:root {
  --panel: rgba(9, 28, 38, 0.82);
  --panel-line: rgba(255, 255, 255, 0.12);
  --text: #f4f8fa;
  --muted: #a9bec8;
  --yellow: #f6c90e;
  --red: #d8232a;
  --green: #3ccf7a;
  --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #000; color: var(--text); font-family: 'Poppins', system-ui, sans-serif; }
canvas#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
canvas#c.picking { cursor: crosshair; }
.hidden { display: none !important; }
kbd { display: inline-block; min-width: 1.6em; padding: 0.05em 0.45em; border-radius: 6px; border: 1px solid rgba(255,255,255,.35); border-bottom-width: 3px; background: rgba(255,255,255,.08); font: 600 0.85em 'Poppins', sans-serif; text-align: center; color: var(--text); }

/* ---------- welcome ---------- */
#welcome { position: fixed; inset: 0; background: #000; display: grid; place-items: center; z-index: 50; transition: opacity .8s; }
#welcome.out { opacity: 0; pointer-events: none; }
.welcome-inner { text-align: center; padding: 16px; }
.logo { width: min(420px, 80vw); border-radius: 14px; background: #000; }
#welcome h1 { font-size: clamp(28px, 4vw, 44px); margin: 28px 0 0; letter-spacing: .02em; }
#welcome .sub { margin: 4px 0 28px; color: var(--muted); font-size: 18px; }
.fine { color: var(--muted); font-size: 12.5px; margin-top: 22px; }

/* ---------- buttons ---------- */
.btn { font: 600 15px 'Poppins', sans-serif; border-radius: 999px; padding: 11px 26px; border: 1px solid var(--panel-line); background: rgba(255,255,255,.08); color: var(--text); cursor: pointer; transition: transform .1s, background .2s; }
.btn:hover { background: rgba(255,255,255,.16); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--yellow); color: #1b1b1b; border-color: transparent; }
.btn.primary:hover { background: #ffd83b; }
.btn .k { opacity: .55; font-weight: 500; margin-left: 8px; font-size: 12px; }

/* ---------- panels ---------- */
#ui { position: fixed; inset: 0; pointer-events: none; z-index: 45; display: flex; padding: 16px; }
#ui > .panel { pointer-events: auto; }
#ui.center { align-items: center; justify-content: center; }
#ui.bottom { align-items: flex-end; justify-content: center; padding-bottom: 28px; }
#ui.top { align-items: flex-start; justify-content: center; padding-top: 64px; }
.panel { background: var(--panel); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--panel-line); border-radius: var(--radius); padding: 22px 26px; max-width: min(720px, 100%); box-shadow: 0 20px 60px rgba(0,0,0,.35); animation: pop .35s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.panel h2 { margin: 0 0 6px; font-size: 22px; }
.panel p { margin: 8px 0; line-height: 1.55; color: #dfe9ee; }
.eyebrow { font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--yellow); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.eyebrow img { height: 18px; }
.actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; flex-wrap: wrap; }
.chip { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--yellow); color: #1b1b1b; letter-spacing: .06em; }
.chip.red { background: var(--red); color: #fff; }
.chip.green { background: var(--green); color: #06301a; }
.speaker { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(180deg, var(--red) 50%, var(--yellow) 50%); flex: none; }
.quote { font-size: 18px; line-height: 1.5; color: #fff; font-style: italic; }

/* language grid */
.lang-grid { width: min(660px, calc(100vw - 90px)); display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 10px; margin-top: 14px; }
.lang { background: rgba(255,255,255,.94); color: #10232c; border: 2px solid transparent; border-radius: 12px; padding: 10px 12px; text-align: left; cursor: pointer; font-family: inherit; }
.lang b { display: block; font-size: 16px; }
.lang small { font-size: 11px; color: #5b6f78; }
.lang.sel { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(246,201,14,.35); }
.note { font-size: 12.5px; color: var(--muted); min-height: 1.4em; margin-top: 10px; }

/* controls list */
.controls { display: grid; grid-template-columns: auto 1fr; gap: 10px 16px; align-items: center; margin-top: 12px; }
.controls div:nth-child(odd) { text-align: right; white-space: nowrap; }

/* feedback */
.result { display: flex; gap: 14px; align-items: flex-start; }
.result .icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 20px; flex: none; }
.result .icon.ok { background: var(--green); color: #06301a; }
.result .icon.no { background: var(--red); color: #fff; }

/* decision options */
.options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.opt { background: rgba(255,255,255,.94); color: #10232c; border-radius: 12px; padding: 12px; font-size: 13.5px; }
.opt b { display: block; font-size: 14px; margin-bottom: 6px; }
.opt .keys { margin-top: 8px; color: #44606b; font-size: 12px; }
.opt kbd { color: #10232c; border-color: #9fb3bb; background: #eef3f5; }
@media (max-width: 640px) { .options { grid-template-columns: 1fr; } }

/* debrief */
.messages { list-style: none; padding: 0; margin: 14px 0 0; counter-reset: m; }
.messages li { counter-increment: m; padding: 10px 14px; margin: 6px 0; background: rgba(255,255,255,.06); border-radius: 10px; font-weight: 600; letter-spacing: .02em; opacity: 0; transform: translateX(-10px); transition: all .5s; display: flex; gap: 12px; align-items: center; }
.messages li::before { content: counter(m); width: 26px; height: 26px; border-radius: 50%; background: var(--yellow); color: #1b1b1b; display: grid; place-items: center; font-size: 13px; flex: none; }
.messages li.in { opacity: 1; transform: none; }
.final { margin-top: 16px; padding: 14px 16px; border-radius: 12px; background: linear-gradient(90deg, rgba(216,35,42,.9), rgba(246,201,14,.9)); color: #fff; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.35); opacity: 0; transition: opacity .8s; }
.final.in { opacity: 1; }
.summary { display: flex; gap: 18px; margin-top: 12px; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.summary b { color: var(--text); }

/* ---------- prompt (task banner) ---------- */
#prompt { position: fixed; top: 58px; left: 50%; transform: translateX(-50%); z-index: 15; background: var(--panel); border: 1px solid var(--panel-line); border-radius: 14px; padding: 12px 20px; max-width: min(680px, calc(100% - 32px)); text-align: center; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
#prompt .eyebrow { justify-content: center; }
#prompt p { margin: 4px 0 0; font-size: 16px; }
#prompt .hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

/* subtitles / VO */
#sub { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 18; max-width: min(760px, calc(100% - 32px)); background: rgba(0,0,0,.6); border-radius: 12px; padding: 12px 18px; text-align: center; font-size: 17px; line-height: 1.45; animation: pop .3s ease-out; }
#sub .chip { margin-right: 8px; vertical-align: 2px; }
#sub.raised { bottom: 210px; }

/* breadcrumbs */
#crumbs { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 16; display: flex; gap: 4px; background: rgba(0,0,0,.35); padding: 5px; border-radius: 999px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); max-width: calc(100% - 100px); overflow-x: auto; }
#crumbs span { font-size: 12px; padding: 4px 12px; border-radius: 999px; color: rgba(255,255,255,.6); white-space: nowrap; }
#crumbs span.done { color: rgba(255,255,255,.9); }
#crumbs span.on { background: var(--yellow); color: #1b1b1b; font-weight: 600; }

/* HUD */
#hud { position: fixed; top: 14px; right: 14px; z-index: 17; }
.hud-card { background: rgba(0,0,0,.55); border: 1px solid var(--panel-line); border-radius: 14px; padding: 10px 14px; width: 210px; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.hud-row { display: flex; align-items: baseline; gap: 6px; }
.hud-row span#hr { font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.hud-row small { color: var(--muted); }
.heart { color: #ff4d5a; font-size: 20px; display: inline-block; }
.heart.beat { animation: beat .25s ease-out; }
@keyframes beat { 50% { transform: scale(1.35); } }
#ecg { width: 180px; height: 40px; display: block; margin: 2px 0 6px; }
.hud-meta { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; font-size: 13px; }
.hud-meta small { color: var(--muted); display: block; font-size: 11px; }
.bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.15); overflow: hidden; margin-top: 4px; }
.bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #ff5a5a, #f6c90e, #3ccf7a); transition: width .2s; }
#hud.danger .hud-row span#hr { color: #ff6b6b; }

/* 3D labels */
#labels { position: fixed; inset: 0; pointer-events: none; z-index: 12; }
.label3d { position: absolute; transform: translate(-50%, -100%); background: rgba(9,28,38,.88); border: 1px solid rgba(255,255,255,.2); color: #fff; font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }
.label3d.good { background: rgba(28, 120, 70, .92); }
.label3d.bad { background: rgba(170, 28, 34, .92); }
.label3d::after { content: ''; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); border: 6px solid transparent; border-top-color: inherit; border-bottom: 0; }

/* fade */
#fade { position: fixed; inset: 0; background: #000; opacity: 1; pointer-events: none; z-index: 40; transition: opacity .7s; }

/* dev menu */
#dev { position: fixed; left: 14px; top: 60px; z-index: 60; background: rgba(0,0,0,.85); border: 1px solid var(--panel-line); border-radius: 14px; padding: 14px 16px; width: 230px; font-size: 13px; }
#dev h3 { margin: 0 0 8px; font-size: 14px; }
#dev-steps button { display: block; width: 100%; text-align: left; margin: 3px 0; background: rgba(255,255,255,.07); border: 0; color: #fff; border-radius: 8px; padding: 7px 10px; font: 500 13px 'Poppins', sans-serif; cursor: pointer; }
#dev-steps button:hover { background: rgba(255,255,255,.18); }
#dev label { display: block; margin-top: 10px; color: var(--muted); }

#mute { position: fixed; left: 14px; top: 12px; z-index: 30; background: rgba(0,0,0,.4); border: 1px solid var(--panel-line); color: #fff; border-radius: 50%; width: 38px; height: 38px; cursor: pointer; font-size: 16px; }
