:root {
  --bg: #0f1117; --panel: #181b24; --panel2: #20242f; --line: #2b3040;
  --text: #e9ecf3; --muted: #8e96a8; --accent: #4f8cff; --accent2: #7c5cff;
  --ok: #2fbf71; --warn: #f0a33a; --bad: #ef5a5a; --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Color Emoji", sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.err { color: var(--bad); }
button { font: inherit; cursor: pointer; }
input, select { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; }
label { display: block; color: var(--muted); font-size: 14px; margin: 6px 0; }
label input, label select { margin-top: 4px; }
.chk { display: flex; gap: 8px; align-items: center; color: var(--text); }
.chk input { width: auto; margin: 0; }

.btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 12px; font-size: 14px; }

header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.brand { font-weight: 800; font-size: 20px; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.lang-select { margin-left: auto; width: auto; padding: 7px 10px; background: var(--panel); font-size: 15px; }
.timer { font-variant-numeric: tabular-nums; background: var(--panel); padding: 6px 10px; border-radius: 10px; cursor: pointer; user-select: none; }
.timer.running { color: var(--ok); }
nav { display: flex; gap: 4px; padding: 8px 12px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: none; }
nav button { background: none; border: 0; color: var(--muted); padding: 8px 12px; border-radius: 8px; white-space: nowrap; }
nav button.active { color: var(--text); background: var(--panel); }
main { max-width: 820px; margin: 0 auto; padding: 16px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.card h2 { margin: 0 0 8px; font-size: 18px; }
.card.warn { border-color: var(--warn); color: var(--warn); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin: 8px 0; }
.row > * { flex: 1 1 180px; }
.row > .btn { flex: 0 0 auto; }
.row.center { justify-content: center; }
.row.opts { align-items: center; }

.kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; }
.kpi span { display: block; font-size: 28px; font-weight: 700; }
.kpi label { margin: 0; font-size: 12px; }
.plan li { margin: 10px 0; }
.plan .btn { margin-left: 6px; }

/* conversa */
.chat { display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; white-space: pre-wrap; }
.msg.tutor { background: var(--panel2); align-self: flex-start; border-bottom-left-radius: 4px; }
.msg.me { background: #213a6b; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.interim { opacity: .6; font-style: italic; }
.msg .tools { margin-top: 6px; display: flex; gap: 6px; }
.msg .tools button { background: none; border: 1px solid var(--line); color: var(--muted); border-radius: 8px; font-size: 12px; padding: 2px 8px; }
.msg .pt { color: var(--muted); font-size: 14px; margin-top: 6px; }
.fb { align-self: flex-end; max-width: 88%; background: #1d2a22; border: 1px solid #285c3c; border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.fb .c { margin: 3px 0; }
.fb s { color: var(--bad); }
.fb b { color: var(--ok); }
.fb .why, .fb .pron { color: var(--muted); }
.fb .praise { color: var(--ok); }
.fb.error { background: #2d1c1c; border-color: #6b2c2c; color: var(--bad); }

.talk-bar { position: fixed; left: 0; right: 0; bottom: 0; background: linear-gradient(transparent, var(--bg) 20%); padding: 24px 16px calc(12px + env(safe-area-inset-bottom)); }
.talk-bar > * { max-width: 820px; margin-left: auto; margin-right: auto; }
.status { text-align: center; color: var(--muted); min-height: 24px; font-size: 14px; }
.talk-controls { display: flex; align-items: center; justify-content: center; gap: 22px; margin: 8px auto; }
.mic { width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--accent); position: relative; box-shadow: 0 6px 24px #4f8cff55; }
.mic span { position: absolute; inset: 0; margin: auto; width: 22px; height: 34px; border-radius: 11px; background: #fff; }
.mic::after { content: ""; position: absolute; left: 50%; bottom: 14px; width: 30px; height: 14px; transform: translateX(-50%); border: 3px solid #fff; border-top: 0; border-radius: 0 0 16px 16px; }
.mic.listening { background: var(--ok); animation: pulse 1.4s infinite; }
.mic.speaking { background: var(--accent2); }
.mic.thinking { background: var(--warn); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 #2fbf7188; } 70% { box-shadow: 0 0 0 22px #2fbf7100; } 100% { box-shadow: 0 0 0 0 #2fbf7100; } }
.type-form { display: flex; gap: 8px; }
#ptBtn.active { border-color: var(--ok); color: var(--ok); }

/* shadowing */
.sh-count { color: var(--muted); font-size: 13px; }
.sh-text { font-size: 24px; font-weight: 600; margin: 8px 0; }
.sh-text.blur { filter: blur(7px); }
.sh-tip { color: var(--warn); font-size: 14px; margin: 6px 0 10px; }
.sh-result { text-align: center; margin: 10px 0; font-size: 18px; }
.sh-result .score { font-size: 32px; font-weight: 800; display: block; }
.w-ok { color: var(--ok); } .w-miss { color: var(--bad); text-decoration: underline; }

/* revisão */
.rv-front { font-size: 26px; font-weight: 600; margin: 18px 0 6px; text-align: center; }
.rv-back { font-size: 24px; color: var(--ok); text-align: center; margin-top: 10px; font-weight: 600; }
#rvHeard { text-align: center; margin-top: 8px; }
.grades { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.grades button { border: 0; border-radius: 10px; padding: 12px 4px; color: #fff; font-weight: 600; }
.grades small { display: block; font-weight: 400; opacity: .8; font-size: 11px; }
.g1 { background: var(--bad); } .g2 { background: var(--warn); } .g3 { background: var(--ok); } .g4 { background: var(--accent); }
.grades .suggest { outline: 3px solid #fff; }

/* progresso */
.bars { display: flex; gap: 4px; align-items: flex-end; height: 120px; margin: 10px 0; }
.bars div { flex: 1; background: var(--accent); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars div span { position: absolute; bottom: -18px; left: 0; right: 0; text-align: center; font-size: 10px; color: var(--muted); }
.err-list { padding-left: 18px; }
.err-list li { margin: 6px 0; }

.prose h3 { margin: 18px 0 4px; font-size: 16px; color: var(--accent); }
.prose p, .prose li { color: #cfd5e2; }

.screen { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-box { width: 100%; max-width: 360px; text-align: center; }
.login-box h1 { font-size: 40px; margin: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.login-box form { display: grid; gap: 10px; margin-top: 18px; }

@media (max-width: 600px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  header { flex-wrap: wrap; }
  .brand { font-size: 18px; }
  .msg, .fb { max-width: 95%; }
}

/* ---------- professores ---------- */
.tutor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; margin-bottom: 14px; }
.tutor { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 6px; }
.tutor .face { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-size: 28px; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.tutor h3 { margin: 6px 0 0; }
.tutor .btn { margin-top: auto; }
.settings summary { cursor: pointer; font-weight: 600; }
.next-lesson:empty { display: none; }
.next-lesson { border-color: var(--accent); }

/* ---------- trilha ---------- */
.level-title { margin: 18px 4px 8px; font-weight: 700; color: var(--muted); }
.lesson { display: flex; align-items: center; gap: 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 8px; cursor: pointer; }
.lesson:hover { border-color: var(--accent); }
.lesson .num { width: 34px; height: 34px; border-radius: 50%; background: var(--panel2); display: grid; place-items: center; font-size: 13px; flex: none; }
.lesson.done .num { background: var(--ok); color: #fff; }
.lesson .info { flex: 1; }
.lesson .sc { font-weight: 700; color: var(--ok); }

/* ---------- chamada ---------- */
.call { position: fixed; inset: 0; z-index: 50; background: radial-gradient(ellipse at 50% 30%, #2a3350 0%, #12151f 60%, #0b0d13 100%); display: flex; flex-direction: column; }
.avatar { position: absolute; inset: 0 0 170px 0; }
@media (orientation: landscape) { .avatar { inset: 0 0 60px 0; } }
.avatar-fallback { position: absolute; inset: 0; display: grid; place-items: center; }
.avatar-fallback .ring { width: 160px; height: 160px; border-radius: 50%; display: grid; place-items: center; font-size: 64px; font-weight: 800; background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.avatar-fallback.speaking .ring { animation: pulse2 1s infinite; }
@keyframes pulse2 { 0% { box-shadow: 0 0 0 0 #7c5cff99; } 70% { box-shadow: 0 0 0 30px #7c5cff00; } 100% { box-shadow: 0 0 0 0 #7c5cff00; } }
.call-loading { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--muted); background: #0b0d13cc; z-index: 3; }
.spinner { width: 42px; height: 42px; border: 4px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.call-top { position: relative; z-index: 2; display: flex; justify-content: space-between; align-items: flex-start; padding: calc(12px + env(safe-area-inset-top)) 16px 12px; background: linear-gradient(#0b0d13cc, transparent); }
.call-top-right { display: flex; gap: 8px; align-items: center; }
.call-clock { font-variant-numeric: tabular-nums; color: var(--muted); }
.icon-btn { background: #ffffff14; color: var(--text); border: 1px solid #ffffff22; border-radius: 10px; padding: 6px 10px; font-size: 14px; }
.icon-btn.active { background: var(--accent); border-color: var(--accent); }
.toasts { position: absolute; z-index: 2; top: 76px; right: 12px; width: min(340px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast { background: #10241acc; border: 1px solid #2f7a4f; backdrop-filter: blur(6px); border-radius: 12px; padding: 8px 12px; font-size: 14px; animation: slidein .3s ease; pointer-events: auto; }
.toast.err { background: #2d1c1ccc; border-color: #6b2c2c; color: var(--bad); }
.toast s { color: var(--bad); } .toast b { color: var(--ok); } .toast .why { color: #c3cad8; }
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.call-bottom { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; padding: 40px 16px calc(14px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, #0b0d13ee 35%); }
.call-bottom > * { max-width: 720px; margin-left: auto; margin-right: auto; }
.subtitle { text-align: center; font-size: 20px; font-weight: 600; min-height: 30px; text-shadow: 0 2px 8px #000; }
.subtitle.off { visibility: hidden; }
.my-line { text-align: center; color: #9fc0ff; min-height: 22px; font-style: italic; }
.round-btn { width: 54px; height: 54px; border-radius: 50%; border: 1px solid #ffffff2a; background: #ffffff14; color: #fff; font-size: 22px; }
.round-btn.end { background: var(--bad); border-color: var(--bad); }
.round-btn.active { background: var(--ok); }
.transcript { position: absolute; z-index: 4; top: 0; right: 0; bottom: 0; width: min(420px, 100%); background: var(--bg); border-left: 1px solid var(--line); display: flex; flex-direction: column; }
.tr-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.transcript .chat { padding: 12px; overflow-y: auto; flex: 1; min-height: 0; }

/* ---------- relatório ---------- */
.modal { position: fixed; inset: 0; z-index: 60; background: #000a; display: grid; place-items: center; padding: 16px; }
.modal-box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; width: min(560px, 100%); max-height: 90vh; overflow-y: auto; }
.big-score { font-size: 54px; font-weight: 800; text-align: center; line-height: 1; }
.score-bars { display: grid; gap: 8px; margin: 16px 0; }
.score-bars .sb { display: grid; grid-template-columns: 100px 1fr 40px; gap: 8px; align-items: center; font-size: 14px; }
.score-bars .track { height: 8px; background: var(--panel2); border-radius: 4px; overflow: hidden; }
.score-bars .fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.modal-box h3 { margin: 16px 0 6px; font-size: 15px; color: var(--accent); }
.modal-box ul { margin: 0; padding-left: 18px; }
.report-list { padding-left: 0; list-style: none; }
.report-list li { padding: 8px 0; border-bottom: 1px solid var(--line); cursor: pointer; }

.lvl { width: 140px; height: 6px; margin: 6px auto 0; background: #ffffff1a; border-radius: 3px; overflow: hidden; }
.lvl i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .08s linear; }

/* ---------- cenários de videochamada (desfocados, como fundo de câmera) ---------- */
/* o ::before vem antes dos filhos posicionados, então fica atrás do avatar e dos controles */
.call { overflow: hidden; }
.call::before { content: ""; position: absolute; inset: -40px; filter: blur(18px) brightness(.85); pointer-events: none; }
.scene-office::before {
  background:
    radial-gradient(circle at 12% 30%, #ffe9b8cc 0 3%, transparent 4%), radial-gradient(circle at 22% 22%, #fff3d1aa 0 2%, transparent 3%),
    radial-gradient(circle at 80% 26%, #cfe3ffcc 0 3.5%, transparent 5%), radial-gradient(circle at 90% 40%, #ffffffaa 0 2%, transparent 3%),
    linear-gradient(90deg, transparent 58%, #9db4d14d 58% 92%, transparent 92%),
    linear-gradient(180deg, #5c6b80 0%, #46546a 55%, #2c3442 56%, #222833 100%);
}
.scene-loft::before {
  background:
    radial-gradient(ellipse at 85% 30%, #fff6e0 0 12%, transparent 30%),
    radial-gradient(ellipse at 14% 62%, #3f6b3f 0 7%, transparent 13%), radial-gradient(ellipse at 18% 52%, #4f7f45 0 6%, transparent 11%),
    radial-gradient(circle at 30% 24%, #ffd99acc 0 2.5%, transparent 4%),
    linear-gradient(180deg, #cdb9a0 0%, #b39a7d 58%, #7a5d43 59%, #5e4532 100%);
}
.scene-library::before {
  background:
    repeating-linear-gradient(90deg, #6d3b2c 0 3%, #2f4a5c 3% 5%, #8a6a3a 5% 8%, #4a2f2a 8% 10%, #556b45 10% 12%) 0 18% / 100% 22% no-repeat,
    repeating-linear-gradient(90deg, #3d5466 0 4%, #7b4a35 4% 6%, #9a7d4c 6% 9%, #4e3a33 9% 12%) 0 52% / 100% 22% no-repeat,
    radial-gradient(ellipse at 80% 20%, #ffe2b0aa 0 10%, transparent 26%),
    linear-gradient(180deg, #4a3428 0%, #3b2a21 100%);
}
.scene-terrace::before {
  background:
    radial-gradient(ellipse at 80% 20%, #e9b77a55 0 8%, transparent 24%),
    radial-gradient(circle at 24% 26%, #ffd59a66 0 2.5%, transparent 4%), radial-gradient(circle at 66% 14%, #ffe3b055 0 2%, transparent 3.5%),
    radial-gradient(ellipse at 12% 72%, #31492a 0 9%, transparent 16%), radial-gradient(ellipse at 90% 76%, #3a5530 0 8%, transparent 15%),
    linear-gradient(180deg, #6b4a36 0%, #5a3d2c 50%, #3f2a1f 51%, #2c1e17 100%);
}

.subtitle-pt { text-align: center; color: #ffd98a; font-size: 16px; min-height: 22px; text-shadow: 0 2px 8px #000; }
.subtitle-pt:empty { min-height: 0; }

.call-who { display: flex; gap: 12px; align-items: center; }
button.brand { border: 0; padding: 0; background-color: transparent; cursor: pointer; }
