:root{
  /* The site's palette: warm ink, parchment text, dusty rose for selection, sage for info, ivory for the main action. */
  --bg:#0e0c10; --panel:#17141a; --raised:#221e25; --line:#2e2930; --fg:#ebe5dc; --muted:#958e86;
  --magenta:#c9707c; --cyan:#9cb8ae; --volt:#e6c27a; --gold:#e6c27a; --red:#d9786f; --green:#9cc4a4;
  --primary:#ebe5dc; --on-primary:#17131a; --wax:#7d2333; --wax-line:#a8434f;
  --display:"Geist","Noto Sans KR",system-ui,sans-serif;
  --body:"Geist","Noto Sans KR",system-ui,sans-serif;
  color-scheme:dark;
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--fg);font-family:var(--body);font-size:15px;overflow:hidden}
body::before{content:"";position:fixed;inset:0 0 auto;height:env(safe-area-inset-top,0px);z-index:10;background:var(--bg)}
button,input{font:inherit;color:inherit}
button{cursor:pointer}
:focus-visible{outline:2px solid var(--cyan);outline-offset:2px}
.app{height:100%;display:flex;flex-direction:column;max-width:720px;margin:0 auto;border-left:1px solid var(--line);border-right:1px solid var(--line)}
.top{display:flex;align-items:center;gap:10px;padding-block:10px;padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px));border-bottom:1px solid var(--line)}
.brand{flex:1;min-width:0}
.brand b{font-family:var(--display);font-size:20px;letter-spacing:.06em;display:block;line-height:1.1;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.brand span{display:block;margin-top:3px;font-size:12px;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.wallet{display:flex;flex-shrink:0;align-items:center;gap:5px;min-height:36px;padding:0 4px 0 10px;border:1px solid var(--line);border-radius:18px;background:var(--panel);color:var(--fg);font-size:13px;font-variant-numeric:tabular-nums}
.wallet[hidden]{display:none}
.wallet b{font-weight:800}
.wallet .add{padding:3px 9px;border-radius:12px;background:var(--cyan);color:#071016;font-size:11px;font-weight:800}
.crew{display:flex;align-items:center;border:0;background:none;padding:4px;border-radius:24px;min-height:44px}
.crew .av{margin-left:-8px;box-shadow:0 0 0 2px var(--bg)}
.crew .av:first-child{margin-left:0}
.iconbtn{width:40px;height:40px;border-radius:20px;border:1px solid var(--line);background:var(--panel);display:grid;place-items:center;font-size:16px}
.log{flex:1;min-height:0;overflow-y:auto;padding-block:16px;padding-left:max(16px,env(safe-area-inset-left,0px));padding-right:max(16px,env(safe-area-inset-right,0px));display:flex;flex-direction:column;gap:12px}
.log>*{flex-shrink:0;transition:opacity .3s}
.log>:first-child{margin-top:auto}
/* Past rows step back and fade; the newest turn never does. Scrolling up to read brings them all back. */
/* Older rows fade a little so the newest stands out, but the last few stay readable over the picture. */
.log>.old{opacity:max(.5,calc(.92 - var(--age,1) * .07))}
.log.reading>.old{opacity:1}
.cover{display:flex;flex-direction:column;gap:6px;padding:12px 14px;border-radius:14px;border:1px solid var(--line);background:var(--panel)}
.cover b{font-family:var(--display);font-size:22px;letter-spacing:.04em}
.cover p{margin:0;font-size:14px;line-height:1.5;color:#e8e4d8;max-width:52ch}
.cover .live{display:inline-flex;align-self:flex-start;gap:6px;align-items:center;font-size:11px;font-weight:700;letter-spacing:.08em;color:var(--cyan);padding:3px 9px;border:1px solid var(--cyan);border-radius:6px;background:rgba(14,12,16,.6)}
.place{font-family:var(--display);font-size:12px;letter-spacing:.1em;color:var(--gold)}
.nar{font-size:14px;line-height:1.65;color:#d3cebf;font-style:italic;max-width:62ch}
.msg{display:flex;gap:10px;align-items:flex-start;max-width:90%}
.msg .nm{font-size:12px;color:var(--muted);margin:0 0 3px 2px;font-weight:600}
.msg .bub{background:var(--panel);border:1px solid var(--line);border-radius:4px 16px 16px 16px;padding:10px 13px;line-height:1.55;white-space:pre-wrap;overflow-wrap:anywhere}
html[lang=ko] .log{word-break:keep-all}
.msg .bub em{color:#cfc8b6}
.msg.me{align-self:flex-end;flex-direction:row-reverse}
.msg.me .bub{background:#e4c9c0;color:#1f1216;border:0;border-radius:16px 4px 16px 16px;font-weight:500}
.msg.me .bub em{color:#3a0b22}
.sys{align-self:center;font-size:12px;font-weight:600;color:var(--cyan);background:rgba(156,184,174,.08);border:1px solid rgba(156,184,174,.25);padding:6px 12px;border-radius:12px;text-align:center;max-width:94%}
.av{width:40px;height:40px;border-radius:50%;flex-shrink:0;display:inline-grid;place-items:center;font-weight:700;color:#111;background-repeat:no-repeat}
.av.sm{width:30px;height:30px;font-size:12px}
.typing{display:inline-flex;gap:4px;padding:3px 0}
.typing i{width:6px;height:6px;border-radius:50%;background:var(--muted);animation:ty 1s infinite}
.typing i:nth-child(2){animation-delay:.15s}.typing i:nth-child(3){animation-delay:.3s}
@keyframes ty{50%{opacity:.25;transform:translateY(-3px)}}
.event{border-radius:16px;border:1px solid rgba(201,112,124,.45);background:linear-gradient(180deg,rgba(201,112,124,.12),var(--panel) 50%);padding:14px;display:flex;flex-direction:column;gap:8px}
.seed{font-size:12px;line-height:1.45;color:#cfe0d9;border:1px dashed rgba(156,184,174,.4);border-radius:10px;padding:8px 10px;background:rgba(156,184,174,.05)}
.seed b{display:block;font-size:10px;letter-spacing:.08em;color:var(--cyan)}
.event .where{font-family:var(--display);font-size:11px;letter-spacing:.1em;color:var(--gold)}
.event h3{margin:0;font-family:var(--display);font-size:22px;line-height:1.15;text-wrap:balance}
.event h3 button{display:block;padding:0;border:0;background:none;font:inherit;line-height:inherit;letter-spacing:inherit;text-align:left;text-wrap:inherit;pointer-events:none}
.event p{margin:0;font-size:14px;line-height:1.55;color:#ddd8ca}
.event .reward{font-size:12px;font-weight:700;color:var(--volt)}
.event.done{border-color:var(--line);background:var(--panel)}
.event .res{font-size:13px;color:var(--green);font-weight:600}
.result{display:flex;flex-wrap:wrap;gap:6px;align-self:center}
.result span{font-size:12px;font-weight:700;padding:4px 10px;border-radius:10px;background:var(--raised)}
.result .up{color:var(--green)}.result .down{color:var(--red)}.result .star{color:var(--volt)}
/* Up to three replies, all in view, one tap each. The row keeps its height while a turn is out, so nothing below it jumps. */
.chips{display:grid;gap:6px;min-height:68px;padding-block:6px;padding-left:max(12px,env(safe-area-inset-left,0px));padding-right:max(12px,env(safe-area-inset-right,0px))}
.chips button{min-width:0;padding:5px 9px;border-radius:12px;border:1px solid var(--line);background:var(--panel);font-size:12.5px;line-height:1.28;text-align:left}
.chips span{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:3;line-clamp:3;overflow:hidden;overflow-wrap:anywhere;word-break:keep-all}
.chips button:hover{border-color:var(--cyan)}
.inp{display:flex;gap:8px;padding-block:8px calc(10px + env(safe-area-inset-bottom,0px));padding-left:max(12px,env(safe-area-inset-left,0px));padding-right:max(12px,env(safe-area-inset-right,0px));border-top:1px solid var(--line)}
.inp input{flex:1;min-width:0;height:48px;border-radius:24px;border:1px solid var(--line);background:var(--panel);padding:0 18px;font-size:16px}
.inp input:focus-visible{outline:none;border-color:var(--cyan)}
.inp button{min-width:48px;height:48px;border-radius:24px;border:0;background:var(--primary);color:var(--on-primary);font-weight:700;padding:0 16px;font-family:var(--display);letter-spacing:.04em}
.inp button.stop{background:var(--raised);color:var(--fg)}
.note{font-size:12px;color:var(--muted);text-align:center;padding:6px 16px}
.err{color:var(--red)}
.sheet{position:fixed;inset:auto 0 0 0;max-width:720px;margin:0 auto;background:var(--panel);border-top:1px solid var(--line);border-radius:18px 18px 0 0;padding:16px max(16px,env(safe-area-inset-right,0px)) calc(18px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px));z-index:20;display:flex;flex-direction:column;gap:8px;box-shadow:0 -20px 60px rgba(0,0,0,.6);max-height:calc(100vh - 12px);max-height:calc(100dvh - 12px);overflow-y:auto;overscroll-behavior:contain}
.sheet-x{position:sticky;top:0;z-index:1;align-self:flex-end;flex:none;width:40px;height:40px;margin:-6px -6px -42px 0;border:0;border-radius:50%;background:var(--raised);color:var(--fg);font-size:22px;line-height:1;cursor:pointer}
.sheet h4{padding-right:40px}
@media (min-width:768px) and (min-height:520px){
  .sheet{inset:50% auto auto 50%;transform:translate(-50%,-50%);width:min(480px,calc(100vw - 48px));max-height:calc(100vh - 48px);max-height:calc(100dvh - 48px);margin:0;padding:22px;border:1px solid var(--line);border-radius:18px;box-shadow:0 24px 80px rgba(0,0,0,.6)}
  .sheet:has(.scene-full){width:min(720px,calc(100vw - 48px))}
}
.sheet h4{margin:0 0 4px;font-family:var(--display);font-size:16px;letter-spacing:.04em}
.opt{display:flex;align-items:center;gap:12px;padding:8px 10px;border-radius:12px;border:1px solid var(--line);background:var(--bg);text-align:left;width:100%}
.opt .t{flex:1;min-width:0}
.opt .t b{display:block;font-size:14px}
.opt .t span{font-size:13px;color:var(--muted)}
.opt .st{font-size:12px;font-weight:700;color:var(--muted)}
.opt.on{border-color:var(--magenta)}
.opt.on .st{color:var(--magenta)}
.scrim{position:fixed;inset:0;background:rgba(0,0,0,.55);z-index:19}
@media (prefers-reduced-motion:reduce){.typing i{animation:none}.log>*{transition:none}.log{transition:none}}

/* Sealbound additions: chat / progress / scenes tabs, the sign-in card, the progress tab. */
.app{height:100dvh}
.tabs{display:flex;border-bottom:1px solid var(--line);background:var(--bg)}
.tabs button{flex:1;min-height:44px;border:0;background:none;color:var(--muted);font-family:var(--display);font-weight:700;letter-spacing:.06em;position:relative}
.tabs button[aria-selected=true]{color:var(--fg)}
.tabs button[aria-selected=true]::after{content:"";position:absolute;left:30%;right:30%;bottom:0;height:2px;background:var(--magenta);border-radius:2px}
.pane{flex:1;min-height:0;display:flex;flex-direction:column}
.pane[hidden]{display:none}
.progress-pane{flex:1;overflow-y:auto;padding:4px max(16px,env(safe-area-inset-right,0px)) calc(24px + env(safe-area-inset-bottom,0px)) max(16px,env(safe-area-inset-left,0px))}
.pg-sec h5{margin:18px 0 8px;font-family:var(--display);font-size:13px;letter-spacing:.06em;color:var(--muted)}
.pg-stats{display:flex;flex-wrap:wrap;gap:8px}
.pg-stat{display:inline-flex;align-items:baseline;gap:6px;padding:8px 12px;border:1px solid var(--line);border-radius:12px;background:var(--panel);font-variant-numeric:tabular-nums}
.pg-stat small{color:var(--muted);font-size:11px}
.pg-sec ul,.pg-sec ol{list-style:none;margin:0 0 10px;padding:0;display:flex;flex-direction:column;gap:8px}
.pg-rel li,.pg-games li,.pg-track li{display:flex;align-items:center;gap:12px;padding:10px 12px;border:1px solid var(--line);border-radius:12px;background:var(--panel)}
.pg-rel li span,.pg-games li span,.pg-track li span{flex:1;min-width:0}
.pg-rel li .av{flex:none}
.pg-rel li b{font-family:var(--display);color:var(--gold);font-variant-numeric:tabular-nums}
.pg-lead{margin:-2px 0 10px;color:var(--muted);font-size:12.5px;line-height:1.5}
.pg-track-name{margin:12px 0 6px;font-size:13px;font-weight:700}
.pg-track li i{width:22px;text-align:center;font-style:normal;color:var(--muted)}
.pg-track li b{display:block;font-size:14px;overflow-wrap:anywhere}
.pg-track li small,.pg-games li small{display:block;margin-top:2px;color:var(--muted);font-size:12px;line-height:1.5;overflow-wrap:anywhere}
.pg-track li em{font-style:normal;font-size:11px;font-weight:700;color:var(--muted)}
.pg-track li.done i,.pg-track li.done em{color:var(--green)}
.pg-track li.open{border-color:var(--cyan)}
.pg-track li.open i,.pg-track li.open em{color:var(--cyan)}
.pg-track li.locked{opacity:.6}
.pg-coll{display:flex;align-items:center;justify-content:space-between;gap:12px;font-size:13px}
.pg-coll button,.pg-games button{min-height:40px;padding:0 16px;border-radius:20px;border:1px solid var(--cyan);background:none;color:var(--cyan);font-weight:700}
.pg-eps li{padding:10px 12px;border:1px solid var(--line);border-radius:12px;background:var(--panel)}
.pg-eps b{font-size:14px}
.pg-eps p{margin:4px 0 0;font-size:13px;line-height:1.55;color:var(--muted);overflow-wrap:anywhere}
.pg-games li b{font-size:14px}
.pg-games li.locked{opacity:.6}
.pg-games li.locked i{font-style:normal}
.pg-msg{display:flex;flex-direction:column;align-items:center;gap:14px;margin:auto;padding:40px 24px;text-align:center;color:var(--muted);line-height:1.7}
.pg-msg p{margin:0;max-width:34ch}
.pg-stat b{font-weight:600}
.pg-msg .google{display:inline-flex;align-items:center;min-height:48px;padding:0 24px;border-radius:999px;border:0;background:#fff;color:#1f1f1f;font-weight:700}
.g-replay{display:grid;place-items:center;background:rgba(0,0,0,.92);padding:24px}
.g-replay-card{width:min(360px,100%);display:flex;flex-direction:column;align-items:center;gap:10px;text-align:center}
.g-replay-card h4{margin:0;font-family:var(--display);letter-spacing:.06em;color:var(--muted)}
.g-replay-grade{font-family:var(--display);font-size:44px;letter-spacing:.04em}
.g-replay-grade.win{color:var(--gold)}
.g-replay-grade.close{color:var(--cyan)}
.g-replay-grade.loss{color:var(--red)}
.g-replay-card p{margin:0}
.g-replay-card small{color:var(--muted);line-height:1.5}
.g-replay-new{color:var(--volt);font-weight:700}
.gate{position:fixed;inset:0;z-index:30;display:flex;flex-direction:column;align-items:center;justify-content:flex-end;gap:12px;padding:24px 20px calc(32px + env(safe-area-inset-bottom,0px));text-align:center;background:linear-gradient(0deg,rgba(14,12,16,.98) 38%,rgba(14,12,16,.35) 70%,rgba(14,12,16,.1)),var(--cover-img,none) 50% 20%/cover no-repeat,var(--bg)}
.gate[hidden]{display:none}
.gate b{font-family:var(--display);font-size:34px;letter-spacing:.05em}
.gate p{margin:0;max-width:34ch;line-height:1.6;color:#e8e4d8;word-break:keep-all}
.gate .google{display:inline-flex;align-items:center;gap:10px;min-height:50px;padding:0 24px;border-radius:999px;border:0;background:#fff;color:#1f1f1f;font-weight:700;font-size:15px;margin-top:6px}
.gate .google:disabled{background:var(--raised);color:var(--muted)}
.why.small a{color:inherit;text-decoration:underline;text-underline-offset:2px}
.gate .back{color:var(--muted);font-size:13px;text-decoration:none;padding:8px}
.gate [hidden]{display:none}
.gate.loading>*{visibility:hidden}
/* Before the room is known there is no art to show yet: the shape of the chat, not a spinner. */
.gate.loading::after{content:"";position:absolute;left:16px;right:16px;bottom:calc(20px + env(safe-area-inset-bottom,0px));max-width:560px;margin:0 auto;height:200px;border-radius:14px;background:linear-gradient(var(--panel) 0 0) 0 0/62% 44px no-repeat,linear-gradient(var(--panel) 0 0) 0 56px/78% 44px no-repeat,linear-gradient(var(--panel) 0 0) 0 112px/48% 28px no-repeat,linear-gradient(var(--panel) 0 0) 0 100%/100% 48px no-repeat;animation:skPulse 1.4s ease-in-out infinite}
.left{min-height:18px;font-size:11px;color:var(--muted);text-align:center;padding:0 16px 4px}
a.opt{text-decoration:none;color:inherit}
.left b{color:var(--fg)}
.left b.last{color:var(--gold)}
.topup{margin-left:6px;border:1px solid var(--cyan);background:none;color:var(--cyan);border-radius:10px;padding:2px 10px;font-size:11px;font-weight:700;min-height:26px}
.sheet .why{margin:0 2px 4px;font-size:14px;color:var(--muted);line-height:1.5}
.sheet .why.small{font-size:13px}
.sheet .why.first{color:var(--gold,#e8c36a);font-weight:700}
.sheet .opt em.bonus{font-style:normal;font-size:12px;color:var(--gold,#e8c36a)}
.opt .price{color:var(--volt);font-family:var(--display);font-size:15px}
.opt:disabled{opacity:.5}

/* A grant announces itself briefly, above the input. */
.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); z-index: 30; max-width: min(92vw, 420px); padding: 10px 16px; border: 1px solid var(--gold); border-radius: 14px; background: var(--raised); color: var(--fg); font-size: 13.5px; font-weight: 600; text-align: center; box-shadow: 0 6px 24px #0008; }

/* The stage: one picture, whole, with a blurred copy of itself as the fill. A column on wide screens, the screen behind the chat on phones. */
.stage { position: relative; overflow: hidden; background: var(--panel); }
.stage-brand { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; font-family: var(--display); font-size: 28px; letter-spacing: .08em; color: var(--muted); text-align: center; background: linear-gradient(160deg, var(--raised), var(--bg)); }
.stage-shot { position: absolute; inset: 0; margin: 0; opacity: 0; transition: opacity .45s; }
.stage-shot.on { opacity: 1; }
.stage-shot i { position: absolute; inset: -8%; background-size: cover; background-position: center; filter: blur(30px) brightness(.5) saturate(1.1); }
.stage-shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: 50% 50%; display: block; }
.stage-cap { position: absolute; z-index: 2; inset: auto 0 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; pointer-events: none; }
.stage-cap:empty { display: none; }
.stage-cap b { min-width: 0; padding: 5px 11px; border-radius: 10px; background: rgba(14, 12, 16, .72); font-family: var(--display); font-size: 13px; letter-spacing: .03em; }
.pin { flex-shrink: 0; min-height: 36px; padding: 0 14px; border: 1px solid rgba(255, 255, 255, .3); border-radius: 999px; background: rgba(14, 12, 16, .72); font-size: 13px; font-weight: 600; pointer-events: auto; }
.stage-tap, .chat-back { display: none; }

/* The intro comic: bars and Skip on top; on a phone the caption sits in a band under the picture, on a wide screen over the
   picture's foot. The log stays empty until episode 1, so without it a wide screen showed pictures with no words. */
.intro { position: absolute; inset: 0; z-index: 5; }
.intro[hidden] { display: none; }
.intro-next { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: none; cursor: pointer; }
.intro-next:focus-visible { outline: none; }
.intro-bars { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); left: 12px; right: 12px; display: flex; gap: 4px; pointer-events: none; }
.intro-bars i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .3); box-shadow: 0 0 4px rgba(0, 0, 0, .5); overflow: hidden; }
.intro-bars b { display: block; height: 100%; width: 0; background: #fff; }
.intro-bars .done b { width: 100%; }
.intro-bars .run b { animation: introBar var(--cut, 8s) linear forwards; }
@keyframes introBar { to { width: 100%; } }
.intro-skip { position: absolute; top: calc(22px + env(safe-area-inset-top, 0px)); right: 12px; min-height: 36px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .35); background: rgba(14, 12, 16, .6); color: #fff; font-size: 14px; font-weight: 600; }
.intro-cap { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; position: absolute; inset: auto 0 0; margin: 0; padding: 72px max(32px, 8%) 40px; background: linear-gradient(to top, rgba(14, 12, 16, .92) 55%, rgba(14, 12, 16, 0)); color: #fff; font-size: 19px; line-height: 1.5; pointer-events: none; word-break: keep-all; }
.intro-cap:empty { display: none; }
.intro-cap span { font-style: italic; }
.intro-cap b { color: var(--accent, #e3a9a6); font-size: 15px; }
.intro-cap q { quotes: none; max-width: 640px; padding: 10px 15px; border-radius: 14px; background: rgba(255, 255, 255, .12); font-size: 18px; }
@media (prefers-reduced-motion: reduce) { .stage-shot { transition: none; } }

/* Lists hold their shape while they load. */
.sk { border-radius: 10px; background: var(--raised); animation: skPulse 1.4s ease-in-out infinite; }
.sk-line { height: 18px; width: 60%; margin-bottom: 14px; }
.sk-tile { aspect-ratio: 2 / 3; }
.sk-row { height: 56px; margin-top: 12px; }
@keyframes skPulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .sk, .gate.loading::after { animation: none; } }

/* Scenes: a tab on phones; on wide screens the story map on the right. */
.map { display: none; }
.scene-pane { flex: 1; overflow-y: auto; padding: 16px; }
.map-head { display: flex; justify-content: space-between; align-items: baseline; font-family: var(--display); }
.map-head b { font-size: 16px; }
.map-head span { color: var(--muted); font-size: 12px; }
.map-cast { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.map-cast li { display: flex; gap: 10px; align-items: flex-start; }
.map-cast b { display: block; font-size: 14px; }
.map-cast small { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.map-bar { height: 5px; margin: 8px 0 4px; border-radius: 3px; background: var(--raised); overflow: hidden; }
.map-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--magenta)); transition: width .6s; }
.scene-pane h5, .map h5 { margin: 16px 0 8px; font-size: 13px; font-weight: 700; }
.scene-pane h5 small, .map h5 small { color: var(--muted); font-weight: 500; }
.scene-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 7px; }
.tile { position: relative; aspect-ratio: 2 / 3; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--raised); }
.tile img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; display: block; }
.tile.locked img { filter: blur(8px) brightness(.55); transform: scale(1.15); }
.tile span { position: absolute; left: 5px; top: 5px; font-size: 11px; opacity: .85; }
.scene-full { display: block; max-width: 100%; max-height: 70dvh; margin: 0 auto 10px; border-radius: 12px; }
.scene-blur { display: block; width: 120px; aspect-ratio: 2 / 3; object-fit: cover; margin: 0 auto 10px; border-radius: 10px; filter: blur(8px) brightness(.6); }
.scene-card { display: flex; align-items: center; gap: 12px; width: min(100%, 340px); padding: 8px; border: 1px solid rgba(201, 112, 124, .5); border-radius: 14px; background: var(--panel); text-align: left; }
.scene-card img { width: 60px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px; }
.scene-card span { display: flex; flex-direction: column; gap: 2px; }
.scene-card small { color: #e3a9a6; font-size: 12px; font-weight: 700; }
.scene-card b { font-size: 14.5px; }
@media (min-width: 1180px) {
  /* The picture gets what the chat and the map leave: most of the screen at any width. */
  :root { --chat-w: clamp(440px, 34vw, 640px); --map-w: clamp(240px, 20vw, 320px); }
  body { display: grid; grid-template-columns: minmax(0, 1fr) var(--chat-w) var(--map-w); height: 100dvh; }
  .app { max-width: none; width: 100%; min-width: 0; margin: 0; }
  .map { display: block; overflow-y: auto; padding: 18px 14px; }
  .scene-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #tab-scenes { display: none; }
  body.in-intro .nar { font-size: 16px; }
  .toast { left: calc(100vw - var(--map-w) - var(--chat-w) / 2); bottom: 180px; max-width: calc(var(--chat-w) - 32px); }
}

/* Phones and tablets: the picture is the screen. The chat sits at the bottom, under half the height, and fades out at its top
   edge, so the face stays in view. Everything over the art keeps a soft dark backing. */
@media (max-width: 1179px) {
  :root { --head: calc(52px + env(safe-area-inset-top, 0px)); --cap-h: 28dvh; }
  .stage { position: fixed; inset: 0; z-index: 0; background: var(--bg); }
  .stage::after { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; background: linear-gradient(0deg, rgba(14, 12, 16, .94), rgba(14, 12, 16, .72) 34%, rgba(14, 12, 16, 0) 60%); }
  .stage-shot img { top: var(--head); height: calc(100% - var(--head)); object-position: 50% 0; }
  .stage-cap { display: none; }
  .stage-tap { display: block; position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; border: 0; background: none; cursor: pointer; }
  .stage-tap:focus-visible { outline-offset: -4px; }
  body.clean .stage::after { display: none; }
  body.clean .stage-shot img { top: 0; height: 100%; object-position: 50% 50%; }
  body.clean .stage-cap { display: flex; padding-right: 116px; bottom: env(safe-area-inset-bottom, 0px); }
  body.clean .pin { display: none; }
  body.clean .app { visibility: hidden; }
  .chat-back { display: inline-flex; align-items: center; position: absolute; z-index: 3; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); min-height: 40px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .35); background: rgba(14, 12, 16, .72); color: #fff; font-size: 13px; font-weight: 600; }
  .chat-back[hidden] { display: none; }

  .app { position: fixed; z-index: 1; top: var(--vvt, 0); left: 0; right: 0; max-width: none; height: var(--vvh, 100dvh); border: 0; pointer-events: none; }
  .top, .tabs, .log, .kit-bar, .chips, .left, .inp, .game-bar, .progress-pane, .scene-pane { pointer-events: auto; }
  .top { border: 0; padding-block: 6px 2px; background: linear-gradient(180deg, rgba(14, 12, 16, .86), rgba(14, 12, 16, .62)); }
  .brand b { font-size: 17px; }
  .brand span { display: none; }
  .tabs { border: 0; background: linear-gradient(180deg, rgba(14, 12, 16, .62), rgba(14, 12, 16, .44) 55%, rgba(14, 12, 16, 0)); }
  .tabs button { min-height: 40px; color: #d6cfc6; text-shadow: 0 1px 4px rgba(0, 0, 0, .8); }
  .iconbtn { background: rgba(30, 26, 32, .72); }
  .wallet { background: rgba(30, 26, 32, .72); min-height: 34px; padding: 0 10px; }
  .wallet .add { display: none; }

  .toast { bottom: calc(52dvh + 10px); }

  /* The log: a fixed block, so rows arriving never move what is around it. */
  .log { flex: none; height: max(140px, calc(52dvh - 156px)); margin-top: auto; padding-block: 28px 8px; gap: 8px; transition: height .25s ease-out; -webkit-mask-image: linear-gradient(180deg, transparent, #000 40px); mask-image: linear-gradient(180deg, transparent, #000 40px); }
  /* Scrolling up to read gives the chat most of the screen and dims the art; back at the newest line it shrinks again. */
  .log.reading { height: max(140px, calc(80dvh - 156px)); -webkit-mask-image: none; mask-image: none; }
  body:has(.log.reading) .stage::after { background: rgba(14, 12, 16, .9); }
  .nar, .place { align-self: flex-start; width: fit-content; padding: 5px 10px; border-radius: 10px; background: rgba(14, 12, 16, .66); }
  .nar { color: #ece8dc; }
  .cover { background: rgba(30, 26, 32, .82); }
  .msg { max-width: 94%; }
  .msg .av { width: 34px; height: 34px; }
  .msg .nm { color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .9); }
  .msg .bub { background: rgba(30, 26, 32, .86); border-color: rgba(255, 255, 255, .1); }
  .msg.me .bub { background: #e4c9c0; }
  .sys { background: rgba(14, 12, 16, .78); }
  .log .cg { height: auto; min-height: 50px; padding: 4px 6px; background: rgba(30, 26, 32, .86); border-color: rgba(255, 255, 255, .1); }
  .log .cg img { width: 28px; height: 40px; border-radius: 6px; }
  /* A locked scene teases: the picture large under a mosaic, the open button and its price in the middle. */
  .log .cg.locked { display: grid; place-items: center; width: 100%; max-width: 420px; height: clamp(190px, 30dvh, 280px); padding: 0; border-color: rgba(201, 112, 124, .55); }
  /* The blur file is a tiny thumbnail, so drawn large with hard edges it is the mosaic. */
  .log .cg.locked img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 0; filter: brightness(.85) saturate(1.2); image-rendering: pixelated; }
  .log .cg.locked .unlock { position: relative; z-index: 1; order: 0; min-height: 48px; padding: 0 24px; border: 0; background: var(--magenta); color: #1a0610; font-size: 15px; box-shadow: 0 4px 22px rgba(0, 0, 0, .55); }
  .log .cg.locked span { position: absolute; inset: auto 0 0; padding: 18px 12px 8px; text-align: center; color: #fff; background: linear-gradient(0deg, rgba(14, 12, 16, .86), rgba(14, 12, 16, 0)); }
  .event { padding: 8px 12px; gap: 6px; background: linear-gradient(180deg, rgba(60, 16, 40, .9), rgba(30, 26, 32, .92) 50%); }
  /* One title line until tapped, and no seed box: the cast's lines stay on screen. */
  .event .seed { display: none; }
  .event:not(.open) > :not(h3) { display: none; }
  .event h3 { font-size: 15px; }
  .event h3 button { position: relative; width: 100%; padding-right: 22px; pointer-events: auto; cursor: pointer; }
  .event:not(.open) h3 button { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .event h3 button::after { content: "▾"; position: absolute; right: 2px; top: 0; color: var(--muted); }
  .event.open h3 button::after { content: "▴"; }
  .event.done { background: rgba(30, 26, 32, .9); }
  .chips button { border-color: rgba(255, 255, 255, .16); background: rgba(30, 26, 32, .86); }
  .left { padding-bottom: 2px; color: #d6cfc6; text-shadow: 0 1px 3px rgba(0, 0, 0, .9); }
  .left b { color: #fff; }
  .left b.last { color: var(--gold); }
  .inp { border: 0; padding-top: 4px; }
  .inp input { background: rgba(30, 26, 32, .9); border-color: rgba(255, 255, 255, .16); }
  .pane .game-bar { border: 0; }
  .chips, .log, .left, .inp, .game-bar { width: 100%; max-width: 720px; margin-inline: auto; }
  .pane .kit-bar { width: calc(100% - 32px); max-width: 688px; margin-inline: auto; }
  .log { margin-top: auto; }

  /* The keyboard is up: the input and the last rows, nothing else. */
  body.kb .tabs, body.kb .chips, body.kb .left { display: none; }
  body.kb .log { flex: 1; height: auto; min-height: 0; }

  /* Other tabs read on a plain page. */
  body.off-chat .app { background: var(--bg); }
  body.off-chat .top, body.off-chat .tabs { background: var(--bg); }
  body.off-chat .tabs { border-bottom: 1px solid var(--line); }

  /* The intro: the picture whole and large, its caption in the band under it. */
  body.in-intro .app { visibility: hidden; }
  body.in-intro .stage::after { display: none; }
  .intro-cap span { font-style: italic; font-size: 15.5px; }
  .intro-cap b { color: var(--accent, #e3a9a6); font-size: 13.5px; }
  .intro-cap q { quotes: none; padding: 9px 13px; border-radius: 14px; background: rgba(255, 255, 255, .1); font-size: 16px; line-height: 1.45; }
  body.in-intro .stage-shot img { top: env(safe-area-inset-top, 0px); height: calc(100% - var(--cap-h) - env(safe-area-inset-top, 0px)); object-position: 50% 50%; }
  body.in-intro .stage-tap { display: none; }
  .intro-cap { display: flex; flex-direction: column; justify-content: center; align-items: flex-start; gap: 6px; position: absolute; inset: auto 0 0; height: var(--cap-h); margin: 0; padding: 12px max(20px, env(safe-area-inset-right, 0px)) calc(28px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px)); background: rgba(14, 12, 16, .7); font-size: 18px; line-height: 1.5; color: #fff; pointer-events: none; word-break: keep-all; }
  .intro-cap::after { content: "›"; position: absolute; right: 18px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); font-size: 26px; line-height: 1; color: var(--muted); animation: introNudge 1.4s ease-in-out infinite; }
  @keyframes introNudge { 50% { transform: translateX(5px); } }
}
@media (prefers-reduced-motion: reduce) { .intro-cap::after { animation: none; } }

/* Game templates: the bar that replaces the composer when a game is due, and everything full-screen above the chat. */
.game-bar { display: flex; gap: 8px; align-items: center; padding-block: 10px calc(12px + env(safe-area-inset-bottom, 0px)); padding-inline: max(12px, env(safe-area-inset-left, 0px)) max(12px, env(safe-area-inset-right, 0px)); border-top: 1px solid var(--line); }
.game-bar[hidden], .inp[hidden], .chips[hidden], .left[hidden] { display: none; }
.game-go { flex: 1; min-height: 56px; border: 0; border-radius: 16px; font-family: var(--display); font-size: 19px; font-weight: 700; letter-spacing: .06em; color: #f3e7d8; background: var(--wax); border: 1px solid var(--wax-line); }
.game-go:disabled { opacity: .55; animation: none; }
.game-auto { min-height: 56px; padding: 0 14px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); font-size: 13px; color: var(--muted); }
.game-auto[hidden] { display: none; }
.game-auto:disabled { opacity: .5; }
@keyframes gamePulse { 50% { box-shadow: 0 0 30px rgba(168, 67, 79, .6); } }
#g-curtain { position: fixed; inset: 0; z-index: 40; background: #000; transition: opacity .4s; }
#g-curtain.off { opacity: 0; pointer-events: none; }
.g-layer { position: fixed; inset: 0; z-index: 41; overflow: hidden; background: #000; touch-action: none; user-select: none; -webkit-user-select: none; }
.g-playable iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; transition: opacity .35s; background: #000; }
.g-playable.ready iframe { opacity: 1; }
.g-playable.out { opacity: 0; transition: opacity .25s; }
.g-pl-load { position: absolute; inset: 0; display: grid; place-items: center; color: #fff9; font: 600 15px/1 system-ui, sans-serif; letter-spacing: .04em; }
.g-pl-quit { position: absolute; top: max(10px, max(env(safe-area-inset-top), var(--shell-inset-top, 0px))); right: 10px; z-index: 2; padding: 7px 12px; border: 1px solid #fff4; border-radius: 999px; background: #0008; color: #fffc; font: 600 12px/1 system-ui, sans-serif; cursor: pointer; }
.g-pl-boosts { position: absolute; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 2; display: flex; flex-direction: column; gap: 6px; align-items: center; width: min(92%, 420px); padding: 10px 12px; border-radius: 14px; background: #000b; pointer-events: none; transition: opacity .5s; font: 600 13px/1.3 system-ui, sans-serif; color: #fff; text-align: center; }
.g-pl-boosts b { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #fff9; }
.g-pl-boosts .up { color: #9dffb0; }
.g-pl-boosts .down { color: #ff9d9d; }
.g-pl-boosts.out { opacity: 0; }
.g-rain { position: absolute; inset: 0; pointer-events: none; z-index: 3; }

.g-vs-pane { position: absolute; left: 0; right: 0; height: 58%; background-size: cover; background-position: 50% 18%; display: flex; }
.g-vs-pane b { position: absolute; font-family: var(--display); font-size: clamp(38px, 11vw, 76px); letter-spacing: .04em; text-shadow: 0 2px 22px #000, 0 0 3px #000; }
.g-vs-pane.top { top: 0; clip-path: polygon(0 0, 100% 0, 100% 74%, 0 100%); animation: vsTop .38s cubic-bezier(.1, .8, .2, 1) both; }
.g-vs-pane.top b { right: 18px; top: calc(16px + env(safe-area-inset-top, 0px)); }
.g-vs-pane.bot { bottom: 0; clip-path: polygon(0 26%, 100% 0, 100% 100%, 0 100%); background-position: 50% 25%; animation: vsBot .38s cubic-bezier(.1, .8, .2, 1) both; }
.g-vs-pane.bot b { left: 18px; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
.g-vs-line { position: absolute; left: -10%; right: -10%; top: 50%; height: 4px; background: #fff; box-shadow: 0 0 26px 6px #c9707c; transform: rotate(-8.5deg); animation: vsLine .38s .32s both; z-index: 2; }
.g-vs-title { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-145%) rotate(-8.5deg); text-align: center; font-family: var(--display); font-size: clamp(22px, 6.5vw, 42px); font-weight: 700; letter-spacing: .14em; color: #fff; text-shadow: 0 0 14px #c9707c, 0 2px 8px #000; animation: vsTitle .3s .42s both; z-index: 3; }
.g-vs.hit { animation: gShake .36s; }
.g-vs.out { opacity: 0; transition: opacity .25s; }
@keyframes vsTop { from { transform: translateX(100%); } }
@keyframes vsBot { from { transform: translateX(-100%); } }
@keyframes vsLine { from { transform: rotate(-8.5deg) scaleX(0); } }
@keyframes vsTitle { from { opacity: 0; letter-spacing: .5em; } }
@keyframes gShake { 15% { transform: translate(-10px, 7px); } 35% { transform: translate(9px, -6px); } 60% { transform: translate(-5px, 3px); } 100% { transform: none; } }

.g-duel canvas { position: absolute; inset: 0; display: block; }
.g-hud { position: absolute; z-index: 5; top: 0; left: 0; right: 0; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top, 0px)) 12px 8px; pointer-events: none; transition: opacity .3s; }
.g-side { display: flex; align-items: center; gap: 7px; min-width: 0; }
.g-side > div { flex: 1; min-width: 0; }
.g-side b { display: block; font-size: 12px; line-height: 1.3; }
.g-side.foe b { text-align: right; }
.g-bar { display: block; height: 8px; border-radius: 2px; background: rgba(255, 255, 255, .14); overflow: hidden; transform: skewX(-18deg); }
.g-bar i { display: block; height: 100%; transition: width .16s; }
.g-bar.hero i { background: linear-gradient(90deg, #e23a4e, #ff7a8c); }
.g-bar.foe { direction: rtl; }
.g-bar.foe i { background: linear-gradient(270deg, #e9c981, #fff3c9); }
.g-clock { font-family: var(--display); font-size: 14px; font-variant-numeric: tabular-nums; letter-spacing: .05em; color: #fff; text-shadow: 0 0 8px rgba(201, 112, 124, .8); }
.g-clock.low { color: var(--red); animation: gamePulseText .5s infinite alternate; }
@keyframes gamePulseText { to { opacity: .55; } }
.g-mute { position: absolute; z-index: 6; top: calc(62px + env(safe-area-inset-top, 0px)); right: 8px; width: 40px; height: 40px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .35); font-size: 15px; }
.g-bark { position: absolute; z-index: 5; left: 12px; right: 56px; top: calc(62px + env(safe-area-inset-top, 0px)); display: flex; align-items: center; gap: 8px; opacity: 0; pointer-events: none; }
.g-bark.on { animation: gBark 3.2s both; }
.g-bark span { font-size: 13px; font-weight: 500; line-height: 1.35; padding: 6px 10px; border-radius: 4px 12px 12px 12px; background: rgba(14, 12, 16, .78); border: 1px solid rgba(255, 255, 255, .14); word-break: keep-all; }
@keyframes gBark { 0% { opacity: 0; transform: translateX(-14px); } 6%, 88% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.g-say { position: absolute; z-index: 5; left: 0; right: 0; top: 19%; text-align: center; font-size: 16px; font-weight: 700; color: var(--gold); text-shadow: 0 1px 8px #000, 0 0 2px #000; opacity: 0; pointer-events: none; padding: 0 16px; }
.g-say.on { animation: gSay 2s both; }
@keyframes gSay { 0% { opacity: 0; transform: translateY(8px); } 10%, 82% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.g-big { position: absolute; z-index: 5; inset: 0; display: grid; place-items: center; font-family: var(--display); font-size: clamp(54px, 18vw, 110px); font-weight: 700; letter-spacing: .1em; text-shadow: 0 0 28px currentColor, 0 2px 8px #000; opacity: 0; pointer-events: none; }
.g-big.on { animation: gBig .8s both; }
@keyframes gBig { 0% { opacity: 0; transform: scale(1.7); } 18%, 60% { opacity: 1; transform: none; } 100% { opacity: 0; transform: scale(.97); } }
.g-hint { position: absolute; z-index: 5; left: 0; right: 0; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); text-align: center; font-size: 13px; color: rgba(255, 255, 255, .72); pointer-events: none; transition: opacity .5s; }
.g-hint.off { opacity: 0; }
.g-vig { position: absolute; z-index: 4; inset: 0; opacity: 0; pointer-events: none; box-shadow: inset 0 0 90px 28px rgba(255, 30, 60, .75); }
.g-cut-bar { position: absolute; z-index: 6; left: 0; right: 0; height: 11%; background: #000; transition: transform .45s cubic-bezier(.2, .8, .2, 1); pointer-events: none; }
.g-cut-bar.top { top: 0; }
.g-cut-bar.bot { bottom: 0; }
.g-duel .g-cut-bar.top { transform: translateY(-101%); }
.g-duel .g-cut-bar.bot { transform: translateY(101%); }
.g-duel.cine .g-cut-bar { transform: none; }
.g-duel.ending .g-hud, .g-duel.ending .g-mute, .g-duel.ending .g-bark, .g-duel.ending .g-hint, .g-duel.ending .g-say { visibility: hidden; }

.g-cut { cursor: pointer; animation: gFadeIn .4s both; }
.g-cut.out { opacity: 0; transition: opacity .46s; }
@keyframes gFadeIn { from { opacity: 0; } }
.g-cut-frame { position: absolute; inset: 0; overflow: hidden; }
.g-cut-back { position: absolute; inset: -8%; background-size: cover; background-position: center; filter: blur(26px) brightness(.45); }
.g-cut-frame img, .g-cut-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; will-change: transform; background: #000; }
.g-cut-sweep { position: absolute; z-index: 4; left: -30%; top: 49%; width: 160%; height: 6px; background: #fff; box-shadow: 0 0 32px 10px #fff; pointer-events: none; }
.g-cut-flash { position: absolute; z-index: 5; inset: 0; background: #fff; pointer-events: none; }
.g-cut-sub { position: absolute; z-index: 7; left: 0; right: 0; bottom: calc(1.5% + env(safe-area-inset-bottom, 0px)); min-height: 8%; display: flex; align-items: center; justify-content: center; padding: 0 22px; text-align: center; font-size: clamp(15px, 4.3vw, 21px); font-weight: 500; line-height: 1.5; color: #fff; word-break: keep-all; opacity: 0; transform: translateY(8px); transition: opacity .5s, transform .5s; }
.g-cut-sub.on { opacity: 1; transform: none; }
.g-cut-stamp { position: absolute; z-index: 8; bottom: calc(14% + env(safe-area-inset-bottom, 0px)); right: 7%; padding: 4px 16px; border: 3px solid; border-radius: 6px; background: rgba(0, 0, 0, .45); font-family: var(--display); font-size: clamp(30px, 9vw, 54px); font-weight: 700; letter-spacing: .12em; transform: rotate(-7deg); animation: gStamp .3s cubic-bezier(.2, 1.5, .4, 1) both; }
@keyframes gStamp { from { opacity: 0; transform: rotate(-7deg) scale(2.1); } }
@media (min-aspect-ratio: 1/1) {
  .g-cut-frame img, .g-cut-frame video { object-fit: contain; object-position: center; }
  .g-vs-pane { background-position: 50% 20%; }
}
@media (prefers-reduced-motion: reduce) { .game-go, .g-clock.low { animation: none; } .g-vs.hit { animation: none; } .g-cut-stamp, .g-big.on { animation-duration: .01s; } }

/* A picture in the chat: the stage already shows it large, so the log keeps a small card that opens it. Its size is fixed, so the rows around it don't move when it loads. */
.cg { position: relative; display: flex; align-items: center; gap: 12px; align-self: flex-start; width: min(100%, 320px); min-height: 76px; padding: 6px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; overflow: hidden; }
.cg img { flex: none; width: 42px; height: 62px; border-radius: 8px; object-fit: cover; object-position: 50% 25%; background: var(--raised); }
.cg span { min-width: 0; font-family: var(--display); font-size: 13px; letter-spacing: .03em; }
/* The title may run long (or be machine-translated longer): the card grows instead of cutting it, up to three lines. */
.cg:not(.locked) > span:not(:has(.cg-t)), .cg.free .cg-t { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; overflow: hidden; }
.cg.free .cg-t { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-weight: inherit; }
.cg .cg-free { display: table; margin-top: 4px; padding: 2px 8px; border-radius: 999px; background: var(--gold, #e8b84a); color: #1a1408; font-style: normal; font-size: 11px; font-weight: 800; letter-spacing: .02em; }

/* A locked scene inside the chat: the blurred picture, its name and one open button with its price. Typing goes on under it. */
.cg.locked { cursor: default; width: 100%; max-width: 420px; }
.cg.locked img { filter: blur(6px) brightness(.7); }
.cg.locked span { flex: 1; }
.cg.locked .unlock { order: 3; flex: none; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .4); background: var(--raised); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer; }
.cg.locked .unlock:disabled { opacity: .6; cursor: default; }

/* The button that follows episode one: a demand signal, nothing is bought. */
.episode-end { align-self: center; margin: 8px 0; text-align: center; }
.episode-end .next-episode { min-height: 44px; padding: 0 22px; border-radius: 999px; border: 1px solid rgba(201, 112, 124, .6); background: var(--panel); color: #fff; font-size: 15px; font-weight: 700; cursor: pointer; }
.episode-end .soon { margin: 0; color: var(--muted); font-size: 14px; }

.ticket-count { color: var(--gold); font-size: 12px; }
body.in-intro .ticket-count { display: none; }

@media (max-width: 340px) { .top { gap: 6px; } }

.log .acts{display:none;margin-top:6px}
.log .ai.last-ai .acts{display:flex}
@media (hover:hover){.log .ai:hover .acts{display:flex}}
.log .acts .flag{display:inline-flex;align-items:center;gap:5px;height:26px;padding:0 11px;border-radius:999px;border:1px solid var(--line);background:rgba(30,26,32,.72);color:var(--muted);font-size:12px;font-weight:600;font-style:normal}
.log .acts .flag:hover{border-color:var(--cyan);color:var(--fg)}
.log .reported{align-self:center;display:flex;gap:10px;align-items:center;max-width:94%;padding:5px 5px 5px 14px;border:1px dashed var(--line);border-radius:999px;background:rgba(30,26,32,.62);color:var(--muted);font-size:12.5px;font-weight:600}
.log .reported .rewrite{height:28px;padding:0 13px;border-radius:999px;border:0;background:var(--cyan);color:#06121a;font-size:12.5px;font-weight:700;white-space:nowrap}
.log .reported .rewrite:disabled{opacity:.6}
.report-sheet{position:fixed;inset:0;z-index:60;background:#0009;display:flex;align-items:flex-end;justify-content:center}
.report-sheet form{width:min(520px,100%);background:var(--panel);border:1px solid var(--line);border-radius:18px 18px 0 0;padding:18px 18px calc(18px + max(env(safe-area-inset-bottom),var(--shell-inset-bottom,0px)));display:flex;flex-direction:column;gap:10px}
.report-sheet h3{margin:0;font-size:17px}
.report-sheet .quote{margin:0;color:var(--muted);font-style:italic;font-size:13px;max-height:4.5em;overflow:hidden}
.report-sheet label{display:flex;gap:10px;align-items:center;font-size:15px}
.report-sheet textarea{min-height:56px;background:transparent;color:inherit;border:1px solid var(--line);border-radius:10px;padding:8px;font:inherit}
.report-sheet .row{display:flex;gap:10px;justify-content:flex-end}
.report-sheet button{border:1px solid var(--line);border-radius:999px;padding:8px 16px;background:none;color:inherit;font-weight:700}
.report-sheet button[type=submit]{background:var(--wax);border-color:var(--wax-line);color:#f3e7d8}
.report-sheet button:disabled{opacity:.5}

/* AI consent sheet (app only, before the first message) */
.ai-yes{height:48px;border:0;border-radius:12px;background:var(--primary);color:var(--on-primary);font-weight:800;font-size:15px;cursor:pointer}
.ai-no{height:42px;border:1px solid var(--line);border-radius:12px;background:transparent;color:var(--fg);cursor:pointer}
/* The story tree reveal card (app.js treeCard): over the chat, above the composer. */
.tree-card { position: fixed; left: 50%; bottom: 132px; transform: translateX(-50%); z-index: 60; width: min(calc(100vw - 32px), 360px); padding: 16px 16px 14px; border-radius: 16px; border: 1px solid var(--gold); background: var(--panel); box-shadow: 0 18px 50px rgba(0,0,0,.45); animation: tree-pop .35s ease-out; }
.tree-card b { display: block; font-family: var(--display); font-size: 15px; letter-spacing: .04em; color: var(--gold); }
.tree-card p { margin: 6px 0 12px; font-size: 13.5px; line-height: 1.5; }
.tree-card div { display: flex; gap: 8px; align-items: center; }
.tree-card .go { flex: 1; min-height: 40px; border: 0; border-radius: 999px; background: var(--gold); color: #1a1408; font: inherit; font-weight: 800; cursor: pointer; }
.tree-card .x { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: transparent; color: inherit; cursor: pointer; }
@keyframes tree-pop { from { opacity: 0; transform: translate(-50%, 12px) scale(.97); } to { opacity: 1; transform: translate(-50%, 0) scale(1); } }
@media (prefers-reduced-motion: reduce) { .tree-card { animation: none; } }

/* Scenario cartridges: one line above the chips. Off: "Set out". On: where you are and the goal, with Turn back. */
.kit-bar{display:flex;align-items:center;gap:8px;margin:0 16px 6px;padding:6px 6px 6px 12px;border:1px solid var(--line);border-radius:12px;background:var(--panel);font-size:13px;min-height:40px}
.kit-bar[hidden]{display:none}
.kit-bar .kit-now{flex:1;min-width:0;display:flex;gap:6px;align-items:baseline;overflow:hidden;white-space:nowrap}
.kit-bar .kit-now b{flex-shrink:0}
.kit-bar .kit-now span{overflow:hidden;text-overflow:ellipsis;color:var(--muted)}
.kit-bar button{flex-shrink:0;min-height:32px;padding:0 12px;border:1px solid var(--line);border-radius:10px;background:none;color:var(--fg);font:inherit;font-size:13px;cursor:pointer}
.kit-bar.off{border-style:dashed;background:none}
.kit-bar.off button{flex:1;border:0;text-align:left;padding:0;font-weight:700}
.kit-list{list-style:none;margin:8px 0 0;padding:0}
.kit-list button{display:flex;align-items:center;gap:12px;width:100%;padding:11px 8px;border:0;border-bottom:1px solid var(--line);background:none;color:var(--fg);font:inherit;text-align:left;cursor:pointer}
.kit-list button:hover{background:var(--raised)}
.kit-list .pl{flex:0 0 72px;font-size:19px;font-weight:700}
.kit-list .tx{flex:1;min-width:0}
.kit-list .tx b{display:block;font-size:14px}
.kit-list .tx span{display:block;overflow:hidden;color:var(--muted);font-size:12.5px;white-space:nowrap;text-overflow:ellipsis}
.kit-list .ok{flex-shrink:0;color:var(--gold,#ffd166);font-size:12px}
.kit-hint{margin:0;color:var(--muted);font-size:13px;line-height:1.5}
