/* Tile game (Shisen-Sho) — Fire B2
   Reuses the Fire A premium tokens: --radius, --radius-lg, --panel-alpha. */

.tile-tier-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 4px 2px;
}
.tile-tier-btn {
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.08);
  font-weight: 600;
  color: var(--fg);
}
.tile-tier-btn.is-selected {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.tile-board-wrap {
  position: relative;
  display: flex;
  justify-content: center;
  padding: calc(var(--space) * 1.2);
  border-radius: var(--radius-lg);
  background: radial-gradient(120% 90% at 50% 28%, #2b4a3a 0%, #1a3428 55%, #122419 100%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), inset 0 0 60px rgba(0,0,0,0.35);
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(var(--tile-cols, 12), 1fr);
  grid-template-rows: repeat(var(--tile-rows, 8), 1fr);
  gap: 4px;
  /* Width capped so the grid fits above the fold on tall rows. The cap is
     asymmetric between (cols+1) and (cols, rows) because the tile margin
     ring is visual, not grid-based. */
  width: min(100%, 900px);
  max-width: 100%;
  aspect-ratio: var(--tile-aspect, 3 / 2);
}

.tile-cell {
  position: relative;
  border-radius: 8px;
  background: linear-gradient(160deg, #f4ecd5 0%, #e6dab8 55%, #cfc29c 100%);
  box-shadow: 0 3px 6px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.6),
    inset 0 -2px 0 rgba(120,90,20,0.18);
  cursor: pointer;
  transition: transform 0.14s ease, box-shadow 0.14s ease, filter 0.14s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
.tile-cell.is-empty {
  background: transparent;
  box-shadow: none;
  cursor: default;
  pointer-events: none;
}
.tile-cell .tile-face {
  display: block;
  width: 82%;
  height: 82%;
  pointer-events: none;
}
.tile-cell .tile-face svg { width: 100%; height: 100%; display: block; }
.tile-cell.is-selected {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 0 0 3px var(--accent), 0 8px 18px rgba(232,176,75,0.5),
    inset 0 1px 0 rgba(255,255,255,0.6);
  filter: brightness(1.06);
}
.tile-cell.is-hint {
  animation: tileHintPulse 1s ease-in-out 1;
}
@keyframes tileHintPulse {
  0%   { box-shadow: 0 0 0 2px rgba(232,176,75,0.6), 0 3px 6px rgba(0,0,0,0.35); }
  50%  { box-shadow: 0 0 0 7px rgba(232,176,75,0.35), 0 3px 6px rgba(0,0,0,0.35); }
  100% { box-shadow: 0 0 0 2px rgba(232,176,75,0.6), 0 3px 6px rgba(0,0,0,0.35); }
}

/* Path flash overlay for a matched pair — sits on top of the grid, only
   active for ~0.6s. */
.tile-path-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: grid;
  grid-template-columns: repeat(calc(var(--tile-cols, 12) + 2), 1fr);
  grid-template-rows: repeat(calc(var(--tile-rows, 8) + 2), 1fr);
  padding: calc(var(--space) * 1.2);
  z-index: 5;
}
.tile-path-cell {
  border-radius: 3px;
  background: rgba(232,176,75,0.65);
  animation: tilePathFade 0.6s ease-out forwards;
  margin: 20%;
}
@keyframes tilePathFade {
  0%   { background: rgba(232,176,75,0.85); transform: scale(0.9); }
  100% { background: rgba(232,176,75,0);    transform: scale(1.15); }
}

.tile-status {
  min-height: 1.6em;
  text-align: center;
  color: var(--fg-dim);
  font-size: 0.95em;
  padding: 2px 6px;
  transition: color 0.15s ease;
}
.tile-status.is-error { color: var(--danger); }

@media (max-width: 700px) {
  .tile-board-wrap { padding: 4px; margin: 0 -8px; }
  .tile-grid { gap: 3px; }
}
@media (max-height: 500px) {
  .tile-board-wrap { padding: 4px; margin: 0 -6px; }
  .tile-grid { gap: 3px; width: min(100%, 700px); }
}

/* FLUX-ART-2026-11-17: shisen-sho table backdrop */
.tile-board-wrap { background-image: linear-gradient(rgba(3,20,14,0.45), rgba(3,20,14,0.45)), url("../img/bg-mahjong-table.jpg"); background-size: cover; background-position: center; border-radius: var(--radius-lg); }
