:root {
  --amber: #ffb84d;
  --amber-dim: #a8742a;
  --green: #9fd48c;
  --bg: #05070a;
  --red: #ff3b30;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: var(--bg);
  font-family: 'Share Tech Mono', monospace;
  color: var(--amber);
  cursor: crosshair;
  -webkit-user-select: none; user-select: none;
  touch-action: none;
}
#scene-container { position: fixed; inset: 0; }
#scene-container canvas { display: block; }

/* ---------- Overlays ---------- */
#scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 50;
  background: repeating-linear-gradient(
    to bottom, rgba(0,0,0,0) 0, rgba(0,0,0,0) 2px,
    rgba(0,0,0,0.18) 3px, rgba(0,0,0,0.18) 4px);
  mix-blend-mode: multiply;
  animation: scanroll 8s linear infinite;
}
@keyframes scanroll { from { background-position-y: 0; } to { background-position-y: 100px; } }

#grain {
  position: fixed; inset: 0; pointer-events: none; z-index: 51; opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grainmove 0.6s steps(4) infinite;
}
@keyframes grainmove { 0%{transform:translate(0,0)} 25%{transform:translate(-3%,2%)} 50%{transform:translate(2%,-2%)} 75%{transform:translate(-2%,-3%)} 100%{transform:translate(0,0)} }

#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 49;
  background: radial-gradient(ellipse at center, rgba(0,0,0,0) 40%, rgba(0,0,0,0.85) 100%);
}
#surge-flash {
  position: fixed; inset: 0; pointer-events: none; z-index: 60;
  background: radial-gradient(ellipse at center, rgba(255,255,255,0.9), rgba(255,40,20,0.6));
  opacity: 0; transition: opacity 0.05s;
}

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; z-index: 40; pointer-events: none; }
#hud.hidden, .hidden { display: none !important; }
.surge-shake { animation: shake 0.09s infinite; }
@keyframes shake { 0%{transform:translate(0,0)} 25%{transform:translate(3px,-2px)} 50%{transform:translate(-3px,2px)} 75%{transform:translate(2px,3px)} 100%{transform:translate(-2px,-1px)} }

#hud-tl { position: absolute; top: 18px; left: 20px; text-shadow: 0 0 8px var(--amber); }
.hud-label { font-size: 12px; letter-spacing: 3px; color: var(--amber-dim); }
#counter {
  font-family: 'VT323', monospace; font-size: 54px; line-height: 0.9; color: var(--amber);
  text-shadow: 0 0 14px rgba(255,184,77,0.7);
}
#counter.flip { animation: pop 0.3s ease; }
@keyframes pop { 0%{transform:scale(1.4);color:#fff} 100%{transform:scale(1)} }

#hud-tr { position: absolute; top: 18px; right: 20px; text-align: right; }
#signal { display: flex; gap: 3px; justify-content: flex-end; margin-top: 4px; }
#signal span { width: 6px; background: var(--green); box-shadow: 0 0 6px var(--green); animation: sig 1.3s infinite; }
#signal span:nth-child(1){height:8px;animation-delay:0s}
#signal span:nth-child(2){height:12px;animation-delay:.15s}
#signal span:nth-child(3){height:16px;animation-delay:.3s}
#signal span:nth-child(4){height:20px;animation-delay:.45s}
#signal span:nth-child(5){height:24px;animation-delay:.6s}
@keyframes sig { 0%,100%{opacity:.9} 50%{opacity:.25} }
#rec { margin-top: 8px; font-size: 13px; color: var(--red); letter-spacing: 2px; }
#rec .dot { display:inline-block; width:9px;height:9px;border-radius:50%;background:var(--red);box-shadow:0 0 8px var(--red);animation:blink 1s infinite; }
@keyframes blink { 0%,49%{opacity:1} 50%,100%{opacity:.1} }

#crosshair { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); }
.ch-ring { width: 26px; height: 26px; border: 1px solid rgba(255,184,77,0.5); border-radius: 50%; position: relative; }
.ch-ring::before,.ch-ring::after{content:'';position:absolute;background:rgba(255,184,77,0.5)}
.ch-ring::before{width:1px;height:6px;left:50%;top:-8px;transform:translateX(-50%)}
.ch-ring::after{width:6px;height:1px;top:50%;left:-8px;transform:translateY(-50%)}
.ch-dot { width: 3px; height: 3px; background: var(--amber); border-radius: 50%; position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); box-shadow: 0 0 6px var(--amber); }

#prompt {
  position: absolute; bottom: 24%; left: 50%; transform: translateX(-50%);
  font-size: 18px; letter-spacing: 2px; color: var(--amber);
  text-shadow: 0 0 10px var(--amber); animation: promptpulse 1.2s infinite;
}
@keyframes promptpulse { 0%,100%{opacity:1} 50%{opacity:.4} }

#voice-panel {
  position: absolute; bottom: 8%; left: 50%; transform: translateX(-50%);
  width: min(90%, 620px); background: rgba(6,10,8,0.82);
  border: 1px solid var(--amber-dim); border-left: 4px solid var(--red);
  padding: 14px 18px; box-shadow: 0 0 30px rgba(0,0,0,0.8);
}
.vp-caller { font-size: 11px; letter-spacing: 3px; color: var(--red); margin-bottom: 6px; }
#voice-text {
  font-family: 'VT323', monospace; font-size: 26px; line-height: 1.15; color: var(--green);
  text-shadow: 0 0 6px rgba(159,212,140,0.6); min-height: 30px; word-break: break-word;
}

#help-btn {
  position: absolute; bottom: 16px; right: 16px; pointer-events: auto;
  width: 38px; height: 38px; border-radius: 50%; background: rgba(6,10,8,0.7);
  border: 1px solid var(--amber-dim); color: var(--amber); font-size: 20px;
  font-family: 'VT323', monospace; cursor: pointer;
}
#help-btn:hover { background: rgba(255,184,77,0.15); }

/* ---------- Mobile controls ---------- */
#mobile-controls { position: fixed; inset: 0; z-index: 45; pointer-events: none; }
#joystick {
  position: absolute; bottom: 30px; left: 26px; width: 120px; height: 120px;
  border-radius: 50%; border: 2px solid rgba(255,184,77,0.35);
  background: radial-gradient(circle, rgba(255,184,77,0.06), rgba(0,0,0,0.4));
  pointer-events: auto; touch-action: none;
}
#joystick-knob {
  position: absolute; top: 50%; left: 50%; width: 52px; height: 52px; margin: -26px;
  border-radius: 50%; background: rgba(255,184,77,0.35);
  border: 1px solid var(--amber); box-shadow: 0 0 12px rgba(255,184,77,0.5);
}

/* ---------- Title screen ---------- */
#title-screen {
  position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column;
  align-items: center; justify-content: center; text-align: center;
  background: radial-gradient(ellipse at center, #0a0f0c 0%, #020303 100%);
  transition: opacity 0.7s; padding: 20px;
}
.title-inner { max-width: 640px; width: 100%; }
.title-flicker {
  font-family: 'VT323', monospace; font-size: clamp(48px, 12vw, 108px); line-height: 0.92;
  color: var(--amber); letter-spacing: 4px;
  text-shadow: 0 0 20px rgba(255,184,77,0.7), 0 0 50px rgba(255,120,0,0.4);
  animation: titleflicker 4s infinite;
}
@keyframes titleflicker {
  0%,100%{opacity:1} 3%{opacity:.4} 6%{opacity:1} 55%{opacity:1} 57%{opacity:.2} 59%{opacity:1} 80%{opacity:.7}
}
.subtitle { margin-top: 12px; font-size: 14px; letter-spacing: 4px; color: var(--green); opacity: 0.8; }
.best-line { margin-top: 10px; font-size: 13px; color: var(--amber-dim); letter-spacing: 1px; }

.leaderboard {
  margin: 24px auto 0; max-width: 400px; text-align: left;
  border: 1px solid rgba(255,184,77,0.2); padding: 12px 16px; background: rgba(6,10,8,0.5);
}
.lb-title { font-size: 11px; letter-spacing: 2px; color: var(--red); text-align: center; margin-bottom: 8px; }
#lb-list { font-size: 14px; color: var(--green); }
.lb-row { display: flex; justify-content: space-between; padding: 2px 0; opacity: 0.85; }

#start-btn {
  margin-top: 28px; background: transparent; border: 2px solid var(--amber);
  color: var(--amber); font-family: 'VT323', monospace; font-size: 30px;
  padding: 10px 34px; letter-spacing: 3px; cursor: pointer;
  text-shadow: 0 0 10px var(--amber); box-shadow: 0 0 20px rgba(255,184,77,0.2);
  transition: all 0.2s;
}
#start-btn:hover { background: rgba(255,184,77,0.15); box-shadow: 0 0 40px rgba(255,184,77,0.5); transform: scale(1.03); }
.warn { margin-top: 18px; font-size: 11px; letter-spacing: 2px; color: #555; }

.remix {
  position: absolute; bottom: 14px; right: 16px; font-size: 12px;
  color: var(--amber-dim); text-decoration: none; letter-spacing: 1px; opacity: 0.6;
}
.remix:hover { color: var(--amber); opacity: 1; }

/* ---------- Help overlay ---------- */
#help-overlay {
  position: fixed; inset: 0; z-index: 110; display: flex; align-items: center; justify-content: center;
  background: rgba(2,3,3,0.9); padding: 20px;
}
.help-box {
  max-width: 460px; width: 100%; border: 1px solid var(--amber-dim);
  background: rgba(6,10,8,0.95); padding: 26px; box-shadow: 0 0 40px rgba(0,0,0,0.9);
}
.help-box h2 { font-family: 'VT323', monospace; font-size: 34px; color: var(--amber); letter-spacing: 3px; margin-bottom: 16px; }
.help-box ul { list-style: none; }
.help-box li { font-size: 14px; color: var(--green); margin-bottom: 12px; line-height: 1.4; }
.help-box li b { color: var(--amber); }
#help-close {
  margin-top: 12px; background: transparent; border: 1px solid var(--amber);
  color: var(--amber); font-family: 'VT323', monospace; font-size: 22px;
  padding: 8px 22px; letter-spacing: 2px; cursor: pointer;
}
#help-close:hover { background: rgba(255,184,77,0.15); }

@media (max-width: 600px) {
  #counter { font-size: 40px; }
  #voice-text { font-size: 22px; }
  #prompt { font-size: 15px; bottom: 30%; }
}
</parameter>
</invoke>