* { box-sizing: border-box; }

:root {
  --paper: oklch(96.5% 0.012 85);
  --paper-2: oklch(92.5% 0.018 85);
  --ink: oklch(23% 0.02 255);
  --ink-2: oklch(44% 0.02 255);
  --rule: oklch(82% 0.02 85);
  --copper: oklch(66% 0.13 52);
  --copper-ink: oklch(45% 0.11 45);
  --steel: oklch(87% 0.008 250);
  --good: oklch(50% 0.13 150);
  --warn: oklch(58% 0.13 70);
  --bad: oklch(52% 0.19 28);
  --cold: oklch(60% 0.11 245);
  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --body: "Figtree", "Segoe UI", sans-serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
}

html, body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 17px;
  line-height: 1.5;
}
body { min-height: 100dvh; }

button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--copper); outline-offset: 2px; }
a { color: var(--copper-ink); text-underline-offset: 3px; }
kbd {
  font-family: var(--body); font-size: .85em; font-weight: 700;
  border: 1.5px solid var(--ink); border-bottom-width: 3px; border-radius: 4px; padding: 0 6px;
}

.screen {
  display: none;
  flex-direction: column;
  max-width: 640px;
  margin: 0 auto;
  padding: clamp(16px, 4vw, 32px) 16px 16px;
  min-height: 100dvh;
}
.screen.active { display: flex; }

.kicker {
  font-family: var(--display); font-weight: 600; font-size: 15px;
  letter-spacing: .16em; text-transform: uppercase; color: var(--copper-ink);
  margin: 0;
}
.lede { color: var(--ink-2); max-width: 34em; margin: 0; }

/* ---- knappar ---- */
.textbtn {
  background: none; border: 0; padding: 8px 0; color: var(--ink-2);
  font-weight: 700; align-self: flex-start;
}
.textbtn:hover { color: var(--ink); }
.key {
  border: 2px solid var(--ink); border-radius: 6px; background: var(--paper);
  box-shadow: 0 4px 0 var(--ink); padding: 12px 18px;
  font-family: var(--display); font-weight: 800; font-size: 22px;
  text-transform: uppercase; letter-spacing: .04em;
  transition: transform .08s var(--ease), box-shadow .08s var(--ease);
}
.key:active { transform: translateY(4px); box-shadow: 0 0 0 var(--ink); }
.key.primary { background: var(--copper); }

/* ---- meny ---- */
.brand { margin-bottom: clamp(24px, 6vw, 40px); }
.brand h1 {
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(52px, 15vw, 96px); line-height: 1.02; letter-spacing: -.005em;
  margin: 0 0 14px;
}
.toc { list-style: none; margin: 0; padding: 0; border-top: 2px solid var(--ink); }
.toc li { border-bottom: 1px solid var(--rule); }
.lv {
  width: 100%; display: grid; grid-template-columns: 2.4em 1fr auto; align-items: baseline;
  column-gap: 10px; background: none; border: 0; padding: 16px 0; text-align: left;
}
.lv:hover .lv-name { color: var(--copper-ink); }
.lv-num { font-family: var(--display); font-weight: 800; font-size: 34px; line-height: 1; color: var(--copper); }
.lv-name {
  display: block; font-family: var(--display); font-weight: 800; font-size: 26px;
  text-transform: uppercase; line-height: 1.05;
}
.lv-sub { display: block; color: var(--ink-2); font-size: 15px; margin-top: 2px; }
.lv-stars { color: var(--copper-ink); letter-spacing: 3px; font-size: 15px; }
.credit { margin-top: auto; padding-top: 40px; color: var(--ink-2); font-size: 14px; }
.credit p { margin: 10px 0 0; }
.starlink {
  display: block; border: 2px solid var(--ink); border-radius: 6px; padding: 12px 14px;
  font-size: 16px; font-weight: 700; color: var(--ink); text-decoration: none; background: var(--paper-2);
}
.starlink:hover { background: var(--copper); }
.keys { list-style: none; padding: 0; margin: 0 0 20px; }
.keys li { padding: 6px 0; }

.basics { margin-top: 18px; }

/* ---- teori ---- */
#teori p { margin: 0 0 10px; max-width: 36em; }
#teori ul { margin: 0 0 10px; padding-left: 1.1em; max-width: 36em; }
#teori li { margin: 6px 0; }
#teori h2 { margin-top: 14px; }
.joints { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 10px 0; }
.joints figure { margin: 0; }
.joints svg {
  display: block; width: 100%; height: auto; background: #efe9dc;
  border: 1.5px solid var(--ink); border-radius: 4px;
}
.joints figcaption { font-size: 14px; margin-top: 6px; color: var(--ink-2); }
.joints figcaption b { color: var(--ink); }
#startFirst { width: 100%; margin: 22px 0 10px; padding: 16px; font-size: 24px; }

/* ---- intro ---- */
#intro h2, #teori h2 {
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(44px, 12vw, 68px); line-height: 1.05; margin: 2px 0 12px;
}
#intro h3, #teori h3 {
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  font-size: 22px; margin: 28px 0 6px; padding-top: 12px; border-top: 2px solid var(--ink);
}
#introKicker { margin-top: 18px; }
.steps { list-style: none; counter-reset: s; padding: 0; margin: 0 0 18px; }
.steps li {
  counter-increment: s; display: grid; grid-template-columns: 1.6em 1fr; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--rule);
}
.steps li::before {
  content: counter(s); font-family: var(--display); font-weight: 800; font-size: 24px;
  line-height: 1.1; color: var(--copper);
}
#startBtn { margin-top: auto; width: 100%; padding: 16px; font-size: 26px; }

.choose { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.chips > span {
  display: block; font-family: var(--display); font-weight: 600; text-transform: uppercase;
  letter-spacing: .12em; font-size: 14px; color: var(--ink-2); margin-bottom: 6px;
}
.seg { display: flex; border: 2px solid var(--ink); border-radius: 6px; overflow: hidden; }
.chip {
  flex: 1; background: var(--paper); border: 0; padding: 10px 8px; font-weight: 700;
}
.chip + .chip { border-left: 2px solid var(--ink); }
.chip.on { background: var(--ink); color: var(--paper); }

/* ---- spelet ---- */
#game { gap: 10px; padding-top: 8px; }
.topbar { display: flex; align-items: center; gap: 12px; }
.topbar .textbtn:first-child { font-size: 22px; padding: 4px 8px 4px 0; }
.gtitle {
  flex: 1; font-family: var(--display); font-weight: 800; font-size: 20px;
  text-transform: uppercase; letter-spacing: .02em;
}
#stage {
  width: 100%; height: auto; max-height: 48dvh; display: block;
  border: 2px solid var(--ink); border-radius: 6px; touch-action: none;
}
.callout text {
  font-family: var(--display); font-weight: 800; font-size: 7px; letter-spacing: .08em; fill: #2a3140;
}
.callout text.onboard { fill: #d9ecdf; }

.gauges { display: flex; flex-direction: column; gap: 6px; }
.gauges.hidden { display: none; }
.gauge { display: grid; grid-template-columns: 6.6em 1fr 4.2em; align-items: center; gap: 10px; }
.gauge .lbl {
  font-family: var(--display); font-weight: 600; font-size: 14px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--ink-2);
}
.gauge .val { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.bar {
  position: relative; height: 14px; border: 1.5px solid var(--ink); border-radius: 3px; overflow: hidden;
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(25% - 1px), var(--rule) calc(25% - 1px) 25%),
    var(--paper-2);
}
.fill { position: absolute; inset: 0 auto 0 0; width: 0; background: var(--cold); }
.fill.flux { background: var(--copper); }
.zone.hot {
  position: absolute; top: 0; bottom: 0; left: 72.5%; right: 0;
  background: repeating-linear-gradient(45deg, oklch(52% 0.19 28 / .28) 0 3px, transparent 3px 7px);
}
.mark { position: absolute; top: -2px; bottom: -2px; width: 2px; background: var(--ink); }
.mark.wet { background: var(--good); width: 3px; }

.statusrow { display: flex; align-items: baseline; gap: 12px; min-height: 52px; }
.hint { flex: 1; font-weight: 700; }
.hint.ok { color: var(--good); }
.hint.warn { color: var(--warn); }
.hint.bad { color: var(--bad); }
.controls { display: flex; gap: 14px; margin-top: auto; padding-bottom: 6px; }
.hold {
  flex: 1; height: clamp(108px, 17dvh, 150px);
  border: 2px solid var(--ink); border-radius: 8px; box-shadow: 0 6px 0 var(--ink);
  font-family: var(--display); font-weight: 800; font-size: 34px; text-transform: uppercase; letter-spacing: .04em;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; touch-action: none;
  transition: transform .06s var(--ease), box-shadow .06s var(--ease), background-color .1s;
}
.hold small { font-family: var(--body); font-size: 13px; font-weight: 700; letter-spacing: .04em; text-transform: none; opacity: .7; }
.hold small.k { display: none; }
.keys-mode .hold small.k { display: block; }
.keys-mode .hold small.t { display: none; }
.hold.iron { background: var(--copper); }
.hold.feed { background: var(--steel); }
.hold.on { transform: translateY(6px); box-shadow: 0 0 0 var(--ink); }
.hold.iron.on { background: oklch(58% 0.17 40); }
.hold.feed.on { background: oklch(80% 0.01 250); }

/* ---- resultat (ersätter kontrollerna) ---- */
#game.done .controls, #game.done .statusrow { display: none; }
.result { border-top: 2px solid var(--ink); padding-top: 14px; margin-top: auto; }
.result.hidden { display: none; }
.verdict { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stamp {
  display: inline-block; font-family: var(--display); font-weight: 800; font-size: 30px;
  letter-spacing: .08em; text-transform: uppercase; padding: 0 12px;
  border: 3px solid currentColor; border-radius: 4px; transform: rotate(-5deg);
  animation: stamp .32s var(--ease) both;
}
.stamp.good { color: var(--good); }
.stamp.bad { color: var(--copper-ink); }
.stars { color: var(--copper-ink); font-size: 24px; letter-spacing: 4px; }
.result h2 {
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  font-size: 30px; line-height: 1; margin: 14px 0 6px;
}
.result p { margin: 0 0 8px; }
.notes { padding-left: 1.1em; margin: 0 0 8px; }
.notes li { margin: 4px 0; }
.row { display: flex; gap: 12px; margin-top: 14px; padding-bottom: 10px; }
.row .key { flex: 1; }

@keyframes stamp {
  from { opacity: 0; transform: rotate(-5deg) scale(1.7); }
  to { opacity: 1; transform: rotate(-5deg) scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .stamp { animation: none; }
  .key, .hold { transition: none; }
}
