/* ============================================================
   STARGATE – Desert Hunt  |  style.css
   ============================================================ */

:root {
  --sand:        #E8C97A;
  --sand-dark:   #C4944C;
  --sand-light:  #F5E6C0;
  --sand-bg:     #F0D9A0;
  --brown:       #8B4513;
  --panel-bg:    rgba(255, 243, 210, 0.97);
  --border:      #C4944C;
  --text-dark:   #2c1810;
  --oasis:       #a8d5b5;
  --oasis-dark:  #3a7a4e;
  --danger:      #c0392b;
  --success:     #27ae60;
  --blue:        #3498db;
  --night:       #0f0e17;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: Georgia, 'Times New Roman', serif;
  background: var(--night);
  min-height: 100vh;
  color: var(--text-dark);
  overflow: hidden;
}

/* ──────────────────────────────────────────────────────────
   SCREENS
────────────────────────────────────────────────────────── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; }

/* ──────────────────────────────────────────────────────────
   HOME SCREEN
────────────────────────────────────────────────────────── */
#homeScreen {
  justify-content: center;
  align-items: center;
  position: relative;
}

.home-bg {
  position: absolute;
  inset: 0;
  background-image: url('Assets/Assets/simon-berger-twukN12EN7c-unsplash.jpg');
  background-size: cover;
  background-position: center;
  filter: brightness(0.35) saturate(0.7);
}

.home-container {
  position: relative;
  background: rgba(10, 8, 4, 0.82);
  border: 2px solid var(--sand-dark);
  border-radius: 20px;
  padding: 40px 48px;
  width: 440px;
  max-width: 95vw;
  text-align: center;
  box-shadow: 0 0 60px rgba(0,0,0,0.8), 0 0 0 1px rgba(228,185,100,0.15);
}

.game-logo { margin-bottom: 28px; }

.logo-img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  filter: drop-shadow(0 0 16px gold);
  animation: floatLogo 3s ease-in-out infinite;
}

@keyframes floatLogo {
  0%, 100% { transform: translateY(0); }
  50%       { transform: translateY(-6px); }
}

.game-logo h1 {
  font-size: 2.8rem;
  color: var(--sand);
  letter-spacing: 10px;
  text-shadow: 0 0 24px gold, 0 2px 4px rgba(0,0,0,0.8);
  margin-top: 8px;
}

.game-logo .subtitle {
  color: #a09070;
  font-style: italic;
  font-size: 1rem;
  letter-spacing: 2px;
  margin-top: 2px;
}

.setup-card { display: flex; flex-direction: column; gap: 18px; }

.setup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--sand-light);
  font-size: 0.95rem;
}

.player-count-selector { display: flex; gap: 8px; }

.count-btn {
  width: 42px;
  height: 42px;
  border: 2px solid var(--sand-dark);
  background: transparent;
  color: var(--sand);
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.count-btn:hover, .count-btn.active {
  background: var(--sand);
  color: #1a1100;
  border-color: var(--sand);
}

.number-input {
  width: 80px;
  padding: 8px;
  border: 2px solid var(--sand-dark);
  background: rgba(255,255,255,0.06);
  color: var(--sand-light);
  border-radius: 8px;
  font-size: 1rem;
  text-align: center;
}
.number-input:focus { outline: none; border-color: var(--sand); }

.player-inputs-container { display: flex; flex-direction: column; gap: 10px; }

.player-input-row { display: flex; align-items: center; gap: 10px; }

.player-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 6px currentColor;
}

.player-name-input {
  flex: 1;
  padding: 8px 12px;
  border: 2px solid var(--sand-dark);
  background: rgba(255,255,255,0.06);
  color: var(--sand-light);
  border-radius: 8px;
  font-size: 0.95rem;
}
.player-name-input::placeholder { color: rgba(255,240,200,0.3); }
.player-name-input:focus { outline: none; border-color: var(--sand); }

.start-btn {
  padding: 13px 36px;
  background: linear-gradient(135deg, var(--sand), var(--sand-dark));
  border: none;
  border-radius: 10px;
  font-size: 1.1rem;
  font-weight: bold;
  color: #1a1100;
  cursor: pointer;
  letter-spacing: 2px;
  transition: transform 0.18s, box-shadow 0.18s;
  font-family: inherit;
}
.start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(228,185,100,0.45);
}

.continue-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #a09070;
  font-size: 0.85rem;
  padding: 8px 12px;
  background: rgba(255,255,255,0.04);
  border-radius: 8px;
  border: 1px solid var(--sand-dark);
}
.continue-row.hidden { display: none; }

.continue-btn {
  padding: 6px 16px;
  background: transparent;
  border: 1px solid var(--sand-dark);
  color: var(--sand);
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  transition: background 0.18s;
}
.continue-btn:hover { background: rgba(228,185,100,0.15); }

/* ──────────────────────────────────────────────────────────
   GAME SCREEN LAYOUT
────────────────────────────────────────────────────────── */
#gameScreen {
  flex-direction: column;
  background: linear-gradient(180deg, #100d08 0%, #1a1510 100%);
}

.game-layout { display: flex; flex-direction: column; height: 100vh; }

/* Top bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 18px;
  background: rgba(0,0,0,0.55);
  border-bottom: 2px solid var(--sand-dark);
  flex-shrink: 0;
}

.timer-display {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--sand-light);
  font-size: 1.2rem;
  font-family: 'Courier New', monospace;
  background: rgba(0,0,0,0.4);
  padding: 5px 14px;
  border-radius: 8px;
  border: 1px solid var(--sand-dark);
  min-width: 90px;
}
.timer-icon { font-size: 1rem; }

.game-title {
  font-size: 1.7rem;
  color: var(--sand);
  letter-spacing: 8px;
  text-shadow: 0 0 18px gold, 0 2px 6px rgba(0,0,0,0.7);
}

.items-display { display: flex; gap: 10px; }

.item-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 10px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(196,148,76,0.4);
  border-radius: 8px;
  opacity: 0.38;
  transition: opacity 0.4s, border-color 0.4s, background 0.4s;
}
.item-slot.found {
  opacity: 1;
  border-color: gold;
  background: rgba(255,215,0,0.12);
  box-shadow: 0 0 12px rgba(255,215,0,0.3);
}
.item-slot img { width: 28px; height: 28px; object-fit: contain; }
.item-slot span { color: var(--sand-light); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1px; }

/* Game body */
.game-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  padding: 10px;
  gap: 10px;
  align-items: flex-start;
}

/* ──────────────────────────────────────────────────────────
   PLAYER PANEL (left)
────────────────────────────────────────────────────────── */
.players-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 155px;
  flex-shrink: 0;
  overflow-y: auto;
  max-height: calc(100vh - 80px);
}

.player-card {
  background: var(--panel-bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 10px 11px;
  transition: border-color 0.3s, box-shadow 0.3s;
}
.player-card.active-player {
  border-color: gold;
  box-shadow: 0 0 16px rgba(255,215,0,0.35);
}
.player-card.dead { opacity: 0.38; }

.player-name-header {
  font-weight: bold;
  font-size: 0.95rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
  margin-bottom: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.water-bar-wrap {
  height: 5px;
  background: #ddd;
  border-radius: 3px;
  margin: 5px 0 4px;
  overflow: hidden;
}
.water-bar {
  height: 100%;
  background: linear-gradient(90deg, #2980b9, #7fb3d3);
  border-radius: 3px;
  transition: width 0.4s;
}
.water-bar.low { background: linear-gradient(90deg, #c0392b, #e57373); }

.player-stat {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  margin: 3px 0;
}
.player-stat img { width: 16px; height: 16px; object-fit: contain; }

.player-items {
  display: flex;
  gap: 4px;
  margin-top: 7px;
}
.player-item-ind {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: 1px solid #ccc;
  background: #eee;
  overflow: hidden;
  opacity: 0.3;
  transition: opacity 0.3s, border-color 0.3s;
}
.player-item-ind.found { border-color: gold; opacity: 1; }
.player-item-ind img { width: 100%; height: 100%; object-fit: contain; }

/* ──────────────────────────────────────────────────────────
   BOARD SECTION (centre)
────────────────────────────────────────────────────────── */
.board-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.board {
  display: grid;
  grid-template-columns: repeat(5, 88px);
  grid-template-rows: repeat(5, 88px);
  gap: 5px;
  padding: 10px;
  background: rgba(139,69,19,0.28);
  border: 3px solid var(--brown);
  border-radius: 14px;
  box-shadow: 0 0 40px rgba(0,0,0,0.6), inset 0 0 24px rgba(0,0,0,0.35);
}

/* ── CELLS ── */
.cell {
  width: 88px;
  height: 88px;
  border-radius: 8px;
  border: 2px solid rgba(139,69,19,0.4);
  position: relative;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  user-select: none;
}

.cell.cell-hidden {
  background: linear-gradient(145deg, #c49c4e 0%, #d4b46a 40%, #b8832a 100%);
}
.cell.cell-hidden::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 4px;
  pointer-events: none;
}

.cell.revealed {
  background: var(--sand-bg);
}
.cell.cell-oasis.revealed  { background: #d4edda; }
.cell.cell-drought.revealed { background: #f8d7da; }
.cell.cell-stargate { background: #0d0d1e !important; border-color: rgba(100,100,255,0.5) !important; }

.cell.movable {
  border-color: gold !important;
  box-shadow: 0 0 14px rgba(255,215,0,0.55) !important;
  cursor: pointer;
}
.cell.movable::before {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255,215,0,0.08);
  border-radius: 6px;
  animation: pulse 1.4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes pulse {
  0%, 100% { opacity: 0.3; }
  50%       { opacity: 0.8; }
}

.cell.current-pos {
  border-color: rgba(255,255,255,0.7) !important;
  box-shadow: inset 0 0 12px rgba(255,255,255,0.15) !important;
}

.cell:hover { transform: scale(1.045); z-index: 2; }
.cell.cell-stargate:hover { transform: none; }

/* Cell images */
.cell-img {
  width: 82%;
  height: 82%;
  object-fit: contain;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  transition: opacity 0.3s;
}
.cell-img.oasis-marker { opacity: 0.7; }

/* ── PLAYER TOKENS ── */
.player-token {
  position: absolute;
  border-radius: 50%;
  border: 2px solid;
  z-index: 10;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.55);
  pointer-events: none;
  transition: box-shadow 0.3s;
  display: flex;
  justify-content: center;
  align-items: center;
}

.token-sprite {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Active player's token glows gold without conflicting with transform */
.player-token.active-token {
  border-color: gold !important;
  animation: tokenGlow 1.4s ease-in-out infinite;
}
@keyframes tokenGlow {
  0%, 100% { box-shadow: 0 0 8px 2px rgba(255,215,0,0.55); }
  50%       { box-shadow: 0 0 18px 6px rgba(255,215,0,0.9); }
}

/* ──────────────────────────────────────────────────────────
   ACTION BAR
────────────────────────────────────────────────────────── */
.action-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel-bg);
  padding: 9px 18px;
  border-radius: 10px;
  border: 2px solid var(--border);
  width: 100%;
  max-width: 490px;
}

.action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: bold;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
  flex-shrink: 0;
}
.action-btn:hover { transform: translateY(-2px); box-shadow: 0 4px 14px rgba(0,0,0,0.25); }
.action-btn:active { transform: translateY(0); }
.action-btn:disabled { filter: grayscale(0.6); opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.dig-btn { background: linear-gradient(135deg, #c8762e, #7a3a0f); color: white; }
.dig-btn img { width: 18px; height: 18px; object-fit: contain; filter: invert(1); }

.actions-indicator {
  flex: 1;
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-dark);
}
#currentPlayerName { font-weight: bold; }
#actionsLeft {
  font-size: 1.4rem;
  font-weight: bold;
  vertical-align: middle;
}

/* ──────────────────────────────────────────────────────────
   GAME LOG
────────────────────────────────────────────────────────── */
.game-log {
  background: rgba(0,0,0,0.72);
  border: 1px solid rgba(196,148,76,0.5);
  border-radius: 8px;
  padding: 8px 12px;
  width: 100%;
  max-width: 490px;
  height: 88px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--sand-dark) transparent;
}
.log-entry {
  color: var(--sand-light);
  font-size: 0.78rem;
  padding: 2px 0;
  border-bottom: 1px solid rgba(255,240,200,0.07);
  line-height: 1.4;
}
.log-entry:last-child { border-bottom: none; }

/* ──────────────────────────────────────────────────────────
   INFO PANEL (right)
────────────────────────────────────────────────────────── */
.info-panel {
  width: 152px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.info-box {
  background: var(--panel-bg);
  border: 2px solid var(--border);
  border-radius: 10px;
  padding: 10px 11px;
}

.info-box h3 {
  font-size: 0.72rem;
  color: var(--sand-dark);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
  margin-bottom: 8px;
}

.clue-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: bold;
  margin: 5px 0;
  color: #666;
  transition: color 0.3s;
}
.clue-item img { width: 26px; height: 26px; object-fit: contain; flex-shrink: 0; }
.clue-item.complete { color: var(--success); }
.clue-item.complete img { filter: drop-shadow(0 0 4px #27ae60); }

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 0.75rem;
  margin: 4px 0;
  color: var(--text-dark);
}
.leg-dot {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}
.leg-pulse {
  background: rgba(255,215,0,0.3);
  border: 1px solid gold !important;
  animation: pulse 1.4s ease-in-out infinite;
}

.how-to p { font-size: 0.72rem; color: #555; line-height: 1.5; margin: 3px 0; }
.how-to strong { color: var(--brown); }

/* ──────────────────────────────────────────────────────────
   OVERLAYS
────────────────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  animation: fadeIn 0.35s ease;
}
.overlay.hidden { display: none; }

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.overlay-card {
  background: var(--panel-bg);
  border: 3px solid var(--sand-dark);
  border-radius: 22px;
  padding: 44px 60px;
  text-align: center;
  max-width: 420px;
  animation: slideUp 0.35s ease;
}
@keyframes slideUp {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.gameover-card { border-color: var(--danger); }
.victory-card  { border-color: gold; box-shadow: 0 0 40px rgba(255,215,0,0.25); }

.overlay-icon { font-size: 3.5rem; margin-bottom: 12px; }

.overlay-card h1 {
  font-size: 2.4rem;
  margin-bottom: 12px;
}
.gameover-card h1 { color: var(--danger); }
.victory-card h1  { color: #b8860b; text-shadow: 0 0 20px gold; }

.overlay-card p {
  font-size: 1rem;
  margin-bottom: 28px;
  color: #555;
}

/* ──────────────────────────────────────────────────────────
   TUTORIAL OVERLAY
────────────────────────────────────────────────────────── */
#tutorialOverlay {
  background: rgba(4, 3, 1, 0.78);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  align-items: center;
  overflow-y: auto;
  padding: 20px;
}

.tutorial-card {
  background: rgba(18, 14, 8, 0.92);
  border: 1px solid rgba(196, 148, 76, 0.55);
  border-radius: 20px;
  padding: 36px 40px 32px;
  max-width: 700px;
  width: 100%;
  box-shadow: 0 0 60px rgba(0,0,0,0.7), 0 0 0 1px rgba(228,185,100,0.08);
  animation: slideUp 0.4s ease;
}

.tut-header {
  text-align: center;
  margin-bottom: 28px;
}
.tut-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  filter: drop-shadow(0 0 14px gold);
  margin-bottom: 10px;
  animation: floatLogo 3s ease-in-out infinite;
}
.tut-header h2 {
  font-size: 1.9rem;
  color: var(--sand);
  letter-spacing: 5px;
  text-shadow: 0 0 16px gold;
  margin-bottom: 6px;
}
.tut-subtitle {
  color: #8a7055;
  font-style: italic;
  font-size: 0.9rem;
  letter-spacing: 0.5px;
}

.tut-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

.tut-section {
  background: rgba(255, 240, 200, 0.05);
  border: 1px solid rgba(196, 148, 76, 0.22);
  border-radius: 12px;
  padding: 16px 14px;
  text-align: center;
  transition: background 0.2s;
}
.tut-section:hover {
  background: rgba(255, 240, 200, 0.09);
}

.tut-icon {
  font-size: 1.8rem;
  margin-bottom: 8px;
  line-height: 1;
}
.tut-section h4 {
  color: var(--sand);
  font-size: 0.85rem;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.tut-section p {
  color: #9a8060;
  font-size: 0.78rem;
  line-height: 1.55;
}
.tut-section p strong {
  color: var(--sand-light);
}

.tut-actions-row {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.tut-action-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 240, 200, 0.06);
  border: 1px solid rgba(196, 148, 76, 0.3);
  border-radius: 20px;
  padding: 6px 14px;
  color: #a08060;
  font-size: 0.78rem;
}
.tut-action-chip img {
  width: 18px;
  height: 18px;
  object-fit: contain;
  opacity: 0.75;
}

.tut-dismiss-btn {
  display: block;
  margin: 0 auto;
  min-width: 220px;
  letter-spacing: 1px;
}

/* ──────────────────────────────────────────────────────────
   STORY BUTTON & AUTHOR CREDIT  (home screen)
────────────────────────────────────────────────────────── */
.story-btn {
  background: transparent;
  border: 1px solid rgba(196,148,76,0.4);
  color: #9a8060;
  border-radius: 8px;
  padding: 8px 0;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  letter-spacing: 1px;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.story-btn:hover {
  border-color: var(--sand-dark);
  color: var(--sand-light);
  background: rgba(255,240,200,0.05);
}

.author-credit {
  position: absolute;
  bottom: 20px;
  color: #5a4a36;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}
.author-credit a {
  color: #9a7a50;
  text-decoration: none;
  border-bottom: 1px solid rgba(154,122,80,0.4);
  padding-bottom: 1px;
  transition: color 0.2s, border-color 0.2s;
}
.author-credit a:hover {
  color: var(--sand);
  border-color: var(--sand);
}

/* ──────────────────────────────────────────────────────────
   STORY OVERLAY
────────────────────────────────────────────────────────── */
#storyOverlay {
  background: rgba(3, 2, 1, 0.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow-y: auto;
  padding: 24px;
  z-index: 2000;
}

.story-card {
  background: rgba(12, 9, 4, 0.95);
  border: 1px solid rgba(196,148,76,0.4);
  border-radius: 20px;
  padding: 40px 44px 36px;
  max-width: 580px;
  width: 100%;
  box-shadow: 0 0 80px rgba(0,0,0,0.8);
  animation: slideUp 0.35s ease;
}

.story-emblem {
  text-align: center;
  margin-bottom: 16px;
}
.story-emblem img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  filter: drop-shadow(0 0 16px gold) drop-shadow(0 0 40px rgba(255,180,0,0.3));
  animation: floatLogo 3s ease-in-out infinite;
}

.story-title {
  text-align: center;
  font-size: 1.5rem;
  color: var(--sand);
  letter-spacing: 8px;
  text-shadow: 0 0 18px gold;
  margin-bottom: 26px;
}

.story-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 28px;
}
.story-body p {
  color: #8a7055;
  font-size: 0.88rem;
  line-height: 1.7;
}
.story-body p strong {
  color: var(--sand-light);
}

.story-items {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(255,240,200,0.04);
  border: 1px solid rgba(196,148,76,0.18);
  border-radius: 12px;
  padding: 16px;
}
.story-item-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.story-item-row img {
  width: 36px;
  height: 36px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(255,200,100,0.4));
}
.story-item-row div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.story-item-row strong {
  color: var(--sand-light);
  font-size: 0.88rem;
}
.story-item-row span {
  color: #6a5840;
  font-size: 0.78rem;
  line-height: 1.4;
}

.story-warning {
  text-align: center;
  color: #a06040 !important;
  font-style: italic;
  font-size: 0.85rem !important;
  padding: 10px;
  border-top: 1px solid rgba(196,148,76,0.2);
  border-bottom: 1px solid rgba(196,148,76,0.2);
}

.story-close-btn {
  display: block;
  margin: 0 auto;
  min-width: 160px;
  letter-spacing: 1px;
}

/* ──────────────────────────────────────────────────────────
   SCROLLBAR
────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--sand-dark); border-radius: 3px; }

/* ──────────────────────────────────────────────────────────
   MOBILE  (≤ 767px)
────────────────────────────────────────────────────────── */
@media (max-width: 767px) {

  /* Allow the page to scroll vertically */
  body { overflow-x: hidden; overflow-y: auto; }

  /* ── Top bar ── */
  .top-bar { padding: 6px 10px; gap: 6px; }
  .game-title { font-size: 1rem; letter-spacing: 3px; }
  .timer-display { font-size: 0.8rem; min-width: 68px; padding: 4px 8px; gap: 5px; }
  .timer-icon { font-size: 0.85rem; }
  .items-display { gap: 5px; }
  .item-slot { padding: 3px 5px; gap: 0; }
  .item-slot span { display: none; }        /* hide "Watch / Robot / Camera" labels */
  .item-slot img { width: 20px; height: 20px; }

  /* ── Full-height game layout → auto height so page can scroll ── */
  .game-layout { height: auto; min-height: 100vh; }

  /* ── Game body: vertical stack ── */
  .game-body {
    flex-direction: column;
    align-items: stretch;
    overflow: visible;
    padding: 8px;
    gap: 8px;
  }

  /* Board section comes first */
  .board-section { order: 1; width: 100%; align-items: center; }

  /* Players panel below the board */
  .players-panel {
    order: 2;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    max-height: none;
    overflow-y: visible;
    gap: 6px;
  }
  .player-card {
    flex: 1;
    min-width: 130px;
    max-width: calc(50% - 3px);
    padding: 8px 9px;
  }

  /* Info panel last */
  .info-panel {
    order: 3;
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .info-box { flex: 1; min-width: 130px; }
  .how-to { display: none; }   /* covered by the tutorial overlay */

  /* ── Board: dynamic cell size ──
     overhead = game-body padding (2×8) + board padding (2×8) + 4 gaps (4×4) = 48px */
  .board {
    --cell: calc((100vw - 48px) / 5);
    grid-template-columns: repeat(5, var(--cell));
    grid-template-rows:    repeat(5, var(--cell));
    gap: 4px;
    padding: 8px;
    width: fit-content;
    margin: 0 auto;
  }
  .cell {
    width:  var(--cell);
    height: var(--cell);
  }

  /* ── Action bar & log ── */
  .action-bar { max-width: 100%; padding: 8px 12px; }
  .game-log   { max-width: 100%; height: 68px; }

  /* ── Home screen ── */
  .home-container { padding: 28px 22px; }

  /* ── Overlays ── */
  .overlay-card {
    padding: 28px 20px;
    margin: 0 12px;
    max-width: calc(100vw - 24px);
  }
  .story-card   { padding: 24px 18px; }
  .tutorial-card { padding: 24px 16px 20px; }
  .tut-grid {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  /* ── Touch: prevent 300 ms tap delay, remove blue highlight ── */
  .cell, .action-btn, .start-btn, .count-btn,
  .story-btn, .continue-btn, .player-name-input,
  .number-input, .tut-dismiss-btn, .story-close-btn {
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
  }
}
