:root {
  --bg: #f3f4f6; --panel: #ffffff; --text: #1d2025; --muted: #5f6670; --border: #e1e4e8;
  --case: #2b2e34; --key: #c9cdd3; --key-text: #2b2f36; --key-shadow: #9fa5ae;
  --ok: #2fa84f; --ok-shadow: #1f7a38; --fail: #d93a3a; --fail-shadow: #9e2424;
  --down: #8fe3a5; --accent: #2f6fde; --chip: #eceef1;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15171a; --panel: #1e2125; --text: #e6e8eb; --muted: #9aa1ab; --border: #2e3238;
    --case: #0d0e10; --key: #4a4f57; --key-text: #e8eaed; --key-shadow: #30343a; --chip: #2a2e34;
    --accent: #5b8ff0;
  }
}
:root[data-theme="dark"] {
  --bg: #15171a; --panel: #1e2125; --text: #e6e8eb; --muted: #9aa1ab; --border: #2e3238;
  --case: #0d0e10; --key: #4a4f57; --key-text: #e8eaed; --key-shadow: #30343a; --chip: #2a2e34;
  --accent: #5b8ff0; color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
a { color: var(--accent); }
main { flex: 1 0 auto; width: 100%; max-width: 1400px; margin: 0 auto; padding: 20px 16px 40px; }
h1 { font-size: 26px; margin: 6px 0 4px; line-height: 1.2; }
.lead { color: var(--muted); margin: 0 0 18px; max-width: 70ch; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* Header */
.top { background: var(--panel); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.top .inner { max-width: 1400px; margin: 0 auto; padding: 8px 16px; display: flex; align-items: center; gap: 8px 18px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 17px; color: var(--text); text-decoration: none; }
.brand-sub { font-weight: 500; color: var(--muted); padding-left: 10px; margin-left: 2px; border-left: 1px solid var(--border); white-space: nowrap; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.nav a { color: var(--text); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: 14px; white-space: nowrap; }
.nav a:hover { background: var(--chip); }
.nav a[aria-current] { background: var(--accent); color: #fff; }
.tools { display: flex; gap: 8px; align-items: center; }
@media (max-width: 640px) {
  .top .inner { justify-content: space-between; }
  .nav { order: 3; flex-basis: 100%; justify-content: space-between; }
  .nav a { font-size: 13px; padding: 5px 8px; }
}
@media (max-width: 420px) { .nav a span { display: none; } .nav a { font-size: 20px; flex: 1; text-align: center; } }
.select { font: inherit; font-size: 13px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--border); background: var(--panel); color: var(--text); }

/* Controls */
.toolbar { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; margin-bottom: 16px; }
.group { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.group > span { color: var(--muted); font-size: 13px; }
.seg { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--panel); }
.seg button { border: 0; background: transparent; color: var(--text); padding: 6px 11px; font: inherit; font-size: 13px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--accent); color: #fff; }
.btn { border: 1px solid var(--border); background: var(--panel); color: var(--text); padding: 6px 12px;
  border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer; }
.btn:hover { border-color: var(--accent); }
.btn.big { font-size: 15px; padding: 10px 18px; background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.icon { font-size: 16px; padding: 4px 10px; }
.btn.locked { background: var(--ok); color: #fff; border-color: var(--ok); }
.stats { display: flex; gap: 18px; flex-wrap: wrap; margin-bottom: 12px; font-size: 14px; }
.stats b { font-variant-numeric: tabular-nums; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
@media (max-width: 800px) { .cols { grid-template-columns: 1fr; } }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.card h2 { font-size: 13px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.chip { padding: 3px 9px; border-radius: 6px; background: var(--chip); font: 12px ui-monospace, monospace; }
.chip.ok { background: var(--ok); color: #fff; } .chip.fail { background: var(--fail); color: #fff; }
.log { list-style: none; margin: 0; padding: 0; font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace; max-height: 260px; overflow: auto; }
.log li.bad { color: var(--fail); font-weight: 600; }
ul.tips { margin: 6px 0 0; padding-left: 18px; font-size: 13px; color: var(--muted); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--border); }
.tbl th { font-size: 12px; color: var(--muted); font-weight: 600; }
.tbl tr.ok td:first-child { color: var(--ok); font-weight: 600; }
.tbl tr.fail td { color: var(--fail); font-weight: 600; }

/* Home */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }
.tile { display: flex; flex-direction: column; gap: 4px; padding: 18px; border-radius: 14px; background: var(--panel);
  border: 1px solid var(--border); color: var(--text); text-decoration: none; transition: border-color .15s, transform .15s; }
.tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.tile b { font-size: 18px; }
.tile-icon { font-size: 34px; line-height: 1; margin-bottom: 6px; }

/* Keyboard */
.wrap { position: relative; background: var(--case); border-radius: 14px; padding: 14px; overflow: hidden; }
#kb { position: relative; margin: 0 auto; }
.key { position: absolute; border-radius: calc(var(--u) * 0.12); background: var(--key); color: var(--key-text);
  box-shadow: inset 0 calc(var(--u) * -0.07) 0 var(--key-shadow);
  display: flex; align-items: flex-start; justify-content: flex-start;
  padding: calc(var(--u) * 0.1) calc(var(--u) * 0.13);
  font-size: calc(var(--u) * 0.24); font-weight: 600; line-height: 1.1; user-select: none; cursor: pointer;
  transition: background .12s, transform .05s; overflow: hidden; white-space: nowrap; }
.key.iso-enter { clip-path: polygon(0 0, 100% 0, 100% 100%, 16.67% 100%, 16.67% 50%, 0 50%); }
.key.ok { background: var(--ok); color: #fff; box-shadow: inset 0 calc(var(--u) * -0.07) 0 var(--ok-shadow); }
.key.fail { background: var(--fail); color: #fff; box-shadow: inset 0 calc(var(--u) * -0.07) 0 var(--fail-shadow); }
.key.down { background: var(--down); color: #10361b; transform: translateY(2px); box-shadow: none; }
.key.fail.down { background: #ff8a8a; color: #4a0d0d; }
.key.virtual { outline: 2px dashed rgba(255,255,255,.35); outline-offset: -4px; }
.key.sel { outline: 3px solid var(--accent); outline-offset: 1px; }
.overlay { position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55); color: #fff; font-size: 17px; font-weight: 600; border-radius: 14px; cursor: pointer; text-align: center; padding: 16px; }
.overlay.show { display: flex; }
#detail { font-size: 14px; min-height: 42px; }
#extras { display: flex; flex-wrap: wrap; gap: 6px; }

/* Mouse */
.mouse-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 800px) { .mouse-grid { grid-template-columns: 1fr; } }
.pad { background: var(--case); border-radius: 14px; min-height: 380px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px; padding: 20px; cursor: crosshair; user-select: none; outline: none; touch-action: none; }
.pad-hint { color: #c9cdd3; text-align: center; margin: 0; font-size: 14px; max-width: 40ch; }
.mouse-svg { width: 160px; height: auto; }
.m-body { fill: #3a3e45; stroke: #5a6069; stroke-width: 2; }
.m-btn { fill: #555b64; stroke: #2b2e34; stroke-width: 2; transition: fill .1s; }
.m-wheel { fill: #8a9099; transition: fill .1s; }
.m-btn.ok, .m-wheel.ok { fill: var(--ok); }
.m-btn.fail { fill: var(--fail); }
.m-btn.down, .m-wheel.down { fill: var(--down); }
.cps { display: flex; flex-direction: column; gap: 14px; }
.cps .stats { margin: 0; justify-content: center; font-size: 16px; }
.cps-zone { position: relative; overflow: hidden; width: 100%; min-height: 220px; border: 0; border-radius: 16px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px;
  color: #fff; font: inherit; background: linear-gradient(135deg, #2f6fde, #7b4fe0); box-shadow: 0 6px 20px rgba(47,111,222,.35);
  user-select: none; -webkit-user-select: none; touch-action: manipulation; transition: transform .05s, box-shadow .15s, background .3s; }
.cps-zone:hover { box-shadow: 0 8px 28px rgba(47,111,222,.5); }
.cps-zone:active { transform: scale(.995); }
.cps-zone:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.cps-zone.running { background: linear-gradient(135deg, #e0682f, #d93a6a); box-shadow: 0 6px 24px rgba(217,58,106,.4); }
.cps-zone.done { background: linear-gradient(135deg, #2fa84f, #1f8a7a); box-shadow: 0 6px 20px rgba(47,168,79,.35); }
.cps-main { font-size: clamp(22px, 4vw, 34px); font-weight: 700; line-height: 1.15; font-variant-numeric: tabular-nums; }
.cps-zone.running .cps-main, .cps-zone.done .cps-main { font-size: clamp(40px, 8vw, 64px); }
.cps-sub { font-size: 15px; opacity: .9; }
.cps-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; background: rgba(255,255,255,.2); }
.cps-bar i { display: block; height: 100%; width: 0; background: #fff; }
.cps-zone.pulse .cps-main { animation: cpsPulse .12s ease-out; }
@keyframes cpsPulse { from { transform: scale(1.08); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .cps-zone.pulse .cps-main { animation: none; } }

/* Dodge game */
.game-card { margin-top: 16px; text-align: center; }
.game-card > p { max-width: 75ch; margin-left: auto; margin-right: auto; }
.game-stats { align-items: center; justify-content: center; }
.g-slow { color: #5bc8ff; font-weight: 600; }
.game-wrap { max-width: 960px; margin: 0 auto; }
.game-canvas { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; border-radius: 12px; background: #0e1014;
  border: 2px solid var(--border); touch-action: none; user-select: none; }
.game-canvas.playing { cursor: none; }

/* Gamepad */
.wait { text-align: center; padding: 40px 16px; }
.wait p { margin: 8px 0 0; }
.padcard { margin-bottom: 16px; }
.padhead { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.padhead b { word-break: break-word; }
.padbody { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 16px; }
@media (max-width: 860px) { .padbody { grid-template-columns: 1fr; } }
.pad-svg { width: 100%; height: auto; background: var(--case); border-radius: 14px; }
.pad-svg .shell { fill: #3a3e45; stroke: #5a6069; stroke-width: 2; }
.pad-svg .b { fill: #5c626b; stroke: #25282d; stroke-width: 2; }
.pad-svg .b.ok { fill: var(--ok); }
.pad-svg .b.down { fill: var(--down); }
.pad-svg text { fill: #fff; font: 600 15px system-ui, sans-serif; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.pad-svg .well { fill: #24272c; stroke: #5a6069; stroke-width: 2; }
.pad-svg .dead { fill: none; stroke: rgba(255,255,255,.25); stroke-dasharray: 3 3; }
.pad-svg .trig-bg { fill: #24272c; }
.pad-svg .trig-fill { fill: var(--accent); }
.sticks { display: flex; gap: 16px; flex-wrap: wrap; }
.stick { text-align: center; font: 12px ui-monospace, monospace; }
.stick canvas { background: var(--case); border-radius: 50%; display: block; margin: 0 auto 4px; }
.raw { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.raw .chip.down { background: var(--down); color: #10361b; }
.bar { height: 8px; background: var(--chip); border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); width: 0; }
.axes { font: 12px ui-monospace, monospace; display: grid; grid-template-columns: auto 1fr auto; gap: 4px 8px; align-items: center; }

/* Monitor */
.hz { font-size: 44px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.hz b { font-weight: 700; }
.motion { width: 100%; display: block; background: #000; border-radius: 10px; }
.grads { display: grid; gap: 6px; }
.grad { height: 34px; border-radius: 6px; }
.g-gray { background: linear-gradient(90deg, #000, #fff); }
.g-red { background: linear-gradient(90deg, #000, #f00); }
.g-green { background: linear-gradient(90deg, #000, #0f0); }
.g-blue { background: linear-gradient(90deg, #000, #00f); }
.colorpick { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.colorpick input[type=color] { width: 44px; height: 34px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--panel); cursor: pointer; }
.fs { position: fixed; inset: 0; z-index: 100; cursor: none; }
.fs-hint { position: absolute; left: 50%; bottom: 24px; transform: translateX(-50%); background: rgba(0,0,0,.75); color: #fff;
  padding: 8px 14px; border-radius: 8px; font-size: 14px; transition: opacity .6s; text-align: center; max-width: 90vw; }

/* Ads, affiliate, text */
.ad { margin: 28px 0; text-align: center; }
.ad-label { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.ad-placeholder div { height: 120px; border: 2px dashed var(--border); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.aff { margin-top: 24px; }
.aff ul { margin: 0; padding-left: 18px; }
.aff li { margin: 4px 0; }
.seo, .prose { max-width: 75ch; margin-top: 32px; }
.seo h2, .prose h2 { font-size: 19px; margin: 26px 0 8px; }
.seo h3 { font-size: 16px; margin: 18px 0 4px; }
.seo p, .seo li, .prose p, .prose li { color: var(--text); }
.foot { border-top: 1px solid var(--border); background: var(--panel); margin-top: 40px; }
.foot .inner { max-width: 1400px; margin: 0 auto; padding: 18px 16px; text-align: center; font-size: 13px; }
.foot p { margin: 6px 0; }
.foot a { color: var(--accent); text-decoration: none; }
.foot a:hover { text-decoration: underline; }

/* Testrapport (PDF) */
.report { margin-top: 16px; }
.report-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px 14px; margin: 10px 0 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.field input, .field select { width: 100%; box-sizing: border-box; font-size: 14px; padding: 7px 9px; }
.report-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.btn.big.alt { background: var(--panel); color: var(--text); border-color: var(--accent); }

/* Kjøpe brukt-guider og reklamasjon */
.guide-link { margin: 18px 0 0; font-weight: 600; }
.claim { margin-top: 16px; }
.claim p { margin: 0 0 10px; line-height: 1.5; }
.claim h3 { font-size: 15px; margin: 14px 0 8px; }
.claim-text { width: 100%; box-sizing: border-box; font: 14px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace; resize: vertical; margin-bottom: 10px; }
.guide-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; margin-bottom: 16px; }
.guide-cta p { margin: 0; flex: 1 1 240px; }
.guide-cta .btn { text-decoration: none; }
.checklist { margin: 0; padding-left: 22px; }
.checklist li { margin: 0 0 14px; }
.checklist h3 { font-size: 16px; margin: 0 0 4px; }
.checklist p { margin: 0; line-height: 1.5; }
.guide + .cols { margin-top: 16px; }
.section-title { font-size: 20px; margin: 32px 0 4px; }
.tiles.small .tile { padding: 14px; }
