/* Inglês de Viagem — design tokens + componentes (mobile-first, offline, sem fontes externas) */
:root {
  /* Marca Diz Aí: azul-noite (ação), laranja-voz (destaque), creme (fundo) */
  --bg: #FBF6EE;
  --surface: #ffffff;
  --surface-2: #F1EAE0;
  --text: #1B2A4A;
  --muted: #5F6878;
  --line: #E4DDD2;
  --accent: #1B2A4A;
  --accent-ink: #ffffff;
  --accent-soft: #E3E8F3;
  --warn: #B4400F;
  --warn-soft: #FFE3D6;
  --danger: #b91c1c;
  --danger-soft: #fde2e2;
  --ok: #15803d;
  --ok-soft: #dcf5e3;
  --gold: #FF6B35;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 6px 24px rgba(28, 27, 25, .08);
  --gutter: 16px;
  --tap: 48px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0F1627; --surface: #1B2A4A; --surface-2: #24355C; --text: #F3EEE6; --muted: #A9B2C4;
    --line: #2F4068; --accent: #FF8A5B; --accent-ink: #1B2A4A; --accent-soft: #3A2E2A;
    --warn: #FFB38A; --warn-soft: #3d2a10; --danger: #f87171; --danger-soft: #3f1616;
    --ok: #4ade80; --ok-soft: #123820; --gold: #FFB38A; --shadow: 0 6px 24px rgba(0,0,0,.35);
  }
}
:root[data-theme="dark"] {
  --bg: #0F1627; --surface: #1B2A4A; --surface-2: #24355C; --text: #F3EEE6; --muted: #A9B2C4;
  --line: #2F4068; --accent: #FF8A5B; --accent-ink: #1B2A4A; --accent-soft: #3A2E2A;
  --warn: #FFB38A; --warn-soft: #3d2a10; --danger: #f87171; --danger-soft: #3f1616;
  --ok: #4ade80; --ok-soft: #123820; --gold: #FFB38A; --shadow: 0 6px 24px rgba(0,0,0,.35);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 17px; line-height: 1.45; overflow-x: hidden;
  padding-bottom: env(safe-area-inset-bottom);
}
button { font: inherit; color: inherit; }
input, textarea { font: inherit; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .4em; }
h1 { font-size: clamp(1.5rem, 5vw, 2rem); letter-spacing: -.01em; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .8em; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.center { text-align: center; }
.hidden { display: none !important; }

.app { max-width: 640px; margin: 0 auto; padding: 0 var(--gutter) 96px; min-height: 100dvh; }

/* Topo */
.topbar {
  display: flex; align-items: center; gap: 12px; min-height: 56px;
  padding: calc(env(safe-area-inset-top) + 8px) 0 8px; position: sticky; top: 0; z-index: 5;
  background: linear-gradient(var(--bg) 80%, transparent);
}
.topbar h1 { font-size: 1.15rem; margin: 0; flex: 1; }
.topbar .back { width: var(--tap); height: var(--tap); border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow); font-size: 1.3rem; }

/* Cards */
.card {
  background: var(--surface); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  margin-bottom: 14px; border: 1px solid var(--line);
}
.card.accent { background: var(--accent); color: var(--accent-ink); border: 0; }
.card.accent .muted { color: color-mix(in srgb, var(--accent-ink) 80%, transparent); }
.card.soft { background: var(--surface-2); box-shadow: none; }
.row { display: flex; align-items: center; gap: 12px; }
.row.between { justify-content: space-between; }
.grow { flex: 1; }
.stack > * + * { margin-top: 10px; }

/* Botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 10px 18px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 600; text-decoration: none;
  transition: transform .12s ease, background .15s ease, opacity .15s ease; user-select: none; -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.big { min-height: 58px; font-size: 1.1rem; }
.btn.icon { width: var(--tap); padding: 0; border-radius: 50%; font-size: 1.25rem; }
.btn.icon.lg { width: 72px; height: 72px; font-size: 1.8rem; }
.btn.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.btn.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn.listening { background: var(--danger); color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(185,28,28,.5);} 50% { box-shadow: 0 0 0 14px rgba(185,28,28,0);} }
.btnrow { display: flex; gap: 10px; flex-wrap: wrap; }
.btnrow .btn { flex: 1; }

/* Formulários */
.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 6px; }
.input {
  width: 100%; min-height: var(--tap); padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
textarea.input { min-height: 90px; resize: vertical; }

/* Progresso */
.progress { height: 10px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s ease; }
.card.accent .progress { background: rgba(255,255,255,.25); }
.card.accent .progress > i { background: var(--accent-ink); }
.ring { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 1.1rem;
  background: conic-gradient(var(--accent) calc(var(--p) * 1%), var(--surface-2) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--surface); }
.ring > span { position: relative; }
.card.accent .ring { background: conic-gradient(var(--accent-ink) calc(var(--p) * 1%), rgba(255,255,255,.28) 0); color: var(--accent-ink); }
.card.accent .ring::before { background: var(--accent); }

/* Mapa dos 30 dias */
.daymap { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.daymap button {
  aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--line); background: var(--surface);
  font-weight: 700; font-size: .95rem; display: grid; place-items: center; cursor: pointer; position: relative;
}
.daymap button.done { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.daymap button.today { outline: 2px solid var(--accent); outline-offset: 2px; }
.daymap button.locked { opacity: .45; }
.daymap button small { position: absolute; bottom: 3px; font-size: .55rem; font-weight: 500; color: var(--muted); }

/* Passos da sessão */
.steps { display: flex; gap: 6px; margin: 8px 0 16px; }
.steps i { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-2); }
.steps i.done { background: var(--accent); }
.steps i.now { background: var(--gold); }

/* Frase */
.phrase-en { font-size: clamp(1.3rem, 5.5vw, 1.7rem); font-weight: 700; letter-spacing: -.01em; margin: 0 0 6px; }
.phrase-pt { color: var(--muted); font-size: 1.05rem; margin: 0 0 10px; }
.note { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 8px 12px; font-size: .9rem; display: inline-block; }
.kind { display: inline-block; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; background: var(--surface-2); color: var(--muted); margin-bottom: 8px; }
.kind.hear { background: var(--accent-soft); color: var(--accent); }

/* Lista de frases */
.plist { list-style: none; margin: 0; padding: 0; }
.plist li { display: flex; gap: 10px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); }
.plist li:last-child { border-bottom: 0; }
.plist .t { flex: 1; }
.plist .t b { display: block; font-size: 1.02rem; }
.plist .t span { color: var(--muted); font-size: .92rem; }

/* Diálogo */
.dialog { list-style: none; margin: 0; padding: 0; }
.dialog li { display: flex; flex-direction: column; margin-bottom: 10px; max-width: 88%; }
.dialog li.A { align-self: flex-start; }
.dialog li.B { align-self: flex-end; margin-left: auto; }
.dialog .bubble { padding: 10px 14px; border-radius: 16px; background: var(--surface-2); }
.dialog li.B .bubble { background: var(--accent-soft); color: var(--text); }
.dialog .who { font-size: .72rem; color: var(--muted); margin: 0 6px 3px; }
.dialog .pt { font-size: .85rem; color: var(--muted); margin: 3px 8px 0; }
.dialog li.active .bubble { outline: 2px solid var(--gold); }

/* Avaliação de fala */
.score { font-size: 2.2rem; font-weight: 800; }
.score.good { color: var(--ok); } .score.mid { color: var(--warn); } .score.bad { color: var(--danger); }
.diff span { padding: 1px 3px; border-radius: 4px; }
.diff .ok { color: var(--ok); } .diff .miss { background: var(--danger-soft); color: var(--danger); text-decoration: line-through; }
.diff .extra { background: var(--warn-soft); color: var(--warn); }

/* Chat do tutor */
.chat { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.msg { max-width: 88%; padding: 10px 14px; border-radius: 16px; background: var(--surface-2); white-space: pre-wrap; }
.msg.user { align-self: flex-end; background: var(--accent-soft); }
.msg.fb { align-self: stretch; max-width: 100%; background: var(--warn-soft); color: var(--warn); font-size: .92rem; border-radius: 12px; }
.msg.fb b { display: block; margin-bottom: 2px; }
.msg .pt { display: block; color: var(--muted); font-size: .85rem; margin-top: 4px; }
.cover { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 12px; }
.cover span { font-size: .8rem; padding: 4px 10px; border-radius: 999px; background: var(--surface-2); color: var(--muted); }
.cover span.done { background: var(--ok-soft); color: var(--ok); text-decoration: line-through; }
.composer { position: sticky; bottom: 0; background: var(--bg); padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-height: var(--tap); max-height: 140px; }

/* Marca escrita (wordmark) */
.wordmark { font-family: Sora, var(--font); font-weight: 800; letter-spacing: -.05em; color: var(--text); line-height: 1; display: inline-block; }
.wordmark .i { position: relative; display: inline-block; }
.wordmark .i::after { content: ""; position: absolute; left: 50%; top: -.04em; width: .26em; height: .26em; margin-left: -.13em; border-radius: .08em .08em .08em .02em; background: var(--gold); transform: rotate(-8deg); }
.wordmark .tag { display: block; font-weight: 700; font-size: .19em; letter-spacing: .32em; color: var(--gold); margin-top: .18em; }
h1, h2 { font-family: Sora, var(--font); }

/* Abertura (landing) */
.landing .hero { text-align: center; padding: 40px 0 24px; }
.landing .hero .wordmark { font-size: 2.6rem; margin-top: 14px; }
.landing .hero h1 { font-size: clamp(1.9rem, 7vw, 2.6rem); line-height: 1.1; margin: 14px 0 12px; letter-spacing: -.02em; }
.landing .hero h1 em { font-style: normal; color: var(--gold); }
.landing .lead { font-size: 1.05rem; color: var(--muted); margin: 0 0 18px; }
.landing .beta { display: inline-block; margin-top: 14px; font-size: .72rem; font-weight: 700; letter-spacing: .08em; padding: 5px 12px; border-radius: 999px; background: var(--warn-soft); color: var(--warn); }
.feat { list-style: none; margin: 0; padding: 0; }
.feat li { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.feat li:last-child { border-bottom: 0; }
.feat i { font-style: normal; font-size: 1.4rem; width: 32px; flex: none; text-align: center; }
.feat b { display: block; margin-bottom: 2px; }

/* Chips de resposta (onboarding) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .btn { flex: 1 1 auto; text-align: left; justify-content: flex-start; }
.chips.days .btn { flex: 1 1 0; min-width: 40px; justify-content: center; padding: 10px 0; }

/* Barra inferior */
.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; display: flex; justify-content: center;
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .inner { display: flex; width: 100%; max-width: 640px; }
.tabbar button { flex: 1; min-height: 58px; border: 0; background: transparent; color: var(--muted); font-size: .72rem; font-weight: 600; display: flex; flex-direction: column; gap: 2px; align-items: center; justify-content: center; cursor: pointer; }
.tabbar button i { font-style: normal; font-size: 1.35rem; }
.tabbar button.on { color: var(--accent); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: .92rem; transition: .25s ease; z-index: 50; max-width: 90vw; text-align: center; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Badge / streak */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface-2); font-weight: 600; font-size: .9rem; }
.badge.gold { background: color-mix(in srgb, var(--gold) 18%, transparent); color: var(--warn); }

/* Util */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.fade { animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px);} to { opacity: 1; transform: none;} }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
