/* Shared phone play layout and the dark gold-accent board.
   Opt in by adding game-mobile-play on .prepaid-play.
   Desktop stays the settings rail. Below 901px the order is:
   stake line, board, legend (settings extra), stats, quick actions,
   auto / sound / play, setup controls, verify.
   Keno is the reference. Other games reuse .game-board and .game-tile. */

.game-mobile-play {
  --game-board-bg: #0d1014;
  --game-board-border: #202833;
  --game-tile-top: #151b22;
  --game-tile-bottom: #10151b;
  --game-tile-border: #28323d;
  --game-tile-text: #f5f7fa;
  --game-tile-hover-top: #1a212a;
  --game-tile-hover-bottom: #12181f;
  --game-tile-hover-border: #394554;
  --game-selected-bg: #161311;
  --game-selected-border: #e8c047;
  --game-selected-text: #fff4cf;
  --game-selected-glow: rgba(232, 192, 71, 0.18);
  --game-hit-top: #f0d78a;
  --game-hit-bottom: #c4922a;
  --game-gold: #e8c047;
}

.game-board {
  position: relative;
  padding: 12px;
  border-radius: 14px;
  background: var(--game-board-bg);
  border: 1px solid var(--game-board-border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
  transition: border-color 0.35s ease, box-shadow 0.35s ease;
}

.game-board.is-win,
.game-board.is-gold-win {
  border-color: rgba(232, 192, 71, 0.55);
  box-shadow: 0 0 22px rgba(232, 192, 71, 0.12);
}

.game-board.is-lose {
  border-color: rgba(255, 120, 132, 0.28);
}

.game-tile {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid var(--game-tile-border);
  background: linear-gradient(180deg, var(--game-tile-top) 0%, var(--game-tile-bottom) 100%);
  color: var(--game-tile-text);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease, box-shadow 0.12s ease;
}

.game-tile:hover:not(.is-selected):not(.is-hit):not(.is-gold):not(.is-miss) {
  transform: translateY(-1px);
  border-color: var(--game-tile-hover-border);
  background: linear-gradient(180deg, var(--game-tile-hover-top) 0%, var(--game-tile-hover-bottom) 100%);
}

.game-tile.is-selected {
  background: var(--game-selected-bg);
  border-color: var(--game-selected-border);
  color: var(--game-selected-text);
  box-shadow: 0 0 12px var(--game-selected-glow), inset 0 0 0 1px rgba(232, 192, 71, 0.22);
}

.game-tile.is-miss {
  background: #080a0d;
  border-color: #3a2226;
  color: #ff4d5e;
  box-shadow: none;
}

.game-tile.is-hit {
  background: linear-gradient(180deg, #ffe7a3 0%, #e0a106 100%);
  border-color: #fff6d4;
  color: #2a1c00;
  box-shadow: 0 0 20px rgba(255, 196, 60, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.game-tile.is-gold {
  background: linear-gradient(180deg, #ffe7a3 0%, #e0a106 100%);
  border-color: #fff6d4;
  color: #2a1c00;
  box-shadow: 0 0 20px rgba(255, 196, 60, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.game-tile.is-gold.is-hit {
  box-shadow:
    0 0 0 2px var(--game-selected-text),
    0 0 22px rgba(255, 196, 60, 0.75),
    inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

/* Desktop: board on the left, settings rail on the right.
   Opt in with .game-play-session. Keno keeps its own stage grid. */
@media (min-width: 901px) {
  .play-area.active.game-play-session {
    display: grid;
    width: 100%;
    grid-template-columns: minmax(0, 1fr) 340px;
    grid-template-areas: "board rail";
    align-items: stretch;
    column-gap: 0;
    overflow: hidden;
    background: #10141c;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
  }

  .game-play-session > .game-play-board {
    grid-area: board;
    min-width: 0;
    padding: 16px;
  }

  .game-play-session > .game-settings {
    grid-area: rail;
    align-self: stretch;
    border-left: 1px solid rgba(255, 255, 255, 0.07);
  }
}

@media (max-width: 900px) {
  .prepaid-play.game-mobile-play,
  .game-mobile-play:has(.play-area.active) {
    align-self: stretch;
    width: 100%;
    max-width: none;
    margin-left: 0;
    margin-right: 0;
    padding-left: 0;
    padding-right: 0;
  }

  .prepaid-play.game-mobile-play #prepaid-session:not([hidden]),
  .game-mobile-play .play-area.active.game-play-session {
    display: flex;
    flex-direction: column;
    width: 100%;
    margin-left: 0;
    margin-right: 0;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    background: transparent;
  }

  .game-mobile-play .game-settings,
  .game-mobile-play .game-settings-stack,
  .game-mobile-play .game-settings-deck {
    display: contents;
  }

  .game-mobile-play .game-settings-summary {
    order: 1;
    margin: 4px 4px 0;
  }

  .game-mobile-play #prepaid-board,
  .game-mobile-play .game-play-board {
    order: 2;
    padding: 4px 4px 0;
  }

  .game-mobile-play .game-settings-extra:not(:empty) {
    order: 3;
    margin: 0 4px;
    padding: 0 8px 6px;
    background: var(--game-board-bg);
    border: 1px solid var(--game-board-border);
    border-top: 0;
    border-radius: 0 0 10px 10px;
  }

  .game-mobile-play #prepaid-session:has(.game-settings-extra:not(:empty)) .game-board,
  .game-mobile-play .game-play-session:has(.game-settings-extra:not(:empty)) .game-board {
    padding: 4px;
    border-radius: 10px 10px 0 0;
    border-bottom-color: transparent;
  }

  .game-mobile-play .game-settings-stats {
    order: 4;
    margin: 0.45rem 0.4rem 0;
  }

  .game-mobile-play .game-settings-actions {
    order: 5;
    padding: 0.4rem 0.4rem 0;
  }

  .game-mobile-play .game-settings-controls {
    order: 6;
    padding: 0.35rem 0.4rem 0;
  }

  .game-mobile-play .game-settings-verify {
    order: 7;
  }
}
