/* =============================================================================
   Gambito — CSS canônico do produto (CONTRATO §3, CORE_API "Vistas")
   Único arquivo CSS do projeto. Sem CDN, sem framework, sem @import.
   Paleta: navy #0B2A4A · ouro #E8B33A · marfim #F4F1EA · verde #17A97A
           · vermelho #D8422E · grafite #16181D
   Tipografia: Archivo (títulos) / Inter (texto) / mono (relógios, números, PGN)
   Acessibilidade: contraste AA, foco visível, skip-link, prefers-reduced-motion.
   ============================================================================= */

/* ---------------------------------------------------------------- variáveis */
:root {
  --navy: #0B2A4A;
  --navy-700: #0A2340;
  --navy-600: #12395f;
  --navy-100: #dbe5f0;
  --gold: #E8B33A;
  --gold-600: #c9962a;
  --gold-100: #fbf0d4;
  --ivory: #F4F1EA;
  --green: #17A97A;
  --green-100: #dcf5ec;
  --red: #D8422E;
  --red-100: #fbe4e0;
  --graphite: #16181D;
  --grey-900: #24272e;
  --grey-700: #4b5563;
  --grey-500: #6b7280;
  --grey-300: #c9ced6;
  --grey-200: #e2e5ea;
  --grey-100: #eef0f3;
  --white: #ffffff;

  --board-light: #f0d9b5;
  --board-dark: #b58863;
  --board-sel: rgba(232, 179, 58, .55);
  --board-last: rgba(23, 169, 122, .32);
  --board-check: rgba(216, 66, 46, .55);
  --board-hint: rgba(11, 42, 74, .32);

  --font-title: "Archivo", "Segoe UI Semibold", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "JetBrains Mono", "Roboto Mono", Consolas, monospace;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow-1: 0 1px 2px rgba(11, 42, 74, .08), 0 2px 8px rgba(11, 42, 74, .06);
  --shadow-2: 0 6px 24px rgba(11, 42, 74, .14);
  --shadow-3: 0 18px 48px rgba(11, 42, 74, .22);
  --gap: 16px;
  --wrap: 1180px;
  --line: 1.55;
  --focus: 0 0 0 3px rgba(232, 179, 58, .75), 0 0 0 5px rgba(11, 42, 74, .35);
}

/* ----------------------------------------------------------------- reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: var(--line);
  color: var(--graphite);
  background: var(--ivory);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
h1, h2, h3, h4, h5 {
  font-family: var(--font-title);
  color: var(--navy);
  line-height: 1.22;
  margin: 0 0 .55em;
  font-weight: 700;
  letter-spacing: -.011em;
  overflow-wrap: break-word;
}
h1 { font-size: clamp(1.65rem, 1.1rem + 2.2vw, 2.6rem); }
h2 { font-size: clamp(1.32rem, 1rem + 1.4vw, 1.85rem); }
h3 { font-size: clamp(1.12rem, 1rem + .6vw, 1.32rem); }
h4 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--navy-600); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--navy); }
img, svg, video { max-width: 100%; height: auto; display: block; }
ul, ol { margin: 0 0 1em; padding-left: 1.25em; }
li { margin: .28em 0; }
code, pre, kbd, samp { font-family: var(--font-mono); font-size: .92em; }
code { background: var(--grey-100); padding: .1em .38em; border-radius: 5px; }
pre { background: var(--graphite); color: #e8ecf2; padding: 14px 16px; border-radius: var(--radius-sm); overflow: auto; }
hr, .rule { border: 0; border-top: 1px solid var(--grey-200); margin: 22px 0; }
table { border-collapse: collapse; width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--gold-100); color: var(--navy); }

:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 6px; }
@supports not selector(:focus-visible) {
  a:focus, button:focus, input:focus, select:focus, textarea:focus, [tabindex]:focus { box-shadow: var(--focus); }
}

/* ------------------------------------------------------------ utilitários */
.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 18px; }
.wrap-narrow { max-width: 720px; }
main.wrap, main[role="main"] { flex: 1 1 auto; padding-top: 26px; padding-bottom: 40px; }
.grid-2, .grid-3, .grid-4 { display: grid; gap: var(--gap); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-width: 900px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 620px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); } }

.muted { color: var(--grey-500); }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.lead { font-size: 1.08rem; color: var(--grey-700); }
.inline { display: inline-flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form { display: inline-flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.list { list-style: none; padding: 0; margin: 0; }
.list > li { padding: 10px 0; border-bottom: 1px solid var(--grey-200); margin: 0; }
.list > li:last-child { border-bottom: 0; }
.link { background: none; border: 0; padding: 0; color: var(--navy-600); cursor: pointer; text-decoration: underline; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: absolute; left: 12px; top: -60px; z-index: 200;
  background: var(--gold); color: var(--navy); font-weight: 700;
  padding: 10px 16px; border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  transition: top .15s ease;
}
.skip-link:focus { top: 0; }
.codes, .secret, .totp-setup code { font-family: var(--font-mono); letter-spacing: .04em; word-break: break-all; }
.breadcrumbs { list-style: none; display: flex; gap: 8px; flex-wrap: wrap; padding: 0; margin: 0 0 8px; font-size: .86rem; color: var(--grey-500); }
.breadcrumbs li + li::before { content: "›"; margin-right: 8px; color: var(--grey-300); }
.toc { background: var(--white); border: 1px solid var(--grey-200); border-radius: var(--radius); padding: 14px 18px; }
.toc ol { margin: 0; padding-left: 1.1em; }

/* --------------------------------------------------------------- navegação */
.nav {
  position: sticky; top: 0; z-index: 60;
  background: var(--navy);
  color: var(--ivory);
  box-shadow: var(--shadow-2);
}
.nav-inner {
  width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 10px 18px;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ivory); text-decoration: none; }
.brand:hover { color: var(--gold); }
.brand-mark { border-radius: 8px; background: var(--navy-700); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text strong { font-family: var(--font-title); font-size: 1.16rem; letter-spacing: .02em; }
.brand-text em { font-style: normal; color: var(--gold); font-size: .8rem; letter-spacing: .12em; text-transform: uppercase; }
.brand-text small { color: #b9c4d2; font-size: .72rem; letter-spacing: .02em; }
.nav-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.nav-links a {
  color: #dbe5f0; text-decoration: none; padding: 8px 11px; border-radius: var(--radius-sm);
  font-size: .94rem; font-weight: 500;
}
.nav-links a:hover { background: var(--navy-600); color: var(--white); }
.nav-links a.is-active { color: var(--navy); background: var(--gold); font-weight: 700; }
.nav-private { border-left: 1px solid rgba(255, 255, 255, .16); }
.nav-sep { width: 1px; height: 22px; background: rgba(255, 255, 255, .22); }
.nav-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.nav-user { display: inline-flex; align-items: center; gap: 8px; color: #dbe5f0; font-size: .9rem; }
.avatar {
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--gold); color: var(--navy); font-weight: 800; font-size: .78rem;
  font-family: var(--font-title);
}
.nav-toggle {
  display: none; background: var(--navy-600); color: var(--white); border: 1px solid rgba(255, 255, 255, .2);
  border-radius: var(--radius-sm); width: 42px; height: 38px; font-size: 1.2rem; cursor: pointer;
}
@media (max-width: 860px) {
  .nav-toggle { display: inline-block; order: 3; }
  .nav-links { order: 4; flex-basis: 100%; display: none; flex-direction: column; align-items: stretch; }
  .nav.is-open .nav-links { display: flex; }
  .nav-links a { padding: 12px 10px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
  .nav-private { border-left: 0; }
  .nav-actions { order: 2; }
  .nav-sep { display: none; }
}

/* ------------------------------------------------------------------ admin */
.admin-body { background: var(--grey-100); }
.topbar {
  position: sticky; top: 0; z-index: 70; background: var(--navy); color: var(--ivory);
  display: flex; align-items: center; gap: 14px; padding: 9px 16px; box-shadow: var(--shadow-2);
}
.topbar .brand-text { color: var(--ivory); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: #dbe5f0; font-size: .88rem; }
.admin-shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); gap: 0; flex: 1 1 auto; }
.sidenav { background: var(--navy-700); padding: 16px 10px 40px; }
.sidenav-group {
  font-family: var(--font-title); text-transform: uppercase; letter-spacing: .1em;
  font-size: .68rem; color: var(--gold); margin: 18px 8px 6px; font-weight: 700;
}
.sidenav-item {
  display: block; color: #cfd9e6; text-decoration: none; padding: 8px 10px;
  border-radius: var(--radius-sm); font-size: .9rem; margin-bottom: 2px;
}
.sidenav-item:hover { background: var(--navy-600); color: var(--white); }
.sidenav-item.is-active { background: var(--gold); color: var(--navy); font-weight: 700; }
.admin-main { padding: 22px 24px 46px; min-width: 0; background: var(--grey-100); }
.admin-head { display: flex; align-items: baseline; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.admin-head h1 { margin: 0; font-size: 1.5rem; }
.footer-admin { margin-top: auto; }
@media (max-width: 980px) {
  .admin-shell { grid-template-columns: minmax(0, 1fr); }
  .sidenav { display: none; }
  .sidenav.is-open { display: block; }
  .admin-main { padding: 18px 14px 40px; }
}

/* ---------------------------------------------------------------- blank */
.blank-body { background: var(--ivory); }
.blank-head {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 18px; background: var(--navy); color: var(--ivory); flex-wrap: wrap;
}
.blank-head .brand-text { color: var(--ivory); }
.blank-nav { display: flex; align-items: center; gap: 12px; }
.blank-nav a { color: #dbe5f0; text-decoration: none; }
.blank-nav a:hover { color: var(--gold); }
.footer-blank { margin-top: auto; }

/* --------------------------------------------------------------- footer */
.footer { background: var(--graphite); color: #d7dde6; padding: 26px 0 20px; font-size: .88rem; }
.footer a { color: var(--gold); text-decoration: none; }
.footer a:hover { text-decoration: underline; }
.footer-grid {
  width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 18px;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 26px;
}
.footer h2 { color: var(--ivory); font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; margin: 0 0 10px; }
.footer p { margin: 0 0 .7em; }
.footer-links { list-style: none; padding: 0; margin: 0; }
.footer-links li { margin: 0; padding: 3px 0; }
.footer-brand { font-size: .95rem; }
.footer-legal {
  width: 100%; max-width: var(--wrap); margin: 18px auto 0; padding: 14px 18px 0;
  border-top: 1px solid rgba(255, 255, 255, .12); color: #b9c4d2; font-size: .8rem;
}
@media (max-width: 820px) { .footer-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; } }

/* ------------------------------------------------------------------- botões */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--navy); color: var(--white); border: 1px solid var(--navy);
  padding: 10px 17px; border-radius: var(--radius-sm); font-family: var(--font-title);
  font-weight: 600; font-size: .95rem; line-height: 1.15; text-decoration: none; cursor: pointer;
  transition: transform .06s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--navy-600); color: var(--white); box-shadow: var(--shadow-1); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-blocked, .btn:disabled {
  background: var(--grey-200); border-color: var(--grey-300); color: var(--grey-500);
  cursor: not-allowed; box-shadow: none; transform: none;
}
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn-gold:hover { background: var(--gold-600); border-color: var(--gold-600); color: var(--navy); }
.btn-ghost { background: transparent; color: var(--navy); border-color: var(--navy-100); }
.btn-ghost:hover { background: var(--white); border-color: var(--navy); color: var(--navy); }
.btn-danger { background: var(--red); border-color: var(--red); color: var(--white); }
.btn-danger:hover { background: #b8361f; border-color: #b8361f; color: var(--white); }
.btn-sm { padding: 6px 12px; font-size: .84rem; }
.btn-block { display: flex; width: 100%; }
@media (max-width: 420px) { .btn { padding: 11px 14px; } }

/* ------------------------------------------------------------------ cartões */
.card {
  background: var(--white); border: 1px solid var(--grey-200); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-1); margin-bottom: 18px; overflow-wrap: break-word;
}
.card h2, .card h3 { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card .card, .notice .card { box-shadow: none; }
.notice {
  border-left: 4px solid var(--navy); background: var(--white); border-radius: var(--radius-sm);
  padding: 12px 16px; margin-bottom: 14px; box-shadow: var(--shadow-1);
}
.notice-info { border-left-color: var(--navy-600); }
.notice-bad, .notice-error { border-left-color: var(--red); background: var(--red-100); }
.notice-ok { border-left-color: var(--green); background: var(--green-100); }
.notice-warn { border-left-color: var(--gold); background: var(--gold-100); }

/* ------------------------------------------------------------------ tabelas */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius); }
.table { width: 100%; font-size: .93rem; background: var(--white); }
.table caption { text-align: left; font-size: .84rem; color: var(--grey-500); padding: 0 0 8px; }
.table th, .table td { padding: 9px 11px; text-align: left; border-bottom: 1px solid var(--grey-200); vertical-align: top; }
.table thead th {
  background: var(--navy); color: var(--ivory); font-family: var(--font-title); font-weight: 600;
  font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; position: sticky; top: 0;
}
.table tbody tr:nth-child(even) { background: #faf9f5; }
.table tbody tr:hover { background: var(--gold-100); }
.table td.nowrap, .table th.nowrap { white-space: nowrap; }
.table.numeric td, .table.numeric th { font-variant-numeric: tabular-nums; }
@media (max-width: 620px) {
  .table.compactResponsive thead { display: none; }
  .table.compactResponsive tbody tr { display: block; border: 1px solid var(--grey-200); border-radius: var(--radius-sm); margin-bottom: 10px; padding: 6px 10px; }
  .table.compactResponsive td { display: flex; justify-content: space-between; gap: 10px; border: 0; }
  .table.compactResponsive td::before { content: attr(data-rotulo); font-weight: 600; color: var(--grey-700); }
}

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: .76rem;
  font-weight: 700; letter-spacing: .02em; background: var(--grey-100); color: var(--grey-700);
  border: 1px solid var(--grey-200); white-space: nowrap;
}
.badge-info { background: var(--navy-100); color: var(--navy); border-color: #c2d3e6; }
.badge-ok { background: var(--green-100); color: #0e7a58; border-color: #b6e6d3; }
.badge-warn { background: var(--gold-100); color: #8a6516; border-color: #eddcae; }
.badge-bad { background: var(--red-100); color: #a32e1d; border-color: #f2c3ba; }
.pill {
  display: inline-block; padding: 3px 10px; border-radius: 999px; background: rgba(255, 255, 255, .14);
  color: inherit; font-size: .76rem; font-family: var(--font-mono); letter-spacing: .04em;
}
.sidenav .pill, .topbar .pill { background: rgba(255, 255, 255, .16); color: var(--ivory); }
.pager { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 18px 0; }
.pager a, .pager span {
  padding: 6px 11px; border-radius: var(--radius-sm); border: 1px solid var(--grey-200);
  background: var(--white); text-decoration: none; font-size: .88rem; font-variant-numeric: tabular-nums;
}
.pager .is-active, .pager [aria-current="page"] { background: var(--navy); color: var(--white); border-color: var(--navy); font-weight: 700; }
.pager .muted { border: 0; background: transparent; }

/* ------------------------------------------------------------------ stats */
.stat {
  background: var(--white); border: 1px solid var(--grey-200); border-left: 4px solid var(--gold);
  border-radius: var(--radius-sm); padding: 12px 15px; box-shadow: var(--shadow-1);
}
.stat strong, .stat b, .stat .stat-value {
  display: block; font-family: var(--font-title); font-size: 1.5rem; color: var(--navy);
  font-variant-numeric: tabular-nums; line-height: 1.1;
}
.stat span, .stat .stat-label { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--grey-500); }
.stat-ok { border-left-color: var(--green); }
.stat-bad { border-left-color: var(--red); }
.progress, .bar {
  height: 10px; border-radius: 999px; background: var(--grey-200); overflow: hidden; margin: 8px 0;
}
.progress > i, .progress > span, .progress > div, .bar > i, .bar > span, .bar > div {
  display: block; height: 100%; background: var(--gold); border-radius: 999px;
  transition: width .3s ease;
}
.progress.ok > *, .bar.ok > * { background: var(--green); }
.progress.bad > *, .bar.bad > * { background: var(--red); }
.bar { height: 14px; }
.empty {
  border: 1px dashed var(--grey-300); border-radius: var(--radius); padding: 22px 18px;
  color: var(--grey-500); background: #fbfaf7; text-align: center; margin-bottom: 18px;
}
.empty p { margin: 0; }

/* ------------------------------------------------------------------- forms */
.form { background: var(--white); border: 1px solid var(--grey-200); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-1); }
.form > :last-child { margin-bottom: 0; }
.field { margin-bottom: 15px; display: block; }
.field > label, .form label, fieldset label {
  display: block; font-weight: 600; font-size: .87rem; color: var(--navy); margin-bottom: 5px;
}
.field .hint, .hint { display: block; font-size: .8rem; color: var(--grey-500); margin-top: 4px; }
.field small { display: block; color: var(--grey-500); font-size: .8rem; margin-top: 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"],
input[type="date"], input[type="search"], input[type="url"], select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--grey-300); border-radius: var(--radius-sm);
  background: var(--white); color: var(--graphite); transition: border-color .12s ease, box-shadow .12s ease;
}
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--navy-600); outline: none; box-shadow: var(--focus); }
input[aria-invalid="true"], .field.is-error input, .field.is-error textarea, .field.is-error select { border-color: var(--red); background: #fffaf9; }
input[type="checkbox"], input[type="radio"] { width: auto; margin-right: 8px; accent-color: var(--navy); transform: scale(1.12); }
fieldset { border: 1px solid var(--grey-200); border-radius: var(--radius-sm); padding: 14px; margin: 0 0 16px; }
legend { font-weight: 700; color: var(--navy); padding: 0 6px; font-size: .92rem; }
.error { color: #a32e1d; background: var(--red-100); border-left: 3px solid var(--red); padding: 7px 11px; font-size: .85rem; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; margin: 6px 0; }
input:disabled, select:disabled, textarea:disabled { background: var(--grey-100); color: var(--grey-500); cursor: not-allowed; }
input[type="file"] { font-size: .88rem; }
output, .mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 16px; }
.filters .field { margin: 0; min-width: 170px; flex: 1 1 170px; }

/* ------------------------------------------------------------------ flash */
.flash, .flash-ok, .flash-error, .flash-info, .flash-warn {
  padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px;
  border-left: 4px solid var(--navy); background: var(--white); box-shadow: var(--shadow-1); font-size: .93rem;
}
.flash-ok { border-left-color: var(--green); background: var(--green-100); color: #0e5c43; }
.flash-error { border-left-color: var(--red); background: var(--red-100); color: #8f2718; }
.flash-warn { border-left-color: var(--gold); background: var(--gold-100); color: #6d5012; }
.flash-info { border-left-color: var(--navy-600); }
.toast-area {
  position: fixed; right: 16px; bottom: 16px; z-index: 300;
  display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px));
}
.toast {
  background: var(--graphite); color: var(--ivory); padding: 11px 15px; border-radius: var(--radius-sm);
  box-shadow: var(--shadow-3); font-size: .9rem; border-left: 4px solid var(--gold);
  animation: toast-in .18s ease;
}
.toast-ok { border-left-color: var(--green); }
.toast-error { border-left-color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ modal */
.modal {
  position: fixed; inset: 0; z-index: 400; display: flex; align-items: center; justify-content: center;
  background: rgba(11, 42, 74, .55); padding: 18px;
}
.modal[hidden] { display: none; }
.modal > .card, .modal .modal-card {
  background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-3);
  max-width: 520px; width: 100%; max-height: 88vh; overflow: auto; padding: 22px;
}
.modal h2 { margin-top: 0; }
.modal-backdrop { position: fixed; inset: 0; background: rgba(11, 42, 74, .55); z-index: 390; }

/* ------------------------------------------------------------------ tabuleiro */
.board {
  --casas: min(78vh, 100%, 560px);
  display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto;
  gap: 0; width: fit-content; margin: 0 auto 18px; font-family: var(--font-body);
  background: var(--navy-700); padding: 8px; border-radius: var(--radius); box-shadow: var(--shadow-2);
}
.board-grid {
  grid-column: 2; grid-row: 1;
  display: grid; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(8, 1fr);
  width: var(--casas); aspect-ratio: 1 / 1; border: 2px solid var(--navy-700);
}
.board .square, .board .casa, .board > div > .light, .board > div > .dark {
  position: relative; display: grid; place-items: center; padding: 0; border: 0; cursor: grab;
  aspect-ratio: 1 / 1; font-size: clamp(18px, 5.2vw, 44px); line-height: 1; user-select: none;
  background: var(--board-light);
}
.board .dark, .board .square.dark { background: var(--board-dark); }
.board .square:active { cursor: grabbing; }
.board .piece { display: block; color: var(--white); text-shadow: 0 2px 3px rgba(0, 0, 0, .45); pointer-events: none; }
.board .piece.white { color: #fbfbf7; text-shadow: 0 1px 2px rgba(0, 0, 0, .55); }
.board .piece.black { color: #1b1c20; text-shadow: 0 1px 1px rgba(255, 255, 255, .28); }
.board .sel, .board .square.sel { box-shadow: inset 0 0 0 3px var(--gold), inset 0 0 12px rgba(232, 179, 58, .5); }
.board .last, .board .square.last { background-image: linear-gradient(var(--board-last), var(--board-last)); }
.board .check, .board .square.check { box-shadow: inset 0 0 0 3px var(--red), inset 0 0 16px var(--board-check); }
.board .hint::after, .board .square.hint::after {
  content: ""; width: 28%; height: 28%; border-radius: 50%; background: var(--board-hint);
}
.board .hint.has-piece::after, .board .square.hint.has-piece::after { width: 88%; height: 88%; background: transparent; box-shadow: inset 0 0 0 4px var(--board-hint); }
.board-coords-y, .board-coords-x { display: grid; color: #cfd9e6; font-size: .68rem; font-family: var(--font-mono); }
.board-coords-y { grid-column: 1; grid-row: 1; grid-template-rows: repeat(8, 1fr); align-items: center; padding-right: 4px; width: 14px; }
.board-coords-x { grid-column: 2; grid-row: 2; grid-template-columns: repeat(8, 1fr); justify-items: center; padding-top: 4px; }
.board-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; margin-bottom: 14px; font-size: .84rem; color: var(--grey-700); }
.board-legend span { display: inline-flex; align-items: center; gap: 5px; }
.board-legend i { font-style: normal; font-size: 1.25rem; }
.board-sm { --casas: min(46vh, 100%, 320px); }
@media (max-width: 420px) {
  .board { --casas: min(58vh, 92vw, 340px); padding: 5px; }
  .board .square { font-size: 22px; }
}

/* ------------------------------------------------------------------ relógio */
.clock {
  font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 1.7rem;
  background: var(--graphite); color: var(--ivory); padding: 8px 16px; border-radius: var(--radius-sm);
  letter-spacing: .04em; display: inline-block; min-width: 128px; text-align: center;
  border: 2px solid transparent;
}
.clock.active, .clock.is-turn { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 179, 58, .25); }
.clock.low, .clock-low {
  border-color: var(--red); color: #ffe4de; background: #3a120b;
  animation: clock-pulse 1s steps(2, jump-none) infinite;
}
@keyframes clock-pulse {
  0%, 100% { background: #3a120b; color: #ffe4de; }
  50% { background: var(--red); color: #fff; }
}
.clock .clock-suffix { font-size: .7rem; letter-spacing: .1em; display: block; text-transform: uppercase; color: #b9c4d2; }
.moves, .move-list, [data-move-list] {
  font-family: var(--font-mono); font-size: .88rem; max-height: 260px; overflow: auto;
  background: var(--white); border: 1px solid var(--grey-200); border-radius: var(--radius-sm); padding: 10px 12px;
}
.moves li { list-style: none; }
.pgn, [data-pgn-live] { white-space: pre-wrap; word-break: break-word; }

/* ------------------------------------------------------------------ páginas */
.hero {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-700) 55%, #071b30 100%);
  color: var(--ivory); border-radius: var(--radius-lg); padding: clamp(24px, 4vw, 46px);
  margin-bottom: 26px; box-shadow: var(--shadow-2); position: relative; overflow: hidden;
}
.hero h1 { color: var(--white); max-width: 32ch; }
.hero p { color: #dbe5f0; max-width: 62ch; }
.hero .eyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: .16em; font-size: .74rem; font-weight: 700; font-family: var(--font-title); }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.steps { counter-reset: passo; list-style: none; padding: 0; margin: 0 0 18px; display: grid; gap: 12px; }
.steps > li {
  counter-increment: passo; background: var(--white); border: 1px solid var(--grey-200);
  border-radius: var(--radius); padding: 14px 16px 14px 56px; position: relative; box-shadow: var(--shadow-1); margin: 0;
}
.steps > li::before {
  content: counter(passo); position: absolute; left: 14px; top: 12px; width: 30px; height: 30px;
  display: grid; place-items: center; background: var(--gold); color: var(--navy);
  border-radius: 50%; font-weight: 800; font-family: var(--font-title);
}
.prose { max-width: 74ch; }
.prose h2 { margin-top: 1.5em; }
.prose h3 { margin-top: 1.2em; }
.prose blockquote { border-left: 4px solid var(--gold); margin: 0 0 1em; padding: 4px 0 4px 16px; color: var(--grey-700); background: var(--white); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.legal-page main, .legal-page { line-height: 1.7; }
.rating-card { background: var(--white); border: 1px solid var(--grey-200); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow-1); }
.rating-card .rating-value { font-family: var(--font-title); font-size: 1.9rem; color: var(--navy); font-variant-numeric: tabular-nums; }
.rating-card .rating-kind { text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; color: var(--grey-500); }
.ratings { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }
.age-gate, .consent-check {
  background: var(--gold-100); border: 1px solid #eddcae; border-radius: var(--radius); padding: 16px 18px; margin-bottom: 18px;
}
.auth-login, .auth-register, .auth-recover, .auth-age, .recovery-once {
  max-width: 520px; margin: 24px auto 40px;
}
.recovery-once code { display: block; background: var(--graphite); color: var(--ivory); padding: 12px; border-radius: var(--radius-sm); }
.qr img, .qr canvas { margin: 0 auto; }
.academy, .academy-lesson, .clubs, .how, .jovem, .dash, .prizes, .appeals, .support, .privacy, .security, .settings, .ranking { margin-bottom: 26px; }
.dash { display: grid; gap: 18px; grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr); }
@media (max-width: 900px) { .dash { grid-template-columns: minmax(0, 1fr); } }
.seg { display: inline-flex; gap: 4px; background: var(--grey-100); padding: 4px; border-radius: 999px; }
.seg a { padding: 6px 14px; border-radius: 999px; text-decoration: none; color: var(--grey-700); font-size: .88rem; }
.seg a.is-active { background: var(--navy); color: var(--white); font-weight: 600; }
kbd.key { background: var(--grey-100); border: 1px solid var(--grey-300); border-bottom-width: 2px; border-radius: 6px; padding: 1px 6px; }

/* ------------------------------------------------------------- print/estados */
@media print {
  .nav, .sidenav, .topbar, .footer, .btn, .toast-area, .skip-link, .filters, .pager { display: none !important; }
  body { background: #fff; color: #000; }
  .card, .table { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important; animation-iteration-count: 1 !important;
    transition-duration: .001ms !important; scroll-behavior: auto !important;
  }
  .clock-low { animation: none; background: var(--red); color: #fff; }
}
@media (forced-colors: active) {
  .btn, .card, .table th, .table td, .badge, .board .square { border: 1px solid CanvasText; }
}
@media (max-width: 360px) {
  body { font-size: 15px; }
  .wrap { padding: 0 12px; }
  .nav-inner { padding: 8px 12px; gap: 10px; }
  .card, .form { padding: 14px; }
  .clock { font-size: 1.3rem; min-width: 104px; }
  h1 { font-size: 1.5rem; }
}
