/* ---------- Tokens de tema ---------- */
:root {
  --bg: #f4f1ea;
  --surface: #ffffff;
  --surface-2: #f0ebe1;
  --border: #e0d8c8;
  --text: #24211c;
  --text-muted: #6b6457;
  --accent: #2f6f5e;
  --accent-strong: #245a4c;
  --accent-soft: #dcebe5;
  --danger: #b4483a;
  --warning: #a8741a;
  --shadow: 0 1px 2px rgba(40, 30, 10, .06), 0 4px 16px rgba(40, 30, 10, .06);
  --sq-light: #ecdcc0;
  --sq-dark: #b58b63;
  --sev-inaccuracy: #b98a12;
  --sev-mistake: #d26a1e;
  --sev-blunder: #c0392b;
  --sev-missed: #7a4fb5;
  --radius: 12px;
  --sidebar-w: 220px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

:root[data-theme="dark"] {
  --bg: #171a19;
  --surface: #212625;
  --surface-2: #2a302f;
  --border: #353c3a;
  --text: #ece8df;
  --text-muted: #a39d91;
  --accent: #5fb39a;
  --accent-strong: #7cc8b0;
  --accent-soft: #24403a;
  --danger: #e07a6c;
  --warning: #e0b05a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --sq-light: #d9c7a7;
  --sq-dark: #9a7352;
  --sev-inaccuracy: #e0b23a;
  --sev-mistake: #ec8a45;
  --sev-blunder: #ee6b5d;
  --sev-missed: #ad8ae6;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171a19;
    --surface: #212625;
    --surface-2: #2a302f;
    --border: #353c3a;
    --text: #ece8df;
    --text-muted: #a39d91;
    --accent: #5fb39a;
    --accent-strong: #7cc8b0;
    --accent-soft: #24403a;
    --danger: #e07a6c;
    --warning: #e0b05a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --sq-light: #d9c7a7;
    --sq-dark: #9a7352;
  --sev-inaccuracy: #e0b23a;
  --sev-mistake: #ec8a45;
  --sev-blunder: #ee6b5d;
  --sev-missed: #ad8ae6;
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
p { margin: 0 0 .75em; }
a { color: var(--accent); }
.muted { color: var(--text-muted); }
.icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.nav { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 8px;
  color: var(--text-muted); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a[aria-current="page"] { background: var(--accent-soft); color: var(--accent-strong); }
.theme-toggle {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border: 0; border-radius: 8px; background: none;
  color: var(--text-muted); font: inherit; cursor: pointer;
}
.theme-toggle:hover { background: var(--surface-2); color: var(--text); }
#sound-toggle[aria-pressed="true"] .sound-off,
#sound-toggle[aria-pressed="false"] .sound-on { display: none; }
.content { flex: 1; min-width: 0; padding: 28px 32px; outline: none; }

/* ---------- Componentes ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-strong); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 6px 10px; font-size: .9rem; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--text-muted); font-size: .8rem; font-weight: 600; }
.badge.ok { background: var(--accent-soft); color: var(--accent-strong); }
.badge.warn { background: rgba(168, 116, 26, .15); color: var(--warning); }
.alert { border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; border: 1px solid; }
.alert.error { border-color: var(--danger); color: var(--danger); background: rgba(180, 72, 58, .08); }
.alert.warn { border-color: var(--warning); color: var(--warning); background: rgba(168, 116, 26, .08); }
.alert code { color: var(--text); }

.segmented { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 500; color: var(--text-muted); }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); }
.field { margin-bottom: 18px; }
.field > .label { display: block; font-weight: 600; margin-bottom: 6px; }
select {
  font: inherit; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px);
  background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-weight: 500;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100% - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Tabuleiro ---------- */
.board-wrap { width: min(100%, calc(100vh - 64px)); max-width: 760px; position: relative; }
.board { width: 100%; aspect-ratio: 1; position: relative; border-radius: 6px; overflow: hidden; box-shadow: var(--shadow); }
.board .cg-wrap { width: 100%; height: 100%; }
.board cg-board {
  background-color: var(--sq-light);
  background-image: none;
}
.board cg-board::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  /* Casa a8 clara e a1 escura: em cada bloco 2x2, escuras em cima à direita e embaixo à esquerda. */
  background: conic-gradient(transparent 90deg, var(--sq-dark) 90deg 180deg, transparent 180deg 270deg, var(--sq-dark) 270deg);
  background-size: 25% 25%;
}
.board coords { font-weight: 700; font-size: clamp(9px, 1.4vw, 12px) !important; }

.promotion {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(0, 0, 0, .45);
  display: flex; align-items: center; justify-content: center;
}
.promotion .choices { display: flex; gap: 8px; background: var(--surface); padding: 10px; border-radius: 12px; box-shadow: var(--shadow); }
.promotion button { width: 72px; height: 72px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); cursor: pointer; padding: 6px; }
.promotion button:hover { background: var(--accent-soft); }
.promotion piece { display: block; width: 100%; height: 100%; background-size: cover; position: static !important; }

/* ---------- Tela Jogar ---------- */
.play { display: flex; gap: 24px; align-items: flex-start; }
.play .side { flex: 1; min-width: 280px; max-width: 420px; display: flex; flex-direction: column; gap: 16px; }
.player { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.player .name { font-weight: 700; }
.status-line { font-weight: 600; }
.status-line.thinking::after { content: ""; display: inline-block; width: 1em; animation: dots 1.2s steps(4) infinite; overflow: hidden; vertical-align: bottom; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.result-banner { border-radius: 10px; padding: 14px; text-align: center; background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; }
.result-banner.derrota { background: rgba(180, 72, 58, .12); color: var(--danger); }
.result-banner.empate { background: var(--surface-2); color: var(--text); }
.result-banner small { display: block; font-weight: 500; opacity: .85; }

.movelist { max-height: 340px; overflow-y: auto; margin: 0; padding: 0; list-style: none; font-variant-numeric: tabular-nums; }
.movelist li { display: grid; grid-template-columns: 3em 1fr 1fr; padding: 3px 6px; border-radius: 6px; }
.movelist li:nth-child(odd) { background: var(--surface-2); }
.movelist .num { color: var(--text-muted); }
.movelist .san { font-weight: 600; }
.movelist .san.last { color: var(--accent-strong); }
.movelist-empty { color: var(--text-muted); font-style: italic; }
.review-bar { margin-top: 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 10px; border: 2px solid var(--warning); background: rgba(168, 116, 26, .10); }
.review-bar[hidden] { display: none; }
.review-bar .review-text { font-weight: 600; }
.review-bar .review-text small { display: block; font-weight: 400; color: var(--text-muted); }
.review-bar .review-new { color: var(--warning); }
.board-wrap.reviewing .board { filter: saturate(.55) brightness(.97); }

/* ---------- Escolha do adversário ---------- */
.setup { max-width: 980px; }
.opponents { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.opponent-card { position: relative; cursor: pointer; }
.opponent-card input { position: absolute; opacity: 0; pointer-events: none; }
.opponent-body {
  display: flex; flex-direction: column; gap: 6px; height: 100%;
  padding: 12px 14px; border-radius: var(--radius);
  background: var(--surface); border: 2px solid var(--border); box-shadow: var(--shadow);
  font-size: .9rem;
}
.opponent-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 1rem; }
.opponent-card:hover .opponent-body { border-color: var(--text-muted); }
.opponent-card input:checked + .opponent-body { border-color: var(--accent); background: var(--accent-soft); }
.opponent-card input:focus-visible + .opponent-body { outline: 2px solid var(--accent); outline-offset: 2px; }
.setup-options { max-width: 560px; }
.strength-help { margin: 8px 0 0; font-size: .9rem; }
.strength-manual { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.strength-manual input { flex: 1; accent-color: var(--accent); }
.strength-manual output { font-weight: 700; min-width: 3.5em; text-align: right; font-variant-numeric: tabular-nums; }
.opening-line { font-size: .88rem; margin-top: 4px; }
.rating-change { margin-top: 6px; }

/* ---------- Gráficos ---------- */
.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; outline: none; }
.chart svg:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.chart-grid { stroke: var(--border); stroke-width: 1; }
.chart-axis { fill: var(--text-muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-reference { stroke: var(--text-muted); stroke-width: 1; stroke-dasharray: 4 4; opacity: .7; }
.chart-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.chart-cross { stroke: var(--text-muted); stroke-width: 1; }
.chart-tip {
  position: absolute; pointer-events: none; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow);
  border-radius: 8px; padding: 6px 10px; font-size: .85rem;
  display: flex; flex-direction: column; line-height: 1.3;
}
.chart-tip strong { font-size: 1rem; font-variant-numeric: tabular-nums; }
.chart-tip span { color: var(--text-muted); }
.chart-empty { color: var(--text-muted); padding: 24px 0; text-align: center; }

/* Gráfico de avaliação */
.eval-chart { cursor: pointer; }
.eval-white-zone { fill: var(--surface); }
.eval-black-zone { fill: var(--surface-2); }
.eval-area { fill: var(--accent); opacity: .12; }
.eval-cursor { stroke: var(--text); stroke-width: 1.5; }
.eval-mark { stroke: var(--surface); stroke-width: 2; }
.mark-imprecisao { fill: var(--sev-inaccuracy); }
.mark-erro { fill: var(--sev-mistake); }
.mark-erro_grave { fill: var(--sev-blunder); }
.mark-oportunidade_perdida { fill: var(--sev-missed); }

/* Barra de resultados V/E/D */
.wdl { display: flex; height: 10px; border-radius: 5px; overflow: hidden; gap: 2px; background: var(--surface); margin: 8px 0 6px; }
.wdl span { display: block; height: 100%; }
.wdl .w { background: var(--accent); }
.wdl .d { background: var(--text-muted); opacity: .55; }
.wdl .l { background: var(--danger); opacity: .8; }
.wdl-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .85rem; color: var(--text-muted); }
.wdl-legend b { color: var(--text); font-variant-numeric: tabular-nums; }
.key { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.key.w { background: var(--accent); }
.key.d { background: var(--text-muted); opacity: .55; }
.key.l { background: var(--danger); opacity: .8; }

/* Tabelas */
.table { width: 100%; border-collapse: collapse; font-size: .92rem; font-variant-numeric: tabular-nums; }
.table th { text-align: left; font-weight: 600; color: var(--text-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; padding: 6px 8px; border-bottom: 1px solid var(--border); }
.table td { padding: 8px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; }
.table a { color: inherit; font-weight: 600; text-decoration: none; }
.table a:hover { color: var(--accent); }
.table-wrap { overflow-x: auto; }
.outcome { font-weight: 700; }
.outcome.vitoria { color: var(--accent-strong); }
.outcome.derrota { color: var(--danger); }
.outcome.empate { color: var(--text-muted); }
.delta.up { color: var(--accent-strong); }
.delta.down { color: var(--danger); }

/* Painel */
.dash { display: grid; gap: 16px; grid-template-columns: repeat(12, 1fr); }
.dash > * { grid-column: span 12; min-width: 0; }
@media (min-width: 900px) {
  .dash .span-4 { grid-column: span 4; }
  .dash .span-6 { grid-column: span 6; }
  .dash .span-8 { grid-column: span 8; }
}
.stat-label { color: var(--text-muted); font-size: .85rem; }
.stat-value { font-size: 1.9rem; font-weight: 800; line-height: 1.15; font-variant-numeric: tabular-nums; }
.stat-value small { font-size: .95rem; font-weight: 500; color: var(--text-muted); }
.suggestion { border-left: 4px solid var(--accent); }
.suggestion h2 { margin-bottom: 4px; }
.card h2 .badge { margin-left: 6px; vertical-align: 2px; }
.section-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }

/* Análise */
.text-input, .pgn-input {
  font: inherit; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.pgn-input { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: .85rem; resize: vertical; }
.alert.ok { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }
.alert ul { margin: 6px 0 0; padding-left: 1.2em; }
.progress { display: inline-block; width: 120px; height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; vertical-align: middle; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .4s; }
.progress.big { width: 100%; height: 12px; border-radius: 6px; margin: 8px 0; }
.board-with-bar { display: flex; gap: 8px; align-items: stretch; }
.board-with-bar .board { flex: 1; min-width: 0; }
.eval-bar { width: 22px; flex: none; border-radius: 6px; overflow: hidden; position: relative; background: #3a3a3a; display: flex; flex-direction: column-reverse; }
.eval-bar span { display: block; background: #f2f2f2; transition: height .3s; }
.eval-bar b { position: absolute; left: 0; right: 0; bottom: 4px; font-size: 9px; text-align: center; color: #444; font-variant-numeric: tabular-nums; }
.chart-caption { font-size: .82rem; margin: 6px 0 0; }
.sev { font-weight: 700; white-space: nowrap; }
.sev-imprecisao { color: var(--sev-inaccuracy); }
.sev-erro { color: var(--sev-mistake); }
.sev-erro_grave { color: var(--sev-blunder); }
.sev-oportunidade_perdida { color: var(--sev-missed); }
.sev-badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-weight: 700; background: var(--surface-2); }
.sev-badge.sev-imprecisao, .sev-badge.sev-erro, .sev-badge.sev-erro_grave, .sev-badge.sev-oportunidade_perdida { color: #fff; }
.sev-badge.sev-imprecisao { background: var(--sev-inaccuracy); }
.sev-badge.sev-erro { background: var(--sev-mistake); }
.sev-badge.sev-erro_grave { background: var(--sev-blunder); }
.sev-badge.sev-oportunidade_perdida { background: var(--sev-missed); }
.sev-badge.sev-melhor, .sev-badge.sev-teoria { background: var(--accent-soft); color: var(--accent-strong); }
.detail-head { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-bottom: 10px; }
.explain { padding-left: 1.2em; margin: 0 0 8px; display: flex; flex-direction: column; gap: 8px; }
.small-text { font-size: .85rem; }
.analysis-moves { max-height: 260px; }
.analysis-moves sup { font-weight: 800; margin-left: 1px; }
.cls-imprecisao sup { color: var(--sev-inaccuracy); }
.cls-erro sup { color: var(--sev-mistake); }
.cls-erro_grave sup { color: var(--sev-blunder); }
.cls-oportunidade_perdida sup { color: var(--sev-missed); }
.movelist .san.current sup { color: #fff; }
.variation { margin-top: 12px; padding: 10px; border-radius: 10px; background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.variation-moves { display: flex; flex-wrap: wrap; gap: 4px 8px; font-weight: 600; }
.summary-table td { padding: 4px 6px; }
.reinforce-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.reinforce-list li { display: flex; justify-content: space-between; gap: 12px; }

/* Visualizador */
.viewer-nav { display: flex; gap: 6px; justify-content: center; }
.movelist .san.clickable { cursor: pointer; border-radius: 4px; padding: 0 4px; margin: 0 -4px; }
.movelist .san.clickable:hover { background: var(--accent-soft); }
.movelist .san.current { background: var(--accent); color: #fff; }

/* ---------- Início ---------- */
.rating-card { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 32px; margin-bottom: 16px; }
.rating-number { font-size: 2rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.rating-number .muted { font-size: 1rem; font-weight: 500; }
.hero { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.module-card h2 { display: flex; align-items: center; gap: 10px; }
.module-card .badge { margin-bottom: 8px; }
.placeholder { max-width: 680px; }
.placeholder ul { padding-left: 1.2em; }

/* ---------- Responsivo ---------- */
@media (max-width: 1200px) and (min-width: 721px) {
  /* Menu só com ícones, para sobrar espaço ao tabuleiro. */
  :root { --sidebar-w: 68px; }
  .brand span, .nav a span, .theme-toggle span { display: none; }
  .brand, .nav a, .theme-toggle { justify-content: center; padding-left: 0; padding-right: 0; }
  .content { padding: 24px; }
}
@media (max-width: 1000px) {
  .play { flex-direction: column; align-items: stretch; }
  .board-wrap { width: min(100%, 72vh); margin: 0 auto; }
  .play .side { max-width: none; }
}
@media (max-width: 720px) {
  .app { flex-direction: column; }
  .sidebar {
    position: fixed; bottom: 0; top: auto; left: 0; right: 0; z-index: 30;
    width: 100%; height: auto; flex-direction: row; padding: 4px;
    border-right: 0; border-top: 1px solid var(--border);
  }
  .brand, .theme-toggle span { display: none; }
  .nav { flex-direction: row; justify-content: space-around; }
  .nav a { flex-direction: column; gap: 2px; padding: 6px 4px; font-size: .68rem; }
  .theme-toggle { padding: 6px; }
  .content { padding: 16px 16px 84px; }
}

/* Crédito do autor, no pé do menu lateral. Some quando o menu fica só com ícones. */
.credit { margin: 10px 0 0; padding: 0 10px; font-size: .72rem; color: var(--text-muted, var(--muted, #888)); }
@media (max-width: 1200px) { .credit { display: none; } }

/* Tutor (tela de jogo) */
.tutor[hidden] { display: none; }
.tutor h2 svg { width: 18px; height: 18px; vertical-align: -3px; }
.tutor-intro { margin: 0 0 10px; }
.tutor-warn { margin: 0 0 10px; color: var(--warning); }
.tutor-wait { display: block; margin-top: 6px; }
.tutor-step { margin-bottom: 12px; }
.tutor-step h3 { font-size: 0.95rem; margin: 0 0 6px; }
.tutor-step p { margin: 0 0 6px; line-height: 1.45; }

/* ---------- Contas: tela de entrada, conta no menu e administração ---------- */
.login-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: min(100%, 420px); text-align: center; padding: 28px 24px; }
.login-brand { display: flex; align-items: center; justify-content: center; gap: 12px; font-size: 1.5rem; font-weight: 800; margin-bottom: 12px; }
.login-card .alert { text-align: left; }
.google-btn { display: inline-flex; align-items: center; justify-content: center; gap: 12px; width: 100%; padding: 12px 16px; font-weight: 600; text-decoration: none; color: var(--text); margin: 8px 0 12px; }
.google-mark { width: 20px; height: 20px; flex: none; }
.login-credit { display: block !important; margin-top: 18px; }

.account { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 8px; }
.account-info { display: flex; flex-direction: column; padding: 4px 12px 6px; min-width: 0; }
.account-name { font-weight: 600; font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-email { color: var(--text-muted); font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account .theme-toggle { width: 100%; }

.admin-form .text-input { flex: 1 1 220px; min-width: 0; }
.table-scroll { overflow-x: auto; }
.table td.right { text-align: right; }

@media (max-width: 1200px) and (min-width: 721px) {
  .account-info { display: none; }
  .account .theme-toggle { justify-content: center; padding-left: 0; padding-right: 0; }
}
@media (max-width: 720px) {
  .account { border-top: 0; margin: 0; padding: 0; display: flex; align-items: center; }
  .account-info, .account .theme-toggle span { display: none; }
  .account .theme-toggle { width: auto; }
}
@media (max-width: 720px) {
  /* Com "Contas" e "Sair", os botões podem passar da largura: a barra rola na horizontal. */
  .sidebar { overflow-x: auto; scrollbar-width: none; }
  .sidebar::-webkit-scrollbar { display: none; }
  .nav { flex: 1 0 auto; }
}

/* ---------- Treinar (Fase 5) ---------- */
.train-tabs { margin-bottom: 18px; }
.train-tabs a { display: block; padding: 7px 16px; border-radius: 8px; color: var(--text-muted); font-weight: 600; text-decoration: none; }
.train-tabs a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.train-resume { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.subject-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.subject-card { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; text-align: left; font: inherit; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: pointer; }
.subject-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.subject-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.subject-name { font-weight: 700; }
.subject-card .progress { width: 100%; height: 6px; }
.small-head { font-size: .95rem; margin: 10px 0 6px; }
.small-head:first-child { margin-top: 0; }
.solution-list { max-height: 220px; }
.solution-list li { grid-template-columns: 3.5em 1fr; }
.solution-list li.voce .san { color: var(--accent-strong); }
.solution-list li.voce .san.current { color: #fff; }
.lesson-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; counter-reset: lesson; }
.lesson-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid transparent; }
.lesson-list li.next { border-color: var(--accent); }
.lesson-list li.done b { color: var(--accent-strong); }
details summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.status-line.end-resolvido { color: var(--accent-strong); }
.status-line.end-errou { color: var(--danger); }
.section-title .badge { white-space: nowrap; }
.reinforce-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.reinforce-list li > span:first-child { flex: 1; min-width: 0; }
.tree-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 360px; overflow-y: auto; }
.tree-list li { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 4px 6px; border-radius: 6px; }
.tree-list li:hover { background: var(--surface-2); }
.tree-list a { color: var(--text); text-decoration: none; display: flex; flex-direction: column; min-width: 0; }
.variation-moves a { color: var(--text); text-decoration: none; }
.variation-moves a:hover { color: var(--accent); }
