:root {
  --blue: #4cc9f0;
  --orange: #ff8c1a;
  --bg: #06070c;
  --panel: rgba(12, 16, 30, 0.92);
  --text: #e8eefc;
  --muted: #98a4c4;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, "Segoe UI", Roboto, sans-serif;
}

canvas#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

[hidden] { display: none !important; }

#hud { position: fixed; inset: 0; pointer-events: none; }

#scores {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.4rem;
}

.side { display: flex; flex-direction: column; min-width: 8rem; }
#side1 { align-items: flex-end; }
.name { font-size: 0.8rem; letter-spacing: 0.18em; font-weight: 700; }
.score { font-size: 3.4rem; font-weight: 800; line-height: 1; }
#side0 .name, #side0 .score { color: var(--blue); text-shadow: 0 0 18px rgba(76, 201, 240, 0.6); }
#side1 .name, #side1 .score { color: var(--orange); text-shadow: 0 0 18px rgba(255, 140, 26, 0.6); }

.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.5rem; max-width: 16rem; }
#side1 .chips { justify-content: flex-end; }
.chip {
  font-size: 0.8rem;
  font-weight: 700;
  padding: 0.2rem 0.55rem;
  border: 2px solid;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.5);
}

#banner {
  position: absolute;
  top: 38%;
  width: 100%;
  margin: 0;
  text-align: center;
  font-size: 2.2rem;
  font-weight: 800;
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

#toast {
  position: absolute;
  top: 16%;
  width: 100%;
  margin: 0;
  text-align: center;
  font-size: 1.9rem;
  font-weight: 800;
  opacity: 0;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.9);
}
#toast.show { animation: pop 1.6s ease-out forwards; }
@keyframes pop {
  0% { opacity: 0; transform: scale(0.7); }
  12% { opacity: 1; transform: scale(1.12); }
  25% { transform: scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-14px); }
}

#hint {
  position: absolute;
  bottom: 0.7rem;
  width: 100%;
  margin: 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.panel {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(34rem, calc(100vw - 2rem));
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
  padding: 1.4rem 1.6rem;
  background: var(--panel);
  border: 1px solid rgba(110, 168, 255, 0.35);
  border-radius: 16px;
  box-shadow: 0 0 60px rgba(76, 201, 240, 0.15);
  text-align: center;
}

.panel h1 { margin: 0.2rem 0 0.6rem; font-size: 2.6rem; letter-spacing: 0.04em; }
.panel h2 { margin: 1.2rem 0 0.4rem; font-size: 1rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.kicker { margin: 0; font-size: 0.75rem; letter-spacing: 0.3em; text-transform: uppercase; color: var(--blue); }
.small { font-size: 0.85rem; color: var(--muted); }
.final { font-size: 1.4rem; font-weight: 700; }
.error { color: #ff7a8a; min-height: 1.2em; margin: 0.4rem 0; }

.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.6rem; margin: 0.8rem 0; }

button, select, input {
  font: inherit;
  color: var(--text);
}

button.big {
  padding: 0.7rem 1.4rem;
  font-weight: 700;
  font-size: 1.05rem;
  border: 0;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), #3a7bd5);
  color: #04101c;
  cursor: pointer;
}
button.big.secondary { background: transparent; color: var(--text); border: 2px solid rgba(110, 168, 255, 0.55); }
button.big:hover:not(:disabled) { filter: brightness(1.15); }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
button:disabled { opacity: 0.5; cursor: default; }

select, input[type="text"], #name {
  padding: 0.45rem 0.6rem;
  background: #0d1224;
  border: 1px solid rgba(110, 168, 255, 0.45);
  border-radius: 8px;
}
#name { width: 11rem; margin: 0.4rem 0.4rem 0.4rem 0; }
label.check { display: inline-flex; align-items: center; gap: 0.4rem; }

details { text-align: left; margin: 0.6rem 0; }
summary { cursor: pointer; color: var(--blue); font-weight: 600; }
.powerup-list { margin: 0.5rem 0 0; padding-left: 1.2rem; font-size: 0.92rem; line-height: 1.5; }

.leaderboard { margin: 0; padding-left: 1.6rem; text-align: left; font-size: 0.95rem; line-height: 1.6; }

@media (max-width: 600px) {
  .score { font-size: 2.4rem; }
  .panel h1 { font-size: 2rem; }
  #hint { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #toast.show { animation: none; opacity: 1; }
}
