/* Lotto Graveyard · Ticket Graveyard styles (Inkwell ledger design). Shared tokens first, then the ledger styles. */
/* Shared Funeral March tokens. */
:root {
  --mustard: #F2C230;
  --ink: #1B1A17;
  --cream: #FFF6DC;
  --paper: #FFFFFF;
  --red: #C8402F;
  --brown: #5A3E22;
  --tan: #E8C79A;
  --b: 3px solid var(--ink);
  --shadow: 4px 4px 0 var(--ink);
  --shadow-red: 5px 5px 0 var(--red);
  --display: 'Bungee', Impact, 'Arial Black', sans-serif;
  --body: 'Bricolage Grotesque', system-ui, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body {
  font-family: var(--body);
  font-weight: 500;
  color: var(--ink);
  background: var(--cream);
  line-height: 1.4;
}
h1, h2, h3, .display { font-family: var(--display); font-weight: 400; line-height: 1; margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 4px solid var(--red); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 0 20px;
  font-family: var(--display); font-size: 16px; letter-spacing: .02em;
  background: var(--paper); border: var(--b); box-shadow: var(--shadow);
  transition: transform .08s, box-shadow .08s;
}
.btn:hover { box-shadow: 6px 6px 0 var(--ink); }
.btn:active { transform: translate(4px, 4px); box-shadow: 1px 1px 0 var(--ink); }
.btn-primary { background: var(--ink); color: var(--mustard); box-shadow: var(--shadow-red); min-height: 58px; font-size: 18px; }
.btn-primary:hover { box-shadow: 7px 7px 0 var(--red); }
.btn-primary:active { box-shadow: 1px 1px 0 var(--red); }

/* Balls */
.ball {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--paper); border: var(--b);
  font-family: var(--display); font-size: 16px;
}
.ball.pb { background: var(--red); color: var(--paper); }
.ball.hit { background: var(--mustard); }

.legal { font-size: 13px; text-align: center; padding: 24px 16px 40px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
  :root {
    --desk: #17100B; --leather: #4A2C18; --bone: #EFE3C6; --bone-hi: #F7EFDA; --bone-lo: #E2D2AC; --rule: #B9A57E;
    --iron: #3A2414; --wet: #1E2B4A; --faded: #5A4A36; --wax: #A92E20; --redink: #9E2B1D; --stone: #BDB4A0; --carve: #2E2A24;
    --fell: 'IM Fell English', Georgia, 'Times New Roman', serif;
    --burn: .5; --pad-r: 22px 14px 18px;
  }
  body { background: var(--desk); color: var(--cream); min-height: 100vh; }
  /* The one candle lights the desk; its strength follows the candle timer (--burn) */
  body::before { content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 0;
    background: radial-gradient(ellipse 75% 60% at 50% 35%, rgba(255, 186, 96, calc(.05 + .17 * var(--burn))), transparent 72%); transition: background .3s; }
  .top, main, .legal { position: relative; z-index: 1; }

  .top { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding: 12px 12px 14px; }
  .brand { flex-basis: 100%; font-size: 21px; color: var(--mustard); }
  .brand small { display: block; margin-top: 4px; font: italic 400 16px var(--fell); color: var(--tan); }
  .chatter { min-height: 44px; padding: 0 12px; font: 700 13px var(--body); background: transparent; color: var(--cream); border: 3px solid var(--mustard); }
  .chatter[aria-pressed="true"] { background: var(--mustard); color: var(--ink); }
  .board { margin-left: auto; display: flex; align-items: center; gap: 6px; background: var(--mustard); color: var(--ink); border: var(--b); box-shadow: 4px 4px 0 var(--wax); padding: 6px 10px; font-family: var(--display); }
  .board-lbl { font-size: 11px; }
  .board-n { font-size: 18px; min-width: 2.2em; text-align: right; }
  .shovels { display: flex; gap: 1px; }
  .shovel { width: 15px; height: 20px; opacity: .25; }
  .shovel.on { opacity: 1; }
  .shovel.bonus path { stroke-dasharray: 3 2; }

  main { max-width: 1240px; margin: 0 auto; padding: 0 10px 20px; }

  /* Ribbon bookmarks = step pips */
  .ribbons { list-style: none; margin: 0 auto -50px; padding: 0; display: flex; justify-content: center; align-items: flex-start; gap: 2px; position: relative; z-index: 6; }
  .ribbons li { display: block; }
  .rib { position: relative; display: flex; justify-content: center; width: 44px; height: 54px; padding: 7px 0 12px; border: 2px solid var(--ink); border-top: 0; background: var(--brown); color: var(--tan); font: 10px var(--display); cursor: default; transition: height .25s ease; }
  .rib span { writing-mode: vertical-rl; letter-spacing: .04em; }
  .rib::after { content: ""; position: absolute; left: -2px; right: -2px; bottom: -2px; height: 10px; background: var(--bone); clip-path: polygon(0 100%, 50% 0, 100% 100%); }
  .rib.done { background: var(--mustard); color: var(--ink); height: 62px; cursor: pointer; }
  .rib.done:hover { height: 68px; }
  .rib.on { background: var(--wax); color: var(--cream); height: 74px; }

  .book { position: relative; z-index: 2; background: var(--leather); border: var(--b); box-shadow: 6px 6px 0 #000; padding: 6px 6px 12px; }
  .spread { display: grid; border: var(--b); background: var(--bone); color: var(--iron); box-shadow: 4px 4px 0 var(--mustard), 7px 7px 0 var(--ink); }
  .page { position: relative; min-width: 0; }
  .page-l { padding: 52px 14px 12px; }
  .page-r { padding: var(--pad-r); border-top: 4px double var(--redink); }
  .runhead { display: flex; justify-content: space-between; gap: 8px; margin: 0 0 12px; padding-bottom: 4px; border-bottom: 1px solid var(--rule); font: italic 15px var(--fell); color: var(--faded); }

  /* Mort, the etching, and his entry */
  .host { display: flex; gap: 12px; align-items: flex-start; }
  .figure { flex: 0 0 88px; display: grid; gap: 4px; justify-items: center; }
  .etching { width: 100%; border: 4px double var(--iron); background: var(--bone-hi); padding: 3px; }
  #mort, #tomba { display: block; width: 100%; height: auto; }
  /* Tomba, who reads the cards: her candle and crystal ball glow, and the flame flickers while she speaks */
  .tflame { transform-origin: 14px 158px; transform-box: view-box; }
  #tomba.talking .tflame { animation: flicker .35s ease-in-out infinite alternate; }
  @keyframes flicker { to { transform: scale(.85, 1.12) rotate(4deg); } }
  .caption { text-align: center; line-height: 1.1; }
  .caption b { display: block; font: 400 13px var(--display); }
  .caption i { font: italic 13px var(--fell); color: var(--faded); }
  .mouth-open { display: none; transform-origin: 95px 165px; transform-box: view-box; }
  .talking .mouth-open { display: inline; animation: yap .2s steps(2) infinite; }
  .talking .mouth-shut { display: none; }
  @keyframes yap { 50% { transform: scaleY(.35); } }
  .spade { transform-origin: 165px 220px; transform-box: view-box; }
  .digging .spade { animation: dig .5s ease-in-out 3; }
  @keyframes dig { 50% { transform: rotate(-14deg); } }

  .entry { flex: 1; min-width: 0; position: relative; min-height: 132px; padding: 0 0 22px; font: 400 20px/1.32 var(--fell); cursor: pointer; }
  .entry:focus { outline: none; }
  .entry:focus-visible { outline: 4px solid var(--red); outline-offset: 4px; }
  .line { color: var(--iron); }
  .line.writing { color: var(--wet); }
  .line .wet { text-shadow: 0 0 1.5px rgba(30, 43, 74, .7), 0 0 5px rgba(30, 43, 74, .3); }
  .line.settle { animation: settle .45s ease-out both; }
  @keyframes settle { from { color: var(--wet); text-shadow: 0 0 2px rgba(30, 43, 74, .6), 0 0 6px rgba(30, 43, 74, .25); } to { color: var(--iron); text-shadow: 0 0 0 transparent; } }
  .ghost { visibility: hidden; }
  .nib { display: inline-block; position: relative; width: 0; height: 1em; }
  .nib svg { position: absolute; left: -1px; bottom: -.1em; width: 1.5em; height: 1.85em; animation: scrib .26s ease-in-out infinite alternate; transform-origin: 0 100%; }
  @keyframes scrib { to { transform: translate(1px, -2px) rotate(-4deg); } }
  .hint { position: absolute; right: 0; bottom: 0; font: 700 11px var(--body); color: var(--faded); }

  /* Task panels */
  .panel { display: grid; gap: 14px; align-content: start; }
  .kicker { font: 13px var(--display); color: var(--redink); margin: 0; letter-spacing: .02em; }
  .waiting { margin: 0; font: italic 18px var(--fell); color: var(--faded); }
  .note { margin: 0; font-size: 14px; color: var(--iron); }
  .actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
  .chip { font: 700 11px var(--body); background: var(--ink); color: var(--mustard); padding: 3px 7px; }
  .linkish { background: none; border: 0; padding: 0; min-height: 44px; text-decoration: underline; font-weight: 800; justify-self: start; color: var(--iron); }

  .index { list-style: none; margin: 0; padding: 0; }
  .index li { display: grid; grid-template-columns: auto 1fr auto; gap: 2px 8px; align-items: baseline; padding: 9px 0; border-bottom: 1px solid var(--rule); }
  .index b { font: 400 14px var(--display); }
  .index .lead { border-bottom: 2px dotted var(--iron); transform: translateY(-4px); }
  .index em { font: italic 17px var(--fell); }
  .index span.d { grid-column: 1 / -1; font-weight: 700; font-size: 14px; }

  /* Register line (ticket entry) + margin corrections */
  .with-margin { display: grid; gap: 10px; }
  .register { background: var(--bone-hi); border: var(--b); box-shadow: var(--shadow); padding: 10px 10px 8px; }
  .reg-head { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 20px; padding-bottom: 4px; border-bottom: 2px solid var(--redink); font: italic 15px var(--fell); }
  .fields { display: flex; gap: 5px; align-items: flex-start; }
  .field { position: relative; display: grid; gap: 4px; justify-items: center; font: 700 11px var(--body); }
  .field.pb { margin-left: 3px; padding-left: 6px; border-left: 2px solid var(--redink); color: var(--redink); }
  .field input { position: relative; z-index: 1; width: 44px; height: 50px; padding: 0; border: var(--b); border-radius: 0; background: #FFFBEF; text-align: center; font: 20px var(--display); color: var(--iron); }
  .field.pb input { border-color: var(--wax); }
  .field.inked input { animation: inkin .6s ease-out both; }
  @keyframes inkin { from { color: var(--wet); text-shadow: 0 0 4px rgba(30, 43, 74, .8); } to { color: var(--iron); text-shadow: 0 0 0 transparent; } }
  .field input[aria-invalid="true"] { border-style: dashed; border-color: var(--redink); background: rgba(255, 251, 239, .45); text-shadow: 2px 1px 2px rgba(58, 36, 20, .5), -2px 0 3px rgba(58, 36, 20, .3); }
  .blot { display: none; position: absolute; z-index: 0; left: -5px; top: -4px; width: 54px; height: 58px; background: rgba(58, 36, 20, .2); border-radius: 42% 58% 61% 39% / 47% 38% 62% 53%; transform: rotate(-12deg); }
  .field input[aria-invalid="true"] ~ .blot { display: block; animation: smudge .4s ease-out both; }
  @keyframes smudge { from { transform: rotate(-12deg) scale(.4); opacity: 0; } }
  /* Skull of light: drops onto the box and settles once a number is accepted (from 11D) */
  .skull { position: absolute; z-index: 2; top: -15px; left: 50%; width: 18px; margin-left: -9px; pointer-events: none;
    opacity: 0; transform: translateY(-26px) scale(.7); transition: transform .45s cubic-bezier(.3, 1.5, .5, 1), opacity .2s; }
  .skull svg { display: block; width: 100%; height: auto; }
  .field.pb .skull { margin-left: -6px; }
  .field.placed .skull { opacity: 1; transform: none; filter: drop-shadow(0 0 3px rgb(242 194 48 / .95)) drop-shadow(0 0 8px rgb(255 190 80 / .6)); }
  .field.placed input { box-shadow: inset 0 0 10px rgb(242 194 48 / .35); }
  .mnote { margin: 0; min-height: 1.3em; font: italic 17px/1.3 var(--fell); color: var(--redink); }
  .mnote.ink { color: var(--faded); }
  .mnote.fresh { animation: ghostin .8s ease-out both; }
  @keyframes ghostin { from { clip-path: inset(0 100% 0 0); text-shadow: 0 0 6px rgba(158, 43, 29, .5); } to { clip-path: inset(0 0 0 0); text-shadow: 0 0 0 transparent; } }

  /* Candle timer */
  .round-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
  .round-head > div:first-child { display: grid; gap: 8px; }
  .candle-wrap { flex: 0 0 auto; display: grid; justify-items: center; gap: 6px; margin: -8px -4px 0 0; }
  .candle { display: block; width: 62px; height: 156px; overflow: visible; }
  .candle .flame { transform-origin: 45px -6px; transform-box: view-box; animation: flick 1.8s ease-in-out infinite alternate; }
  @keyframes flick { 0% { transform: scale(1, 1); } 50% { transform: scale(.94, 1.05) skewX(2deg); } 100% { transform: scale(1.03, .97) skewX(-2deg); } }
  .candle.paused .flame { animation: none; transform: scale(.82, .78); }
  .snuffer { transform: translateY(-70px); opacity: 0; transition: transform .35s ease, opacity .2s; }
  .candle.paused .snuffer { transform: translateY(-4px); opacity: 1; }
  .candle.snuffed .snuffer { transform: translateY(28px); opacity: 1; }
  .candle.snuffed .flame, .candle.out .flame, .candle.snuffed .glow, .candle.out .glow { display: none; }
  .smoke { display: none; }
  .candle.out .smoke, .candle.snuffed .smoke { display: inline; animation: smoke 1.8s ease-out both; }
  @keyframes smoke { from { opacity: 0; transform: translateY(8px); } 30% { opacity: .9; } to { opacity: .55; transform: translateY(-6px); } }
  .pause { min-height: 44px; min-width: 44px; padding: 0 8px; font-size: 12px; box-shadow: 3px 3px 0 var(--ink); }

  /* Handwritten answer entries */
  .answers { display: grid; gap: 12px; padding: 2px 6px 6px 0; }
  .ans { position: relative; display: grid; grid-template-columns: 38px 1fr; align-items: center; column-gap: 12px; min-height: 64px; padding: 6px 76px 8px 10px; text-align: left; background: var(--bone-hi); color: var(--iron); border: var(--b); box-shadow: 5px 5px 0 var(--ink); transition: transform .1s, box-shadow .1s; }
  .ans:not(:disabled):hover { box-shadow: 8px 8px 0 var(--ink); }
  .ans:not(:disabled):active { box-shadow: 1px 1px 0 var(--ink); transform: translate(4px, 4px); }
  .letter { grid-row: span 2; width: 36px; height: 36px; display: grid; place-items: center; background: var(--ink); color: var(--mustard); font: 16px var(--display); border-radius: 50%; }
  .word { position: relative; justify-self: start; font: 400 32px/1.05 var(--fell); padding: 0 2px; }
  .word small { font: italic 19px var(--fell); margin-left: 4px; }
  .ans .tag { grid-column: 2; font: italic 15px/1.2 var(--fell); color: var(--redink); }
  .uline, .strike { position: absolute; display: none; overflow: visible; pointer-events: none; }
  .uline { left: -4px; right: -6px; bottom: -9px; height: 12px; width: calc(100% + 10px); }
  .strike { left: -6px; top: -4px; width: calc(100% + 12px); height: calc(100% + 8px); }
  .uline path, .strike path { fill: none; stroke-linecap: round; vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 0; }
  .uline path { stroke: var(--red); stroke-width: 4; }
  .strike path { stroke: var(--iron); stroke-width: 3; }
  .ans.picked .uline { display: block; }
  .ans.picked .uline path { animation: draw .35s ease-out both; }
  .ans.struck .strike { display: block; }
  .ans.struck .strike path { animation: draw .4s .55s ease-in-out both; }
  .ans.struck .strike path + path { animation-delay: .8s; }
  @keyframes draw { from { stroke-dashoffset: 1; } }
  .ans:disabled { cursor: default; }
  .ans:disabled:not(.correct):not(.picked) { background: transparent; color: var(--faded); border-style: dashed; box-shadow: none; }
  .seal { position: absolute; right: 4px; top: 50%; width: 68px; height: 68px; transform: translateY(-50%) rotate(-12deg); animation: stamp .45s .3s cubic-bezier(.3, 1.4, .5, 1) both; }
  @keyframes stamp { 0% { transform: translateY(-50%) rotate(-30deg) scale(1.9); opacity: 0; } 100% { transform: translateY(-50%) rotate(-12deg) scale(1); opacity: 1; } }
  .answers.still .uline path, .answers.still .strike path, .answers.still .seal { animation: none; }
  .keys { margin: -4px 0 0; font-size: 13px; color: var(--faded); font-weight: 700; }

  .reveal { border-top: 4px double var(--redink); padding-top: 12px; display: grid; gap: 8px; }
  .verdict { font-size: 26px; }
  .verdict.right { color: var(--iron); }
  .verdict.wrong, .verdict.time { color: var(--redink); }
  .fact { margin: 0; font-weight: 800; }
  .bars { display: grid; gap: 6px; margin: 4px 0; padding: 0; list-style: none; }
  .bar { display: grid; grid-template-columns: 66px 1fr 46px; align-items: center; gap: 8px; font-weight: 700; font-size: 13px; }
  .bar .track { display: block; height: 20px; border: var(--b); background: var(--bone-hi); }
  .bar .fill { display: block; height: 100%; width: 0; background: var(--tan); border-right: 3px solid var(--ink); transition: width .6s steps(8); }
  .bar.star .fill { background: var(--mustard); }
  .bar .n { font-family: var(--display); }

  /* Memorial plate tipped into the book */
  .plate { justify-self: center; position: relative; width: min(100%, 380px); padding: 14px; background: #D8CFBD; border: var(--b); box-shadow: 6px 6px 0 var(--ink); transform: rotate(-1.2deg); }
  .pc { position: absolute; width: 26px; height: 26px; background: var(--ink); }
  .pc.tl { top: -5px; left: -5px; clip-path: polygon(0 0, 100% 0, 0 100%); }
  .pc.tr { top: -5px; right: -5px; clip-path: polygon(0 0, 100% 0, 100% 100%); }
  .pc.bl { bottom: -5px; left: -5px; clip-path: polygon(0 0, 0 100%, 100% 100%); }
  .pc.br { bottom: -5px; right: -5px; clip-path: polygon(100% 0, 0 100%, 100% 100%); }
  .stone { background: var(--stone); color: var(--carve); border: var(--b); border-radius: 26px 26px 0 0; padding: 22px 14px 16px; text-align: center; display: grid; gap: 10px; text-shadow: 1px 1px 0 rgba(247, 239, 218, .6); }
  .stone h2 { font-size: 30px; }
  .stone .row { display: flex; justify-content: center; gap: 4px; flex-wrap: wrap; text-shadow: none; }
  .stone .ball { width: 38px; height: 38px; font-size: 14px; }
  .epitaph { margin: 0; font: italic 19px/1.3 var(--fell); }
  .carved { justify-self: center; font: 22px var(--display); border: 3px solid var(--carve); padding: 6px 12px; margin: 0; }
  .dates { font: 12px var(--display); margin: 0; }
  .plate-cap { margin: 10px 0 0; text-align: center; font: italic 15px var(--fell); color: var(--carve); }

  /* Tarot leaves tucked between the pages */
  .yourguess { margin: 0; font-weight: 800; }
  .cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
  .card { display: grid; gap: 6px; align-content: start; text-align: center; min-width: 0; }
  .card .lbl { margin: 0; font: 12px var(--display); }
  .card .name { margin: 0; min-height: 2.5em; font: 800 13px/1.2 var(--body); }
  .slot { position: relative; overflow: hidden; }
  .pull { position: relative; z-index: 1; display: block; width: 100%; padding: 0; border: 0; background: none; transition: transform .5s cubic-bezier(.3, 1.3, .5, 1); }
  .pull:focus-visible { outline-offset: -5px; }
  .pull:disabled { cursor: default; }
  .tab { display: grid; place-items: center; width: 40px; height: 30px; margin: 0 auto -3px; background: var(--brown); color: var(--cream); border: 2px solid var(--ink); border-bottom: 0; font: 10px var(--display); }
  .slot.now .tab { background: var(--wax); }
  .slot.pulled .tab { background: var(--mustard); }
  .mat { display: block; width: 100%; background: var(--paper); border: var(--b); padding: 5px; }
  .mat img { display: block; width: 100%; aspect-ratio: 7 / 12; object-fit: cover; border: 2px solid var(--ink); }
  .slot.tucked .pull { transform: translateY(54%); }
  .slot.now .mat { box-shadow: 0 -4px 0 var(--red); }
  .pocket { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; height: 34%; background: var(--bone); border-top: 3px solid var(--ink); }
  .pocket::before { content: ""; position: absolute; left: 10%; right: 10%; top: 10px; border-top: 1px solid var(--rule); box-shadow: 0 10px 0 -0px var(--rule); height: 0; }
  .slot.pulled .pocket { display: none; }
  .slot.fresh .pull { animation: pullout .6s cubic-bezier(.2, .9, .3, 1.15) both; }
  @keyframes pullout { from { transform: translateY(54%); } }

  /* Torn-out page */
  .torn-wrap { justify-self: center; width: min(100%, 400px); transform: rotate(1deg);
    filter: drop-shadow(3px 0 0 var(--ink)) drop-shadow(-3px 0 0 var(--ink)) drop-shadow(0 3px 0 var(--ink)) drop-shadow(0 -3px 0 var(--ink)) drop-shadow(7px 7px 0 var(--mustard)); }
  .torn { display: flex; flex-direction: column; gap: 10px; padding: 34px 20px 22px; background: var(--bone-hi); color: var(--iron);
    clip-path: polygon(0 16px, 5% 6px, 10% 14px, 16% 3px, 22% 12px, 28% 5px, 34% 15px, 41% 4px, 47% 12px, 53% 2px, 60% 13px, 66% 6px, 72% 15px, 79% 4px, 85% 12px, 91% 5px, 96% 14px, 100% 7px, 100% 100%, 0 100%); }
  .torn .chip { align-self: flex-start; font: 12px var(--display); padding: 4px 8px; }
  .torn h2 { font-size: 32px; color: var(--ink); }
  .torn .row { display: flex; gap: 4px; flex-wrap: wrap; }
  .torn .ball { width: 36px; height: 36px; font-size: 13px; }
  .torn p { margin: 0; font-weight: 800; }
  .torn .sig { font: italic 400 17px var(--fell); border-top: 1px solid var(--rule); padding-top: 8px; }
  /* Tomba's reading on the torn page: thumbnail + the full line for each card */
  .torn .fortune { list-style: none; margin: 2px 0 0; padding: 8px 0 0; display: grid; gap: 10px; border-top: 1px solid var(--rule); }
  .torn .fortune li { display: grid; grid-template-columns: 44px 1fr; gap: 10px; align-items: start; }
  .torn .fortune img { width: 44px; height: 73px; object-fit: cover; border: 2px solid var(--ink); background: var(--paper); display: block; }
  .torn .fortune b { display: block; font: 12px var(--display); color: var(--redink); }
  .torn .fortune span { font: italic 400 16px/1.3 var(--fell); color: var(--ink); }
  .torn .by { font: italic 400 15px var(--fell); color: var(--faded); text-align: right; }
  .socials { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
  .socials p { margin: 0; font: 13px var(--display); color: var(--redink); }
  .socials .btn { min-height: 44px; padding: 0 14px; font-size: 14px; text-decoration: none; color: var(--ink); }
  .sharetext { margin: 0; font: 700 13px var(--body); background: var(--bone-hi); border: 2px dashed var(--ink); padding: 8px 10px; overflow-wrap: anywhere; }

  .stepnav { display: flex; justify-content: space-between; gap: 12px; margin-top: 20px; padding-top: 14px; border-top: 1px solid var(--rule); }
  .stepnav .btn[disabled] { opacity: .45; cursor: not-allowed; }
  .stepnav .btn:not(.btn-primary) { background: var(--bone-hi); color: var(--ink); }

  /* ---------- Mort's lantern: a hazy spotlight on the focus ----------
     --lx/--ly/--lr are viewport coordinates driven from JS (the light glides, and snaps on scroll).
     .veil dims everything outside the pool by 18% (worst text outside the light: red ink on bone, 4.8:1).
     .haze is the warm, breathing lantern glow inside the pool; it only lightens, so text inside stays crisp. */
  :root { --lx: 50vw; --ly: 40vh; --lr: 360px; }
  .spread { position: relative; z-index: 1; --hx: 50%; --hy: 40%; }
  .page { z-index: 1; }
  /* 1 · the shade outside the light (over everything, text included: capped at 18%) */
  .veil { position: fixed; inset: 0; z-index: 50; pointer-events: none; background: rgb(10 6 3 / .18);
    -webkit-mask-image: radial-gradient(circle at var(--lx) var(--ly), transparent 0, transparent calc(var(--lr) * .38), #000 var(--lr));
    mask-image: radial-gradient(circle at var(--lx) var(--ly), transparent 0, transparent calc(var(--lr) * .38), #000 var(--lr)); }
  /* 2 · warm light spilling on the desk around the book */
  .pool { position: fixed; inset: 0; z-index: 0; pointer-events: none;
    background: radial-gradient(circle at var(--lx) var(--ly), rgb(255 190 96 / .34) 0, rgb(255 190 96 / .12) calc(var(--lr) * .6), transparent calc(var(--lr) * 1.15)); }
  /* 3 · the hazy glow on the paper, under the ink (only lightens the paper, so text inside the light gets more contrast) */
  .spread::before { content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
    background: radial-gradient(circle at var(--hx) var(--hy), rgb(255 226 160 / .55) 0, rgb(255 214 140 / .2) calc(var(--lr) * .5), transparent var(--lr));
    animation: breathe 3.6s ease-in-out infinite alternate; }
  @keyframes breathe { from { opacity: .78; } to { opacity: 1; } }
  .in-light { filter: drop-shadow(0 0 10px rgb(255 190 80 / .8)); }
  .entry.in-light, .register.in-light, .answers.in-light { filter: drop-shadow(0 0 12px rgb(255 190 80 / .7)); }
  .field.in-light { filter: none; }
  .field.in-light input { box-shadow: 0 0 0 3px rgb(242 194 48 / .6), 0 0 18px 4px rgb(255 190 80 / .55); }
  /* the lantern in Mort's hand */
  #mort .lglass { fill: #F2C230; transition: fill .3s; }
  #mort .lhalo { fill: #FFD873; opacity: .55; transition: opacity .3s; }
  #mort.unlit .lglass { fill: #8C7A5E; }
  #mort.unlit .lhalo { opacity: 0; }

  /* ---------- The Inkwell (transition): wash out, write in ----------
     The old page runs like wet ink and washes away; the new page is written in behind a wet-ink edge
     that travels in the direction you're going (left→right forward, right→left back). */
  #task { position: relative; z-index: 1; }
  .pen { position: absolute; z-index: 6; top: 0; left: 0; width: 56px; pointer-events: none; display: none; }
  .pen.on { display: block; }
  .pen::before { content: ""; position: absolute; inset: 0; background: linear-gradient(to left, rgb(30 43 74 / .28), rgb(30 43 74 / 0)); }
  .pen::after { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 3px; background: var(--wet); box-shadow: 0 0 8px 1px rgb(30 43 74 / .45); }
  .pen.back::before { background: linear-gradient(to right, rgb(30 43 74 / .28), rgb(30 43 74 / 0)); }
  .pen.back::after { right: auto; left: 0; }

  /* Skip the chatter: plain text, no hand, no ink, no timer */
  body.quiet .figure, body.quiet .hint { display: none; }
  body.quiet .entry { min-height: 0; cursor: default; padding-bottom: 0; font: 800 17px/1.35 var(--body); color: var(--ink); }
  body.quiet .line { color: var(--ink); }
  .legal { color: var(--tan); }

  @media (min-width: 960px) {
    :root { --pad-r: 56px 34px 30px 46px; }
    .top { padding: 16px 24px 16px; }
    .brand { flex-basis: auto; font-size: 26px; }
    .chatter { margin-left: auto; }
    .board { margin-left: 0; padding: 8px 14px; }
    .shovel { width: 22px; height: 28px; }
    .board-n { font-size: 26px; }
    main { padding: 0 24px 30px; }
    .ribbons { gap: 4px; margin-bottom: -56px; }
    .rib { width: 48px; height: 58px; font-size: 11px; }
    .rib.done { height: 68px; } .rib.done:hover { height: 74px; } .rib.on { height: 82px; }
    .book { padding: 14px 18px 18px; }
    .spread { grid-template-columns: minmax(380px, 5fr) 6fr; box-shadow: -4px 4px 0 var(--mustard), 4px 4px 0 var(--mustard), -7px 7px 0 var(--ink), 7px 7px 0 var(--ink); }
    .page-l { padding: 56px 40px 30px 30px; border-right: 3px solid var(--ink); box-shadow: inset -16px 0 0 var(--bone-lo); }
    .page-r { border-top: 0; box-shadow: inset 16px 0 0 var(--bone-lo); }
    .skull { width: 22px; margin-left: -11px; top: -18px; }
    .field.pb .skull { margin-left: -6px; }
    .host { flex-direction: column; align-items: stretch; gap: 22px; position: sticky; top: 16px; }
    .figure { flex: none; width: 230px; align-self: center; }
    .caption b { font-size: 18px; } .caption i { font-size: 16px; }
    .entry { font-size: 28px; line-height: 1.3; min-height: 250px; padding-bottom: 26px; }
    .hint { font-size: 12px; }
    .panel { gap: 18px; }
    .fields { gap: 10px; }
    .field.pb { margin-left: 6px; padding-left: 10px; }
    .field input { width: 58px; height: 66px; font-size: 26px; }
    .blot { width: 68px; height: 76px; }
    .with-margin { grid-template-columns: 1fr 180px; gap: 18px; }
    .with-margin .mnote { border-left: 4px double var(--redink); padding-left: 12px; }
    .candle { width: 76px; height: 190px; }
    .ans { min-height: 78px; grid-template-columns: 44px 1fr; padding-right: 100px; }
    .letter { width: 42px; height: 42px; font-size: 18px; }
    .word { font-size: 40px; }
    .seal { width: 88px; height: 88px; right: 8px; }
    .cards { gap: 22px; }
    body.quiet .spread { grid-template-columns: 1fr; max-width: 860px; margin: 0 auto; }
    body.quiet .page-l { border-right: 0; box-shadow: none; padding-bottom: 8px; }
    body.quiet .page-r { border-top: 4px double var(--redink); box-shadow: none; }
    body.quiet .host { position: static; }
  }

/* ---------- Production additions ---------- */
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 1000; background: var(--mustard); color: var(--ink); padding: 10px 14px; font-weight: 800; border: var(--b); }
.skip-link:focus { top: 8px; }
.legal a { color: var(--mustard); font-weight: 700; }
.legal nav { display: flex; justify-content: center; gap: 18px; margin-bottom: 10px; }
.status { margin: 0; font: italic 17px/1.3 var(--fell); color: var(--faded); }
.status.err { color: var(--redink); }
/* Ticket scanner: the camera view tipped into the register */
.scanner { display: grid; gap: 10px; padding: 10px; background: var(--bone-hi); border: var(--b); box-shadow: var(--shadow); }
.scanner video { display: block; width: 100%; max-height: 300px; background: var(--ink); border: 2px solid var(--ink); object-fit: cover; }
.scanner .status { font-size: 15px; }
/* A matched Powerball on the stone: mustard like the other hits, with dark ink so the number stays readable */
.ball.pb.hit { background: var(--mustard); color: var(--ink); box-shadow: inset 0 0 0 3px var(--red); }
