:root {
  --bg: #08111f;
  --panel: rgba(11, 19, 35, 0.88);
  --panel-border: rgba(145, 175, 255, 0.22);
  --text: #ecf4ff;
  --muted: #97a9ca;
  --accent: #7cf7d4;
  --accent-2: #6fa8ff;
  --danger: #ff5f7d;
  --warning: #ffd86b;
  --wall: #25304d;
  --floor: #101a31;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(90, 132, 255, 0.22), transparent 38%),
    linear-gradient(180deg, #09101d, #060b14 65%);
  min-height: 100vh;
}
button { font: inherit; }
.app-shell { max-width: 1220px; margin: 0 auto; padding: 18px; }
.topbar { display: flex; gap: 10px; justify-content: center; color: var(--muted); margin-bottom: 16px; }
.topbar a { color: var(--accent); text-decoration: none; }
.app { display: grid; grid-template-columns: minmax(320px, 1.1fr) minmax(280px, 0.9fr); gap: 18px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 22px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.28);
}
.hero { grid-column: 1 / -1; padding: 20px 22px; }
.eyebrow { margin: 0 0 6px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.12em; font-size: 0.78rem; }
.hero h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.2rem); }
.subtitle { margin: 10px 0 0; color: var(--muted); max-width: 720px; }
.board-panel { padding: 18px; }
.status-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.status-row > div { background: rgba(255,255,255,0.03); border-radius: 14px; padding: 10px 12px; }
.label { display: block; color: var(--muted); font-size: 0.8rem; margin-bottom: 4px; }
.message { min-height: 48px; padding: 10px 12px; margin-bottom: 12px; border-radius: 14px; background: rgba(111,168,255,0.08); color: #dce9ff; }
.message.fail { background: rgba(255,95,125,0.12); color: #ffd3dc; }
.message.win { background: rgba(124,247,212,0.12); color: #d9fff3; }
.board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  aspect-ratio: 1;
}
.cell {
  position: relative;
  border-radius: 18px;
  background: var(--floor);
  border: 1px solid rgba(255,255,255,0.06);
  display: grid;
  place-items: center;
  min-height: 48px;
  overflow: hidden;
}
.cell::before, .cell::after { content: ""; position: absolute; opacity: 0; }
.cell.beam-row::before {
  inset: 40% 0;
  background: linear-gradient(90deg, transparent, rgba(255,95,125,0.95), transparent);
  box-shadow: 0 0 18px rgba(255,95,125,0.8);
  opacity: 1;
}
.cell.beam-col::after {
  inset: 0 40%;
  background: linear-gradient(180deg, transparent, rgba(255,216,107,0.95), transparent);
  box-shadow: 0 0 18px rgba(255,216,107,0.7);
  opacity: 1;
}
.cell.beam-both { background: linear-gradient(135deg, rgba(255,95,125,0.24), rgba(255,216,107,0.24)), var(--floor); }
.cell.wall { background: linear-gradient(135deg, #334162, #202b44); }
.cell.wall::before, .cell.wall::after { opacity: 0.35; }
.cell.player { outline: 3px solid rgba(124,247,212,0.5); }
.token {
  position: relative;
  z-index: 2;
  width: 70%;
  aspect-ratio: 1;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-weight: 800;
}
.token.player { background: linear-gradient(135deg, var(--accent), #42d8ff); color: #04131b; border-radius: 16px; }
.token.core { color: #0b1020; background: linear-gradient(135deg, #ffe37d, #ffb74f); clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); }
.token.exit { color: #f5edff; background: linear-gradient(135deg, #946eff, #6677ff); }
.cell.collected .token.core { opacity: 0.25; }
.controls { display: grid; justify-content: center; gap: 8px; margin-top: 16px; }
.control-row { display: grid; grid-template-columns: repeat(3, 64px); gap: 8px; }
.controls button, .action-row button {
  border: 0;
  border-radius: 16px;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--accent-2), #8a6bff);
  color: white;
  font-weight: 700;
}
.controls button { width: 64px; height: 56px; }
.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.action-row .secondary { background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.08); }
button:disabled { opacity: 0.45; cursor: not-allowed; }
.sidebar { display: grid; gap: 18px; }
.sidebar .panel { padding: 16px; }
.hint { margin: 0 0 12px; color: #dbe8ff; }
.rules { margin: 0; padding-left: 18px; color: var(--muted); }
.phase-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.phase-head h2, .sidebar h2, .preview-grid h3 { margin: 0 0 12px; }
.phase-label { color: var(--warning); font-weight: 700; }
.phase-rail { display: grid; gap: 8px; margin-bottom: 12px; }
.phase-chip {
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.06);
  color: var(--muted);
}
.phase-chip.active { border-color: rgba(124,247,212,0.45); color: var(--text); }
.phase-chip.next { border-color: rgba(255,216,107,0.45); }
.preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.preview-grid h3 { font-size: 0.95rem; }
.mini-board {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
}
.mini-cell { aspect-ratio: 1; border-radius: 6px; background: #131d33; }
.mini-cell.row { background: rgba(255,95,125,0.55); }
.mini-cell.col { background: rgba(255,216,107,0.55); }
.mini-cell.both { background: linear-gradient(135deg, rgba(255,95,125,0.8), rgba(255,216,107,0.8)); }
.summary { display: grid; gap: 8px; }
.summary-item {
  display: flex; justify-content: space-between; gap: 8px;
  padding: 10px 12px; border-radius: 14px; background: rgba(255,255,255,0.04);
}
.summary-item.done { border: 1px solid rgba(124,247,212,0.35); }
.summary-item.active { border: 1px solid rgba(111,168,255,0.35); }
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
}
