/* Prism Drift — dark + cyan prism aesthetic (DFWatson Games) */

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0b0f14;
  --bg-panel: rgba(11, 15, 20, 0.94);
  --text: #e8eef4;
  --muted: #8b9bb0;
  --accent: #4fc3f7;
  --accent-bright: #7df9ff;
  --accent-dim: #3a8fb7;
  --magenta: #e879f9;
  --amber: #fbbf24;
  --danger: #ff5a5a;
  --glow: 0 0 24px rgba(79, 195, 247, 0.45);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, Cantarell, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  position: relative;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background:
    radial-gradient(ellipse 70% 50% at 50% 40%, #152030 0%, var(--bg) 65%),
    var(--bg);
}

#game {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: crosshair;
}

#fail-flash,
#win-flash {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  z-index: 4;
}

#fail-flash { background: rgba(255, 90, 90, 0.45); }
#win-flash { background: rgba(125, 249, 255, 0.28); }

#fail-flash.show { animation: flash 220ms ease-out forwards; }
#win-flash.show { animation: flash 320ms ease-out forwards; }

@keyframes flash {
  0% { opacity: 1; }
  40% { opacity: 0.65; }
  100% { opacity: 0; }
}

.screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + var(--safe-top)) 20px calc(24px + var(--safe-bottom));
  background: rgba(8, 12, 18, 0.72);
  backdrop-filter: blur(6px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 10;
}

.screen.active {
  opacity: 1;
  pointer-events: auto;
}

.panel {
  width: min(360px, 100%);
  padding: 2rem 1.5rem;
  text-align: center;
  background: var(--bg-panel);
  border: 1px solid rgba(79, 195, 247, 0.22);
  border-radius: 20px;
  box-shadow: var(--glow), 0 16px 48px rgba(0, 0, 0, 0.5);
}

.lang-picker {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.lang-btn {
  min-width: 2.4rem;
  padding: 0.3rem 0.55rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--muted);
  background: transparent;
  border: 1px solid rgba(139, 155, 176, 0.35);
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}

.lang-btn.active,
.lang-btn[aria-pressed="true"] {
  color: #0b0f14;
  background: var(--accent);
  border-color: var(--accent);
}

.badge {
  display: inline-block;
  margin-bottom: 0.5rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent);
  border: 1px solid rgba(79, 195, 247, 0.35);
  border-radius: 999px;
}

h1 {
  font-size: clamp(1.85rem, 7vw, 2.55rem);
  font-weight: 800;
  color: var(--accent-bright);
  text-shadow: 0 0 28px rgba(79, 195, 247, 0.5);
  margin-bottom: 0.35rem;
}

h2 {
  font-size: 1.45rem;
  margin-bottom: 0.75rem;
  color: var(--accent-bright);
}

.tagline {
  color: var(--muted);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.howto {
  text-align: left;
  margin: 0 auto 1.25rem;
  padding-left: 1.15rem;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
  max-width: 290px;
}

.howto li { margin-bottom: 0.4rem; }

.hint {
  margin-top: 1rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.studio {
  margin-top: 0.65rem;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  color: rgba(139, 155, 176, 0.7);
  text-transform: uppercase;
}

.result {
  font-size: 2.1rem;
  font-weight: 800;
  color: var(--accent-bright);
  margin-bottom: 0.25rem;
}

.result-sub,
.result-best {
  color: var(--muted);
  margin-bottom: 1rem;
  font-size: 0.95rem;
}

.btn {
  display: block;
  width: 100%;
  margin-top: 0.55rem;
  padding: 0.85rem 1rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  text-align: center;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}

.btn:active { transform: scale(0.98); }

.btn-play,
.btn-primary {
  color: #0b0f14;
  background: linear-gradient(135deg, var(--accent-bright), var(--accent));
  box-shadow: 0 0 20px rgba(79, 195, 247, 0.35);
}

.btn-ghost {
  color: var(--text);
  background: transparent;
  border: 1px solid rgba(139, 155, 176, 0.35);
}

.btn-tip {
  color: var(--accent);
  background: rgba(79, 195, 247, 0.08);
  border: 1px solid rgba(79, 195, 247, 0.28);
  font-size: 0.9rem;
}

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: calc(12px + var(--safe-top)) 16px 8px;
  pointer-events: none;
  z-index: 5;
  font-variant-numeric: tabular-nums;
}

.hud.hidden,
.play-hint.hidden { display: none; }

.hud-left,
.hud-center,
.hud-right {
  display: flex;
  flex-direction: column;
  min-width: 4.5rem;
}

.hud-center { align-items: center; }
.hud-right { align-items: flex-end; }

.hud-label {
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}

#hud-level,
#hud-score,
#hud-moves {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent-bright);
  text-shadow: 0 0 12px rgba(79, 195, 247, 0.4);
}

.play-hint {
  position: absolute;
  bottom: calc(18px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  padding: 0.45rem 0.9rem;
  font-size: 0.75rem;
  color: var(--muted);
  background: rgba(11, 15, 20, 0.75);
  border: 1px solid rgba(79, 195, 247, 0.18);
  border-radius: 999px;
  pointer-events: none;
  z-index: 5;
  white-space: nowrap;
}


.ver-badge {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  color: var(--accent-dim);
  margin-top: -0.35rem;
  margin-bottom: 0.75rem;
}

.hud-sub {
  margin-top: 0.15rem;
  font-size: 0.7rem;
  color: var(--muted);
}

.btn-undo {
  position: absolute;
  left: 12px;
  bottom: calc(16px + var(--safe-bottom));
  z-index: 6;
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent-bright);
  background: rgba(11, 15, 20, 0.85);
  border: 1px solid rgba(79, 195, 247, 0.4);
  border-radius: 10px;
  cursor: pointer;
  pointer-events: auto;
  box-shadow: 0 0 16px rgba(79, 195, 247, 0.2);
}

.btn-undo:disabled {
  opacity: 0.35;
  cursor: default;
}

.btn-undo.hidden { display: none; }


/* Pause overlay (v0.1.2) */
#pause-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 12, 18, 0.78);
  backdrop-filter: blur(4px);
  z-index: 12;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
#pause-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
#pause-overlay .pause-panel {
  text-align: center;
  padding: 1.5rem 2rem;
  border-radius: 16px;
  border: 1px solid rgba(79, 195, 247, 0.35);
  background: rgba(11, 15, 20, 0.95);
  box-shadow: var(--glow);
}
#pause-overlay h2 {
  font-size: 1.5rem;
  color: var(--accent-bright);
  margin-bottom: 0.5rem;
  letter-spacing: 0.06em;
}
#pause-overlay p {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.win-stars {
  font-size: 1.75rem;
  letter-spacing: 0.18em;
  color: var(--amber);
  text-shadow: 0 0 18px rgba(251, 191, 36, 0.55);
  margin: 0.35rem 0 0.85rem;
}

#hud-par {
  display: block;
  font-size: 0.68rem;
  opacity: 0.75;
  letter-spacing: 0.02em;
  margin-top: 2px;
}
#hud-par.near-par {
  color: #f0c060;
  text-shadow: 0 0 8px rgba(240, 192, 96, 0.55);
}
#hud-par.over-par {
  color: #fbbf24;
  opacity: 0.95;
}

/* v0.2.0 — level select, pause button */
.panel-levels {
  width: min(400px, 100%);
  padding: 1.4rem 1.1rem;
  max-height: 100%;
  overflow-y: auto;
}
.world-tabs {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin: 0.2rem 0 0.5rem;
}
.world-tab {
  min-width: 2.6rem;
  padding: 0.4rem 0.5rem;
  font: inherit;
  font-weight: 800;
  font-size: 0.9rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid rgba(139, 155, 176, 0.35);
  border-radius: 10px;
  cursor: pointer;
}
.world-tab.active {
  color: #0b0f14;
  background: var(--accent);
  border-color: var(--accent);
}
.world-tab.dim { opacity: 0.45; }
.world-name {
  color: var(--accent-bright);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  margin-bottom: 0.6rem;
}
.level-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.45rem;
  margin-bottom: 0.6rem;
}
.lvl-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1 / 1;
  font: inherit;
  font-weight: 800;
  font-size: 1rem;
  color: var(--accent-bright);
  background: rgba(79, 195, 247, 0.08);
  border: 1px solid rgba(79, 195, 247, 0.35);
  border-radius: 12px;
  cursor: pointer;
  padding: 0;
}
.lvl-btn .lvl-stars {
  font-size: 0.6rem;
  letter-spacing: 0.05em;
  color: var(--amber);
  margin-top: 2px;
}
.lvl-btn.done { background: rgba(79, 195, 247, 0.16); }
.lvl-btn.current {
  border-color: var(--accent-bright);
  box-shadow: 0 0 14px rgba(125, 249, 255, 0.45);
}
.lvl-btn:disabled {
  color: rgba(139, 155, 176, 0.5);
  background: rgba(20, 28, 38, 0.6);
  border-color: rgba(139, 155, 176, 0.18);
  cursor: default;
}
.lvl-btn:disabled .lvl-stars { color: rgba(139, 155, 176, 0.5); }
.btn-pause {
  position: absolute;
  right: 12px;
  bottom: calc(16px + var(--safe-bottom));
  z-index: 6;
  min-width: 2.6rem;
  padding: 0.55rem 0.8rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--accent-bright);
  background: rgba(11, 15, 20, 0.85);
  border: 1px solid rgba(79, 195, 247, 0.4);
  border-radius: 10px;
  cursor: pointer;
}
.btn-pause.hidden { display: none; }
#pause-overlay .btn { margin-top: 0.5rem; }

.pause-stats {
  margin: 0.35rem 0 0.65rem;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--accent-bright);
  letter-spacing: 0.02em;
}
.pause-stats.hidden { display: none; }
#app.pulse-gold {
  animation: prismGoldPulse 520ms ease-out;
}
@keyframes prismGoldPulse {
  0% { box-shadow: inset 0 0 0 0 rgba(255, 213, 79, 0); }
  35% { box-shadow: inset 0 0 80px 12px rgba(255, 213, 79, 0.28); }
  100% { box-shadow: inset 0 0 0 0 rgba(255, 213, 79, 0); }
}
