/* ==========================================================================
   PlayLite — per-game board styles (loaded on game pages only)
   Games added later inject their own scoped CSS via PLG.css(), so only the
   original board-based games need rules here.
   ========================================================================== */

/* ------------------------------------------------------------------- 2048 */
.g2048-board {
  --cell: min(19vw, 92px);
  grid-template-columns: repeat(4, var(--cell));
  grid-auto-rows: var(--cell);
  background: var(--bg-soft); padding: 8px; border-radius: 14px; gap: 8px;
  touch-action: none;
}
.g2048-cell {
  border-radius: 8px; background: var(--line);
  display: grid; place-items: center;
  font-weight: 800; font-size: clamp(.9rem, calc(var(--cell) * .34), 2rem);
  font-variant-numeric: tabular-nums;
}
.g2048-cell.pop { animation: pop .15s var(--ease-out); }
@keyframes pop { 0% { transform: scale(.55); } 100% { transform: scale(1); } }

/* ------------------------------------------------------------ minesweeper */
.mine-board { gap: 3px; max-width: 100%; overflow: auto; padding-bottom: 4px; }
.mine-cell {
  width: 32px; height: 32px; border-radius: 6px;
  background: var(--card-3); border: 1px solid var(--line);
  display: grid; place-items: center; font-weight: 800; font-size: .9rem;
  cursor: pointer; user-select: none;
  transition: background .1s var(--ease);
}
.mine-cell:not(.open):hover { background: var(--brand-soft); }
.mine-cell.open { background: var(--bg-soft); border-color: transparent; cursor: default; }
.mine-cell.boom { background: var(--bad); color: #fff; }
@media (max-width: 480px) { .mine-cell { width: 30px; height: 30px; } }

/* ----------------------------------------------------------- memory match */
.mem-board { grid-template-columns: repeat(4, minmax(58px, 84px)); }
.mem-card { aspect-ratio: 1; border-radius: 12px; cursor: pointer; perspective: 600px; position: relative; }
.mem-inner { position: absolute; inset: 0; transition: transform .32s var(--ease-out); transform-style: preserve-3d; }
.mem-card.flip .mem-inner { transform: rotateY(180deg); }
.mem-face {
  position: absolute; inset: 0; border-radius: 12px;
  display: grid; place-items: center; font-size: clamp(22px, 6vw, 34px);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.mem-back {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; font-size: 20px;
}
.mem-front {
  background: var(--card-2); border: 1px solid var(--line); transform: rotateY(180deg);
}
.mem-card.done .mem-front { background: color-mix(in srgb, var(--good) 18%, var(--card-2)); }

/* ----------------------------------------------------------------- sudoku */
.sudoku-board {
  grid-template-columns: repeat(9, minmax(30px, 46px));
  gap: 0; border: 2px solid var(--text); border-radius: 6px; overflow: hidden;
}
.su-cell {
  aspect-ratio: 1; display: grid; place-items: center;
  font-weight: 700; font-size: clamp(.9rem, 3.4vw, 1.15rem);
  background: var(--card); border: 1px solid var(--line);
  cursor: pointer; font-variant-numeric: tabular-nums;
}
.su-cell.given { background: var(--bg-soft); cursor: default; }
.su-cell.sel { background: var(--brand-soft); outline: 2px solid var(--brand); outline-offset: -2px; }
.su-cell.same { background: color-mix(in srgb, var(--brand-soft) 60%, var(--card)); }
.su-cell.bad { color: var(--bad); }
.su-cell.br { border-right: 2px solid var(--text); }
.su-cell.bb { border-bottom: 2px solid var(--text); }
.su-pad { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; max-width: 420px; }
.su-pad button {
  width: 42px; height: 46px; border-radius: 10px; border: 1px solid var(--line-2);
  background: var(--card-2); font-size: 1.1rem; font-weight: 700; cursor: pointer;
  color: var(--text); font-family: inherit;
}
.su-pad button:active { background: var(--brand); color: var(--brand-ink); }

/* ------------------------------------------------------------- word guess */
.wg-board { grid-template-rows: repeat(6, 1fr); gap: 6px; }
.wg-row { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.wg-tile {
  width: min(15vw, 60px); height: min(15vw, 60px);
  border: 2px solid var(--line-2); border-radius: 8px;
  display: grid; place-items: center;
  font-size: clamp(1.1rem, 6vw, 1.7rem); font-weight: 800; text-transform: uppercase;
  transition: transform .1s var(--ease), background .25s var(--ease), border-color .25s var(--ease);
}
.wg-tile.filled { border-color: var(--muted); transform: scale(1.04); }
.wg-tile.correct { background: var(--good); border-color: var(--good); color: #fff; }
.wg-tile.present { background: var(--accent); border-color: var(--accent); color: #fff; }
.wg-tile.absent { background: var(--muted); border-color: var(--muted); color: var(--card); }

/* --------------------------------------------------------- sliding puzzle */
.slide-board { background: var(--bg-soft); padding: 8px; border-radius: 14px; gap: 6px; touch-action: none; }
.slide-tile {
  border-radius: 9px; background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff; display: grid; place-items: center;
  font-weight: 800; font-size: clamp(1rem, 5vw, 1.5rem); cursor: pointer;
  font-variant-numeric: tabular-nums;
  transition: transform .1s var(--ease);
}
.slide-tile:active { transform: scale(.95); }
.slide-hole { background: transparent; }

/* ------------------------------------------------------------ tic-tac-toe */
.ttt-board { grid-template-columns: repeat(3, minmax(78px, 108px)); gap: 8px; }
.ttt-cell {
  aspect-ratio: 1; border-radius: 15px; background: var(--card-2);
  border: 1px solid var(--line); font-size: clamp(2rem, 9vw, 3rem); font-weight: 800;
  display: grid; place-items: center; cursor: pointer; color: var(--text);
  transition: background .14s var(--ease), border-color .14s var(--ease);
}
.ttt-cell:hover { border-color: var(--brand); }
.ttt-cell.win { background: color-mix(in srgb, var(--good) 22%, var(--card-2)); border-color: var(--good); }
.ttt-x { color: var(--brand); }
.ttt-o { color: var(--accent); }

/* ---------------------------------------------------------- whack-a-mole */
.mole-board { grid-template-columns: repeat(3, minmax(80px, 110px)); gap: 12px; }
.mole-hole {
  aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 50% 35%, var(--bg-soft), var(--line));
  display: grid; place-items: center; font-size: clamp(2.2rem, 10vw, 3.4rem);
  cursor: pointer; overflow: hidden; user-select: none;
  border: 1px solid var(--line);
}
.mole-hole .mole { transform: translateY(120%); transition: transform .12s var(--ease-out); pointer-events: none; }
.mole-hole.up .mole { transform: translateY(0); }
.mole-hole.bonk .mole { transform: translateY(10%) scale(.85) rotate(12deg); }

/* -------------------------------------------------------------- reaction */
.react-zone {
  width: 100%; max-width: 520px; height: 300px; border-radius: var(--r-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; cursor: pointer; font-weight: 800; font-size: 1.25rem; text-align: center;
  background: var(--card-2); color: var(--text); user-select: none; padding: 18px;
  border: 1px solid var(--line);
  transition: background .1s var(--ease);
}
.react-zone.wait { background: #b91c1c; color: #fff; border-color: #b91c1c; }
.react-zone.go { background: var(--good); color: #fff; border-color: var(--good); }
.react-zone .small { font-size: .86rem; font-weight: 600; opacity: .85; }

/* ---------------------------------------------------------- block puzzle */
.bp-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; width: 100%; }
.bp-board {
  --bp-cell: min(8vw, 36px);
  display: grid; grid-template-columns: repeat(10, var(--bp-cell));
  grid-auto-rows: var(--bp-cell); gap: 3px;
  background: var(--bg-soft); padding: 6px; border-radius: 12px; touch-action: none;
}
.bp-cell { border-radius: 5px; background: var(--line); }
.bp-cell.filled { background: var(--brand); }
.bp-cell.preview { background: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.bp-cell.clearing { animation: bpclear .26s var(--ease) forwards; }
@keyframes bpclear { to { transform: scale(.2); opacity: 0; } }
.bp-tray { display: flex; gap: 18px; justify-content: center; min-height: 90px; align-items: center; }
.bp-piece { display: grid; gap: 3px; cursor: grab; touch-action: none; }
.bp-piece.used { visibility: hidden; }
.bp-piece .pc { width: 22px; height: 22px; border-radius: 4px; background: var(--brand-2); }
.bp-piece .pc.empty { background: transparent; }
.bp-ghost { position: fixed; z-index: 99; pointer-events: none; display: grid; gap: 3px; opacity: .85; }
.bp-ghost .pc { width: var(--bp-cell, 34px); height: var(--bp-cell, 34px); border-radius: 5px; background: var(--brand-2); }
.bp-ghost .pc.empty { background: transparent; }
