:root {
  --bg: #f7f5f0;
  --surface: #fffefb;
  --surface-2: #f1eee6;
  --ink: #2c2823;
  --ink-soft: #a6a196;
  --line: #ece8de;
  --accent: #dd6470;
  --accent-soft: #f8e7e9;
  --hero-bg: #2c2823;
  --hero-ink: #f6f4ee;
  --on-accent: #ffffff;
  --green: #8bc4a0;
  --amber: #e6c67e;
  --red: #dd6470;
  --neutral: #e5e1d7;
  --r-lg: 22px;
  --r-md: 18px;
  --r-sm: 12px;
  --tabbar-h: 72px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #141311;
  --surface: #1c1b18;
  --surface-2: #24231f;
  --ink: #efece4;
  --ink-soft: #98948a;
  --line: #2a2824;
  --accent: #ef8791;
  --accent-soft: #33211f;
  --hero-bg: #201e1a;
  --hero-ink: #f2efe8;
  --on-accent: #2c2823;
  --green: #7cc394;
  --amber: #e6c67e;
  --red: #ef8791;
  --neutral: #2f2d29;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141311;
    --surface: #1c1b18;
    --surface-2: #24231f;
    --ink: #efece4;
    --ink-soft: #98948a;
    --line: #2a2824;
    --accent: #ef8791;
    --accent-soft: #33211f;
    --hero-bg: #201e1a;
    --hero-ink: #f2efe8;
    --on-accent: #2c2823;
    --green: #7cc394;
    --amber: #e6c67e;
    --red: #ef8791;
    --neutral: #2f2d29;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

#app { min-height: 100dvh; display: flex; flex-direction: column; }

.view {
  flex: 1;
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 18px calc(var(--tabbar-h) + 32px);
}

/* ---------- Wide screens (iPad / desktop) ---------- */
.dash { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.cards-2 { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.dash > *, .cards-2 > *, .goal-grid > * { margin-bottom: 0; min-width: 0; }
@media (min-width: 880px) {
  .view { max-width: 1060px; padding-left: 28px; padding-right: 28px; }
  .dash { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; }
  .dash > .span-all { grid-column: 1 / -1; }
  .cards-2 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; }
  .cal-grid, .cal-head, .cal-legend { max-width: 620px; }
  .cal-head, .cal-legend { margin-left: auto; margin-right: auto; }
  .cal-grid { margin: 0 auto; }
}

/* ---------- Stats tiles ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.stat-tile { background: var(--surface-2); border-radius: var(--r-md); padding: 16px; }
.stat-tile .n { font-size: clamp(30px, 8vw, 40px); font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.stat-tile .n .u { font-size: 0.45em; color: var(--accent); font-weight: 800; }
.stat-tile .l { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-soft); margin-top: 6px; }

/* ---------- Brand / top bar ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 18px; }
.brand { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.brand .d { color: var(--accent); }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--surface-2); color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.icon-btn.active { color: var(--accent); }
.icon-btn.spin svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-soft);
}

.display { font-weight: 800; letter-spacing: -0.03em; line-height: 0.94; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  margin-bottom: 14px;
}
.card-ink {
  background: var(--hero-bg);
  color: var(--hero-ink);
  border: none;
  border-radius: var(--r-lg);
  padding: 24px;
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}
.hero-dot { position: absolute; top: 22px; right: 22px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.hero-glow { display: none; }
.card-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase;
  color: var(--ink-soft); margin-bottom: 14px;
}
.card-ink .card-label { color: color-mix(in srgb, var(--hero-ink) 55%, transparent); }

/* ---------- Home hero (weather) ---------- */
.weather-day { font-size: 14px; font-weight: 600; color: color-mix(in srgb, var(--hero-ink) 72%, transparent); text-transform: capitalize; }
.hero-compact { padding: 20px 22px; }
.hero-lead { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.temp { display: flex; align-items: center; gap: 10px; }
.temp .wicon { font-size: clamp(34px, 10vw, 46px); line-height: 0; color: var(--hero-ink); }
.wsvg { width: 1em; height: 1em; display: block; fill: currentColor; }
.wsvg line { stroke: currentColor; }
.wsvg .w-warm { color: var(--amber); fill: var(--amber); }
.temp .n { font-size: clamp(44px, 15vw, 60px); font-weight: 800; letter-spacing: -0.04em; line-height: 0.85; }
.temp .deg { font-size: clamp(18px, 6vw, 24px); font-weight: 800; color: var(--accent); align-self: flex-start; }
.weather-meta { font-size: 13px; color: color-mix(in srgb, var(--hero-ink) 66%, transparent); margin-top: 4px; }
.year-line { display: flex; align-items: center; gap: 12px; margin-top: 18px; }
.year-line .progress { flex: 1; margin-top: 0; }
.year-tag { font-size: 12px; font-weight: 700; color: color-mix(in srgb, var(--hero-ink) 66%, transparent); white-space: nowrap; }
.card-ink .year-side { color: color-mix(in srgb, var(--hero-ink) 60%, transparent); }
.card-ink .progress { background: color-mix(in srgb, var(--hero-ink) 16%, transparent); }
.weather-hilo { font-size: 12px; font-weight: 600; color: color-mix(in srgb, var(--hero-ink) 58%, transparent); margin-top: 4px; }
.rain-alert { font-size: 13px; font-weight: 700; color: var(--accent); margin-top: 14px; }

/* ---------- Agenda (próximos jogos) ---------- */
.agenda-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.agenda-row:last-child { border-bottom: none; }
.agenda-main { min-width: 0; }
.agenda-title { font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.agenda-sub { font-size: 11px; font-weight: 600; color: var(--ink-soft); margin-top: 2px; }
.agenda-when { font-size: 12px; font-weight: 700; color: var(--accent); white-space: nowrap; }

/* ---------- Year progress (big %) ---------- */
.year-card { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.year-num { font-size: clamp(30px, 9vw, 40px); font-weight: 800; letter-spacing: -0.04em; line-height: 0.85; }
.year-num .pct { font-size: 0.4em; color: var(--accent); font-weight: 700; }
.year-side { text-align: right; padding-bottom: 6px; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 16px; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 99px; }

/* ---------- Tasks ---------- */
.task { display: flex; align-items: center; gap: 14px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: none; }
.check {
  width: 30px; height: 30px; flex: none; border-radius: 50%;
  border: 2px solid var(--neutral); background: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center; transition: transform .1s;
}
.check:active { transform: scale(0.9); }
.check.done { background: var(--accent); border-color: var(--accent); }
.check.done::after { content: "✓"; color: var(--on-accent); font-size: 16px; font-weight: 800; }
.task .info { flex: 1; min-width: 0; }
.task .t { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.task.done .t { text-decoration: line-through; color: var(--ink-soft); }
.task .tags { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.task .tag { font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-soft); }
.task .tag.time { color: var(--accent); font-variant-numeric: tabular-nums; }
.task .tag.carried { color: var(--accent); }
.task .row-actions { display: flex; gap: 6px; }
.mini-btn {
  border: none; background: var(--surface-2); color: var(--ink); cursor: pointer;
  width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
}
.mini-btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.mini-btn.danger { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 54px; padding: 0 22px;
  border: none; border-radius: 99px; cursor: pointer;
  background: var(--accent); color: var(--on-accent);
  font-size: 16px; font-weight: 700; letter-spacing: -0.01em;
}
.btn.accent { background: var(--accent); color: var(--on-accent); }
.btn.ghost { background: var(--surface-2); color: var(--ink); }
.btn:disabled { opacity: 0.5; }
.fab {
  position: fixed; right: 18px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
  width: 62px; height: 62px; border-radius: 50%; border: none;
  background: var(--accent); color: var(--on-accent); font-size: 32px; line-height: 1; cursor: pointer;
  z-index: 40;
}

/* ---------- Tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex; justify-content: space-around; align-items: center;
  background: var(--surface);
  border-top: 1px solid var(--line); z-index: 50;
}
.tab {
  flex: 1; height: 100%; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-soft); font-size: 10px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
}
.tab svg { width: 23px; height: 23px; stroke: currentColor; fill: none; stroke-width: 1.7; }
.tab.active { color: var(--accent); }

/* ---------- Forms ---------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-soft); margin-bottom: 8px; }
.field input, .field select {
  width: 100%; min-height: 54px; padding: 0 16px;
  border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font-size: 16px; font-family: var(--font); font-weight: 500;
}
.dow-row { display: flex; gap: 7px; }
.dow { flex: 1; min-height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; font-size: 14px; cursor: pointer; }
.dow.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.type-row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 9px; }
.type-opt { min-height: 52px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-weight: 700; cursor: pointer; }
.type-opt.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* ---------- Calendar ---------- */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.cal-title { font-size: clamp(22px, 7vw, 30px); font-weight: 800; letter-spacing: -0.02em; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal-dow { text-align: center; font-size: 10px; font-weight: 700; color: var(--ink-soft); padding-bottom: 4px; text-transform: uppercase; }
.cal-cell {
  aspect-ratio: 1; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; background: var(--surface); border: 1px solid var(--line); cursor: pointer;
}
.cal-cell.empty { background: none; border: none; cursor: default; }
.cal-cell.verde { background: var(--green); color: var(--on-accent); border-color: var(--green); }
.cal-cell.amarelo { background: var(--amber); color: #4a4438; border-color: var(--amber); }
.cal-cell.vermelho { background: var(--red); color: var(--on-accent); border-color: var(--red); }
.cal-cell.today { outline: 2.5px solid var(--accent); outline-offset: 1px; }
.cal-legend { display: flex; gap: 14px; margin-top: 18px; flex-wrap: wrap; }
.cal-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-soft); font-weight: 600; }
.dot { width: 11px; height: 11px; border-radius: 4px; }

/* ---------- News (square cards with image) ---------- */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.news-card {
  position: relative; aspect-ratio: 4 / 5; border-radius: var(--r-md); overflow: hidden;
  background: var(--surface-2); text-decoration: none; display: block; border: 1px solid var(--line);
}
.news-card img { width: 100%; height: 100%; object-fit: cover; display: block; }
.news-card .noimg { width: 100%; height: 100%; background: var(--accent-soft); }
.news-card .scrim { display: none; }
.news-card .body { position: absolute; left: 0; right: 0; bottom: 0; padding: 14px 14px 15px; background: linear-gradient(to top, rgba(20,17,14,0.92) 60%, rgba(20,17,14,0)); }
.news-card .src { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; background: var(--accent); color: var(--on-accent); padding: 3px 8px; border-radius: 6px; margin-bottom: 8px; }
.news-card .h { font-size: 15.5px; font-weight: 600; line-height: 1.3; color: #fff; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.news-card .when { font-size: 11px; color: rgba(255,255,255,0.8); margin-top: 7px; }

/* ---------- Sports items ---------- */
.match { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--line); gap: 12px; }
.match:last-child { border-bottom: none; }
.match .teams { font-weight: 700; font-size: 16px; letter-spacing: -0.01em; }
.match-teams { min-width: 0; }
.match-comp { font-size: 11px; font-weight: 600; color: var(--ink-soft); margin-top: 2px; }
.match .when { font-size: 12px; color: var(--ink-soft); font-weight: 600; white-space: nowrap; text-align: right; }
.match .when .match-score { font-size: 15px; color: var(--ink); }
.match .when .match-date { font-size: 11px; font-weight: 500; margin-top: 2px; }
.sports-news { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-top: 4px; }
.news-card-full {
  display: flex; flex-direction: column; border-radius: var(--r-md); overflow: hidden;
  background: var(--surface); text-decoration: none; border: 1px solid var(--line);
}
.news-card-full .thumb, .news-card-full .noimg { width: 100%; height: 130px; object-fit: cover; display: block; background: var(--accent-soft); }
.news-card-full .body { padding: 12px 14px 14px; }
.news-card-full .src { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; background: var(--accent); color: var(--on-accent); padding: 3px 8px; border-radius: 6px; margin-bottom: 8px; }
.news-card-full .h { font-size: 14.5px; font-weight: 600; line-height: 1.35; color: var(--ink); }
.news-card-full .when { font-size: 11px; color: var(--ink-soft); margin-top: 7px; }

/* ---------- Team buttons (flat crests) ---------- */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 10px; margin-bottom: 14px; }
.team-btn { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 8px; display: flex; flex-direction: column; align-items: center; gap: 9px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.team-btn:active { opacity: 0.6; }
.team-logo-wrap { line-height: 0; }
.team-logo { width: 46px; height: 46px; display: block; object-fit: contain; }
.team-logo.noimg { border-radius: 13px; background: var(--line); }
.team-btn .tname { font-size: 12px; font-weight: 700; color: var(--ink); text-align: center; letter-spacing: -0.01em; }
.team-live { position: absolute; top: 7px; right: 7px; font-size: 8px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.04em; color: #fff; background: var(--accent); border-radius: 99px; padding: 2px 6px; animation: pulse 1.6s ease-in-out infinite; }
.tappable { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.tappable:active { transform: scale(0.99); }
.tap-hint { font-size: 12px; font-weight: 700; color: var(--accent); margin-top: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.live-badge { font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; color: #fff; background: var(--accent); border-radius: 99px; padding: 3px 10px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.live-score .score { font-size: clamp(22px, 7vw, 30px); font-weight: 800; letter-spacing: -0.02em; }

/* ---------- Standings table ---------- */
.trow { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.trow:last-child { border-bottom: none; }
.trow .pos { width: 24px; text-align: center; font-weight: 800; color: var(--ink-soft); font-size: 14px; }
.trow .tm { flex: 1; font-weight: 600; font-size: 15px; }
.trow .pl { font-size: 12px; color: var(--ink-soft); width: 28px; text-align: right; }
.trow .pt { font-weight: 800; width: 40px; text-align: right; }
.trow.hl { color: var(--accent); }
.trow.hl .pos, .trow.hl .tm, .trow.hl .pt { color: var(--accent); }

/* ---------- Goals (Metas) — cards flat ---------- */
.goal-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 880px) { .goal-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: stretch; } }
.balance-card { margin-bottom: 14px; }
.gs-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.gs-pct { font-size: clamp(40px, 12vw, 54px); line-height: 0.86; }
.gs-pct .u { font-size: 0.36em; color: var(--accent); font-weight: 700; }
.gs-cap { text-align: right; font-size: 13px; font-weight: 600; color: var(--ink-soft); padding-bottom: 6px; }
.gs-days { color: var(--accent); font-weight: 700; margin-top: 3px; }

.goal-card { cursor: pointer; -webkit-tap-highlight-color: transparent; display: flex; flex-direction: column; }
.goal-card .progress.slim { margin-top: auto; }
.goal-card:active { opacity: 0.6; }
.goal-card.done { border-color: color-mix(in srgb, var(--green) 55%, var(--line)); }
.goal-top { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.goal-name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; min-width: 0; }
.goal-pct { font-size: 19px; font-weight: 800; color: var(--accent); letter-spacing: -0.02em; }
.goal-pct.big { font-size: clamp(40px, 12vw, 52px); }
.goal-card.done .goal-pct { color: var(--green); }
.goal-meta { font-size: 12px; font-weight: 600; color: var(--ink-soft); margin: 5px 0 13px; }
.goal-card.done .progress > i { background: var(--green); }
.progress.slim { height: 6px; margin-top: 0; }

.sheet-progress { margin-bottom: 22px; }
.sheet-progress .goal-sub { justify-content: flex-start; margin-top: 10px; font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.icon-btn.danger { color: var(--accent); }
.sheet-sub { font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-top: 3px; }
.entry-icon .ic-book { width: 18px; height: 18px; display: block; fill: var(--accent); }

/* ---------- Goal charts ---------- */
.chart-wrap { background: var(--surface-2); border-radius: var(--r-sm); padding: 8px 6px; margin-bottom: 18px; }
.chart { width: 100%; height: auto; display: block; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill: color-mix(in srgb, var(--accent) 14%, transparent); stroke: none; }
.chart-dot { fill: var(--accent); }
.chart-dot.last { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-target { stroke: var(--ink-soft); stroke-width: 1; stroke-dasharray: 4 4; opacity: 0.55; }
.chart-target-label { fill: var(--ink-soft); font-size: 9px; font-weight: 700; }
.chart-axis { fill: var(--ink-soft); font-size: 9px; font-weight: 600; }

/* ---------- Goal entries ---------- */
.entry-list { margin-bottom: 18px; }
.entry { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: none; }
.entry-icon { font-size: 18px; }
.entry-main { flex: 1; min-width: 0; }
.entry-text { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.entry-when { font-size: 11px; color: var(--ink-soft); margin-top: 2px; }
.entry-form { border-top: 1px solid var(--line); padding-top: 16px; }

/* ---------- Notes ---------- */
.note { padding: 12px 0; border-bottom: 1px solid var(--line); display: flex; gap: 10px; align-items: flex-start; }
.note:last-child { border-bottom: none; }
.note .nbody { flex: 1; font-size: 15px; line-height: 1.35; white-space: pre-wrap; word-break: break-word; cursor: pointer; }
.note .nwhen { font-size: 11px; color: var(--ink-soft); margin-top: 4px; }
textarea.note-input { width: 100%; min-height: 160px; padding: 14px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); color: var(--ink); font-size: 16px; font-family: var(--font); resize: vertical; }

/* ---------- Badges / states ---------- */
.stale-badge { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--amber); border: 1px solid var(--amber); border-radius: 99px; padding: 2px 9px; }
.section-title { font-size: clamp(30px, 9vw, 44px); font-weight: 800; letter-spacing: -0.03em; margin-bottom: 18px; }

/* ---------- Overlays ---------- */
.overlay { position: fixed; inset: 0; z-index: 100; background: var(--bg); overflow-y: auto; }
.overlay.hidden { display: none; }
.sheet { width: 100%; max-width: 520px; margin: 0 auto; padding: max(20px, env(safe-area-inset-top)) 18px 40px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.login-wrap { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login-box { width: 100%; max-width: 360px; text-align: center; }
.login-box .mark { font-size: 56px; font-weight: 800; letter-spacing: -0.04em; margin-bottom: 6px; }
.login-box .mark .d { color: var(--accent); }
.login-box p { color: var(--ink-soft); margin-bottom: 26px; font-weight: 500; }
.login-box input { text-align: center; letter-spacing: 0.3em; font-size: 24px; font-weight: 700; }
.error-text { color: var(--accent); font-size: 14px; font-weight: 600; margin-top: 14px; min-height: 20px; }

/* ---------- Misc ---------- */
.empty-state { text-align: center; color: var(--ink-soft); padding: 70px 20px; }
.empty-state .big { font-size: 28px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); margin-bottom: 8px; }
.spinner { text-align: center; color: var(--ink-soft); padding: 48px; font-weight: 500; }
.muted { color: var(--ink-soft); }
.hidden { display: none; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.stack { display: flex; flex-direction: column; }

/* Estudo */
.st-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.st-topic { min-width: 0; text-align: left; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 13px 13px 12px; cursor: pointer; -webkit-tap-highlight-color: transparent; display: flex; flex-direction: column; gap: 6px; }
.st-topic:active { opacity: 0.6; }
.st-topic.off { opacity: 0.4; cursor: default; }
.st-topic.off:active { opacity: 0.4; }
.st-topic-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; min-width: 0; }
.st-topic-name { min-width: 0; font-size: 13px; font-weight: 700; color: var(--ink); line-height: 1.25; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.st-topic-sub { font-size: 11px; color: var(--ink-soft); font-weight: 600; }
.st-acc { font-size: 11px; font-weight: 800; padding: 2px 7px; border-radius: 99px; white-space: nowrap; }
.st-acc.good { background: var(--green); color: #16321f; }
.st-acc.mid { background: var(--amber); color: #3a2f12; }
.st-acc.low { background: var(--red); color: #fff; }
.st-acc.none { background: var(--neutral); color: var(--ink-soft); }
.st-overall { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; }
.st-big { font-size: 44px; font-weight: 800; line-height: 1; letter-spacing: -0.03em; color: var(--ink); }
.st-big .u { font-size: 20px; font-weight: 700; color: var(--ink-soft); margin-left: 2px; }
.st-cap { color: var(--ink-soft); font-size: 13px; font-weight: 600; }
.st-def-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); margin: 14px 0 8px; }
.st-def-row { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: none; padding: 8px 0; cursor: pointer; border-top: 1px solid var(--line); }
.st-def-name { flex: 1; text-align: left; font-size: 13px; font-weight: 600; color: var(--ink); min-width: 0; overflow-wrap: anywhere; }
.st-def-bar { width: 72px; height: 6px; background: var(--neutral); border-radius: 99px; overflow: hidden; }
.st-def-bar i { display: block; height: 100%; border-radius: 99px; }
.st-def-bar i.low { background: var(--red); }
.st-def-bar i.mid { background: var(--amber); }
.st-def-pct { font-size: 12px; font-weight: 800; color: var(--ink-soft); width: 34px; text-align: right; }
.st-count .type-opt { min-height: 44px; }
.st-progress { height: 6px; background: var(--neutral); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.st-progress i { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width 0.25s ease; }
.st-link { background: none; border: none; color: var(--accent); font-weight: 700; font-size: 14px; cursor: pointer; }
.st-qnum { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-soft); margin-bottom: 10px; }
.st-qtopic { display: inline-block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); background: var(--surface-2); border-radius: 999px; padding: 3px 10px; margin-bottom: 10px; }
.st-question { font-size: 18px; font-weight: 600; line-height: 1.4; letter-spacing: -0.01em; color: var(--ink); margin-bottom: 18px; overflow-wrap: anywhere; }
.st-options { display: flex; flex-direction: column; gap: 10px; }
.st-opt { display: flex; align-items: center; gap: 12px; text-align: left; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-sm); padding: 14px; cursor: pointer; -webkit-tap-highlight-color: transparent; min-width: 0; }
.st-opt:active { opacity: 0.7; }
.st-opt:disabled { cursor: default; }
.st-opt-letter { flex-shrink: 0; width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); color: var(--ink-soft); font-weight: 800; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.st-opt-text { font-size: 15px; font-weight: 500; color: var(--ink); line-height: 1.35; min-width: 0; overflow-wrap: anywhere; }
.st-opt.correct { border-color: var(--green); background: color-mix(in srgb, var(--green) 16%, var(--surface)); }
.st-opt.correct .st-opt-letter { background: var(--green); color: #16321f; }
.st-opt.wrong { border-color: var(--red); background: color-mix(in srgb, var(--red) 14%, var(--surface)); }
.st-opt.wrong .st-opt-letter { background: var(--red); color: #fff; }
.st-opt.idk { border-color: var(--amber); background: color-mix(in srgb, var(--amber) 16%, var(--surface)); }
.st-opt.idk .st-opt-letter { background: var(--amber); color: #16321f; }
.st-opt-idk { margin-top: 10px; border-style: dashed; }
.st-feedback { margin-top: 14px; padding: 13px 14px; border-radius: var(--r-sm); background: var(--surface-2); }
.st-feedback.ok { border-left: 3px solid var(--green); }
.st-feedback.no { border-left: 3px solid var(--red); }
.st-feedback.idk { border-left: 3px solid var(--amber); }
.st-verdict { font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 5px; }
.st-feedback.ok .st-verdict { color: var(--green); }
.st-feedback.no .st-verdict { color: var(--red); }
.st-feedback.idk .st-verdict { color: var(--amber); }
.st-expl { font-size: 14px; line-height: 1.5; color: var(--ink); overflow-wrap: anywhere; white-space: pre-wrap; }
.st-task-btn {
  display: inline-flex; align-items: center; width: auto; min-height: 0;
  margin-top: 8px; padding: 7px 13px; border-radius: 99px; cursor: pointer;
  border: none; background: var(--accent-soft); color: var(--accent);
  font-size: 12.5px; font-weight: 700; letter-spacing: -0.01em; text-align: left;
}
.st-task-btn:disabled { opacity: 0.5; }
.st-result { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 24px 0 8px; gap: 8px; }
