@import url('../global.css');

:root {
  --title-color: var(--color-labyrinth);
  /* An ancient parquet-floor maze: dark oak walls, honey-parquet corridors. */
  --lab-wall: #3a2a1c;
  --lab-path: #d9b877;
  --lab-reach: #22c55e;
}

/* ─── Board shell ─────────────────────────────────────────────────────────── */

.labyrinth-board {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--spacing-xs);
  background: transparent;
  border: none;
}

.labyrinth-board[data-visual-theme='arcade'] {
  --lab-wall: #3a1030;
  --lab-path: #ff9fe6;
  --lab-reach: #ff4fd8;
}

.labyrinth-board[data-visual-theme='midnight'] {
  --lab-wall: #14202e;
  --lab-path: #9fd3f5;
  --lab-reach: #38bdf8;
}

.labyrinth-board[data-visual-theme='daylight'] {
  --lab-wall: #4c3a63;
  --lab-path: #e4d4f7;
  --lab-reach: #7c3aed;
}

.labyrinth-board[data-visual-theme='amber'] {
  --lab-wall: #4a2f0c;
  --lab-path: #f6cf8e;
  --lab-reach: #fbbf24;
}

/* ─── Outer 9×9 grid (arrows + 7×7 tiles) ────────────────────────────────── */

.lab-outer {
  display: grid;
  /* col 1: left arrows | cols 2-8: tiles | col 9: right arrows */
  grid-template-columns: 1.6rem repeat(7, 1fr) 1.6rem;
  /* row 1: top arrows  | rows 2-8: tiles  | row 9: bottom arrows */
  grid-template-rows: 1.6rem repeat(7, 1fr) 1.6rem;
  gap: 2px;
  padding: 6px;
  background: var(--lab-wall);
  border-radius: var(--border-radius-md);
  box-shadow: inset 0 0 16px rgba(0, 0, 0, 0.5);
  /* Height-driven square from the shared .game-square contract; aspect-ratio
     keeps it square while the extra panel row takes its own height. */
}

/* ─── Tiles ───────────────────────────────────────────────────────────────── */

.lab-cell {
  position: relative;
  cursor: default;
  border-radius: 2px;
  overflow: hidden;
}

.lab-cell::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(90deg, rgba(58, 42, 28, 0.12) 0 3px, transparent 3px 9px);
}

.lab-cell.is-reachable {
  cursor: pointer;
}

.lab-tile-svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* SVG fill classes (resolved as CSS inside inline SVG) */
.lab-wall {
  fill: var(--lab-wall);
}
.lab-path {
  fill: var(--lab-path);
}

.lab-gem {
  fill: #6366f1;
  stroke: rgba(255, 255, 255, 0.6);
  stroke-width: 1;
}

.lab-gem--target {
  fill: #f59e0b;
  stroke: white;
  stroke-width: 1.5;
}

/* Seat colours */
.lab-pawn {
  stroke: white;
  stroke-width: 1.5;
}
.lab-pawn-0 {
  fill: #8b5cf6;
}
.lab-pawn-1 {
  fill: #ef4444;
}
.lab-pawn-2 {
  fill: #22c55e;
}
.lab-pawn-3 {
  fill: #f59e0b;
}

/* ─── Push arrows ─────────────────────────────────────────────────────────── */

.lab-arrow-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-labyrinth);
  color: #fff;
  border: none;
  border-radius: 3px;
  font-size: 0.7rem;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.15s;
  padding: 0;
}

.lab-arrow-btn:hover:not(:disabled) {
  opacity: 1;
}

.lab-arrow-btn:disabled {
  opacity: 0.15;
  cursor: default;
}

.lab-arrow-btn.is-blocked {
  opacity: 0.08;
}

/* ─── Extra-tile panel ────────────────────────────────────────────────────── */

.lab-extra-panel {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  justify-content: center;
  padding: var(--spacing-xs) 0;
}

.lab-extra-svg {
  display: block;
  width: 3rem;
  height: 3rem;
  border-radius: 3px;
  overflow: hidden;
  flex-shrink: 0;
  border: 3px solid var(--lab-wall);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.lab-rotate-btn {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 2rem;
  height: 2rem;
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-color);
  transition: background 0.15s;
}

.lab-rotate-btn:hover:not(:disabled) {
  background: var(--surface-glass);
}

.lab-rotate-btn:disabled {
  opacity: 0.3;
  cursor: default;
}
