/* Random Maze — neon grid maze. Full-bleed canvas. */
*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  -webkit-tap-highlight-color: transparent;
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #05070d;
  font-family: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  touch-action: none;
  overscroll-behavior: none;
}

#canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; }

/* ---------- HUD (timer) ---------- */
.hud {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  left: 0; right: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  pointer-events: none;
}
.hud__time {
  font-size: clamp(1.9rem, 7vw, 3.2rem);
  font-weight: 900;
  letter-spacing: 0.01em;
  color: #d6faff;
  text-shadow: 0 0 10px rgba(53, 224, 255, 0.6), 0 0 30px rgba(53, 224, 255, 0.35);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.hud__best {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(120, 226, 255, 0.55);
  font-variant-numeric: tabular-nums;
}

.sound-btn {
  position: fixed;
  top: max(14px, env(safe-area-inset-top));
  right: 14px;
  z-index: 6;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1.5px solid rgba(53, 224, 255, 0.3);
  background: rgba(8, 14, 24, 0.5);
  color: #9bebff;
  font-size: 1.05rem;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: border-color 140ms ease, background 140ms ease;
}
.sound-btn:hover { border-color: rgba(53, 224, 255, 0.7); }
.sound-btn[aria-pressed="false"] { color: rgba(120, 200, 226, 0.35); }

/* ---------- control bar ---------- */
.controls {
  position: fixed;
  bottom: max(14px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  gap: 8px;
  padding: 0 10px;
}
.ctrl {
  appearance: none;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #bff2ff;
  background: rgba(8, 16, 26, 0.62);
  border: 1.5px solid rgba(53, 224, 255, 0.28);
  padding: 9px 15px;
  border-radius: 999px;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  white-space: nowrap;
  transition: border-color 140ms ease, background 140ms ease, color 140ms ease;
}
.ctrl:hover { border-color: rgba(53, 224, 255, 0.7); background: rgba(12, 24, 38, 0.8); }
.ctrl[aria-pressed="true"] {
  color: #052027;
  background: linear-gradient(180deg, #6ef0ff, #2ec6e6);
  border-color: transparent;
  box-shadow: 0 0 18px -2px rgba(53, 224, 255, 0.6);
}

/* ---------- overlay ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(120% 90% at 50% 42%, rgba(10, 20, 34, 0.85), rgba(2, 4, 9, 0.96));
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity 260ms ease;
}
.overlay[hidden] { display: none; }
.overlay.is-hidden { opacity: 0; pointer-events: none; }

.panel {
  text-align: center;
  max-width: 460px;
  padding: 34px 30px 32px;
  border-radius: 24px;
  background: rgba(8, 14, 24, 0.85);
  border: 1px solid rgba(53, 224, 255, 0.16);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.75), inset 0 0 60px -30px rgba(53, 224, 255, 0.4);
  animation: pop 320ms cubic-bezier(0.2, 0.9, 0.25, 1) both;
}
@keyframes pop { from { transform: scale(0.92); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.panel__title {
  margin: 0 0 6px;
  font-size: clamp(2.4rem, 10vw, 4rem);
  font-weight: 900;
  letter-spacing: -0.02em;
  line-height: 0.95;
  padding-bottom: 0.16em;
  background: linear-gradient(176deg, #eafdff 0%, #6ef0ff 46%, #21b7e0 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  filter: drop-shadow(0 4px 26px rgba(53, 224, 255, 0.45));
}
.panel__text { margin: 0 0 26px; font-size: clamp(0.98rem, 3.4vw, 1.08rem); line-height: 1.55; font-weight: 500; color: #c4d2e2; }
.play-btn {
  appearance: none;
  font-family: inherit;
  font-size: 1.05rem;
  font-weight: 800;
  color: #04222b;
  background: linear-gradient(180deg, #7ef2ff, #2ec6e6);
  border: 0;
  padding: 16px 40px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 10px 30px -6px rgba(53, 224, 255, 0.6);
  transition: transform 140ms ease, box-shadow 140ms ease;
}
.play-btn:hover { transform: translateY(-2px); box-shadow: 0 16px 40px -8px rgba(53, 224, 255, 0.75); }
.play-btn:active { transform: translateY(0); }

/* ---------- frame + hint ---------- */
.frame { position: fixed; inset: 0; z-index: 4; pointer-events: none; }
.frame__corner {
  position: absolute;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(140, 210, 235, 0.5);
}
.frame__corner--tl { top: max(14px, env(safe-area-inset-top)); left: 16px; }
.frame__corner--tr { top: max(14px, env(safe-area-inset-top)); right: 62px; }
.frame__corner--bl { bottom: 14px; left: 16px; }
.frame__corner a { color: inherit; text-decoration: none; pointer-events: auto; }
.frame__corner a:hover { color: #6ef0ff; }

.hint {
  position: fixed;
  bottom: 66px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 4;
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(140, 210, 235, 0.5);
  pointer-events: none;
  white-space: nowrap;
  transition: opacity 300ms ease;
}
.hint.is-gone { opacity: 0; }

@media (max-width: 560px) {
  .frame__corner--bl { display: none; }
  .frame__corner--tr { display: none; }
}
