@font-face {
  font-family:Instrument; src:url("/fonts/instrument-serif-latin-400-normal.woff2") format("woff2");
  font-style:normal; font-weight:400; font-display:swap;
}
@font-face {
  font-family:Instrument; src:url("/fonts/instrument-serif-latin-400-italic.woff2") format("woff2");
  font-style:italic; font-weight:400; font-display:swap;
}
:root {
  color-scheme:dark;
  --ink:#f4eee4; --muted:#bfb6a8; --quiet:#9f968a; --line:#443c35;
  --surface:#201c18; --bg:#151310; --inset:#12100e;
  --red:#ed806a; --red-dark:#a43424; --oxide:#bd3f2e; --paper:#f2ece2;
  --display:Instrument, Georgia, "Times New Roman", serif;
  --sans:-apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --mono:"SFMono-Regular", Consolas, "Liberation Mono", monospace;
}
body[data-screen=player],body[data-screen=host] {
  color-scheme:light; --ink:#28211c; --muted:#5e5449; --quiet:#655a4d; --line:#d3c7b8;
  --surface:#ede4d7; --bg:#f5efe5; --inset:#fbf6ee; --red:#9e3223; --red-dark:#861e12;
}
* { box-sizing:border-box; }
body { margin:0; min-height:100vh; color:var(--ink); background:var(--bg); font:16px/1.5 var(--sans); }
a { color:inherit; }
button,input,textarea,select { font:inherit; }
button { border:0; cursor:pointer; touch-action:manipulation; }
button:disabled { cursor:default; opacity:.52; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline:2px solid var(--red); outline-offset:4px; }
h1,h2,h3,p { margin:0; }
h1,h2 { font-family:var(--display); font-weight:400; line-height:.94; letter-spacing:-.015em; }
h1 { font-size:clamp(3rem, 7vw, 8.25rem); }
h2 { font-size:clamp(2.5rem, 4.2vw, 4.9rem); }
h1 em,h2 em { font-weight:inherit; }
strong { font-weight:680; }
.eyebrow,.status,.micro,.progress-text { font:650 .72rem/1.45 var(--mono); letter-spacing:.085em; text-transform:uppercase; }
.eyebrow { display:block; margin-bottom:.75rem; color:var(--red); }
.micro,.muted { color:var(--muted); }
.boot { min-height:100vh; display:grid; place-items:center; color:var(--muted); }
.btn {
  min-height:46px; display:inline-flex; justify-content:center; align-items:center; padding:.72rem 1.1rem; gap:.5rem;
  color:#211812; background:#f1e9dc; border:1px solid #f1e9dc; border-radius:3px; font-size:.92rem; font-weight:685;
  text-align:center; text-decoration:none; transition:background .16s,color .16s,border .16s;
}
.btn:hover { background:#fff8eb; }
.btn:active { transform:translateY(1px); }
.btn.secondary { background:var(--surface); color:var(--ink); border-color:var(--line); }
.btn.secondary:hover,.btn.quiet:hover { background:var(--surface); border-color:var(--muted); }
.btn.quiet { background:transparent; color:var(--muted); border-color:var(--line); }
.btn.danger { background:transparent; border-color:var(--line); color:var(--red); }
.btn.small { min-height:36px; padding:.45rem .7rem; font-size:.83rem; }
.btn.full { width:100%; }
[data-screen=player] .btn:not(.secondary):not(.quiet):not(.danger),
[data-screen=host] .btn:not(.secondary):not(.quiet):not(.danger) { background:#2c211b; border-color:#2c211b; color:#fff8ed; }
[data-screen=player] .btn:not(.secondary):not(.quiet):not(.danger):hover,
[data-screen=host] .btn:not(.secondary):not(.quiet):not(.danger):hover { background:#4b3428; }
.field { display:grid; gap:.45rem; color:var(--muted); font-size:.84rem; font-weight:650; }
input,textarea,select { padding:.77rem .85rem; min-width:0; width:100%; background:var(--inset); border:1px solid var(--line); color:var(--ink); border-radius:3px; font-size:1rem; }
input::placeholder,textarea::placeholder { color:var(--quiet); font-weight:400; }
textarea { min-height:82px; resize:vertical; }
input[type=file] { padding:.55rem; }
::file-selector-button { font:650 .83rem/1.5 var(--sans); color:var(--ink); background:var(--surface); border:1px solid var(--line); border-radius:2px; padding:.42rem .58rem; margin-right:.55rem; cursor:pointer; }
.pill { display:inline-flex; gap:.52rem; align-items:center; }
.dot { flex:0 0 6px; width:6px; height:6px; background:#718451; border-radius:50%; display:inline-block; }
.dot.wait { background:var(--red); }
.fb { padding:.7rem .9rem; border-left:2px solid var(--red); background:var(--surface); color:var(--ink); font-size:.91rem; }
.fb.error { color:var(--red); }
.frame { position:relative; margin:auto; min-height:100vh; padding:clamp(18px,3vh,36px) clamp(24px,5vw,104px); max-width:1920px; display:flex; flex-direction:column; }
.topbar,.bottom { display:flex; justify-content:space-between; align-items:center; gap:16px; min-height:44px; position:relative; }
.topbar { border-bottom:1px solid var(--line); padding-bottom:12px; }
.bottom { margin-top:auto; border-top:1px solid var(--line); padding-top:12px; }
.brand { display:flex; align-items:center; gap:9px; color:var(--ink); font-family:var(--display); font-size:1.55rem; line-height:1; white-space:nowrap; }
.brand-mark { display:block; width:7px; height:7px; background:var(--red); transform:rotate(45deg); }
.status { color:var(--muted); }
.tv-grid {
  display:grid; grid-template-columns:minmax(0,1.5fr) minmax(270px,1fr); align-items:center;
  gap:clamp(25px,4.3vw,80px); flex:1; padding:clamp(24px,4.7vh,58px) 0;
}
.tv-grid.intro { grid-template-columns:minmax(370px,1fr) minmax(0,.95fr); }
.tv-grid.intro .console { grid-column:1; grid-row:1; }
.tv-grid.intro .tv-board { grid-column:2; grid-row:1; }
.tv-grid.reveal { display:block; }
.console { display:grid; gap:1.2rem; width:100%; align-content:center; }
.console h1 { font-size:clamp(4.3rem,8.6vw,9.5rem); }
.console h1 em { color:#ea8a75; }
.console h2 { font-size:clamp(2.9rem,5vw,5.8rem); }
.console .muted { font-size:clamp(1rem,1.4vw,1.3rem); max-width:36ch; }
.console > .panel { border:0; border-top:1px solid var(--line); padding:1rem 0 0; background:transparent; }
.console[data-phase=setup] .form { max-width:370px; }
.intro h1 { margin-bottom:.28rem; }
.tv-board {
  min-width:0; min-height:405px; position:relative; border:1px solid var(--line); display:grid; place-items:center;
  background:#1f1b17; overflow:hidden;
}
.tv-board.artwork {
  min-height:425px;
  background-color:#b53d2e; color:#f9dece; border:0; box-shadow:inset 0 0 0 1px #e598805e;
  isolation:isolate;
}
.tv-board.artwork::before {
  position:absolute; z-index:-1; inset:0; content:""; opacity:.8;
  background:repeating-linear-gradient(105deg,#f5b39b08 0 1px,transparent 1px 4px);
}
.tv-board.artwork::after {
  position:absolute; inset:17px; content:""; border:1px solid #ffd2bb55; pointer-events:none;
}
.corner { position:absolute; z-index:1; top:13px; left:14px; color:#f3e9dc; background:#180e0adf; padding:5px 8px; }
.panel.qr-join { display:flex; align-items:center; gap:1.15rem; }
.qr-copy { display:grid; gap:.42rem; }
.qr-copy strong { font-size:clamp(1rem,1.4vw,1.25rem); }
.qr { flex:none; display:block; width:clamp(108px,11vw,155px); background:#fff; padding:4px; }
.qr img { display:block; width:100%; height:auto; }
.panel { border:1px solid var(--line); padding:clamp(14px,2vw,24px); background:var(--surface); display:grid; gap:.85rem; }
.panel.stack { gap:1rem; }
.subtle-link { color:var(--muted); font-weight:600; font-size:.85rem; text-underline-offset:3px; }
.locked-board { display:grid; gap:1.05rem; justify-items:center; text-align:center; padding:35px 20px; }
.progress { display:flex; align-items:center; gap:6px; white-space:nowrap; }
.progress i { width:13px; height:3px; background:var(--line); display:inline-block; }
.progress i.on { background:var(--red); }
.progress i:nth-child(5) { margin-left:6px; }
.progress-text { color:var(--muted); margin-left:6px; }
.pieces { display:flex; flex-wrap:wrap; gap:7px; }
.piece { min-width:52px; height:52px; padding:.3rem; display:grid; place-items:center; border:1px solid var(--line); border-radius:2px; background:var(--surface); color:var(--ink); font:400 1.65rem/1 var(--display); }
.piece.empty { color:var(--quiet); background:transparent; }
.piece.lit { color:var(--red); border-color:var(--red); }
.piece svg { width:23px; height:23px; }
.challenge-img { width:100%; height:100%; position:absolute; inset:0; overflow:hidden; background:var(--inset); }
.challenge-img img { width:100%; height:100%; object-fit:cover; transition:transform .44s ease; display:block; }
.media-box { width:100%; aspect-ratio:16/9; min-height:100%; align-self:stretch; position:relative; background:#110f0d; display:grid; place-items:center; }
.media-box video { display:block; width:100%; max-height:67vh; object-fit:contain; }
.media-box button { position:absolute; inset:auto 0 9%; margin:auto; width:max-content; max-width:90%; }
.media-box button[hidden] { display:none; }
.solved-overlay { position:absolute; z-index:3; bottom:15px; left:15px; display:flex; align-items:center; gap:.75rem; padding:8px 15px 8px 8px; background:#1a130fea; border:1px solid #875441; }
.solved-overlay .piece { min-width:34px; height:34px; }
.riddle-board { width:min(90%,675px); display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:0 19px; padding:52px 0 30px; }
.riddle { min-height:107px; border-top:1px solid var(--line); padding:1rem .3rem; display:grid; align-content:center; gap:.45rem; color:var(--ink); font-size:clamp(.95rem,1.55vw,1.35rem); }
.riddle span { font:650 .68rem var(--mono); letter-spacing:.1em; color:var(--red); }
.riddle .placed svg { width:25px; height:25px; vertical-align:middle; color:var(--red); margin-right:.45em; }
.gift-board {
  min-height:420px; min-height:min(72vh,800px); display:flex; justify-content:center; align-items:center;
  position:relative; isolation:isolate; overflow:hidden; padding:clamp(22px,5vw,68px);
  background:#762d21; color:#2a1d15;
}
.gift-board.final { background:#d3aa84; }
.gift-image { position:absolute; z-index:-1; inset:0; width:100%; height:100%; object-fit:cover; }
.gift-ticket {
  position:relative; background:#f2e8d8; color:#281e18; width:min(100%, 1020px); padding:clamp(22px,4.8vw,68px);
  border:1px solid #c0a890; box-shadow:0 12px 32px #210c0733; display:grid; grid-template-columns:minmax(0,1fr) auto; gap:25px;
}
.gift-ticket h1 { font-size:clamp(3.8rem,10vw,10rem); overflow-wrap:break-word; margin:.15em 0; }
.gift-ticket .eyebrow { color:#873425; }
.gift-ticket p { font-size:clamp(1rem,1.65vw,1.45rem); }
.gift-stub {
  border-left:1px dashed #b4a593; display:grid; place-items:center; padding-left:clamp(14px,3vw,40px);
  color:#813729; font:400 clamp(1.8rem,5vw,6rem)/1 var(--display);
}
.gift-board .gift-ticket { animation:ticket-in .48s ease-out both; }
@keyframes ticket-in { from{opacity:0;transform:translateY(9px)} to{opacity:1;transform:translateY(0)} }
.gift-phone { display:grid; gap:16px; padding:22px 18px; }
.gift-phone .gift-ticket { padding:24px 21px; background:#f3e5d2; box-shadow:none; gap:15px; }
.gift-phone .gift-ticket h2 { font-size:clamp(2.7rem,12vw,4.8rem); margin:.18em 0; }
.phone,.host { max-width:520px; margin:auto; min-height:100vh; padding:20px max(19px,env(safe-area-inset-right)) max(27px,env(safe-area-inset-bottom)); display:flex; flex-direction:column; gap:23px; }
.phone .topbar { padding-bottom:15px; }
.phone-body { display:grid; gap:17px; }
.phone h1 { font-size:clamp(3rem,11.8vw,5rem); }
.phone h2 { font-size:2.5rem; }
.phone .eyebrow { margin:0; }
.big-prompt { font-size:clamp(1.05rem,3.9vw,1.33rem); color:var(--ink); line-height:1.43; }
.phone .empty-state { align-content:center; min-height:65vh; }
.phone .chapter-start { align-content:start; }
.phone .chapter-start .phone-cover { background:#b53d2e; color:#ffe3d4; min-height:145px; position:relative; display:grid; place-items:center; padding:22px; overflow:hidden; }
.phone .chapter-start .phone-cover::after { content:""; position:absolute; inset:7px; border:1px solid #ffecd36b; pointer-events:none; }
.phone .phone-foot { padding-top:15px; border-top:1px solid var(--line); display:flex; gap:.5rem; flex-wrap:wrap; margin-top:5px; }
.form { display:grid; gap:.75rem; }
.file-preview { display:block; width:100%; max-height:190px; object-fit:contain; background:var(--inset); }
.audio-meter { display:flex; align-items:center; justify-content:space-between; gap:1em; padding:8px 0; }
.audio-meter time { color:var(--red); font:650 1.1rem var(--mono); }
.options { display:grid; gap:7px; }
.options button { justify-content:flex-start; }
.options em { font:650 .75rem var(--mono); color:var(--red); }
.zoom-actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; }
.symbols { display:grid; grid-template-columns:repeat(4,1fr); gap:7px; }
.symbols .piece { width:100%; min-width:0; height:56px; cursor:pointer; }
.symbols .active { outline:2px solid var(--red); outline-offset:2px; }
.symbol-label { font:600 .57rem var(--mono); color:var(--muted); text-transform:capitalize; }
.symbols svg { width:21px; height:21px; }
.host { max-width:1000px; }
.host h1 { font-size:clamp(3.4rem,8vw,6.4rem); }
.host.narrow { max-width:480px; justify-content:center; }
.form-row { display:flex; flex-wrap:wrap; align-items:center; gap:.6rem; }
.host-head { display:flex; align-items:center; justify-content:space-between; gap:18px; flex-wrap:wrap; }
.tabs { display:flex; gap:.5rem; border-bottom:1px solid var(--line); padding-bottom:12px; }
.host-grid,.edit-grid { display:grid; grid-template-columns:1fr 1fr; gap:15px; align-items:start; }
.host .code { font:700 clamp(1.45rem,6vw,2.7rem)/1 var(--mono); letter-spacing:.12em; color:var(--red); overflow-wrap:anywhere; }
.host .panel h3 { font-size:1.09rem; }
.host details { padding:.85rem 1rem; border:1px solid var(--line); background:var(--inset); }
.host details summary { cursor:pointer; font-weight:700; }
.host details > .form { margin-top:1rem; }
.edit-subhead { padding-top:10px; }
.host .media-preview { width:100%; max-height:180px; object-fit:contain; background:var(--inset); }
.editor-footer { position:sticky; bottom:0; padding:12px; background:var(--bg); border:1px solid var(--line); z-index:2; }
.preview-stack { display:grid; gap:.8rem; }
.phone-video { width:100%; max-height:250px; }
@media(max-width:895px) {
  .tv-grid { gap:24px; grid-template-columns:minmax(0,1.2fr) minmax(230px,1fr); }
  .tv-grid.intro { grid-template-columns:minmax(255px,1fr) minmax(0,.85fr); }
  .tv-board,.tv-board.artwork { min-height:345px; }
}
@media(max-width:620px) {
  .frame { padding:14px 17px; }
  .tv-grid,.tv-grid.intro,.host-grid,.edit-grid { grid-template-columns:1fr; }
  .tv-grid { gap:22px; padding:23px 0; }
  .tv-grid .console,.tv-grid.intro .console { grid-column:1; grid-row:1; }
  .tv-grid.intro .tv-board { grid-column:1; grid-row:2; }
  .tv-board,.tv-board.artwork { min-height:252px; }
  .console h1 { font-size:clamp(3.85rem,14vw,6.3rem); }
  .riddle-board { width:91%; }
  .riddle { padding:.55rem 0; min-height:92px; }
  .topbar,.bottom { gap:9px; }
  .gift-board { min-height:388px; }
}
@media(prefers-reduced-motion:reduce) { *,*::before,*::after { transition:none!important; animation:none!important; } }

/* The player stays readable if the 3D layer cannot load. */
.clay-art { position:relative; flex:none; display:grid; place-items:center; line-height:0; }
.clay-still, .clay-still img { width:100%; height:auto; display:block; }
.clay-canvas { position:absolute; inset:0; width:100%; height:100%; }
.clay-art.rendered .clay-still { visibility:hidden; }
.tv-board.artwork { background:#e9c4ad; color:#5e3226; border:1px solid #e8bfab; box-shadow:none; }
.tv-board.artwork::before { background:repeating-linear-gradient(115deg,#7c352908 0 1px,transparent 1px 6px); }
.tv-board.artwork::after { border-color:#77554037; }
.artwork .cover-art { width:min(89%, 512px); margin-top:-4%; }
.tv-board.art-stage { background:#e5cbb7; border-color:#d8b8a2; }
.tv-board.art-stage .corner { background:transparent; color:#633728; top:17px; left:20px; }
.stage-art { width:min(74%, 380px); }
.locked-board .lock-art { width:clamp(145px,24vmin,240px); margin:-8px 0; }
.phone .chapter-start .phone-cover {
  background:#e9c9b5; color:#5e3226; height:213px; min-height:150px; padding:0;
}
.phone .chapter-start .phone-cover::after { border-color:#85584336; z-index:1; }
.phone-cover .cover-art { width:250px; max-width:88%; margin-top:-8px; }
.phone-title { display:grid; grid-template-columns:minmax(0,1fr) 94px; align-items:center; gap:12px; }
.phone-title .eyebrow { margin-bottom:8px; }
.phone-title .chapter-art { width:94px; background:#ead7c5; border-radius:10px; padding:5px; }
.phone-title h1 { font-size:clamp(2.65rem,10vw,4.1rem); overflow-wrap:break-word; }
.gift-ticket { align-items:center; }
.gift-stub { align-self:stretch; padding-left:clamp(14px,2vw,29px); }
.gift-art { width:clamp(106px,18vw,235px); }
.gift-phone { padding:0; }
.gift-phone .gift-ticket { padding:25px 17px; gap:9px; }
.gift-phone .gift-stub { padding-left:8px; }
.gift-phone .gift-art { width:clamp(58px,20vw,120px); }
@media(max-width:620px) {
  .artwork .cover-art { width:min(79%, 350px); }
  .tv-board.artwork { min-height:220px; }
  .gift-ticket { gap:12px; padding:19px; }
  .gift-board .gift-ticket h1 { font-size:clamp(2.85rem,11vw,5rem); }
  .gift-board .gift-art { width:clamp(58px,18vw,106px); }
}
@media(max-width:355px) {
  .phone-title { grid-template-columns:minmax(0,1fr) 72px; gap:8px; }
  .phone-title .chapter-art { width:72px; }
}
.photo-picker {
  display:flex; align-items:center; gap:.75rem; min-height:52px; padding:.55rem .64rem;
  position:relative; border:1px solid var(--line); background:var(--inset); cursor:pointer;
}
.photo-picker input { position:absolute; inset:0; width:100%; height:100%; opacity:0; cursor:pointer; margin:0; }
.photo-picker:focus-within { outline:2px solid var(--red); outline-offset:2px; }
.photo-picker span { flex:none; padding:.45rem .58rem; background:var(--surface); border:1px solid var(--line); font-weight:650; font-size:.89rem; }
.photo-picker small { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; color:var(--muted); font-size:.8rem; }
