:root {
  --ink: #ece5d3; --muted: #a49c8a; --line: rgba(255,255,255,.09); --glass: rgba(12,15,19,.62); --glass2: rgba(20,24,30,.72);
  --accent: #e2aa4c; --accent2: #b5533c; --good: #7fbf78; --bad: #c25b4e;
  --serif: "Cormorant Garamond", "Iowan Old Style", Palatino, Georgia, serif; --display: "Cinzel", "Cormorant Garamond", Georgia, serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: #0d1119; color: var(--ink); font-family: var(--serif); font-size: 17px; overflow: hidden; }
#scene { position: fixed; inset: 0; }
#scene canvas { display: block; width: 100%; height: 100%; }
.overlay { position: fixed; inset: 0; pointer-events: none; overflow: hidden; }
.labels div { position: absolute; transform: translate(-50%, -50%); font-family: var(--display); font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: rgba(236,229,211,.55); text-shadow: 0 1px 6px rgba(0,0,0,.9); white-space: nowrap; }
.labels div.npc { font-family: var(--serif); font-size: 14px; letter-spacing: .04em; text-transform: none; color: rgba(236,229,211,.92); font-weight: 600; }
.labels div.npc.near { color: var(--accent); }
.labels div.npc .m { display: block; text-align: center; font-size: 10px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.labels div.player { font-family: var(--serif); font-size: 12px; letter-spacing: .02em; text-transform: none; color: rgba(236,229,211,.6); }
.bubbles div { position: absolute; transform: translate(-50%, -100%); max-width: 230px; background: rgba(236,229,211,.96); color: #1a1408; padding: 8px 12px; border-radius: 10px; font-size: 14px; line-height: 1.35; box-shadow: 0 8px 24px rgba(0,0,0,.45); animation: pop .25s ease-out; }
.bubbles div::after { content: ""; position: absolute; left: 50%; bottom: -7px; margin-left: -6px; border: 6px solid transparent; border-top-color: rgba(236,229,211,.96); border-bottom: 0; }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -90%) scale(.9) } to { opacity: 1; transform: translate(-50%, -100%) scale(1) } }
.vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at center, rgba(0,0,0,0) 45%, rgba(0,0,0,.55) 100%); }
.bars { position: fixed; inset: 0; pointer-events: none; }
.bars::before, .bars::after { content: ""; position: absolute; left: 0; right: 0; height: 0; background: #06080b; transition: height .7s cubic-bezier(.4,0,.2,1); }
.bars::before { top: 0 } .bars::after { bottom: 0 }
.bars.on::before, .bars.on::after { height: 7vh; }

.hud { position: fixed; background: var(--glass); backdrop-filter: blur(14px) saturate(120%); -webkit-backdrop-filter: blur(14px) saturate(120%); border: 1px solid var(--line); box-shadow: 0 10px 40px rgba(0,0,0,.35); }
.top { top: 14px; left: 14px; right: 14px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 18px; border-radius: 12px; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; }
.brand h1 { font-family: var(--display); font-size: 20px; margin: 0; letter-spacing: .22em; font-weight: 600; text-transform: uppercase; }
.lantern { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 16px 5px rgba(226,170,76,.45); animation: flicker 2.4s infinite; }
@keyframes flicker { 0%,100% { opacity: 1 } 45% { opacity: .75 } 60% { opacity: .95 } 80% { opacity: .7 } }
.tag { font-size: 11px; color: var(--muted); border: 1px solid var(--line); padding: 2px 8px; border-radius: 10px; letter-spacing: .06em; font-family: var(--display); }
.quest { display: flex; flex-direction: column; max-width: 480px; }
.quest .q-title { color: var(--accent); font-family: var(--display); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
.quest .q-goal { color: var(--muted); font-size: 14px; line-height: 1.3; }
.actions { display: flex; gap: 8px; }
button { font-family: var(--display); font-size: 12px; letter-spacing: .1em; text-transform: uppercase; cursor: pointer; border-radius: 8px; border: 1px solid var(--accent); background: linear-gradient(180deg, #f0be62, #cf9a3b); color: #1a1408; padding: 9px 16px; transition: transform .1s, box-shadow .2s; }
button:hover { box-shadow: 0 0 18px rgba(226,170,76,.35); }
button:active { transform: translateY(1px); }
button:disabled { opacity: .5; cursor: default; box-shadow: none; }
button.ghost { background: rgba(255,255,255,.03); color: var(--muted); border-color: var(--line); }
button.ghost:hover { color: var(--ink); border-color: rgba(255,255,255,.25); box-shadow: none; }
button.ghost.busy { color: var(--accent); border-color: var(--accent); }
.hint { position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); color: rgba(164,156,138,.7); font-size: 13px; letter-spacing: .04em; pointer-events: none; z-index: 4; }
.prompt { position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%); background: var(--glass2); backdrop-filter: blur(10px); border: 1px solid var(--accent); color: var(--ink); padding: 8px 16px; border-radius: 8px; font-size: 16px; pointer-events: none; z-index: 5; animation: pop .2s ease-out; }
.prompt kbd { font-family: var(--display); background: var(--accent); color: #1a1408; padding: 1px 7px; border-radius: 4px; font-weight: 700; margin-right: 8px; font-size: 12px; }
.toast { position: fixed; left: 50%; top: 92px; transform: translateX(-50%); background: var(--glass2); backdrop-filter: blur(10px); border: 1px solid var(--line); color: var(--ink); padding: 10px 18px; border-radius: 8px; font-size: 16px; max-width: 70%; text-align: center; z-index: 6; animation: pop .2s ease-out; }

.side { top: 92px; right: 14px; width: 320px; max-height: calc(100vh - 120px); border-radius: 12px; display: flex; flex-direction: column; font-size: 15px; z-index: 5; transform: translateX(0); transition: transform .35s cubic-bezier(.4,0,.2,1), opacity .35s; }
.side.closed { transform: translateX(360px); opacity: 0; pointer-events: none; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; color: var(--muted); border-radius: 0; padding: 12px 6px; font-size: 11px; letter-spacing: .12em; }
.tabs button:hover { box-shadow: none; color: var(--ink); }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.tabs.small button { font-size: 10px; padding: 9px 4px; }
.count { font-family: var(--serif); background: rgba(255,255,255,.08); color: var(--ink); border-radius: 8px; padding: 0 6px; font-size: 11px; }
.count:empty { display: none; }
.tab { display: none; padding: 10px 16px 14px; overflow-y: auto; }
.tab.on { display: block; }
.tab h3 { margin: 8px 0 4px; font-family: var(--display); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 500; }
ul.plain, #npcList { list-style: none; margin: 0; padding: 0; }
ul.plain li { padding: 7px 0; border-bottom: 1px solid var(--line); line-height: 1.4; }
ul.plain li .from { color: var(--muted); font-size: 13px; }
ul.plain li.empty { color: var(--muted); font-style: italic; border: 0; }
#feed li { font-size: 14px; }
#feed li.rumor { color: #d9b8e0; } #feed li.clue { color: #f0d79a; } #feed li.item { color: #a8d8a0; } #feed li.trust { color: var(--muted); }
#npcList li { display: grid; grid-template-columns: 12px 1fr auto; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
#npcList li .dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
#npcList li .n { font-weight: 600; }
#npcList li .r { display: block; color: var(--muted); font-size: 13px; font-weight: 400; }
#npcList li .m { color: var(--muted); font-size: 13px; white-space: nowrap; text-align: right; }
#npcList li .bar { grid-column: 2 / 4; height: 3px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; }
#npcList li .bar i { display: block; height: 100%; background: var(--accent); }
.blurb { color: var(--muted); font-size: 14px; line-height: 1.45; margin: 12px 0 0; font-style: italic; }

.dialogue { left: 50%; bottom: 44px; transform: translateX(-50%); width: min(880px, calc(100% - 28px)); display: flex; gap: 16px; padding: 16px 18px; border-radius: 14px; border-color: rgba(226,170,76,.45); z-index: 6; animation: rise .35s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 16px) } to { opacity: 1; transform: translate(-50%, 0) } }
.portrait { flex: none; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.face { width: 84px; height: 84px; border-radius: 14px; display: grid; place-items: center; font-family: var(--display); font-size: 40px; font-weight: 600; color: rgba(0,0,0,.6); border: 2px solid rgba(255,255,255,.14); box-shadow: inset 0 -20px 30px rgba(0,0,0,.25); }
.trustBox { width: 84px; font-size: 12px; color: var(--muted); text-align: center; }
.trustBar { height: 4px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden; margin-bottom: 4px; }
.trustBar i { display: block; height: 100%; background: var(--accent); transition: width .6s; }
.talk { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.who { display: flex; align-items: baseline; gap: 10px; }
.who .name { font-family: var(--display); font-size: 17px; font-weight: 600; letter-spacing: .06em; }
.who .role { color: var(--muted); font-size: 14px; flex: 1; font-style: italic; }
.who .mood { font-size: 12px; color: var(--accent); border: 1px solid var(--line); padding: 1px 9px; border-radius: 10px; }
.who .close { padding: 0 8px; font-size: 18px; line-height: 1.3; font-family: var(--serif); }
.log { max-height: 210px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 6px; scroll-behavior: smooth; }
.line { padding: 8px 12px; border-radius: 8px; line-height: 1.45; font-size: 17px; max-width: 86%; white-space: pre-wrap; }
.line.you { align-self: flex-end; background: rgba(255,255,255,.07); }
.line.npc { align-self: flex-start; background: rgba(226,170,76,.08); border-left: 2px solid var(--accent); }
.line.npc.live::after { content: "▍"; color: var(--accent); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0 } }
.line.sys { align-self: flex-start; color: var(--muted); font-style: italic; font-size: 14px; padding: 2px 12px; }
.line.fx { align-self: flex-start; font-size: 14px; padding: 4px 12px; border-radius: 6px; background: rgba(127,191,120,.12); color: #cfe6c9; }
.line.fx.clue { background: rgba(240,215,154,.12); color: #f0d79a; } .line.fx-trust { align-self: flex-start; color: var(--muted); padding: 0 12px; font-size: 13px; }
.line.err { align-self: stretch; background: rgba(181,83,60,.15); border-left: 2px solid var(--accent2); color: #f0c9bf; font-size: 14px; }
.line.err code { font-family: ui-monospace, Menlo, monospace; background: rgba(0,0,0,.3); padding: 0 4px; border-radius: 3px; }
.line.wait { align-self: flex-start; color: var(--muted); font-style: italic; }
.line.wait::after { content: "…"; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: "" } 25% { content: "." } 50% { content: ".." } 75% { content: "..." } }
#say { display: flex; gap: 8px; }
#input { flex: 1; font-family: var(--serif); font-size: 17px; padding: 9px 14px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0,0,0,.35); color: var(--ink); }
#input:focus { outline: none; border-color: var(--accent); }

.hood { position: fixed; top: 0; right: 0; bottom: 0; width: min(580px, 100%); background: rgba(10,13,17,.92); backdrop-filter: blur(16px); border-left: 1px solid rgba(226,170,76,.5); display: flex; flex-direction: column; z-index: 20; box-shadow: -20px 0 50px rgba(0,0,0,.6); }
.hoodHead { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.hoodHead strong { flex: 1; font-family: var(--display); letter-spacing: .12em; font-size: 13px; text-transform: uppercase; }
.hoodHead select { font-family: var(--serif); font-size: 15px; background: rgba(0,0,0,.4); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; }
.hoodNote { margin: 0; padding: 10px 16px; color: var(--muted); font-size: 13px; line-height: 1.4; border-bottom: 1px solid var(--line); }
.hoodBody { flex: 1; overflow: auto; margin: 0; padding: 14px 16px; font: 12px/1.55 ui-monospace, Menlo, monospace; white-space: pre-wrap; color: #d6d0c2; }
.modal { position: fixed; inset: 0; background: rgba(4,6,9,.78); backdrop-filter: blur(6px); display: grid; place-items: center; z-index: 30; padding: 20px; animation: fade .4s; }
@keyframes fade { from { opacity: 0 } to { opacity: 1 } }
.card { background: rgba(14,17,22,.96); border: 1px solid rgba(226,170,76,.5); border-radius: 14px; padding: 30px 34px; max-width: 560px; width: 100%; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.card h2 { margin: 0; font-family: var(--display); font-size: 24px; font-weight: 600; letter-spacing: .04em; }
.card p { margin: 0; color: var(--muted); line-height: 1.55; font-size: 17px; }
.card input { font-family: var(--serif); font-size: 18px; padding: 11px 14px; border-radius: 8px; border: 1px solid var(--line); background: rgba(0,0,0,.4); color: var(--ink); }
.card input:focus { outline: none; border-color: var(--accent); }
.card.ending { max-width: 700px; }
.eyebrow { font-family: var(--display); font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--accent); }
.endText { max-height: 50vh; overflow-y: auto; line-height: 1.65; font-size: 18px; }
.endText p { margin: 0 0 14px; }
.row { display: flex; gap: 10px; justify-content: flex-end; }
@media (max-width: 900px) { .quest { display: none } .side { width: 280px } }

#hereList li { display: flex; align-items: center; gap: 8px; font-size: 14px; }
#hereList li .dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 8px currentColor; }
#hereList li .r { color: var(--muted); font-size: 12px; }
.labels div.other { font-family: var(--serif); font-size: 13px; letter-spacing: .02em; text-transform: none; color: rgba(200,220,255,.85); }
.labels div.other .m { display: block; text-align: center; font-size: 10px; color: var(--muted); }
button.ghost.off { text-decoration: line-through; opacity: .7; }

.clock { display: flex; flex-direction: column; align-items: flex-end; min-width: 90px; }
.clock .c-time { font-family: var(--display); font-size: 14px; letter-spacing: .08em; color: var(--ink); }
.clock .c-period { font-size: 12px; color: var(--muted); font-style: italic; text-transform: capitalize; }
.chat { position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%); width: min(560px, calc(100% - 28px)); z-index: 6; }
.chat input { width: 100%; font-family: var(--serif); font-size: 17px; padding: 11px 16px; border-radius: 10px; border: 1px solid var(--accent); background: var(--glass2); backdrop-filter: blur(10px); color: var(--ink); }
.chat input:focus { outline: none; }
.bubbles div.say { background: rgba(200,220,255,.96); }
.bubbles div.say::after { border-top-color: rgba(200,220,255,.96); }
#checklist li { display: flex; gap: 8px; align-items: baseline; }
#checklist li .or { color: var(--muted); font-style: italic; font-size: 13px; }
#checklist li .ok { color: var(--good); }
#checklist li .no { color: var(--muted); }
.prompt { pointer-events: auto; cursor: pointer; }
@media (max-width: 900px) { .clock { display: none } }

.line.act { align-self: flex-start; color: var(--accent); font-style: italic; font-size: 14px; padding: 2px 12px; }
.bubbles div.hail { background: rgba(226,170,76,.97); }
.bubbles div.hail::after { border-top-color: rgba(226,170,76,.97); }
