/* ==========================================================================
   GenioBuzz — Game-specific layouts
   Shared visual patterns reused by multiple games (boards/grids/canvas).
   ========================================================================== */

/* ---------- Choice buttons (RPS, Higher/Lower, Odd/Even, True/False) ---------- */
.choice-row { display: flex; gap: var(--space-4); flex-wrap: wrap; justify-content: center; }
.choice-btn {
  min-width: 110px;
  min-height: 110px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: var(--space-2);
  border-radius: var(--radius-md);
  border: 2px solid var(--line);
  background: var(--paper-raised);
  font-weight: 700;
  font-size: var(--step-1);
}
.choice-btn .choice-emoji { font-size: 2rem; }
.choice-btn:hover { border-color: var(--brand); }
.choice-btn[data-state="win"] { border-color: var(--good); background: var(--good-tint); }
.choice-btn[data-state="lose"] { border-color: var(--bad); background: var(--bad-tint); }

/* ---------- Square grid boards (Tic-Tac-Toe) ---------- */
.board-grid {
  display: grid;
  gap: 8px;
  width: min(360px, 90vw);
  margin-inline: auto;
}
.board-grid[data-size="3"] { grid-template-columns: repeat(3, 1fr); }
.board-cell {
  aspect-ratio: 1;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  font-weight: 700;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}
.board-cell:not([disabled]):hover { background: var(--brand-tint); }
.board-cell[data-mark="X"] { color: var(--brand-ink); }
.board-cell[data-mark="O"] { color: var(--bad); }
.board-cell.is-winning { background: var(--buzz-tint); border-color: var(--buzz); }

/* ---------- Connect Four ---------- */
.c4-board {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  background: var(--brand);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  width: min(480px, 94vw);
  margin-inline: auto;
}
.c4-col-btn {
  grid-column: span 1;
  background: transparent;
  border: none;
  min-height: 44px;
}
.c4-cell {
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--paper-raised);
}
.c4-cell[data-piece="1"] { background: var(--buzz); }
.c4-cell[data-piece="2"] { background: var(--bad); }

/* ---------- Memory / matching grids ---------- */
.match-grid {
  display: grid;
  gap: 10px;
  width: min(420px, 94vw);
  margin-inline: auto;
}
.match-card {
  aspect-ratio: 3/4;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--brand-tint);
  font-size: 1.6rem;
  display: grid; place-items: center;
}
.match-card[data-face="up"] { background: var(--paper-raised); }
.match-card[data-face="matched"] { background: var(--good-tint); border-color: var(--good); }

/* ---------- Simon Says ---------- */
.simon-pad {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: min(300px, 80vw);
  margin-inline: auto;
}
.simon-pad button {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  border: none;
  opacity: 0.55;
}
.simon-pad button.is-lit { opacity: 1; }
.simon-pad button:nth-child(1) { background: #ff5f5f; }
.simon-pad button:nth-child(2) { background: #4cc2ff; }
.simon-pad button:nth-child(3) { background: #ffd23c; }
.simon-pad button:nth-child(4) { background: #5cd67d; }

/* ---------- Number line / input row (guessing games, math) ---------- */
.number-row { display: flex; gap: var(--space-3); justify-content: center; flex-wrap: wrap; align-items: center; }
.number-input {
  width: 8ch;
  text-align: center;
  min-height: 48px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  font-size: var(--step-1);
}
.math-problem {
  font-family: var(--font-display);
  font-size: var(--step-3);
  text-align: center;
  margin-bottom: var(--space-4);
}

/* ---------- Hangman figure ---------- */
.hangman-figure { display: block; margin-inline: auto; width: min(220px, 60vw); }
.hangman-word { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-block: var(--space-4); }
.hangman-word span {
  width: 28px; text-align: center;
  border-bottom: 3px solid var(--ink);
  font-family: var(--font-display);
  font-size: var(--step-2);
}

/* ---------- Canvas games ---------- */
.game-canvas-wrap { display: flex; justify-content: center; }
canvas.game-canvas {
  width: 100%;
  max-width: 480px;
  height: auto;
  background: var(--paper-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  touch-action: none;
}

/* ---------- On-screen directional pad (Snake, Maze, Dodge) ---------- */
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(3, 56px);
  gap: 6px;
  justify-content: center;
  margin-top: var(--space-4);
}
.dpad button {
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--paper-raised);
  font-size: 1.3rem;
}
.dpad .dpad-up { grid-column: 2; grid-row: 1; }
.dpad .dpad-left { grid-column: 1; grid-row: 2; }
.dpad .dpad-right { grid-column: 3; grid-row: 2; }
.dpad .dpad-down { grid-column: 2; grid-row: 3; }

/* ---------- Random Wheel ---------- */
.wheel-svg {
  width: min(320px, 90vw);
  height: min(320px, 90vw);
  display: block;
}
.wheel-rotor {
  transform-origin: 160px 160px;
  transform-box: fill-box;
}

/* ---------- Wheel of Names reel ---------- */
.name-reel {
  max-width: 420px;
  margin-inline: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--paper-raised);
}
.name-reel-window {
  height: 84px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: var(--step-2);
  font-weight: 700;
  border-bottom: 3px solid var(--brand);
}
.name-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 12px;
}
.name-chip {
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: var(--step--1);
  color: #fff;
}

/* ---------- Coin ---------- */
.coin-stage { perspective: 800px; display: flex; justify-content: center; margin: 20px 0; }
.coin {
  width: 140px; height: 140px;
  border-radius: 50%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 1.1s cubic-bezier(0.2, 0.7, 0.3, 1);
}
.coin-face {
  position: absolute; inset: 0;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: var(--step-1);
  color: #fff;
  backface-visibility: hidden;
  box-shadow: inset 0 0 0 4px rgba(255,255,255,0.35);
}
.coin-face--heads { background: linear-gradient(160deg, var(--brand), var(--brand-ink)); }
.coin-face--tails { background: linear-gradient(160deg, var(--buzz), #d99a00); transform: rotateY(180deg); }

@media (min-width: 768px) {
  .dpad { display: none; } /* keyboard is sufficient on desktop; shown only on touch via JS toggle */
}
