/* Glömskan — ink, fog and one warm ember for named things. */
:root {
  --ink: #0b0d10;
  --ink-2: #13161b;
  --ink-3: #1b1f26;
  --fog: #8e98a3;
  --fog-dim: #58616b;
  --bone: #e8e2d4;
  --bone-dim: #b9b2a3;
  --ember: #e6a55a;
  --ember-glow: rgba(230, 165, 90, 0.35);
  --rust: #d0735a;
  --slate: #86a8bd;
  --display: 'IM Fell English', 'Iowan Old Style', Georgia, serif;
  --text: 'Spectral', Georgia, serif;
  --radius: 3px;
  --gutter: clamp(16px, 4vw, 40px);
}

* { box-sizing: border-box; }

html, body { margin: 0; min-height: 100%; }

body {
  background: radial-gradient(ellipse at 50% 30%, #161a20 0%, var(--ink) 70%) fixed, var(--ink);
  color: var(--bone);
  font-family: var(--text);
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

#fog { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; }

.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.08; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

#app { position: relative; z-index: 2; min-height: 100vh; padding: var(--gutter); max-width: 1100px; margin: 0 auto; }

.loading { font-family: var(--display); font-style: italic; color: var(--fog); text-align: center; margin-top: 40vh; }

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 1px solid var(--ember); outline-offset: 3px; }

.primary {
  background: transparent; border: 1px solid var(--ember); color: var(--ember);
  padding: 0.7em 1.8em; border-radius: var(--radius); letter-spacing: 0.06em;
  font-variant: small-caps; font-size: 1.05rem;
  transition: background 0.25s, color 0.25s, box-shadow 0.25s;
}
.primary:hover, .primary:focus-visible { background: var(--ember); color: var(--ink); box-shadow: 0 0 28px var(--ember-glow); }

.link { background: none; border: none; color: var(--fog); text-decoration: underline; text-underline-offset: 3px; padding: 0.6em 0.2em; min-height: 44px; font-size: 0.95rem; }
.link:hover { color: var(--bone); }

.warning { color: var(--rust); font-style: italic; max-width: 34em; }
.note { color: var(--bone-dim); font-style: italic; }

/* ——— Title ——— */
.title-screen { position: relative; min-height: calc(100vh - 2 * var(--gutter)); display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 1.1rem; padding-left: clamp(0px, 6vw, 80px); }
/* Full-bleed painting behind the title text. Negative z-index keeps it under the (static,
   in-flow) text without touching the text's own stacking — see .title-scrim below for why the
   ordering between the two negative layers is pinned by distinct values, not DOM order. */
.title-art { position: fixed; inset: auto 0 0 0; width: 100%; height: 100vh; object-fit: cover; object-position: bottom; mix-blend-mode: screen; opacity: 0.9; z-index: -2; pointer-events: none; }
/* A soft pool of shadow behind the text: radial and oversized so it has no visible edge. */
.title-scrim { position: absolute; inset: -30vh -45vw -30vh -45vw; z-index: -1; pointer-events: none; background: radial-gradient(ellipse 38% 46% at 42% 48%, rgba(11, 13, 16, 0.86) 0%, rgba(11, 13, 16, 0.6) 45%, transparent 78%); }
.title-word { font-family: var(--display); font-weight: 400; font-size: clamp(3.6rem, 14vw, 9.5rem); line-height: 0.9; margin: 0; letter-spacing: -0.01em; }
.title-word span { display: inline-block; animation: erode 9s ease-in-out infinite; animation-delay: calc(var(--i) * -1.3s); }
@keyframes erode {
  0%, 70%, 100% { opacity: 1; filter: blur(0); transform: none; }
  82% { opacity: 0.25; filter: blur(3px); transform: translateY(-4px); }
}
.tagline { font-family: var(--display); font-style: italic; font-size: clamp(1.1rem, 3vw, 1.45rem); color: var(--bone-dim); margin: 0; }
.stats { color: var(--fog); font-variant: small-caps; letter-spacing: 0.05em; margin: 0.4rem 0 1.2rem; }
.hint { color: var(--fog); font-size: 0.85rem; margin-top: 2.5rem; }

/* ——— Level picker ——— */
.levels-screen { min-height: calc(100vh - 2 * var(--gutter)); display: flex; flex-direction: column; justify-content: center; gap: 1.3rem; padding-left: clamp(0px, 6vw, 80px); }
.levels-screen h1 { font-family: var(--display); font-weight: 400; font-size: clamp(2.2rem, 7vw, 3.6rem); margin: 0; }
.levels-screen .lede { color: var(--bone-dim); font-style: italic; margin: 0; max-width: 40em; }
.level-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0.9rem; }
.level-card {
  text-align: left; display: flex; flex-direction: column; min-height: 44px; padding: 0;
  background: linear-gradient(170deg, var(--ink-3), var(--ink-2)); border: 1px solid rgba(232, 226, 212, 0.14);
  border-radius: var(--radius); overflow: hidden; opacity: 0; animation: deal 0.45s ease forwards; animation-delay: calc(var(--n) * 70ms);
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.level-card:hover, .level-card:focus-visible { transform: translateY(-4px); border-color: var(--ember); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4), 0 0 20px var(--ember-glow); }
/* overflow: hidden on .level-card (above) clips this to the card's own rounded corners. */
.level-art { width: 100%; height: 120px; object-fit: cover; display: block; mix-blend-mode: screen;
  mask-image: radial-gradient(ellipse 70% 75% at center, black 55%, transparent 100%); -webkit-mask-image: radial-gradient(ellipse 70% 75% at center, black 55%, transparent 100%); }
.level-card-body { display: flex; flex-direction: column; gap: 0.5rem; padding: 1rem 1.1rem; }
.level-top { display: flex; align-items: baseline; gap: 0.6rem; }
.level-key { color: var(--fog); font-variant: small-caps; letter-spacing: 0.08em; }
.level-name { font-family: var(--display); font-size: 1.4rem; color: var(--ember); }
.level-desc { color: var(--bone-dim); margin: 0; font-size: 0.92rem; }
.level-examples-lede { margin: 0.4rem 0 0.1rem; color: var(--fog); font-style: italic; font-size: 0.85rem; }
.level-words { font-family: var(--display); font-size: 1.05rem; margin: 0; color: var(--bone); }
.change-level { margin-top: 0.2rem; }

/* ——— Placement test ——— */
.placement-screen { min-height: calc(100vh - 2 * var(--gutter)); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 0.7rem; }
.placement-progress { color: var(--fog); font-variant: small-caps; letter-spacing: 0.08em; font-variant-numeric: tabular-nums; margin: 0; }
.placement-ask { color: var(--bone-dim); font-style: italic; margin: 0; }
.placement-word { font-family: var(--display); font-size: clamp(2.4rem, 9vw, 4rem); margin: 0.1em 0 0.6em; color: var(--bone); }
.placement-buttons, .placement-result-buttons { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.placement-buttons button { min-width: 9rem; min-height: 44px; }
.secondary { background: none; border: 1px solid var(--fog-dim); color: var(--bone-dim); padding: 0.7em 1.8em; border-radius: var(--radius); font-variant: small-caps; letter-spacing: 0.06em; font-size: 1.05rem; min-height: 44px; }
.secondary:hover, .secondary:focus-visible { border-color: var(--bone); color: var(--bone); }
.placement-buttons .key { font-family: var(--text); font-size: 0.75rem; opacity: 0.75; margin-right: 0.4em; }
.placement-result h2 { font-family: var(--display); font-weight: 400; font-size: clamp(1.8rem, 6vw, 2.8rem); margin: 0; }

/* ——— Combat ——— */
.combat { display: grid; gap: 1.2rem; }
/* The encounter's backdrop, fixed behind the whole screen. Base opacity 0 + an animation to the
   real 0.3 (rather than animating 0.3 → 0.3, a no-op) so `.still`/reduced-motion — which strip
   the animation, not override it — need one explicit fallback rule each, same pattern as .card. */
.encounter-bg { position: fixed; inset: 0; width: 100vw; height: 100vh; object-fit: cover; z-index: -2; mix-blend-mode: screen; pointer-events: none; opacity: 0; animation: bg-fade-in 1.8s ease forwards; }
@keyframes bg-fade-in { to { opacity: 0.3; } }
.enemy { position: relative; text-align: center; padding-top: 2vh; }
/* Behind the enemy's name (z-index -1, see .enemy-name below), not in the flow — so it never
   pushes the hand of cards down. Health drives its opacity/blur inline (art.js has no runtime
   state to read at render time; combat.js computes it from combat.enemy.hp/maxHp each render). */
/* The generated "black" is not perfectly black, so a radial mask feathers the portrait into the
   page instead of leaving a faint box. */
.portrait { position: absolute; top: 48%; left: 50%; transform: translate(-50%, -50%); height: 400px; max-height: 50vh; width: auto; max-width: 92%; z-index: -1; mix-blend-mode: screen; transition: opacity 1.2s ease, filter 1.2s ease; pointer-events: none;
  mask-image: radial-gradient(closest-side, black 45%, transparent 100%); -webkit-mask-image: radial-gradient(closest-side, black 45%, transparent 100%); }
.encounter-count { position: relative; color: var(--fog); font-variant: small-caps; letter-spacing: 0.12em; margin: 0; text-shadow: 0 0 6px var(--ink), 0 0 6px var(--ink), 0 0 14px var(--ink), 0 0 24px var(--ink); }
.intent { text-shadow: 0 0 6px var(--ink), 0 0 6px var(--ink), 0 0 14px var(--ink), 0 0 24px var(--ink); }
.enemy-name { position: relative; font-family: var(--display); font-weight: 400; font-size: clamp(2.6rem, 10vw, 6rem); margin: 0.1em 0 0.25em; line-height: 1; color: var(--bone); text-shadow: 0 0 40px rgba(142, 152, 163, 0.25); }
.enemy-name.boss { color: #d9d2c3; font-size: clamp(2.4rem, 9vw, 5.4rem); }
.enemy-name span { display: inline-block; transition: opacity 1.2s ease, filter 1.2s ease, transform 1.2s ease; animation: breathe 5s ease-in-out infinite; animation-delay: calc(var(--i) * 0.35s); }
.enemy-name span.gone { opacity: 0.07; filter: blur(6px); transform: translateY(-10px) rotate(-6deg); animation: none; }
@keyframes breathe { 50% { transform: translateY(-3px); opacity: 0.85; } }
.intent { color: var(--rust); font-variant: small-caps; letter-spacing: 0.06em; margin: 0.6rem 0 0; }
.enemy-block { color: var(--slate); }

.meter { display: grid; grid-template-columns: 3.5em 1fr 4.5em; align-items: center; gap: 0.7em; max-width: 440px; margin: 0 auto; font-size: 0.85rem; color: var(--fog); }
.meter-bar { height: 4px; background: var(--ink-3); position: relative; overflow: hidden; }
.meter-bar span { position: absolute; inset: 0 auto 0 0; transition: width 0.6s ease; }
.enemy-hp .meter-bar span { background: var(--bone-dim); }
.player-hp .meter-bar span { background: var(--ember); }
/* The pale "chip" left behind when a hit drains the bar; it catches up a moment later
   (src/ui/ink-fx.js drainMeter). Drawn before the fill in the DOM, so the fill covers it. */
.enemy-hp .meter-bar .meter-chip { background: rgba(240, 206, 190, 0.85); }
.player-hp .meter-bar .meter-chip { background: rgba(244, 236, 220, 0.85); }
.meter-value { text-align: right; font-variant-numeric: tabular-nums; }

/* ——— Impacts (src/ui/impact-fx.js) ———
   Every piece starts invisible and is revealed only by its Web Animation, so a browser that
   cannot run one shows nothing extra rather than a stuck number. */
.player, .player-row, .hand { position: relative; }
.ink-number { position: absolute; z-index: 3; transform: translateX(-50%); font-family: var(--display); line-height: 1; white-space: nowrap; pointer-events: none; opacity: 0;
  text-shadow: 0 0 3px var(--ink), 0 0 10px var(--ink), 0 0 22px rgba(11, 13, 16, 0.9); }
.ink-number.dealt { color: var(--bone); text-shadow: 0 0 3px var(--ink), 0 0 10px var(--ink), 0 0 30px rgba(208, 115, 90, 0.5); }
.ink-number.taken { color: #cf5a44; text-shadow: 0 0 3px var(--ink), 0 0 12px var(--ink), 0 0 26px rgba(160, 30, 20, 0.55); }
.ink-number.blocked { color: var(--fog); font-family: var(--text); font-style: italic; letter-spacing: 0.02em; }
/* Tänd/Våga abilities: named in ember small caps under their number. */
.ink-number.ability { color: var(--ember); font-family: var(--text); font-variant: small-caps; letter-spacing: 0.1em;
  text-shadow: 0 0 3px var(--ink), 0 0 10px var(--ink), 0 0 20px var(--ember-glow); }
/* Genomslag's crack: one jagged ink stroke across the name, drawn left to right, then gone. */
.ink-crack { position: absolute; left: 14%; width: 72%; height: 70px; z-index: 2; pointer-events: none; opacity: 0; overflow: visible; }
.ink-crack path { fill: none; stroke: var(--bone); stroke-width: 2.2; stroke-linejoin: miter; vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 4px rgba(230, 165, 90, 0.8)) drop-shadow(0 0 1px var(--ink)); }
/* An ability waking on the player's side: warm light welling up behind the row or the hand. */
.ember-pulse { position: absolute; inset: -10px -14px; z-index: 0; pointer-events: none; opacity: 0; border-radius: 40%; mix-blend-mode: screen;
  background: radial-gradient(ellipse at center, rgba(230, 165, 90, 0.45) 0%, rgba(230, 165, 90, 0.16) 45%, transparent 72%); }
.enemy-name span.ink-ghost { position: absolute; display: block; opacity: 0; pointer-events: none; animation: none; transition: none; }
.ink-ash { position: absolute; width: 5px; height: 5px; margin: -2.5px 0 0 -2.5px; border-radius: 50%; opacity: 0; pointer-events: none;
  background: radial-gradient(circle, rgba(214, 208, 196, 0.95) 0%, rgba(142, 152, 163, 0.5) 45%, transparent 72%); }
/* Red ink seeping in from the screen's edges: a pulse when hurt (.ink-vignette), a faint steady
   stain at low health (.wound-vignette). Above the game, below the answer sheet. */
.ink-vignette, .wound-vignette { position: fixed; inset: 0; z-index: 5; pointer-events: none; opacity: 0;
  background:
    radial-gradient(ellipse 80% 72% at 48% 46%, transparent 52%, rgba(120, 20, 12, 0.34) 80%, rgba(70, 6, 4, 0.8) 100%),
    radial-gradient(ellipse 95% 60% at 55% 58%, transparent 60%, rgba(96, 12, 8, 0.4) 100%); }
.wound-vignette { transition: opacity 1.4s ease; }
.wound-vignette.on { opacity: 0.3; animation: wound-throb 1.6s ease-in-out infinite; }
@keyframes wound-throb { 0%, 100% { opacity: 0.26; } 12% { opacity: 0.4; } 26% { opacity: 0.3; } 36% { opacity: 0.36; } }

.log { min-height: 1.6em; text-align: center; font-style: italic; color: var(--bone-dim); margin: 0; }

.player { display: grid; gap: 0.7rem; border-top: 1px solid rgba(232, 226, 212, 0.08); padding-top: 1rem; }
.player .meter { margin: 0; max-width: none; }
.player-row { display: flex; align-items: center; gap: 1.1rem; flex-wrap: wrap; }
.energy { display: inline-flex; gap: 6px; }
.energy i { width: 12px; height: 12px; border-radius: 50%; border: 1px solid var(--ember); display: block; }
.energy i.on { background: var(--ember); box-shadow: 0 0 10px var(--ember-glow); }
.player-block { color: var(--slate); font-variant: small-caps; }
.boost { color: var(--ember); font-variant: small-caps; }
.end-turn { margin-left: auto; background: none; border: 1px solid var(--fog-dim); color: var(--bone-dim); padding: 0.45em 1.1em; border-radius: var(--radius); font-variant: small-caps; letter-spacing: 0.05em; }
.end-turn:hover { border-color: var(--bone); color: var(--bone); }

.tag { font-size: 0.72rem; font-variant: small-caps; letter-spacing: 0.08em; color: var(--ember); }

/* ——— Answer sheet ——— */
#overlay { position: fixed; inset: 0; z-index: 10; display: grid; place-items: end center; background: rgba(6, 7, 9, 0.72); backdrop-filter: blur(3px); padding: var(--gutter) 16px; overflow-y: auto; }
#overlay[hidden] { display: none; }
.sheet { width: min(640px, 100%); background: linear-gradient(175deg, #1a1e25, #111418); border: 1px solid rgba(232, 226, 212, 0.16); border-radius: var(--radius); padding: clamp(1.2rem, 4vw, 2.2rem); box-shadow: 0 -20px 60px rgba(0, 0, 0, 0.5); animation: rise 0.35s ease; margin-bottom: 4vh; }
@keyframes rise { from { transform: translateY(30px); opacity: 0; } }
.sheet-kind { margin: 0; color: var(--fog); font-variant: small-caps; letter-spacing: 0.12em; font-size: 0.85rem; }
.ask { margin: 0.8rem 0 0.2rem; color: var(--fog); font-style: italic; }
.clue { font-family: var(--display); font-size: clamp(1.4rem, 4.5vw, 2rem); line-height: 1.25; margin: 0; }
.lemma { color: var(--ember); font-family: var(--display); font-size: 1.3rem; margin: 0.3rem 0 0; }
.cloze-hint { margin: 0.6rem 0 0; color: var(--fog); font-size: 0.95rem; line-height: 1.4; }
.cloze-hint-label { font-variant: small-caps; letter-spacing: 0.08em; }
.answer-form { margin-top: 1.4rem; display: grid; gap: 0.8rem; }
.hint-line { margin: 0; color: var(--fog); font-size: 0.9rem; }
.answer-input { width: 100%; background: transparent; border: none; border-bottom: 1px solid var(--fog-dim); color: var(--ember); font-family: var(--display); font-size: clamp(1.8rem, 6vw, 2.6rem); padding: 0.1em 0; caret-color: var(--ember); }
.answer-input:focus { outline: none; border-bottom-color: var(--ember); }
.answer-input::placeholder { color: var(--fog-dim); font-style: italic; }
.letters { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.letter { width: 2.75rem; height: 2.75rem; background: var(--ink-3); border: 1px solid rgba(232, 226, 212, 0.18); border-radius: var(--radius); font-family: var(--display); font-size: 1.3rem; }
.letter:hover { border-color: var(--ember); color: var(--ember); }
.letters .primary { margin-left: auto; }
.options { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0.6rem; margin-top: 1.4rem; }
.option { text-align: left; background: var(--ink-3); border: 1px solid rgba(232, 226, 212, 0.14); border-radius: var(--radius); padding: 0.8rem 1rem; font-family: var(--display); font-size: 1.35rem; display: flex; gap: 0.8rem; align-items: baseline; }
.option:hover, .option:focus-visible { border-color: var(--ember); color: var(--ember); }
.option .key { font-family: var(--text); font-size: 0.8rem; color: var(--fog); }
.sheet-links { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-top: 1.2rem; }
/* Waiting for Jev: a quiet pulse on the status line; disabled controls dim so the wait reads as one. */
.judging { margin: 1rem 0 0; color: var(--fog); font-style: italic; animation: judging-pulse 1.6s ease-in-out infinite; }
.sheet[aria-busy="true"] :disabled { opacity: 0.55; cursor: wait; }
@keyframes judging-pulse { 50% { opacity: 0.45; } }

.feedback { text-align: center; }
.verdict { font-variant: small-caps; letter-spacing: 0.14em; margin: 0; color: var(--fog); }
.feedback.good .verdict { color: var(--ember); }
.feedback.bad .verdict { color: var(--rust); }
.judged-by { font-size: 0.85rem; margin-top: 0.2rem; }
.named-word { font-family: var(--display); font-size: clamp(2.6rem, 10vw, 4rem); margin: 0.1em 0; line-height: 1.1; }
.feedback.good .named-word { color: var(--ember); text-shadow: 0 0 30px var(--ember-glow); animation: kindle 0.9s ease; }
.feedback.bad .named-word { color: var(--bone-dim); }
.listen { font-family: var(--text); font-size: 0.9rem; vertical-align: middle; margin-left: 0.4em; background: none; border: 1px solid rgba(232, 226, 212, 0.24); border-radius: 999px; color: var(--fog); padding: 0.3em 0.8em; min-height: 36px; }
.listen:hover, .listen:focus-visible { border-color: var(--ember); color: var(--ember); }
@keyframes kindle { from { opacity: 0; filter: blur(8px); letter-spacing: 0.2em; } }
.definition { color: var(--bone-dim); font-style: italic; margin: 0.4rem 0; }
.example { font-family: var(--display); font-size: 1.2rem; margin: 0.8rem 0; }
.example mark { background: none; color: var(--ember); border-bottom: 1px solid var(--ember); }
.effect { color: var(--fog); font-variant: small-caps; letter-spacing: 0.06em; margin: 0.4rem 0 1.4rem; }

/* ——— Interlude & summary ——— */
.interlude, .summary { min-height: calc(100vh - 2 * var(--gutter)); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; gap: 0.6rem; }
/* A wide banner faded into the page: a single radial mask softens all four edges at once,
   rather than needing two gradients composited together for width and height separately. */
.scene-banner { width: min(720px, 100%); max-height: 220px; object-fit: cover; margin: 0 auto 0.4rem; display: block; mix-blend-mode: screen; mask-image: radial-gradient(ellipse 62% 68% at center, black 50%, transparent 100%); -webkit-mask-image: radial-gradient(ellipse 62% 68% at center, black 50%, transparent 100%); }
.defeated { font-family: var(--display); font-size: clamp(2rem, 7vw, 3.6rem); margin: 0; }
.rest, .next { color: var(--bone-dim); font-style: italic; margin: 0; }
.next { margin-bottom: 1.6rem; }
.summary h2 { font-family: var(--display); font-weight: 400; font-size: clamp(2rem, 7vw, 3.4rem); margin: 0; }
.lede { color: var(--bone-dim); font-style: italic; margin: 0 0 1rem; }
.lists { display: flex; gap: clamp(1.5rem, 6vw, 4rem); flex-wrap: wrap; justify-content: center; }
.word-list h3 { font-weight: 400; font-variant: small-caps; letter-spacing: 0.1em; font-size: 0.95rem; color: var(--fog); margin: 0 0 0.4rem; }
.word-list ul { list-style: none; padding: 0; margin: 0; font-family: var(--display); font-size: 1.35rem; }
.word-list.kept li { color: var(--ember); }
.word-list.lost li { color: var(--fog); text-decoration: line-through; text-decoration-color: rgba(142, 152, 163, 0.4); }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .end-turn { margin-left: 0; width: 100%; }
  .title-screen { padding-left: 0; }
  /* Anchor near the top: on-screen keyboards grow from the bottom and can hide the submit row. */
  #overlay { place-items: start center; }
  .levels-screen { padding-left: 0; }
  .level-grid { grid-template-columns: 1fr; }
  .level-art { height: 96px; }
  .placement-buttons, .placement-result-buttons { flex-direction: column; width: 100%; }
  .placement-buttons button, .placement-result-buttons button { width: 100%; }
  .portrait { height: 170px; top: 40%; }
  .scene-banner { max-height: 140px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .card { opacity: 1; }
  .encounter-bg { opacity: 0.3; }
  .wound-vignette.on { opacity: 0.16; }
}

/* The player's own "Minska rörelse" choice, set on <html> by src/ui/motion.js. */
.still *, .still *::before, .still *::after { animation: none !important; transition: none !important; }
.still .card { opacity: 1; }
.still .encounter-bg { opacity: 0.3; }
.still .wound-vignette.on { opacity: 0.16; }
.motion-toggle { margin-top: 0.4rem; font-size: 0.85rem; }
.sound-toggles { display: flex; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.2rem; }
.sound-toggles .sound-toggle { margin-top: 0; font-size: 0.85rem; padding: 0.4em 0.1em; }

/* ——— Tänd and Våga (climb spec §3; Tänd was Glöd, deckbuilder spec §13) ———
   A lit card (Tänd) wears an ember rim that breathes slowly (styles/cards.css); the Våga toggle
   beside "Avsluta draget" shares the ember. The motion rules above strip the
   breathing for reduced motion and "Minska rörelse", leaving the rim itself. */
@keyframes ember-breathe { 50% { opacity: 1; } }
.dare-toggle { background: none; border: 1px solid var(--ember); color: var(--ember); padding: 0.45em 1.1em; border-radius: var(--radius); font-variant: small-caps; letter-spacing: 0.05em; }
.dare-toggle:hover, .dare-toggle.on { background: var(--ember); color: var(--ink); box-shadow: 0 0 18px var(--ember-glow); }
.player-motstot { color: var(--ember); font-variant: small-caps; }
.ability-note { color: var(--ember); font-variant: small-caps; letter-spacing: 0.06em; margin: 0.2rem 0 0; }
.ability-flash { font-family: var(--display); font-size: clamp(1.4rem, 5vw, 2rem); color: var(--ember); text-shadow: 0 0 24px var(--ember-glow); margin: 0.2rem 0 0; animation: kindle 0.9s ease; }

/* ——— The snap (deckbuilder spec §8) ———
   The canvas sits over the page while the shattered card turns to ash (src/ui/shatter.js). The
   ghost is the shattered card shown once more where it sat, already dealt, so it needs no deal-in. */
/* Under #overlay (10), so an answer sheet opened during the snap is never covered by ash. */
.shatter-canvas { position: fixed; z-index: 6; pointer-events: none; }

.fallback-note { margin: 0.25rem 0 0; font-size: 0.85rem; color: var(--bone-dim); font-style: italic; }

/* ——— Help taken (code review, finding 1): a card weakened by recognition mode ———
   The sheet's card dims, ink bleeds from its frame (src/ui/degrade-fx.js) and a thin crack stays
   across it; in hand, a card holding such a word keeps a fainter crack. Under reduced motion only
   the dim and the number change (the crack is not drawn). */
.sheet-card { position: relative; padding: 0.5rem 0.7rem; margin: -0.5rem -0.7rem 0.4rem; border-radius: var(--radius); transition: opacity 0.4s ease, filter 0.4s ease; }
.sheet-effect { margin: 0.2rem 0 0; font-family: var(--display); font-size: 1.05rem; color: var(--bone-dim); display: inline-block; }
.sheet-card.degraded .sheet-kind, .sheet-card.degraded .sheet-effect { opacity: 0.62; filter: saturate(0.6); }
.ink-crack-mark { position: absolute; left: 6%; top: 30%; width: 88%; height: 40%; pointer-events: none; overflow: visible; }
.ink-crack-mark path { fill: none; stroke: var(--bone); stroke-width: 1.4; opacity: 0.7; vector-effect: non-scaling-stroke; }
.degrade-note, .dare-note { margin: 0.2rem 0 0; font-size: 0.85rem; color: var(--bone-dim); font-style: italic; }

/* Every card shattered: only ending the turn is left (src/ui/screens/combat.js). */
.end-turn.urgent { border-color: var(--ember); color: var(--ember); box-shadow: 0 0 16px var(--ember-glow); }
.log.stranded { color: var(--ember); }

/* Facet sheets (deckbuilder spec §3): the word is shown, Kedja has one field per form. */
.sheet .lemma-shown { color: var(--bone); letter-spacing: 0.01em; }
.answer-form.forms { display: grid; gap: 0.7rem; }
.form-slot { display: grid; grid-template-columns: 7.5rem 1fr; align-items: baseline; gap: 0.6rem; }
.form-name { color: var(--fog); font-variant: small-caps; letter-spacing: 0.08em; }
.answer-form.forms .answer-input { font-size: clamp(1.4rem, 5vw, 2rem); }
.sheet .notice { margin: 0.8rem 0 0; color: var(--ember); }
.forms-line { font-style: normal; }
@media (max-width: 420px) { .form-slot { grid-template-columns: 1fr; gap: 0.1rem; } }
