/* Mini games — shared layout + game shells */

.games-filters {
  margin-bottom: 1.5rem;
}

.games-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  background: #fff;
  color: #475569;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.games-filter-chip:hover {
  border-color: rgba(236, 72, 153, 0.45);
  color: #db2777;
  background: rgba(236, 72, 153, 0.06);
}

.games-filter-chip.is-active {
  background: linear-gradient(135deg, #ec4899, #f59e0b);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(236, 72, 153, 0.35);
}

body[data-theme="dark"] .games-filter-chip {
  background: rgba(255, 255, 255, 0.04);
  color: #cbd5e1;
  border-color: rgba(255, 255, 255, 0.08);
}

body[data-theme="dark"] .games-filter-chip:hover {
  border-color: rgba(236, 72, 153, 0.55);
  background: rgba(236, 72, 153, 0.14);
  color: #fbcfe8;
}

.game-page {
  padding: 6rem 0 3rem;
  min-height: 70vh;
}

.game-page__back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: #64748b;
  text-decoration: none;
  margin-bottom: 1rem;
  transition: color 0.15s ease;
}

.game-page__back:hover { color: #db2777; }

body[data-theme="dark"] .game-page__back { color: #94a3b8; }
body[data-theme="dark"] .game-page__back:hover { color: #fbcfe8; }

.game-page__head {
  display: flex;
  align-items: flex-start;
  gap: 1.2rem;
  padding: 1.5rem 1.6rem;
  border-radius: 1.25rem;
  background: #fff;
  box-shadow: 0 6px 28px rgba(15, 23, 42, 0.06);
  border: 1px solid rgba(0, 0, 0, 0.05);
  margin-bottom: 1.5rem;
}

body[data-theme="dark"] .game-page__head {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.18);
}

.game-page__icon {
  flex-shrink: 0;
  width: 64px;
  height: 64px;
  border-radius: 1rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.5rem;
  box-shadow: 0 10px 26px rgba(236, 72, 153, 0.28);
}

.game-page__eyebrow {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #db2777;
  margin-bottom: 0.2rem;
}

body[data-theme="dark"] .game-page__eyebrow { color: #fbcfe8; }

.game-page__title {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 0.3rem 0;
  color: #0f172a;
}

body[data-theme="dark"] .game-page__title { color: #f1f5f9; }

.game-page__desc {
  margin: 0;
  font-size: 0.92rem;
  color: #475569;
  line-height: 1.6;
  max-width: 640px;
}

body[data-theme="dark"] .game-page__desc { color: #cbd5e1; }

.game-page__body {
  background: #fff;
  border-radius: 1.25rem;
  padding: 1.75rem;
  box-shadow: 0 6px 28px rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.05);
  margin-bottom: 1.5rem;
}

body[data-theme="dark"] .game-page__body {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.18);
}

.game-page__about {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.08), rgba(245, 158, 11, 0.05));
  border: 1px solid rgba(236, 72, 153, 0.2);
  border-radius: 1rem;
  padding: 1.2rem 1.4rem;
  margin-bottom: 2rem;
}

body[data-theme="dark"] .game-page__about {
  background: rgba(236, 72, 153, 0.1);
  border-color: rgba(236, 72, 153, 0.28);
}

.game-page__about-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin: 0 0 0.5rem 0;
  color: #be185d;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

body[data-theme="dark"] .game-page__about-title { color: #fbcfe8; }

.game-page__about-text {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.6;
  color: #475569;
}

body[data-theme="dark"] .game-page__about-text { color: #cbd5e1; }

.game-page__related-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 0 0 1rem 0;
  color: #0f172a;
}

body[data-theme="dark"] .game-page__related-title { color: #f1f5f9; }

/* Reuse tool-card from tools.css on index — games index loads tools.css too */

/* —— Snake —— */
.snake-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

.snake-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  font-family: ui-monospace, monospace;
  font-weight: 700;
  color: #0f172a;
}

body[data-theme="dark"] .snake-hud { color: #e2e8f0; }

.snake-canvas-wrap {
  border-radius: 1rem;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.12);
  line-height: 0;
}

.snake-canvas-wrap canvas {
  display: block;
  background: #ecfdf5;
  max-width: 100%;
  height: auto;
}

body[data-theme="dark"] .snake-canvas-wrap canvas {
  background: #022c22;
}

.snake-dpad {
  display: grid;
  grid-template-columns: repeat(3, 3.2rem);
  grid-template-rows: repeat(3, 3.2rem);
  gap: 0.35rem;
  justify-content: center;
}

.snake-dpad button {
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 0.55rem;
  background: #f1f5f9;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease;
}

.snake-dpad button:active { transform: scale(0.96); }

body[data-theme="dark"] .snake-dpad button {
  background: rgba(148, 163, 184, 0.15);
  border-color: rgba(148, 163, 184, 0.25);
  color: #e2e8f0;
}

.snake-dpad .snake-dpad__up { grid-column: 2; grid-row: 1; }
.snake-dpad .snake-dpad__left { grid-column: 1; grid-row: 2; }
.snake-dpad .snake-dpad__down { grid-column: 2; grid-row: 3; }
.snake-dpad .snake-dpad__right { grid-column: 3; grid-row: 2; }

.game-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.55rem 1.1rem;
  border-radius: 0.65rem;
  font-weight: 600;
  font-size: 0.88rem;
  border: 0;
  cursor: pointer;
  background: linear-gradient(135deg, #ec4899, #f97316);
  color: #fff;
  box-shadow: 0 6px 16px rgba(236, 72, 153, 0.35);
}

.game-btn:hover { filter: brightness(1.05); color: #fff; }

.game-btn--ghost {
  background: transparent;
  color: #64748b;
  border: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: none;
}

body[data-theme="dark"] .game-btn--ghost {
  color: #cbd5e1;
  border-color: rgba(148, 163, 184, 0.25);
}

/* —— Memory —— */
.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  max-width: 420px;
  margin: 0 auto 1rem;
}

@media (min-width: 480px) {
  .memory-grid { gap: 0.75rem; }
}

.memory-card {
  position: relative;
  display: block;
  aspect-ratio: 1;
  width: 100%;
  border-radius: 0.65rem;
  cursor: pointer;
  perspective: 600px;
  border: 0;
  padding: 0;
  background: transparent;
}

.memory-card__inner {
  position: absolute;
  inset: 0;
  display: block;
  border-radius: 0.65rem;
  transition: transform 0.4s ease;
  transform-style: preserve-3d;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12);
}

.memory-card.is-flipped .memory-card__inner,
.memory-card.is-matched .memory-card__inner {
  transform: rotateY(180deg);
}

.memory-card__face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0.65rem;
  font-size: clamp(1.6rem, 6vw, 2.2rem);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.memory-card__back {
  background: linear-gradient(145deg, #6366f1, #a855f7);
  color: #fff;
  font-weight: 700;
  font-size: 1.4rem;
  background-image:
    linear-gradient(145deg, #6366f1, #a855f7),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.08) 0 6px, transparent 6px 14px);
  background-blend-mode: overlay;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.18);
}

.memory-card__front {
  background: #fff;
  transform: rotateY(180deg);
  border: 2px solid rgba(99, 102, 241, 0.35);
  color: #1e293b;
}

body[data-theme="dark"] .memory-card__front {
  background: #1e293b;
  border-color: rgba(167, 139, 250, 0.45);
  color: #f1f5f9;
}

.memory-card:hover:not(.is-matched):not(.is-flipped) .memory-card__inner {
  transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(99, 102, 241, 0.32);
}

.memory-card.is-matched .memory-card__front {
  opacity: 0.6;
  cursor: default;
  border-color: rgba(34, 197, 94, 0.55);
  box-shadow: inset 0 0 0 2px rgba(34, 197, 94, 0.45);
}

/* —— Reaction —— */
.reaction-zone {
  max-width: 420px;
  margin: 0 auto 1rem;
  min-height: 220px;
  border-radius: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1.5rem;
  font-weight: 700;
  font-size: 1.15rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
  background: #e2e8f0;
  color: #475569;
  border: 2px dashed rgba(71, 85, 105, 0.35);
}

.reaction-zone:active { transform: scale(0.99); }

.reaction-zone.is-wait {
  background: #fef3c7;
  color: #92400e;
  border-color: rgba(245, 158, 11, 0.5);
}

.reaction-zone.is-go {
  background: #22c55e;
  color: #fff;
  border: 2px solid #16a34a;
  font-size: 1.6rem;
}

.reaction-zone.is-result {
  background: #f1f5f9;
  color: #0f172a;
  border-style: solid;
}

.reaction-zone.is-foul {
  background: #fee2e2;
  color: #991b1b;
  border-color: #f87171;
}

body[data-theme="dark"] .reaction-zone {
  background: #1e293b;
  color: #cbd5e1;
}

body[data-theme="dark"] .reaction-zone.is-wait {
  background: rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

body[data-theme="dark"] .reaction-zone.is-go {
  background: #15803d;
  color: #fff;
}

body[data-theme="dark"] .reaction-zone.is-result {
  background: #0f172a;
  color: #f1f5f9;
}

body[data-theme="dark"] .reaction-zone.is-foul {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
}

.reaction-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: center;
  font-family: ui-monospace, monospace;
  font-size: 0.95rem;
  color: #475569;
}

body[data-theme="dark"] .reaction-stats { color: #94a3b8; }

/* —— Tic-tac-toe —— */
.ttt-board {
  display: grid;
  grid-template-columns: repeat(3, 5.5rem);
  grid-template-rows: repeat(3, 5.5rem);
  gap: 0.45rem;
  justify-content: center;
  margin: 0 auto 1rem;
}

@media (max-width: 400px) {
  .ttt-board {
    grid-template-columns: repeat(3, 4.8rem);
    grid-template-rows: repeat(3, 4.8rem);
  }
}

.ttt-cell {
  border-radius: 0.65rem;
  border: 2px solid rgba(37, 99, 235, 0.25);
  background: #fff;
  font-size: 2rem;
  font-weight: 800;
  color: #1e40af;
  cursor: pointer;
  transition: background 0.12s ease, transform 0.12s ease;
}

.ttt-cell:hover:not(:disabled) {
  background: #eff6ff;
  transform: scale(1.02);
}

.ttt-cell:disabled {
  cursor: default;
  opacity: 0.9;
}

body[data-theme="dark"] .ttt-cell {
  background: #1e293b;
  border-color: rgba(56, 189, 248, 0.35);
  color: #7dd3fc;
}

.ttt-status {
  text-align: center;
  font-weight: 700;
  min-height: 1.6rem;
  margin-bottom: 0.75rem;
  color: #0f172a;
}

body[data-theme="dark"] .ttt-status { color: #e2e8f0; }

.ttt-x { color: #dc2626 !important; }
.ttt-o { color: #2563eb !important; }
