:root {
  --brand: #0020a5; --brand-2: #253cc0; --violet: #4648d4;
  --desk: #23443c; --desk-dk: #19312b; --wall: #cbe3d7; --frame: #aeb8ba;
  --form: #f4e5a0; --print: #22408f; --hand: #23201c;
  --ink-a: #4342cf; --ink-r: #c3261e; --ink-e: #136049;
  --paper: #fffdf6; --text: #1a1d29; --muted: #5b6070;
  --head: 'Plus Jakarta Sans', system-ui, sans-serif; --body: 'Inter', system-ui, sans-serif; --script: 'Kalam', 'Comic Sans MS', cursive;
  --grain: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--desk-dk); color: var(--text); font: 15px/1.45 var(--body); -webkit-tap-highlight-color: transparent; }
body::before { content: ''; position: fixed; inset: 0; background-image: var(--grain); opacity: .5; pointer-events: none; }
#stage { position: relative; max-width: 540px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; min-height: 100dvh; }
.screen[hidden] { display: none; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid #ffd54a; outline-offset: 2px; }
.small { font-size: 13px; color: var(--muted); margin: 6px 0 0; }

/* ---------- shared panels + buttons (brand) ---------- */
.panel { background: #fff; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 10px; border-radius: 18px 18px 0 0; box-shadow: 0 -8px 24px rgba(0,0,0,.25); }
.btn { display: block; width: 100%; text-align: center; text-decoration: none; padding: 14px 16px; border-radius: 12px; border: 2px solid var(--brand); background: #fff; color: var(--brand); font: 700 16px/1.2 var(--head); cursor: pointer; transition: transform .08s; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 4px 0 #00137a; }
.btn-primary:active { box-shadow: 0 1px 0 #00137a; transform: translateY(3px); }
.btn-quiet { border-color: transparent; background: #eef0fb; color: var(--brand-2); font-size: 14px; padding: 10px; }
.row-btns { display: flex; gap: 8px; }

/* ---------- title ---------- */
.title-desk { position: relative; overflow: hidden; flex: 1; display: grid; place-items: center; padding: 28px 16px; background: radial-gradient(120% 80% at 50% 20%, #2e5a50, var(--desk) 60%, var(--desk-dk)); }
.title-form { position: relative; width: min(100%, 360px); background: var(--form); padding: 18px 20px 26px; transform: rotate(-2deg); box-shadow: 0 18px 30px rgba(0,0,0,.4), 0 2px 0 #d9c77a; border-top: 6px solid var(--print); }
.title-desk .title-id { position: absolute; width: 190px; top: 9%; left: 5%; transform: rotate(-8deg); }
.title-face { position: absolute; width: 132px; top: 5%; right: 6%; transform: rotate(4deg); background: var(--wall); border: 8px solid var(--frame); border-radius: 4px; height: 132px; overflow: hidden; z-index: 1; background-image: linear-gradient(rgba(255,255,255,.55) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.55) 1px, transparent 1px); background-size: 22px 22px; box-shadow: 0 14px 24px rgba(0,0,0,.35); }
.title-face svg { position: absolute; bottom: 0; left: 8px; width: 104px; height: 122px; }
.title-form { z-index: 2; margin-top: 90px; }
.title-form .ink { font-size: 30px; }
.tf-head { margin: 0; color: var(--print); font: 600 12px var(--body); display: flex; justify-content: space-between; border-bottom: 1px solid rgba(34,64,143,.35); padding-bottom: 6px; }
.title-form h1 { margin: 16px 0 4px; font: 800 44px/1 var(--head); color: var(--print); letter-spacing: -0.02em; }
.tf-hand { margin: 0; font: 400 22px var(--script); color: var(--hand); border-bottom: 1px dashed rgba(34,64,143,.4); }
.goal { margin: 0 0 4px; font: 600 16px/1.4 var(--head); color: var(--text); }

/* ---------- intro (rulebook page) ---------- */
.scr-intro { background: var(--desk); }
.book { flex: 1 1 auto; min-height: 0; overflow-y: auto; margin: 16px; padding: 22px 20px 20px 34px; background: var(--paper); border-radius: 4px 10px 10px 4px; position: relative; box-shadow: 0 14px 28px rgba(0,0,0,.35); background-image: repeating-linear-gradient(transparent 0 27px, #dfe5f3 27px 28px); align-self: stretch; }
.book::before { content: ''; position: absolute; left: 16px; top: 0; bottom: 0; width: 2px; background: #e8a3a3; }
.book-day { margin: 0; font: 700 14px var(--head); color: var(--brand-2); }
.book-new { margin: 2px 0 14px; font-size: 13px; color: var(--muted); }
.book h2 { margin: 0 0 12px; font: 800 30px/1.1 var(--head); color: var(--text); }
.book-line { font: 400 22px/1.27 var(--script); color: var(--hand); margin: 0 0 14px; }
.book-tip { font-size: 14px; background: #fff3c4; padding: 8px 10px; border-left: 4px solid #e2b400; margin: 0 0 12px; }
.book-src { font-size: 11px; color: var(--muted); margin: 12px 0 0; }
.book-stamp { display: inline-block; margin: 4px 0; }

/* ---------- play ---------- */
.scr-play { height: 100dvh; min-height: 0; overflow: hidden; background: var(--desk); }
.hud { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: #102620; color: #e9f2ee; font-size: 13px; z-index: 5; }
.hud-day { display: flex; flex-direction: column; line-height: 1.1; }
.hud-day b { font: 700 14px var(--head); }
.hud-day span { font-size: 11px; opacity: .75; font-variant-numeric: tabular-nums; }
.hud-clock { display: flex; align-items: center; gap: 6px; margin: 0 auto; font: 700 16px var(--head); font-variant-numeric: tabular-nums; }
.hud-clock svg { width: 30px; height: 30px; }
.hud-clock .cf { fill: #fbfaf5; stroke: #c9b37a; stroke-width: 2.5; }
.hud-clock .hh { stroke: #1b1b1b; stroke-width: 2.6; stroke-linecap: round; }
.hud-clock .hm { stroke: #1b1b1b; stroke-width: 1.6; stroke-linecap: round; }
.hud-clock.late span { color: #ffb4a8; }
.hud-clock.hurt { animation: hurt .5s; }
@keyframes hurt { 0%, 100% { transform: none; } 30% { transform: translateX(-4px); color: #ff8a7a; } 60% { transform: translateX(3px); } }
.hud-score { display: flex; align-items: center; gap: 6px; font: 800 18px var(--head); font-variant-numeric: tabular-nums; }
.streak { font: 700 12px var(--head); font-style: normal; padding: 2px 7px; border-radius: 99px; background: #2c4a42; color: #bcd; transition: transform .15s; }
.streak.hot { background: #ffcf3f; color: #3a2600; }
.streak.squash { animation: squash .35s; }
@keyframes squash { 30% { transform: scale(1.3, .6); } }
.streak.pulse { animation: pulse .4s; }
@keyframes pulse { 40% { transform: scale(1.35); } }
.hud-btn { background: #24443b; border: 1px solid #3f6a5e; color: #e9f2ee; padding: 6px 10px; border-radius: 8px; font: 600 13px var(--body); cursor: pointer; }

/* the window: wall, client, glass */
.window { position: relative; height: 118px; flex: none; overflow: hidden; background: var(--wall); border-bottom: 10px solid var(--frame); box-shadow: inset 0 -2px 0 #8d999b; }
.tiles { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.55) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.55) 1px, transparent 1px); background-size: 22px 22px; }
.glass { position: absolute; inset: 0; background: linear-gradient(115deg, rgba(255,255,255,0) 30%, rgba(255,255,255,.35) 38%, rgba(255,255,255,0) 46%, rgba(255,255,255,0) 70%, rgba(255,255,255,.18) 74%, rgba(255,255,255,0) 80%); border-left: 6px solid var(--frame); border-right: 6px solid var(--frame); pointer-events: none; }
.slot { position: absolute; left: 30%; right: 30%; bottom: -1px; height: 12px; background: #3b4b4d; border-radius: 10px 10px 0 0; }
.token { position: absolute; left: 12px; top: 8px; background: #111; padding: 2px 7px; border-radius: 3px; border: 2px solid #555; z-index: 2; }
.token span { font: 800 20px/1 var(--head); color: #ff3b2f; text-shadow: 0 0 6px rgba(255,59,47,.8); font-variant-numeric: tabular-nums; letter-spacing: .05em; }
.client { position: absolute; left: 18%; bottom: 0; width: 96px; height: 112px; transition: transform .45s cubic-bezier(.2,.8,.2,1), opacity .3s; }
.client svg { width: 100%; height: 100%; display: block; }
.client.out { transform: translateX(-160%); opacity: 0; }
.client.leave { transform: translateX(240%); opacity: 0; }
.client.react { animation: bob .4s; }
@keyframes bob { 40% { transform: translateY(-6px); } }
.client .kid { position: absolute; left: 62px; bottom: -8px; width: 62px; height: 72px; }
.bubble { position: absolute; left: calc(18% + 104px); right: 10px; top: 16px; background: #fff; border-radius: 12px; padding: 7px 10px; font: 500 14px/1.3 var(--body); box-shadow: 0 2px 0 rgba(0,0,0,.12); max-width: 230px; transition: opacity .2s; }
.bubble::before { content: ''; position: absolute; left: -7px; top: 14px; border: 7px solid transparent; border-right-color: #fff; border-left: 0; }
.bubble:empty { opacity: 0; }
.poster { position: absolute; right: 12px; top: 6px; width: 104px; background: #fff8e8; padding: 4px 6px 5px; font-size: 10px; line-height: 1.25; transform: rotate(2deg); box-shadow: 0 2px 4px rgba(0,0,0,.2); z-index: 3; cursor: pointer; }
.poster::before { content: ''; position: absolute; top: -5px; left: 36px; width: 32px; height: 10px; background: rgba(230,220,170,.85); }
.poster b { display: block; color: var(--ink-r); font: 700 11px var(--head); }
.window.fri .poster { right: auto; left: 8px; top: 8px; width: 96px; transform: rotate(-2deg); }
.window.fri .client { left: 104px; }
.window.fri .bubble { left: 206px; right: 66px; font-size: 13px; }
.window.fri .token { left: auto; right: 10px; top: auto; bottom: 14px; }
@media (max-width: 400px) { .window.fri .client { left: 100px; width: 84px; } .window.fri .bubble { left: 188px; } }

/* counter + papers */
.counter { position: relative; flex: 1; min-height: 0; padding: 10px 10px 6px; background: var(--desk); background-image: var(--grain), radial-gradient(130% 90% at 50% 0%, #2b5148, var(--desk) 65%); }
.counter.shake { animation: deskshake .22s; }
@keyframes deskshake { 20% { transform: translate(0, 3px); } 45% { transform: translate(-2px, -1px); } 70% { transform: translate(1px, 1px); } }
.papers { display: grid; grid-template-columns: 1.1fr 1fr; gap: 8px 8px; align-items: start; transition: transform .45s cubic-bezier(.5,0,.75,0), opacity .4s; }
.papers.away { transform: translateY(-140%) scale(.6); opacity: 0; }
.papers.in > * { animation: drop .38s cubic-bezier(.2,.9,.3,1.2) both; }
.papers.in > *:nth-child(2) { animation-delay: .07s; }
.papers.in > *:nth-child(3) { animation-delay: .14s; }
.papers.in > *:nth-child(4) { animation-delay: .2s; }
@keyframes drop { from { transform: translateY(-50px) rotate(var(--r, 0deg)); opacity: 0; } to { transform: rotate(var(--r, 0deg)); opacity: 1; } }
.doc { position: relative; transform: rotate(var(--r, 0deg)); box-shadow: 0 4px 10px rgba(0,0,0,.35); overflow: hidden; }
.extras { display: flex; flex-direction: column; gap: 8px; }

.f { cursor: pointer; border-radius: 3px; transition: background .12s, box-shadow .12s; }
.f:hover { background: rgba(70,72,212,.08); }
.f.hl { background: rgba(255,214,74,.45); box-shadow: 0 0 0 2px #e0a800; }
.f.hl.photo-f { box-shadow: 0 0 0 3px #e0a800; }

/* KYC form */
.form { grid-column: 1 / -1; background: var(--form); padding: 6px 9px 7px; --r: -0.6deg; border-top: 4px solid var(--print); }
.form-head { display: flex; justify-content: space-between; align-items: baseline; color: var(--print); font: 700 11px var(--head); border-bottom: 1px solid rgba(34,64,143,.35); padding-bottom: 3px; margin-bottom: 3px; }
.form-head span { font: 500 10px var(--body); opacity: .8; }
.frow { display: grid; grid-template-columns: 78px 1fr; align-items: baseline; gap: 6px; padding: 2px 2px; min-height: 24px; }
.frow label { color: var(--print); font-size: 10.5px; line-height: 1.1; }
.frow .val { font: 700 17px/1.2 var(--script); color: var(--hand); border-bottom: 1px dotted rgba(34,64,143,.55); background-image: repeating-linear-gradient(90deg, transparent 0 15px, rgba(34,64,143,.18) 15px 16px); text-transform: uppercase; letter-spacing: .02em; overflow-wrap: anywhere; }
.frow .val.blank { color: transparent; }
.frow .val.blank::after { content: '.'; color: transparent; }
.checks { display: flex; gap: 10px; font-size: 11px; color: var(--print); }
.box { display: inline-block; width: 13px; height: 13px; border: 1.5px solid var(--print); vertical-align: -2px; margin-right: 3px; position: relative; background: #fffbe3; }
.box.on::after { content: ''; position: absolute; left: 2px; top: -3px; width: 5px; height: 10px; border: solid var(--hand); border-width: 0 2.5px 2.5px 0; transform: rotate(40deg); }

/* ink impressions */
.ink { position: absolute; z-index: 4; pointer-events: none; padding: 3px 12px; border: 3px solid currentColor; border-radius: 6px; font: 800 24px/1 var(--head); letter-spacing: .08em; text-transform: uppercase; opacity: .86; mix-blend-mode: multiply; -webkit-mask-image: var(--grain-mask); mask-image: var(--grain-mask); -webkit-mask-size: 120px; mask-size: 120px; }
.ink::after { content: ''; position: absolute; inset: 3px; border: 1px solid currentColor; border-radius: 3px; }
.ink.approve { color: var(--ink-a); } .ink.reject { color: var(--ink-r); } .ink.escalate { color: var(--ink-e); font-size: 20px; }
.ink.fresh { animation: inkin .16s ease-out; }
@keyframes inkin { from { transform: var(--t) scale(1.25); opacity: 0; } to { transform: var(--t); opacity: .86; } }

/* ID cards */
.idcard { min-height: 118px; padding: 6px 8px; border-radius: 7px; display: grid; grid-template-columns: 30% 1fr; grid-template-rows: auto 1fr; gap: 3px 7px; font-size: 10.5px; line-height: 1.2; --r: 1.2deg; }
.idcard .id-top { grid-column: 1 / -1; font: 800 10px var(--head); display: flex; justify-content: space-between; }
.idcard .id-top em { font: 600 8px var(--body); font-style: normal; opacity: .65; }
.idcard .ph { align-self: start; background: #e8eef2; border-radius: 3px; overflow: hidden; aspect-ratio: .82; }
.idcard .ph svg { width: 100%; height: 100%; display: block; }
.idcard dl { margin: 0; display: grid; gap: 1px; align-content: start; }
.idcard dt { font-size: 8.5px; opacity: .65; }
.idcard dd { margin: 0 0 2px; font-weight: 700; font-size: 11.5px; overflow-wrap: anywhere; }
.idcard .num { font-size: 8.5px; opacity: .8; font-variant-numeric: tabular-nums; }
.idcard::after { content: 'SPECIMEN'; position: absolute; right: -10px; bottom: 22%; transform: rotate(-24deg); font: 800 17px var(--head); color: rgba(200,30,30,.16); letter-spacing: .1em; pointer-events: none; }
.id-aadhaar { background: linear-gradient(#fff, #fff) padding-box; background-color: #fff; border-top: 6px solid #f29b38; border-bottom: 5px solid #3d9b4a; }
.id-passport { background: #eef1f7; border-top: 7px solid #1d2c5e; }
.id-passport .id-top { color: #1d2c5e; }
.id-dl { background: #f8d6de; }
.id-dl .id-top { color: #8c1f3b; }
.id-voter { background: #dfe5ec; border-left: 6px solid #6b7a8c; }
.id-pan { background: #cfe2f2; }
.id-pan .id-top { color: #0e4d7c; }
.id-college { background: #fff; border-top: 7px solid #2c7a4b; }
.id-ration { background: #f7deb2; }

/* small slips */
.slip { padding: 6px 8px 7px; font-size: 10.5px; line-height: 1.25; background: var(--paper); }
.slip h4 { margin: 0 0 2px; font: 800 10px var(--head); display: flex; justify-content: space-between; }
.slip p { margin: 0; }
.slip .k { font-size: 8.5px; opacity: .6; display: block; margin-top: 1px; }
.slip b { font-size: 11.5px; }
.bill { --r: -1.6deg; border-top: 4px dashed #d6a300; }
.bill h4 { color: #7a5b00; }
.cheque { --r: 0.8deg; background: repeating-linear-gradient(-35deg, #e5f1ef 0 3px, #edf7f4 3px 6px); border: 1px solid #9cc6bd; }
.cheque h4 { color: #1d5d52; }
.cheque .sig { font: 400 15px/1 var(--script); color: #1f2c7a; border-bottom: 1px solid #577; display: inline-block; padding: 0 4px; transform: rotate(-4deg); }
.marriage { --r: -0.8deg; background: #fffaf0; border: 3px double #b48a3c; }
.marriage h4 { color: #8b6420; }

/* note + citations + pops */
.note { position: absolute; right: 12px; bottom: 8px; max-width: 58%; background: #fff27a; padding: 6px 9px; font: 400 15px/1.2 var(--script); color: #2b2400; transform: rotate(2deg); box-shadow: 0 3px 6px rgba(0,0,0,.3); z-index: 6; }
.note[hidden] { display: none; }
.cites { position: absolute; right: 8px; bottom: 6px; width: min(76%, 300px); z-index: 7; pointer-events: none; }
.cite { background: #ffd9e1; border: 1px solid #e79aaa; padding: 8px 10px 10px; margin-bottom: 6px; font-size: 12.5px; line-height: 1.3; box-shadow: 0 8px 16px rgba(0,0,0,.35); background-image: radial-gradient(circle at 6px 50%, #fff 3px, transparent 3.5px), radial-gradient(circle at calc(100% - 6px) 50%, #fff 3px, transparent 3.5px); background-size: 100% 12px; background-repeat: repeat-y; padding-left: 16px; padding-right: 16px; transform-origin: top; animation: print .7s steps(7) both; }
.cite b { display: block; font: 800 13px var(--head); color: #8d0f22; }
.cite .pen { float: right; font: 800 12px var(--head); color: #8d0f22; }
@keyframes print { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.cite.gone { transition: opacity .4s, transform .4s; opacity: 0; transform: translateY(-20px) rotate(-3deg); }
.pops { position: absolute; inset: 0; pointer-events: none; z-index: 8; }
.pop { position: absolute; font: 800 22px var(--head); color: #fff; text-shadow: 0 2px 0 rgba(0,0,0,.4); animation: popup .8s ease-out forwards; white-space: nowrap; transform: translateX(-50%); }
.pop.small { font-size: 14px; color: #ffe27a; }
@keyframes popup { 0% { transform: translate(-50%, 6px) scale(.6); opacity: 0; } 20% { transform: translate(-50%, -4px) scale(1.15); opacity: 1; } 100% { transform: translate(-50%, -46px); opacity: 0; } }

/* loupe */
.loupe { flex: none; height: 96px; overflow: auto; overscroll-behavior: contain; background: #f7f8fb; border-top: 3px solid #c9b37a; padding: 6px 10px; font-size: 13px; }
.loupe-empty { margin: 8px 0; color: var(--muted); font-size: 13px; }
.loupe h5 { margin: 0 0 3px; font: 700 12px var(--head); color: var(--brand-2); }
.lrow { display: grid; grid-template-columns: 86px 1fr; gap: 8px; padding: 2px 0; border-bottom: 1px solid #e6e8f0; }
.lrow span:first-child { color: var(--muted); font-size: 12px; }
.lrow span:last-child { font-weight: 600; letter-spacing: .01em; overflow-wrap: anywhere; }
.lfaces { display: flex; gap: 12px; align-items: end; }
.lfaces figure { margin: 0; text-align: center; font-size: 11px; color: var(--muted); }
.lfaces svg { width: 58px; height: 68px; display: block; background: #e8eef2; border-radius: 6px; }

/* stamps */
.stamps { flex: none; display: flex; gap: 10px; justify-content: center; padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); background: #15302a; }
.stamp-btn { position: relative; flex: 1; max-width: 150px; height: 74px; border: 0; background: none; cursor: pointer; padding: 0; touch-action: manipulation; }
.stamp-btn[hidden] { display: none; }
.stamp-btn .knob { position: absolute; left: 50%; top: 0; width: 34px; height: 30px; transform: translateX(-50%); border-radius: 50% 50% 40% 40%; background: radial-gradient(circle at 35% 30%, #c98a56, #7a4522 70%); box-shadow: 0 2px 0 #4a2812; }
.stamp-btn .knob::after { content: ''; position: absolute; left: 50%; top: 26px; width: 14px; height: 12px; transform: translateX(-50%); background: #6b3b1c; }
.stamp-btn .block { position: absolute; left: 0; right: 0; bottom: 4px; height: 34px; display: grid; place-items: center; border-radius: 6px; font: 800 14px var(--head); letter-spacing: .04em; color: #fff; text-transform: uppercase; box-shadow: 0 4px 0 rgba(0,0,0,.35); }
.s-approve .block { background: var(--ink-a); }
.s-reject .block { background: var(--ink-r); }
.s-escalate .block { background: var(--ink-e); }
.stamp-btn kbd { position: absolute; right: 6px; top: 4px; font: 600 10px var(--body); color: #b7cbc4; }
.stamp-btn:active .block, .stamp-btn.down .block { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0,0,0,.35); }
.stamp-btn:disabled { opacity: .35; cursor: default; }
.stamp-btn.guide .block { animation: guide 1s infinite; }
@keyframes guide { 50% { box-shadow: 0 4px 0 rgba(0,0,0,.35), 0 0 0 5px #ffd54a; } }
.flying { position: absolute; z-index: 20; pointer-events: none; width: 120px; height: 74px; }
.flying .knob, .flying .block { position: absolute; }

/* rulebook sheet */
.sheet { position: absolute; inset: 0; background: rgba(8,18,15,.55); display: flex; align-items: flex-end; z-index: 30; }
.sheet[hidden] { display: none; }
.sheet-card { width: 100%; background: var(--paper); padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; max-height: 80%; overflow: auto; }
.sheet-card h3 { margin: 0; font: 800 20px var(--head); }
.sheet-card ol { padding-left: 20px; }
.sheet-card li { margin-bottom: 10px; }
.sheet-card li b { font-family: var(--head); }
.sheet-card li p { margin: 2px 0; font-size: 14px; }
.sheet-card li .tip { color: var(--muted); font-size: 13px; }

/* report + end */
.scr-report, .scr-end { background: var(--desk); }
.report { flex: 1; margin: 16px; min-height: 0; padding: 18px 16px; background: var(--paper); border-radius: 6px; box-shadow: 0 14px 28px rgba(0,0,0,.35); }
.rep-head { margin: 0; font: 600 13px var(--body); color: var(--muted); }
.report h2 { margin: 2px 0 12px; font: 800 26px/1.15 var(--head); }
.rep-stats { display: flex; gap: 8px; margin-bottom: 12px; }
.rep-stats div { flex: 1; background: #eef0fb; border-radius: 10px; padding: 8px; text-align: center; }
.rep-stats b { display: block; font: 800 22px var(--head); color: var(--brand); font-variant-numeric: tabular-nums; }
.rep-stats span { font-size: 12px; color: var(--muted); }
.rep-list, .end-hurt { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rep-list li { border-left: 5px solid var(--ink-r); background: #fff4f4; padding: 8px 10px; font-size: 14px; }
.rep-list li.good { border-color: #2f8a57; background: #f0faf3; }
.rep-list .who { font: 700 14px var(--head); }
.rep-list .did { font-size: 12px; color: var(--muted); margin: 1px 0 4px; }
.rep-list .hurt { margin: 0 0 3px; }
.rep-list .why { margin: 0; color: #333; font-size: 13px; }
.rep-list .src { margin: 3px 0 0; font-size: 11px; color: var(--muted); }
.best-stamp { display: inline-block; margin: 0 0 10px; padding: 3px 10px; border: 3px solid var(--ink-a); color: var(--ink-a); font: 800 15px var(--head); text-transform: uppercase; transform: rotate(-5deg); border-radius: 4px; }
.end-grid { display: grid; gap: 6px; margin: 0 0 14px; }
.end-grid .gday { display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 6px; font: 700 13px var(--head); }
.end-grid .marks { display: flex; flex-wrap: wrap; gap: 4px; }
.mk { width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; }
.mk.ok { background: #2f8a57; } .mk.no { background: var(--ink-r); }
.end-hurt li { font-size: 14px; background: #f4f5f8; padding: 7px 10px; border-radius: 8px; display: flex; justify-content: space-between; gap: 10px; }
.end-hurt li b { font-family: var(--head); }
.cta { background: #eef0fb; border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.cta[hidden] { display: none; }
.cta p { margin: 0; font-size: 14px; }

/* narrow + reduced motion */
@media (max-height: 680px) { .window { height: 100px; } .client { width: 82px; height: 96px; } .bubble { left: calc(18% + 88px); font-size: 13px; } }
@media (min-width: 541px) and (max-width: 1023px) { #stage { box-shadow: 0 0 60px rgba(0,0,0,.4); } }
.nomotion *, .nomotion *::before, .nomotion *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; } }

/* short phones: tighten the papers so the stamps never fall off */
@media (max-height: 700px) { .frow { min-height: 20px; padding: 0 2px; } .frow .val { font-size: 15px; } .idcard { min-height: 104px; font-size: 9.5px; } .idcard dd { font-size: 10.5px; } }

/* ---------- layout rules (docs/DESIGN.md "Layout rules", docs/DESKTOP.md) ----------
   Every screen is a fixed-height shell: nothing scrolls the page, long lists scroll inside their own card,
   and the primary button sits at the bottom edge (phones) or in the side column (desktop). */
.scr-title, .scr-intro, .scr-play, .scr-report, .scr-end { flex: none; height: 100dvh; min-height: 0; overflow: hidden; }
.title-desk { min-height: 0; }
.rail-slot:empty { display: none; }
.side-col { flex: none; display: flex; flex-direction: column; }
.act-panel { gap: 10px; }
.book-chip:empty, .rep-chip:empty { display: none; }
.book-chip { margin: 10px 0 0; }
.rep-chip { margin: 10px 0 2px; }
.play-grid { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.play-main { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.play-side { flex: none; display: flex; flex-direction: column; }
.report { display: flex; flex-direction: column; padding-bottom: 10px; }
.rep-top { flex: none; }
.rep-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; outline: none; margin: 0 -6px; padding: 0 6px 6px; }
.end-main { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 6px; }
.end-main .report { flex: none; margin-bottom: 0; }
.end-promo { margin: 12px 16px 0; }
.end-promo:empty { display: none; }
.deb-h { margin: 0 0 8px; font: 800 16px var(--head); }
.end-actions { flex: none; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: #15302a; box-shadow: 0 -6px 18px rgba(0,0,0,.3); }
.end-actions .btn { flex: 1; }
.end-actions .small { color: rgba(255,255,255,.8); max-height: 3.2em; overflow: hidden; }
.end-actions .small:empty { display: none; }
@media (max-height: 700px) { .loupe { height: 76px; } .report { margin: 10px 12px; padding: 12px; } .report h2 { font-size: 22px; margin-bottom: 8px; } .book { margin: 10px 12px; padding: 14px 14px 14px 30px; } .book h2 { font-size: 24px; } .book-line { font-size: 19px; } }

/* tablets: the same single column, a little wider */
@media (min-width: 600px) and (max-width: 1023px) { #stage { max-width: 600px; } }

/* desktop (1024+): two columns. Desk on the left, the loupe + stamps + promo rail beside it. */
@media (min-width: 1024px) {
  #stage { max-width: 1180px; }
  body { background: radial-gradient(120% 90% at 50% 0%, #2b5148, var(--desk) 55%, var(--desk-dk)); background-attachment: fixed; }
  .scr-intro, .scr-report, .scr-end { background: none; }
  .scr-play { --side: 340px; --mw: min(640px, calc(100vw - 72px - var(--side))); background: none; padding: 0 24px 20px; }
  .hud { width: calc(var(--mw) + 24px + var(--side)); margin: 0 auto; border-radius: 0 0 12px 12px; padding: 7px 14px; }
  .play-grid { display: grid; grid-template-columns: var(--mw) var(--side); gap: 24px; justify-content: center; padding-top: 14px; }
  .play-main { border-radius: 12px; overflow: hidden; box-shadow: 0 16px 40px rgba(0,0,0,.35); }
  .window { height: 128px; }
  .play-side { min-height: 0; gap: 12px; }
  .loupe { flex: 1 1 auto; height: auto; min-height: 0; border-top: 0; border-radius: 12px; padding: 12px 14px; font-size: 14px; }
  .loupe-empty { font-size: 14px; }
  .stamps { border-radius: 12px; padding: 10px; }
  .sheet-card { max-width: 560px; margin: 0 auto; }
  .sheet { justify-content: center; }

  .scr-title { flex-direction: row; align-items: center; justify-content: center; gap: 40px; padding: 24px; background: none; }
  .title-desk { flex: 0 1 560px; height: min(600px, calc(100dvh - 48px)); border-radius: 18px; background: none; }
  .scr-title .panel { flex: 0 0 360px; border-radius: 18px; padding: 22px; }

  .scr-intro, .scr-report { display: grid; grid-template-columns: minmax(0, 620px) 340px; grid-template-rows: minmax(0, 1fr); gap: 24px; justify-content: center; padding: 24px; }
  .scr-intro .book, .scr-report .report { margin: 0; max-height: calc(100dvh - 48px); }
  .scr-intro .book { align-self: start; }
  .side-col { gap: 12px; align-self: start; }
  .act-panel { border-radius: 16px; padding: 18px; }

  .scr-end { display: grid; grid-template-columns: minmax(0, 560px) 380px; grid-template-rows: auto auto minmax(0, 1fr); grid-template-areas: "top promo" "deb actions" "deb ."; gap: 16px 24px; justify-content: center; padding: 24px; }
  .end-main { display: contents; }
  .end-main .report { margin: 0; }
  .end-top { grid-area: top; }
  .end-deb { grid-area: deb; min-height: 0; overflow-y: auto; align-self: start; max-height: 100%; }
  .end-promo { grid-area: promo; margin: 0; align-self: start; }
  .end-actions { grid-area: actions; background: none; box-shadow: none; padding: 0; }
}
