/* Minimal, clean UI */
:root{
  --bg:#0b0f17;
  --panel:#111827;
  --card:#0f172a;
  --text:#e5e7eb;
  --muted:#9ca3af;
  --line:rgba(255,255,255,.08);
  --shadow: 0 14px 40px rgba(0,0,0,.35);

  /* Board colors (overridden by themes) */
  --sqLight:#d1d5db;
  --sqDark:#334155;
  --sqDark2:#2b3a52;
  --boardBorder: rgba(0,0,0,.22);

  /* Entorno / moldura (white by default per requirement) */
  --surround1:#ffffff;
  --surround2:#ffffff;
  --surroundChan2:#f3f4f6;

  /* Moldura (espessura para o snapper) */
  --frameT: 34px;
  --coordColor: rgba(60,60,60,.90);
  --coordShadow: 0 1px 0 rgba(255,255,255,.35);
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  height:100%;
  min-height: 100dvh;
  height: 100dvh;
  overflow:hidden; /* evita scroll da página principal */
  display:flex;
  flex-direction:column;
  font: 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Arial;
  background: radial-gradient(1200px 800px at 20% 0%, rgba(34,197,94,.12), transparent 60%),
              radial-gradient(900px 700px at 90% 10%, rgba(59,130,246,.12), transparent 60%),
              var(--bg);
  color:var(--text);
}

/* ---------- App shell (sidebar + content) ---------- */
.app-shell{
  flex: 1 1 auto;
  height: 100%;
  min-height: 0;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px;
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 14px;
  overflow: hidden;
}
.content{
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display:flex;
}
.sidebar{
  min-height: 0;
  overflow: auto;
  padding: 14px 14px 10px;
}
.sidebar-head{margin-bottom:12px}
.side-title{font-weight:900; letter-spacing:.2px; font-size:15px}
.side-sub{font-size:12px; color: var(--muted); margin-top:4px}

.side-nav{display:flex; flex-direction:column; gap:10px}
.side-divider{height:1px; background: var(--line); margin: 4px 0 2px}

.side-btn{
  width: 100%;
  text-align:left;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor:pointer;
}
.side-btn:hover{background: rgba(255,255,255,.07)}
.side-btn:active{transform: translateY(1px)}

.side-submenu{
  margin-top: 8px;
  display:flex;
  flex-direction:column;
  gap:8px;
}
.side-option{
  width: 100%;
  text-align:left;
  padding:10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--text);
  cursor:pointer;
}
.side-option:hover{background: rgba(255,255,255,.07)}
.side-option.active{
  border-color: rgba(255,255,255,.20);
  background: rgba(255,255,255,.09);
}

.side-toggle{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.04);
}
.side-toggle input{transform: translateY(1px)}
.side-field{
  padding:10px 12px;
  border:1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.side-label{font-size:12px; color: var(--muted)}
.side-field select{
  background: rgba(0,0,0,.15);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 10px;
  padding: 6px 10px;
}

.games-panel{margin-top:8px; display:flex; flex-direction:column; gap:10px}
.games-list{display:flex; flex-direction:column; gap:10px}
.game-folder{display:flex; flex-direction:column; gap:8px}
.folder-title{font-size:12px; color: var(--muted); font-weight:800; letter-spacing:.2px}
.game-item{
  width:100%;
  text-align:left;
  padding:10px 12px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  color: var(--text);
  cursor:pointer;
}
.game-item:hover{background: rgba(255,255,255,.07)}
.game-item.active{
  border-color: rgba(34,197,94,.35);
  background: rgba(34,197,94,.10);
}

.sidebar-foot{margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line)}

.sidebar-toggle{
  position:absolute;
  top: 10px;
  left: 10px;
  z-index: 5;
  display:none; /* desktop */
}

.mobile-bar{display:none;}
.mobile-playbar{display:none;}
.btn-moves{white-space:nowrap}

.sidebar-overlay{
  display:none; /* desktop */
}

/* Mobile: sidebar vira drawer */
@media (max-width: 980px){
  body{overflow:hidden}
  .app-shell{
    grid-template-columns: 1fr;
    padding: 8px;
    padding-left: calc(env(safe-area-inset-left) + 8px);
    padding-right: calc(env(safe-area-inset-right) + 8px);
  }
  /* Mobile layout: empilhar barra ☰ + conteúdo */
  .content{display:block;}
  .mobile-bar{
    display:flex;
    align-items:center;
    justify-content:flex-start;
    gap:10px;
    padding: calc(env(safe-area-inset-top) + 4px) 6px 4px;
    margin-bottom: 6px;
  }
  .mobile-bar .sidebar-toggle{
    display:inline-flex !important;
    position:static !important;
    inset:auto !important;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    font-size: 24px;
    padding: 0;
  }

  /* Tabuleiro centralizado e 100% visível no mobile */
  .board-host{justify-content:center;}
  .board-wrap{margin: 0 auto;}

  /* Playbar mobile (seletor + slider) junto aos controles */
  .mobile-playbar{
    display:flex;
    flex-direction:column;
    gap: 10px;
    margin-top: 10px;
  }
  .mobile-playbar .mobile-row{
    display:flex;
    align-items:center;
    gap: 10px;
  }
  #gameSelectMobile{
    flex: 1 1 auto;
    min-width: 0;
    height: 50px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.06);
    color: var(--text);
    outline:none;
  }
  #moveSliderMobile{
    flex: 1 1 auto;
    min-width: 0;
    height: 50px;
  }
  .btn-moves{
    height: 50px;
    padding: 0 16px;
    border-radius: 16px;
    font-size: 15px;
  }
  .mobile-ply{
    min-width: 84px;
    text-align:right;
  }

  /* Aproximar painel de lances do tabuleiro */
  .moves-panel.sheet{
    left: 8px;
    right: 8px;
    bottom: 6px;
    --sheetPeek: 40px;
  }

  .sidebar{
    position: fixed;
    top: 10px;
    bottom: 10px;
    left: 10px;
    width: min(320px, 92vw);
    transform: translateX(-110%);
    transition: transform .22s ease;
    z-index: 50;
  }
  body.sidebar-open .sidebar{transform: translateX(0)}
  .sidebar-toggle{display:inline-flex; position:fixed; top: calc(env(safe-area-inset-top) + 8px); left: calc(env(safe-area-inset-left) + 8px); z-index: 60; width: 46px; height: 46px; padding: 0; border-radius: 16px; font-size: 22px; line-height: 1}
  /* Mobile: compactar espaçamentos e maximizar área útil do tabuleiro */
  .board-panel{gap:10px}

  .sidebar-overlay{
    display:block;
    position: fixed;
    inset:0;
    background: rgba(0,0,0,.45);
    opacity:0;
    pointer-events:none;
    transition: opacity .22s ease;
    z-index: 40;
  }
  body.sidebar-open .sidebar-overlay{
    opacity:1;
    pointer-events:auto;
  }
}

/* PlayOK-like board + pieces (somente visual) */
body.theme-playok{
  --sqLight:#f2f2e1;
  --sqDark:#57aa6a;
  --sqDark2:#4fa260;
  --boardBorder: rgba(0,0,0,.22);
  --surround1:#ffffff;
  --surround2:#ffffff;
  --surroundChan2:#f3f4f6;
}
body.theme-dambo{
  --sqLight:#b3cce3;
  --sqDark:#258ecd;
  --sqDark2:#1f7fb8;
  --boardBorder: rgba(0,0,0,.22);
  --surround1:#ffffff;
  --surround2:#ffffff;
  --surroundChan2:#f3f4f6;
}

body.theme-playok .board{border-radius: 0}
body.theme-playok .square.dark{background: var(--sqDark)}
body.theme-playok .square.light{background: var(--sqLight)}
body.theme-playok .square .dot{background: rgba(0,0,0,.55)}


/* Ajuste fino para ficar mais parecido com os exemplos (cores + bordas) */
body.theme-playok .piece.white{
  --pFace: radial-gradient(circle at 35% 25%, #ffffff, #eef2f6 62%, #e6ebf0 100%);
  --pRim:  #f6f8fb;
  --pInner: rgba(0,0,0,.18);
  color: rgba(0,0,0,.55);
}
body.theme-playok .piece.black{
  --pFace: radial-gradient(circle at 35% 25%, var(--pRedFaceHi), var(--pRedFace) 62%, #c9251d 100%);
  --pRim:  var(--pRedRim);
  --pInner: rgba(255,255,255,.18);
  color: var(--pRedText);
}
/* Rei no estilo PlayOK: anel (em vez do símbolo ♛) */
body.theme-playok .piece.king::after{
  content: "";
  width: 54%;
  height: 54%;
  border-radius: 999px;
  border: 7px solid var(--pKingRingRed);
  box-shadow: inset 0 0 0 3px rgba(0,0,0,.10);
}


/* Rei branco precisa de mais contraste (anel escuro + interno claro) */
body.theme-playok .piece.white.king::after{
  border-color: var(--pKingRingWhite);
  box-shadow: inset 0 0 0 4px rgba(255,255,255,.95), 0 2px 6px rgba(0,0,0,.25);
}

.topbar{
  flex: 0 0 auto;
  display:flex; gap:14px; align-items:center; justify-content:space-between;
  padding:12px 14px;
  background: rgba(15,23,42,.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand{display:flex; gap:10px; align-items:center}
.logo{width:36px;height:36px;display:grid;place-items:center;border-radius:12px;background:rgba(255,255,255,.06);box-shadow: var(--shadow)}
.title{font-weight:800; letter-spacing:.2px}
.subtitle{font-size:12px;color:var(--muted)}
.top-actions{display:flex;gap:8px;align-items:center;flex-wrap:wrap;justify-content:flex-end}
.toggle{display:flex; gap:8px; align-items:center; padding:6px 10px; border:1px solid var(--line); border-radius:12px; background:rgba(255,255,255,.04)}
.toggle-sound{padding:6px 8px}
.toggle-sound span{font-size:12px}
.btn{
  padding:8px 12px;
  border:1px solid var(--line);
  border-radius:12px;
  background:rgba(255,255,255,.04);
  color:var(--text);
  cursor:pointer;
}
.btn:hover{background:rgba(255,255,255,.07)}
.btn:active{transform: translateY(1px)}
.layout{
  flex: 1 1 auto;
  min-height: 0; /* crucial para evitar overflow com flex */
  width: 100%;
  margin: 0;
  padding: 0;
  display:grid;
  grid-template-columns: 1.25fr .75fr;
  gap:14px;
  overflow:hidden; /* sem scroll no wrapper; cada painel pode rolar */
}
@media (max-width: 1100px){
  .layout{
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }
  .moves-panel{
    width: 100%;
    justify-self: stretch;
    max-height: 42vh;
  }
}
.card{
  background: rgba(15,23,42,.78);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 18px;
}
.board-panel{display:flex; flex-direction:column; gap:14px; min-height:0}
.board-host{
  flex: 1 1 auto;
  min-height: 0;
  display:flex;
  align-items:center;
  justify-content:center;
}

.board-wrap{
  position: relative;
  width: calc(var(--boardSize, 520px) + 2*var(--frameT));
  height: calc(var(--boardSize, 520px) + 2*var(--frameT));
  max-width: 100%;
  max-height: 100%;
  margin: 0 auto;
  padding: var(--frameT);
  overflow: visible;
  border-radius: 0;

  /* Entorno branco conforme solicitado */
  background: linear-gradient(180deg, var(--surround1) 0%, var(--surround2) 100%);
  border: 1px solid rgba(0,0,0,.10);
  box-shadow:
    0 18px 55px rgba(0,0,0,.55),
    0 0 0 1px rgba(255,255,255,.12);
}


.board-wrap::before{
  content:"";
  position:absolute;
  inset:0;
  pointer-events:none;

  /* Detalhe de encaixe/junção nos cantos (estilo miter) */
  background:
    /* sombra */
    linear-gradient(45deg, rgba(0,0,0,.42) 0 3px, transparent 3px) 0 0/72px 72px no-repeat,
    linear-gradient(-45deg, rgba(0,0,0,.42) 0 3px, transparent 3px) 100% 0/72px 72px no-repeat,
    linear-gradient(-45deg, rgba(0,0,0,.42) 0 3px, transparent 3px) 0 100%/72px 72px no-repeat,
    linear-gradient(45deg, rgba(0,0,0,.42) 0 3px, transparent 3px) 100% 100%/72px 72px no-repeat,

    /* highlight */
    linear-gradient(45deg, rgba(255,255,255,.20) 0 2px, transparent 2px) 0 0/72px 72px no-repeat,
    linear-gradient(-45deg, rgba(255,255,255,.20) 0 2px, transparent 2px) 100% 0/72px 72px no-repeat,
    linear-gradient(-45deg, rgba(255,255,255,.20) 0 2px, transparent 2px) 0 100%/72px 72px no-repeat,
    linear-gradient(45deg, rgba(255,255,255,.20) 0 2px, transparent 2px) 100% 100%/72px 72px no-repeat;

  box-shadow:
    inset 0 3px 0 rgba(255,255,255,.18),
    inset 0 -7px 12px rgba(0,0,0,.32),
    inset 0 0 0 1px rgba(0,0,0,.35);
}

.board-wrap::after{
  content:"";
  position:absolute;
  pointer-events:none;

  /* "Canal" interno onde o tabuleiro encaixa */
  inset: calc(var(--frameT) - 7px);
  background:
    linear-gradient(180deg, rgba(255,255,255,.18), rgba(0,0,0,.16)),
    linear-gradient(180deg, var(--surround1) 0%, var(--surroundChan2) 100%);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.18),
    inset 0 -2px 8px rgba(0,0,0,.28),
    0 0 0 1px rgba(255,255,255,.10),
    0 0 0 2px rgba(0,0,0,.30);
}

.coords{
  pointer-events:none;
  position:absolute;
  inset:0;
  z-index:4;
}

.coords .files{
  position:absolute;
  left: var(--frameT);
  right: var(--frameT);
  bottom: calc(var(--frameT)/2 - 8px);
  display:grid;
  grid-template-columns: repeat(8, 1fr);
}

.coords .ranks{
  position:absolute;
  top: var(--frameT);
  bottom: var(--frameT);
  left: calc(var(--frameT)/2 - 8px);
  display:grid;
  grid-template-rows: repeat(8, 1fr);
}

.coords .files div,
.coords .ranks div{
  display:flex;
  align-items:center;
  justify-content:center;
  color: var(--coordColor);
  text-shadow: var(--coordShadow);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .4px;
}


/* Moldura do tabuleiro (somente visual; não altera o tamanho do tabuleiro) */


.board{
  width: 100%;
  height: 100%;
  position: relative;
  z-index: 2;
  border-radius: 0;
  overflow:hidden;
  display:grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border: 0;
  box-shadow: var(--shadow);
  background: var(--sqLight);
  transform: translateZ(0);
}
.square{position:relative; display:flex; align-items:center; justify-content:center; user-select:none; min-width:0; min-height:0; overflow:hidden}
.square{transform: translateZ(0)}
.square.light{background: var(--sqLight)}
.square.dark{background: linear-gradient(180deg, var(--sqDark), var(--sqDark2))}
.square .dot{
  width: 9px; height: 9px;
  border-radius: 999px;
  opacity: .0;
  background: rgba(255,255,255,.85);
}
.square.highlight .dot{opacity:.95}
.piece{
  position:absolute;
  left:50%; top:50%;
  transform: translate(-50%,-50%);
  width: 78%;
  height: 78%;
  border-radius: 999px;
  display:grid;
  place-items:center;
  font-weight:900;

  /* Base "disco" (mais parecido com as peças de exemplo) */
  background:
    radial-gradient(circle at 34% 26%, rgba(255,255,255,.28), rgba(255,255,255,0) 36%),
    radial-gradient(circle at 50% 70%, rgba(0,0,0,.22), rgba(0,0,0,0) 58%),
    var(--pFace, #111);
  border: 6px solid var(--pRim, rgba(255,255,255,.12));
  box-shadow:
    0 10px 18px rgba(0,0,0,.55),
    inset 0 2px 2px rgba(255,255,255,.28),
    inset 0 -8px 12px rgba(0,0,0,.30);
}

/* ---- Peças por imagens (pics/*.png) ----
   Quando o JS encontra as imagens, ele adiciona a classe .has-img.
   Se a imagem não existir, a classe é removida e o estilo "desenhado" em CSS volta.
*/
.piece.has-img{
  width: 86%;
  height: 86%;
  border-radius: 0;
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
  display:flex;
  align-items:center;
  justify-content:center;
}
.piece.has-img::before,
.piece.has-img::after{
  content: none !important;
  display:none !important;
}
.piece-img{
  width: 100%;
  height: 100%;
  display:block;
  object-fit: contain;
  user-select:none;
  pointer-events:none;
  -webkit-user-drag:none;
  filter: drop-shadow(0 10px 16px rgba(0,0,0,.45));
}

.piece::before{
  content:"";
  width: 52%;
  height: 52%;
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 25%, rgba(255,255,255,.18), rgba(255,255,255,0) 58%),
    rgba(255,255,255,.02);
  box-shadow:
    inset 0 0 0 2px var(--pInner, rgba(0,0,0,.16)),
    inset 0 6px 10px rgba(0,0,0,.18);
  opacity:.95;
}

.piece.white{
  --pFace: radial-gradient(circle at 35% 25%, #ffffff, #eef2f6 62%, #e6ebf0 100%);
  --pRim:  #f6f8fb;
  --pInner: rgba(0,0,0,.16);
  color: rgba(0,0,0,.55);
}

.piece.black{
  /* no estilo PlayOK (theme-playok) isso vira "vermelha" via vars abaixo */
  --pFace: radial-gradient(circle at 35% 25%, rgba(255,255,255,.18), rgba(2,6,23,.92));
  --pRim: rgba(255,255,255,.12);
  --pInner: rgba(255,255,255,.18);
  color: rgba(255,255,255,.85);
}

/* Padrão (fora do PlayOK): mantém o símbolo ♛ */
.piece.king::after{
  content: "♛";
  font-size: 20px;
  transform: translateY(-1px);
  opacity:.9;
}

/* Efeito de captura: peça esmaece e some */
.piece.fx{
  pointer-events:none;
  z-index: 6;
  transition: opacity 1.05s ease, transform 1.05s ease, filter 1.05s ease;
}
.piece.fx.fade{
  opacity: 0;
  transform: translate(-50%,-50%) scale(.45);
  filter: blur(2px);
}

/* Controles abaixo do tabuleiro */
.board-controls{
  padding:10px 12px;
  /* mantém a mesma largura do tabuleiro */
  width: min(var(--boardSize, 520px), 100%);
  max-width: var(--boardSize, 520px);
  margin: 0 auto;
}
.btn-row{display:flex; gap:8px; align-items:center; flex-wrap:wrap}
.btn-row .spacer{flex:1 1 auto}
.btn.primary{border-color: rgba(34,197,94,.55); background: rgba(34,197,94,.12)}
.btn.primary:hover{background: rgba(34,197,94,.18)}

.small{font-size:12px;color:var(--muted)}
.meta{padding:12px}
.meta-grid{display:grid; grid-template-columns: repeat(3, 1fr); gap:10px}
@media (max-width: 560px){
  .meta-grid{grid-template-columns: repeat(2, 1fr)}
}
.k{font-size:11px;color:var(--muted)}
.v{font-weight:700}
.loaders{padding:12px; display:grid; gap:12px}
.loader .h{font-weight:800; margin-bottom:6px}

/* ----------------- Modo Treino (tático) ----------------- */
.train-row{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:8px;
  flex-wrap:wrap;
}
.train-toggle{
  display:inline-flex;
  align-items:center;
  gap:8px;
  cursor:pointer;
  user-select:none;
  font-size:13px;
  color: var(--text);
}
.train-toggle input{
  accent-color: var(--accent);
}
.train-status{
  flex: 1 1 auto;
  min-width: 140px;
  padding: 6px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
}
.train-status.ok{
  border-color: rgba(52,211,153,.55);
}
.train-status.err{
  border-color: rgba(251,113,133,.6);
}

body.training .square{ cursor:pointer; }

.square.selected{
  outline: 3px solid rgba(52,211,153,.95);
  outline-offset: -3px;
}

.square.path{
  outline: 2px solid rgba(255,255,255,.22);
  outline-offset: -3px;
}
.square.wrong{
  outline: 3px solid rgba(251,113,133,.9);
  outline-offset: -3px;
  animation: sqShake .22s linear 1;
}
@keyframes sqShake{
  0%{ transform: translateZ(0) translateX(0); }
  25%{ transform: translateZ(0) translateX(-2px); }
  50%{ transform: translateZ(0) translateX(2px); }
  75%{ transform: translateZ(0) translateX(-1px); }
  100%{ transform: translateZ(0) translateX(0); }
}

.hint{font-size:12px;color:var(--muted); margin-top:6px}
.row{display:flex; gap:8px}
input[type="file"], input[type="text"]{
  width:100%;
  padding:10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
}
.moves-panel{
  padding:10px;
  display:flex;
  flex-direction:column;
  min-height: 0;
  overflow:hidden;
  justify-self: end;
  /* proporcional ao tabuleiro (ajustado via JS em --boardSize) */
  width: min(440px, calc(var(--boardSize, 520px) * .92));
}

.ad-banner{
  flex: 0 0 auto;
  min-height: 65px;
  padding: 8px 10px 4px;
  border-bottom: 1px solid var(--line);
  background: rgba(255,255,255,.03);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}
.ad-slot{
  display: inline-flex;
  width: 468px;
  height: 60px;
  vertical-align: top;
  align-items: center;
  justify-content: center;
  background: rgba(128,128,128,.06);
  overflow: hidden;
}
.ad-placeholder{
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 1px dashed rgba(148,163,184,.45);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.15;
  text-align: center;
}
.ad-placeholder strong{
  color: var(--text);
  font-size: 12px;
}
.ad-close{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  margin-left: 6px;
  padding: 0;
  vertical-align: top;
  cursor: pointer;
  border: 0;
  background: transparent;
  color: currentColor;
  opacity: .35;
  font-weight: 900;
  line-height: 1;
}
.ad-close:hover,
.ad-close:focus-visible{
  opacity: .75;
}
.ad-caption{
  margin: 3px 44px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: .55;
  font-size: 12px;
  line-height: 1.2;
}
body.tc-base-layout.ad-interstitial-open{
  overflow: hidden !important;
}
body.tc-base-layout .ad-banner.ad-mobile-interstitial{
  position: fixed !important;
  inset: 0 !important;
  z-index: 1200 !important;
  width: auto !important;
  min-height: 0 !important;
  padding: max(22px, env(safe-area-inset-top)) 14px max(22px, env(safe-area-inset-bottom)) !important;
  border: 0 !important;
  border-radius: 0 !important;
  border-bottom: 0 !important;
  background: rgba(15, 23, 42, .66) !important;
  box-shadow: none !important;
  color: #000 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  overflow: auto !important;
  white-space: normal !important;
}
body.tc-base-layout .ad-banner.ad-mobile-interstitial .ad-slot{
  width: min(336px, calc(100vw - 40px)) !important;
  min-height: 280px !important;
  height: auto !important;
  padding: 14px !important;
  margin: 0 auto !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border-radius: 18px !important;
  background: #fff !important;
  box-shadow: 0 18px 48px rgba(0,0,0,.32) !important;
}
body.tc-base-layout .ad-banner.ad-mobile-interstitial .adsbygoogle{
  width: 300px !important;
  max-width: 100% !important;
  min-height: 250px !important;
  height: auto !important;
}
body.tc-base-layout .ad-banner.ad-mobile-interstitial .ad-close{
  position: fixed !important;
  top: max(12px, env(safe-area-inset-top)) !important;
  right: max(12px, env(safe-area-inset-right)) !important;
  width: 42px !important;
  height: 42px !important;
  margin: 0 !important;
  border-radius: 50% !important;
  background: #fff !important;
  color: #111 !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.24) !important;
  opacity: .96 !important;
  font-size: 17px !important;
}
body.tc-base-layout .ad-banner.ad-mobile-interstitial .ad-caption{
  position: fixed !important;
  left: 16px !important;
  right: 70px !important;
  top: max(22px, env(safe-area-inset-top)) !important;
  margin: 0 !important;
  font-size: 12px !important;
  line-height: 1.2 !important;
  text-align: left !important;
  color: rgba(255,255,255,.82) !important;
}
.mobile-sticky-ad{
  display: none;
}
@media (max-width: 980px){
  body.tc-base-layout .ad-banner .ad-slot,
  body.tc-base-layout .ad-banner .adsbygoogle{
    width: 320px !important;
    max-width: 100% !important;
    height: 50px !important;
  }
}

.moves{flex:1 1 auto; min-height:0; overflow:auto; padding-right:4px}

/* Melhor contraste no select e lista */
select{
  padding:8px 10px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.06);
  color: var(--text);
}
select option{background: #0b1220; color: var(--text)}
.moves-head{display:flex; gap:10px; align-items:center; justify-content:space-between}
.moves-head .h{font-weight:900}
select{
  padding:10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
}
.controls{margin-top:10px}
#moveSlider{width:100%}
.small{font-size:12px;color:var(--muted); margin-top:4px}
.moves{
  margin-top:10px;
  padding:8px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.14);
  overflow:auto;
  flex:1;
  font-size: 13px;
}
.move-row{display:grid; grid-template-columns: 44px 1fr 1fr; gap:8px; padding:6px 8px; border-radius: 12px}
.move-row:hover{background: rgba(255,255,255,.04)}
.move-no{color:var(--muted); font-weight:800}
.move{
  padding:4px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor:pointer;
  white-space: nowrap;
  overflow:hidden;
  text-overflow: ellipsis;
}
.move.active{border-color: rgba(34,197,94,.55); background: rgba(34,197,94,.10)}
.move.missing{opacity:.25; cursor:default}
.notation-flow{
  line-height: 1.85;
}
.notation-line{
  white-space: normal;
  word-break: normal;
}
.notation-flow .move-no{
  display: inline;
  margin-right: 3px;
}
.notation-flow .move{
  display: inline-block;
  vertical-align: baseline;
  margin: 1px 2px;
  max-width: none;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
}
.notation-flow .variation{
  font-style: normal;
}
.notation-flow .notation-comment{
  display: inline;
  margin: 0 2px;
  color: #64748b;
  font-weight: 500;
}
.notation-flow .variation-depth-1,
.notation-flow .variant-depth-1,
.notation-flow .variation-depth-1 .move-no{
  color: #ef4444;
}
.notation-flow .variation-depth-2,
.notation-flow .variant-depth-2,
.notation-flow .variation-depth-2 .move-no{
  color: #2563eb;
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
}
.notation-flow .variation-depth-3,
.notation-flow .variant-depth-3,
.notation-flow .variation-depth-3 .move-no{
  color: #7c3aed;
}
.notation-flow .notation-comment.variant-depth-1,
.notation-flow .notation-comment.variant-depth-2,
.notation-flow .notation-comment.variant-depth-3{
  color: #64748b;
}
.notation-flow .notation-comment.variant-depth-2{
  font-family: Georgia, "Times New Roman", serif;
  font-style: italic;
}
.debug{margin-top:10px}
.debug summary{cursor:pointer;color:var(--muted)}
.debug pre{white-space:pre-wrap; word-break:break-word; color:rgba(255,255,255,.85)}
.footer{
  max-width: 1200px;
  margin: 0 auto 18px;
  padding: 0 14px;
  color: rgba(255,255,255,.5);
  font-size: 12px;
}


/* ----- Controles extras (cores + peças) ----- */
.toggle .toggle-label{font-size:12px;color:var(--muted); font-weight:700}
.toggle select{
  padding:6px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-size: 12px;
}
.toggle input[type="color"]{
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.toggle-color input[type="text"]{
  width: 92px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  font: 12px/1 ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}
.muted{color: var(--muted)}

/* ----- Dialog (Estilo de Peças) ----- */
dialog.dialog{
  border: none;
  padding: 0;
  border-radius: 18px;
  background: transparent;
  width: min(560px, calc(100vw - 28px));
}
dialog.dialog::backdrop{
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(3px);
}
.dialog-card{
  background: rgba(15,23,42,.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  border-radius: 18px;
  overflow: hidden;
}
.dialog-head{
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap: 14px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}
.dialog-title{font-weight: 900; font-size: 16px; letter-spacing: .2px}
.dialog-sub{color: var(--muted); font-size: 12px; margin-top: 2px}
.dialog-body{padding: 14px}
.field{display:grid; gap:6px; margin-bottom:10px}
.field > span{font-size: 12px; color: var(--muted); font-weight: 700}
.field select{width: 100%}


.top-actions .btn{padding:8px 12px}

/* Mobile fine-tuning: maximize board area and avoid clipping on mobile browser UI */
@media (max-width: 520px){
  :root{
    --frameT: 22px; /* thinner surround so the board fits better */
  }
  .app-shell{padding: 8px}
  .board-panel{gap: 10px}
  .board-controls{padding: 12px}
}


/* --- Mobile layout fixes (v2) --- */
/* Corrige alinhamento do painel de lances no mobile (não ficar “encostado à direita”) */
@media (min-width: 981px) and (max-width: 1100px){
  .layout{
    /* garante que os dois painéis dividam a altura do viewport */
    grid-template-columns: 1fr;
    grid-template-rows: 1.35fr 0.95fr;
    height: 100%;
  }
  .moves-panel{
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    justify-self: stretch !important;
    align-self: stretch !important;
  }
}

/* Ajustes finos para telas bem pequenas */
@media (max-width: 560px){
  :root{ --frameT: 18px; }
  .app-shell{ padding: 6px; }
  .board-panel{ gap: 10px; }
  .board-controls{
    width: 100%;
    max-width: none;
  }
  .moves-panel{ padding: 10px; }
  .sidebar-toggle{
    top: calc(env(safe-area-inset-top) + 8px);
    left: calc(env(safe-area-inset-left) + 8px);
  }
}

/* Quando o usuário ativa “Versão para computador” no navegador, evitar micro-board */
@media (min-width: 981px) and (max-width: 1100px) and (pointer: coarse){
  .layout{ grid-template-rows: 1.25fr 1fr; }
}


/* ---------------- Bottom sheet (mobile) ---------------- */
.sheet-overlay{
  display:none;
}

@media (max-width: 980px){
  /* Overlay para fechar ao tocar fora */
  .sheet-overlay{
    display:block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.42);
    opacity: 0;
    pointer-events: none;
    transition: opacity .18s ease;
    z-index: 35;
  }
  body.sheet-open .sheet-overlay{
    opacity: 1;
    pointer-events: auto;
  }

  /* Painel de Jogos/Lances vira bottom-sheet */
  .moves-panel.sheet{
    --sheetPeek: 40px;
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: 8px;
    z-index: 45;

    width: auto !important;
    max-width: none !important;
    max-height: none !important;
    align-self: auto !important;

    height: min(72vh, 640px);
    transform: translateY(calc(100% - var(--sheetPeek)));
    transition: transform .22s ease;
    will-change: transform;
    backdrop-filter: blur(10px);
  }
  /* Quando recolhido no mobile, mostre apenas o cabeçalho (para maximizar o tabuleiro) */
  .moves-panel.sheet:not(.sheet-expanded) #gameSelect,
  .moves-panel.sheet:not(.sheet-expanded) .controls,
  .moves-panel.sheet:not(.sheet-expanded) #moves{
    display:none !important;
  }
  .moves-panel.sheet:not(.sheet-expanded){
    padding: 10px 12px;
  }
  /* Peek mais baixo: esconder botão e centralizar título */
  .moves-panel.sheet:not(.sheet-expanded) .sheet-toggle{ display:none; }
  .moves-panel.sheet:not(.sheet-expanded) .moves-head{ gap: 4px; }
  .moves-panel.sheet:not(.sheet-expanded) .moves-head-row{ justify-content: center; }
  .moves-panel.sheet:not(.sheet-expanded) .moves-head-row .h{ font-size: 14px; opacity: .85; }

  .moves-panel.sheet.sheet-expanded{
    transform: translateY(0);
  }
  .moves-panel.sheet.sheet-dragging{
    transition: none;
  }

  /* Cabeçalho em coluna + handle */
  .moves-head{
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    margin-bottom: 0px;
  }
  .moves-head-row{
    display:flex;
    align-items:center;
    justify-content: space-between;
    gap: 10px;
  }
  .sheet-grab{
    display:block;
    width: 44px;
    height: 5px;
    border-radius: 999px;
    background: rgba(255,255,255,.22);
    margin: 2px auto 0;
  }
  .sheet-toggle{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,.06);
    color: var(--text);
    cursor: pointer;
  ;
    font-size: 18px;
  }
  .sheet-toggle:active{ transform: translateY(1px); }

  /* Reserva um “rodapé” para o tabuleiro/controles não ficarem sob o sheet */
  .layout{
    padding-bottom: calc(var(--sheetPeek, 0px) + 6px);
    /* No mobile com bottom-sheet, NÃO dividir a tela em 2 painéis/linhas (isso encolhe o tabuleiro). */
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr !important;
    /* Evita criar linhas implícitas no grid (o sheet é position:fixed). */
    grid-auto-rows: 0 !important;
    height: 100%;
  }

  .board-panel{ grid-column: 1; grid-row: 1; }
  .moves-panel{ grid-column: 1; grid-row: 1; }

  /* No mobile, mantenha seletor/slider próximos aos controles (usar a playbar do mobile). */
  .moves-panel.sheet #gameSelect,
  .moves-panel.sheet .controls{
    display: none !important;
  }

  .board-controls{
    width: 100%;
    max-width: none;
  }
}

/* Em telas maiores, esconda os elementos do sheet */
@media (min-width: 981px){
  .sheet-grab, .sheet-toggle{ display:none; }
}


/* ---------------- Board fullscreen (mobile UI) ---------------- */
.btn-fullscreen{ display:none; }

@media (max-width: 980px){
  .btn-fullscreen{
    display:inline-flex;
    align-items:center;
    justify-content:center;
    min-width: 40px;
    padding-left: 10px;
    padding-right: 10px;
  }

  /* Modo “Tela cheia do tabuleiro”: esconde menu e bottom-sheet e maximiza área do tabuleiro */
  body.board-fullscreen{
    overflow:hidden;
  }
  /* Em tela cheia do tabuleiro (mobile): esconder o painel de lances, mas manter o menu acessível */
  body.board-fullscreen .sheet-overlay{
    display:none !important;
  }
  body.board-fullscreen .moves-panel{
    display:none !important;
  }
  body.board-fullscreen .layout{
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr !important;
    gap: 0 !important;
    padding-bottom: 0 !important; /* remove reserva do sheet */
  }
  body.board-fullscreen .app-shell{
    padding: calc(env(safe-area-inset-top) + 8px)
             calc(env(safe-area-inset-right) + 8px)
             calc(env(safe-area-inset-bottom) + 8px)
             calc(env(safe-area-inset-left) + 8px) !important;
    gap: 0 !important;
  }
  body.board-fullscreen .board-panel{ gap: 10px; }
  body.board-fullscreen .hint{ display:none; }
  body.board-fullscreen .sidebar-toggle{ display:inline-flex !important; }
}


/* --- Treino (mobile) toast + toggle --- */
.train-toggle-mini{
  margin-left:auto;
  padding:6px 10px;
  border:1px solid var(--line);
  border-radius:12px;
  background: rgba(255,255,255,.04);
  white-space:nowrap;
}
.train-toggle-mini span{font-size:13px}

.train-toast{
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  z-index: 120;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,.14);
  background: rgba(255,255,255,.95);
  color: rgba(0,0,0,.85);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  font-weight: 600;
}
.train-toast.show{opacity:1; transform: translateY(0)}

/* Desktop: posiciona no topo/centro para ficar bem visível */
@media (min-width: 981px){
  .train-toast{
    top: 14px;
    bottom: auto;
    left: 50%;
    right: auto;
    width: min(560px, calc(100% - 40px));
    transform: translate(-50%, 10px);
  }
  .train-toast.show{
    transform: translate(-50%, 0);
  }
}

/* Sucesso: balão claro (como no anexo) */
.train-toast.ok{
  background: rgba(255,255,255,.96);
  color: rgba(0,0,0,.86);
  border-color: rgba(0,0,0,.12);
}

/* Erro: cartão vermelho grande (como no anexo) */
.train-toast.err{
  background: rgba(239,68,68,.92);
  color: rgba(255,255,255,.95);
  border-color: rgba(255,255,255,.20);
  padding: 20px 16px;
  border-radius: 10px;
  font-size: 22px;
  letter-spacing: .2px;
  text-align: center;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:12px;
}
.train-toast.err .icon{ font-size: 26px; line-height: 1; opacity: .95; }
.train-toast.err .text{ display:inline-block; }

/* Botões bloqueados no treino */
.btn.disabled{
  opacity: .45;
  cursor: not-allowed;
}

/* Banner inline no desktop (abaixo do checkbox de treino) */
.train-status:empty{ display:none; }
.train-status{
  flex: 1 1 auto;
  min-width: 160px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  font-weight: 700;
}
.train-status.ok{
  border-color: rgba(34,197,94,.55);
  background: rgba(34,197,94,.14);
}
.train-status.err{
  border-color: rgba(251,113,133,.55);
  background: rgba(239,68,68,.20);
  display:flex;
  align-items:center;
  gap:10px;
}
.train-status.err .icon{ font-size: 18px; line-height: 1; }
.train-status.err .text{ font-weight: 800; }

/* ===== Treino: ocultar anotação e impedir atalhos que entregam solução ===== */
body.training .moves-panel{ display:none !important; }
body.training .layout{ grid-template-columns: 1fr; }
body.training .hint{ display:none !important; }
body.training .sidebar-foot{ display:none !important; }
body.training #btnOpenMoves{ display:none !important; }

/* =========================
   Tema claro (ui-light)
   ========================= */
.sidebar-head-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
}
.theme-toggle{
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor:pointer;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  flex: 0 0 auto;
}
.theme-toggle:hover{ background: rgba(255,255,255,.07); }
.theme-toggle:active{ transform: translateY(1px); }

.theme-toggle-mobile{
  width: 46px;
  height: 46px;
  border-radius: 14px;
  padding: 0;
  font-size: 18px;
}

label.disabled{ opacity: .55; }

body.ui-light{
  --bg:#f5f7ff;
  --panel:#ffffff;
  --card:#ffffff;
  --text:#0b1220;
  --muted:#475569;
  --line: rgba(15,23,42,.16);
  --shadow: 0 14px 36px rgba(2,6,23,.12);
  --coordColor: rgba(20,20,20,.88);
  --coordShadow: 0 1px 0 rgba(255,255,255,0);
}

body.ui-light .card{
  background: rgba(255,255,255,.84);
}
body.ui-light .btn,
body.ui-light .side-btn,
body.ui-light .side-option,
body.ui-light .side-toggle,
body.ui-light .side-field,
body.ui-light .game-item,
body.ui-light .theme-toggle{
  background: rgba(15,23,42,.035);
  border-color: rgba(15,23,42,.14);
  color: var(--text);
}
body.ui-light .btn:hover,
body.ui-light .side-btn:hover,
body.ui-light .side-option:hover,
body.ui-light .side-toggle:hover,
body.ui-light .game-item:hover,
body.ui-light .theme-toggle:hover{
  background: rgba(15,23,42,.06);
}

body.ui-light .side-option.active{
  border-color: rgba(37,99,235,.30);
  background: rgba(37,99,235,.10);
}
body.ui-light .game-item.active{
  border-color: rgba(37,99,235,.30);
  background: rgba(37,99,235,.10);
}

body.ui-light select,
body.ui-light input[type="text"],
body.ui-light input[type="search"]{
  background: rgba(255,255,255,.95);
  color: var(--text);
  border-color: rgba(15,23,42,.18);
}

body.ui-light code{
  background: rgba(15,23,42,.06);
  color: #0b1220;
}

body.ui-light .sidebar-overlay,
body.ui-light .sheet-overlay{
  background: rgba(15,23,42,.45) !important;
}

/* Melhor contraste do texto dos lances no claro */
body.ui-light .moves .move{ background: rgba(15,23,42,.03); }
body.ui-light .moves .move:hover{ background: rgba(15,23,42,.06); }
body.ui-light .moves .move.active{ background: rgba(37,99,235,.10); border-color: rgba(37,99,235,.30); }
body.ui-light .moves{
  background: rgba(15,23,42,.03);
  border-color: rgba(15,23,42,.14);
}
body.ui-light .move-row:hover{ background: rgba(15,23,42,.06); }
body.ui-light .move.active{ border-color: rgba(37,99,235,.30); background: rgba(37,99,235,.10); }
body.ui-light .debug pre{ color: rgba(2,6,23,.88); }
body.ui-light .footer{ color: rgba(2,6,23,.55); }

/* ==========================================================
   Correção das caixas de seleção no tema claro
   Evita fundo escuro/preto no menu aberto dos <select>.
   ========================================================== */
body.ui-light select,
body.ui-light .side-field select,
body.ui-light #gameSelect,
body.ui-light #gameSelectMobile,
body.ui-light #boardStyleSelect,
body.ui-light #playbackSpeed{
  background: #ffffff !important;
  color: #0f172a !important;
  border-color: rgba(15,23,42,.18) !important;
  color-scheme: light;
}

body.ui-light select option,
body.ui-light #gameSelect option,
body.ui-light #gameSelectMobile option,
body.ui-light #boardStyleSelect option,
body.ui-light #playbackSpeed option,
body.ui-light select optgroup{
  background-color: #ffffff !important;
  color: #0f172a !important;
}

body.ui-light select option:checked,
body.ui-light #gameSelect option:checked,
body.ui-light #gameSelectMobile option:checked,
body.ui-light #boardStyleSelect option:checked,
body.ui-light #playbackSpeed option:checked{
  background-color: #dbeafe !important;
  color: #0f172a !important;
}

body.ui-light select:focus,
body.ui-light #gameSelect:focus,
body.ui-light #gameSelectMobile:focus,
body.ui-light #boardStyleSelect:focus,
body.ui-light #playbackSpeed:focus{
  outline: 2px solid rgba(37,99,235,.25);
  outline-offset: 2px;
}

/* ==========================================================
   Layout Base de Estudo aplicado ao Treinamento de Cálculo
   - Menu lateral em gaveta aberta pelo ícone de três traços
   - Tema claro/escuro no canto superior direito
   - Anotação do jogo à direita do tabuleiro
   ========================================================== */
body.tc-base-layout{
  height: 100dvh;
  min-height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(980px 520px at 4% 0%, rgba(34,197,94,.10), transparent 60%),
    linear-gradient(180deg, rgba(255,255,255,.04), rgba(255,255,255,0) 120px),
    var(--bg);
}
body.tc-base-layout .tc-topbar{
  height: 60px;
  flex: 0 0 60px;
  display: grid;
  grid-template-columns: 76px minmax(0,1fr) 86px;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(15,23,42,.80);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 34px rgba(0,0,0,.20);
  position: relative;
  z-index: 70;
}
body.ui-light.tc-base-layout .tc-topbar{
  background: rgba(255,255,255,.90);
}
.tc-topbar h1{
  margin: 0;
  text-align: center;
  font-size: clamp(18px, 2vw, 24px);
  line-height: 1.1;
  letter-spacing: .04em;
  font-weight: 1000;
  color: var(--text);
  text-transform: uppercase;
}
.tc-top-icon{
  width: 52px;
  height: 52px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.86);
  color: #0f172a;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  font-size: 22px;
  justify-self: start;
}
.tc-theme-btn{
  justify-self: end;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: var(--text);
  font-size: 18px;
}
body.ui-light .tc-theme-btn{
  background: rgba(15,23,42,.04);
  color: #0f172a;
}
.tc-top-icon:hover{ filter: brightness(1.04); transform: translateY(-1px); }
.tc-top-icon:active{ transform: translateY(0); }

body.tc-base-layout .app-shell{
  width: 100%;
  max-width: none;
  height: calc(100dvh - 60px);
  min-height: 0;
  padding: 10px 18px 10px;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  overflow: hidden;
}
body.tc-base-layout .content{
  width: 100%;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
}
body.tc-base-layout .layout{
  width: 100%;
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(350px, 34vw) minmax(420px, 1fr);
  gap: 18px;
  align-items: stretch;
  overflow: hidden;
}
body.tc-base-layout .board-panel{
  min-width: 0;
  min-height: 0;
  height: 100%;
  gap: 10px;
  overflow: hidden;
}
body.tc-base-layout .board-host{
  min-height: 0;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
body.tc-base-layout .board-controls{
  flex: 0 0 auto;
  border-radius: 0;
  padding: 8px;
}
body.tc-base-layout .btn-row{
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
body.tc-base-layout .btn-row .btn{
  min-width: 0;
  height: 36px;
  padding: 0 6px;
  border-radius: 3px;
  font-weight: 900;
  white-space: nowrap;
}
body.tc-base-layout .moves-panel{
  min-width: 0;
  min-height: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 0;
  overflow: hidden;
}
body.tc-base-layout .moves-head{
  flex: 0 0 auto;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
body.tc-base-layout .moves-head-row .h{
  font-size: 15px;
  font-weight: 1000;
  letter-spacing: .02em;
  text-transform: uppercase;
}
body.tc-base-layout .controls{
  flex: 0 0 auto;
  padding: 10px;
  border-bottom: 1px solid var(--line);
}
body.tc-base-layout .moves{
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  padding: 10px;
}

/* Gaveta sempre oculta por padrão, em qualquer resolução. */
body.tc-base-layout .sidebar{
  position: fixed !important;
  top: 72px !important;
  left: 12px !important;
  bottom: 12px !important;
  width: min(322px, calc(100vw - 24px));
  max-height: calc(100dvh - 84px);
  z-index: 100;
  transform: translateX(calc(-100% - 24px));
  transition: transform .22s ease;
  overflow: auto;
  border-radius: 16px;
}
body.tc-base-layout.sidebar-open .sidebar{
  transform: translateX(0);
}
body.tc-base-layout .sidebar-overlay{
  display: block;
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0,0,0,.48);
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease;
}
body.tc-base-layout.sidebar-open .sidebar-overlay{
  opacity: 1;
  pointer-events: auto;
}
body.tc-base-layout .mobile-bar{ display: none !important; }
body.tc-base-layout .sidebar-toggle{ display: none !important; }
body.tc-base-layout .sheet-toggle{ display: none; }
body.tc-base-layout .sheet-grab{ display: none; }

/* Contraste dos selects e campos da gaveta em tema claro. */
body.ui-light.tc-base-layout .side-field select,
body.ui-light.tc-base-layout #gameSelect,
body.ui-light.tc-base-layout #gameSelectMobile,
body.ui-light.tc-base-layout #boardStyleSelect,
body.ui-light.tc-base-layout #playbackSpeed{
  background: #fff !important;
  color: #0f172a !important;
}

/* Responsivo: em telas menores o painel de anotação vira sheet como no projeto original. */
@media (max-width: 980px){
  body.tc-base-layout .tc-topbar{
    height: 58px;
    grid-template-columns: 62px 1fr 62px;
    padding: 5px 8px;
  }
  body.tc-base-layout .tc-top-icon{
    width: 48px;
    height: 48px;
  }
  body.tc-base-layout .tc-topbar h1{
    font-size: clamp(15px, 4.5vw, 20px);
  }
  body.tc-base-layout .app-shell{
    height: calc(100dvh - 58px);
    padding: 8px;
  }
  body.tc-base-layout .layout{
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
    gap: 10px;
  }
  body.tc-base-layout .board-controls{
    padding: 8px;
  }
  body.tc-base-layout .btn-row{
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
  }
  body.tc-base-layout .btn-row .btn{
    height: 38px;
    font-size: 13px;
  }
  body.tc-base-layout .btn-fullscreen{ display: inline-flex; }
  body.tc-base-layout .mobile-playbar{ display: flex; }
  body.tc-base-layout .moves-panel.sheet{
    border-radius: 18px 18px 0 0;
  }
  body.tc-base-layout .moves-panel.sheet .sheet-toggle,
  body.tc-base-layout .moves-panel.sheet .sheet-grab{
    display: block;
  }
}
@media (max-width: 560px){
  body.tc-base-layout .app-shell{ padding: 6px; }
  body.tc-base-layout .btn-row{
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  body.tc-base-layout .btn-row .btn{
    font-size: 12.5px;
    padding: 0 4px;
  }
  body.tc-base-layout .train-row{
    flex-wrap: wrap;
  }
}

/* ==========================================================
   v35 — Tabuleiro, botões e responsividade no padrão Base de Estudo
   ========================================================== */
:root{
  --frameT: 22px;
}

/* Corpo e workspace como a Base de Estudo: conteúdo preso ao viewport. */
body.tc-base-layout{
  width: 100%;
  min-width: 0;
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
}
body.tc-base-layout .app-shell{
  max-width: none !important;
  width: 100% !important;
  height: calc(100dvh - 60px) !important;
  min-height: 0 !important;
  padding: 8px 18px 8px !important;
  display: grid !important;
  grid-template-columns: 1fr !important;
  overflow: hidden !important;
}
body.tc-base-layout .content,
body.tc-base-layout .layout{
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  overflow: hidden !important;
}
body.tc-base-layout .layout{
  display: grid !important;
  grid-template-columns: minmax(380px, 470px) minmax(410px, 1fr) !important;
  gap: 8px !important;
  align-items: stretch !important;
}

/* Coluna do tabuleiro: os controles fazem parte do mesmo bloco visual.
   Isso impede que os botões desçam para o rodapé em telas altas. */
body.tc-base-layout .board-panel.local-board-panel,
body.tc-base-layout .board-panel{
  width: 100% !important;
  max-width: 470px !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: flex-start !important;
  gap: 0 !important;
  overflow: hidden !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}
body.tc-base-layout .board-host.local-board-host,
body.tc-base-layout .board-host{
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: flex-start !important;
  gap: 6px !important;
  overflow: hidden !important;
}

/* Estilo exato do tabuleiro da Base de Estudo: moldura verde, coordenadas claras. */
body.tc-base-layout .board-wrap{
  padding: var(--frameT) !important;
  background: var(--sqDark) !important;
  border: 1px solid rgba(255,255,255,.72) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  overflow: visible !important;
}
body.tc-base-layout .board-wrap::before,
body.tc-base-layout .board-wrap::after{
  content: none !important;
  display: none !important;
}
body.tc-base-layout .board{
  border: 1px solid rgba(244,246,226,.82) !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  background: var(--sqLight) !important;
}
body.tc-base-layout .coords .files{
  left: var(--frameT) !important;
  right: var(--frameT) !important;
  bottom: 0 !important;
  height: var(--frameT) !important;
  grid-template-columns: repeat(8, 1fr) !important;
}
body.tc-base-layout .coords .ranks{
  top: var(--frameT) !important;
  bottom: var(--frameT) !important;
  left: 0 !important;
  width: var(--frameT) !important;
  grid-template-rows: repeat(8, 1fr) !important;
}
body.tc-base-layout .coords .files div,
body.tc-base-layout .coords .ranks div{
  color: #f2f2e1 !important;
  text-shadow: none !important;
  font-family: Arial, Helvetica, sans-serif !important;
  font-size: clamp(10px, calc(var(--frameT) * .54), 13px) !important;
  font-weight: 800 !important;
  letter-spacing: .01em !important;
  line-height: 1 !important;
  padding: 0 !important;
  transform: none !important;
  align-items: center !important;
  justify-content: center !important;
}
body.tc-base-layout .coords .files div{
  text-transform: uppercase !important;
}

/* Controles no padrão Base de Estudo. */
body.tc-base-layout .play-controls.aurora-play-controls,
body.tc-base-layout .board-controls{
  flex: 0 0 auto !important;
  width: min(var(--boardSize, 448px), 100%) !important;
  max-width: var(--boardSize, 448px) !important;
  margin: 0 auto !important;
  padding: 0 0 2px !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}
body.tc-base-layout .play-buttons.aurora-play-buttons,
body.tc-base-layout .btn-row{
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  gap: 5px !important;
  width: 100% !important;
  flex-wrap: nowrap !important;
}
body.tc-base-layout .play-buttons .btn,
body.tc-base-layout .btn-row .btn{
  flex: 1 1 0 !important;
  min-width: 0 !important;
  width: auto !important;
  height: 32px !important;
  min-height: 32px !important;
  padding: 0 3px !important;
  border: 1px solid #a9a9a9 !important;
  border-radius: 2px !important;
  background: linear-gradient(180deg, #ffffff 0%, #d7d7d7 100%) !important;
  color: #000 !important;
  font-size: clamp(12px, .95vw, 13.5px) !important;
  font-weight: 900 !important;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.9) !important;
  white-space: nowrap !important;
}
body.tc-base-layout .play-buttons .btn:hover,
body.tc-base-layout .btn-row .btn:hover{
  background: linear-gradient(180deg, #ffffff 0%, #cfcfcf 100%) !important;
}
body.tc-base-layout .btn.primary{
  border-color: #8f8f8f !important;
}

/* Caixa de identificação do jogo abaixo do tabuleiro. */
body.tc-base-layout .current-game-title{
  margin-top: 4px !important;
  min-height: 27px !important;
  border: 2px groove #cfcfcf !important;
  background: #f8f8f8 !important;
  color: #000 !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
  padding: 3px 6px !important;
  font-size: 12px !important;
  line-height: 1.15 !important;
  overflow: hidden !important;
  white-space: nowrap !important;
  text-overflow: ellipsis !important;
}
body.tc-base-layout .current-game-title strong{
  font-weight: 950 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}
body.tc-base-layout .current-game-title span{
  color: #334155 !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  min-width: 0 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* Opções auxiliares permanecem, mas compactadas abaixo da caixa do jogo. */
body.tc-base-layout .mobile-playbar{
  margin-top: 6px !important;
}
body.tc-base-layout .train-row{
  margin-top: 6px !important;
  gap: 6px !important;
}
body.tc-base-layout .train-toggle{
  color: var(--text) !important;
}
body.tc-base-layout .train-status{
  min-height: 24px !important;
  padding: 4px 8px !important;
}

/* Painel da anotação à direita, no padrão visual da área de jogos da Base de Estudo. */
body.tc-base-layout .moves-panel{
  width: 100% !important;
  max-width: none !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  justify-self: stretch !important;
  align-self: stretch !important;
  display: flex !important;
  flex-direction: column !important;
  border: 1px solid #bcbcbc !important;
  border-radius: 0 !important;
  background: #eeeeee !important;
  color: #000 !important;
  box-shadow: none !important;
  overflow: hidden !important;
  padding: 0 !important;
}
body.tc-base-layout .ad-banner{
  min-height: 65px !important;
  padding: 8px 10px 4px !important;
  background: #f7f7f7 !important;
  border-bottom: 1px solid #d1d1d1 !important;
  color: #000 !important;
}
body.tc-base-layout .ad-slot{
  width: 468px !important;
  height: 60px !important;
  background: rgba(128,128,128,.06) !important;
}
body.tc-base-layout .ad-placeholder{
  border-color: rgba(80,80,80,.24) !important;
  color: rgba(0,0,0,.54) !important;
}
body.tc-base-layout .ad-placeholder strong{
  color: rgba(0,0,0,.78) !important;
}
body.tc-base-layout .ad-close{
  color: #000 !important;
}
body.tc-base-layout .ad-caption{
  color: #000 !important;
}
body.tc-base-layout .moves-head{
  flex: 0 0 auto !important;
  min-height: 64px !important;
  padding: 10px 12px !important;
  background: #f7f7f7 !important;
  border-bottom: 1px solid #d1d1d1 !important;
  color: #000 !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: stretch !important;
  justify-content: center !important;
  gap: 8px !important;
}
body.tc-base-layout .moves-head-row{
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 8px !important;
}
body.tc-base-layout .moves-head-row .h,
body.tc-base-layout .moves-head .h{
  color: #000 !important;
  font-size: 14px !important;
  font-weight: 950 !important;
  letter-spacing: .01em !important;
  text-transform: uppercase !important;
}
body.tc-base-layout #gameSelect,
body.tc-base-layout #gameSelectMobile{
  width: 100% !important;
  min-width: 0 !important;
  height: 34px !important;
  border: 1px solid #c7c7c7 !important;
  border-radius: 2px !important;
  background: #fff !important;
  color: #000 !important;
  font-weight: 800 !important;
  font-size: 12px !important;
  padding: 0 8px !important;
  color-scheme: light !important;
}
body.tc-base-layout #gameSelect option,
body.tc-base-layout #gameSelectMobile option{
  background: #fff !important;
  color: #000 !important;
}
body.tc-base-layout .controls{
  flex: 0 0 auto !important;
  margin: 0 !important;
  padding: 8px 12px !important;
  border-bottom: 1px solid #d1d1d1 !important;
  background: #f6f6f6 !important;
  color: #000 !important;
}
body.tc-base-layout .controls .small,
body.tc-base-layout .mobile-ply{
  color: #334155 !important;
  font-weight: 800 !important;
}
body.tc-base-layout #moveSlider,
body.tc-base-layout #moveSliderMobile{
  width: 100% !important;
  accent-color: #2563eb !important;
}
body.tc-base-layout .moves{
  flex: 1 1 auto !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 8px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: #eeeeee !important;
  color: #000 !important;
  overflow: auto !important;
  font-size: 13px !important;
}
body.tc-base-layout .move-row{
  display: grid !important;
  grid-template-columns: 44px minmax(0,1fr) minmax(0,1fr) !important;
  gap: 8px !important;
  padding: 5px 7px !important;
  border: 1px solid #c7c7c7 !important;
  border-radius: 0 !important;
  background: #fff !important;
  color: #000 !important;
  margin-bottom: 5px !important;
}
body.tc-base-layout .move-row:hover{
  border-color: #6699cc !important;
  background: #f1f7ff !important;
}
body.tc-base-layout .move-no{
  color: #334155 !important;
  font-weight: 950 !important;
}
body.tc-base-layout .move{
  color: #000 !important;
  font-weight: 850 !important;
  border-radius: 2px !important;
  padding: 3px 6px !important;
}
body.tc-base-layout .move.active{
  border-color: #1d4ed8 !important;
  background: #dbeafe !important;
  color: #000 !important;
}
body.tc-base-layout .move.missing{
  opacity: .30 !important;
}
body.tc-base-layout .notation-flow{
  line-height: 1.75 !important;
}
body.tc-base-layout .notation-line{
  background: #fff !important;
  color: #000 !important;
  padding: 8px 10px !important;
  min-height: 100% !important;
}
body.tc-base-layout .notation-flow .move-row{
  display: block !important;
}
body.tc-base-layout .notation-flow .move-no{
  display: inline !important;
  color: #000 !important;
  font-weight: 900 !important;
}
body.tc-base-layout .notation-flow .move{
  display: inline-block !important;
  margin: 1px 1px !important;
  color: #000 !important;
  border-radius: 2px !important;
  max-width: none !important;
  overflow: visible !important;
  text-overflow: clip !important;
}
body.tc-base-layout .notation-flow .notation-comment{
  display: inline !important;
  margin: 0 2px !important;
  color: #6b7280 !important;
  font-weight: 500 !important;
}
body.tc-base-layout .notation-flow .variation-depth-1,
body.tc-base-layout .notation-flow .variant-depth-1,
body.tc-base-layout .notation-flow .variation-depth-1 .move-no{
  color: #ff0000 !important;
}
body.tc-base-layout .notation-flow .variation-depth-2,
body.tc-base-layout .notation-flow .variant-depth-2,
body.tc-base-layout .notation-flow .variation-depth-2 .move-no{
  color: #0000ff !important;
  font-family: Georgia, "Times New Roman", serif !important;
  font-style: italic !important;
  font-weight: 500 !important;
}
body.tc-base-layout .notation-flow .variation-depth-3,
body.tc-base-layout .notation-flow .variant-depth-3,
body.tc-base-layout .notation-flow .variation-depth-3 .move-no{
  color: #7c3aed !important;
}
body.tc-base-layout .notation-flow .notation-comment.variant-depth-1,
body.tc-base-layout .notation-flow .notation-comment.variant-depth-2,
body.tc-base-layout .notation-flow .notation-comment.variant-depth-3{
  color: #6b7280 !important;
}
body.tc-base-layout .notation-flow .notation-comment.variant-depth-2{
  font-family: Georgia, "Times New Roman", serif !important;
  font-style: italic !important;
}

/* Gaveta com o mesmo comportamento do projeto Base: abre por cima da tela em qualquer resolução. */
body.tc-base-layout .sidebar{
  top: 70px !important;
}

@media (max-width: 980px){
  :root{ --frameT: 20px; }
  body.tc-base-layout .tc-topbar{
    height: 58px !important;
    flex-basis: 58px !important;
  }
  body.tc-base-layout .app-shell{
    height: calc(100dvh - 58px) !important;
    padding: 6px !important;
  }
  body.tc-base-layout .layout{
    grid-template-columns: 1fr !important;
    grid-template-rows: 1fr !important;
    gap: 0 !important;
    padding-bottom: calc(var(--sheetPeek, 40px) + 4px) !important;
  }
  body.tc-base-layout.mobile-sticky-ad-visible .layout{
    padding-bottom: calc(var(--sheetPeek, 40px) + 76px) !important;
  }
  body.tc-base-layout .board-panel.local-board-panel,
  body.tc-base-layout .board-panel{
    max-width: none !important;
  }
  body.tc-base-layout .board-host.local-board-host,
  body.tc-base-layout .board-host{
    justify-content: flex-start !important;
    gap: 5px !important;
  }
  body.tc-base-layout .play-controls.aurora-play-controls,
  body.tc-base-layout .board-controls{
    width: min(calc(100vw - 12px), var(--boardSize, 520px)) !important;
    max-width: var(--boardSize, 520px) !important;
  }
  body.tc-base-layout .play-buttons.aurora-play-buttons,
  body.tc-base-layout .btn-row{
    gap: 4px !important;
    flex-wrap: nowrap !important;
  }
  body.tc-base-layout .play-buttons .btn,
  body.tc-base-layout .btn-row .btn{
    height: 32px !important;
    font-size: 12px !important;
    padding: 0 2px !important;
  }
  body.tc-base-layout .btn-fullscreen{
    flex: 0 0 34px !important;
    display: inline-flex !important;
  }
  body.tc-base-layout .current-game-title{
    min-height: 31px !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 1px !important;
    font-size: 11.5px !important;
    padding: 4px 6px !important;
  }
  body.tc-base-layout .current-game-title span{
    font-size: 10.5px !important;
  }
  body.tc-base-layout .mobile-playbar{
    display: flex !important;
    gap: 6px !important;
  }
  body.tc-base-layout .mobile-playbar .mobile-row{
    gap: 6px !important;
  }
  body.tc-base-layout .btn-moves{
    height: 36px !important;
    border-radius: 2px !important;
  }
  body.tc-base-layout #gameSelectMobile{
    height: 36px !important;
  }

  /* Bottom-sheet da anotação, preservando a lógica original. */
  body.tc-base-layout .moves-panel.sheet{
    left: 6px !important;
    right: 6px !important;
    bottom: 6px !important;
    width: auto !important;
    height: min(72vh, 640px) !important;
    border-radius: 16px 16px 0 0 !important;
    z-index: 45 !important;
  }
  body.tc-base-layout.mobile-ad-visible .moves-panel.sheet{
    bottom: 6px !important;
  }
  body.tc-base-layout.mobile-sticky-ad-visible .moves-panel.sheet{
    bottom: 74px !important;
  }
  body.tc-base-layout .moves-panel.sheet:not(.sheet-expanded){
    padding: 0 !important;
  }
  body.tc-base-layout .moves-panel.sheet:not(.sheet-expanded) .ad-banner{
    display: none !important;
  }
  body.tc-base-layout .moves-panel.sheet.sheet-expanded .ad-banner{
    display: block !important;
  }
  body.tc-base-layout .moves-panel.sheet:not(.sheet-expanded) .moves-head{
    min-height: var(--sheetPeek, 40px) !important;
    padding: 7px 12px !important;
  }
  body.tc-base-layout .moves-panel.sheet:not(.sheet-expanded) .moves-head-row{
    justify-content: center !important;
  }
  body.tc-base-layout .moves-panel.sheet .sheet-grab{
    background: rgba(15,23,42,.24) !important;
    height: 5px !important;
    width: 44px !important;
    border-radius: 999px !important;
    margin: 0 auto 2px !important;
  }
  body.tc-base-layout .moves-panel.sheet .sheet-toggle{
    width: 34px !important;
    height: 30px !important;
    border-radius: 2px !important;
    background: linear-gradient(180deg, #fff 0%, #d7d7d7 100%) !important;
    color: #000 !important;
    border: 1px solid #a9a9a9 !important;
  }
  body.tc-base-layout .mobile-sticky-ad{
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    bottom: max(6px, env(safe-area-inset-bottom)) !important;
    z-index: 90 !important;
    width: min(100vw - 16px, 336px) !important;
    transform: translateX(-50%) !important;
    pointer-events: none !important;
  }
  body.tc-base-layout.mobile-sticky-ad-visible .mobile-sticky-ad:not([hidden]){
    display: flex !important;
    justify-content: center !important;
  }
  body.tc-base-layout .mobile-sticky-ad-card{
    position: relative !important;
    width: min(100%, 336px) !important;
    min-height: 58px !important;
    padding: 4px 34px 4px 4px !important;
    border: 1px solid rgba(15,23,42,.18) !important;
    border-radius: 14px !important;
    background: rgba(255,255,255,.97) !important;
    box-shadow: 0 8px 26px rgba(15,23,42,.28) !important;
    pointer-events: auto !important;
  }
  body.tc-base-layout .mobile-sticky-ad-slot{
    width: 300px !important;
    max-width: 100% !important;
    height: 50px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    overflow: hidden !important;
    background: rgba(128,128,128,.06) !important;
  }
  body.tc-base-layout .mobile-sticky-ad .adsbygoogle{
    width: 300px !important;
    max-width: 100% !important;
    height: 50px !important;
  }
  body.tc-base-layout .mobile-sticky-ad-close{
    position: absolute !important;
    top: 50% !important;
    right: 4px !important;
    width: 28px !important;
    height: 28px !important;
    padding: 0 !important;
    transform: translateY(-50%) !important;
    border: 0 !important;
    border-radius: 50% !important;
    background: rgba(255,255,255,.95) !important;
    color: #111 !important;
    box-shadow: 0 1px 6px rgba(15,23,42,.2) !important;
    cursor: pointer !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    opacity: .82 !important;
  }
  body.tc-base-layout .mobile-sticky-ad-close:hover,
  body.tc-base-layout .mobile-sticky-ad-close:focus-visible{
    opacity: 1 !important;
  }
}

@media (max-width: 520px){
  :root{ --frameT: 18px; }
  body.tc-base-layout .app-shell{ padding: 5px !important; }
  body.tc-base-layout .board-host.local-board-host,
  body.tc-base-layout .board-host{ gap: 4px !important; }
  body.tc-base-layout .play-controls.aurora-play-controls,
  body.tc-base-layout .board-controls{
    width: min(calc(100vw - 10px), var(--boardSize, 520px)) !important;
  }
  body.tc-base-layout .play-buttons.aurora-play-buttons,
  body.tc-base-layout .btn-row{
    gap: 3px !important;
  }
  body.tc-base-layout .play-buttons .btn,
  body.tc-base-layout .btn-row .btn{
    height: 30px !important;
    font-size: 11px !important;
    padding: 0 1px !important;
  }
  body.tc-base-layout .btn-fullscreen{
    flex-basis: 30px !important;
  }
  body.tc-base-layout .train-row{
    font-size: 12px !important;
  }
  body.tc-base-layout .train-status{
    flex-basis: 100% !important;
  }
}

@media (max-width: 380px){
  :root{ --frameT: 16px; }
  body.tc-base-layout .play-buttons .btn,
  body.tc-base-layout .btn-row .btn{
    font-size: 10.5px !important;
  }
}

/* ==========================================================
   v36 — ajustes solicitados
   - Módulos sempre visíveis na gaveta
   - Remoção definitiva do botão de tela cheia do tabuleiro
   - Botões mobile um pouco maiores após a remoção do botão extra
   - No modo treino, ocultar a anotação também no layout Base
   ========================================================== */
.side-panel-title{
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: .03em;
  text-transform: uppercase;
}
body.ui-light .side-panel-title{
  background: rgba(15,23,42,.035);
  border-color: rgba(15,23,42,.14);
  color: var(--text);
}
.modules-section .games-panel{
  margin-top: 10px;
}
.modules-section .folder-title{
  text-transform: uppercase;
}

/* O botão ⛶ foi removido do HTML; esta regra evita reaparecimento por cache/customizações. */
.btn-fullscreen,
body.tc-base-layout .btn-fullscreen{
  display: none !important;
}

/* Com seis botões na linha, dá para deixar o toque mais confortável no mobile. */
@media (max-width: 980px){
  body.tc-base-layout .play-buttons .btn,
  body.tc-base-layout .btn-row .btn{
    height: 36px !important;
    min-height: 36px !important;
    font-size: 13px !important;
    padding: 0 5px !important;
  }
}
@media (max-width: 520px){
  body.tc-base-layout .play-buttons .btn,
  body.tc-base-layout .btn-row .btn{
    height: 34px !important;
    min-height: 34px !important;
    font-size: 12px !important;
    padding: 0 3px !important;
  }
}
@media (max-width: 380px){
  body.tc-base-layout .play-buttons .btn,
  body.tc-base-layout .btn-row .btn{
    font-size: 11.5px !important;
    padding: 0 2px !important;
  }
}

/* A regra antiga era vencida por regras posteriores do layout Base; aqui ela fica no final. */
body.tc-base-layout.training .moves-panel,
body.tc-base-layout.training .sheet-overlay{
  display: none !important;
}
body.tc-base-layout.training .layout{
  grid-template-columns: minmax(320px, 470px) !important;
  justify-content: start !important;
}
@media (max-width: 980px){
  body.tc-base-layout.training .layout{
    grid-template-columns: 1fr !important;
    padding-bottom: 0 !important;
  }
}

body.encyclopedia-mode .train-row{
  display: none !important;
}


/* ==========================================================
   v52 — Enciclopédia: PDN + estabilidade com anúncios âncora
   ========================================================== */
/* No desktop, 100dvh/visualViewport pode diminuir quando um anúncio automático
   aparece na parte inferior. 100vh mantém o workspace estável e evita que o
   tabuleiro seja recalculado para um tamanho excessivamente pequeno. */
@media (min-width: 981px){
  body.tc-base-layout{
    height: 100vh !important;
    min-height: 100vh !important;
  }
  body.tc-base-layout .app-shell{
    height: calc(100vh - 60px) !important;
  }
}

/* ==========================================================
   Curso de Abertura: menu de configurações no cabeçalho
   ========================================================== */
body.tc-base-layout .tc-topbar h1{
  text-transform: none;
}
.tc-settings-btn{
  justify-self: end;
  border-radius: 8px;
  background: rgba(255,255,255,.08);
  color: var(--text);
  font-size: 18px;
}
body.ui-light .tc-settings-btn{
  background: rgba(15,23,42,.04);
  color: #0f172a;
}
.settings-menu{
  position: fixed;
  top: 68px;
  right: 14px;
  width: min(340px, calc(100vw - 28px));
  z-index: 130;
  padding: 12px;
  border-radius: 14px;
  background: rgba(15,23,42,.98);
  border: 1px solid var(--line);
  box-shadow: 0 20px 55px rgba(0,0,0,.35);
  backdrop-filter: blur(14px);
}
.settings-menu[hidden]{ display: none !important; }
body.ui-light .settings-menu{
  background: rgba(255,255,255,.98);
  color: #0f172a;
}
.settings-menu-head{
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
  font-size: 16px;
}
.settings-close{
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
body.ui-light .settings-close{ color: #0f172a; }
.settings-row,
.settings-field,
.settings-toggle{
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 2px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 72%, transparent);
}
.settings-menu > :last-child{ border-bottom: 0; }
.settings-field select{
  width: 132px;
  min-width: 112px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.06);
  color: var(--text);
  padding: 0 9px;
  font-weight: 800;
}
body.ui-light .settings-field select{
  background: #fff;
  color: #0f172a;
}
.settings-label{
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-weight: 800;
}
.settings-label i{
  width: 20px;
  text-align: center;
  opacity: .9;
}
.settings-theme-toggle{
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.07);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
body.ui-light .settings-theme-toggle{
  background: rgba(15,23,42,.05);
  color: #0f172a;
}
.settings-toggle input[type="checkbox"]{
  width: 42px;
  height: 22px;
  accent-color: #2563eb;
  cursor: pointer;
}

/* A gaveta contém apenas os estudos que serão carregados no tabuleiro. */
body.tc-base-layout .sidebar .side-nav{
  padding-bottom: 10px;
}
body.tc-base-layout .sidebar .modules-section{
  margin-top: 0;
}
body.tc-base-layout .sidebar .games-list{
  display: grid;
  gap: 7px;
}
body.tc-base-layout .sidebar .game-item{
  width: 100%;
  text-align: left;
}

@media (max-width: 980px){
  .settings-menu{
    top: 64px;
    right: 8px;
    width: min(340px, calc(100vw - 16px));
  }
}

/* =========================================================
   ACESSO GRATUITO / CONTEÚDO PARA MEMBROS - AUSTRALIANA
   ========================================================= */
.course-account-area{padding:0 0 14px;border-bottom:1px solid var(--border,rgba(148,163,184,.22));margin-bottom:14px}
.course-account-btn{display:flex;align-items:center;justify-content:center;gap:9px;width:100%;padding:12px 14px;border-radius:11px;background:linear-gradient(135deg,#1593d1,#0875b8);color:#fff!important;text-decoration:none;font-weight:800;box-shadow:0 7px 20px rgba(8,117,184,.22)}
.course-account-btn:hover{filter:brightness(1.08)}
.course-free-note{margin-top:9px;padding:9px 10px;border-radius:9px;background:rgba(245,158,11,.1);border:1px solid rgba(245,158,11,.25);font-size:.79rem;line-height:1.35;color:var(--muted,#94a3b8)}
.course-free-note i{color:#f59e0b;margin-right:5px}
.course-member-box{padding:11px 12px;border-radius:11px;background:rgba(34,197,94,.1);border:1px solid rgba(34,197,94,.28)}
.course-member-box>div{font-weight:800;color:#22c55e}.course-member-box small{display:block;margin-top:4px;color:var(--text,#e5e7eb);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.course-member-box a{display:inline-block;margin-top:7px;color:var(--muted,#94a3b8);font-size:.82rem}

select option.course-locked-option{color:#8d96a5;background:#e7eaf0;font-style:italic}
body:not(.light) select option.course-locked-option{color:#9aa4b4;background:#202a38}

.course-lock-modal[hidden]{display:none!important}.course-lock-modal{position:fixed;inset:0;z-index:100000;display:grid;place-items:center;padding:18px}.course-lock-backdrop{position:absolute;inset:0;background:rgba(2,6,14,.78);backdrop-filter:blur(5px)}.course-lock-dialog{position:relative;width:min(100%,480px);border-radius:20px;padding:30px 26px;background:linear-gradient(160deg,#142337,#091423);border:1px solid rgba(148,163,184,.28);box-shadow:0 28px 85px rgba(0,0,0,.55);color:#f8fafc;text-align:center;animation:courseLockIn .2s ease-out}.course-lock-close{position:absolute;right:13px;top:10px;border:0;background:transparent;color:#cbd5e1;font-size:1.9rem;line-height:1;cursor:pointer}.course-lock-icon{width:72px;height:72px;margin:0 auto 16px;border-radius:50%;display:grid;place-items:center;background:rgba(245,158,11,.14);border:1px solid rgba(245,158,11,.38);color:#fbbf24;font-size:29px}.course-lock-dialog h2{margin:0 0 12px;font-size:1.45rem}.course-lock-dialog p{margin:0;color:#c7d2e2;line-height:1.62}.course-lock-actions{display:grid;grid-template-columns:1fr 1fr;gap:11px;margin-top:23px}.course-lock-actions a{display:flex;align-items:center;justify-content:center;gap:8px;min-height:48px;border-radius:11px;padding:10px;text-decoration:none;font-weight:800}.course-login-action{background:#238ed0;color:#fff}.course-whatsapp-action{background:#25d366;color:#062e16}@keyframes courseLockIn{from{transform:translateY(10px) scale(.97);opacity:0}to{transform:none;opacity:1}}

.game-item.course-source-locked{opacity:.62}.game-item .course-mini-lock{margin-left:auto;color:#f59e0b}
@media(max-width:520px){.course-lock-actions{grid-template-columns:1fr}.course-lock-dialog{padding:27px 19px}}


/* =========================================================
   v54 — Gaveta: espaçamento, contato e rodapé automático
   ========================================================= */
/* Mantém o rodapé visível na base da gaveta e deixa a lista de estudos
   rolar de forma independente quando houver muitos itens. */
body.tc-base-layout .sidebar{
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
body.tc-base-layout .sidebar .side-nav{
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
}

/* Afastamento entre “Voltar à coleção” e “Entrar para liberar tudo”. */
.course-account-btn + .course-account-btn{
  margin-top: 9px;
}

.sidebar-project-footer{
  flex: 0 0 auto;
  margin-top: 12px;
  padding: 12px 2px 2px;
  border-top: 1px solid var(--line);
  text-align: center;
}
.sidebar-whatsapp-contact{
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 9px 12px;
  margin-bottom: 10px;
  border-radius: 11px;
  background: #25d366;
  color: #062e16 !important;
  text-decoration: none;
  font-weight: 900;
  box-shadow: 0 7px 18px rgba(37,211,102,.2);
  transition: transform .16s ease, filter .16s ease;
}
.sidebar-whatsapp-contact:hover{
  filter: brightness(1.05);
  transform: translateY(-1px);
}
.sidebar-whatsapp-contact i{
  font-size: 20px;
}
.sidebar-project-copy{
  color: var(--text);
  font-size: .78rem;
  font-weight: 800;
  line-height: 1.35;
}
.sidebar-project-author{
  margin-top: 3px;
  color: var(--muted);
  font-size: .74rem;
  line-height: 1.35;
}

@media (max-width: 980px){
  body.tc-base-layout .sidebar{
    padding-bottom: 10px;
  }
  .sidebar-project-footer{
    margin-top: 10px;
  }
}

/* ==========================================================
   v60 — Cores integradas, planos, detalhes e progresso
   ========================================================== */
:root{
  --tc-accent:#2286c2;
  --tc-accent-dark:#196590;
}

/* A cor do estilo do tabuleiro acompanha os controles do cabeçalho,
   a gaveta de navegação e o menu de configurações. */
body.tc-base-layout .tc-menu-btn,
body.tc-base-layout .tc-settings-btn,
.course-account-btn,
.course-login-action,
.course-plans-action,
.tc-details-plans-button,
.tc-plan-button{
  background:linear-gradient(135deg,var(--tc-accent),var(--tc-accent-dark)) !important;
  color:#fff !important;
  border-color:color-mix(in srgb,var(--tc-accent) 66%,transparent) !important;
  box-shadow:0 8px 22px color-mix(in srgb,var(--tc-accent) 27%,transparent) !important;
}
body.tc-base-layout .tc-menu-btn:hover,
body.tc-base-layout .tc-settings-btn:hover,
.course-account-btn:hover,
.course-login-action:hover,
.course-plans-action:hover,
.tc-details-plans-button:hover,
.tc-plan-button:hover{
  filter:brightness(1.08);
  transform:translateY(-1px);
}
body.tc-base-layout .tc-menu-btn:active,
body.tc-base-layout .tc-settings-btn:active,
.course-plans-action:active,
.tc-details-plans-button:active{
  transform:translateY(0);
}
.settings-menu{
  border-color:color-mix(in srgb,var(--tc-accent) 38%,var(--line)) !important;
  box-shadow:0 22px 60px rgba(0,0,0,.36),0 0 0 1px color-mix(in srgb,var(--tc-accent) 13%,transparent) !important;
}
.settings-menu-head strong,
.settings-label i,
.settings-close:hover,
.course-free-note i,
.side-panel-title,
.sidebar-project-author{
  color:var(--tc-accent) !important;
}
.settings-theme-toggle,
.settings-close,
.settings-field select{
  border-color:color-mix(in srgb,var(--tc-accent) 34%,var(--line)) !important;
}
.settings-theme-toggle:hover,
.settings-close:hover{
  background:color-mix(in srgb,var(--tc-accent) 13%,transparent) !important;
}
.settings-toggle input[type="checkbox"]{
  accent-color:var(--tc-accent) !important;
}
.settings-field select:focus,
#gameSelect:focus,
#gameSelectMobile:focus{
  outline:2px solid color-mix(in srgb,var(--tc-accent) 35%,transparent) !important;
  outline-offset:2px;
}
body.tc-base-layout .sidebar{
  border-color:color-mix(in srgb,var(--tc-accent) 24%,var(--line)) !important;
}
body.tc-base-layout .sidebar-head{
  border-bottom-color:color-mix(in srgb,var(--tc-accent) 30%,var(--line)) !important;
}
body.tc-base-layout .sidebar .game-item.active{
  border-color:var(--tc-accent) !important;
  background:color-mix(in srgb,var(--tc-accent) 17%,transparent) !important;
  box-shadow:inset 0 0 0 1px color-mix(in srgb,var(--tc-accent) 24%,transparent) !important;
}
body.ui-light.tc-base-layout .sidebar .game-item.active{
  background:color-mix(in srgb,var(--tc-accent) 11%,white) !important;
}

/* Botões informativos adicionados à gaveta. */
.drawer-actions{
  display:grid;
  gap:9px;
  margin:0 0 14px;
}
.drawer-action{
  width:100%;
  min-height:46px;
  display:flex;
  align-items:center;
  justify-content:flex-start;
  gap:10px;
  padding:11px 13px;
  border:1px solid color-mix(in srgb,var(--tc-accent) 32%,var(--line));
  border-radius:12px;
  background:color-mix(in srgb,var(--tc-accent) 8%,rgba(255,255,255,.035));
  color:var(--text);
  font:inherit;
  font-weight:850;
  text-align:left;
  cursor:pointer;
  transition:transform .16s ease,background .16s ease,border-color .16s ease;
}
.drawer-action i{
  width:20px;
  text-align:center;
  color:var(--tc-accent);
  font-size:16px;
}
.drawer-action:hover{
  border-color:color-mix(in srgb,var(--tc-accent) 56%,transparent);
  background:color-mix(in srgb,var(--tc-accent) 15%,transparent);
  transform:translateY(-1px);
}
.drawer-action-plans{
  background:linear-gradient(135deg,color-mix(in srgb,var(--tc-accent) 22%,transparent),color-mix(in srgb,var(--tc-accent-dark) 11%,transparent));
}
body.ui-light .drawer-action{
  color:#0f172a;
  background:color-mix(in srgb,var(--tc-accent) 7%,white);
  border-color:color-mix(in srgb,var(--tc-accent) 28%,rgba(15,23,42,.13));
}
body.ui-light .drawer-action:hover{
  background:color-mix(in srgb,var(--tc-accent) 13%,white);
}

/* Modais gerais. */
body.tc-modal-open{overflow:hidden !important}
.tc-modal[hidden]{display:none !important}
.tc-modal{
  position:fixed;
  inset:0;
  z-index:120000;
  display:grid;
  place-items:center;
  padding:clamp(10px,2.4vw,28px);
}
.tc-modal-backdrop{
  position:absolute;
  inset:0;
  background:rgba(2,6,14,.80);
  backdrop-filter:blur(7px);
}
.tc-modal-dialog{
  position:relative;
  width:min(100%,760px);
  max-height:min(90dvh,900px);
  display:flex;
  flex-direction:column;
  overflow:hidden;
  border:1px solid color-mix(in srgb,var(--tc-accent) 34%,rgba(148,163,184,.28));
  border-radius:22px;
  background:linear-gradient(160deg,color-mix(in srgb,var(--tc-accent) 10%,#142337),#07111f);
  color:#f8fafc;
  box-shadow:0 32px 100px rgba(0,0,0,.62);
  animation:tcModalIn .2s ease-out;
}
body.ui-light .tc-modal-dialog{
  background:linear-gradient(160deg,color-mix(in srgb,var(--tc-accent) 6%,white),#f4f7fb);
  color:#0f172a;
  border-color:color-mix(in srgb,var(--tc-accent) 26%,rgba(15,23,42,.16));
  box-shadow:0 30px 90px rgba(15,23,42,.24);
}
@keyframes tcModalIn{
  from{opacity:0;transform:translateY(12px) scale(.975)}
  to{opacity:1;transform:none}
}
.tc-modal-header{
  flex:0 0 auto;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:16px;
  padding:20px 22px;
  border-bottom:1px solid rgba(148,163,184,.20);
  background:rgba(255,255,255,.025);
}
body.ui-light .tc-modal-header{
  background:rgba(15,23,42,.018);
  border-color:rgba(15,23,42,.12);
}
.tc-modal-heading{
  display:flex;
  align-items:center;
  gap:13px;
  min-width:0;
}
.tc-modal-heading-icon,
.tc-materials-icon{
  width:46px;
  height:46px;
  flex:0 0 46px;
  display:grid;
  place-items:center;
  border-radius:14px;
  background:color-mix(in srgb,var(--tc-accent) 13%,transparent);
  border:1px solid color-mix(in srgb,var(--tc-accent) 34%,transparent);
  color:var(--tc-accent);
  font-size:19px;
}
.tc-modal-heading h2{
  margin:0;
  font-size:clamp(19px,2.3vw,26px);
  line-height:1.15;
}
.tc-modal-heading p{
  margin:4px 0 0;
  color:#b8c4d4;
  line-height:1.4;
}
body.ui-light .tc-modal-heading p{color:#64748b}
.tc-modal-close{
  width:42px;
  height:42px;
  flex:0 0 42px;
  display:grid;
  place-items:center;
  border:1px solid rgba(148,163,184,.20);
  border-radius:12px;
  background:rgba(255,255,255,.05);
  color:inherit;
  font-size:28px;
  line-height:1;
  cursor:pointer;
}
.tc-modal-close:hover{
  border-color:color-mix(in srgb,var(--tc-accent) 38%,transparent);
  background:color-mix(in srgb,var(--tc-accent) 12%,transparent);
}
body.ui-light .tc-modal-close{
  background:rgba(15,23,42,.035);
  border-color:rgba(15,23,42,.13);
}
.tc-modal-body{
  min-height:0;
  overflow:auto;
  padding:22px;
}

/* Planos e pagamento. */
.tc-plans-dialog{width:min(100%,1040px)}
.tc-plan-grid{
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:16px;
}
.tc-plan-card{
  position:relative;
  display:flex;
  flex-direction:column;
  min-height:300px;
  padding:24px;
  border:1px solid color-mix(in srgb,var(--tc-accent) 25%,rgba(148,163,184,.22));
  border-radius:19px;
  background:linear-gradient(160deg,color-mix(in srgb,var(--tc-accent) 8%,rgba(255,255,255,.045)),rgba(255,255,255,.025));
}
.tc-plan-card-featured{
  border-color:color-mix(in srgb,var(--tc-accent) 52%,transparent);
  background:linear-gradient(160deg,color-mix(in srgb,var(--tc-accent) 17%,rgba(255,255,255,.04)),rgba(255,255,255,.025));
}
body.ui-light .tc-plan-card{
  background:#fff;
  border-color:color-mix(in srgb,var(--tc-accent) 23%,rgba(15,23,42,.13));
}
body.ui-light .tc-plan-card-featured{
  background:linear-gradient(160deg,color-mix(in srgb,var(--tc-accent) 9%,white),#fff);
}
.tc-plan-badge{
  align-self:flex-start;
  padding:5px 9px;
  border-radius:999px;
  background:color-mix(in srgb,var(--tc-accent) 16%,transparent);
  color:color-mix(in srgb,var(--tc-accent) 70%,white);
  font-size:12px;
  font-weight:900;
  text-transform:uppercase;
  letter-spacing:.04em;
}
body.ui-light .tc-plan-badge{
  color:var(--tc-accent);
  background:color-mix(in srgb,var(--tc-accent) 10%,white);
}
.tc-plan-card h3{margin:16px 0 5px;font-size:22px}
.tc-plan-price{
  font-size:39px;
  line-height:1;
  font-weight:1000;
  letter-spacing:-.03em;
}
.tc-plan-price small{
  font-size:17px;
  vertical-align:top;
  line-height:1.6;
  color:#94a3b8;
}
.tc-plan-card p{
  margin:15px 0 22px;
  color:#bac5d4;
  line-height:1.58;
}
body.ui-light .tc-plan-card p{color:#526174}
.tc-plan-button{
  margin-top:auto;
  min-height:49px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  padding:11px 14px;
  border:0;
  border-radius:12px;
  text-decoration:none;
  font-weight:900;
  text-align:center;
}
.tc-payment-box.tc-pix-payment{
  display:block;
  margin-top:20px;
  padding:28px;
  border:1px solid color-mix(in srgb,var(--tc-accent) 34%,transparent);
  border-radius:20px;
  background:linear-gradient(145deg,color-mix(in srgb,var(--tc-accent) 10%,rgba(15,23,42,.96)),rgba(15,23,42,.94));
  overflow:hidden;
}
body.ui-light .tc-payment-box.tc-pix-payment{
  background:linear-gradient(145deg,color-mix(in srgb,var(--tc-accent) 9%,white),#f8fffb);
  border-color:color-mix(in srgb,var(--tc-accent) 30%,transparent);
}
.tc-pix-intro{
  display:flex;
  align-items:flex-start;
  gap:17px;
}
.tc-pix-logo{
  width:56px;
  height:56px;
  flex:0 0 56px;
  display:grid;
  place-items:center;
  border-radius:16px;
  color:#fff;
  background:linear-gradient(135deg,var(--tc-accent),var(--tc-accent-dark));
  box-shadow:0 9px 24px color-mix(in srgb,var(--tc-accent) 28%,transparent);
  font-size:27px;
}
.tc-pix-eyebrow{
  display:block;
  margin:2px 0 7px;
  color:color-mix(in srgb,var(--tc-accent) 72%,white);
  font-size:12px;
  font-weight:1000;
  letter-spacing:.075em;
  text-transform:uppercase;
}
body.ui-light .tc-pix-eyebrow{color:var(--tc-accent)}
.tc-payment-box.tc-pix-payment h3{
  margin:0 0 6px;
  font-size:clamp(25px,3vw,32px);
  line-height:1.1;
}
.tc-payment-box.tc-pix-payment p{
  margin:0;
  max-width:760px;
  color:#b8c4d4;
  line-height:1.55;
}
body.ui-light .tc-payment-box.tc-pix-payment p{color:#64748b}
.tc-payment-box.tc-pix-payment .tc-pix-box{
  position:relative;
  margin:20px 0 0 73px;
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  grid-template-areas:"data copy" "feedback feedback";
  align-items:center;
  gap:10px 18px;
  padding:18px 20px;
  border:1px dashed color-mix(in srgb,var(--tc-accent) 58%,transparent);
  border-radius:15px;
  background:rgba(255,255,255,.045);
}
body.ui-light .tc-payment-box.tc-pix-payment .tc-pix-box{background:rgba(255,255,255,.9)}
.tc-pix-data{
  grid-area:data;
  display:grid;
  gap:3px;
  min-width:0;
}
.tc-pix-data>span{
  color:#9aa8bb;
  font-size:11px;
  font-weight:900;
  letter-spacing:.055em;
  text-transform:uppercase;
}
.tc-pix-data strong{
  font-size:clamp(22px,3.1vw,30px);
  line-height:1.15;
  letter-spacing:.025em;
  overflow-wrap:anywhere;
}
.tc-pix-data small{margin-top:2px;color:#aebbd0;font-size:13px}
body.ui-light .tc-pix-data>span,
body.ui-light .tc-pix-data small{color:#64748b}
.tc-copy-button{
  grid-area:copy;
  min-width:102px;
  min-height:42px;
  padding:9px 13px;
  border:1px solid color-mix(in srgb,var(--tc-accent) 48%,transparent);
  border-radius:10px;
  background:color-mix(in srgb,var(--tc-accent) 13%,transparent);
  color:inherit;
  font:inherit;
  font-weight:850;
  cursor:pointer;
}
.tc-copy-button:hover{background:color-mix(in srgb,var(--tc-accent) 22%,transparent)}
.tc-copy-feedback{
  grid-area:feedback;
  min-height:18px;
  color:#4ade80;
  font-size:12px;
  font-weight:800;
}
.tc-copy-feedback:empty{display:none}
.tc-whatsapp-button{
  width:max-content;
  min-width:210px;
  min-height:50px;
  margin:20px 0 0 73px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:10px;
  padding:12px 20px;
  border-radius:13px;
  background:#25d366;
  color:#06351a !important;
  text-decoration:none;
  font-weight:1000;
  box-shadow:0 9px 22px rgba(37,211,102,.22);
}
.tc-whatsapp-button:hover{filter:brightness(1.05);transform:translateY(-1px)}

/* Relação de materiais. */
.tc-materials-section{
  margin-top:20px;
  padding:22px;
  border:1px solid color-mix(in srgb,var(--tc-accent) 32%,rgba(148,163,184,.22));
  border-radius:18px;
  background:color-mix(in srgb,var(--tc-accent) 7%,rgba(255,255,255,.028));
}
body.ui-light .tc-materials-section{
  background:color-mix(in srgb,var(--tc-accent) 5%,white);
  border-color:color-mix(in srgb,var(--tc-accent) 25%,rgba(15,23,42,.13));
}
.tc-materials-heading{
  display:flex;
  align-items:flex-start;
  gap:13px;
  margin-bottom:16px;
}
.tc-materials-heading h3{margin:0;font-size:20px}
.tc-materials-heading p{margin:4px 0 0;color:#b8c4d4;line-height:1.45}
body.ui-light .tc-materials-heading p{color:#64748b}
.tc-materials-list{
  list-style:none;
  display:grid;
  grid-template-columns:repeat(2,minmax(0,1fr));
  gap:9px 16px;
  margin:0;
  padding:0;
}
.tc-materials-list li{
  display:flex;
  align-items:flex-start;
  gap:9px;
  min-width:0;
  padding:9px 10px;
  border-radius:10px;
  background:rgba(255,255,255,.035);
  line-height:1.4;
}
body.ui-light .tc-materials-list li{background:rgba(255,255,255,.78)}
.tc-materials-list li i{
  flex:0 0 auto;
  margin-top:3px;
  color:var(--tc-accent);
}

/* Detalhes do projeto. */
.tc-details-dialog{width:min(100%,900px)}
.tc-details-content{font-size:15px;line-height:1.7}
.tc-details-content>p{margin:0 0 16px;color:#c2cddd}
body.ui-light .tc-details-content>p{color:#475569}
.tc-details-content strong{color:#fff}
body.ui-light .tc-details-content strong{color:#0f172a}
.tc-details-materials{margin-top:18px}
.tc-details-actions{
  display:flex;
  justify-content:center;
  margin-top:20px;
}
.tc-details-plans-button{
  min-width:210px;
  min-height:50px;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:9px;
  padding:11px 18px;
  border:0;
  border-radius:12px;
  font:inherit;
  font-weight:900;
  cursor:pointer;
}

/* Janela de conteúdo bloqueado integrada à cor selecionada. */
.course-lock-dialog{
  border-color:color-mix(in srgb,var(--tc-accent) 38%,rgba(148,163,184,.28)) !important;
  background:linear-gradient(160deg,color-mix(in srgb,var(--tc-accent) 12%,#142337),#091423) !important;
}
.course-lock-icon{
  color:color-mix(in srgb,var(--tc-accent) 72%,white) !important;
  background:color-mix(in srgb,var(--tc-accent) 15%,transparent) !important;
  border-color:color-mix(in srgb,var(--tc-accent) 45%,transparent) !important;
}
.course-lock-actions a,
.course-lock-actions button{
  min-height:48px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  padding:10px;
  border:0;
  border-radius:11px;
  font:inherit;
  font-weight:800;
  text-decoration:none;
  cursor:pointer;
}
body.ui-light .course-lock-dialog{
  color:#0f172a !important;
  background:linear-gradient(160deg,color-mix(in srgb,var(--tc-accent) 8%,white),#fff) !important;
  border-color:color-mix(in srgb,var(--tc-accent) 28%,rgba(15,23,42,.16)) !important;
}
body.ui-light .course-lock-dialog p{color:#475569 !important}
body.ui-light .course-lock-close{color:#334155 !important}

/* Demarcação dos estudos completamente reproduzidos na Anotação do Jogo. */
#gameSelect option.game-played-option,
#gameSelectMobile option.game-played-option,
body.ui-light #gameSelect option.game-played-option,
body.ui-light #gameSelectMobile option.game-played-option,
body:not(.ui-light) #gameSelect option.game-played-option,
body:not(.ui-light) #gameSelectMobile option.game-played-option{
  background:#f59e0b !important;
  color:#18181b !important;
  font-weight:900 !important;
}

/* Seletor personalizado no celular para preservar a cor dos itens concluídos. */
.mobile-game-picker-trigger,
.mobile-game-picker{display:none}
@media (max-width:980px){
  body.tc-base-layout .mobile-native-game-select{
    position:absolute !important;
    width:1px !important;
    height:1px !important;
    opacity:0 !important;
    pointer-events:none !important;
    overflow:hidden !important;
  }
  .mobile-game-picker-trigger{
    width:100%;
    min-height:42px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:9px 11px;
    border:1px solid #a9a9a9;
    border-radius:4px;
    background:#fff;
    color:#000;
    font:inherit;
    font-weight:800;
    text-align:left;
    cursor:pointer;
  }
  .mobile-game-picker-trigger-label{
    min-width:0;
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
  }
  .mobile-game-picker-trigger.is-played{
    background:#f59e0b;
    color:#18181b;
    border-color:#d97706;
  }
  .mobile-game-picker-trigger.is-locked:not(.is-played){opacity:.68}
  .mobile-game-picker[hidden]{display:none !important}
  .mobile-game-picker{
    position:fixed;
    inset:0;
    z-index:130000;
    display:flex;
    align-items:flex-end;
    justify-content:center;
    padding:14px;
  }
  .mobile-game-picker-backdrop{
    position:absolute;
    inset:0;
    background:rgba(2,6,14,.78);
    backdrop-filter:blur(5px);
  }
  .mobile-game-picker-panel{
    position:relative;
    width:min(100%,540px);
    max-height:min(82dvh,720px);
    display:flex;
    flex-direction:column;
    overflow:hidden;
    border:1px solid color-mix(in srgb,var(--tc-accent) 34%,rgba(148,163,184,.28));
    border-radius:18px;
    background:linear-gradient(160deg,color-mix(in srgb,var(--tc-accent) 9%,#142337),#091423);
    color:#f8fafc;
    box-shadow:0 28px 85px rgba(0,0,0,.56);
    animation:mobileGamePickerIn .18s ease-out;
  }
  body.ui-light .mobile-game-picker-panel{
    background:linear-gradient(160deg,color-mix(in srgb,var(--tc-accent) 7%,white),#f8fafc);
    color:#0f172a;
  }
  .mobile-game-picker-head{
    flex:0 0 auto;
    display:flex;
    align-items:flex-start;
    justify-content:space-between;
    gap:12px;
    padding:15px 16px;
    border-bottom:1px solid rgba(148,163,184,.20);
  }
  .mobile-game-picker-head>div{display:grid;gap:4px}
  .mobile-game-picker-head strong{font-size:16px}
  .mobile-game-picker-head small{color:#aebacd;line-height:1.35}
  body.ui-light .mobile-game-picker-head small{color:#64748b}
  .mobile-game-picker-close{
    width:38px;
    height:38px;
    flex:0 0 38px;
    border:1px solid rgba(148,163,184,.25);
    border-radius:11px;
    background:rgba(255,255,255,.06);
    color:inherit;
    font-size:25px;
    cursor:pointer;
  }
  .mobile-game-picker-list{
    min-height:0;
    overflow:auto;
    padding:10px;
    display:grid;
    gap:8px;
    overscroll-behavior:contain;
  }
  .mobile-game-picker-item{
    width:100%;
    min-height:48px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
    padding:11px 12px;
    border:1px solid rgba(148,163,184,.18);
    border-radius:11px;
    background:rgba(255,255,255,.045);
    color:inherit;
    font:inherit;
    font-weight:800;
    text-align:left;
    cursor:pointer;
  }
  body.ui-light .mobile-game-picker-item{
    background:#fff;
    border-color:rgba(15,23,42,.13);
  }
  .mobile-game-picker-item.is-active{
    border-color:var(--tc-accent);
    box-shadow:inset 0 0 0 1px var(--tc-accent);
  }
  .mobile-game-picker-item.is-played{
    background:#f59e0b !important;
    color:#18181b !important;
    border-color:#d97706 !important;
  }
  .mobile-game-picker-item.is-locked:not(.is-played){opacity:.68}
  .mobile-game-picker-item-label{min-width:0;line-height:1.35}
  .mobile-game-picker-item-status{
    flex:0 0 auto;
    padding:3px 7px;
    border-radius:999px;
    background:rgba(24,24,27,.14);
    font-size:10px;
    font-weight:950;
    text-transform:uppercase;
    letter-spacing:.04em;
  }
  body.mobile-game-picker-open{overflow:hidden !important}
  @keyframes mobileGamePickerIn{
    from{transform:translateY(16px);opacity:.72}
    to{transform:translateY(0);opacity:1}
  }
}

@media (max-width:700px){
  .tc-modal{padding:8px}
  .tc-modal-dialog{max-height:calc(100dvh - 16px);border-radius:17px}
  .tc-modal-header{padding:15px}
  .tc-modal-heading-icon{width:40px;height:40px;flex-basis:40px;border-radius:12px}
  .tc-modal-heading p{font-size:12.5px}
  .tc-modal-body{padding:15px}
  .tc-plan-grid{grid-template-columns:1fr}
  .tc-plan-card{min-height:0;padding:20px}
  .tc-payment-box.tc-pix-payment{padding:20px 16px}
  .tc-pix-intro{gap:12px}
  .tc-pix-logo{width:48px;height:48px;flex-basis:48px;border-radius:14px;font-size:23px}
  .tc-payment-box.tc-pix-payment .tc-pix-box{
    margin-left:0;
    grid-template-columns:1fr;
    grid-template-areas:"data" "copy" "feedback";
    padding:16px;
  }
  .tc-payment-box.tc-pix-payment .tc-copy-button{width:100%}
  .tc-payment-box.tc-pix-payment .tc-whatsapp-button{width:100%;margin-left:0}
  .tc-materials-list{grid-template-columns:1fr}
  .tc-materials-section{padding:16px}
}
@media (max-width:420px){
  .tc-modal-heading p{display:none}
  .tc-plan-price{font-size:34px}
  .tc-materials-heading{align-items:center}
  .tc-materials-icon{width:40px;height:40px;flex-basis:40px}
}
