/* Telas do app, em cima do design system (ds.css). Aqui ficam só o layout e o jeito de cada tela;
   cores, formas e movimento vêm dos tokens do ds.css. */

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 500 17px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
body { padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom); }
#app { max-width: 560px; margin: 0 auto; padding: 16px 16px 104px; }
h1 { font: 800 1.6rem/1.15 var(--font); margin: 8px 0 12px; }
h2 { font: 800 1.1rem/1.25 var(--font); margin: 0 0 8px; }
p { margin: 0 0 10px; }
.muted { color: var(--ink-2); font-size: .92rem; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.full { width: 100%; }
.greet { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.greet h1 { margin: 0; }
.greet .mascot { flex: none; }

/* home: o Polly pousa na borda do cartão principal (os pés ficam sobre a borda de cima) */
.perch-top { display: flex; align-items: flex-start; gap: 6px; padding: 0 4px; position: relative; z-index: 1; margin-bottom: -7px; }
.perch-top .mascot { flex: none; width: 120px; height: 120px; }
.bubble { position: relative; margin: 14px 0 0; padding: 8px 14px; background: var(--card); border: 2px solid var(--line); border-bottom-width: var(--press); border-radius: var(--r-lg); }
.bubble::before { content: ""; position: absolute; left: -8px; top: 22px; width: 12px; height: 12px; background: var(--card); border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg); }
.bubble h1 { margin: 0; font-size: 1.2rem; }
.bubble p { margin: 2px 0 0; }

/* cartões e estatísticas */
.card { background: var(--card); border: 2px solid var(--line); border-bottom-width: var(--press); border-radius: var(--r-lg); padding: 14px; margin: 0 0 12px; }
.hero { border-color: var(--brand); }
.grid { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.grid.four { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.stat { background: var(--card); border: 2px solid var(--line); border-radius: var(--r-md); padding: 10px 4px; text-align: center; font-size: .82rem; overflow-wrap: anywhere; color: var(--ink-2); font-weight: 700; }
.stat b { display: block; font: 800 1.4rem/1.2 var(--font); color: var(--ink); }
.stat .feathers { display: flex; justify-content: center; margin-bottom: 4px; }
.grid.four .stat { font-size: .7rem; padding: 10px 2px; }
.grid.four .stat b { font-size: 1.25rem; }
button.stat { cursor: pointer; border-bottom-width: var(--press); }
h2.section { margin: 22px 4px 8px; font: 800 .8rem var(--font); color: var(--ink-2); text-transform: uppercase; letter-spacing: .06em; }

/* botões: secundário por padrão, borda tátil embaixo */
button, a.btn {
  font: 800 1rem/1.1 var(--font); min-height: 48px; padding: 10px 16px; border-radius: var(--r-md);
  border: 2px solid var(--line); border-bottom-width: var(--press); background: var(--card); color: var(--ink);
  cursor: pointer; text-align: center; transition: transform var(--t-fast) var(--ease), border-bottom-width var(--t-fast) var(--ease), filter var(--t-fast);
}
button:hover { filter: brightness(1.03); }
button:active, a.btn:active { transform: translateY(calc(var(--press) - 1px)); border-bottom-width: 1px; }
button.primary, a.btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); border-bottom-color: var(--brand-deep); }
button.ghost { background: transparent; border-color: transparent; border-bottom-width: 2px; color: var(--ink-2); min-height: 44px; }
button.ghost:active { transform: none; }
button.danger { color: var(--red-ink); }
button.big { min-height: 58px; font-size: 1.1rem; }
button:disabled { opacity: .5; cursor: default; }
button.on { background: var(--brand-tint); border-color: var(--brand); color: var(--brand-ink); }
a.btn { display: block; text-decoration: none; line-height: 26px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 14px; }
.chips button { flex: 1 1 auto; }
.band { display: flex; flex-direction: column; gap: 2px; align-items: center; justify-content: center; padding: 10px 4px; font-size: .95rem; }

/* campos */
textarea, input[type=text], input[type=password], input[type=number] {
  width: 100%; font: 500 1rem/1.4 var(--font); padding: 12px; border-radius: var(--r-md); border: 2px solid var(--line); background: var(--card); color: var(--ink);
}
textarea:focus, input:focus { outline: none; border-color: var(--blue); }
textarea { min-height: 96px; resize: vertical; }

/* menu de baixo */
.tabs { position: fixed; bottom: 0; left: 0; right: 0; background: var(--card); border-top: 2px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 5; }
.tabs-in { max-width: 560px; margin: 0 auto; display: flex; }
.tabs button { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; padding: 8px 2px 6px; border: 0; border-radius: 0; background: transparent; min-height: 60px; font-size: .74rem; color: var(--ink-3); position: relative; transform: none; filter: none; }
.tabs button svg { display: block; }
.tabs button.on { color: var(--brand-ink); font-weight: 800; }
.tabs button.on::before { content: ""; position: absolute; top: 0; left: 22%; right: 22%; height: 4px; border-radius: 0 0 4px 4px; background: var(--brand); }

/* etiquetas */
.pill { background: var(--track); color: var(--ink); }
.pill.ok { background: var(--green-tint); color: var(--green-ink); }
.pill.bad { background: var(--red-tint); color: var(--red-ink); }
.pill.warn { background: var(--gold-tint); color: var(--gold-ink); }

/* palavras: o visual vem de ds.css (.w acompanha .word) */
.words { display: flex; flex-wrap: wrap; gap: 0; margin: 8px 0; }
.w { font-size: 1.05rem; padding: 5px 11px; }
.w.tap { cursor: pointer; user-select: none; transition: transform var(--t-fast) var(--spring); }
.w.tap:active { transform: scale(.94); }
button.w { min-height: 0; border-bottom-width: 2px; font-weight: 700; }

/* escuta */
.listen { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.listen .main { grid-column: 1 / -1; }

/* progresso da sessão: barra (fallback) e segmentos (ds.css) */
.progress { height: 16px; background: var(--track); border-radius: var(--r-pill); overflow: hidden; margin: 8px 0 14px; }
.progress i { display: block; height: 100%; background: var(--brand); border-radius: var(--r-pill); transition: width var(--t-slow) var(--spring); }

/* calendário: dia cumprido é laranja (sequência), parcial é amarelo */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.cal div { padding: 8px 0; border-radius: var(--r-sm); font: 700 .9rem var(--font); }
.cal .d-cumprido { background: var(--orange); color: #fff; }
.cal .d-parcial { background: var(--gold-tint); color: var(--gold-ink); border: 2px solid var(--gold); }
.cal .head { color: var(--ink-3); font-size: .75rem; }

.fb h2 { margin-top: 12px; }
.rec { display: flex; gap: 8px; align-items: center; }
.rec .dot { width: 12px; height: 12px; border-radius: 50%; background: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
#toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: 92px; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: var(--r-md); font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90%; z-index: 10; }
#toast.show { opacity: 1; }
svg.chart { width: 100%; height: auto; }
table { width: 100%; border-collapse: collapse; font-size: .95rem; }
td, th { padding: 6px 4px; border-bottom: 2px solid var(--line); text-align: left; }
.empty { text-align: center; padding: 8px 0 4px; }
.empty .mascot { margin: 0 auto 4px; }

@media (min-width: 900px) {
  #app { max-width: 640px; padding-top: 28px; }
  .tabs-in { max-width: 640px; }
  h1 { font-size: 1.85rem; }
}
@media (max-width: 430px) {
  .grid.four { grid-template-columns: repeat(2, 1fr); }
  .grid.four .stat { font-size: .82rem; padding: 10px 4px; }
}
.banner { margin-bottom: 12px; }
.cal .d-gelo { background: var(--blue-tint); color: var(--blue-ink); border: 2px solid var(--blue); }
.cal .d-folga { background: var(--blue-tint); color: var(--blue-ink); border: 2px dashed var(--blue); }
.xpbars { display: flex; gap: 8px; align-items: flex-end; height: 104px; margin-top: 14px; }
.xpbars > div { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; font: 700 11px var(--font); color: var(--ink-3); }
.xpbars i { display: block; width: 100%; min-height: 4px; background: var(--gold); border-radius: 8px 8px 4px 4px; }
.week { font-size: 12px; }
button.gold { background: var(--gold); color: var(--gold-ink); border-color: var(--gold); border-bottom-color: var(--gold-deep); }
button.small { min-height: 38px; padding: 6px 12px; font-size: .85rem; }

/* feedback de pronúncia */
.pron-head { display: flex; gap: 14px; align-items: center; margin: 14px 0 6px; }
.pron-score { flex: none; width: 76px; height: 76px; border-radius: 50%; display: grid; place-content: center; text-align: center; background: var(--brand-tint); color: var(--brand-ink); border: 3px solid var(--brand); }
.pron-score b { font: 800 26px/1 var(--font); }
.pron-score span { font-size: 11px; font-weight: 700; }
.pron-title { display: grid; gap: 2px; }
.pron-title span { color: var(--ink-2); font-size: .92rem; }
.pron-h { margin: 16px 0 4px; font: 800 1rem/1.3 var(--font); color: var(--ink); }
.pron-ok { margin: 12px 0; color: var(--green-ink); font-weight: 700; }
.pw { border: 2px solid var(--line); border-radius: var(--r-md); padding: 10px 12px; margin: 0 0 10px; background: var(--card); }
.pw-word { font-size: 1.15rem; }
.pw-btn { min-height: 36px; padding: 0 12px; font-size: .85rem; }
.sounds { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.snd { padding: 5px 10px; border-radius: var(--r-sm); border: 2px solid var(--line); font: 800 1rem/1 ui-monospace, "SF Mono", Menlo, monospace; background: var(--bg); } /* monoespaçada para o "l" não parecer um "I" */
.snd.weak { background: var(--red-tint); border-color: var(--red); color: var(--red-ink); }
.tips { margin: 6px 0 0; padding-left: 18px; font-size: .92rem; color: var(--ink-2); }
.tips li { margin: 3px 0; }
.tips b { color: var(--red-ink); }
.pron-next { display: grid; gap: 2px; margin: 12px 0; padding: 10px 12px; border-radius: var(--r-md); background: var(--brand-tint); color: var(--brand-ink); }
.pron-details { margin: 8px 0 0; font-size: .92rem; }
.pron-details summary { cursor: pointer; color: var(--ink-2); font-weight: 700; }
.pron-details p { margin: 6px 0 0; }

/* régua de nível CEFR */
.ruler { position: relative; margin: 12px 0 6px; padding-bottom: 22px; }
.ruler .segs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.ruler .seg { position: relative; height: 30px; border-radius: var(--r-sm); background: var(--track); overflow: hidden; border: 2px solid transparent; }
.ruler .seg::before { content: ""; position: absolute; inset: 0 auto 0 0; width: var(--fill); background: var(--brand); }
.ruler .seg span { position: relative; display: grid; place-content: center; height: 100%; font: 800 .8rem/1 var(--font); color: var(--ink-2); mix-blend-mode: normal; }
.ruler .seg[style*="--fill:100%"] span { color: #fff; }
.ruler .seg.goal { border-color: var(--ink); }
.ruler .pin { position: absolute; bottom: 0; transform: translateX(-50%); min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--card); border: 2px solid var(--brand); color: var(--brand-ink); font: 800 .7rem/16px var(--font); text-align: center; font-style: normal; }
.skill { padding: 8px 0; border-top: 2px solid var(--line); }

