:root {
  --bg: #07021a;
  --ink: #f4ecff;
  --dim: #9d8fc4;
  --pink: #ff3fa4;
  --cyan: #3fe0ff;
  --gold: #ffd23f;
  --lime: #8cff5a;
  --violet: #b46bff;
  --panel: rgba(20, 8, 48, 0.72);
  --edge: rgba(180, 107, 255, 0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Space Mono', ui-monospace, monospace;
  -webkit-user-select: none;
  user-select: none;
  touch-action: none;
}

canvas#game {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

[hidden] { display: none !important; }

/* ---------- HUD ---------- */
#hud {
  position: fixed;
  top: 0; left: 0; right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  padding: 14px 18px;
  pointer-events: none;
  text-shadow: 0 0 12px rgba(255, 63, 164, 0.6);
}
.hud-center { text-align: center; }
.hud-right { text-align: right; }
.label { font-size: 11px; letter-spacing: 0.25em; color: var(--dim); }
.big { font-family: 'Bungee', sans-serif; font-size: 30px; line-height: 1.1; }
.mid { font-family: 'Bungee', sans-serif; font-size: 18px; color: var(--gold); }
.combo {
  font-family: 'Bungee', sans-serif;
  font-size: 15px;
  background: linear-gradient(90deg, var(--gold), var(--pink), var(--cyan));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  min-height: 20px;
}
.lives { font-size: 22px; letter-spacing: 4px; margin-top: 2px; }
.lives span { display: inline-block; transform: rotate(-90deg); }
.powers { display: flex; gap: 6px; justify-content: center; margin-top: 6px; }
.powers div {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--c);
  color: var(--c);
  box-shadow: 0 0 10px var(--c);
}

.banner {
  position: fixed;
  top: 38%;
  left: 0; right: 0;
  text-align: center;
  font-family: 'Bungee', sans-serif;
  font-size: clamp(36px, 9vw, 96px);
  pointer-events: none;
  opacity: 0;
  background: linear-gradient(90deg, #ff3fa4, #ffd23f, #8cff5a, #3fe0ff, #b46bff);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 18px rgba(255, 63, 164, 0.6));
  transition: opacity 0.4s, transform 0.4s;
  transform: scale(0.8);
}
.banner.show { opacity: 1; transform: scale(1); }

/* ---------- Vernon ---------- */
.vernon {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translate(-50%, 30px);
  width: min(620px, calc(100vw - 32px));
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 12px 16px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 14px;
  backdrop-filter: blur(6px);
  box-shadow: 0 0 30px rgba(180, 107, 255, 0.25);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  z-index: 5;
}
.vernon.show { opacity: 1; transform: translate(-50%, 0); }
.vernon-face {
  flex: none;
  width: 48px; height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ff3fa4, #b46bff);
  position: relative;
  box-shadow: 0 0 16px rgba(255, 63, 164, 0.6);
}
.vernon-face .eye {
  position: absolute;
  top: 15px;
  width: 10px; height: 4px;
  background: #fff;
  border-radius: 2px;
}
.vernon-face .eye:nth-child(1) { left: 10px; transform: rotate(8deg); }
.vernon-face .eye:nth-child(2) { right: 10px; transform: rotate(-8deg); }
.vernon-face .mouth {
  position: absolute;
  left: 14px; right: 14px; bottom: 12px;
  height: 3px;
  background: #fff;
  border-radius: 2px;
  transition: height 0.08s;
}
.vernon.talking .mouth { animation: yap 0.18s infinite alternate; }
@keyframes yap { from { height: 3px; } to { height: 9px; bottom: 9px; } }
.vernon-name { font-family: 'Bungee', sans-serif; font-size: 12px; color: var(--gold); letter-spacing: 0.08em; }
.vernon-name span { font-family: 'Space Mono', monospace; color: var(--dim); letter-spacing: 0; font-size: 11px; }
.vernon-text { font-size: 14px; line-height: 1.4; min-height: 20px; }

/* ---------- Overlays ---------- */
.overlay {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 24px 16px 120px;
  background: radial-gradient(ellipse at center, rgba(7, 2, 26, 0.35), rgba(7, 2, 26, 0.85));
  z-index: 4;
}
.logo {
  margin: 0;
  font-family: 'Bungee', sans-serif;
  font-weight: 400;
  font-size: clamp(56px, 13vw, 140px);
  line-height: 0.9;
  text-align: center;
  background: linear-gradient(100deg, #ff3fa4 0%, #ffd23f 30%, #8cff5a 50%, #3fe0ff 70%, #b46bff 100%);
  background-size: 200% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 24px rgba(255, 63, 164, 0.5));
  animation: shimmer 6s linear infinite;
}
.logo.small { font-size: clamp(44px, 9vw, 90px); }
@keyframes shimmer { to { background-position: 200% 0; } }
.tag { margin: 0; color: var(--dim); text-align: center; max-width: 520px; }

.btn {
  font-family: 'Bungee', sans-serif;
  font-size: 20px;
  color: #12002b;
  background: linear-gradient(90deg, var(--gold), var(--pink));
  border: 0;
  border-radius: 999px;
  padding: 12px 30px;
  cursor: pointer;
  box-shadow: 0 0 24px rgba(255, 63, 164, 0.6);
  animation: pulse 1.4s ease-in-out infinite;
}
.btn.small { font-size: 14px; padding: 10px 18px; animation: none; }
.btn:focus-visible { outline: 3px solid var(--cyan); outline-offset: 3px; }
@keyframes pulse { 50% { transform: scale(1.05); box-shadow: 0 0 40px rgba(255, 210, 63, 0.7); } }

.cols { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; width: 100%; max-width: 780px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 14px 18px;
  min-width: min(340px, 100%);
  flex: 1;
  max-width: 420px;
  width: 100%;
}
.panel h2 { font-family: 'Bungee', sans-serif; font-weight: 400; font-size: 13px; color: var(--cyan); margin: 0 0 10px; letter-spacing: 0.06em; }
.panel h2 + * { margin-top: 0; }
.controls h2:not(:first-child) { margin-top: 14px; }
dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 0; font-size: 13px; }
dt { color: var(--gold); }
dd { margin: 0; color: var(--dim); }
.pu-list { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; font-size: 13px; color: var(--dim); }
.pu-list i {
  font-style: normal;
  display: inline-grid;
  place-items: center;
  width: 20px; height: 20px;
  margin-right: 8px;
  border: 1.5px solid var(--c);
  color: var(--c);
  transform: rotate(45deg);
  font-size: 11px;
  box-shadow: 0 0 8px var(--c);
}

.board { list-style: none; padding: 0; margin: 0; font-size: 14px; counter-reset: r; }
.board li {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 10px;
  padding: 4px 0;
  border-bottom: 1px dashed rgba(180, 107, 255, 0.18);
  counter-increment: r;
}
.board li::before { content: counter(r); color: var(--dim); }
.board li:nth-child(1)::before { color: var(--gold); }
.board li:nth-child(2)::before { color: #d8d8ff; }
.board li:nth-child(3)::before { color: #ff9d5c; }
.board .s { color: var(--lime); text-align: right; }
.board .w { color: var(--dim); font-size: 12px; min-width: 32px; text-align: right; }
.board li.me { background: linear-gradient(90deg, rgba(255, 63, 164, 0.25), transparent); }
.board .empty { color: var(--dim); display: block; }
.board .empty::before { content: none; }

.final { font-family: 'Bungee', sans-serif; font-size: clamp(40px, 8vw, 72px); color: var(--gold); text-align: center; line-height: 1; }
.final small { display: block; font-family: 'Space Mono', monospace; font-size: 13px; color: var(--dim); letter-spacing: 0.3em; }
.stats { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; font-size: 13px; color: var(--dim); }
.stats b { color: var(--ink); }

.entry { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.entry label { color: var(--pink); font-size: 14px; }
.entry-row { display: flex; gap: 8px; }
.entry input {
  font-family: 'Bungee', sans-serif;
  font-size: 18px;
  width: 210px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 2px solid var(--pink);
  background: rgba(7, 2, 26, 0.8);
  color: var(--ink);
  text-transform: uppercase;
  outline: none;
  box-shadow: 0 0 16px rgba(255, 63, 164, 0.4);
}

/* ---------- Touch + mute ---------- */
.touch {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  display: flex;
  justify-content: space-between;
  padding: 16px;
  z-index: 3;
}
.touch div { display: flex; gap: 10px; align-items: flex-end; }
.touch button {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 2px solid var(--edge);
  background: rgba(20, 8, 48, 0.5);
  color: var(--ink);
  font-size: 22px;
  touch-action: none;
}
.touch button.fire { width: 80px; height: 80px; border-color: var(--pink); color: var(--pink); }
.touch button.sm { width: 48px; height: 48px; font-size: 11px; }
.touch button.on { background: rgba(255, 63, 164, 0.35); }
body.touchy .vernon { bottom: 110px; }

.mute {
  position: fixed;
  right: 14px;
  bottom: 14px;
  width: 40px; height: 40px;
  border-radius: 50%;
  border: 1px solid var(--edge);
  background: var(--panel);
  color: var(--ink);
  font-size: 18px;
  cursor: pointer;
  z-index: 6;
}
body.touchy .mute { top: 70px; bottom: auto; }
