/* ============================================================
   PlayHub — стили игровых полей
   ============================================================ */
.game-panel {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
}
@keyframes pop {
  0% {
    transform: scale(0.55);
  }
  60% {
    transform: scale(1.12);
  }
  100% {
    transform: scale(1);
  }
}

/* ---- Крестики-нолики ---- */
.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 12px;
  width: min(86vw, 360px);
  aspect-ratio: 1;
}
.ttt-cell {
  display: grid;
  place-items: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: clamp(40px, 13vw, 62px);
  font-weight: 700;
  line-height: 1;
  transition: background 0.15s, transform 0.1s;
}
.ttt-cell:not(:disabled):hover {
  background: var(--surface-3);
  transform: translateY(-2px);
}
.ttt-cell.x {
  color: var(--cyan);
}
.ttt-cell.o {
  color: var(--pink);
}
.ttt-cell.win {
  background: rgba(52, 211, 153, 0.18);
  border-color: var(--green);
  animation: pop 0.35s var(--ease);
}

/* ---- Четыре в ряд ---- */
.c4-board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 9px; /* фиксированный зазор — симметричен по обеим осям (проценты ломали вертикаль) */
  padding: 13px;
  width: min(94vw, 452px);
  border-radius: 20px;
  background: linear-gradient(160deg, #4059c9, #1e3a8a);
  box-shadow: var(--shadow-lg), inset 0 2px 8px rgba(255, 255, 255, 0.15);
}
.c4-cell {
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(3, 7, 30, 0.42);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.45);
  display: grid;
  place-items: center;
  cursor: pointer;
}
.c4-cell.col-hover {
  background: rgba(3, 7, 30, 0.6);
}
.c4-disc {
  width: 84%;
  height: 84%;
  border-radius: 50%;
}
.c4-disc.red {
  background: radial-gradient(circle at 34% 28%, #ff9a9a, #e11d48);
  box-shadow: inset 0 -5px 9px rgba(0, 0, 0, 0.32);
}
.c4-disc.yellow {
  background: radial-gradient(circle at 34% 28%, #ffe58a, #f59e0b);
  box-shadow: inset 0 -5px 9px rgba(0, 0, 0, 0.32);
}
.c4-disc.dropping {
  animation: c4drop 0.4s cubic-bezier(0.33, 0.66, 0.4, 1.2);
}
@keyframes c4drop {
  from {
    transform: translateY(-720%);
  }
  to {
    transform: translateY(0);
  }
}
.c4-disc.c4-win {
  box-shadow: 0 0 0 3px #fff, inset 0 -5px 9px rgba(0, 0, 0, 0.32);
  animation: c4win 0.7s ease infinite alternate;
}
@keyframes c4win {
  to {
    filter: brightness(1.45) saturate(1.2);
  }
}

/* ---- Сапёр ---- */
.ms-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  padding: 8px 16px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.ms-hud-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}
.ms-face {
  font-size: 24px;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  transition: transform 0.1s;
}
.ms-face:active {
  transform: scale(0.92);
}
.ms-board-wrap {
  max-width: 100%;
  overflow-x: auto;
  padding: 4px 2px 8px;
}
.ms-board {
  display: grid;
  grid-template-columns: repeat(var(--cols), var(--cell, 30px));
  gap: 3px;
  margin: 0 auto;
}
.ms-cell {
  width: var(--cell, 30px);
  height: var(--cell, 30px);
  padding: 0;
  border-radius: 6px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: calc(var(--cell, 30px) * 0.54);
  line-height: 1;
  cursor: pointer;
  user-select: none;
}
.ms-cell:hover:not(.open):not(.flag) {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
.ms-cell.open {
  background: rgba(255, 255, 255, 0.015);
  cursor: default;
}
.ms-cell.flag {
  background: rgba(251, 191, 36, 0.12);
}
.ms-cell.mine {
  background: rgba(251, 113, 133, 0.22);
}
.ms-cell.boom {
  background: var(--red);
  animation: pop 0.3s var(--ease);
}
.ms-cell.n1 { color: #60a5fa; }
.ms-cell.n2 { color: #34d399; }
.ms-cell.n3 { color: #fb7185; }
.ms-cell.n4 { color: #a78bfa; }
.ms-cell.n5 { color: #fbbf24; }
.ms-cell.n6 { color: #22d3ee; }
.ms-cell.n7 { color: #f472b6; }
.ms-cell.n8 { color: #e5e7eb; }
@media (max-width: 560px) {
  .ms-board {
    --cell: 27px;
  }
}

/* ---- Шахматы ---- */
.chess-wrap {
  width: min(92vw, 460px);
  padding: 10px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
}
.chess-board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  grid-template-rows: repeat(8, 1fr);
  width: 100%;
  aspect-ratio: 1;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px var(--border);
}
.chess-sq {
  position: relative;
  display: grid;
  place-items: center;
  padding: 0;
  border: none;
  cursor: pointer;
}
.chess-sq.light {
  background: #46406b;
}
.chess-sq.dark {
  background: #2b2748;
}
.chess-sq.sel {
  box-shadow: inset 0 0 0 3px var(--accent);
  background: #5a4f8f;
}
.chess-sq.last::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(124, 92, 255, 0.32);
}
.chess-sq.check::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(239, 68, 68, 0.75), transparent 72%);
}
.chess-sq .cp {
  position: relative;
  z-index: 2;
  font-size: clamp(26px, 7.4vw, 44px);
  line-height: 1;
}
.chess-sq .cp {
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.4));
}
.cp.w {
  color: #f6f4ff;
  -webkit-text-stroke: 1.4px #241f3a;
}
.cp.b {
  color: #14111f;
  -webkit-text-stroke: 1.4px #b7afdd;
}
.chess-sq.target::after {
  content: '';
  position: absolute;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: rgba(157, 123, 255, 0.55);
  z-index: 1;
}
.chess-sq.capture::after {
  content: '';
  position: absolute;
  inset: 6%;
  border-radius: 50%;
  border: 4px solid rgba(157, 123, 255, 0.6);
  z-index: 1;
}
.coord {
  position: absolute;
  font-size: 10px;
  font-weight: 700;
  z-index: 3;
  pointer-events: none;
}
.coord.file {
  bottom: 1px;
  right: 3px;
}
.coord.rank {
  top: 1px;
  left: 3px;
}
.chess-sq.light .coord {
  color: rgba(255, 255, 255, 0.55);
}
.chess-sq.dark .coord {
  color: rgba(255, 255, 255, 0.4);
}
.promo-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 18px;
}
.promo-btn {
  width: 66px;
  height: 66px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
  transition: background 0.15s, border-color 0.15s;
}
.promo-btn:hover {
  background: var(--surface-3);
  border-color: var(--accent);
}
.chess-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

/* ---- 2048 ---- */
.g2048-hud {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 14px;
}
.g2048-score {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px 20px;
  text-align: center;
  min-width: 100px;
}
.g2048-score-label {
  font-size: 0.68rem;
  letter-spacing: 0.09em;
  color: var(--text-faint);
  font-weight: 800;
}
.g2048-score-val {
  font-size: 1.35rem;
  font-weight: 850;
  font-variant-numeric: tabular-nums;
}
.g2048-board {
  position: relative;
  width: min(92vw, 420px);
  aspect-ratio: 1;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 16px;
  touch-action: none;
}
.g2048-cell {
  position: absolute;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.045);
}
.tile {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  transition: transform 0.12s ease;
  will-change: transform;
}
.tile-inner {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-weight: 850;
  line-height: 1;
}
.tile-2 { background: #eee4da; color: #4b4640; }
.tile-4 { background: #ede0c8; color: #4b4640; }
.tile-8 { background: #f2b179; color: #fff; }
.tile-16 { background: #f59563; color: #fff; }
.tile-32 { background: #f67c5f; color: #fff; }
.tile-64 { background: #f65e3b; color: #fff; }
.tile-128 { background: #edcf72; color: #fff; }
.tile-256 { background: #edcc61; color: #fff; }
.tile-512 { background: #edc850; color: #fff; }
.tile-1024 { background: #edc53f; color: #fff; }
.tile-2048 {
  background: #edc22e;
  color: #fff;
  box-shadow: 0 0 26px rgba(237, 194, 46, 0.6);
}
.tile-super {
  background: #3c3a32;
  color: #fff;
}
.appear {
  animation: t-appear 0.18s ease;
}
.pop {
  animation: t-pop 0.18s ease;
}
@keyframes t-appear {
  from {
    transform: scale(0);
  }
}
@keyframes t-pop {
  50% {
    transform: scale(1.16);
  }
}

/* ---- Судоку ---- */
.sdk-hud {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin-bottom: 14px;
}
.sdk-hud-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 6px 15px;
  border-radius: 12px;
}
.sdk-wrap {
  width: min(94vw, 460px);
}
.sdk-board {
  display: grid;
  grid-template-columns: repeat(9, 1fr);
  grid-template-rows: repeat(9, 1fr);
  width: 100%;
  aspect-ratio: 1;
  background: var(--surface-2);
  border: 2.5px solid var(--border-strong);
  border-radius: 14px;
  overflow: hidden;
}
.sdk-cell {
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--violet-2);
  font-weight: 650;
  font-size: clamp(17px, 5.2vw, 27px);
  line-height: 1;
  cursor: pointer;
  transition: background 0.12s;
}
.sdk-cell.box-l {
  border-left: 2.5px solid var(--border-strong);
}
.sdk-cell.box-t {
  border-top: 2.5px solid var(--border-strong);
}
.sdk-cell.given {
  color: var(--text);
  font-weight: 850;
  cursor: default;
}
.sdk-cell.peer {
  background: rgba(var(--accent-rgb), 0.08);
}
.sdk-cell.same {
  background: rgba(34, 211, 238, 0.18);
}
.sdk-cell.wrong {
  color: var(--red);
  background: rgba(251, 113, 133, 0.16);
}
.sdk-cell.sel {
  background: rgba(var(--accent-rgb), 0.42);
  box-shadow: inset 0 0 0 2px var(--accent);
  color: #fff;
}
.sdk-pad {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  width: min(94vw, 460px);
  margin-top: 16px;
}
.sdk-key {
  padding: 13px 0;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.sdk-key:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
}
.sdk-key:active {
  transform: scale(0.94);
}
.sdk-erase {
  color: var(--text-dim);
}
