:root {
  --bg: #0f1b2b; --panel: #17263a; --panel2: #1f3149; --text: #eef3f8; --muted: #9fb2c6;
  --accent: #3fa9f5; --accent2: #ffd45c; --good: #3ecf8e; --bad: #ff6b6b; --track: #2a3d55;
  --me: #2f7dd1; --npc: #ffffff; --npcText: #1b2430;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; }
input { font: inherit; }
#app { max-width: 560px; margin: 0 auto; min-height: 100%; }
body[data-mock="1"]::after { content: "modo simulado (sem IA)"; position: fixed; bottom: 4px; left: 4px; font-size: 11px; color: #ffb347; opacity: .8; pointer-events: none; }

/* ---------- páginas de menu ---------- */
.page { padding: 24px 16px 40px; display: flex; flex-direction: column; gap: 12px; }
.logo { font-size: 34px; font-weight: 900; letter-spacing: 2px; text-align: center; margin: 18px 0 4px; }
.logo span { color: var(--accent); }
.logo.small { font-size: 24px; margin-top: 4px; }
.agent { text-align: center; color: var(--muted); }
h2 { margin: 12px 0 0; font-size: 22px; }
h2 small { color: var(--muted); font-weight: 400; }
h3 { margin: 16px 0 0; font-size: 17px; color: var(--accent2); }
.lead { color: #d6e2ee; margin: 0; }
.small, small { color: var(--muted); font-size: 13px; }
label { font-weight: 600; margin-top: 8px; }
.page input { width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid #33496a; background: var(--panel); color: var(--text); }
.primary { background: var(--accent); color: #04121f; font-weight: 800; padding: 15px; border-radius: 14px; font-size: 17px; margin-top: 8px; }
.ghost { background: transparent; border: 1px solid #36506f; padding: 12px; border-radius: 12px; color: var(--text); }
.ghost.tiny { align-self: flex-start; padding: 4px 10px; font-size: 13px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.row > * { flex: 1 1 140px; }
.mission { text-align: left; background: var(--panel); border-radius: 16px; padding: 16px; border-left: 5px solid var(--accent); }
.mission .mt { font-weight: 800; font-size: 17px; }
.mission .ms { color: var(--muted); font-size: 14px; }
.mission .mb { margin-top: 6px; font-size: 14px; color: var(--accent2); }
.mission.locked { opacity: .5; border-left-color: #556; cursor: default; }
.agerow { display: flex; gap: 8px; }
.agerow input { flex: 1; }
.heard { min-height: 20px; color: var(--muted); font-size: 14px; }
.portrait.big { width: 130px; height: 143px; margin: 0 auto; background: var(--panel2); border-radius: 50%; overflow: hidden; }
.portrait.big svg { width: 100%; height: 100%; }
.stamp { align-self: flex-start; border: 2px solid var(--bad); color: var(--bad); font-weight: 900; letter-spacing: 3px; padding: 2px 10px; transform: rotate(-3deg); font-size: 13px; }
.objlist { margin: 0; padding-left: 22px; color: #d6e2ee; }
.objlist li { margin: 4px 0; }
.prevscore { background: var(--panel); padding: 10px 12px; border-radius: 12px; font-size: 14px; }
.loading { align-items: center; justify-content: center; min-height: 80vh; }
.spinner { width: 48px; height: 48px; border: 5px solid var(--track); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- conversa ---------- */
.play #c { height: 100dvh; }
.convo { display: flex; flex-direction: column; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--panel); }
.topbar .icon { background: transparent; font-size: 22px; width: 36px; }
.topbar .ttl { flex: 1; font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .counter { color: var(--accent2); font-weight: 700; }
.stage { position: relative; height: 30vh; min-height: 150px; max-height: 240px; overflow: hidden; flex: none; }
.scene, .scene svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.scene.fade { animation: fade .6s ease; }
@keyframes fade { from { opacity: .2; } to { opacity: 1; } }
.stage .portrait { position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); width: 42%; max-width: 190px; aspect-ratio: 200/220; filter: drop-shadow(0 4px 8px rgba(0,0,0,.35)); }
.stage .portrait svg { width: 100%; height: 100%; }
.stage .tag { position: absolute; left: 10px; bottom: 10px; background: rgba(0,0,0,.55); padding: 2px 10px; border-radius: 10px; font-size: 13px; font-weight: 700; }
.objectives { background: var(--panel2); padding: 6px 12px; font-size: 14px; flex: none; }
.objectives summary { cursor: pointer; font-weight: 700; color: var(--accent2); }
.objectives ul { list-style: none; margin: 4px 0 2px; padding: 0; max-height: 18vh; overflow: auto; }
.objectives li { display: flex; align-items: flex-start; gap: 6px; flex-wrap: wrap; padding: 2px 0; color: #d6e2ee; }
.objectives .chk { width: 16px; height: 16px; border: 2px solid var(--muted); border-radius: 4px; flex: none; margin-top: 2px; }
.objectives li.ok .chk { background: var(--good); border-color: var(--good); }
.objectives li.ok .en { text-decoration: line-through; color: var(--muted); }
.objectives li.flash { animation: flash 1s ease; }
@keyframes flash { 0% { background: rgba(62,207,142,.45); } 100% { background: transparent; } }
.objectives .en { flex: 1; }
.objectives .pt { background: var(--track); border-radius: 50%; width: 20px; height: 20px; font-size: 12px; line-height: 20px; padding: 0; flex: none; }
.objectives .ptx { flex-basis: 100%; padding-left: 22px; color: var(--accent2); font-size: 13px; }
.log { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.bubble { max-width: 84%; padding: 9px 12px; border-radius: 16px; display: flex; gap: 6px; align-items: flex-end; }
.bubble.npc { align-self: flex-start; background: var(--npc); color: var(--npcText); border-bottom-left-radius: 4px; }
.bubble.me { align-self: flex-end; background: var(--me); border-bottom-right-radius: 4px; }
.bubble.me.fix span { text-decoration: underline wavy rgba(255,212,92,.8); text-underline-offset: 4px; }
.bubble .say { background: transparent; padding: 0; font-size: 14px; opacity: .6; }
.bubble i { font-style: normal; font-size: 12px; opacity: .7; }
.typing, .note { align-self: center; color: var(--muted); font-size: 13px; font-style: italic; text-align: center; }
.typing::after { content: " ●●●"; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }
.helpcard { background: #2a2a12; border: 1px solid #6b5f1f; border-radius: 14px; padding: 10px 12px; font-size: 14px; }
.helpcard .h { font-weight: 800; color: var(--accent2); }
.helpcard .tr { margin: 4px 0; }
.helpcard .sg { color: var(--muted); font-size: 13px; }
.helpcard .sugg { display: block; width: 100%; text-align: left; background: rgba(255,255,255,.08); padding: 6px 10px; border-radius: 10px; margin-top: 4px; }
.helpcard .tip { color: var(--accent2); margin-top: 6px; font-size: 13px; }
.composer { background: var(--panel); padding: 8px 10px calc(10px + env(safe-area-inset-bottom)); flex: none; display: flex; flex-direction: column; gap: 8px; }
.tools { display: flex; gap: 6px; }
.tool { background: var(--panel2); padding: 6px 10px; border-radius: 10px; font-size: 14px; }
.tools .kbd { margin-left: auto; }
.inputrow { display: none; gap: 6px; }
.inputrow.show { display: flex; }
.inputrow .text { flex: 1; padding: 10px 12px; border-radius: 12px; border: 1px solid #33496a; background: var(--bg); color: var(--text); min-width: 0; }
.send { background: var(--accent); color: #04121f; width: 46px; border-radius: 12px; font-size: 18px; }
.send:disabled { opacity: .35; }
.send.pulse:not(:disabled) { animation: pulse 1s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(63,169,245,.35); } }
.mic { background: var(--good); color: #052016; font-weight: 800; padding: 16px; border-radius: 18px; font-size: 17px; display: flex; align-items: center; justify-content: center; gap: 10px; user-select: none; touch-action: none; }
.mic .dot { width: 14px; height: 14px; border-radius: 50%; background: #052016; }
.mic.on { background: var(--bad); color: #fff; }
.mic.on .dot { background: #fff; animation: blink .8s infinite; }
.mic.small { padding: 10px 14px; font-size: 15px; }
.busy .mic { opacity: .5; }
.nomic { margin: 0; font-size: 13px; color: var(--accent2); text-align: center; }
.card-in { align-self: stretch; display: flex; flex-direction: column; }

.bubble .b { display: flex; flex-direction: column; gap: 3px; }
.bubble .bt { display: flex; flex-direction: column; gap: 2px; }
.bubble .ptx { font-size: 13px; color: #5a6a7d; font-style: italic; }
.bubble .ptb, .objectives .pt, .introlist .ptb { font-size: 11px; font-weight: 800; padding: 1px 5px; border-radius: 6px; background: #e3ebf3; color: #3a5068; }
.objectives .pt { width: auto; height: auto; line-height: normal; border-radius: 6px; }
.helpcard .sugg small { display: block; color: var(--muted); font-size: 12px; }
.notice { background: rgba(255,212,92,.12); border: 1px solid rgba(255,212,92,.4); border-radius: 12px; padding: 10px 12px; margin: 0; font-size: 14px; }
.seg { display: flex; gap: 8px; }
.seg button { flex: 1; padding: 12px; border-radius: 12px; background: var(--panel); border: 2px solid #33496a; }
.seg button.sel { border-color: var(--accent); background: var(--panel2); font-weight: 700; }
.levels { display: flex; gap: 6px; }
.lv { flex: 1; background: var(--panel); border: 2px solid #33496a; border-radius: 12px; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; font-size: 14px; }
.lv.sel { border-color: var(--accent); background: var(--panel2); }
.lv:disabled { opacity: .45; cursor: default; }
.introlist { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 8px; }
.introlist li { background: var(--panel); border-radius: 12px; padding: 8px 10px; }
.introlist .en { font-weight: 600; }
.introlist .ptx { color: var(--accent2); font-size: 14px; margin-top: 2px; }
.charcard { display: flex; align-items: center; gap: 12px; background: var(--panel); border-radius: 14px; padding: 8px 12px; }
.portrait.mini { width: 56px; height: 62px; background: var(--panel2); border-radius: 50%; overflow: hidden; flex: none; }
.portrait.mini svg { width: 100%; height: 100%; }
.toast { position: fixed; left: 16px; right: 16px; bottom: 16px; max-width: 528px; margin: 0 auto; background: #3a2a10; border: 1px solid #a07a2a; color: #ffe2a8; padding: 12px 14px; border-radius: 14px; font-size: 14px; z-index: 10; }

/* ---------- tradução palavra por palavra ---------- */
.w { cursor: pointer; border-radius: 4px; }
.w:hover, .w.sel { background: rgba(63,169,245,.25); }
.bubble.npc .w:hover, .bubble.npc .w.sel { background: #d6eaff; }
.wtip, .wcard { position: fixed; z-index: 20; background: #fff; color: #1b2430; border-radius: 10px; box-shadow: 0 6px 20px rgba(0,0,0,.35); }
.wtip { padding: 4px 10px; font-size: 14px; pointer-events: none; max-width: 240px; }
.wcard { padding: 10px 12px; min-width: 170px; max-width: 260px; font-size: 14px; }
.wcard .wh { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.wcard .ww { font-weight: 800; font-size: 17px; }
.wcard .wsay { background: #e3ebf3; border-radius: 8px; padding: 2px 8px; }
.wcard .wm { color: #6a7a8c; font-size: 12px; margin: 2px 0 4px; }
.wcard ul { margin: 0; padding-left: 18px; }
.wcard li { margin: 2px 0; }
.wcard li small { color: #2f7dd1; font-size: 11px; }
.wtip .ld, .wcard .ld { color: #6a7a8c; }

/* ---------- relatório ---------- */
.score { width: 170px; height: 170px; border-radius: 50%; margin: 8px auto 0; display: grid; place-items: center; }
.score > div { width: 140px; height: 140px; border-radius: 50%; background: var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score b { font-size: 44px; }
.cmp { text-align: center; font-size: 15px; }
.up { color: var(--good); font-weight: 800; } .down { color: var(--bad); font-weight: 700; }
.perfect { text-align: center; color: var(--accent2); font-weight: 800; font-size: 18px; }
.crit { display: flex; flex-direction: column; gap: 6px; background: var(--panel); border-radius: 14px; padding: 12px; }
.crit .c { display: grid; grid-template-columns: 120px 1fr 34px; align-items: center; gap: 8px; font-size: 14px; }
.crit .bar { height: 9px; background: var(--track); border-radius: 5px; overflow: hidden; }
.crit .bar i { display: block; height: 100%; background: var(--accent); }
.crit b { text-align: right; }
.pen { font-size: 13px; color: var(--muted); text-align: center; }
.box.good { background: rgba(62,207,142,.12); border-radius: 14px; padding: 4px 12px; }
.box.good h3 { color: var(--good); margin-top: 8px; }
.box ul { margin: 6px 0 10px; padding-left: 20px; }
.review { display: flex; flex-direction: column; gap: 8px; }
.ritem { background: var(--panel); border-radius: 14px; padding: 10px 12px; border-left: 4px solid var(--accent2); }
.ritem.okd { border-left-color: var(--good); }
.ritem .said { color: var(--bad); text-decoration: line-through; font-size: 14px; }
.ritem .better { font-weight: 700; margin: 2px 0; }
.ritem .tip { color: var(--muted); font-size: 13px; }
.ract { display: flex; gap: 6px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.ract .tool.on { background: var(--bad); }
.ract .res { font-size: 14px; }
.vocab { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.vocab li { background: var(--panel); padding: 8px 12px; border-radius: 10px; }
