:root {
  --panel: rgba(20, 18, 48, 0.72);
  --text: #F4F0FF;
  --muted: #B8B0D8;
  --gold: #FFD84D;
  --cyan: #7FE3FF;
  --pink: #FF9ECF;
  --violet: #B69CFF;
  --display: 'Baloo 2', 'Trebuchet MS', sans-serif;
  --body: 'Nunito', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #0b0a1e; color: var(--text); overflow: hidden; }
body { display: grid; place-items: center; font-family: var(--body); }

.stage { position: relative; }
canvas { display: block; }
.muted { color: var(--muted); }

/* ---------- HUD ---------- */
.hud { position: absolute; inset: 0; pointer-events: none; }
.hud[hidden] { display: none; }
.hud { display: flex; align-items: flex-start; gap: 0.8em; padding: 1.4% 1.6%; }
.box { padding: 0.45em 1em; border-radius: 0.9em; background: var(--panel); border: 1px solid rgba(182, 156, 255, 0.3); display: flex; flex-direction: column; gap: 0.05em; }
.box.wide { flex: 1; align-items: center; }
.box span { font-size: 0.75em; font-weight: 700; letter-spacing: 0.14em; color: var(--muted); }
.box b { display: flex; align-items: center; gap: 0.35em; font-family: var(--display); font-weight: 800; font-size: 1.6em; line-height: 1.1; }
.box em { font-style: normal; }
#timebox.low b { color: var(--pink); animation: pulse 0.8s ease-in-out infinite; }
.gem { width: 0.6em; height: 0.85em; background: var(--cyan); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); box-shadow: 0 0 8px var(--cyan); }
.form { width: 0.75em; height: 0.75em; border-radius: 50%; background: var(--violet); }
.form[data-power="1"] { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.form[data-power="2"] { background: var(--pink); box-shadow: 0 0 8px var(--pink); }
@keyframes pulse { 50% { opacity: 0.45; } }

.banner { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); white-space: nowrap; font-family: var(--display); font-weight: 800; font-size: 3.6em; letter-spacing: 0.02em; color: #FFFFFF; text-shadow: 0 3px 0 #5a3fb0, 0 6px 18px rgba(0, 0, 0, 0.6); }
.banner[hidden] { display: none; }

/* ---------- screens ---------- */
.screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: flex-end; }
.screen[hidden] { display: none; }
.title { background: linear-gradient(90deg, rgba(11, 10, 30, 0) 35%, rgba(11, 10, 30, 0.82) 62%); }
.title .panel { width: 40%; margin-right: 5%; display: flex; flex-direction: column; gap: 1.6em; }
.title h1 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 7.5em; line-height: 0.9; letter-spacing: -0.01em; text-shadow: 0 5px 0 #5a3fb0, 0 10px 30px rgba(0, 0, 0, 0.5); }
.title h1 span { color: var(--gold); }
.tagline { margin: -0.4em 0 0; font-size: 1.3em; color: #DCD4F8; }
.primary { min-height: 3.4em; padding: 0 1.4em; display: flex; align-items: center; justify-content: space-between; border: 0; border-radius: 1em; background: var(--gold); color: #2a1a00; font-family: var(--display); font-weight: 800; font-size: 1.5em; cursor: pointer; box-shadow: 0 4px 0 #b8901a; }
.primary small { font-family: var(--body); font-weight: 700; font-size: 0.6em; opacity: 0.75; }
.primary:hover { filter: brightness(1.06); }
.primary:focus-visible { outline: 3px solid #FFFFFF; outline-offset: 3px; }
.controls { display: flex; flex-direction: column; gap: 0.35em; font-size: 1em; color: #DCD4F8; }
.controls b { display: inline-block; min-width: 5.5em; color: var(--violet); }
.back { position: absolute; left: 2%; top: 2.5%; color: #DCD4F8; text-decoration: none; text-shadow: 0 1px 3px #000; }
.back:hover, .back:focus-visible { color: #FFFFFF; }

.dim { justify-content: center; background: rgba(11, 10, 30, 0.6); }
.card { padding: 1.6em 2.6em; border-radius: 1.2em; background: rgba(24, 20, 56, 0.95); border: 1px solid rgba(182, 156, 255, 0.35); text-align: center; }
.card h2 { margin: 0 0 0.2em; font-family: var(--display); font-weight: 800; font-size: 3.2em; color: var(--gold); }
.card p { margin: 0.3em 0; font-size: 1.2em; }

@media (prefers-reduced-motion: reduce) { #timebox.low b { animation: none; } }
