/* AFTERIMAGE: a memory eye exam. Warm orange paper, black marker, blue only for afterimages. Light mode only. */
:root {
  color-scheme: light;
  --orange: #E2803F; --orange-hi: #EC9455; --orange-lo: #D26C33; --lid: #C9622A;
  --ink: #17120E; --paper: #FBF5EA; --blue: #2F6BFF;
  --r1: 255px 15px 225px 15px / 15px 225px 15px 255px;
  --r2: 15px 225px 15px 255px / 255px 15px 225px 15px;
  --r3: 225px 25px 205px 20px / 20px 205px 25px 225px;
  --r4: 25px 225px 20px 205px / 205px 20px 225px 25px;
  --paper-r: 12px 6px 14px 8px / 8px 14px 6px 12px;
  --font-display: "Gochi Hand", "Comic Sans MS", cursive;
  --font-body: "Nunito", system-ui, -apple-system, sans-serif;
  --font-mono: "Nunito", system-ui, -apple-system, sans-serif;

  /* tokens the grader's drawing and scorecard code reads */
  --grid: rgba(23, 18, 14, 0.07); --grid-major: rgba(23, 18, 14, 0.15);
  --card: #FBF5EA; --desk: #F1E4CD; --line: rgba(23, 18, 14, 0.22); --muted: #4D3B2D;
  --pencil: #17120E; --pencil-fill: rgba(23, 18, 14, 0.08); --blue-fill: rgba(47, 107, 255, 0.1);
  --fit: #9A4A1C; --hl: #F2C94C; --hl-ink: #17120E; --flash: #FFFFFF;
  --btn: #17120E; --btn-ink: #FBF5EA; --focus: #17120E; --shadow: rgba(23, 18, 14, 0.25);
  --cat-1: #17120E; --cat-2: #9A4A1C; --cat-3: #D9A21B; --cat-4: #5F7152;
  --cat-text: #FBF5EA; --cat-4-text: #FBF5EA; --critical: #C2321F; --track: #E7D8C0;
  /* the doodle as players see it: black marker outlines on paper, ink-coloured parts filled black */
  --d-line: #17120E; --d-ink: #17120E;
  --d-mist: #FBF5EA; --d-pink: #FBF5EA; --d-rose: #FBF5EA; --d-snow: #FBF5EA; --d-orange: #FBF5EA; --d-sun: #FBF5EA;
  --d-green: #FBF5EA; --d-leaf: #FBF5EA; --d-tan: #FBF5EA; --d-brown: #FBF5EA; --d-cream: #FBF5EA; --d-grey: #FBF5EA;
  --d-steel: #FBF5EA; --d-sky: #FBF5EA; --d-red: #FBF5EA; --d-gold: #FBF5EA; --d-violet: #FBF5EA; --d-wood: #FBF5EA; --d-white: #FBF5EA;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; }
body { background: var(--orange); color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.45; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px dashed var(--ink); outline-offset: 5px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hand { font-family: var(--font-display); font-weight: 400; }
.wob { filter: url(#ai-wob); }

/* ---------- the room: orange paper with grain */
.app {
  position: relative; min-height: 100vh; min-height: 100dvh; overflow-x: clip;
  background: radial-gradient(ellipse at 18% 12%, var(--orange-hi) 0%, rgba(236,148,85,0) 44%), radial-gradient(ellipse at 90% 95%, var(--orange-lo) 0%, rgba(210,108,51,0) 50%), var(--orange);
}
.fx-defs { position: absolute; width: 0; height: 0; }
.grain { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.light { position: absolute; inset: 0; pointer-events: none; background: transparent; transition: background .9s ease; }
.app[data-screen="look"] .light { background: rgba(255, 240, 218, 0.24); }
.app[data-screen="draw"] .light { background: rgba(48, 16, 0, 0.32); }
.screen { position: relative; z-index: 5; min-height: 100vh; min-height: 100dvh; padding: 132px 24px 56px; }

/* ---------- buttons: hand-drawn outlines */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; background: transparent; color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r1); padding: 10px 26px 7px; font-family: var(--font-display); font-size: 28px; line-height: 1.1; cursor: pointer; transition: transform .15s ease; }
.btn:hover { transform: rotate(-1.5deg) scale(1.04); }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .35; cursor: default; transform: none; }
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.r2 { border-radius: var(--r2); } .btn.r3 { border-radius: var(--r3); } .btn.r4 { border-radius: var(--r4); }
.btn.small { font-size: 22px; padding: 7px 18px 5px; min-height: 44px; }
.btn svg { width: 22px; height: 22px; flex: none; }
.icon-btn { width: 60px; height: 60px; display: grid; place-items: center; background: transparent; border: 0; cursor: pointer; padding: 0; transition: transform .15s ease; }
.icon-btn:hover { transform: rotate(-4deg) scale(1.06); }
.quit { position: absolute; z-index: 6; top: 34px; left: 40px; background: none; border: 0; cursor: pointer; padding: 8px 4px; font-family: var(--font-display); font-size: 28px; color: var(--ink); transform: rotate(-3deg); }
.quit:hover { transform: rotate(-5deg) scale(1.04); }
.kicker { margin: 0; font-family: var(--font-display); font-size: 24px; letter-spacing: .05em; text-align: center; }
.paper { position: relative; background: var(--paper); border: 3px solid var(--ink); border-radius: var(--paper-r); }
.paper > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border-radius: inherit; }
.sq-board { width: clamp(280px, calc(100dvh - 340px), 520px); max-width: 100%; aspect-ratio: 1 / 1; }
.pop { animation: pop .28s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes pop { 0% { transform: scale(.6) rotate(3deg); opacity: 0; } 100% { transform: none; opacity: 1; } }
.fade { animation: fade .35s ease; }
@keyframes fade { 0% { opacity: 0; transform: translateY(10px); } 100% { opacity: 1; transform: none; } }

/* ---------- eye mascot */
.mascot { position: absolute; z-index: 45; left: 50%; top: 24px; width: 124px; transform: translateX(-50%); transition: left .6s ease, top .6s ease, width .6s ease, transform .6s ease; pointer-events: none; }
.mascot svg { width: 100%; height: auto; display: block; overflow: visible; }
#eyeLook { transition: transform .35s ease; }

/* ---------- home */
.home { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 150px 24px 180px; }
.home-center { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.mode-line { margin: 0 0 6px; font-size: 24px; letter-spacing: .06em; transform: rotate(-2deg); text-align: center; }
.title { background: none; border: 0; padding: 0 12px; margin: 0; cursor: pointer; color: var(--ink); font-size: clamp(60px, 11.5vw, 172px); line-height: 1; letter-spacing: .02em; -webkit-text-stroke: 1.5px var(--ink); transform: rotate(-4deg); white-space: nowrap; }
.title > span { display: inline-block; }
.title i { display: inline-block; font-style: normal; animation: boil 1.6s steps(1) infinite; }
.title > span:nth-child(2n) i { animation-delay: -.4s; }
.title > span:nth-child(3n) i { animation-delay: -.9s; }
.title:hover i { animation-duration: .45s; }
@keyframes boil { 0% { transform: translate(0, 0) rotate(0); } 33% { transform: translate(.6px, -1px) rotate(.8deg); } 66% { transform: translate(-.6px, .8px) rotate(-.7deg); } }
.tag-row { display: flex; align-items: flex-start; gap: 18px; margin-top: 4px; flex-wrap: wrap; justify-content: center; }
.tagline { margin: 0; font-size: 34px; transform: rotate(-2deg); }
.hint-arrow { display: flex; align-items: flex-end; gap: 4px; transform: translate(0, -26px) rotate(4deg); font-size: 24px; }
.menu-wrap { position: absolute; z-index: 42; top: 34px; right: 40px; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.menu { transform-origin: top right; background: var(--paper); border: 3px solid var(--ink); border-radius: var(--r3); padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; min-width: 220px; }
.menu button { background: none; border: 0; cursor: pointer; text-align: left; padding: 9px 12px; font-family: var(--font-display); font-size: 28px; transition: transform .15s ease; }
.menu button:hover { transform: translateX(4px) rotate(-1deg); }
.streak { position: absolute; z-index: 10; left: 40px; bottom: 34px; display: flex; align-items: center; gap: 10px; }
.streak b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 54px; line-height: .9; }
.streak span { display: block; font-family: var(--font-display); font-size: 20px; letter-spacing: .05em; }
.modes-wrap { position: absolute; z-index: 20; right: 40px; bottom: 36px; display: flex; flex-direction: column; align-items: flex-end; gap: 14px; max-width: calc(100% - 80px); }
.modes { transform-origin: bottom right; width: 450px; max-width: 100%; background: var(--paper); border: 3px solid var(--ink); border-radius: var(--r4); padding: 22px 28px 26px; display: flex; flex-direction: column; gap: 16px; }
.mtabs { display: flex; gap: 8px; }
.mtab { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; background: transparent; border: 3px solid var(--ink); border-radius: var(--r1); cursor: pointer; padding: 8px 6px 6px; font-family: var(--font-display); font-size: 26px; line-height: 1.1; }
.mtab:nth-child(2) { border-radius: var(--r2); } .mtab:nth-child(3) { border-radius: var(--r3); }
.mtab small { font-family: var(--font-body); font-size: 12px; font-weight: 800; letter-spacing: .08em; visibility: hidden; }
.mtab.current small { visibility: visible; }
.mtab[aria-selected="true"] { background: var(--ink); color: var(--paper); }
.mode-desc { margin: 0; font-size: 19px; font-weight: 600; line-height: 1.35; min-height: 52px; }
.pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pick > span:first-child { font-family: var(--font-display); font-size: 24px; margin-right: 4px; }
.chip { background: transparent; border: 3px solid var(--ink); border-radius: var(--r2); padding: 4px 14px 2px; min-height: 44px; font-family: var(--font-display); font-size: 22px; cursor: pointer; }
.chip[aria-checked="true"] { background: var(--ink); color: var(--paper); }
.round-btn { width: 44px; height: 44px; background: transparent; border: 3px solid var(--ink); border-radius: 50% 45% 55% 48%; cursor: pointer; font-family: var(--font-display); font-size: 28px; line-height: 1; padding: 0; }
.pick output { font-family: var(--font-display); font-size: 40px; width: 28px; text-align: center; }

/* ---------- memorize */
.look-screen, .draw-screen, .lineup { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.cd { position: absolute; top: 22px; right: 40px; width: 200px; }
.cd svg { width: 100%; height: auto; display: block; overflow: visible; }
.cd span { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-52%); text-align: center; font-size: 66px; line-height: 1; }
.cd span.tick { animation: num .4s cubic-bezier(.25, 1.3, .5, 1); }
@keyframes num { 0% { transform: translateY(-52%) scale(1.18); opacity: .35; } 100% { transform: translateY(-52%) scale(1); opacity: 1; } }
.h-look, .h-draw, .h-big { margin: 0; font-size: 68px; line-height: 1; transform: rotate(-3deg); text-align: center; }
.h-draw { font-size: 64px; transform: rotate(2deg); }
.caption { margin: 2px 0 0; font-size: 26px; text-align: center; transform: rotate(-1deg); }
.look-screen { padding-top: 120px; gap: 12px; }
.look-screen .sq-board { width: clamp(260px, calc(100dvh - 410px), 520px); }
.look-foot { display: flex; align-items: center; gap: 18px; min-height: 48px; }
.look-foot .hint { font-size: 28px; min-width: 150px; text-align: right; }

/* ---------- draw */
.draw-screen { padding-top: 44px; }
.draw-screen .h-draw { margin-top: 14px; }
.draw-row { display: flex; align-items: center; justify-content: center; gap: 30px; flex-wrap: wrap; width: 100%; margin-top: 8px; }
.tool-spacer { width: 104px; flex: none; }
#board { touch-action: none; cursor: crosshair; }
.board-wrap.erasing #board { cursor: none; }
#glow { pointer-events: none; opacity: 0; transition: opacity 1.4s ease-out; }
.timer-tag { position: absolute; top: -26px; right: -30px; z-index: 2; transform: rotate(6deg); background: var(--paper); border: 3px solid var(--ink); border-radius: 50% 44% 52% 46% / 48% 54% 44% 52%; padding: 10px 18px 6px; font-size: 38px; line-height: 1; font-variant-numeric: tabular-nums; }
.timer-tag.pulse { animation: pulse .6s ease-in-out infinite alternate; }
@keyframes pulse { 0% { transform: rotate(6deg) scale(1); } 100% { transform: rotate(-4deg) scale(1.12); } }
.grading { position: absolute; inset: 0; z-index: 3; display: grid; place-items: center; font-size: 46px; background: rgba(251, 245, 234, .55); border-radius: inherit; }
.grading span { transform: rotate(-3deg); }
.tools { display: flex; flex-direction: column; align-items: center; gap: 12px; width: 104px; }
.tool { width: 66px; height: 66px; display: grid; place-items: center; background: transparent; color: var(--ink); border: 3px solid var(--ink); border-radius: var(--r1); cursor: pointer; padding: 0; transition: transform .15s ease; }
.tool:nth-child(2) { border-radius: var(--r2); } .tool:nth-child(3) { border-radius: var(--r3); } .tool:nth-child(4) { border-radius: var(--r4); } .tool:nth-child(5) { border-radius: var(--r2); }
.tool:hover { transform: rotate(-3deg) scale(1.05); }
.tool:disabled { opacity: .35; cursor: default; transform: none; }
.tool[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.tool svg { width: 38px; height: 38px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.draw-foot { display: flex; align-items: center; gap: 22px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }
.draw-foot .btn.solid { font-size: 32px; padding: 12px 44px 9px; }
.reminder { font-size: 28px; transform: rotate(-2deg); }

/* ---------- results */
.results { max-width: 1200px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 56px; justify-content: center; align-items: flex-start; }
.res-left { flex: 0 1 420px; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.res-right { flex: 0 1 560px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.chart { display: flex; flex-direction: column; gap: 6px; padding: 8px 0; }
.chart-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) 28px; align-items: center; gap: 12px; }
.chart-row .sn { font-size: 14px; font-weight: 600; text-align: right; }
.chart-row .ltr { position: relative; font-family: var(--font-display); line-height: 1.05; letter-spacing: .28em; text-align: center; transition: filter .6s ease, opacity .6s ease; }
.chart-row .mark-line { position: absolute; left: 6%; right: 6%; bottom: -4px; height: 6px; border-bottom: 4px solid var(--ink); border-radius: 0 0 50% 40%; display: none; }
.chart-row .arrow { font-family: var(--font-display); font-size: 24px; visibility: hidden; }
.chart-row.mark .mark-line { display: block; }
.chart-row.mark .arrow { visibility: visible; }
.chart-row.mark .sn { font-weight: 800; }
.tier { margin: 6px 0 0; font-size: 70px; line-height: 1; text-align: center; transform: rotate(-3deg); }
.pct { margin: 0; font-size: 22px; font-weight: 800; }
.tier-line { margin: 0; font-size: 18px; font-weight: 700; text-align: center; }
.explain, .res-note { margin: 0; font-size: 16px; font-weight: 600; text-align: center; max-width: 40ch; }
.res-note { font-weight: 800; }
.cmp-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.keyline { display: flex; align-items: center; gap: 18px; font-size: 16px; font-weight: 700; }
.keyline span { display: inline-flex; align-items: center; gap: 8px; }
.keyline i { width: 28px; height: 6px; border-radius: 4px; display: inline-block; }
.seg-toggle { display: flex; border: 3px solid var(--ink); border-radius: var(--r1); overflow: hidden; }
.seg-toggle button { background: transparent; border: 0; cursor: pointer; padding: 8px 16px 6px; min-height: 44px; font-family: var(--font-display); font-size: 22px; }
.seg-toggle button + button { border-left: 3px solid var(--ink); }
.seg-toggle button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.sq-res { width: 100%; aspect-ratio: 1 / 1; }
.side { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.side figure { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.side .paper { width: 100%; aspect-ratio: 1 / 1; }
.side figcaption { font-family: var(--font-display); font-size: 22px; text-align: center; }
.sheet { background: var(--paper); border: 3px solid var(--ink); border-radius: 10px 16px 8px 14px / 14px 8px 16px 10px; padding: 18px 20px; display: grid; gap: 14px; min-width: 0; }
.sheet h3 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1.1; }
.res-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.res-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.res-foot .flame { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-size: 26px; }
.res-foot .next { font-size: 16px; font-weight: 700; }
.res-foot .next b { font-variant-numeric: tabular-nums; }

/* ---------- party lineup */
.lineup { padding-top: 150px; }
.lineup ol { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; width: 520px; max-width: 100%; }
.lineup li { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto; align-items: center; gap: 16px; padding: 10px 0; border-bottom: 3px solid var(--ink); border-radius: 0 0 40% 60% / 0 0 6px 4px; }
.lineup .rank, .lineup .pts { font-family: var(--font-display); font-size: 40px; line-height: 1; }
.lineup .who b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 30px; line-height: 1.1; }
.lineup .who span { font-size: 16px; font-weight: 700; }
.row-btns { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }

/* ---------- overlays */
.overlay { position: fixed; inset: 0; z-index: 40; overflow-y: auto; overscroll-behavior: contain; background: radial-gradient(ellipse at 18% 12%, var(--orange-hi) 0%, rgba(236,148,85,0) 44%), radial-gradient(ellipse at 90% 95%, var(--orange-lo) 0%, rgba(210,108,51,0) 50%), var(--orange); }
.overlay .grain { position: fixed; }
.overlay .close { position: fixed; z-index: 3; top: 34px; right: 40px; }
.overlay-inner { position: relative; z-index: 1; min-height: 100%; padding: 150px 24px 72px; display: flex; flex-direction: column; align-items: center; }
.panel-view { display: flex; flex-direction: column; align-items: center; gap: 36px; width: 100%; }
.panel-view h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 68px; line-height: 1; transform: rotate(-3deg); text-align: center; }
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 40px; width: 100%; max-width: 1040px; }
.step { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.step .n { font-family: var(--font-display); font-size: 30px; }
.step h3 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 46px; line-height: 1; }
.step p { margin: 0; font-size: 20px; font-weight: 600; }
.how-note { margin: 0; max-width: 62ch; font-size: 18px; font-weight: 600; text-align: center; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 24px; width: 100%; max-width: 1000px; }
.tile { display: flex; flex-direction: column; align-items: center; text-align: center; }
.tile b { font-family: var(--font-display); font-weight: 400; font-size: 72px; line-height: 1; }
.tile span { font-size: 17px; font-weight: 800; }
.week { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; max-width: 640px; }
.week h3 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 34px; transform: rotate(-1deg); }
.bars { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 18px; align-items: end; width: 100%; height: 230px; border-bottom: 3px solid var(--ink); border-radius: 0 0 4px 6px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.bar b { font-family: var(--font-display); font-weight: 400; font-size: 24px; line-height: 1; }
.bar i { display: block; width: 100%; background: var(--paper); border: 3px solid var(--ink); border-bottom: 0; border-radius: 10px 14px 0 0 / 12px 10px 0 0; }
.bar.today i { background: var(--ink); }
.bar-days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 18px; width: 100%; margin-top: -4px; font-size: 15px; font-weight: 800; text-align: center; }
.week-empty { margin: 0; font-size: 18px; font-weight: 700; }
.settings { display: flex; flex-direction: column; gap: 26px; width: 100%; max-width: 560px; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.set-row b { display: block; font-family: var(--font-display); font-weight: 400; font-size: 36px; line-height: 1.05; }
.set-row span { font-size: 17px; font-weight: 600; }
.switch { position: relative; flex: none; width: 84px; height: 46px; background: transparent; border: 3px solid var(--ink); border-radius: 30px 26px 32px 24px / 24px 30px 26px 32px; cursor: pointer; padding: 0; transition: background .2s ease; }
.switch::after { content: ""; position: absolute; top: 5px; left: 5px; width: 30px; height: 30px; box-sizing: border-box; border: 3px solid var(--ink); border-radius: 50% 46% 52% 48%; transition: left .2s ease, background .2s ease, border-color .2s ease; }
.switch[aria-checked="true"] { background: var(--ink); }
.switch[aria-checked="true"]::after { left: 43px; background: var(--paper); border-color: var(--paper); }
.slip { width: 440px; max-width: 100%; background: var(--paper); border: 3px solid var(--ink); border-radius: 6px 10px 5px 12px / 12px 5px 10px 6px; padding: 26px 30px 24px; transform: rotate(-1.5deg); display: flex; flex-direction: column; gap: 12px; }
.slip .row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.slip .logo { font-family: var(--font-display); font-size: 40px; line-height: 1; transform: rotate(-2deg); }
.slip .small { font-size: 13px; font-weight: 800; letter-spacing: .08em; }
.slip .cut { border-top: 3px dashed var(--ink); opacity: .8; }
.slip .big { font-family: var(--font-display); font-size: 46px; line-height: 1; }
.slip .pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.slip .pair .paper { width: 100%; aspect-ratio: 1 / 1; border-width: 2px; }
.share-text { margin: 0; max-width: 440px; width: 100%; padding: 10px 14px; background: var(--paper); border: 2px dashed var(--ink); border-radius: 8px; font-size: 14px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; user-select: text; }
.status-line { margin: 0; min-height: 26px; font-size: 18px; font-weight: 700; }

/* ---------- full exam report (the grader's scorecard) */
.sc { max-width: 760px; gap: 24px; }
.sc > .sheet, .sc-body > .sheet { width: 100%; }
.sc-body { display: grid; gap: 24px; width: 100%; }
.sc-top { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
.sc-sub { margin: 0; font-size: 18px; font-weight: 700; }
.sc-score { margin: 0; font-family: var(--font-display); font-size: 54px; line-height: 1; }
.empty-note { margin: 0; font-size: 16px; line-height: 1.5; }
.mapcard { position: relative; width: 100%; max-width: 460px; aspect-ratio: 1 / 1; }
.mapcard canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; border-radius: inherit; }
/* ---- the exam report ---- */
/* the score scale: one 100-point bar split into what you earned per category, what extra shapes cost, and what you missed */
.scale-block { position: relative; display: grid; gap: 8px; }
.scale-cap { margin: 0; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.scale { display: flex; gap: 2px; height: 28px; width: 100%; }
.seg { position: relative; min-width: 3px; border-radius: 4px; display: flex; align-items: center; overflow: visible; cursor: default; }
.seg.c1 { background: var(--cat-1); color: var(--cat-text); }
.seg.c2 { background: var(--cat-2); color: var(--cat-text); }
.seg.c3 { background: var(--cat-3); color: var(--cat-text); }
.seg.c4 { background: var(--cat-4); color: var(--cat-4-text); }
.seg.lost { background: var(--critical); color: #ffffff; }
.seg.none { background: var(--track); color: var(--muted); }
.seg span { padding-left: 7px; font-family: var(--font-mono); font-size: 12px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.seg span[hidden] { display: none; }
.scale-ends { display: flex; justify-content: space-between; margin-top: -4px; font-family: var(--font-mono); font-size: 10.5px; color: var(--muted); }
.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--ink); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.legend i.c1 { background: var(--cat-1); } .legend i.c2 { background: var(--cat-2); } .legend i.c3 { background: var(--cat-3); } .legend i.c4 { background: var(--cat-4); }
.legend i.lost { background: var(--critical); } .legend i.none { background: var(--track); box-shadow: inset 0 0 0 1px var(--line); }
.legend i.ring { background: transparent; box-shadow: inset 0 0 0 2px var(--blue); }
.legend i.pen { background: var(--pencil-fill); box-shadow: inset 0 0 0 2px var(--pencil); }
.legend i.dash { background: transparent; border: 2px dashed var(--critical); }
.legend i.hl { background: var(--hl); }
.legend i.fit { background: transparent; border: 2px dashed var(--fit); }
.legend i.red { width: 14px; height: 0; border-radius: 0; border-top: 2px dashed var(--critical); }
.tip { position: absolute; z-index: 5; bottom: calc(100% + 6px); left: 0; max-width: min(320px, 100%); padding: 7px 10px; border-radius: 6px; background: var(--btn); color: var(--btn-ink); font-size: 12.5px; line-height: 1.35; pointer-events: none; box-shadow: 0 6px 18px -8px var(--shadow); }

/* Scorecard tab */
.sc-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; }
.sc-head > div { min-width: 0; }
.sc-title { margin: 0; font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: 24px; line-height: 1.1; }
.sc-sub { margin: 4px 0 0; font-size: 14px; color: var(--muted); }
.panel { display: grid; gap: 14px; padding: 16px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); min-width: 0; }
.panel h3 { margin: 0; font-family: var(--font-display); font-stretch: 125%; font-weight: 800; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase; }
.panel-note { margin: -6px 0 0; font-size: 13.5px; line-height: 1.45; color: var(--muted); }
.sc-math { margin: 0; font-family: var(--font-mono); font-size: 13px; line-height: 1.6; overflow-wrap: anywhere; }
.sc-math b { font-weight: 600; }
.sc-math .sub { display: inline-block; margin-top: 4px; font-family: var(--font-body); font-size: 12.5px; line-height: 1.4; color: var(--muted); }
.empty-note { margin: 0; font-size: 14.5px; line-height: 1.5; }

/* each shape: a numbered row with its four measurements */
.slist { list-style: none; margin: 0; padding: 0; display: grid; }
.srow { display: grid; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.srow:first-child { border-top: 0; padding-top: 2px; }
.srow-head { display: flex; align-items: center; gap: 10px; }
.badge { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--blue); color: var(--card); font-family: var(--font-mono); font-size: 11px; font-weight: 600; }
.srow.missed .badge { background: var(--hl); color: var(--hl-ink); }
.srow-head .shape-ico { width: 20px; height: 20px; flex: none; color: var(--muted); }
.sname { flex: 1; min-width: 0; display: grid; }
.sname b { font-weight: 700; line-height: 1.25; }
.sname span { font-size: 12.5px; line-height: 1.35; color: var(--muted); }
.spts { flex: none; font-family: var(--font-mono); font-size: 15px; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.spts small { font-size: 11px; font-weight: 400; color: var(--muted); }
.smiss { margin: 0; padding-left: 34px; font-size: 13px; line-height: 1.4; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px 14px; padding-left: 34px; }
.metric { display: grid; align-content: start; gap: 1px; min-width: 0; }
.mk { font-family: var(--font-mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.mv { font-family: var(--font-mono); font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ms { font-size: 11.5px; line-height: 1.3; color: var(--muted); overflow-wrap: anywhere; }
.minibar { display: block; height: 4px; margin: 3px 0 2px; border-radius: 2px; background: var(--track); overflow: hidden; }
.minibar i { display: block; height: 100%; border-radius: 2px; }
.metric.c1 .minibar i { background: var(--cat-1); } .metric.c2 .minibar i { background: var(--cat-2); }
.metric.c3 .minibar i { background: var(--cat-3); } .metric.c4 .minibar i { background: var(--cat-4); }
.xlist { list-style: none; margin: 0; padding: 10px 0 0; border-top: 1px solid var(--line); display: grid; gap: 6px; font-size: 14px; }
.xlist:empty { display: none; }
.xlist li { display: flex; justify-content: space-between; gap: 12px; }
.xlist b { font-family: var(--font-mono); font-size: 13px; color: var(--critical); white-space: nowrap; }
.inkmap { margin: 0; display: grid; gap: 10px; }
/* what the grader saw: each recognized freehand shape, and the ink that fit nothing */
.rlist { list-style: none; margin: 0; padding: 0; display: grid; }
.rrow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 4px 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); }
.rrow:first-child { border-top: 0; padding-top: 2px; }
.letter { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; background: var(--fit); color: var(--card); font-family: var(--font-mono); font-size: 11px; font-weight: 600; }
.rrow.extra .letter { background: var(--critical); color: #ffffff; }
.rmain { display: grid; gap: 2px; min-width: 0; }
.rmain b { font-weight: 700; }
.rmain span { font-size: 12.5px; line-height: 1.4; color: var(--muted); overflow-wrap: anywhere; }
.rpair { font-family: var(--font-mono); font-size: 12px; text-align: right; white-space: nowrap; }
.rrow.extra .rpair { color: var(--critical); font-weight: 600; }
.unrec-note { margin: 0; padding-top: 10px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 12px; font-size: 14px; line-height: 1.45; }
.unrec-note b { font-family: var(--font-mono); font-size: 13px; color: var(--critical); white-space: nowrap; }
.layers { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.layers label { display: inline-flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; cursor: pointer; }
.layers input { width: 17px; height: 17px; margin: 0; accent-color: var(--blue); }
.inkmap .card { max-width: 440px; }

/* the scale: how each measurement turns into credit, with your shapes placed on it */
.rules { display: grid; gap: 22px; }
.rule { display: grid; gap: 6px; }
.rule-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.rule-head b { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.rule-head b i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.rule-head b i.c1 { background: var(--cat-1); } .rule-head b i.c2 { background: var(--cat-2); } .rule-head b i.c3 { background: var(--cat-3); } .rule-head b i.c4 { background: var(--cat-4); } .rule-head b i.lost { background: var(--critical); }
.rule-pts { font-family: var(--font-mono); font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.rule p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--muted); }
.rule p.you { color: var(--ink); font-size: 13.5px; }
.ruler { position: relative; display: grid; gap: 5px; padding: 6px 12px 0; }
.ruler-dots { position: relative; }
.ruler-dot { position: absolute; display: grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--blue); color: var(--card); font-family: var(--font-mono); font-size: 10px; font-weight: 600; white-space: nowrap; }
.ruler-track { height: 10px; border-radius: 5px; background: linear-gradient(to right, var(--c), var(--track)); }
.ruler-ticks { position: relative; height: 30px; }
.ruler-tick { position: absolute; top: 0; display: grid; justify-items: center; font-family: var(--font-mono); font-size: 10px; line-height: 1.35; color: var(--muted); white-space: nowrap; transform: translateX(-50%); }
.ruler-tick b { font-weight: 600; color: var(--ink); }
.ruler-tick.first { transform: translateX(-12px); justify-items: start; }
.ruler-tick.last { transform: translateX(calc(-100% + 12px)); justify-items: end; }
.bins { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.bin { display: grid; gap: 1px; padding: 8px 10px; border-radius: 5px; font-size: 13px; }
.bin b { font-weight: 700; }
.bin span { font-family: var(--font-mono); font-size: 11px; }
.bin.yes { background: var(--cat-1); color: var(--cat-text); }
.bin.no { background: var(--track); color: var(--ink); }
.bin .bin-n { font-family: var(--font-body); font-size: 12.5px; opacity: 0.92; }

@media (max-width: 480px) {
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); padding-left: 0; }
  .smiss { padding-left: 0; }
}
/* restyle the grader's report bits for the room */
.scale { height: 30px; }
.seg { border-radius: 6px 4px 7px 5px; }
.seg.c3 { color: var(--ink); }
.seg.lost { background: repeating-linear-gradient(-45deg, var(--critical) 0 6px, #A4281A 6px 12px); }
.seg.none { background: transparent; box-shadow: inset 0 0 0 2px var(--line); color: var(--muted); }
.seg span { font-weight: 800; font-size: 13px; }
.scale-cap { font-size: 12px; font-weight: 800; color: var(--ink); }
.scale-ends { font-size: 12px; font-weight: 700; }
.legend { font-size: 14px; font-weight: 600; }
.legend i.none { background: transparent; box-shadow: inset 0 0 0 2px var(--line); }
.tip { border-radius: 8px 12px 7px 10px; font-weight: 600; }
.mk { font-size: 11px; font-weight: 800; color: var(--ink); }
.mv { font-size: 15px; font-weight: 800; }
.ms { font-size: 12.5px; }
.spts { font-weight: 800; }
.sname b, .rmain b { font-weight: 800; }
.badge { background: var(--blue); color: var(--paper); font-weight: 800; }
.letter { font-weight: 800; }
.rule-head b { font-weight: 800; }
.rule-pts, .ruler-tick { font-size: 12px; font-weight: 700; }
.ruler-dot { font-weight: 800; }
.layers label { font-weight: 700; }
.layers input { accent-color: var(--ink); width: 20px; height: 20px; }
.sc-math { font-size: 14px; }
.sc-sub { margin: 0; font-size: 18px; font-weight: 700; color: var(--ink); }
.empty-note { font-size: 16px; }

/* ---------- blink: eyelids close over everything */
.lid { position: fixed; left: 0; right: 0; height: 52vh; z-index: 60; pointer-events: none; visibility: hidden; transition: transform .38s cubic-bezier(.6, 0, .4, 1), visibility 0s linear .38s; }
.lid-top { top: 0; transform: translateY(calc(-100% - 60px)); }
.lid-bot { bottom: 0; transform: translateY(calc(100% + 12px)); }
.app.lids-closed .lid { transform: translateY(0); visibility: visible; transition: transform .38s cubic-bezier(.6, 0, .4, 1), visibility 0s; }
.lid-skin { position: absolute; inset: 0; background: var(--lid); overflow: hidden; }
.lid-top .lid-skin { border-bottom: 6px solid var(--ink); border-radius: 0 0 50% 50% / 0 0 90px 90px; }
.lid-bot .lid-skin { border-top: 6px solid var(--ink); border-radius: 50% 50% 0 0 / 90px 90px 0 0; }
.lid-skin span { position: absolute; left: 0; right: 0; bottom: 28%; text-align: center; font-size: 56px; transform: rotate(-2deg); }
.lashes { position: absolute; left: 50%; bottom: -46px; width: 600px; max-width: 90%; transform: translateX(-50%); }

/* ---------- reduced motion (setting or system) */
.app.reduced *, .app.reduced *::before, .app.reduced *::after { animation: none !important; transition: none !important; }

/* ---------- narrow screens */
@media (max-width: 760px) {
  .screen { padding: 120px 16px 48px; }
  .quit { top: 20px; left: 16px; font-size: 24px; }
  .menu-wrap { top: 20px; right: 16px; }
  .overlay .close { top: 20px; right: 16px; }
  .cd { top: 96px; right: 16px; width: 120px; }
  .cd span { font-size: 42px; }
  .h-look, .h-draw, .panel-view h2 { font-size: 48px; }
  .tool-spacer { display: none; }
  .tools { flex-direction: row; width: auto; flex-wrap: wrap; justify-content: center; }
  .timer-tag { right: -8px; font-size: 30px; }
  .home { padding-bottom: 300px; }
  .streak { left: 16px; bottom: 20px; }
  .modes-wrap { right: 16px; bottom: 20px; max-width: calc(100% - 32px); }
  .tier { font-size: 52px; }
}
