:root {
  --amber: #ffb000;
  --amber-dim: #c47a12;
  --neon: #ff3ad5;
  --teal: #18f0d0;
  --panel: rgba(12, 4, 24, 0.78);
  --line: rgba(255, 58, 213, 0.45);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  height: 100%;
  overflow: hidden;
  background: #120418;
  color: #f4efe6;
  font-family: 'Rajdhani', 'Segoe UI', sans-serif;
  user-select: none;
  touch-action: none;
}
#c { position: fixed; inset: 0; display: block; width: 100%; height: 100%; cursor: crosshair; }
#vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background: radial-gradient(ellipse at center, transparent 42%, rgba(40,0,50,0.35) 100%);
}
#hud { position: fixed; inset: 0; z-index: 3; pointer-events: none; display: flex; flex-direction: column; }
#hud button, #hud input, #hud .hit { pointer-events: auto; }
header.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px 4px; gap: 16px; flex-wrap: wrap;
  background: linear-gradient(to bottom, rgba(0,0,0,0.65), transparent);
}
header.top h1 {
  font-family: 'Bebas Neue', Impact, sans-serif;
  font-size: 2rem; letter-spacing: 4px; font-weight: 400;
  background: linear-gradient(180deg, #fff06a, #ff3ad5 55%, #18f0d0);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 12px rgba(255,58,213,0.55));
  text-shadow: none;
}
.stat-row { display: flex; gap: 18px; align-items: center; font-size: 1.05rem; font-weight: 600; }
.stat-row b { color: var(--teal); font-size: 1.25rem; text-shadow: 0 0 8px rgba(24,240,208,0.5); }
.scoreboard-wrap {
  padding: 0 16px;
  display: flex; justify-content: center;
}
.frames {
  display: flex; gap: 3px; background: var(--panel);
  border: 2px solid var(--teal);
  box-shadow: 0 0 18px rgba(255,58,213,0.25), inset 0 0 20px rgba(0,0,0,0.35);
  border-radius: 4px;
  padding: 6px 8px; backdrop-filter: blur(8px);
  overflow-x: auto; max-width: 100%;
}
.frame {
  min-width: 58px; text-align: center; border: 1px solid rgba(255,255,255,0.08);
  border-radius: 4px; overflow: hidden; background: rgba(255,255,255,0.03);
}
.frame.active { border-color: var(--neon); box-shadow: 0 0 10px rgba(255,58,213,0.45); background: rgba(255,58,213,0.12); }
.frame-h { font-size: 0.65rem; color: rgba(255,255,255,0.4); letter-spacing: 1px; padding: 2px; background: rgba(0,0,0,0.35); }
.frame-rolls { display: flex; justify-content: center; gap: 2px; padding: 4px 3px; min-height: 22px; }
.roll {
  width: 18px; height: 18px; font-size: 0.72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.08); border-radius: 2px;
}
.roll.x { background: var(--neon); color: #111; }
.roll.sp { background: var(--teal); color: #111; }
.roll.g { background: #333; color: #888; }
.frame-sc { font-size: 0.95rem; font-weight: 700; color: var(--amber); padding: 2px 0 4px; border-top: 1px solid rgba(24,240,208,0.2); }
.frame-10 { min-width: 72px; }
.frame-10 .roll { width: 16px; }
#message {
  text-align: center; min-height: 1.4em; margin-top: 8px;
  font-size: 1.15rem; font-weight: 700; color: #fff06a;
  text-shadow: 0 0 12px rgba(255,58,213,0.6), 0 2px 12px rgba(0,0,0,0.8);
}
#banner {
  position: absolute; left: 50%; top: 38%; transform: translate(-50%, -50%) scale(0.6);
  font-family: 'Bebas Neue', Impact, sans-serif; font-size: 7rem; letter-spacing: 10px;
  color: #fff; opacity: 0; pointer-events: none; text-align: center;
  text-shadow: 0 0 40px rgba(255,58,213,0.95), 0 0 18px #18f0d0, 0 8px 0 #7a0a5a;
  transition: none;
}
#banner.show { animation: bannerPop 1.8s ease forwards; }
@keyframes bannerPop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4) rotate(-6deg); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(1deg); }
  70% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(0); }
  100% { opacity: 0; transform: translate(-50%, -60%) scale(1.15); }
}
.bottom {
  margin-top: auto;
  background: linear-gradient(to top, rgba(0,0,0,0.82) 20%, transparent);
  padding: 12px 16px 14px;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
}
.meters {
  display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; width: 100%;
}
.meter {
  display: flex; flex-direction: column; gap: 3px; min-width: 160px;
}
.meter label { font-size: 0.72rem; letter-spacing: 1.5px; color: rgba(255,255,255,0.55); font-weight: 700; }
.meter input[type=range] {
  width: 180px; accent-color: var(--amber); cursor: pointer;
}
.power-wrap { width: min(420px, 92vw); }
.power-track {
  height: 16px; border-radius: 8px; overflow: hidden;
  background: rgba(0,0,0,0.55); border: 1px solid rgba(255,255,255,0.18);
  position: relative;
}
.power-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #2ecc71, #f0a020 60%, #e74c3c);
  box-shadow: 0 0 12px rgba(240,160,32,0.5);
}
.power-sweet {
  position: absolute; top: 0; bottom: 0; left: 62%; width: 18%;
  border-left: 1px dashed rgba(255,255,255,0.35);
  border-right: 1px dashed rgba(255,255,255,0.35);
  pointer-events: none;
}
.row-btns { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
button {
  font-family: inherit; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase;
  border: none; border-radius: 8px; padding: 10px 22px; cursor: pointer; font-size: 0.95rem;
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s;
}
button:active { transform: scale(0.96); }
button:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }
.btn-bowl {
  background: linear-gradient(180deg, #f3b13a, #d07810); color: #1a0e00;
  box-shadow: 0 4px 16px rgba(240,160,32,0.4);
}
.btn-new { background: linear-gradient(180deg, #e05a4a, #a32820); color: #fff; }
.btn-mute { background: rgba(255,255,255,0.1); color: #fff; padding: 10px 14px; }
.btn-setup { background: linear-gradient(180deg, #3d6ea8, #1f3f6a); color: #fff; }
.help { font-size: 0.78rem; color: rgba(255,255,255,0.5); text-align: center; max-width: 720px; line-height: 1.35; }
#setup {
  position: fixed; inset: 0; z-index: 6; display: none;
  align-items: center; justify-content: center;
  background: rgba(4, 4, 10, 0.72); pointer-events: auto;
}
#setup.open { display: flex; }
.setup-card {
  width: min(560px, 94vw); max-height: 90vh; overflow-y: auto;
  background: rgba(12, 12, 20, 0.96); border: 1px solid var(--line);
  border-radius: 14px; padding: 22px 24px 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
}
.setup-card h2 {
  font-family: 'Bebas Neue', Impact, sans-serif; letter-spacing: 4px;
  font-size: 1.8rem; color: var(--amber); margin-bottom: 12px;
}
.setup-card label {
  display: block; font-size: 0.72rem; letter-spacing: 1.6px; font-weight: 700;
  color: rgba(255,255,255,0.55); margin: 12px 0 6px;
}
.setup-card select, .setup-card input[type=number] {
  width: 100%; background: #16161f; color: #fff; border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px; padding: 8px 10px; font-family: inherit; font-size: 1rem;
}
.pin-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.pin-picks button {
  padding: 8px 12px; background: rgba(255,255,255,0.08); color: #fff;
  letter-spacing: 1px; font-size: 0.85rem;
}
.pin-picks button.on { background: var(--amber); color: #111; }
.oil-blurb { font-size: 0.85rem; color: rgba(255,255,255,0.6); margin-top: 6px; min-height: 2.4em; }
.setup-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.challenge-strip {
  font-family: 'Bebas Neue', Impact, sans-serif;
  letter-spacing: 3px;
  font-size: 1.25rem;
  color: var(--teal);
  padding: 8px 18px;
  text-shadow: 0 0 10px rgba(24,240,208,0.55);
  text-align: center;
}
#loader {
  position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px;
  background: #08080e; color: var(--amber);
  font-family: 'Bebas Neue', sans-serif; font-size: 2.4rem; letter-spacing: 6px;
}
#loader small { font-family: 'Rajdhani', sans-serif; font-size: 0.9rem; letter-spacing: 2px; color: #888; }
#loader.hide { opacity: 0; pointer-events: none; transition: opacity 0.6s; }
@media (max-width: 700px) {
  header.top h1 { font-size: 1.4rem; letter-spacing: 2px; }
  #banner { font-size: 3.4rem; letter-spacing: 4px; }
  .frame { min-width: 46px; }
  .help { font-size: 0.7rem; }
}
