:root {
  --bg: #e9e6e0;
  --ink: #221d19;
  --muted: #716960;
  --gold: #9a641e;
  --gold-soft: rgba(154, 100, 30, 0.14);
  --glass: rgba(255, 255, 255, 0.72);
  --line: rgba(116, 79, 31, 0.30);
  --red: #e2573f;
  --scrollbar: rgba(217, 178, 106, 0.45);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); font-family: Inter, system-ui, sans-serif; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
#coords { position: fixed; inset: 0; pointer-events: none; z-index: 2; overflow: hidden; }
#coords.hidden { display: none; }
.coord { position: absolute; transform: translate(-50%, -50%); padding: 2px 3px; border: 0; border-radius: 3px; background: rgba(0,0,0,.42); color: #fff; font-size: 9px; font-weight: 700; line-height: 1; letter-spacing: .02em; text-align: center; text-shadow: 0 1px 2px #000; font-variant-numeric: tabular-nums; opacity: .95; }
.coord.light { color: #111; background: rgba(255,255,255,.62); text-shadow: none; }
.coord.edge { padding: 2px 5px; border-radius: 5px; background: rgba(255,255,255,.78); color: #2b2722; font-size: 11px; text-shadow: none; box-shadow: 0 1px 4px rgba(0,0,0,.12); }
button { font: inherit; color: inherit; cursor: pointer; }

#loading { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 18px; background: var(--bg); z-index: 20; transition: opacity .8s; font-family: Cinzel, serif; letter-spacing: .12em; color: var(--muted); }
#loading.done { opacity: 0; pointer-events: none; }
.sigil { width: 64px; height: 64px; border: 2px solid var(--gold); border-radius: 50%; border-top-color: transparent; animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.top { position: fixed; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: center; gap: 20px; padding: 34px 26px 16px; background: linear-gradient(var(--bg), transparent); pointer-events: none; -webkit-app-region: drag; }
.top > * { pointer-events: auto; -webkit-app-region: no-drag; }
.brand { position: absolute; left: 26px; display: flex; align-items: center; gap: 10px; font-family: Cinzel, serif; font-weight: 700; font-size: 20px; letter-spacing: .22em; color: var(--gold); text-transform: uppercase; }
.brand img { width: 42px; height: 42px; object-fit: contain; filter: drop-shadow(0 0 8px rgba(217,178,106,.35)); }
.turn { display: none; }
.turn .dot { width: 18px; height: 18px; border-radius: 50%; background: #f4ecdc; box-shadow: 0 0 10px rgba(255,255,255,.5); }
.turn.b .dot { background: #1b1714; box-shadow: 0 0 0 1px var(--gold); }
.turn.check { border-color: var(--red); color: #ffd8cf; }
.actions { position: absolute; right: 26px; display: flex; gap: 8px; }
.actions button { padding: 7px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(10px); font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.actions button span { color: var(--gold); font-size: 15px; line-height: 1; }
.actions button:hover { border-color: var(--gold); color: var(--gold); }
.actions button.active { border-color: var(--gold); color: var(--gold); }

.moves { position: fixed; right: 22px; top: 78px; width: 190px; max-height: calc(100vh - 290px); overflow-y: auto; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--glass); backdrop-filter: blur(12px); }
.moves h3 { margin: 0 0 8px; font-family: Cinzel, serif; font-size: 12px; letter-spacing: .2em; color: var(--gold); font-weight: 500; }
.moves ol { margin: 0; padding-left: 26px; font-size: 13px; line-height: 1.75; color: var(--muted); font-variant-numeric: tabular-nums; }
.moves li span { display: inline-block; min-width: 58px; color: var(--ink); }
.moves:has(ol:empty) { width: 150px; padding: 12px 14px; }
.moves ol:empty::after { content: 'No moves yet'; display: block; padding: 5px 0 2px 0; color: var(--muted); font-size: 12px; font-style: italic; }

.banner { position: fixed; top: 34%; left: 50%; transform: translate(-50%, -50%) scale(.96); font-family: Cinzel, serif; font-size: clamp(28px, 5vw, 56px); letter-spacing: .12em; color: var(--gold); text-shadow: 0 0 30px rgba(154,100,30,.35), 0 2px 0 rgba(255,255,255,.7); opacity: 0; pointer-events: none; transition: opacity .4s, transform .6s; text-align: center; }
.banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.banner.red { color: #ff8a70; text-shadow: 0 0 30px rgba(226,87,63,.7), 0 2px 0 #000; }

.voice { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); width: min(620px, calc(100vw - 32px)); display: grid; gap: 10px; justify-items: center; }
.heard { min-height: 44px; max-width: 100%; padding: 10px 18px; border-radius: 14px; background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(12px); font-size: 15px; text-align: center; transition: border-color .3s; }
.heard:empty { display: none; }
.heard { position: relative; padding-right: 40px; }
.heard .x { position: absolute; top: 6px; right: 8px; width: 26px; height: 26px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 18px; line-height: 1; }
.heard .x:hover { background: var(--gold-soft); color: var(--gold); }
.heard .hint { color: var(--muted); font-size: 13px; }
.heard .q { color: var(--ink); }
.heard .lang { margin-left: 8px; font-size: 11px; padding: 2px 7px; border-radius: 6px; background: var(--gold-soft); color: var(--gold); vertical-align: 2px; }
.heard .res { display: block; margin-top: 3px; font-size: 13px; color: var(--gold); }
.heard .res.ignored { color: var(--muted); font-style: italic; }
.heard .res.unclear { color: #ffb4a3; }
.bar { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; }
.orb { position: relative; flex: none; width: 62px; height: 62px; border-radius: 50%; border: 1px solid var(--line); background: radial-gradient(circle at 35% 30%, #3a2f22, #120e14 70%); display: grid; place-items: center; transition: transform .2s, box-shadow .3s; }
.orb svg { width: 26px; height: 26px; fill: var(--muted); transition: fill .3s; }
.orb .ring { position: absolute; inset: -6px; border-radius: 50%; border: 2px solid var(--gold); opacity: 0; transform: scale(calc(1 + var(--lvl, 0) * .35)); transition: opacity .3s; }
.orb.on { box-shadow: 0 0 26px rgba(217,178,106,.45); border-color: var(--gold); }
.orb.on svg { fill: var(--gold); }
.orb.on .ring { opacity: .6; }
.orb.rec .ring { border-color: #ff9b6a; opacity: 1; }
.orb.think { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 40px rgba(217,178,106,.8); } }
#typed { position: relative; flex: 1; }
#typed input { width: 100%; padding: 14px 54px 14px 18px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass); backdrop-filter: blur(12px); color: var(--ink); font: inherit; font-size: 14px; outline: none; }
#typed input:focus { border-color: var(--gold); }
#inline-mic { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: var(--muted); }
#inline-mic svg { width: 20px; height: 20px; fill: currentColor; }
#inline-mic:hover, #inline-mic.on { color: var(--gold); background: var(--gold-soft); }
#inline-mic.rec { color: #ff9b6a; background: rgba(255,155,106,.14); }
.vstatus { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

@media (max-width: 720px) {
  .moves { display: none; }
  .brand { padding-left: 0; font-size: 15px; }
  .top { padding: 24px 16px 14px; gap: 10px; flex-wrap: wrap; }
  .actions button { padding: 6px 10px; font-size: 12px; }
}

.micgate { display: flex; align-items: center; gap: 16px; width: 100%; padding: 14px 16px 14px 20px; border-radius: 16px; border: 1px solid var(--gold); background: rgba(28, 22, 16, 0.86); backdrop-filter: blur(14px); box-shadow: 0 0 30px rgba(217,178,106,.18); }
.micgate[hidden] { display: none; }
.mg-text { flex: 1; display: grid; gap: 3px; font-size: 13px; color: var(--muted); }
.mg-text strong { font-family: Cinzel, serif; font-weight: 500; letter-spacing: .08em; color: var(--gold); font-size: 14px; }
.mg-btn { flex: none; padding: 11px 20px; border-radius: 999px; border: 0; background: var(--gold); color: #1a130b; font-weight: 600; font-size: 14px; }
.mg-btn:hover { filter: brightness(1.08); }
.turn.note { border-color: var(--gold); color: var(--gold); }
