/* Protótipo de conversa com NPC. Direção: laca escura, ouro envelhecido, jade e papel.
   Sem fontes ou imagens externas. */
:root {
  --ink-950: #070d0f;
  --ink-900: #0a1315;
  --ink-800: #0f1c20;
  --ink-700: #16292e;
  --gold: #c9a35c;
  --gold-soft: #e6cf9a;
  --jade: #8fe0c8;
  --jade-deep: #2f6f6a;
  --paper: #efe7d4;
  --paper-dim: #b3ae9c;
  --vermilion: #c8523a;
  --vermilion-soft: #e79a84;
  --display: "Palatino Linotype", "Book Antiqua", Palatino, "Iowan Old Style", "Noto Serif", Georgia, serif;
  --ui: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", sans-serif;
  --panel-w: clamp(440px, 38vw, 620px);
  --ease: cubic-bezier(.2, .8, .2, 1);
}
@media (max-width: 1280px) { :root { --panel-w: clamp(380px, 44vw, 540px); } }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--ink-950);
  color: var(--paper);
  font-family: var(--ui);
  font-size: 14px;
  line-height: 1.45;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; }
h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.sr-defs { position: absolute; }
:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 2px; }

.app { position: fixed; inset: 0; overflow: hidden; }

/* ───────────── cena ───────────── */
.stage { position: absolute; inset: 0; cursor: pointer; touch-action: none; user-select: none; opacity: 0; transition: opacity .8s ease; }
.is-ready .stage { opacity: 1; }
.stage.is-locked { cursor: default; }
#scene, #motes { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#motes { pointer-events: none; }
.vignette {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(4, 9, 11, .55) 100%),
    linear-gradient(180deg, rgba(4, 9, 11, .35), transparent 22%);
}

.star.twinkle { animation: twinkle 4.5s ease-in-out infinite; }
.mist { animation: drift 70s ease-in-out infinite alternate; }
.mist-1 { animation-duration: 95s; animation-direction: alternate-reverse; }
.mist-2 { animation-duration: 120s; }
.isle { animation: bob 10s ease-in-out infinite; }
.cranes { animation: glide 46s linear infinite; }
.flicker, #lantern-glow { animation: flicker 3.4s ease-in-out infinite; }
#lantern-glow { transform-box: fill-box; transform-origin: center; transition: transform 1.8s var(--ease); }
#terrace-glow { opacity: 0; transition: opacity 1.8s ease; }
#door-rays { opacity: 0; transition: opacity 2s ease .4s; }
#door .leaf { transform-box: fill-box; transition: transform 2s var(--ease); }
.leaf-l { transform-origin: 0 50%; }
.leaf-r { transform-origin: 100% 50%; }
#bell { transform-box: fill-box; transform-origin: 50% 0; }
.sprite-body { animation: breathe 3.8s ease-in-out infinite; }
#sp-npc .sprite-body { animation-duration: 4.6s; }
.leg { transform-box: fill-box; transform-origin: 50% 0; }
.walking .leg-a { animation: stride .44s ease-in-out infinite alternate; }
.walking .leg-b { animation: stride .44s ease-in-out infinite alternate-reverse; }
.walking .sprite-body { animation: walkbob .44s ease-in-out infinite; }

.cue-lantern-bright #terrace-glow { opacity: .6; }
.cue-lantern-bright #lantern-glow { transform: scale(1.9); }
.cue-lantern-flare #terrace-glow { animation: flare 2s ease-out; }
.cue-lantern-flare #lantern-body { animation: jolt .16s linear 8; }
.cue-bell #bell { animation: bell 2s ease-in-out; }
.cue-pavilion-open .leaf { transform: scaleX(.1); }
.cue-pavilion-open #door-rays { opacity: .34; }

@keyframes twinkle { 50% { opacity: .15; } }
@keyframes drift { to { transform: translateX(140px); } }
@keyframes bob { 50% { transform: translateY(-9px); } }
@keyframes glide { from { transform: translateX(-60px); } to { transform: translateX(260px); } }
@keyframes flicker { 0%, 100% { opacity: .78; } 40% { opacity: .95; } 55% { opacity: .7; } 70% { opacity: .9; } }
@keyframes breathe { 50% { transform: translateY(-2.4px); } }
@keyframes walkbob { 50% { transform: translateY(-3.5px); } }
@keyframes stride { from { transform: rotate(-22deg); } to { transform: rotate(22deg); } }
@keyframes flare { 0% { opacity: 0; } 10% { opacity: 1; } 28% { opacity: .2; } 40% { opacity: .85; } 100% { opacity: 0; } }
@keyframes jolt { 50% { transform: translateX(3px); } }
@keyframes bell { 0%, 100% { transform: rotate(0); } 15% { transform: rotate(7deg); } 35% { transform: rotate(-6deg); } 55% { transform: rotate(4deg); } 75% { transform: rotate(-2deg); } }

/* placa do NPC e área clicável */
.nameplate {
  position: absolute; top: 0; left: 0; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-align: center; white-space: nowrap;
  text-shadow: 0 1px 2px #000, 0 0 12px rgba(4, 9, 11, .9);
}
.np-name { font-family: var(--display); font-size: 16px; letter-spacing: .02em; color: var(--paper); }
.np-role { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-soft); }
.np-prompt {
  display: inline-flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 5px 12px 5px 6px;
  font-size: 12.5px; letter-spacing: .06em; color: var(--paper); text-shadow: none;
  background: rgba(10, 19, 21, .82); border: 1px solid rgba(201, 163, 92, .6); border-radius: 999px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .5), 0 0 18px rgba(201, 163, 92, .22);
  opacity: 0; transform: translateY(6px); transition: opacity .25s ease, transform .25s var(--ease);
}
.np-prompt kbd {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  font: 600 12px var(--ui); color: var(--ink-900); background: linear-gradient(180deg, #f1dca6, var(--gold));
}
.stage.in-range:not(.has-panel) .np-prompt { opacity: 1; transform: none; animation: hover 2.4s ease-in-out infinite; }
.np-bubble {
  display: inline-flex; gap: 4px; margin-bottom: 8px; padding: 8px 11px; border-radius: 12px 12px 12px 2px;
  background: rgba(239, 231, 212, .94); box-shadow: 0 6px 16px rgba(0, 0, 0, .45);
  opacity: 0; transform: scale(.7); transform-origin: 20% 100%; transition: opacity .2s ease, transform .25s var(--ease);
  position: absolute; bottom: 100%;
}
.np-bubble i { width: 5px; height: 5px; border-radius: 50%; background: var(--ink-700); animation: dot 1.1s ease-in-out infinite; }
.np-bubble i:nth-child(2) { animation-delay: .15s; }
.np-bubble i:nth-child(3) { animation-delay: .3s; }
.nameplate.is-speaking .np-bubble { opacity: 1; transform: none; }
.npc-hit {
  position: absolute; top: 0; left: 0; padding: 0; border: 0; border-radius: 18px;
  background: transparent; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.npc-hit:focus-visible {
  outline: 1.5px dashed var(--gold-soft); outline-offset: 2px;
  background: radial-gradient(60% 14% at 50% 94%, rgba(230, 207, 154, .35), transparent 70%);
}
.stage.is-locked .npc-hit { cursor: default; }
@keyframes hover { 50% { transform: translateY(-4px); } }
@keyframes dot { 0%, 60%, 100% { opacity: .25; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* ───────────── HUD ───────────── */
.hud { position: absolute; top: 18px; left: 18px; display: flex; flex-direction: column; gap: 14px; max-width: min(340px, 62vw); pointer-events: none; }
.plaque {
  padding: 9px 44px 10px 16px; border-left: 2px solid var(--gold);
  background: linear-gradient(90deg, rgba(8, 15, 17, .78), rgba(8, 15, 17, .35) 70%, transparent);
}
.plaque-kicker { font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-soft); }
.plaque-title { font-family: var(--display); font-weight: 400; font-size: 23px; letter-spacing: .01em; text-shadow: 0 2px 10px rgba(0, 0, 0, .7); text-wrap: balance; }
.tracker { padding: 10px 14px 12px 16px; border-left: 2px solid var(--jade-deep); background: linear-gradient(90deg, rgba(8, 15, 17, .86), rgba(8, 15, 17, .72) 78%, rgba(8, 15, 17, .2)); animation: rise .5s var(--ease); }
.tracker-head { font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--jade); margin-bottom: 6px; }
.tracker li { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; padding: 4px 0; }
.tracker li + li { border-top: 1px solid rgba(239, 231, 212, .1); margin-top: 4px; padding-top: 8px; }
.q-title { font-family: var(--display); font-size: 16px; }
.q-state { font-size: 10.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--jade); align-self: center; }
.q-obj { grid-column: 1 / -1; font-size: 12.5px; color: var(--paper-dim); }
.tracker .is-completed .q-title { color: var(--gold-soft); }
.tracker .is-completed .q-state { color: var(--gold-soft); }
.tracker .is-completed .q-obj { text-decoration: line-through; text-decoration-color: rgba(179, 174, 156, .5); }

.controls { position: absolute; top: 18px; right: 18px; display: flex; gap: 8px; align-items: center; transition: right .5s var(--ease); z-index: 6; }
.lang { display: flex; padding: 3px; border-radius: 999px; background: rgba(8, 15, 17, .72); border: 1px solid rgba(201, 163, 92, .35); backdrop-filter: blur(6px); }
.lang button { min-width: 38px; height: 28px; padding: 0 10px; border: 0; border-radius: 999px; background: transparent; font-size: 12px; font-weight: 600; letter-spacing: .08em; color: var(--paper-dim); cursor: pointer; }
.lang button[aria-pressed="true"] { background: linear-gradient(180deg, #f1dca6, var(--gold)); color: var(--ink-900); }
.pill { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 14px 0 11px; border-radius: 999px; background: rgba(8, 15, 17, .72); border: 1px solid rgba(201, 163, 92, .35); backdrop-filter: blur(6px); font-size: 12.5px; letter-spacing: .04em; cursor: pointer; }
.pill svg { width: 15px; height: 15px; color: var(--gold-soft); }
.pill:hover, .pill[aria-expanded="true"] { border-color: var(--gold); }

.move-hint {
  position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); padding: 7px 16px; border-radius: 999px;
  font-size: 12.5px; letter-spacing: .03em; color: var(--paper); text-align: center; max-width: calc(100vw - 32px);
  background: rgba(8, 15, 17, .7); border: 1px solid rgba(239, 231, 212, .14); pointer-events: none; transition: opacity .6s ease;
}
.move-hint.is-gone { opacity: 0; }

/* bancada de simulação */
.sim {
  position: absolute; top: 64px; right: 18px; width: min(320px, calc(100vw - 36px)); max-height: calc(100dvh - 82px); overflow: auto;
  padding: 16px; border-radius: 12px; z-index: 6;
  background: rgba(9, 17, 19, .94); border: 1px solid rgba(201, 163, 92, .35); box-shadow: 0 20px 50px rgba(0, 0, 0, .55);
  backdrop-filter: blur(10px); transition: right .5s var(--ease); animation: rise .25s var(--ease);
}
.sim h2 { font-family: var(--display); font-weight: 400; font-size: 18px; }
.sim-note { font-size: 12px; color: var(--paper-dim); margin-top: 2px; }
.sim h3 { margin: 14px 0 6px; font-size: 10.5px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--gold-soft); }
.sim-quest { display: grid; gap: 4px; margin-bottom: 8px; }
.sim-quest-name { font-size: 13px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid rgba(239, 231, 212, .16); border-radius: 8px; overflow: hidden; }
.seg button { padding: 6px 4px; border: 0; background: transparent; font-size: 11.5px; color: var(--paper-dim); cursor: pointer; }
.seg button + button { border-left: 1px solid rgba(239, 231, 212, .16); }
.seg button[aria-pressed="true"] { background: rgba(143, 224, 200, .16); color: var(--jade); }
.seg button:focus-visible { outline-offset: -2px; }
.check { display: flex; align-items: center; gap: 8px; padding: 4px 0; font-size: 13px; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--gold); margin: 0; }
.sim-btn { margin-top: 6px; padding: 7px 12px; border-radius: 8px; border: 1px solid rgba(201, 163, 92, .45); background: rgba(201, 163, 92, .08); font-size: 12.5px; cursor: pointer; }
.sim-btn:hover:not(:disabled) { background: rgba(201, 163, 92, .18); }
.sim-btn:disabled { opacity: .4; cursor: not-allowed; }
.sim-log { font: 11.5px/1.5 ui-monospace, "Cascadia Mono", Consolas, monospace; color: var(--paper-dim); }
.sim-log li { padding: 2px 0; overflow-wrap: anywhere; }
.sim-log .is-empty { font-family: var(--ui); font-style: italic; }
.sim-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(239, 231, 212, .1); }
.sim-foot .sim-btn { margin: 0; flex: none; }
.sim-valid { font-size: 11.5px; color: var(--jade); }
.sim-valid.is-bad { color: var(--vermilion-soft); }

/* ───────────── painel de conversa ───────────── */
.dialogue {
  position: absolute; top: 0; right: 0; bottom: 0; width: var(--panel-w); z-index: 5;
  display: flex; flex-direction: column;
  background:
    radial-gradient(90% 40% at 100% 0%, rgba(143, 224, 200, .1), transparent 70%),
    radial-gradient(70% 30% at 0% 100%, rgba(201, 163, 92, .07), transparent 70%),
    linear-gradient(180deg, #13262b 0%, #0d191c 50%, #091113 100%);
  border-left: 1px solid rgba(201, 163, 92, .6);
  box-shadow: -40px 0 90px rgba(3, 8, 10, .6), -1px 0 0 rgba(0, 0, 0, .6), inset 1px 0 0 rgba(255, 255, 255, .04);
  transform: translateX(104%); opacity: 0;
  transition: transform .52s var(--ease), opacity .3s ease;
}
.dialogue.is-open { transform: none; opacity: 1; }
.dialogue:focus { outline: none; }
.dialogue::before { content: ""; position: absolute; inset: 9px; border: 1px solid rgba(201, 163, 92, .16); pointer-events: none; }
.fret {
  position: absolute; width: 24px; height: 24px; pointer-events: none; opacity: .9;
  background: url("fret.svg") no-repeat;
}
.fret.tl { top: 9px; left: 9px; }
.fret.tr { top: 9px; right: 9px; transform: scaleX(-1); }
.fret.bl { bottom: 9px; left: 9px; transform: scaleY(-1); }
.fret.br { bottom: 9px; right: 9px; transform: scale(-1); }

.is-talking .controls, .is-talking .sim { right: calc(var(--panel-w) + 18px); }

.dlg-head { display: flex; align-items: center; gap: 20px; padding: 30px 30px 18px 32px; flex: none; }
.portrait {
  flex: none; width: 112px; aspect-ratio: 1; padding: 4px; border-radius: 50%;
  background: conic-gradient(from 210deg, #f3dfab, #86652f, #e6cf9a, #6a4f24, #f3dfab);
  box-shadow: 0 0 0 1px var(--ink-950), 0 0 0 3px rgba(201, 163, 92, .22), 0 12px 30px rgba(0, 0, 0, .55), 0 0 44px rgba(143, 224, 200, .16);
}
.portrait svg { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--ink-800); }
.portrait.is-loading svg { animation: pulse 1.2s ease-in-out infinite; }
.dlg-id { min-width: 0; flex: 1; }
.dlg-affil { font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-soft); margin-bottom: 3px; }
.dlg-name {
  font-family: var(--display); font-weight: 400; font-size: 29px; line-height: 1.12; letter-spacing: .005em; text-wrap: balance;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere;
}
.dlg-facts { margin-top: 8px; display: grid; gap: 3px; }
.dlg-facts li { position: relative; padding-left: 16px; font-size: 13.5px; color: var(--paper-dim); }
.dlg-facts li::before { content: ""; position: absolute; left: 2px; top: .52em; width: 6px; height: 6px; transform: rotate(45deg); background: var(--jade); }
.dlg-facts .fact-realm::before { background: var(--gold); }
.dlg-facts .skel { height: 12px; margin: 3px 0; width: 70%; padding: 0; border-radius: 4px; background: rgba(239, 231, 212, .1); animation: pulse 1.2s ease-in-out infinite; }
.dlg-facts .skel.short { width: 46%; }
.dlg-facts .skel::before { display: none; }
.dlg-close {
  align-self: flex-start; flex: none; display: grid; place-items: center; width: 34px; height: 34px; margin: -8px -8px 0 0; padding: 0;
  border-radius: 50%; border: 1px solid rgba(239, 231, 212, .16); background: rgba(239, 231, 212, .04); color: var(--paper-dim); cursor: pointer;
  transition: color .2s, border-color .2s, background .2s;
}
.dlg-close svg { width: 14px; height: 14px; }
.dlg-close:hover { color: var(--paper); border-color: var(--gold); background: rgba(201, 163, 92, .14); }

.dlg-rule { position: relative; flex: none; height: 1px; margin: 0 30px; background: linear-gradient(90deg, transparent, rgba(201, 163, 92, .65) 20%, rgba(201, 163, 92, .65) 80%, transparent); }
.dlg-rule i { position: absolute; left: 50%; top: 50%; width: 9px; height: 9px; transform: translate(-50%, -50%) rotate(45deg); background: #0f1d21; border: 1px solid var(--gold); }

.dlg-body { position: relative; flex: 1; min-height: 0; display: flex; }
.timeline {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px 30px 18px 32px;
  display: flex; flex-direction: column; gap: 12px;
  scrollbar-width: thin; scrollbar-color: rgba(201, 163, 92, .4) transparent;
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 22px); mask-image: linear-gradient(180deg, transparent 0, #000 22px);
}
.timeline:focus-visible { outline-offset: -6px; }
.entry { animation: rise .42s var(--ease) both; }
.entry .txt { overflow-wrap: anywhere; }

.e-npc { display: grid; grid-template-columns: 36px 1fr; gap: 10px; align-items: start; padding-right: 26px; }
.e-npc .avatar { width: 36px; height: 36px; border-radius: 50%; overflow: hidden; border: 1px solid rgba(201, 163, 92, .7); background: var(--ink-800); }
.e-npc .avatar svg { display: block; width: 100%; height: 100%; }
.e-npc .bubble {
  justify-self: start; padding: 10px 15px 11px; border-radius: 3px 14px 14px 14px;
  background: linear-gradient(180deg, rgba(239, 231, 212, .09), rgba(239, 231, 212, .045));
  border: 1px solid rgba(239, 231, 212, .1); border-left: 2px solid rgba(201, 163, 92, .8);
}
.e-npc .txt { font-family: var(--display); font-size: 17px; line-height: 1.5; color: var(--paper); }
.who { display: block; margin-bottom: 2px; font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-soft); }
.e-npc + .e-npc { margin-top: -5px; }
.e-npc + .e-npc .avatar { visibility: hidden; height: 0; }
.e-npc + .e-npc .who { display: none; }
.e-npc + .e-npc .bubble { border-top-left-radius: 14px; }

.e-player { display: flex; justify-content: flex-end; padding-left: 56px; }
.e-player .bubble {
  padding: 9px 15px 10px; border-radius: 14px 3px 14px 14px; text-align: left;
  background: linear-gradient(135deg, rgba(47, 111, 106, .62), rgba(47, 111, 106, .3));
  border: 1px solid rgba(143, 224, 200, .32); border-right: 2px solid rgba(143, 224, 200, .8);
}
.e-player .who { color: var(--jade); text-align: right; }
.e-player .txt { font-family: var(--display); font-size: 16.5px; line-height: 1.45; color: #e8f6f0; }

.e-narration, .e-end, .e-system { display: flex; align-items: center; gap: 14px; padding: 4px 6px; text-align: center; }
.e-narration::before, .e-narration::after, .e-end::before, .e-end::after { content: ""; flex: 1; min-width: 18px; height: 1px; background: linear-gradient(90deg, transparent, rgba(239, 231, 212, .24)); }
.e-narration::after, .e-end::after { transform: scaleX(-1); }
.e-narration .txt { max-width: 78%; font-family: var(--display); font-style: italic; font-size: 15px; line-height: 1.45; color: #cfc8b4; }
.e-end { margin-top: 6px; }
.e-end::before, .e-end::after { background: linear-gradient(90deg, transparent, rgba(200, 82, 58, .7)); }
.e-end .txt { max-width: 78%; font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--vermilion-soft); }
.e-system { justify-content: center; }
.e-system .txt { padding: 6px 12px; border-radius: 8px; font-size: 12.5px; color: var(--paper-dim); background: rgba(239, 231, 212, .05); border: 1px dashed rgba(239, 231, 212, .2); }

.e-consequence {
  display: flex; align-items: center; justify-content: center; gap: 12px; margin: 4px -30px 4px -32px; padding: 11px 30px;
  background: linear-gradient(90deg, transparent, rgba(201, 163, 92, .17) 22%, rgba(201, 163, 92, .17) 78%, transparent);
  border-block: 1px solid transparent; border-image: linear-gradient(90deg, transparent, rgba(201, 163, 92, .7) 25%, rgba(201, 163, 92, .7) 75%, transparent) 1;
  animation: rise .42s var(--ease) both, sheen 1.6s ease .2s both;
}
.e-consequence .seal { flex: none; position: relative; width: 22px; height: 22px; border-radius: 4px; background: var(--vermilion); transform: rotate(45deg); box-shadow: 0 0 14px rgba(200, 82, 58, .6); }
.e-consequence .seal::after { content: ""; position: absolute; left: 7px; top: 3.5px; width: 6px; height: 11px; border: solid #fff3e0; border-width: 0 2px 2px 0; }
.e-consequence .txt { display: grid; text-align: left; }
.e-consequence .lbl { font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold-soft); }
.e-consequence .val { font-family: var(--display); font-size: 18px; color: var(--paper); }

.e-opening { display: flex; justify-content: center; padding: 26px 0; }
.dots { display: inline-flex; gap: 5px; align-items: center; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--gold-soft); animation: dot 1.1s ease-in-out infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
.e-typing .bubble { padding: 14px 16px; }

.new-msg {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px 6px 14px; border-radius: 999px; border: 1px solid var(--gold); background: rgba(10, 19, 21, .95);
  font-size: 12px; letter-spacing: .04em; color: var(--gold-soft); cursor: pointer; box-shadow: 0 8px 20px rgba(0, 0, 0, .5); animation: rise .25s var(--ease);
}
.new-msg svg { width: 12px; height: 12px; }

.dlg-foot { flex: none; padding: 14px 24px 16px; border-top: 1px solid rgba(201, 163, 92, .22); background: linear-gradient(180deg, rgba(6, 12, 14, .5), rgba(6, 12, 14, .75)); }
.choices { display: grid; gap: 8px; max-height: min(300px, 38dvh); overflow: hidden auto; padding: 2px 6px 2px 2px; margin: -2px; scrollbar-width: thin; scrollbar-color: rgba(201, 163, 92, .4) transparent; }
.choice {
  display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: center; width: 100%; padding: 10px 14px 10px 12px; text-align: left;
  border-radius: 10px; border: 1px solid rgba(201, 163, 92, .3); background: rgba(239, 231, 212, .04); cursor: pointer;
  transition: background .18s, border-color .18s, transform .18s var(--ease), box-shadow .18s, opacity .25s;
  animation: slide-in .36s var(--ease) both;
}
.choice:nth-child(2) { animation-delay: .05s; }
.choice:nth-child(3) { animation-delay: .1s; }
.choice:nth-child(4) { animation-delay: .15s; }
.choice:nth-child(n+5) { animation-delay: .2s; }
.choice .num { display: grid; place-items: center; width: 22px; height: 22px; margin-left: 2px; transform: rotate(45deg); border: 1px solid rgba(201, 163, 92, .75); background: rgba(201, 163, 92, .1); transition: background .18s; }
.choice .num b { transform: rotate(-45deg); font: 600 11.5px var(--ui); color: var(--gold-soft); }
.choice .body { display: grid; gap: 2px; min-width: 0; }
.choice .txt { font-family: var(--display); font-size: 16.5px; line-height: 1.35; color: var(--paper); }
.choice:not([aria-disabled="true"]):hover, .choice:not([aria-disabled="true"]):focus-visible {
  border-color: var(--gold); background: rgba(201, 163, 92, .13); transform: translateX(3px); box-shadow: 0 0 22px rgba(201, 163, 92, .14);
}
.choice:not([aria-disabled="true"]):hover .num, .choice:not([aria-disabled="true"]):focus-visible .num { background: var(--gold); }
.choice:not([aria-disabled="true"]):hover .num b, .choice:not([aria-disabled="true"]):focus-visible .num b { color: var(--ink-900); }
.choice:focus-visible { outline-offset: 1px; }

.choice.is-locked { cursor: not-allowed; border-style: dashed; border-color: rgba(239, 231, 212, .18); background: transparent; }
.choice.is-locked .txt { color: #8f8b7d; }
.choice.is-locked .num { transform: none; border: 0; background: none; }
.choice.is-locked .num b { transform: none; width: 14px; height: 11px; margin-top: 7px; border-radius: 2px; background: #8f8b7d; position: relative; }
.choice.is-locked .num b::before { content: ""; position: absolute; left: 2.5px; top: -7px; width: 9px; height: 9px; border: 2px solid #8f8b7d; border-bottom: 0; border-radius: 5px 5px 0 0; box-sizing: border-box; }
.choice .reason { font-size: 12.5px; color: var(--vermilion-soft); }
.choice.shake { animation: shake .36s ease; }
.choice.is-dimmed { opacity: .38; cursor: default; }
.choice.is-chosen { border-color: var(--jade); background: rgba(143, 224, 200, .12); cursor: progress; }
.choice.is-chosen .num { border-color: var(--jade); background: var(--jade); animation: spin-fwd 1.6s linear infinite; }
.choice.is-chosen .num b { color: var(--ink-900); animation: spin-back 1.6s linear infinite; }
.choice.is-secondary { border-color: rgba(239, 231, 212, .18); }

.dlg-status { display: flex; align-items: center; gap: 10px; min-height: 24px; padding: 2px 4px 10px; font-size: 12.5px; letter-spacing: .04em; color: var(--paper-dim); }
.dlg-status:only-child, .choices:empty { margin: 0; }
.choices:empty { display: none; }
.dlg-error { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; padding: 10px 12px 10px 14px; border-radius: 10px; background: rgba(200, 82, 58, .14); border: 1px solid rgba(200, 82, 58, .55); animation: rise .3s var(--ease); }
.dlg-error p { flex: 1; font-size: 13px; color: #f4d5cb; }
.dlg-error button { flex: none; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--vermilion-soft); background: rgba(200, 82, 58, .25); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.dlg-error button:hover { background: rgba(200, 82, 58, .45); }
.keys { margin-top: 12px; text-align: center; font-size: 11.5px; letter-spacing: .05em; color: #7f7c70; }

@keyframes rise { from { opacity: 0; transform: translateY(9px); } }
@keyframes sheen { 0% { filter: brightness(1.9); } 100% { filter: none; } }
@keyframes pulse { 50% { opacity: .45; } }
@keyframes shake { 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(3px); } }
@keyframes slide-in { from { opacity: 0; transform: translateX(-10px); } }
@keyframes spin-fwd { from { transform: rotate(45deg); } to { transform: rotate(405deg); } }
@keyframes spin-back { from { transform: rotate(-45deg); } to { transform: rotate(-405deg); } }

/* ───────────── classe compacta (painel lateral estreito) ───────────── */
@media (max-width: 1280px) {
  .dlg-head { gap: 16px; padding: 26px 24px 16px 26px; }
  .portrait { width: 84px; }
  .dlg-name { font-size: 24px; }
  .dlg-rule { margin: 0 24px; }
  .timeline { padding: 20px 24px 16px 26px; }
  .e-consequence { margin-inline: -26px -24px; }
  .dlg-foot { padding: 12px 18px 14px; }
}

/* ───────────── tela estreita: painel vira faixa inferior ───────────── */
@media (max-width: 820px) {
  .dialogue {
    top: auto; left: 0; width: auto; height: min(64dvh, 620px);
    border-left: 0; border-top: 1px solid rgba(201, 163, 92, .6); border-radius: 18px 18px 0 0;
    box-shadow: 0 -30px 70px rgba(3, 8, 10, .6);
    transform: translateY(104%);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .dialogue::before, .fret { display: none; }
  .is-talking .controls, .is-talking .sim { right: 12px; }
  .is-talking .sim { max-height: calc(36dvh - 70px); }
  .hud { top: 12px; left: 12px; gap: 8px; max-width: calc(100vw - 214px); transition: opacity .3s ease; }
  .plaque-kicker { display: none; }
  /* Com a faixa aberta sobra pouco mundo: o painel já mostra quem fala e onde. */
  .is-talking .hud, .stage.has-panel .nameplate .np-name, .stage.has-panel .nameplate .np-role { opacity: 0; }
  .controls { top: 12px; right: 12px; }
  .sim { top: 56px; right: 12px; width: min(320px, calc(100vw - 24px)); }
  .plaque { padding: 7px 20px 8px 12px; }
  .plaque-title { font-size: 17px; }
  .dlg-head { gap: 14px; padding: 16px 16px 12px 18px; }
  .portrait { width: 60px; padding: 3px; }
  .dlg-affil { font-size: 10px; margin-bottom: 1px; }
  .dlg-name { font-size: 21px; -webkit-line-clamp: 1; }
  .dlg-facts { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 2px 14px; }
  .dlg-facts li { font-size: 12.5px; }
  .dlg-close { margin: -2px -2px 0 0; width: 40px; height: 40px; }
  .dlg-rule { margin: 0 16px; }
  .timeline { padding: 16px 16px 12px 18px; gap: 10px; }
  .e-npc { grid-template-columns: 30px 1fr; gap: 8px; padding-right: 10px; }
  .e-npc .avatar { width: 30px; height: 30px; }
  .e-npc .txt { font-size: 16px; }
  .e-player { padding-left: 34px; }
  .e-player .txt { font-size: 15.5px; }
  .e-consequence { margin-inline: -18px -16px; padding-inline: 16px; }
  .dlg-foot { padding: 10px 12px 12px; }
  .choices { max-height: 26dvh; gap: 6px; }
  .choice { padding: 9px 12px 9px 10px; min-height: 44px; }
  .choice .txt { font-size: 15.5px; }
  .keys, .np-prompt kbd { display: none; }
  .np-prompt { padding-left: 12px; }
  .move-hint { bottom: 14px; font-size: 12px; width: max-content; }
}
@media (hover: none) { .keys { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

[data-delay="0.0"] { animation-delay: 0.0s; }
[data-delay="0.1"] { animation-delay: 0.1s; }
[data-delay="0.2"] { animation-delay: 0.2s; }
[data-delay="0.3"] { animation-delay: 0.3s; }
[data-delay="0.4"] { animation-delay: 0.4s; }
[data-delay="0.5"] { animation-delay: 0.5s; }
[data-delay="0.6"] { animation-delay: 0.6s; }
[data-delay="0.7"] { animation-delay: 0.7s; }
[data-delay="0.8"] { animation-delay: 0.8s; }
[data-delay="0.9"] { animation-delay: 0.9s; }
[data-delay="1.0"] { animation-delay: 1.0s; }
[data-delay="1.1"] { animation-delay: 1.1s; }
[data-delay="1.2"] { animation-delay: 1.2s; }
[data-delay="1.3"] { animation-delay: 1.3s; }
[data-delay="1.4"] { animation-delay: 1.4s; }
[data-delay="1.5"] { animation-delay: 1.5s; }
[data-delay="1.6"] { animation-delay: 1.6s; }
[data-delay="1.7"] { animation-delay: 1.7s; }
[data-delay="1.8"] { animation-delay: 1.8s; }
[data-delay="1.9"] { animation-delay: 1.9s; }
[data-delay="2.0"] { animation-delay: 2.0s; }
[data-delay="2.1"] { animation-delay: 2.1s; }
[data-delay="2.2"] { animation-delay: 2.2s; }
[data-delay="2.3"] { animation-delay: 2.3s; }
[data-delay="2.4"] { animation-delay: 2.4s; }
[data-delay="2.5"] { animation-delay: 2.5s; }
[data-delay="2.6"] { animation-delay: 2.6s; }
[data-delay="2.7"] { animation-delay: 2.7s; }
[data-delay="2.8"] { animation-delay: 2.8s; }
[data-delay="2.9"] { animation-delay: 2.9s; }
[data-delay="3.0"] { animation-delay: 3.0s; }
[data-delay="3.1"] { animation-delay: 3.1s; }
[data-delay="3.2"] { animation-delay: 3.2s; }
[data-delay="3.3"] { animation-delay: 3.3s; }
[data-delay="3.4"] { animation-delay: 3.4s; }
[data-delay="3.5"] { animation-delay: 3.5s; }
[data-delay="3.6"] { animation-delay: 3.6s; }
[data-delay="3.7"] { animation-delay: 3.7s; }
[data-delay="3.8"] { animation-delay: 3.8s; }
[data-delay="3.9"] { animation-delay: 3.9s; }
[data-delay="4.0"] { animation-delay: 4.0s; }
[data-delay="4.1"] { animation-delay: 4.1s; }
[data-delay="4.2"] { animation-delay: 4.2s; }
[data-delay="4.3"] { animation-delay: 4.3s; }
[data-delay="4.4"] { animation-delay: 4.4s; }
[data-delay="4.5"] { animation-delay: 4.5s; }
[data-delay="4.6"] { animation-delay: 4.6s; }
[data-delay="4.7"] { animation-delay: 4.7s; }
[data-delay="4.8"] { animation-delay: 4.8s; }
[data-delay="4.9"] { animation-delay: 4.9s; }
[data-delay="5.0"] { animation-delay: 5.0s; }
.lab-nav{position:fixed;bottom:0;right:0;z-index:1000;background:#151719;color:#fff;padding:.2em .6em;font:12px sans-serif}.lab-nav a{color:#fff}