/* ══════════════════════════════════════════════════════════════════
   Diochess — tema visual (carregado por último).
   Paleta escura com tabuleiro verde/creme, botões "3D" verdes,
   barra lateral à esquerda no desktop e tabuleiro dimensionado
   pela altura útil da tela (1366×768, 1280×768, celular).
   ══════════════════════════════════════════════════════════════════ */

:root {
  --bg: #312e2b;
  --bg-deep: #262421;
  --panel: #262522;
  --panel-2: #21201d;
  --panel-border: rgba(255, 255, 255, 0.06);
  --surface: #3c3a37;
  --surface-hover: #4a4744;
  --text: #ffffff;
  --text-2: #c3c2c1;
  --text-3: #8b8987;
  --green: #81b64c;
  --green-hover: #a3d160;
  --green-shadow: #45753c;
  --red: #e02828;
  --sq-light: #ebecd0;
  --sq-dark: #739552;
  --hl-light: #f5f682;
  --hl-dark: #b9ca43;
  --rail-w: 168px;
  --topbar-h: 52px;
  --gap: 16px;
  --panel-w: 360px;

  /* Tamanho do tabuleiro: limitado pela altura útil e pela largura. */
  --board-size: min(
    calc(100vh - var(--topbar-h) - 96px),
    calc(100vw - var(--rail-w) - var(--panel-w) - 72px)
  );
  --sq-size: calc(var(--board-size) / 8);
}

@supports (height: 100dvh) {
  :root {
    --board-size: min(
      calc(100dvh - var(--topbar-h) - 96px),
      calc(100vw - var(--rail-w) - var(--panel-w) - 72px)
    );
  }
}

html { -webkit-text-size-adjust: 100%; }

body,
body.app-layout {
  background: var(--bg);
  color: var(--text-2);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body.app-layout { height: 100vh; }
@supports (height: 100dvh) { body.app-layout { height: 100dvh; } }

a { color: inherit; }

/* ── Topbar ─────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--bg-deep);
  border-bottom: 1px solid rgba(0, 0, 0, 0.35);
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  padding: 0 1rem;
}

.logo-text {
  background: none;
  -webkit-text-fill-color: #fff;
  color: #fff;
  filter: none;
  font-size: 1.25rem;
  letter-spacing: -0.2px;
}
.brand img { filter: none; }

.user-nav-link { color: var(--text-2); font-weight: 600; }
.user-nav-link:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }

.auth-nav { gap: 0.5rem; }
.auth-nav a,
.btn-logout {
  color: #fff;
  background: var(--surface);
  border: none;
  border-radius: 6px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
  font-weight: 700;
  padding: 0.45rem 0.9rem;
}
.auth-nav a:hover,
.btn-logout:hover {
  background: var(--surface-hover);
  color: #fff;
  border: none;
  transform: none;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35);
}
.auth-nav a[href="/signup/request"] {
  background: var(--green);
  box-shadow: 0 3px 0 var(--green-shadow);
}
.auth-nav a[href="/signup/request"]:hover { background: var(--green-hover); }

.lang-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-2);
}
.lang-btn:hover { background: rgba(255, 255, 255, 0.06); border-color: transparent; }
.lang-menu { background: var(--panel); border-color: var(--panel-border); }
.lang-option { color: var(--text-2); }
.lang-option:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }

.stat-pill { background: var(--surface); border-color: transparent; }
.stat-pill .label { color: var(--text-3); }
.stat-pill .value { color: #fff; }
.xp-progress-container { background: var(--surface); }
.xp-progress-bar { background: var(--green); }

/* ── Shell ─────────────────────────────────────────────────────── */
.main-content {
  background: var(--bg);
  padding: var(--gap) 20px;
  scroll-behavior: auto;
}

/* Barra lateral fixa à esquerda no desktop (estilo rail). */
@media (min-width: 769px) {
  .user-nav { display: none; }

  .sidebar {
    display: flex;
    position: static;
    transform: none;
    width: var(--rail-w);
    background: var(--panel-2);
    border-right: 1px solid rgba(0, 0, 0, 0.3);
    box-shadow: none;
    overflow-y: auto;
  }

  .sidebar-nav { padding: 0.5rem 0; gap: 0; }
}

.sidebar { background: var(--panel-2); }

.sidebar .nav-item {
  gap: 0.75rem;
  padding: 0.7rem 1rem;
  border-radius: 0;
  color: var(--text-2);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.2;
}
.sidebar .nav-item:hover {
  background: rgba(0, 0, 0, 0.25);
  color: #fff;
  transform: none;
}
.sidebar .nav-item.active {
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
  transform: none;
  box-shadow: inset 3px 0 0 var(--green);
}
.nav-icon {
  width: 1.6rem;
  font-size: 1.25rem;
  text-align: center;
  flex-shrink: 0;
  color: var(--green);
  line-height: 1;
}

@media (max-width: 768px) {
  .sidebar { top: var(--topbar-h); bottom: 0; }
}

/* Rail compacto (só ícones) em larguras médias. */
@media (min-width: 769px) and (max-width: 1099px) {
  :root { --rail-w: 64px; --panel-w: 300px; }
  .sidebar .nav-item { justify-content: center; padding: 0.85rem 0; }
  .sidebar .nav-item .nav-label { display: none; }
}

/* ── Bottombar (celular) ──────────────────────────────────────── */
.bottombar {
  background: var(--bg-deep);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-top: 1px solid rgba(0, 0, 0, 0.4);
  box-shadow: none;
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(60px + env(safe-area-inset-bottom));
}
.bottom-nav { height: 60px; }
.bottom-nav .nav-item { color: var(--text-3); font-weight: 700; }
.bottom-nav .nav-item.active,
.bottom-nav .nav-item:hover { color: #fff; }
.bottom-nav .nav-item.active .icon { color: var(--green); }

/* ── Botões ───────────────────────────────────────────────────── */
.btn {
  border-radius: 8px;
  font-weight: 800;
  font-size: 0.95rem;
  padding: 0.7rem 1rem;
  background: var(--surface);
  color: #fff;
  border: none;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  transition: background-color 0.12s, transform 0.06s, box-shadow 0.06s;
  touch-action: manipulation;
}
.btn:hover { filter: none; background: var(--surface-hover); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }

.btn-confirm,
.btn.primary {
  background: var(--green);
  color: #fff;
  font-size: 1.15rem;
  padding: 0.85rem 1rem;
  box-shadow: 0 4px 0 var(--green-shadow);
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.2);
}
.btn-confirm:hover,
.btn.primary:hover { background: var(--green-hover); }
.btn-confirm:active,
.btn.primary:active { box-shadow: 0 1px 0 var(--green-shadow); }

.btn-nav { background: var(--green); box-shadow: 0 4px 0 var(--green-shadow); font-size: 1.05rem; }
.btn-nav:hover { background: var(--green-hover); }
.btn-reveal,
.btn-toggle,
.btn-skip { background: var(--surface); color: var(--text-2); border: none; }
.btn-reveal:hover,
.btn-toggle:hover,
.btn-skip:hover { background: var(--surface-hover); color: #fff; }

.btn-ai {
  background: #5d4bb7;
  box-shadow: 0 3px 0 #3d2f85;
  color: #fff;
}
.btn-ai:hover { background: #6f5cd0; box-shadow: 0 3px 0 #3d2f85; }

/* ══ Treino ════════════════════════════════════════════════════ */
.round-card {
  background: transparent;
  border: none;
  box-shadow: none;
  max-width: none;
  width: fit-content;
  margin: 0 auto;
}

.pos-meta {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0 0 8px;
  font-size: 0.82rem;
  color: var(--text-3);
}
.pos-id { color: #fff; }
.pos-tags, .target-label { color: var(--text-3); }
.turn-label { color: var(--text-2); font-weight: 700; }
.pos-diff { color: #f7c045; }

.round-body {
  flex-wrap: nowrap;
  gap: var(--gap);
  align-items: flex-start;
}

.board-area { padding: 0; }

.board-shell {
  border-radius: 4px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.35);
  background: transparent;
}

.chess-board {
  width: var(--board-size);
  height: var(--board-size);
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  touch-action: manipulation;
}

.square {
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  transition: none;
}
.square.light { background: var(--sq-light); }
.square.dark { background: var(--sq-dark); }
.square.selectable:hover { filter: none; }
.square.selectable:hover::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 calc(var(--sq-size) * 0.05) rgba(255, 255, 255, 0.65);
  pointer-events: none;
}

/* Seleção: destaque vermelho translúcido, como as marcações de casa. */
.square.selected::after,
.square.selected:hover::after {
  content: "";
  position: absolute;
  inset: 0;
  border: none;
  border-radius: 0;
  background: rgba(235, 97, 80, 0.8);
  box-shadow: none;
  pointer-events: none;
}
.square.selected .piece { z-index: 2; }
.square.selectable:not(:has(.piece)):hover::before { display: none; }

.piece {
  width: 100%;
  height: 100%;
  filter: none;
  transition: none;
}
.square.selectable:hover .piece { transform: none; }

.square.mark-correct { background: #81b64c !important; }
.square.mark-wrong { background: #e05d4b !important; }
.square.mark-missed { background: #f0a43a !important; }
.square.mark-answer { background: #f5d547 !important; }

/* Coordenadas dentro das casas da borda. */
.coord {
  position: absolute;
  font-size: max(10px, calc(var(--sq-size) * 0.2));
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
  user-select: none;
  z-index: 3;
}
.coord-rank { top: 4%; left: 5%; }
.coord-file { bottom: 4%; right: 6%; }
.square.light .coord, .live-square.light .coord { color: var(--sq-dark); }
.square.dark .coord, .live-square.dark .coord { color: var(--sq-light); }

/* Painel de controle ao lado do tabuleiro. */
.control-panel {
  flex: 0 0 var(--panel-w);
  width: var(--panel-w);
  max-width: none;
  min-width: 0;
  min-height: var(--board-size);
  max-height: var(--board-size);
  overflow-y: auto;
  background: var(--panel);
  border: none;
  border-radius: 8px;
  padding: 16px;
  gap: 12px;
}

.instruction-card,
.summary-box {
  background: rgba(0, 0, 0, 0.2);
  border-left: none;
  border-radius: 6px;
  padding: 12px 14px;
  color: var(--text);
  font-size: 1rem;
}
.instruction-card p:first-child { font-weight: 700; }
.instruction-card .hint { color: var(--text-3); font-size: 0.85rem; }
.summary-box.perfect { box-shadow: inset 4px 0 0 var(--green); }
.summary-msg { font-size: 1.1rem; color: #fff; }
.summary-stats { font-size: 0.9rem; }
.stat-hit { color: var(--green); }

.sel-count { color: var(--text-3); font-size: 0.85rem; }
.divider { background: rgba(255, 255, 255, 0.06); }

.anon-login-hint {
  background: rgba(0, 0, 0, 0.18);
  border: none;
  color: var(--text-3);
  font-size: 0.8rem;
}
.anon-login-hint a { color: var(--green); }

.ai-section { background: rgba(0, 0, 0, 0.2); border: none; box-shadow: none; }
.ai-title { color: #b6a7ff; }
.ai-result { border-top-color: rgba(255, 255, 255, 0.08); }
.ai-feedback-msg { color: var(--text-2); }
.ai-pos-card { background: rgba(0, 0, 0, 0.25); }
.legend-chip { border-radius: 4px; }
.lc-correct { background: #81b64c; }
.lc-wrong { background: #e05d4b; }
.lc-missed { background: #f0a43a; }
.lc-answer { background: #f5d547; color: #222; }

/* ── Telas médias / notebooks ─────────────────────────────────── */
@media (max-width: 1099px) and (min-width: 721px) {
  .main-content { padding: 12px; }
}

/* ── Celular / tablet em pé: tabuleiro ocupa a largura toda ───── */
@media (max-width: 720px) {
  :root {
    --rail-w: 0px;
    --board-size: min(calc(100vw - 12px), 620px);
    --topbar-h: 52px;
  }

  .main-content {
    padding: 8px 6px calc(72px + env(safe-area-inset-bottom));
  }

  .round-card { width: 100%; }
  .pos-meta { padding: 2px 4px 8px; font-size: 0.76rem; gap: 0.4rem; }
  .round-body { flex-direction: column; align-items: center; gap: 10px; }
  .board-area { padding: 0; justify-content: center; }
  .board-shell { border-radius: 2px; }

  .control-panel {
    flex: none;
    width: 100%;
    min-height: 0;
    max-height: none;
    overflow: visible;
    padding: 12px;
    border-top: none;
  }

  .btn-confirm, .btn.primary { font-size: 1.05rem; }
}

@media (max-width: 520px) {
  .auth-nav a[href="/signup/request"] { display: none; }
}

/* Tabuleiro com altura muito limitada (paisagem no celular). */
@media (max-height: 520px) and (min-width: 721px) {
  :root { --board-size: calc(100vh - var(--topbar-h) - 48px); }
  .pos-meta { padding-bottom: 4px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* ── Login / solicitação de cadastro ──────────────────────────── */
body .login-card,
body .request-card {
  background: var(--panel);
  border: none;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
body .login-header h1 {
  background: none;
  -webkit-text-fill-color: #fff;
  color: #fff;
}
body .request-header h1 { color: #fff; }
body .form-group input,
body .form-row input {
  background: var(--panel-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
}
body .form-group input:focus,
body .form-row input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 2px rgba(129, 182, 76, 0.25);
  outline: none;
}
body .btn-submit {
  background: var(--green);
  color: #fff;
  border: none;
  box-shadow: 0 4px 0 var(--green-shadow);
  font-weight: 800;
}
body .btn-submit:hover { background: var(--green-hover); transform: none; }
body .login-footer a { color: var(--green); }
body .btn-back { background: var(--surface); color: #fff; border: none; }

/* ── Login com Google ─────────────────────────────────────────── */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  background: #fff;
  color: #1f1f1f;
  font-weight: 700;
  text-decoration: none;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
}
.btn-google:hover { background: #f1f1f1; }
.btn-google:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, 0.35); }
.login-sep {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1rem 0;
  color: var(--text-3);
  font-size: 0.85rem;
}
.login-sep::before, .login-sep::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}
.notice-msg {
  background: rgba(129, 182, 76, 0.12);
  color: #cfe8b4;
  border-radius: 6px;
  padding: 0.7rem 0.85rem;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

/* ══════════════════════════════════════════════════════════════════
   Preferências do tabuleiro (web/static/js/boardprefs.js)
   ══════════════════════════════════════════════════════════════════ */
html.bp-theme-brown { --sq-light: #f0d9b5; --sq-dark: #b58863; --hl-light: #f7ec74; --hl-dark: #dac34b; }
html.bp-theme-blue  { --sq-light: #eae9d2; --sq-dark: #4b7399; --hl-light: #f5f682; --hl-dark: #b9ca43; }
html.bp-theme-gray  { --sq-light: #e3e3e3; --sq-dark: #9a9a9a; --hl-light: #f2f28c; --hl-dark: #c9c95e; }

html.bp-no-coords .coord { display: none; }
html.bp-no-legal .live-square.target::before { display: none; }
html.bp-no-highlight .live-square.light.last:not(.selected) { background-color: var(--sq-light); }
html.bp-no-highlight .live-square.dark.last:not(.selected)  { background-color: var(--sq-dark); }

.side-btn.board-prefs-btn { flex: 0 0 auto; padding-inline: 0.6rem; font-size: 0.95rem; line-height: 1; }

.board-prefs-pop {
  position: fixed;
  z-index: 2000;
  width: 248px;
  padding: 0.75rem;
  border-radius: 8px;
  background: var(--panel-2);
  border: 1px solid var(--panel-border);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
  color: var(--text-2);
  font-size: 0.82rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}
.board-prefs-pop[hidden] { display: none; }
.board-prefs-pop .bp-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
}
.bp-themes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.4rem; margin-bottom: 0.3rem; }
.bp-theme {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.3rem 0.1rem;
  border: 2px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text-3);
  font-size: 0.66rem;
  font-weight: 600;
  cursor: pointer;
}
.bp-theme:hover { background: var(--surface); color: var(--text-2); }
.bp-theme.active { border-color: var(--green); color: var(--text); }
.bp-swatch {
  width: 36px;
  height: 36px;
  border-radius: 3px;
  background: conic-gradient(var(--d) 0 25%, var(--l) 0 50%, var(--d) 0 75%, var(--l) 0);
  background-size: 50% 50%;
}
.bp-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.35rem 0.15rem;
  cursor: pointer;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.bp-toggle input { position: absolute; opacity: 0; pointer-events: none; }
.bp-switch {
  flex: none;
  position: relative;
  width: 32px;
  height: 18px;
  border-radius: 999px;
  background: var(--surface-hover);
  transition: background 0.15s;
}
.bp-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s;
}
.bp-toggle input:checked + .bp-switch { background: var(--green); }
.bp-toggle input:checked + .bp-switch::after { transform: translateX(14px); }
.bp-toggle input:focus-visible + .bp-switch { outline: 2px solid var(--green-hover); outline-offset: 2px; }
.pos-prefs-btn {
  margin-left: auto;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 1rem;
  line-height: 1;
  padding: 0.15rem 0.3rem;
  border-radius: 4px;
  cursor: pointer;
}
.pos-prefs-btn:hover { color: var(--text); background: var(--surface); }

/* ── Polimento de movimento (site todo) ───────────────────────── */
/* Transição suave entre páginas (navegadores com View Transitions entre documentos). */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 160ms ease-in both vt-out; }
::view-transition-new(root) { animation: 220ms cubic-bezier(.2,.8,.2,1) both vt-in; }
@keyframes vt-out { to { opacity: 0; } }
@keyframes vt-in { from { opacity: 0; transform: translateY(6px); } }

/* Conteúdo entra com um leve deslize (só no carregamento; sem efeito depois). */
.main-content > * { animation: page-in 320ms cubic-bezier(.2,.8,.2,1) backwards; }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } }

/* Retorno tátil ao apertar botões. */
.side-btn, .mode-btn, .bot-chip, .btn-action, .btn-primary, .btn-submit, .sbtn, .user-nav-link, .nav-item {
  transition: transform 90ms ease-out, filter 120ms, background-color 120ms, box-shadow 120ms;
}
.side-btn:active:not(:disabled), .mode-btn:active:not(:disabled), .bot-chip:active:not(:disabled),
.btn-action:active:not(:disabled), .btn-primary:active:not(:disabled), .btn-submit:active:not(:disabled),
.sbtn:active:not(:disabled), .nav-item:active {
  transform: translateY(1px) scale(.96);
}
.mode-btn:hover:not(:disabled), .bot-chip:hover:not(:disabled) { filter: brightness(1.1); }

/* Barra de XP: enche ao carregar e tem um brilho correndo. */
.xp-progress-container { position: relative; }
.xp-progress-bar { transform-origin: left; animation: bar-fill 1.1s .25s cubic-bezier(.2,.8,.2,1) backwards; position: relative; }
.xp-progress-bar::after, .power-bar span::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent);
  transform: translateX(-100%); animation: bar-sheen 3.2s 1.4s ease-in-out infinite;
}
.power-bar span { position: relative; overflow: hidden; transform-origin: left; animation: bar-fill 1.2s .35s cubic-bezier(.2,.8,.2,1) backwards; box-shadow: 0 0 10px rgba(245,158,11,.5); }
@keyframes bar-fill { from { transform: scaleX(0); } }
@keyframes bar-sheen { 0% { transform: translateX(-100%); } 40%, 100% { transform: translateX(100%); } }

/* Título de poder com brilho metálico. */
.power-me-top strong {
  background: linear-gradient(90deg, #fde68a, #fff7d6 40%, #f59e0b 60%, #fde68a);
  background-size: 200% 100%; -webkit-background-clip: text; background-clip: text; color: transparent;
  animation: title-shine 4s linear infinite;
}
@keyframes title-shine { to { background-position: -200% 0; } }

/* ── Passe mobile: sem rolagem lateral e alvos de toque ≥ 44px ───────────── */
/* 721–768px: a barra lateral vira gaveta, então o tabuleiro não desconta o rail
   (antes o tabuleiro do treino encolhia para ~140px nessa faixa). */
@media (min-width: 721px) and (max-width: 768px) {
  :root { --rail-w: 0px; --panel-w: 280px; }
}
@media (max-width: 768px) {
  .menu-toggle { flex-shrink: 0; width: 44px; height: 44px; }
  .lang-btn { min-width: 44px; min-height: 44px; justify-content: center; }
  .sidebar .nav-item { min-height: 48px; }
  .bottom-nav .nav-item { flex: 1 1 0; min-width: 44px; min-height: 48px; }
  .pos-prefs-btn { min-width: 44px; min-height: 44px; margin: -12px -10px -12px 0; }
  .control-panel .btn, .btn-confirm { min-height: 44px; }
  .auth-nav a, .btn-logout { min-height: 44px; display: inline-flex; align-items: center; }
}
/* Celular: "Sair" fica na gaveta (☰); o topo não estoura a largura. */
@media (max-width: 520px) {
  .auth-nav form { display: none; }
  .topbar-right { min-width: 0; }
}
html, body { overflow-x: clip; }
@media (max-width: 768px) {
  .brand { min-height: 44px; }
  .mode-btn, .bot-chip, .bot-start, .side-btn, .btn-buy { min-height: 44px; }
  .side-btn { min-width: 44px; }
  /* Botões pequenos dentro de listas: área de toque ampliada sem mudar o layout. */
  .queue-cancel, .live-game-watch { position: relative; }
  .queue-cancel::after, .live-game-watch::after { content: ""; position: absolute; inset: -12px -6px; }
}
@media (max-width: 768px) {
  .bot-chip { min-width: 44px; justify-content: center; }
  /* 641–768px: os links do topo não cabem ao lado do ☰ — a gaveta e a barra de baixo cobrem. */
  .user-nav { display: none; }
}
