/* BlitzSip — Neon Cyberpunk Party Hub */
:root {
  --bg: #07040f;
  --surface: rgba(19, 15, 34, 0.72);
  --surface2: rgba(28, 22, 48, 0.8);
  --border: rgba(155, 78, 221, 0.35);
  --text: #f2eefe;
  --muted: #a99fc4;
  --magenta: #ff007a;
  --cyan: #00f5d4;
  --amber: #ffbe0b;
  --purple: #9d4edd;
  --danger: #ff3b3b;
  --radius: 20px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "SF Mono", "Cascadia Code", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow-x: hidden;
  min-height: 100dvh;
  position: relative;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 600px at 15% -10%, rgba(157, 78, 221, 0.25), transparent 60%),
    radial-gradient(800px 500px at 110% 20%, rgba(255, 0, 122, 0.18), transparent 55%),
    radial-gradient(700px 700px at 50% 110%, rgba(0, 245, 212, 0.10), transparent 60%),
    var(--bg);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

/* Party mode: flowing animated gradient + drunk wobble */
body.party {
  animation: partyGradient 10s ease-in-out infinite alternate;
}
body.party::before {
  background:
    radial-gradient(1000px 700px at 20% -20%, rgba(255, 0, 122, 0.4), transparent 55%),
    radial-gradient(900px 600px at 90% 10%, rgba(0, 245, 212, 0.35), transparent 50%),
    radial-gradient(800px 800px at 60% 110%, rgba(157, 78, 221, 0.4), transparent 60%),
    var(--bg);
  animation: partyPulse 4s ease-in-out infinite;
}
@keyframes partyGradient {
  0% { filter: hue-rotate(0deg); }
  100% { filter: hue-rotate(30deg); }
}
@keyframes partyPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.65; transform: scale(1.06); }
}

#app {
  max-width: 760px;
  margin: 0 auto;
  padding: 12px 16px calc(24px + env(safe-area-inset-bottom));
  min-height: 100dvh;
  position: relative;
}

/* ---------- Logo ---------- */
.logo {
  font-weight: 900;
  font-size: 30px;
  letter-spacing: 1px;
  line-height: 1;
  font-style: italic;
}
.logo .hub {
  color: black;
  background: var(--amber);
  border-radius: 8px;
  padding: 2px 9px;
  margin-left: 4px;
  font-style: normal;
}
.logo.big { font-size: 52px; text-align: center; }
.logo.small { font-size: 22px; }
.logo .hub { animation: hubGlow 2.4s ease-in-out infinite; }
@keyframes hubGlow {
  0%, 100% { box-shadow: 0 0 0 rgba(255, 190, 11, 0); }
  50% { box-shadow: 0 0 24px rgba(255, 190, 11, 0.55); }
}

/* ---------- Common UI ---------- */
.glass {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 12px 40px rgba(0, 0, 0, 0.45);
}
.btn {
  border: none;
  border-radius: 14px;
  padding: 13px 20px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  color: white;
  transition: transform 0.1s ease, box-shadow 0.2s ease, filter 0.2s;
  font-family: var(--font);
  letter-spacing: 0.3px;
}
.btn:active { transform: scale(0.96); }
.btn.primary {
  background: linear-gradient(135deg, var(--magenta), var(--purple));
  box-shadow: 0 6px 24px rgba(255, 0, 122, 0.35);
}
.btn.primary:hover { box-shadow: 0 8px 32px rgba(255, 0, 122, 0.55); filter: brightness(1.08); }
.btn.ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}
.btn.ghost:hover { border-color: var(--purple); color: var(--text); }
.btn.amber { background: linear-gradient(135deg, #ff9f00, var(--amber)); color: #1a0e00; box-shadow: 0 6px 20px rgba(255, 190, 11, 0.3); }
.btn.cyan { background: linear-gradient(135deg, #00c2a8, var(--cyan)); color: #001b16; box-shadow: 0 6px 20px rgba(0, 245, 212, 0.3); }
.btn.danger { background: linear-gradient(135deg, #ff3b3b, #c40b0b); color: white; box-shadow: 0 6px 20px rgba(255, 59, 59, 0.4); }
.btn.small { padding: 8px 14px; font-size: 13px; border-radius: 10px; }
.btn.tiny { padding: 6px 10px; font-size: 11px; border-radius: 8px; }
.btn.big { padding: 16px 26px; font-size: 17px; width: 100%; }
.mono { font-family: var(--mono); }
.uppercase { text-transform: uppercase; }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 6px 20px rgba(0, 245, 212, 0.3); } 50% { box-shadow: 0 6px 34px rgba(0, 245, 212, 0.7); } }

/* ---------- LOBBY ---------- */
.lobby-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; padding-top: 8vh; }
.tagline { color: var(--muted); letter-spacing: 4px; font-size: 13px; text-transform: uppercase; margin-bottom: 20px; }
.lobby-card {
  width: 100%;
  max-width: 380px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lobby-card label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.lobby-card input {
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 13px 14px;
  font-size: 16px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.lobby-card input:focus { border-color: var(--magenta); box-shadow: 0 0 0 3px rgba(255, 0, 122, 0.18); }
.emoji-row { display: flex; gap: 6px; flex-wrap: wrap; }
.emoji-pick {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid transparent;
  border-radius: 28px;
  font-size: 22px;
  width: 48px; height: 48px;
  cursor: pointer;
  transition: all 0.15s;
}
.emoji-pick.on { background: rgba(255, 0, 122, 0.22); border-color: var(--magenta); transform: scale(1.1); }
.mini { color: var(--muted); font-size: 12px; text-align: center; margin-top: 12px; }

/* ---------- TOPBAR ---------- */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 0 16px;
}
.corner { display: flex; justify-content: flex-end; }
.party-toggle {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 30px;
  width: 44px; height: 44px;
  font-size: 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.party-toggle.on {
  background: linear-gradient(135deg, rgba(255, 0, 122, 0.35), rgba(157, 78, 221, 0.35));
  border-color: var(--magenta);
  box-shadow: 0 0 22px rgba(255, 0, 122, 0.55);
  transform: rotate(-8deg);
  animation: partySpin 3s linear infinite;
}
@keyframes partySpin { 0% { transform: rotate(-8deg) scale(1); } 50% { transform: rotate(8deg) scale(1.15); } 100% { transform: rotate(-8deg) scale(1); } }

/* ---------- HUB ---------- */
.hub-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.room-panel { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.room-code-label { font-size: 11px; color: var(--muted); letter-spacing: 2px; }
.room-code { font-size: 32px; font-weight: 800; letter-spacing: 6px; color: var(--amber); text-shadow: 0 0 18px rgba(255, 190, 11, 0.5); }
.player-list { display: flex; flex-direction: column; gap: 8px; max-height: 240px; overflow-y: auto; }
.player-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 9px 12px;
}
.player-chip.me { border-color: var(--cyan); box-shadow: 0 0 12px rgba(0, 245, 212, 0.2); }
.p-emoji { font-size: 20px; }
.p-name { flex: 1; font-weight: 600; }
.p-tag { font-size: 10px; color: var(--cyan); border: 1px solid var(--cyan); border-radius: 6px; padding: 1px 5px; }
.p-sips { color: var(--muted); font-size: 13px; white-space: nowrap; }
.kick-btn { background: none; border: none; color: var(--danger); font-size: 15px; cursor: pointer; padding: 4px; }
.room-actions { margin-top: 4px; }
.waiting { color: var(--muted); font-style: italic; text-align: center; padding: 14px; }

.modes-panel h2 { font-size: 20px; margin-bottom: 14px; color: var(--text); }
.mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.mode-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}
.mode-card::after {
  content: "";
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(255, 0, 122, 0.12), transparent 50%);
  opacity: 0; transition: opacity 0.2s;
}
.mode-card:hover { transform: translateY(-2px); border-color: var(--purple); }
.mode-card:hover::after { opacity: 1; }
.mode-card.sel {
  border-color: var(--magenta);
  box-shadow: 0 0 18px rgba(255, 0, 122, 0.25), inset 0 0 24px rgba(255, 0, 122, 0.08);
  transform: translateY(-2px);
}
.mode-card.sel::after { opacity: 1; }
.mode-card:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }
.mode-title { font-weight: 800; font-size: 17px; }
.mode-desc { font-size: 12px; color: var(--muted); flex: 1; line-height: 1.45; }
.mode-meta { font-size: 11px; color: var(--amber); letter-spacing: 0.5px; }

/* ---------- GAME ---------- */
.game-top { padding-bottom: 6px; }
.corner-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 30px;
  width: 44px; height: 44px;
  font-size: 26px;
  cursor: pointer;
  line-height: 1;
}
.game-progress { text-align: center; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.game-progress .mono { font-size: 15px; color: var(--muted); }
.progress-bar { width: 130px; height: 5px; background: rgba(255, 255, 255, 0.08); border-radius: 4px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--magenta), var(--purple)); border-radius: 4px; transition: width 0.3s ease; box-shadow: 0 0 8px rgba(255, 0, 122, 0.6); }

.game-stage {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding-top: 8px;
  min-height: 62vh;
}
.card-wrap { flex: 1; display: flex; align-items: stretch; }
.card {
  flex: 1;
  background: linear-gradient(160deg, rgba(30, 24, 52, 0.94), rgba(16, 12, 30, 0.96));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.07);
}
.card::before {
  content: "";
  position: absolute;
  top: -40%; left: -20%;
  width: 140%; height: 80%;
  background: conic-gradient(from 0deg, transparent, rgba(157, 78, 221, 0.14), rgba(255, 0, 122, 0.10), transparent);
  animation: sheen 7s linear infinite;
  opacity: 0.5;
}
@keyframes sheen { to { transform: rotate(360deg); } }
.card-glow {
  position: absolute;
  inset: -2px;
  border-radius: 26px;
  background: linear-gradient(135deg, var(--magenta), var(--purple), var(--cyan), var(--amber));
  background-size: 400% 400%;
  z-index: -1;
  filter: blur(14px);
  opacity: 0.45;
  animation: borderFlow 6s ease infinite;
}
@keyframes borderFlow { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }
.card-top { display: flex; justify-content: space-between; align-items: center; }
.intensity-chip {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  padding: 5px 10px;
  border-radius: 20px;
  background: rgba(255, 190, 11, 0.12);
  color: var(--amber);
  border: 1px solid rgba(255, 190, 11, 0.4);
}
.intensity-chip.lethal { background: rgba(255, 59, 59, 0.15); color: var(--danger); border-color: rgba(255, 59, 59, 0.5); }
.card-text {
  font-size: clamp(20px, 5.4vw, 27px);
  font-weight: 650;
  line-height: 1.4;
  flex: 1;
  display: flex;
  align-items: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}
.sips-chip {
  align-self: flex-start;
  background: rgba(0, 245, 212, 0.10);
  border: 1px solid rgba(0, 245, 212, 0.4);
  color: var(--cyan);
  border-radius: 16px;
  padding: 7px 14px;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.5px;
}
.sips-chip.big { font-size: 18px; padding: 12px 18px; align-self: center; }
.timer-zone { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.cd-digit {
  font-family: var(--mono);
  font-size: 56px;
  font-weight: 800;
  color: var(--amber);
  text-shadow: 0 0 24px rgba(255, 190, 11, 0.6);
  height: 64px;
  line-height: 64px;
}
.cd-digit.pop { animation: cdPop 0.5s ease; }
@keyframes cdPop { 0% { transform: scale(1.4); opacity: 0.5; } 100% { transform: scale(1); opacity: 1; } }
.cd-digit.reveal { color: var(--danger); animation: cdReveal 0.35s ease; text-shadow: 0 0 28px rgba(255, 59, 59, 0.8); }
@keyframes cdReveal { 0% { transform: scale(1.8); } 100% { transform: scale(1); } }
.game-actions { display: flex; flex-direction: column; gap: 10px; }

/* ---------- BOMB ---------- */
.bomb-stage { align-items: center; justify-content: center; gap: 30px; }
.bomb-ring-wrap { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.bomb-ring {
  width: 210px; height: 210px;
  border-radius: 50%;
  background: conic-gradient(var(--cyan) var(--p, 0deg), rgba(255, 255, 255, 0.08) 0deg);
  display: flex; align-items: center; justify-content: center;
  position: relative;
  transition: background 0.2s;
}
.bomb-ring.urgent { background: conic-gradient(var(--danger) var(--p, 0deg), rgba(255, 59, 59, 0.12) 0deg); animation: bombUrgent 0.45s ease-in-out infinite; }
@keyframes bombUrgent { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
.bomb-core {
  width: 150px; height: 150px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #4a3420, #21130a 70%);
  display: flex; align-items: center; justify-content: center;
  font-size: 70px;
  box-shadow: inset 0 -8px 24px rgba(0, 0, 0, 0.6), 0 0 40px rgba(255, 120, 0, 0.25);
  animation: bombThrob calc(0.4s - (var(--p, 0) / 360 * 0.25s)) ease-in-out infinite alternate;
}
.bomb-ring.urgent .bomb-core { animation: bombThrob 0.18s ease-in-out infinite alternate; }
@keyframes bombThrob { from { transform: scale(1); } to { transform: scale(1.07); } }
.bomb-holder-name { font-size: 18px; font-weight: 800; color: var(--cyan); text-shadow: 0 0 16px rgba(0, 245, 212, 0.5); }
.bomb-stage .urgent .bomb-holder-name { color: var(--danger); }

.card.exploded { align-items: center; text-align: center; padding: 40px 24px; border-color: rgba(255, 59, 59, 0.5); box-shadow: 0 20px 60px rgba(255, 59, 59, 0.2); }
.card.exploded::before { opacity: 0.15; }
.boom { font-size: 70px; animation: boomPop 0.5s ease; }
@keyframes boomPop { 0% { transform: scale(0.2) rotate(-20deg); } 60% { transform: scale(1.2) rotate(8deg); } 100% { transform: scale(1) rotate(0); } }
.boom-title { font-size: 32px; font-weight: 900; color: var(--danger); letter-spacing: 2px; }
.boom-text { color: var(--muted); font-size: 16px; }

.end-stage { align-items: center; justify-content: center; gap: 20px; }
.end-card { align-items: center; text-align: center; padding: 44px 26px; max-width: 420px; }
.end-emoji { font-size: 60px; }
.end-sub { color: var(--muted); font-size: 16px; }
.end-leader { color: var(--amber); font-weight: 700; font-size: 15px; }

.center-status { display: flex; align-items: center; justify-content: center; min-height: 60vh; color: var(--muted); }

/* ---------- TOAST ---------- */
#toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translate(-50%, 20px);
  background: rgba(16, 12, 30, 0.95);
  border: 1px solid var(--purple);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 30px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  z-index: 999;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 560px) {
  .mode-grid { grid-template-columns: 1fr 1fr; }
  .mode-desc { font-size: 11px; }
}
@media (min-width: 561px) {
  .hub-grid { grid-template-columns: 340px 1fr; align-items: start; }
  .mode-grid { grid-template-columns: 1fr 1fr; }
}