/* StreetChess — sistema visual */
:root {
  --bg: #f4f3ef;
  --bg-2: #ebe9e2;
  --surface: #ffffff;
  --surface-2: #f8f7f3;
  --line: #dedbd2;
  --line-2: #c9c5b9;
  --text: #16171a;
  --text-2: #4b4d55;
  --muted: #7a7c84;
  --brand: #ffc21a;          /* amarelo sinalização */
  --brand-ink: #16171a;
  --brand-2: #e6a800;
  --accent: #2f6fed;
  --ok: #1f9d55;
  --ok-bg: #e3f5ea;
  --bad: #d64545;
  --bad-bg: #fbe7e7;
  --warn: #b7791f;
  --warn-bg: #fdf3dd;
  --info-bg: #e8f0fe;
  --shadow: 0 1px 2px rgba(20, 20, 30, .06), 0 6px 20px rgba(20, 20, 30, .06);
  --shadow-lg: 0 20px 60px rgba(10, 10, 20, .25);
  --radius: 14px;
  --radius-sm: 9px;
  --sq-light: #eeeed2;
  --sq-dark: #769656;
  --sq-sel: rgba(255, 214, 10, .55);
  --sq-last: rgba(255, 214, 10, .38);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", system-ui, sans-serif;
  --side-w: 248px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111215; --bg-2: #17181c; --surface: #1c1d22; --surface-2: #22242a; --line: #2d2f36; --line-2: #3a3d46;
    --text: #f1f1f3; --text-2: #c2c4cc; --muted: #8b8e98; --accent: #6d9bff;
    --ok: #3ccf7a; --ok-bg: #173424; --bad: #ff6b6b; --bad-bg: #3a1c1f; --warn: #f0b64a; --warn-bg: #3a2e14; --info-bg: #1b2640;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111215; --bg-2: #17181c; --surface: #1c1d22; --surface-2: #22242a; --line: #2d2f36; --line-2: #3a3d46;
  --text: #f1f1f3; --text-2: #c2c4cc; --muted: #8b8e98; --accent: #6d9bff;
  --ok: #3ccf7a; --ok-bg: #173424; --bad: #ff6b6b; --bad-bg: #3a1c1f; --warn: #f0b64a; --warn-bg: #3a2e14; --info-bg: #1b2640;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);
  color-scheme: dark;
}
:root[data-board="blue"] { --sq-light: #dee3e6; --sq-dark: #8ca2ad; }
:root[data-board="wood"] { --sq-light: #f0d9b5; --sq-dark: #b58863; }
:root[data-board="street"] { --sq-light: #d9d9d9; --sq-dark: #5b5f66; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.2; margin: 0 0 .5em; letter-spacing: -.01em; }
h1 { font-size: 30px; } h2 { font-size: 22px; } h3 { font-size: 17px; }
p { margin: 0 0 .8em; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg { display: block; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 980px) { .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: minmax(0, 1fr); } }

/* ── Botões e formulários ── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text);
  padding: 9px 16px; border-radius: 10px; font-weight: 600; cursor: pointer; transition: transform .06s, background .15s, border-color .15s; white-space: nowrap; text-decoration: none !important; }
.btn:hover { background: var(--surface-2); border-color: var(--muted); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn.dark { background: var(--text); border-color: var(--text); color: var(--bg); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-bg); border-color: var(--bad); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn.lg { padding: 13px 24px; font-size: 16px; border-radius: 12px; }
.btn.block { width: 100%; }
.ico { width: 18px; height: 18px; flex: none; display: inline-block; vertical-align: -3px; }
label.field { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 13px; color: var(--text-2); }
.input, select.input, textarea.input { width: 100%; background: var(--surface); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; font-weight: 400; font-size: 15px; color: var(--text); outline: none; transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px rgba(255, 194, 26, .25); }
textarea.input { min-height: 90px; resize: vertical; line-height: 1.5; }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--brand-2); }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: var(--surface); }
.seg button { border: 0; background: transparent; padding: 8px 14px; font-weight: 600; cursor: pointer; color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--text); color: var(--bg); }

/* ── Cartões ── */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card.flat { box-shadow: none; }
.card h2, .card h3 { margin-top: 0; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-title h2, .card-title h3 { margin: 0; }
.stat { display: flex; flex-direction: column; gap: 2px; }
.stat .v { font-family: var(--font-display); font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 13px; font-weight: 500; }
.stat .d { font-size: 12px; font-weight: 600; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--bg-2); color: var(--text-2); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.brand { background: var(--brand); color: var(--brand-ink); }
.bar { height: 8px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--brand-2); border-radius: 99px; transition: width .4s; }
.bar.ok > i { background: var(--ok); }
.empty { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty .big { font-size: 40px; margin-bottom: 8px; }
.callout { border-radius: 12px; padding: 14px 16px; border: 1px solid var(--line); background: var(--surface-2); }
.callout.tip { background: var(--info-bg); border-color: transparent; }
.callout.key { background: var(--warn-bg); border-color: transparent; }
.callout.ok { background: var(--ok-bg); border-color: transparent; }
.callout.bad { background: var(--bad-bg); border-color: transparent; }
.callout .ct { font-weight: 800; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.callout > :last-child { margin-bottom: 0; }

table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: var(--surface-2); }
.tbl-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }

/* ── Estrutura do app ── */
.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; }
.side { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: #111215; color: #e8e8ea; padding: 18px 14px; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: #fff; text-decoration: none !important; }
.brand .logo { width: 38px; height: 38px; border-radius: 10px; background: var(--brand); display: grid; place-items: center; flex: none; }
.brand .logo svg { width: 28px; height: 28px; }
.brand b { font-family: var(--font-display); font-size: 19px; letter-spacing: -.02em; line-height: 1; }
.brand small { display: block; font-size: 11px; color: #9a9ca5; font-weight: 500; letter-spacing: .02em; margin-top: 3px; }
.nav-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: #6f727c; font-weight: 700; padding: 14px 10px 6px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 9px; color: #c9cad0; font-weight: 600; font-size: 14px; text-decoration: none !important; position: relative; }
.nav a:hover { background: #1d1f24; color: #fff; }
.nav a.on { background: #23252b; color: #fff; }
.nav a.on::before { content: ""; position: absolute; left: -14px; top: 8px; bottom: 8px; width: 4px; border-radius: 0 4px 4px 0; background: var(--brand); }
.nav a svg { width: 19px; height: 19px; flex: none; opacity: .9; }
.nav a .count { margin-left: auto; background: var(--brand); color: #111; font-size: 11px; font-weight: 800; border-radius: 99px; padding: 1px 7px; }
.side-foot { margin-top: auto; padding-top: 16px; border-top: 1px solid #23252b; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; color: #e8e8ea; text-decoration: none !important; }
.me:hover { background: #1d1f24; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--brand); color: #111; display: grid; place-items: center; font-weight: 800; font-size: 14px; flex: none; }
.avatar.lg { width: 64px; height: 64px; font-size: 24px; }
.me .who { min-width: 0; }
.me .who b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me .who span { font-size: 12px; color: #9a9ca5; }
.main { min-width: 0; padding: 28px 32px 60px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head p { margin: 4px 0 0; color: var(--text-2); }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.topbar { display: none; }
.wrap { max-width: 1180px; margin: 0 auto; }
.wrap.narrow { max-width: 820px; }

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 60; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: var(--shadow-lg); }
  .topbar { display: flex; position: sticky; top: 0; z-index: 50; align-items: center; gap: 12px; padding: 10px 16px; background: #111215; color: #fff; }
  .topbar .brand { padding: 0; }
  .topbar button { background: transparent; border: 0; color: #fff; padding: 6px; cursor: pointer; }
  .main { padding: 18px 16px 60px; }
  h1 { font-size: 24px; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; }
}

/* ── Toast e modal ── */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 36px); }
.toast { background: #16171a; color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 500; font-size: 14px; animation: pop .2s ease-out; max-width: 380px; }
.toast.ok { background: #13653a; } .toast.bad { background: #9b2c2c; }
@keyframes pop { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-bg { position: fixed; inset: 0; z-index: 150; background: rgba(10, 10, 15, .55); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--surface); border-radius: 18px; box-shadow: var(--shadow-lg); width: 100%; max-width: 560px; max-height: calc(100vh - 32px); overflow: auto; padding: 24px; }
.modal.wide { max-width: 900px; }
.modal h2 { margin-top: 0; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ── Tabuleiro ── */
.board-wrap { position: relative; width: 100%; max-width: 560px; }
.board { position: relative; width: 100%; aspect-ratio: 1; border-radius: 8px; overflow: hidden; user-select: none; -webkit-user-select: none; touch-action: none; box-shadow: 0 6px 24px rgba(0,0,0,.18); }
.board .sqs { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr); }
.board .sq { position: relative; }
.board .sq.l { background: var(--sq-light); } .board .sq.d { background: var(--sq-dark); }
.board .sq.last::after, .board .sq.sel::after, .board .sq.hl::after, .board .sq.mark::after, .board .sq.good::after, .board .sq.wrong::after, .board .sq.miss::after { content: ""; position: absolute; inset: 0; }
.board .sq.last::after { background: var(--sq-last); }
.board .sq.sel::after { background: var(--sq-sel); }
.board .sq.hl::after { background: rgba(47, 111, 237, .35); }
.board .sq.mark::after { background: rgba(255, 194, 26, .6); box-shadow: inset 0 0 0 3px rgba(0,0,0,.25); }
.board .sq.good::after { background: rgba(31, 157, 85, .55); }
.board .sq.wrong::after { background: rgba(214, 69, 69, .55); }
.board .sq.miss::after { box-shadow: inset 0 0 0 4px rgba(214, 69, 69, .85); }
.board .sq.check { background-image: radial-gradient(circle, #ff3b3b 0%, rgba(231, 0, 0, .75) 30%, rgba(169, 0, 0, 0) 75%); }
.board .sq.dot::before { content: ""; position: absolute; left: 50%; top: 50%; width: 30%; height: 30%; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(20, 20, 20, .22); z-index: 3; pointer-events: none; }
.board .sq.cap::before { content: ""; position: absolute; inset: 4%; border-radius: 50%; border: 5px solid rgba(20, 20, 20, .22); z-index: 3; pointer-events: none; }
.board .sq.hover { box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .65); }
.board .coord { position: absolute; font-size: clamp(8px, 1.6vw, 12px); font-weight: 700; pointer-events: none; z-index: 2; }
.board .coord.f { right: 4%; bottom: 2%; } .board .coord.r { left: 4%; top: 2%; }
.board .sq.l .coord { color: var(--sq-dark); } .board .sq.d .coord { color: var(--sq-light); }
.board .pcs { position: absolute; inset: 0; pointer-events: none; }
.board .pc { position: absolute; width: 12.5%; height: 12.5%; left: 0; top: 0; z-index: 4; transition: transform .18s ease-out, opacity .18s; will-change: transform; }
.board .pc svg { width: 100%; height: 100%; }
.board .pc.drag { transition: none; z-index: 20; filter: drop-shadow(0 6px 8px rgba(0,0,0,.35)); }
.board .pc.fade { opacity: 0; }
.board svg.arrows { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 10; }
.board.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.board .promo { position: absolute; inset: 0; z-index: 30; background: rgba(0,0,0,.55); display: grid; place-items: center; }
.board .promo .opts { display: flex; gap: 8px; background: var(--surface); border-radius: 14px; padding: 10px; box-shadow: var(--shadow-lg); }
.board .promo button { width: 64px; height: 64px; border: 0; border-radius: 10px; background: var(--surface-2); cursor: pointer; padding: 4px; }
.board .promo button:hover { background: var(--brand); }
.board .result-badge { position: absolute; z-index: 25; width: 5.5%; height: 5.5%; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 11px; box-shadow: 0 2px 6px rgba(0,0,0,.35); transform: translate(-40%, -60%); }
.board-caption { font-size: 13px; color: var(--text-2); margin-top: 8px; text-align: center; }

/* ── Aula ── */
.lesson-layout { display: grid; grid-template-columns: minmax(0, 1fr) 260px; gap: 24px; align-items: start; }
@media (max-width: 1180px) { .lesson-layout { grid-template-columns: minmax(0, 1fr); } .lesson-aside { order: -1; } }
.prose { font-size: 16px; line-height: 1.7; }
.prose h3 { margin-top: 1.4em; font-size: 19px; }
.prose ul, .prose ol { padding-left: 1.3em; margin: 0 0 1em; }
.prose li { margin: .25em 0; }
.prose strong { font-weight: 700; }
.lesson-block { margin: 0 0 22px; }
.lesson-board { display: flex; flex-direction: column; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.lesson-board .board-wrap { max-width: 400px; }
.seq-controls { display: flex; gap: 6px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.seq-comment { min-height: 48px; margin-top: 12px; padding: 10px 14px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; width: 100%; max-width: 400px; }
.seq-moves { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 13px; margin-top: 8px; color: var(--text-2); text-align: center; max-width: 400px; line-height: 1.8; }
.seq-moves span { padding: 1px 4px; border-radius: 4px; cursor: pointer; }
.seq-moves span.on { background: var(--brand); color: #111; }
.video-box { position: relative; aspect-ratio: 16/9; background: #000; border-radius: var(--radius); overflow: hidden; margin-bottom: 22px; }
.video-box iframe, .video-box video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.objectives { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.objectives li { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.objectives li::before { content: "✓"; color: var(--ok); font-weight: 800; }
.ex-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.ex-tab { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); font-weight: 700; cursor: pointer; display: grid; place-items: center; font-size: 14px; }
.ex-tab.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--text); }
.ex-tab.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.ex-tab.fail { background: var(--warn); border-color: var(--warn); color: #fff; }

/* ── Exercício ── */
#runner { container-type: inline-size; }
.ex { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 300px); gap: 22px; align-items: start; }
.ex.no-board { grid-template-columns: minmax(0, 1fr); }
.ex-board .board-wrap { margin: 0 auto; }
@container (max-width: 620px) { .ex { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 820px) { .ex { grid-template-columns: minmax(0, 1fr); } }
.ex-panel { display: flex; flex-direction: column; gap: 14px; }
.ex-prompt { font-size: 17px; font-weight: 600; line-height: 1.45; }
.ex-turn { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 14px; }
.ex-turn i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--text); }
.ex-turn i.w { background: #fff; } .ex-turn i.b { background: #111; }
.feedback { border-radius: 12px; padding: 12px 14px; font-weight: 600; font-size: 14px; display: flex; gap: 10px; align-items: flex-start; }
.feedback.ok { background: var(--ok-bg); color: var(--ok); }
.feedback.bad { background: var(--bad-bg); color: var(--bad); }
.feedback.info { background: var(--info-bg); color: var(--accent); }
.feedback .fx { color: var(--text); font-weight: 400; margin-top: 4px; }
.quiz-opts { display: flex; flex-direction: column; gap: 10px; }
.quiz-opt { text-align: left; padding: 13px 16px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--surface); cursor: pointer; font-weight: 500; font-size: 15px; display: flex; gap: 12px; align-items: flex-start; }
.quiz-opt:hover { border-color: var(--text); }
.quiz-opt b { flex: none; width: 26px; height: 26px; border-radius: 8px; background: var(--bg-2); display: grid; place-items: center; font-size: 13px; }
.quiz-opt.ok { border-color: var(--ok); background: var(--ok-bg); }
.quiz-opt.bad { border-color: var(--bad); background: var(--bad-bg); opacity: .8; }
.rating-chip { font-family: var(--font-display); font-weight: 700; }

/* ── Jogo ── */
.play-layout { display: grid; grid-template-columns: minmax(0, 620px) minmax(280px, 1fr); gap: 24px; align-items: start; }
@media (max-width: 980px) { .play-layout { grid-template-columns: minmax(0, 1fr); } }
.player-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 2px; }
.player-bar .pname { display: flex; align-items: center; gap: 10px; font-weight: 700; min-width: 0; }
.player-bar .pname span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-bar .caps { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 1px; }
.player-bar .caps svg { width: 18px; height: 18px; margin-right: -4px; }
.clock { font-family: var(--font-display); font-size: 24px; font-weight: 700; padding: 4px 14px; border-radius: 10px; background: var(--bg-2); min-width: 100px; text-align: center; font-variant-numeric: tabular-nums; }
.clock.run { background: var(--text); color: var(--bg); }
.clock.low { background: var(--bad); color: #fff; }
.movelist { max-height: 340px; overflow-y: auto; font-size: 14px; display: grid; grid-template-columns: 42px 1fr 1fr; border: 1px solid var(--line); border-radius: 12px; }
.movelist .n { background: var(--surface-2); color: var(--muted); padding: 5px 8px; text-align: right; font-size: 13px; }
.movelist .m { padding: 5px 10px; cursor: pointer; font-weight: 600; display: flex; gap: 6px; align-items: center; }
.movelist .m:hover { background: var(--surface-2); }
.movelist .m.on { background: var(--brand); color: #111; }
.movelist .m .tag { font-size: 11px; font-weight: 800; padding: 0 5px; border-radius: 5px; color: #fff; }
.tag.blunder { background: #d64545; } .tag.mistake { background: #e8833a; } .tag.inacc { background: #d4a72c; } .tag.best { background: #1f9d55; }
.evalbar { width: 22px; border-radius: 6px; overflow: hidden; background: #333; position: relative; flex: none; align-self: stretch; }
.evalbar i { position: absolute; left: 0; right: 0; bottom: 0; background: #f4f4f4; transition: height .3s; }
.evalbar span { position: absolute; left: 0; right: 0; font-size: 10px; font-weight: 800; text-align: center; z-index: 2; }
.board-row { display: flex; gap: 10px; }
.level-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
@media (max-width: 520px) { .level-grid { grid-template-columns: repeat(2, 1fr); } }
.level-opt { border: 1.5px solid var(--line-2); border-radius: 12px; padding: 10px; cursor: pointer; background: var(--surface); text-align: left; }
.level-opt b { display: block; font-family: var(--font-display); font-size: 18px; }
.level-opt span { font-size: 12px; color: var(--muted); }
.level-opt.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--text); }
.color-pick { display: flex; gap: 8px; }
.color-pick button { width: 56px; height: 56px; border-radius: 12px; border: 1.5px solid var(--line-2); background: var(--surface); cursor: pointer; padding: 8px; }
.color-pick button.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--text); }

/* ── Curso ── */
.level-card { display: grid; grid-template-columns: 76px 1fr; gap: 18px; align-items: start; }
.level-icon { width: 76px; height: 76px; border-radius: 18px; background: #16171a; display: grid; place-items: center; }
.level-icon svg { width: 58px; height: 58px; }
.module { border: 1px solid var(--line); border-radius: 12px; margin-top: 12px; overflow: hidden; }
.module > summary { list-style: none; cursor: pointer; padding: 12px 16px; display: flex; align-items: center; gap: 12px; font-weight: 700; background: var(--surface-2); }
.module > summary::-webkit-details-marker { display: none; }
.module > summary .chev { margin-left: auto; transition: transform .2s; }
.module[open] > summary .chev { transform: rotate(90deg); }
.lesson-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line); color: var(--text); text-decoration: none !important; }
.lesson-row:hover { background: var(--surface-2); }
.lesson-row .st { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line-2); display: grid; place-items: center; flex: none; font-size: 12px; font-weight: 800; color: var(--muted); }
.lesson-row .st.done { background: var(--ok); border-color: var(--ok); color: #fff; }
.lesson-row .meta { margin-left: auto; display: flex; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }

/* ── Página inicial ── */
.landing { background: #0f1013; color: #f1f1f3; min-height: 100vh; }
.landing a { color: inherit; }
.l-nav { display: flex; align-items: center; justify-content: space-between; padding: 18px 28px; max-width: 1200px; margin: 0 auto; gap: 12px; }
.l-hero { max-width: 1200px; margin: 0 auto; padding: 40px 28px 70px; display: grid; grid-template-columns: 1.1fr .9fr; gap: 48px; align-items: center; }
@media (max-width: 900px) { .l-hero { grid-template-columns: 1fr; padding-top: 10px; } .l-nav { padding: 14px 16px; } .l-hero, .l-sec { padding-left: 16px !important; padding-right: 16px !important; } }
.l-hero h1 { font-size: clamp(38px, 6vw, 68px); line-height: 1; letter-spacing: -.03em; margin-bottom: 18px; }
.l-hero h1 em { font-style: normal; color: var(--brand); }
.l-hero p.lead { font-size: 19px; color: #c2c4cc; max-width: 560px; margin-bottom: 28px; }
.l-hero .board-wrap { max-width: 480px; margin-left: auto; transform: rotate(-2deg); }
.l-tag { display: inline-flex; gap: 8px; align-items: center; background: #1d1f24; border: 1px solid #2d2f36; color: #e8e8ea; padding: 6px 12px; border-radius: 99px; font-size: 13px; font-weight: 600; margin-bottom: 18px; }
.l-tag i { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.l-sec { max-width: 1200px; margin: 0 auto; padding: 60px 28px; }
.l-sec h2 { font-size: clamp(26px, 3.4vw, 38px); letter-spacing: -.02em; }
.l-feat { background: #17181c; border: 1px solid #26282e; border-radius: 18px; padding: 22px; }
.l-feat .ic { width: 44px; height: 44px; border-radius: 12px; background: var(--brand); color: #111; display: grid; place-items: center; margin-bottom: 14px; }
.l-feat .ic svg { width: 24px; height: 24px; }
.l-feat p { color: #a9abb4; margin: 0; font-size: 14px; }
.l-levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 900px) { .l-levels { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 520px) { .l-levels { grid-template-columns: 1fr; } }
.l-level { border-radius: 18px; padding: 22px; background: #17181c; border: 1px solid #26282e; position: relative; overflow: hidden; }
.l-level .n { font-family: var(--font-display); font-size: 13px; color: var(--brand); font-weight: 700; letter-spacing: .08em; }
.l-level svg.pc { width: 70px; height: 70px; position: absolute; right: 10px; top: 10px; opacity: .9; }
.l-level ul { padding-left: 18px; margin: 10px 0 0; color: #a9abb4; font-size: 14px; }
.stripe { height: 10px; background: repeating-linear-gradient(-45deg, var(--brand) 0 18px, #111 18px 36px); }
.l-foot { text-align: center; color: #6f727c; padding: 30px 16px 40px; font-size: 13px; }

.auth-card { max-width: 420px; margin: 0 auto; background: var(--surface); color: var(--text); border-radius: 20px; padding: 28px; box-shadow: var(--shadow-lg); }
.auth-card h2 { margin-bottom: 4px; }

/* ── Gráficos ── */
.spark { width: 100%; height: 120px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 100px; }
.bars > div { flex: 1; background: var(--brand-2); border-radius: 4px 4px 0 0; min-height: 2px; position: relative; }
.bars > div:hover::after { content: attr(data-tip); position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 2px 8px; border-radius: 6px; font-size: 11px; white-space: nowrap; margin-bottom: 4px; }

/* ── Professor / editor ── */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; }
.tabs a { padding: 10px 14px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; }
.tabs a.on { color: var(--text); border-color: var(--brand-2); }
.code-big { font-family: var(--font-display); font-size: 26px; letter-spacing: .15em; font-weight: 700; background: var(--bg-2); padding: 6px 14px; border-radius: 10px; display: inline-block; }
.palette { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.palette button { aspect-ratio: 1; border: 1.5px solid var(--line-2); border-radius: 8px; background: var(--surface-2); cursor: pointer; padding: 3px; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.palette button.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--text); background: var(--brand); }
.block-ed { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--surface-2); }
.block-ed .bh { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.tree { max-height: 360px; overflow: auto; border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.tree .lv { font-weight: 800; margin: 8px 0 4px; }
.tree .md { font-weight: 600; color: var(--text-2); margin: 6px 0 2px 8px; font-size: 13px; }
.tree label { display: flex; gap: 8px; align-items: center; padding: 3px 0 3px 18px; font-size: 14px; cursor: pointer; }
.upload-progress { height: 10px; background: var(--bg-2); border-radius: 99px; overflow: hidden; }
.upload-progress i { display: block; height: 100%; background: var(--ok); width: 0; transition: width .2s; }

.spinner { width: 22px; height: 22px; border: 3px solid var(--line-2); border-top-color: var(--brand-2); border-radius: 50%; animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; min-height: 240px; }
kbd { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--bg-2); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; }
.divider { height: 1px; background: var(--line); margin: 18px 0; }

/* ── Escola atual (menu lateral) ── */
.org-box { display: flex; flex-direction: column; gap: 3px; padding: 10px 10px 12px; margin: 0 0 6px; border: 1px solid #26282e; border-radius: 12px; background: #17181c; }
.org-box label, .org-box > .small:first-child { color: #6f727c; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: 10px; }
.org-box b { color: #fff; font-size: 14px; }
.org-box a { color: var(--brand); }
.org-sel { background: #111215; color: #fff; border: 1px solid #3a3d46; border-radius: 8px; padding: 6px 8px; font-weight: 600; width: 100%; }
.lock { opacity: .55; }
.lesson-row.locked { color: var(--muted); }

.l-prof { padding: 32px; display: grid; grid-template-columns: minmax(0,1.2fr) minmax(0,1fr); gap: 28px; align-items: center; }
@media (max-width: 900px) { .l-prof { grid-template-columns: minmax(0,1fr); padding: 22px; } }
