/* ===== Sokoban — game-specific styles =====
   Generic glass chrome comes from shared/css/glass.css (fixed theme, no
   light/dark mode). This file re-tints the accent to warehouse amber and lays
   out the grid. Cell geometry is measured in JS (px), so nothing here needs to
   know a level's dimensions. The .c-modal / .c-win chrome is inherited from
   glass.css untouched, so the rules + level-picker cards never get their own
   inner scrollbar. */

:root {
  /* Sokoban wears warm industrial amber over the default indigo glass. */
  --accent-1: #f5a623;
  --accent-2: #ffcf6b;
  --on-accent: #2a1a03;
}

.c-app { --fpad: clamp(12px, 4vw, 36px); }

/* ---------- Stage ---------- */
.sb-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

/* ---------- Board ---------- */
.sb-board {
  position: relative;
  margin: 0 auto;
  padding: 10px;              /* keep in sync with PAD in sokoban.js */
  border-radius: 16px;
  background: var(--glass);
  border: 1px solid var(--glass-line);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .15);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

/* Static cells: floor, walls, target pads. */
.sb-floor, .sb-wall, .sb-target {
  position: absolute;
  border-radius: 6px;
}
.sb-floor { background: rgba(255, 255, 255, .04); }
.sb-wall {
  background: linear-gradient(160deg, #5a6480, #39415a);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12), inset 0 -3px 6px rgba(0, 0, 0, .35);
}
.sb-target { background: rgba(255, 255, 255, .04); }
.sb-target::after {
  content: "";
  position: absolute; inset: 0; margin: auto;
  width: 34%; height: 34%;
  border-radius: 4px;
  transform: rotate(45deg);
  background: var(--accent-1);
  box-shadow: 0 0 8px rgba(245, 166, 35, .7);
  opacity: .85;
}

/* Moving pieces: crates and the player. */
.sb-box, .sb-player {
  position: absolute;
  border-radius: 7px;
  transition: left .12s ease, top .12s ease;
}
.sb-box {
  background: linear-gradient(155deg, #ffbe4d, #e08a12);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .4), inset 0 0 0 2px #a9660a;
}
.sb-box::before, .sb-box::after {
  content: "";
  position: absolute; background: #a9660a; border-radius: 1px;
}
.sb-box::before { left: 8%; right: 8%; top: 50%; height: 10%; transform: translateY(-50%); }
.sb-box::after  { top: 8%; bottom: 8%; left: 50%; width: 10%; transform: translateX(-50%); }

/* Crate parked on a pad: green signpost. */
.sb-box.is-on {
  background: linear-gradient(155deg, #57e39a, #2fb068);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .35), inset 0 0 0 2px #1b7a44;
}
.sb-box.is-on::before, .sb-box.is-on::after { background: #1b7a44; }

.sb-player {
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #9be8ff, #2f9fd8 70%, #1c6f9c);
  box-shadow: 0 3px 8px rgba(0, 0, 0, .45), inset 0 0 0 2px rgba(255, 255, 255, .35);
}
.sb-player::after {
  content: "";
  position: absolute; inset: 0; margin: auto;
  width: 40%; height: 40%;
  border-radius: 50%;
  background: #0c2b3b;
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .25);
}

/* Whole board gives one happy pulse on a clear. */
.sb-board.is-win .sb-box { animation: sbWin .5s ease; }
@keyframes sbWin { 50% { transform: scale(1.08); } }

/* ---------- On-screen D-pad ---------- */
.sb-dpad {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.sb-dpad__row { display: flex; gap: 8px; }
.sb-key {
  appearance: none;
  width: 56px; height: 56px;
  border-radius: 14px;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  color: var(--c-text);
  font-size: 20px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
}
.sb-key:active { background: var(--glass-hi); transform: translateY(1px); }
.sb-key--mid { color: var(--accent-2); }
@media (hover: none) and (pointer: coarse) { .sb-dpad { display: flex; } }

/* ---------- Level picker ---------- */
.sb-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(56px, 1fr));
  gap: 10px;
  padding: 4px 0 12px;
}
.sb-pick {
  appearance: none;
  position: relative;
  padding: 12px 0;
  border-radius: 12px;
  border: 1px solid var(--glass-line);
  background: var(--glass);
  color: var(--c-text);
  font: inherit; font-weight: 700; font-size: 16px;
  cursor: pointer;
}
.sb-pick:hover { background: var(--glass-hi); }
/* Cleared rooms get a gold ring as a visual tier (does NOT gate access). */
.sb-pick.is-done { box-shadow: inset 0 0 0 2px var(--gold); color: var(--gold); }
.sb-pick.is-cur { outline: 3px solid var(--accent-1); outline-offset: 1px; }
.sb-pick.is-locked { opacity: .34; cursor: default; }
.sb-pick.is-locked:hover { background: var(--glass); }

@media (prefers-reduced-motion: reduce) {
  .sb-box, .sb-player { transition: none; }
  .sb-board.is-win .sb-box { animation: none; }
}
