/* The Birthday Investigation (public/templates/birthday-investigation.html; the film is drawn by detective.js on one canvas).
   Lettering from the font library, each for its job: Saira Stencil (the stamps: CASE CLOSED, the title), Staatliches (the invitation's headline, like a police
   notice), Overpass Mono (the typed case file: the line under the title, the details), Sedgwick Ave (the marker note on the evidence board, on the canvas),
   Red Hat Display (what the detectives say, in their bubbles, and the buttons).
   Only transform and opacity ever move; nothing that moves carries a filter. */
:root { --ink: #1E2228; --night: #0E1214; --manila: #E2C98E; --manila-d: #B89A58; --paper: #FBF8F0; --red: #B3262E; --red-d: #8E1E24; --lamp: #FFD9A0; --type: #2A2420; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0B0D10; color: var(--ink); overflow: hidden; -webkit-tap-highlight-color: transparent; }
body { font-family: 'Red Hat Display', system-ui, sans-serif; }
#film { position: fixed; inset: 0; display: block; z-index: 1; }
.veil { position: fixed; inset: 0; pointer-events: none; opacity: 0; z-index: 30; background: #07080A; }

/* the scene's number and name, top left, as it begins */
#stamp { position: fixed; left: max(16px, env(safe-area-inset-left)); top: max(16px, env(safe-area-inset-top)); z-index: 40; margin: 0; padding: 6px 12px 7px 8px; border-radius: 6px; background: rgba(10, 12, 14, .62);
  color: #F4ECDC; opacity: 0; pointer-events: none; display: none; align-items: center; gap: 8px; will-change: opacity; white-space: nowrap; }
.playing #stamp { display: flex; }
#stamp b { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 4px; background: var(--manila); color: var(--type); font: 800 14px/1 'Saira Stencil', Impact, sans-serif; }
#stamp span { font: 700 13px/1.1 'Overpass Mono', monospace; letter-spacing: .04em; text-transform: uppercase; }

/* a speech bubble at whoever is talking */
.bubble { position: fixed; left: 0; top: 0; z-index: 45; max-width: min(300px, 76vw); padding: 10px 14px 11px; border-radius: 16px; background: #FFFFFF; color: var(--ink); font: 600 clamp(15px, 3.9vw, 19px)/1.3 'Red Hat Display', sans-serif;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .35); opacity: 0; pointer-events: none; will-change: transform, opacity; text-wrap: balance; }
.bubble i { position: absolute; left: 0; bottom: -7px; width: 14px; height: 14px; background: inherit; border-radius: 2px; }
.bubble.miller { background: #FFF6E6; }
.bubble.harris { background: #EAF1FA; }
.nowords .bubble { display: none; }

/* the opening: the case file, the title, the line under it, Play */
#intro { position: fixed; inset: 0; z-index: 60; display: none; place-items: center; padding: 24px 16px; background: radial-gradient(120% 90% at 50% 26%, #2A3436 0%, #12181A 60%, #0A0D0E 100%); color: #F4ECDC; text-align: center; overflow-y: auto; }
.intro #intro { display: grid; }
.i-box { width: min(440px, 100%); }
#i-pic { width: min(200px, 48vw); height: auto; display: block; margin: 0 auto 10px; }
.i-for { margin: 0 0 6px; font: 700 14px/1.3 'Overpass Mono', monospace; letter-spacing: .06em; text-transform: uppercase; color: var(--lamp); }
#intro h1 { margin: 0; font: 800 clamp(30px, 9vw, 46px)/1 'Saira Stencil', Impact, sans-serif; letter-spacing: .03em; text-transform: uppercase; color: #F4ECDC; text-wrap: balance; }
#intro h1 b { display: block; margin-top: 4px; color: var(--manila); font-weight: 800; }
.i-tag { margin: 12px auto 22px; max-width: 340px; font: 500 clamp(15px, 4vw, 17px)/1.45 'Overpass Mono', monospace; color: #CFC6B4; text-wrap: balance; }
.btn { appearance: none; border: 0; border-radius: 999px; padding: 15px 26px; min-height: 48px; font: 800 17px/1 'Red Hat Display', sans-serif; cursor: pointer; background: var(--manila); color: var(--type); }
.btn:hover { background: #EAD6A4; }
.btn.ghost { background: transparent; color: inherit; box-shadow: inset 0 0 0 2px currentColor; }
.btn.ghost:hover { background: rgba(0, 0, 0, .05); }
#b-play.wait::after { content: ' ·'; }
.i-quiet { display: block; margin: 12px auto 0; background: none; border: 0; color: #B9B2A0; font: 600 14px/1.2 'Red Hat Display', sans-serif; text-decoration: underline; cursor: pointer; padding: 8px; }

/* during the film: Pause, Words, Skip, quiet, low on the left (the speaker is at the top right, from speaker.js) */
#ctl { position: fixed; left: 12px; bottom: max(14px, env(safe-area-inset-bottom)); z-index: 50; display: none; gap: 8px; flex-wrap: wrap; max-width: calc(100vw - 24px); }
.playing #ctl { display: flex; }
.cardon #ctl, .editing #ctl { display: none; }
.pill { appearance: none; border: 0; border-radius: 999px; padding: 9px 14px; min-height: 38px; background: rgba(10, 12, 14, .62); color: #F4ECDC; font: 700 13px/1 'Red Hat Display', sans-serif; cursor: pointer; white-space: nowrap; }
.pill:hover { background: rgba(10, 12, 14, .8); }
#vnote { position: fixed; right: 12px; bottom: max(64px, env(safe-area-inset-bottom)); z-index: 50; margin: 0; padding: 7px 12px; border-radius: 999px; background: rgba(10, 12, 14, .66); color: #F4ECDC; font: 500 12px/1.2 'Red Hat Display', sans-serif; pointer-events: none; }
.cardon #vnote { display: none; }

/* the question: Miller has asked; the film waits for the guest's answer */
#ask { position: fixed; left: 50%; bottom: max(70px, calc(env(safe-area-inset-bottom) + 64px)); z-index: 55; transform: translateX(-50%); width: min(420px, calc(100vw - 32px)); display: grid; gap: 10px; }
#ask[hidden] { display: none; }
#ask button { appearance: none; border: 0; border-radius: 12px; min-height: 54px; padding: 12px 18px; background: var(--paper); color: var(--type); font: 800 17px/1.2 'Red Hat Display', sans-serif; text-align: left; cursor: pointer;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .4), inset 4px 0 0 var(--manila-d); }
#ask button:hover, #ask button:focus-visible { background: #FFFFFF; box-shadow: 0 8px 22px rgba(0, 0, 0, .4), inset 6px 0 0 var(--red); outline: none; }
#ask button[hidden] { display: none; }

/* the invitation: the case file the film ends on becomes this one, and opens; then it stays */
#cardwrap { position: fixed; inset: 0; z-index: 20; display: grid; justify-items: center; align-items: start; padding: 64px 16px 72px; opacity: 0; visibility: hidden; perspective: 1600px; pointer-events: none; overflow: hidden; }
.cardon #cardwrap { opacity: 1; visibility: visible; pointer-events: auto; overflow-y: auto; background: rgba(7, 8, 10, .5); }
#card { position: relative; width: min(440px, 100%); margin: auto 0; transform-style: preserve-3d; will-change: transform; transform-origin: 50% 40%; }
#c-in { position: relative; padding: 34px 24px 22px; border-radius: 6px; background: var(--paper); box-shadow: 0 0 0 10px var(--manila), 0 0 0 11px var(--manila-d), 0 22px 50px rgba(0, 0, 0, .5); text-align: center; opacity: 0; }
.cardon #c-in { opacity: 1; }
#c-in::before { content: ''; position: absolute; left: 18px; top: -30px; width: 128px; height: 22px; border-radius: 6px 6px 0 0; background: var(--manila); box-shadow: 0 -1px 0 var(--manila-d); }
#c-cover { position: absolute; inset: -10px; z-index: 3; border-radius: 6px; background: linear-gradient(160deg, #EBD5A0, #D8BC80); box-shadow: inset 0 0 0 1px var(--manila-d); transform-origin: 0 50%; backface-visibility: hidden; -webkit-backface-visibility: hidden; will-change: transform; color: var(--type); }
.cardon #c-cover { display: none; }
.c-tab { position: absolute; left: 18px; top: -22px; padding: 4px 14px; border-radius: 6px 6px 0 0; background: #EBD5A0; font: 700 12px/1.2 'Overpass Mono', monospace; letter-spacing: .1em; }
.c-label { position: absolute; left: 50%; top: 60px; transform: translateX(-50%); width: min(300px, 80%); margin: 0; padding: 12px 14px; background: var(--paper); border: 1px solid #CFC6B4; text-align: left; font: 700 14px/1.5 'Overpass Mono', monospace; }
.c-label b { display: block; font-size: 18px; }
.c-label span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-st1, .c-st2 { position: absolute; left: 50%; margin: 0; padding: 4px 14px; border: 4px solid var(--red); color: var(--red); font: 800 30px/1.1 'Saira Stencil', Impact, sans-serif; white-space: nowrap; opacity: .9; }
.c-st1 { top: 46%; transform: translateX(-50%) rotate(-7deg); }
.c-st2 { top: 62%; transform: translateX(-50%) rotate(-4deg); font-size: 21px; }
.cd-case { display: inline-block; margin: 0 0 14px; padding: 3px 10px; border: 2.5px solid var(--red); color: var(--red); font: 800 13px/1.2 'Saira Stencil', Impact, sans-serif; letter-spacing: .06em; transform: rotate(-2deg); }
#t-head { margin: 0; font: 400 clamp(34px, 10vw, 48px)/.95 Staatliches, Impact, sans-serif; letter-spacing: .02em; text-transform: uppercase; color: var(--ink); text-wrap: balance; }
.cd-sub { margin: 10px auto 18px; max-width: 330px; font: 500 clamp(14px, 3.8vw, 15.5px)/1.5 'Overpass Mono', monospace; color: #4A4036; text-wrap: balance; }
.cd-for { margin: 0 0 6px; font: 700 13px/1.2 'Overpass Mono', monospace; letter-spacing: .08em; text-transform: uppercase; color: var(--red-d); }
#t-who { margin: 0; font: 800 clamp(24px, 7vw, 32px)/1.1 'Saira Stencil', Impact, sans-serif; letter-spacing: .02em; color: var(--ink); text-wrap: balance; }
.cd-age { margin: 4px 0 0; font: 700 15px/1.3 'Overpass Mono', monospace; color: #4A4036; }
.cd-facts { margin: 16px auto 4px; padding: 14px 12px; max-width: 340px; border-top: 1.5px solid #E4DACB; border-bottom: 1.5px solid #E4DACB; }
.cd-facts p { margin: 0; }
.cd-when { font: 800 18px/1.3 'Red Hat Display', sans-serif; }
.cd-time { margin-top: 2px !important; font: 600 16px/1.3 'Red Hat Display', sans-serif; color: #3A3430; }
.cd-where { margin-top: 10px !important; font: 800 17px/1.3 'Red Hat Display', sans-serif; }
.cd-addr { font: 500 15px/1.35 'Red Hat Display', sans-serif; color: #3A3430; }
.cd-acts { display: flex; justify-content: center; flex-wrap: wrap; gap: 4px 18px; margin: 8px 0 4px; }
.linkish { appearance: none; background: none; border: 0; padding: 8px 4px; min-height: 40px; color: var(--red-d); font: 700 15px/1.2 'Red Hat Display', sans-serif; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.linkish[hidden] { display: none; }
.cd-more { margin: 10px auto 0; max-width: 340px; text-align: left; }
.cd-more div { display: grid; grid-template-columns: 7.5em 1fr; gap: 8px; padding: 6px 0; border-bottom: 1px solid #ECE4D4; }
.cd-more dt { font: 700 12px/1.5 'Overpass Mono', monospace; letter-spacing: .04em; text-transform: uppercase; color: #6A5E50; }
.cd-more dd { margin: 0; font: 500 15px/1.45 'Red Hat Display', sans-serif; white-space: pre-line; }
.cd-host { margin: 14px 0 0; font: 600 15px/1.4 'Red Hat Display', sans-serif; color: #3A3430; }
.cd-rsvp, .cd-dish { margin: 22px auto 0; padding-top: 18px; max-width: 360px; border-top: 2px solid #ECE4D4; }
.cd-rsvp h3, .cd-dish h3 { margin: 0 0 6px; font: 400 clamp(22px, 6vw, 27px)/1.05 Staatliches, Impact, sans-serif; letter-spacing: .03em; text-transform: uppercase; text-wrap: balance; }
.cd-by { margin: 0 0 6px; font: 500 14px/1.4 'Overpass Mono', monospace; color: #5A5048; }
.cd-told { margin: 6px 0 10px; font: 600 14px/1.45 'Red Hat Display', sans-serif; color: var(--red-d); text-wrap: balance; }
.ans { display: grid; gap: 8px; margin-top: 10px; }
.ans[hidden] { display: none; }
.ans button { appearance: none; border: 0; border-radius: 10px; min-height: 50px; padding: 12px 16px; background: #F1E8D6; color: var(--type); font: 800 16px/1.2 'Red Hat Display', sans-serif; cursor: pointer; box-shadow: inset 0 0 0 1.5px #D8C9A8; }
.ans button.yes { background: var(--ink); color: #FBF8F0; box-shadow: none; }
.ans button.picked { box-shadow: inset 0 0 0 3px var(--red); }
.ans button.yes.picked { box-shadow: 0 0 0 3px var(--red); }
.ans button[hidden] { display: none; }
#done p { margin: 6px 0; }
#done-t { font: 800 18px/1.3 'Red Hat Display', sans-serif; outline: none; }
#done-p { font: 500 15px/1.45 'Red Hat Display', sans-serif; color: #3A3430; }
#r-closed { font: 600 15px/1.45 'Red Hat Display', sans-serif; color: #5A5048; }
#dish-sum { margin: 0 0 12px; font: 500 15px/1.45 'Red Hat Display', sans-serif; color: #3A3430; }
.cd-dish-acts { display: grid; gap: 8px; }
.cd-dish .btn { width: 100%; font-size: 16px; }
.cd-dish .btn.ghost { color: var(--type); }
.cd-foot { margin-top: 18px; }

/* the reply and the food, in sheets over the invitation */
.sheet { position: fixed; inset: 0; z-index: 80; display: grid; align-items: end; justify-items: center; background: rgba(7, 8, 10, .55); overflow-y: auto; }
.sheet[hidden] { display: none; }
.sh-in { width: min(480px, 100%); max-height: 92vh; overflow-y: auto; padding: 22px 20px calc(20px + env(safe-area-inset-bottom)); border-radius: 18px 18px 0 0; background: var(--paper); color: var(--ink); box-shadow: 0 -10px 40px rgba(0, 0, 0, .35); }
@media (min-width: 700px) { .sheet { align-items: center; } .sh-in { border-radius: 14px; } }
.sh-in h3 { margin: 0 0 12px; font: 400 26px/1.1 Staatliches, Impact, sans-serif; letter-spacing: .03em; text-transform: uppercase; }
.choice { display: grid; gap: 8px; margin: 0 0 14px; padding: 0; border: 0; }
.choice label { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 10px 14px; border-radius: 10px; background: #F1E8D6; font: 700 16px/1.2 'Red Hat Display', sans-serif; cursor: pointer; }
.choice label[hidden] { display: none; }
.choice input { width: 20px; height: 20px; accent-color: var(--red); }
.f { display: grid; gap: 6px; margin: 0 0 14px; font: 700 14px/1.3 'Red Hat Display', sans-serif; color: #3A3430; }
.f[hidden] { display: none; }
.f input, .f textarea { width: 100%; min-height: 48px; padding: 12px 14px; border: 1.5px solid #CFC6B4; border-radius: 10px; background: #FFFFFF; color: var(--ink); font: 500 16px/1.3 'Red Hat Display', sans-serif; }
.f textarea { min-height: 76px; resize: vertical; }
.step { display: flex; align-items: center; gap: 12px; }
.step button { width: 48px; height: 48px; border-radius: 50%; border: 0; background: #F1E8D6; font: 800 22px/1 'Red Hat Display', sans-serif; cursor: pointer; color: var(--ink); }
.step output { min-width: 2ch; text-align: center; font: 800 20px/1 'Red Hat Display', sans-serif; }
#err { min-height: 1.2em; margin: 0 0 10px; font: 600 14px/1.4 'Red Hat Display', sans-serif; color: #3A3430; }
#err.err { color: var(--red); }
.sh-acts { display: flex; flex-wrap: wrap; gap: 10px; }
.sh-acts .btn { flex: 1 1 auto; }
.sh-acts .btn.ghost { color: var(--ink); }

/* the invitation's three looks: a manila folder, a midnight file, red tape */
[data-look="noir"] { --manila: #2E3A52; --manila-d: #1A2234; --paper: #F4F1EA; }
[data-look="noir"] #c-cover { background: linear-gradient(160deg, #3A4866, #222C40); color: #F4ECDC; }
[data-look="noir"] .c-tab { background: #3A4866; color: #F4ECDC; }
[data-look="noir"] .ans button.yes { background: #2E3A52; }
[data-look="cherry"] { --manila: #C8424A; --manila-d: #8E1E24; --red: #1E2228; --red-d: #8E1E24; }
[data-look="cherry"] #c-cover { background: linear-gradient(160deg, #D65058, #A8323A); color: #FBF8F0; }
[data-look="cherry"] .c-tab { background: #D65058; color: #FBF8F0; }
[data-look="cherry"] .c-st1, [data-look="cherry"] .c-st2 { border-color: #FBF8F0; color: #FBF8F0; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* the host's guided editor: the invitation at rest, nothing playing behind it */
.editing #intro { display: none !important; }
/* less motion: the stills change with a fade, nothing slides */
.rm .bubble, .rm #stamp { transition: opacity .3s; }
@media (max-width: 420px) { #c-in { padding: 30px 18px 20px; } .c-st1 { font-size: 26px; } .c-st2 { font-size: 18px; } }
@media (max-height: 460px) and (orientation: landscape) { #ask { grid-template-columns: repeat(3, 1fr); width: min(720px, calc(100vw - 32px)); bottom: 60px; } #ask button { font-size: 15px; min-height: 48px; } }
