/* Maze Paint — tokens from /assets/base.css */

html, body { min-height: 100%; }

body {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 16px;
  min-height: 100vh;
}

.app {
  width: 100%;
  max-width: 520px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 4px;
}

.top {
  width: 100%;
  text-align: center;
  padding-left: 52px;
  padding-right: 8px;
}
.top h1 {
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.panel {
  width: 100%;
  background: linear-gradient(145deg, rgba(16, 20, 38, 0.95), #090c18 50%, #05060f 100%);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 26px;
  padding: 20px 18px 16px;
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(16px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}
.hidden { display: none !important; }
[hidden] { display: none !important; }

/* Menu */
.menu-panel { padding: 22px 18px 18px; }
.menu-title {
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  text-align: center;
}
.menu-hint {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}
.level-card {
  position: relative;
  aspect-ratio: 1 / 1;
  background: linear-gradient(145deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02));
  border: 1px solid var(--line);
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  padding: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--text);
  font: inherit;
  overflow: hidden;
}
.level-card:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(138, 124, 255, 0.25);
}
.level-card:disabled { cursor: not-allowed; opacity: 0.5; }
.level-card .lvl-num {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.6);
}
.level-card .lvl-mini-grid {
  display: grid;
  gap: 1px;
  background: rgba(255,255,255,0.04);
  padding: 2px;
  border-radius: 4px;
  margin-top: 4px;
}
.level-card .mini-cell {
  background: rgba(255,255,255,0.07);
  border-radius: 1px;
}
.level-card .mini-cell.start { background: var(--accent); }
.level-card .mini-cell.wall { background: transparent; }
.level-card .lvl-info {
  font-size: 11px;
  color: rgba(255,255,255,0.65);
  letter-spacing: 0.04em;
}
.level-card.cleared::after {
  content: '✓';
  position: absolute;
  top: 6px;
  right: 8px;
  width: 18px;
  height: 18px;
  background: var(--accent);
  color: #0b0b12;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 11px;
}
.level-card.locked .lock-svg {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 24px;
  height: 24px;
  color: rgba(255, 255, 255, 0.4);
}
.level-card.locked .lvl-mini-grid,
.level-card.locked .lvl-info { display: none; }

/* Game header */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}
.level-tag {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text);
}
.level-info-tag {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.hud {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  width: 100%;
}
.hud-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 8px 6px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hud-label {
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.hud-value {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* Board */
.board-wrap {
  width: 100%;
  display: flex;
  justify-content: center;
}
.board {
  position: relative;
  background: #07090f;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 6px;
  touch-action: none;
  user-select: none;
}
.cells {
  display: grid;
  position: relative;
  gap: 4px;
}
.cell {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  position: relative;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.cell.wall {
  background: transparent;
  border-color: transparent;
  cursor: default;
}
.cell.start {
  background: rgba(138, 124, 255, 0.18);
  border-color: var(--accent);
}
.cell.start::before {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 30%;
  height: 30%;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px rgba(138, 124, 255, 0.6);
}
.cell.filled {
  background: rgba(138, 124, 255, 0.32);
  border-color: var(--accent);
}
.cell.filled.start::before { background: rgba(255,255,255,0.85); box-shadow: none; }
.cell.head {
  background: var(--accent);
  border-color: rgba(255,255,255,0.6);
}
.cell.head.start::before { background: #0b0b12; box-shadow: none; }
/* Cells adjacent to the path head — show a soft hint so tap-to-advance is obvious */
.cell.next-hint {
  border-color: rgba(138, 124, 255, 0.6);
  background: rgba(138, 124, 255, 0.08);
  animation: hint-pulse 1.4s ease-in-out infinite;
}
@keyframes hint-pulse {
  0%, 100% { background: rgba(138, 124, 255, 0.08); }
  50%      { background: rgba(138, 124, 255, 0.18); }
}
.path-svg {
  position: absolute;
  inset: 6px;
  pointer-events: none;
  z-index: 2;
}
.path-svg polyline {
  fill: none;
  stroke: rgba(255, 255, 255, 0.55);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.hint {
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

/* Buttons */
.primary-btn {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-pill);
  padding: 10px 22px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.12s ease, box-shadow 0.18s ease;
}
.primary-btn:hover {
  background: rgba(138, 124, 255, 0.25);
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(138, 124, 255, 0.3);
}
.ghost-btn {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--text);
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}
.ghost-btn:hover {
  background: var(--surface-hover);
  border-color: var(--accent);
  color: var(--accent);
}
.ghost-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.game-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(8, 10, 22, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}
.overlay-card {
  background: linear-gradient(145deg, #1a1c30, #0d0e1d);
  border: 1px solid rgba(138, 124, 255, 0.3);
  border-radius: 22px;
  padding: 28px 32px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
  box-shadow: 0 0 40px rgba(138, 124, 255, 0.2);
  max-width: 340px;
}
.overlay-card h2 {
  font-size: 1.6rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
}
.overlay-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: center;
}
.muted { color: var(--muted); font-size: 0.85rem; }

@media (max-width: 600px) {
  .panel { padding: 16px 14px 12px; border-radius: 20px; }
  .menu-panel { padding: 18px 14px 14px; }
}
