/* Live Alpha UX Pass #4 — full-cell placed tiles + one-screen mobile fit */

/* Once a tile is on the board, let it visually become the square rather than
   looking like a small token floating inside it. */
.cell > .tile {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .16), 0 1px 2px rgba(0, 0, 0, .22);
}

.cell > .tile.pending {
  outline: 0;
  box-shadow:
    inset 0 0 0 2px #e7f36b,
    inset 0 -2px 0 rgba(0, 0, 0, .16),
    0 1px 2px rgba(0, 0, 0, .22);
}

@media (max-width: 620px) {
  html.mobile-game-fit,
  body.mobile-game-fit {
    height: 100%;
    overflow-x: clip;
    overflow-y: auto;
    overscroll-behavior: none;
  }

  body.mobile-game-fit .app-shell {
    width: 100vw;
    height: var(--mobile-viewport-height, 100dvh);
    min-height: 0;
    padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
    display: flex;
    flex-direction: column;
  }

  body.mobile-game-fit .game {
    flex: 1;
    min-height: 0;
    width: 100%;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
  }

  body.mobile-game-fit .scorebar {
    flex: 0 0 auto;
    margin-bottom: 3px;
    border-radius: 0 0 9px 9px;
  }

  body.mobile-game-fit .player-card,
  body.mobile-game-fit .turn-card {
    min-height: 52px;
    padding: 5px 7px;
  }

  body.mobile-game-fit .player-name {
    font-size: .68rem;
  }

  body.mobile-game-fit .player-score {
    font-size: 1.14rem;
  }

  body.mobile-game-fit .turn-card strong {
    font-size: .72rem;
  }

  body.mobile-game-fit .turn-card .muted {
    font-size: .59rem;
  }

  body.mobile-game-fit .game-grid {
    min-height: 0;
    height: 100%;
    display: flex;
    flex-direction: column;
    overflow: visible;
  }

  body.mobile-game-fit .board-panel {
    flex: 0 0 auto;
    width: 100%;
    margin: 0 auto;
    padding: 0;
  }

  body.mobile-game-fit .board {
    width: var(--mobile-board-size, calc(100vw - 6px));
    max-width: var(--mobile-board-size, calc(100vw - 6px));
    height: var(--mobile-board-size, calc(100vw - 6px));
    margin: 0 auto;
    gap: 2px;
    padding: 2px;
    border-radius: 8px;
  }

  body.mobile-game-fit .cell {
    border-radius: 2px;
  }

  body.mobile-game-fit .cell > .tile {
    width: 100%;
    height: 100%;
    border-radius: 2px;
    font-size: clamp(.7rem, 3.25vw, 1rem);
  }

  /* Push the control dock to the bottom of tall phones instead of leaving a
     dead zone below it. On shorter phones the JS fitter shrinks the board. */
  body.mobile-game-fit .controls-panel {
    flex: 0 0 auto;
    margin: auto 4px max(4px, env(safe-area-inset-bottom));
    width: calc(100% - 8px);
    padding: 6px;
    gap: 4px;
  }

  body.mobile-game-fit .controls-panel .rack {
    min-height: 40px;
    gap: 3px;
  }

  body.mobile-game-fit .rack-tile {
    min-height: 38px;
    border-radius: 7px;
    font-size: .9rem;
  }

  body.mobile-game-fit .controls-actions {
    gap: 4px;
  }

  body.mobile-game-fit .controls-panel .primary.wide {
    min-height: 37px;
    padding: 8px 10px;
    font-size: .84rem;
  }

  body.mobile-game-fit .controls-panel .action-row,
  body.mobile-game-fit .controls-panel .mode-row {
    min-height: 33px;
    gap: 3px;
  }

  body.mobile-game-fit .controls-panel .action-row button,
  body.mobile-game-fit .controls-panel .mode-row button {
    min-height: 33px;
    padding: 6px 4px;
    font-size: .67rem;
    line-height: 1.05;
  }

  body.mobile-game-fit .match-details-button {
    font-size: .62rem !important;
  }

  /* Routine status text should not force the whole play surface to scroll.
     Error/status copy remains available but is kept compact. */
  body.mobile-game-fit .controls-panel .message:not(:empty) {
    max-height: 34px;
    overflow: auto;
    padding: 5px 7px;
    font-size: .68rem;
  }
}
