/* ═══════════════════════════════════════════
   ASAF DAMAS – style.css
   ═══════════════════════════════════════════ */

/* ── CSS Variables – Tema Escuro (padrão) ─── */
:root {
  --p1-color: #d0d0d0;
  --p2-color: #cc2222;
  --cell-light: #f0cfa0;
  --cell-dark:  #8b4513;
  --board-border: #5c2a00;
  --bg: #1a0d05;
  --bg2: #261508;
  --surface: #2e1a08;
  --surface2: #3d2510;
  --text: #f5e6c8;
  --text-dim: #b89060;
  --accent: #e8a030;
  --accent2: #c06000;
  --highlight: rgba(255,220,50,0.55);
  --capture: rgba(255,60,60,0.5);
  --valid: rgba(80,220,120,0.55);
  --radius: 12px;
  --shadow: 0 8px 32px rgba(0,0,0,.6);
  --font-title: 'Cinzel', serif;
  --font-body: 'Lato', sans-serif;
}

/* ── Tema Claro (dia) ────────────────────── */
body[data-theme="light"] {
  --bg: #f5ede0;
  --bg2: #ede0cc;
  --surface: #fff8f0;
  --surface2: #f0e4d0;
  --text: #2a1500;
  --text-dim: #7a5030;
  --accent: #b05800;
  --accent2: #8a3e00;
  --shadow: 0 8px 32px rgba(0,0,0,.18);
}
body[data-theme="light"] {
  background: radial-gradient(ellipse at 30% 20%, #e8d4b8 0%, #f5ede0 70%) !important;
}
body[data-theme="light"] header {
  background: rgba(255,248,240,.88) !important;
  border-bottom-color: rgba(176,88,0,.2) !important;
}
body[data-theme="light"] .welcome-box,
body[data-theme="light"] .modal-box {
  background: linear-gradient(160deg, #fff8f0 0%, #ede0cc 100%);
  border-color: var(--accent2);
  box-shadow: 0 0 40px rgba(176,88,0,.12), var(--shadow);
}
body[data-theme="light"] .score-card {
  background: rgba(0,0,0,.05);
  border-color: rgba(0,0,0,.1);
}
body[data-theme="light"] .icon-btn {
  background: rgba(0,0,0,.06);
  border-color: rgba(0,0,0,.1);
}
body[data-theme="light"] .icon-btn:hover {
  background: rgba(176,88,0,.12);
}
body[data-theme="light"] .toggle-btn {
  background: rgba(0,0,0,.05);
  border-color: rgba(0,0,0,.12);
  color: var(--text-dim);
}
body[data-theme="light"] .toggle-btn.active,
body[data-theme="light"] .toggle-btn:hover {
  background: rgba(176,88,0,.1);
  border-color: var(--accent);
  color: var(--accent);
}
body[data-theme="light"] #cpu-thinking {
  background: rgba(245,237,224,.95);
  border-color: var(--accent2);
}
body[data-theme="light"] footer {
  border-top-color: rgba(0,0,0,.1);
}
body[data-theme="light"] #mode-badge {
  background: rgba(176,88,0,.08);
  border-color: rgba(176,88,0,.2);
}
body[data-theme="light"] .welcome-features span {
  background: rgba(0,0,0,.05);
  border-color: rgba(0,0,0,.1);
  color: var(--text);
}
/* Botão primário no tema claro */
body[data-theme="light"] .btn-primary {
  color: #fff;
  box-shadow: 0 4px 20px rgba(176,88,0,.3);
}

/* ── Reset & Base ─────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%; height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100dvh;
  background: radial-gradient(ellipse at 30% 20%, #3b1a06 0%, #1a0d05 70%);
}

/* ── Welcome Overlay ──────────────────────── */
#welcome-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(10,5,2,.92);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fadeIn .4s ease;
}

.welcome-box {
  background: linear-gradient(160deg, var(--surface) 0%, var(--bg2) 100%);
  border: 1px solid var(--accent2);
  border-radius: 20px;
  padding: 2.5rem 2rem;
  max-width: 460px; width: 100%;
  text-align: center;
  box-shadow: 0 0 60px rgba(200,100,0,.25), var(--shadow);
}

.welcome-crown {
  font-size: 3.5rem;
  filter: drop-shadow(0 0 12px #e8a030);
  animation: pulse 2s ease-in-out infinite;
}

.welcome-box h1 {
  font-family: var(--font-title);
  font-size: clamp(1.6rem, 5vw, 2.2rem);
  color: var(--accent);
  margin: .5rem 0 1rem;
  letter-spacing: .04em;
}

.welcome-box p { color: var(--text-dim); line-height: 1.7; font-size: .95rem; }
.welcome-box p strong { color: var(--text); }

.welcome-features {
  display: flex; flex-wrap: wrap; gap: .5rem;
  justify-content: center; margin: 1.2rem 0;
}

.welcome-features span {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: .35rem .85rem;
  font-size: .8rem;
  color: var(--text);
}

.welcome-note { font-size: .72rem; margin-top: 1rem; opacity: .45; }

/* ── Buttons ──────────────────────────────── */
.btn-primary {
  display: inline-block;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  color: #1a0d05;
  border: none;
  border-radius: 50px;
  padding: .75rem 2.2rem;
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: .06em;
  box-shadow: 0 4px 20px rgba(232,160,48,.4);
  transition: transform .15s, box-shadow .15s;
  margin-top: .5rem;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 28px rgba(232,160,48,.55); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-block;
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent2);
  border-radius: 50px;
  padding: .72rem 2rem;
  font-family: var(--font-title);
  font-size: .9rem;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: .04em;
  transition: background .15s, transform .15s;
}
.btn-secondary:hover { background: rgba(232,160,48,.08); transform: translateY(-1px); }

/* ── Modals ───────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 8000;
  background: rgba(10,5,2,.85);
  backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
  animation: fadeIn .25s ease;
}
.modal.hidden { display: none; }

.modal-box {
  background: linear-gradient(160deg, var(--surface) 0%, var(--bg2) 100%);
  border: 1px solid var(--accent2);
  border-radius: var(--radius);
  padding: 2rem 1.8rem;
  width: min(520px, 100%);
  max-height: 92dvh;
  overflow-y: auto;
  position: relative;
  box-shadow: var(--shadow), 0 0 40px rgba(200,100,0,.15);
}
.modal-box.small { max-width: 360px; text-align: center; }

.modal-box h2 {
  font-family: var(--font-title);
  color: var(--accent);
  font-size: 1.3rem;
  margin-bottom: 1.4rem;
  letter-spacing: .05em;
}

.modal-close {
  position: absolute; top: .8rem; right: 1rem;
  background: transparent; border: none;
  color: var(--text-dim); font-size: 1.2rem;
  cursor: pointer; line-height: 1;
  transition: color .15s;
}
.modal-close:hover { color: var(--text); }

/* Settings groups */
.setting-group { margin-bottom: 1.4rem; }
.setting-group > label {
  display: block; font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--text-dim); margin-bottom: .6rem;
}

.toggle-group { display: flex; flex-wrap: wrap; gap: .5rem; }
.toggle-btn {
  flex: 1; min-width: 90px;
  background: rgba(255,255,255,.05);
  border: 1.5px solid rgba(255,255,255,.1);
  border-radius: 8px;
  color: var(--text-dim);
  padding: .55rem .8rem;
  font-size: .85rem; font-family: var(--font-body);
  cursor: pointer;
  transition: all .15s;
}
.toggle-btn.active,
.toggle-btn:hover {
  background: rgba(232,160,48,.12);
  border-color: var(--accent);
  color: var(--accent);
}

/* Color swatches */
.color-row { display: flex; flex-wrap: wrap; gap: .55rem; align-items: center; }
.color-swatch {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform .15s, border-color .15s;
}
.color-swatch.active,
.color-swatch:hover { border-color: var(--accent); transform: scale(1.18); }
.board-swatch { border-radius: 6px; width: 40px; height: 34px; }
input[type="color"] {
  width: 34px; height: 34px;
  border-radius: 50%; border: 2px solid rgba(255,255,255,.2);
  background: none; cursor: pointer; padding: 0;
  overflow: hidden;
}

/* ── Header ───────────────────────────────── */
header {
  flex-shrink: 0;
  background: rgba(15,7,2,.7);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(232,160,48,.15);
  z-index: 100;
}
.header-inner {
  max-width: 900px; margin: 0 auto;
  padding: .55rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
}
.logo {
  font-family: var(--font-title);
  font-size: clamp(.9rem, 3vw, 1.15rem);
  color: var(--accent);
  letter-spacing: .06em;
  display: flex; align-items: center; gap: .4rem;
}
.logo span { opacity: .85; }
.header-actions { display: flex; gap: .3rem; }
.icon-btn {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 8px;
  width: 38px; height: 38px;
  font-size: 1.05rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s, transform .1s;
  color: inherit;
}
.icon-btn:hover { background: rgba(232,160,48,.12); transform: scale(1.05); }

/* ── Main ─────────────────────────────────── */
main {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: .5rem;
}

#game-container {
  width: 100%;
  max-width: 700px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .55rem;
}

/* Scoreboard */
#scoreboard {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem;
}
.score-card {
  flex: 1;
  display: flex; align-items: center; gap: .6rem;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 10px;
  padding: .45rem .8rem;
  transition: border-color .3s, box-shadow .3s;
}
.score-card.active-turn {
  border-color: var(--accent);
  box-shadow: 0 0 14px rgba(232,160,48,.25);
}
.score-avatar {
  font-size: 1.5rem;
  width: 36px; height: 36px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.08);
  color: var(--p1-color);
  transition: color .4s;
}
#score-p2 .score-avatar { color: var(--p2-color); }
.score-info { flex: 1; min-width: 0; }
.score-name { display: block; font-weight: 700; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.score-pieces { display: block; font-size: .7rem; color: var(--text-dim); }
.score-num {
  font-family: var(--font-title);
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  min-width: 28px; text-align: center;
}

/* Turn indicator */
#turn-indicator {
  display: flex; flex-direction: column; align-items: center; gap: .25rem;
  flex-shrink: 0;
}
#turn-pulse {
  width: 14px; height: 14px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.4s ease-in-out infinite;
}
#turn-text { font-size: .68rem; color: var(--text-dim); white-space: nowrap; }

/* ── Board ────────────────────────────────── */
#board-wrapper {
  width: 100%;
  aspect-ratio: 1;
  max-height: calc(100dvh - 240px);
  display: flex; align-items: center; justify-content: center;
}

#board {
  width: min(100%, calc(100dvh - 240px));
  height: min(100%, calc(100dvh - 240px));
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  border: 4px solid var(--board-border);
  border-radius: 6px;
  box-shadow: 0 0 0 2px #3b1a06, 0 8px 40px rgba(0,0,0,.7), inset 0 0 30px rgba(0,0,0,.15);
  overflow: hidden;
  user-select: none;
}

/* Cells */
.cell {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  cursor: default;
  transition: background-color .15s;
}
.cell.light { background: var(--cell-light); }
.cell.dark  { background: var(--cell-dark); }
.cell.dark:hover { background: color-mix(in srgb, var(--cell-dark), #fff 8%); }

.cell.highlight { background: var(--highlight) !important; }
.cell.valid-move {
  cursor: pointer;
}
.cell.valid-move::after {
  content: '';
  position: absolute;
  width: 38%;
  height: 38%;
  background: var(--valid);
  border-radius: 50%;
  pointer-events: none;
  animation: scaleIn .15s ease;
  box-shadow: 0 0 8px rgba(80,220,120,.4);
}
.cell.capture-move::after {
  background: var(--capture);
  box-shadow: 0 0 10px rgba(255,60,60,.5);
}

/* Pieces */
.piece {
  position: relative;
  width: 78%;
  height: 78%;
  border-radius: 50%;
  cursor: pointer;
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s;
  will-change: transform;
  z-index: 2;
}

.piece.p1 {
  background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--p1-color), #fff 40%), var(--p1-color) 60%, color-mix(in srgb, var(--p1-color), #000 20%));
  border: 2px solid color-mix(in srgb, var(--p1-color), #000 30%);
  box-shadow:
    0 4px 8px rgba(0,0,0,.5),
    inset 0 1px 2px rgba(255,255,255,.4),
    inset 0 -2px 4px rgba(0,0,0,.3);
}
.piece.p2 {
  background: radial-gradient(circle at 35% 35%, color-mix(in srgb, var(--p2-color), #fff 35%), var(--p2-color) 60%, color-mix(in srgb, var(--p2-color), #000 25%));
  border: 2px solid color-mix(in srgb, var(--p2-color), #000 30%);
  box-shadow:
    0 4px 8px rgba(0,0,0,.5),
    inset 0 1px 2px rgba(255,255,255,.3),
    inset 0 -2px 4px rgba(0,0,0,.4);
}
.piece.selected {
  transform: scale(1.18) translateY(-4px);
  box-shadow: 0 8px 20px rgba(0,0,0,.6), 0 0 0 3px var(--accent), inset 0 1px 2px rgba(255,255,255,.4);
}
.piece:hover:not(.selected) { transform: scale(1.05); }

/* King crown */
.piece.king::after {
  content: '♛';
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: clamp(.55rem, 2.5vw, 1rem);
  color: rgba(0,0,0,.6);
  pointer-events: none;
}
.piece.p1.king::after { color: rgba(0,0,0,.45); }

/* Piece inner ring decoration */
.piece::before {
  content: '';
  position: absolute;
  inset: 20%;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,.18);
  pointer-events: none;
}

/* ── Status bar ───────────────────────────── */
#status-bar {
  width: 100%;
  display: flex; align-items: center; justify-content: space-between;
  gap: .5rem;
  flex-wrap: wrap;
}
#status-msg {
  font-size: .8rem;
  color: var(--text-dim);
  flex: 1;
}
#mode-badge {
  background: rgba(232,160,48,.1);
  border: 1px solid rgba(232,160,48,.2);
  border-radius: 20px;
  padding: .22rem .75rem;
  font-size: .72rem;
  color: var(--accent);
  white-space: nowrap;
}

/* ── Footer ───────────────────────────────── */
footer {
  flex-shrink: 0;
  border-top: 1px solid rgba(255,255,255,.05);
  padding: .4rem 1rem;
  display: flex; align-items: center; justify-content: space-between;
  font-size: .72rem;
  color: var(--text-dim);
}
footer a { color: var(--accent); text-decoration: none; }

/* ── CPU thinking ─────────────────────────── */
#cpu-thinking {
  position: fixed;
  bottom: 3.5rem; left: 50%; transform: translateX(-50%);
  background: rgba(15,7,2,.9);
  border: 1px solid var(--accent2);
  border-radius: 30px;
  padding: .5rem 1.2rem;
  display: flex; align-items: center; gap: .6rem;
  font-size: .82rem; color: var(--text-dim);
  z-index: 1000;
  box-shadow: var(--shadow);
  animation: slideUp .2s ease;
}
#cpu-thinking.hidden { display: none; }

.dots { display: flex; gap: .28rem; }
.dots span {
  width: 7px; height: 7px;
  background: var(--accent);
  border-radius: 50%;
  animation: bounce 1.2s ease-in-out infinite;
}
.dots span:nth-child(2) { animation-delay: .2s; }
.dots span:nth-child(3) { animation-delay: .4s; }

/* ── Animations ───────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.1); opacity: .7; }
}
@keyframes bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%            { transform: translateY(-6px); }
}
@keyframes slideUp {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes scaleIn {
  from { transform: scale(0); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
@keyframes pieceCapture {
  0%   { transform: scale(1); opacity: 1; }
  50%  { transform: scale(1.3); opacity: .5; }
  100% { transform: scale(0); opacity: 0; }
}
.piece.capturing { animation: pieceCapture .35s ease forwards; }

@keyframes pieceLand {
  0%   { transform: scale(1.2) translateY(-8px); }
  60%  { transform: scale(.95) translateY(2px); }
  100% { transform: scale(1) translateY(0); }
}
.piece.landing { animation: pieceLand .3s ease forwards; }

/* ── Responsive ───────────────────────────── */
@media (max-width: 420px) {
  .score-pieces { display: none; }
  .score-name { font-size: .75rem; }
  .score-num { font-size: 1.2rem; }
  #board-wrapper { max-height: calc(100dvh - 210px); }
}
@media (min-height: 700px) and (max-width: 600px) {
  #board-wrapper { max-height: 72vw; }
}
@media (min-width: 1200px) {
  #board-wrapper { max-height: 70vh; }
  #game-container { max-width: 780px; }
}

/* Board themes */
body[data-board="dark"]  { --cell-light: #555; --cell-dark: #111; --board-border: #000; }
body[data-board="green"] { --cell-light: #b0d4a0; --cell-dark: #3a7a2a; --board-border: #1a4a10; }
body[data-board="blue"]  { --cell-light: #aac4e8; --cell-dark: #2255aa; --board-border: #112266; }
body[data-board="red"]   { --cell-light: #e8aaaa; --cell-dark: #991111; --board-border: #550000; }

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--accent2); border-radius: 5px; }

/* ═══════════════════════════════════════════
   NOVOS ELEMENTOS v4 – Botões de acção em jogo
   ═══════════════════════════════════════════ */

/* ── Botão de perigo (encerrar) no header ── */
.icon-btn-danger {
  color: #e05050 !important;
  border-color: rgba(224,80,80,.25) !important;
}
.icon-btn-danger:hover {
  background: rgba(224,80,80,.12) !important;
  border-color: #e05050 !important;
}
body[data-theme="light"] .icon-btn-danger {
  color: #cc2222 !important;
  border-color: rgba(204,34,34,.25) !important;
}
body[data-theme="light"] .icon-btn-danger:hover {
  background: rgba(204,34,34,.1) !important;
}

/* ── Barra de acções em jogo ─────────────── */
#action-bar {
  width: 100%;
  display: flex;
  gap: .5rem;
  justify-content: center;
  flex-wrap: wrap;
  padding: .25rem 0 .1rem;
}

.action-btn {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 8px;
  color: var(--text-dim);
  font-family: var(--font-body);
  font-size: .78rem;
  font-weight: 600;
  padding: .4rem .85rem;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s, transform .1s;
  white-space: nowrap;
  letter-spacing: .02em;
}
.action-btn:hover  { transform: translateY(-1px); }
.action-btn:active { transform: translateY(0); }

.action-restart { }
.action-restart:hover {
  background: rgba(80,160,255,.12);
  border-color: #50a0ff;
  color: #80c0ff;
}
.action-undo:hover {
  background: rgba(180,140,60,.12);
  border-color: var(--accent2);
  color: var(--accent);
}
.action-hint:hover {
  background: rgba(80,200,120,.12);
  border-color: #50c878;
  color: #80e0a0;
}
.action-quit {
  color: #d06060;
  border-color: rgba(208,96,96,.2);
}
.action-quit:hover {
  background: rgba(208,96,96,.12);
  border-color: #d06060;
  color: #ff8080;
}

/* Tema claro */
body[data-theme="light"] .action-btn {
  background: rgba(0,0,0,.04);
  border-color: rgba(0,0,0,.1);
  color: var(--text-dim);
}
body[data-theme="light"] .action-restart:hover { background: rgba(0,80,200,.08); border-color: #0050c8; color: #0050c8; }
body[data-theme="light"] .action-undo:hover    { background: rgba(176,88,0,.08);  border-color: var(--accent); color: var(--accent); }
body[data-theme="light"] .action-hint:hover    { background: rgba(20,140,60,.08); border-color: #148c3c; color: #148c3c; }
body[data-theme="light"] .action-quit          { color: #cc2222; border-color: rgba(204,34,34,.2); }
body[data-theme="light"] .action-quit:hover    { background: rgba(204,34,34,.08); border-color: #cc2222; color: #cc2222; }

/* Hide text labels on very small screens, keep icons */
@media (max-width: 360px) {
  .action-btn span { display: none; }
  .action-btn { padding: .4rem .6rem; }
}

/* ── Game Over Modal melhorado ───────────── */
#gameover-icon {
  font-size: 3.2rem;
  margin-bottom: .5rem;
  animation: popIn .4s cubic-bezier(.34,1.56,.64,1);
}
@keyframes popIn {
  from { transform: scale(0) rotate(-15deg); opacity: 0; }
  to   { transform: scale(1) rotate(0);      opacity: 1; }
}

.gameover-stats {
  display: flex;
  gap: .5rem;
  justify-content: center;
  flex-wrap: wrap;
  margin: .8rem 0 0;
  font-size: .78rem;
}
.gameover-stat-chip {
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  padding: .25rem .75rem;
  color: var(--text-dim);
}
.gameover-stat-chip strong { color: var(--accent); }

body[data-theme="light"] .gameover-stat-chip {
  background: rgba(0,0,0,.05);
  border-color: rgba(0,0,0,.1);
}

.gameover-actions {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-top: 1.2rem;
}
.gameover-actions .btn-primary,
.gameover-actions .btn-action,
.gameover-actions .btn-secondary {
  width: 100%;
  text-align: center;
  justify-content: center;
}

/* btn-action: verde/confirm */
.btn-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(60,180,100,.12);
  color: #5de09a;
  border: 1.5px solid rgba(60,180,100,.3);
  border-radius: 50px;
  padding: .7rem 2rem;
  font-family: var(--font-title);
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .04em;
  transition: background .15s, transform .12s, box-shadow .15s;
}
.btn-action:hover {
  background: rgba(60,180,100,.2);
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(60,180,100,.2);
}
body[data-theme="light"] .btn-action {
  background: rgba(20,140,60,.08);
  color: #0a7030;
  border-color: rgba(20,140,60,.25);
}

/* btn-danger: vermelho */
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(200,50,50,.12);
  color: #ff7070;
  border: 1.5px solid rgba(200,50,50,.3);
  border-radius: 50px;
  padding: .7rem 2rem;
  font-family: var(--font-title);
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .04em;
  transition: background .15s, transform .12s;
  width: 100%;
}
.btn-danger:hover {
  background: rgba(200,50,50,.22);
  transform: translateY(-1px);
}
body[data-theme="light"] .btn-danger {
  background: rgba(180,20,20,.08);
  color: #cc1111;
  border-color: rgba(180,20,20,.25);
}

/* ── Confirm modais ──────────────────────── */
.confirm-box {
  text-align: center;
  max-width: 340px;
}
.confirm-icon {
  font-size: 2.8rem;
  margin-bottom: .5rem;
}
.confirm-box p {
  color: var(--text-dim);
  font-size: .9rem;
  line-height: 1.6;
  margin: .5rem 0;
}
.confirm-actions {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  margin-top: 1.1rem;
}
.confirm-actions .btn-danger,
.confirm-actions .btn-secondary,
.confirm-actions .btn-primary {
  width: 100%;
  text-align: center;
  justify-content: center;
}

/* ═══════════════════════════════════════════════
   v6 – Tutorial, Cookie Banner, Legal, FAB
   ═══════════════════════════════════════════════ */

/* ── Floating ℹ️ button ─────────────────────── */
.info-fab {
  position: fixed;
  bottom: 4.5rem;
  right: 1rem;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  border: none;
  cursor: pointer;
  z-index: 500;
  box-shadow: 0 4px 18px rgba(232,160,48,.45);
  transition: transform .18s cubic-bezier(.34,1.56,.64,1), box-shadow .18s;
  display: flex; align-items: center; justify-content: center;
}
.info-fab:hover {
  transform: scale(1.12);
  box-shadow: 0 6px 26px rgba(232,160,48,.6);
}
.info-fab:active { transform: scale(.97); }
.info-fab-icon {
  font-size: 1.3rem;
  font-weight: 900;
  font-style: italic;
  color: #1a0d05;
  font-family: var(--font-title);
  line-height: 1;
  user-select: none;
}
/* Pulse animation on first load */
.info-fab.pulse-once {
  animation: fabPulse 1.8s ease 1.2s 2;
}
@keyframes fabPulse {
  0%,100% { box-shadow: 0 4px 18px rgba(232,160,48,.45); }
  50% { box-shadow: 0 4px 32px rgba(232,160,48,.9), 0 0 0 10px rgba(232,160,48,.12); }
}

/* ── Tutorial Modal ──────────────────────────── */
.tutorial-box {
  width: min(720px, 100%);
  max-height: 92dvh;
  display: flex;
  flex-direction: column;
  padding: 1.5rem 1.8rem 1.2rem;
  gap: 0;
}

.tut-header {
  text-align: center;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border, rgba(255,255,255,.1));
  margin-bottom: .8rem;
  flex-shrink: 0;
}
.tut-icon {
  font-size: 2.5rem;
  filter: drop-shadow(0 0 10px var(--accent));
}
.tut-header h2 {
  font-family: var(--font-title);
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  color: var(--accent);
  margin: .3rem 0 .2rem;
  letter-spacing: .04em;
}
.tut-subtitle {
  color: var(--text-dim);
  font-size: .82rem;
}

/* Tabs */
.tut-tabs {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  margin-bottom: .8rem;
  flex-shrink: 0;
}
.tut-tab {
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 6px;
  color: var(--text-dim);
  font-size: .75rem;
  font-family: var(--font-body);
  padding: .38rem .7rem;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
}
.tut-tab:hover { background: rgba(232,160,48,.1); border-color: var(--accent); color: var(--accent); }
.tut-tab.active {
  background: rgba(232,160,48,.15);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

/* Panels */
.tut-content {
  flex: 1;
  overflow-y: auto;
  padding-right: .3rem;
}
.tut-panel { display: none; }
.tut-panel.active { display: block; animation: fadeIn .2s ease; }

.tut-panel h3 {
  font-family: var(--font-title);
  color: var(--accent);
  font-size: 1rem;
  margin: 1.1rem 0 .5rem;
  letter-spacing: .03em;
}
.tut-panel h3:first-child { margin-top: 0; }
.tut-panel p {
  color: var(--text-dim);
  line-height: 1.75;
  font-size: .88rem;
  margin-bottom: .65rem;
}
.tut-panel strong { color: var(--text); }

.tut-list {
  list-style: none;
  padding: 0;
  margin: .4rem 0 .8rem;
}
.tut-list li {
  color: var(--text-dim);
  font-size: .88rem;
  line-height: 1.7;
  padding: .3rem 0 .3rem 1.4rem;
  position: relative;
  border-bottom: 1px solid rgba(255,255,255,.04);
}
.tut-list li::before {
  content: '▸';
  position: absolute;
  left: 0;
  color: var(--accent);
}

/* Rule cards */
.rule-card {
  display: flex;
  gap: .8rem;
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 8px;
  padding: .75rem .9rem;
  margin-bottom: .6rem;
  align-items: flex-start;
}
.rule-num {
  min-width: 28px;
  height: 28px;
  background: var(--accent2);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: .82rem;
  flex-shrink: 0;
  margin-top: .1rem;
}
.rule-card strong { display: block; color: var(--text); font-size: .88rem; margin-bottom: .2rem; }
.rule-card p { margin: 0; font-size: .83rem; }

/* Variant cards */
.variant-card {
  display: flex;
  gap: .8rem;
  background: rgba(255,255,255,.03);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: 8px;
  padding: .7rem .9rem;
  margin-bottom: .55rem;
  align-items: flex-start;
}
.variant-flag { font-size: 1.8rem; flex-shrink: 0; line-height: 1; margin-top: .05rem; }
.variant-card strong { display: block; color: var(--text); font-size: .88rem; margin-bottom: .15rem; }
.variant-card p { margin: 0; font-size: .82rem; }
.variant-badge {
  display: inline-block;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 20px;
  padding: .1rem .55rem;
  font-size: .7rem;
  color: var(--text-dim);
  margin-left: .35rem;
  vertical-align: middle;
  font-weight: 400;
}
.active-variant {
  background: rgba(60,200,100,.12);
  border-color: rgba(60,200,100,.3);
  color: #5de09a;
}

/* Highlight / tip boxes */
.highlight-box {
  background: rgba(232,160,48,.08);
  border: 1px solid rgba(232,160,48,.2);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: .7rem .9rem;
  margin: .6rem 0;
  font-size: .84rem;
  color: var(--text-dim);
  line-height: 1.6;
}
.highlight-box strong { color: var(--accent); }

.tut-tip {
  background: rgba(80,200,120,.08);
  border: 1px solid rgba(80,200,120,.2);
  border-left: 3px solid #50c878;
  border-radius: 6px;
  padding: .7rem .9rem;
  margin-top: .8rem;
  font-size: .84rem;
  color: var(--text-dim);
  line-height: 1.6;
}
.tut-tip strong { color: #80e0a0; }

.tut-footer {
  padding-top: .9rem;
  border-top: 1px solid rgba(255,255,255,.08);
  text-align: center;
  flex-shrink: 0;
}

/* Light theme for tutorial */
body[data-theme="light"] .tut-tab { background: rgba(0,0,0,.04); border-color: rgba(0,0,0,.1); color: var(--text-dim); }
body[data-theme="light"] .tut-tab.active,
body[data-theme="light"] .tut-tab:hover { background: rgba(176,88,0,.08); border-color: var(--accent); color: var(--accent); }
body[data-theme="light"] .rule-card,
body[data-theme="light"] .variant-card { background: rgba(0,0,0,.03); border-color: rgba(0,0,0,.08); }
body[data-theme="light"] .highlight-box { background: rgba(176,88,0,.06); border-color: rgba(176,88,0,.2); border-left-color: var(--accent); }
body[data-theme="light"] .tut-tip { background: rgba(20,140,60,.06); border-color: rgba(20,140,60,.2); border-left-color: #148c3c; }
body[data-theme="light"] .tut-tip strong { color: #0a7030; }
body[data-theme="light"] .tut-list li { border-color: rgba(0,0,0,.05); }
body[data-theme="light"] .active-variant { background: rgba(20,140,60,.1); border-color: rgba(20,140,60,.25); color: #0a7030; }
body[data-theme="light"] .tut-header,
body[data-theme="light"] .tut-footer { border-color: rgba(0,0,0,.1); }

/* ── Cookie Banner ───────────────────────────── */
.cookie-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 7000;
  background: var(--surface, #2e1a08);
  border-top: 1px solid var(--border, #3d2510);
  box-shadow: 0 -4px 20px rgba(0,0,0,.4);
  padding: .9rem 1.2rem;
  animation: slideUp .3s ease;
}
.cookie-banner.hidden { display: none; }

.cookie-inner {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.cookie-text {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  flex: 1;
  min-width: 220px;
}
.cookie-emoji { font-size: 1.4rem; flex-shrink: 0; margin-top: .05rem; }
.cookie-text strong { display: block; font-size: .88rem; color: var(--text); margin-bottom: .15rem; }
.cookie-text p { font-size: .78rem; color: var(--text-dim); line-height: 1.5; margin: 0; }
.cookie-text a { color: var(--accent); }

.cookie-btns {
  display: flex;
  gap: .5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.btn-cookie-accept {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #1a0d05;
  border: none;
  border-radius: 6px;
  padding: .5rem 1.2rem;
  font-size: .82rem;
  font-weight: 700;
  cursor: pointer;
  font-family: var(--font-body);
  transition: transform .1s;
}
.btn-cookie-accept:hover { transform: scale(1.03); }
.btn-cookie-decline {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 6px;
  padding: .5rem 1rem;
  font-size: .8rem;
  cursor: pointer;
  font-family: var(--font-body);
  transition: border-color .15s, color .15s;
}
.btn-cookie-decline:hover { border-color: var(--accent); color: var(--accent); }

body[data-theme="light"] .cookie-banner {
  background: var(--surface, #fff8f0);
  border-top-color: rgba(0,0,0,.1);
}
body[data-theme="light"] .btn-cookie-decline {
  border-color: rgba(0,0,0,.15);
  color: var(--text-dim);
}
body[data-theme="light"] .btn-cookie-accept { color: #fff; }

/* ── Legal Modals ────────────────────────────── */
.legal-box {
  width: min(600px, 100%);
  max-height: 85dvh;
  display: flex;
  flex-direction: column;
}
.legal-content {
  flex: 1;
  overflow-y: auto;
  padding-right: .3rem;
}
.legal-content h4 {
  font-size: .88rem;
  font-weight: 700;
  color: var(--accent);
  margin: 1rem 0 .3rem;
  letter-spacing: .04em;
}
.legal-content h4:first-child { margin-top: 0; }
.legal-content p {
  font-size: .84rem;
  color: var(--text-dim);
  line-height: 1.7;
  margin-bottom: .5rem;
}
.legal-content em { color: var(--text-dim); opacity: .7; }
.legal-box .btn-secondary { margin-top: .8rem; align-self: flex-end; flex-shrink: 0; }

/* Footer legal links */
footer a { color: var(--accent); text-decoration: none; }
footer a:hover { text-decoration: underline; }
