/* ZING! late-night comedy club: deep violet stage, neon signage.
   Display face: Alfa Slab One. Body and ALL numerals: Outfit. */

:root {
  --bg: #120e23;
  --panel: #1d1736;
  --panel2: #271f4a;
  --edge: rgba(255, 255, 255, 0.09);
  --ink: #f4f0ff;
  --muted: #9d93c4;
  --yellow: #ffd60a;
  --yellow-dim: #b89a00;
  --pink: #ff2e88;
  --cyan: #19e3ff;
  --lime: #61f48d;
  --red: #ff5470;
  --font-display: 'Alfa Slab One', system-ui, sans-serif;
  --font-body: 'Outfit', system-ui, sans-serif;
  --radius: 18px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.45;
  overflow-x: hidden;
}

#bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60vmax 60vmax at 15% -10%, rgba(255, 46, 136, 0.16), transparent 60%),
    radial-gradient(55vmax 55vmax at 110% 15%, rgba(25, 227, 255, 0.13), transparent 60%),
    radial-gradient(70vmax 50vmax at 50% 115%, rgba(255, 214, 10, 0.08), transparent 60%), var(--bg);
  animation: bgdrift 24s ease-in-out infinite alternate;
}

@keyframes bgdrift {
  to {
    filter: hue-rotate(14deg);
  }
}

.hidden {
  display: none !important;
}

.num {
  font-family: var(--font-body);
  font-weight: 800;
  letter-spacing: 0.04em;
}

/* ---------- topbar ---------- */

#topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(18, 14, 35, 0.82);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--edge);
}

.tb-logo {
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--yellow);
  text-shadow: 0 0 18px rgba(255, 214, 10, 0.45);
}

.bolt {
  -webkit-text-fill-color: initial;
}

.tb-round {
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.12em;
  font-size: 13px;
}

.tb-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tb-code {
  font-size: 15px;
  background: var(--panel2);
  border: 1px solid var(--edge);
  border-radius: 10px;
  color: var(--cyan);
  padding: 5px 10px;
  cursor: pointer;
}

.iconbtn {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
}

/* ---------- layout & type ---------- */

main {
  max-width: 880px;
  margin: 0 auto;
  padding: 18px 16px 90px;
}

.ttl {
  font-family: var(--font-display);
  font-size: clamp(28px, 6vw, 44px);
  text-align: center;
  margin: 12px 0 4px;
  letter-spacing: 0.02em;
  text-shadow: 0 0 26px rgba(255, 46, 136, 0.35);
}

.ttl.small {
  font-size: clamp(20px, 4.5vw, 30px);
}

.final-ttl {
  color: var(--yellow);
  text-shadow: 0 0 26px rgba(255, 214, 10, 0.5);
}

.hint {
  color: var(--muted);
  text-align: center;
  font-size: 14px;
  margin: 6px 0;
}

.prompt {
  font-size: clamp(18px, 3.4vw, 24px);
  font-weight: 800;
  text-align: center;
  margin: 8px auto;
  max-width: 640px;
}

.prompt.big {
  color: var(--yellow);
  text-shadow: 0 0 22px rgba(255, 214, 10, 0.25);
}

/* ---------- buttons & inputs ---------- */

.btn {
  font-family: var(--font-display);
  font-size: 17px;
  letter-spacing: 0.04em;
  color: var(--ink);
  background: var(--panel2);
  border: 2px solid var(--edge);
  border-radius: 14px;
  padding: 12px 22px;
  cursor: pointer;
  transition:
    transform 0.08s ease,
    box-shadow 0.2s ease,
    filter 0.2s ease;
}

.btn:active {
  transform: translateY(2px) scale(0.98);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--yellow);
  border-color: var(--yellow);
  color: #221a00;
  box-shadow: 0 0 26px rgba(255, 214, 10, 0.35);
}

.btn-primary:not(:disabled):hover {
  filter: brightness(1.08);
}

.btn-cyan {
  background: var(--cyan);
  border-color: var(--cyan);
  color: #002a33;
  box-shadow: 0 0 22px rgba(25, 227, 255, 0.3);
}

.btn.big {
  font-size: 21px;
  padding: 15px 34px;
}

input,
textarea {
  font-family: var(--font-body);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  background: #141029;
  border: 2px solid var(--edge);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  width: 100%;
}

input:focus,
textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(25, 227, 255, 0.25);
}

textarea {
  resize: none;
}

/* ---------- home ---------- */

.home-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding-top: 5vh;
  text-align: center;
}

.logo {
  font-family: var(--font-display);
  font-size: clamp(64px, 16vw, 120px);
  margin: 0;
  line-height: 1;
  color: var(--yellow);
  text-shadow:
    0 0 14px rgba(255, 214, 10, 0.65),
    0 0 60px rgba(255, 46, 136, 0.4);
  animation: flicker 7s linear infinite;
}

@keyframes flicker {
  0%,
  92%,
  95%,
  100% {
    opacity: 1;
  }
  93.5% {
    opacity: 0.55;
  }
}

.tagline {
  font-size: clamp(16px, 3vw, 20px);
  font-weight: 600;
  color: var(--ink);
  margin: 0;
}

.home-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
}

#home-name {
  text-align: center;
  text-transform: uppercase;
}

.or {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.or::before,
.or::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--edge);
}

.join-row {
  display: flex;
  gap: 10px;
}

#home-code {
  width: 110px;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

.join-row .btn {
  flex: 1;
}

.how {
  list-style: none;
  padding: 0;
  margin: 8px 0 0;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
}

.how li {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--muted);
  max-width: 240px;
}

.how b {
  color: var(--ink);
  display: block;
  letter-spacing: 0.06em;
}

.foot {
  color: var(--muted);
  font-size: 13px;
}

/* ---------- lobby ---------- */

.code-chip {
  font-size: inherit;
  background: var(--panel2);
  border: 2px dashed rgba(25, 227, 255, 0.5);
  color: var(--cyan);
  border-radius: 14px;
  padding: 2px 16px;
  cursor: pointer;
  letter-spacing: 0.14em;
  font-family: var(--font-body);
  font-weight: 800;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin: 18px auto;
  max-width: 640px;
}

.pchip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 999px;
  padding: 8px 16px 8px 10px;
  font-weight: 800;
  animation: popin 0.25s ease both;
}

@keyframes popin {
  from {
    transform: scale(0.6);
    opacity: 0;
  }
}

.pchip.me {
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(25, 227, 255, 0.25);
}

.pchip.off {
  opacity: 0.4;
}

.pav {
  font-size: 22px;
}

.phost {
  font-size: 10px;
  letter-spacing: 0.1em;
  background: var(--pink);
  border-radius: 6px;
  padding: 2px 6px;
}

.aud-row {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  margin: 6px 0 14px;
}

.hostbox {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  margin-top: 10px;
}

.modes {
  display: flex;
  gap: 10px;
}

.mode-btn {
  font-family: var(--font-body);
  background: var(--panel);
  color: var(--ink);
  border: 2px solid var(--edge);
  border-radius: 14px;
  padding: 10px 18px;
  cursor: pointer;
  text-align: center;
}

.mode-btn b {
  display: block;
  font-size: 16px;
  letter-spacing: 0.08em;
}

.mode-btn span {
  font-size: 12px;
  color: var(--muted);
}

.mode-btn.sel {
  border-color: var(--pink);
  box-shadow: 0 0 16px rgba(255, 46, 136, 0.35);
}

/* ---------- intro splash ---------- */

.splash {
  text-align: center;
  padding-top: 18vh;
  animation: splashin 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

@keyframes splashin {
  from {
    transform: scale(0.4);
    opacity: 0;
  }
}

.splash-kicker {
  color: var(--cyan);
  font-weight: 800;
  letter-spacing: 0.3em;
  margin: 0 0 6px;
}

.splash-title {
  font-family: var(--font-display);
  font-size: clamp(40px, 9vw, 76px);
  margin: 0;
  color: var(--yellow);
  text-shadow:
    0 0 18px rgba(255, 214, 10, 0.6),
    0 0 70px rgba(255, 46, 136, 0.35);
}

.splash-sub {
  color: var(--muted);
  font-size: 18px;
}

/* ---------- write ---------- */

#write-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 620px;
  margin: 14px auto;
}

.wcard {
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35);
  animation: popin 0.3s ease both;
}

.wcard .prompt {
  text-align: left;
  margin-top: 0;
  color: var(--yellow);
}

.wcard.sent {
  opacity: 0.55;
}

.sent-msg {
  font-weight: 800;
  color: var(--lime);
  margin: 4px 0 0;
}

.wfoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}

.count {
  color: var(--muted);
  font-size: 13px;
}

.donebox {
  text-align: center;
  padding-top: 8vh;
}

.bigcheck {
  font-size: 64px;
  animation: popin 0.4s cubic-bezier(0.2, 1.6, 0.4, 1) both;
}

.done-msg {
  font-family: var(--font-display);
  font-size: 26px;
  margin: 8px 0;
}

/* ---------- duels ---------- */

.duel-n {
  text-align: center;
  color: var(--cyan);
  letter-spacing: 0.25em;
  font-size: 13px;
  margin: 14px 0 2px;
}

.vs-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 620px;
  margin: 18px auto 10px;
}

.vs {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-7deg);
  font-family: var(--font-display);
  font-size: 24px;
  color: var(--pink);
  text-shadow: 0 0 16px rgba(255, 46, 136, 0.8);
  background: var(--bg);
  border: 2px solid var(--pink);
  border-radius: 12px;
  padding: 2px 12px;
  z-index: 2;
  pointer-events: none;
}

.acard {
  position: relative;
  font-family: var(--font-body);
  background: var(--panel);
  color: var(--ink);
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  padding: 22px 20px;
  font-size: clamp(18px, 3.2vw, 23px);
  font-weight: 800;
  min-height: 86px;
  cursor: default;
  text-align: center;
  transition:
    transform 0.1s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    opacity 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  overflow: hidden;
}

.acard.pickable {
  cursor: pointer;
  border-color: rgba(25, 227, 255, 0.45);
}

.acard.pickable:hover {
  transform: translateY(-2px);
  box-shadow: 0 0 22px rgba(25, 227, 255, 0.25);
}

.acard.picked {
  border-color: var(--cyan);
  box-shadow: 0 0 26px rgba(25, 227, 255, 0.45);
}

.acard.picked::after {
  content: 'YOUR VOTE';
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--cyan);
}

.crickets {
  color: var(--muted);
  font-style: italic;
  font-weight: 600;
}

/* reveal */

.acard.revealed {
  cursor: default;
}

.acard.win {
  border-color: var(--yellow);
  box-shadow: 0 0 34px rgba(255, 214, 10, 0.45);
  animation: winpulse 1.6s ease infinite;
}

@keyframes winpulse {
  50% {
    box-shadow: 0 0 50px rgba(255, 214, 10, 0.65);
  }
}

.acard.lose {
  opacity: 0.55;
}

.acard.tie {
  border-color: var(--cyan);
}

.a-extra {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.rbar {
  display: block;
  height: 10px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.rfill {
  display: block;
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--pink), var(--yellow));
  transition: width 0.9s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.rmeta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

.rauthor {
  color: var(--ink);
  font-weight: 800;
}

.rpts {
  color: var(--lime);
  font-size: 17px;
}

.stamp {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%) rotate(-9deg) scale(0);
  font-family: var(--font-display);
  font-size: 26px;
  color: var(--pink);
  border: 3px solid var(--pink);
  border-radius: 10px;
  padding: 0 10px;
  background: rgba(18, 14, 35, 0.85);
  text-shadow: 0 0 14px rgba(255, 46, 136, 0.8);
  animation: stampin 0.35s cubic-bezier(0.2, 1.8, 0.4, 1) 0.55s both;
  z-index: 3;
}

@keyframes stampin {
  to {
    transform: translateX(-50%) rotate(-9deg) scale(1);
  }
}

/* ---------- scoreboard ---------- */

.board {
  max-width: 620px;
  margin: 16px auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.srow {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 10px 14px;
  opacity: 0;
  transform: translateX(-18px);
  transition:
    opacity 0.35s ease,
    transform 0.35s ease;
}

.srow.in {
  opacity: 1;
  transform: none;
}

.srank {
  width: 22px;
  color: var(--muted);
  text-align: right;
}

.sav {
  font-size: 22px;
}

.sname {
  font-weight: 800;
  min-width: 90px;
}

.sbarbox {
  flex: 1;
  height: 12px;
  background: rgba(255, 255, 255, 0.07);
  border-radius: 7px;
  overflow: hidden;
}

.sbar {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--pink));
  border-radius: 7px;
  transition: width 1s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.sgain {
  color: var(--lime);
  font-size: 14px;
  min-width: 56px;
  text-align: right;
}

.sscore {
  min-width: 64px;
  text-align: right;
  font-size: 18px;
}

/* ---------- finale ---------- */

#final-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  max-width: 760px;
  margin: 14px auto;
}

.fcard {
  position: relative;
  font-family: var(--font-body);
  background: var(--panel);
  color: var(--ink);
  border: 2px solid var(--edge);
  border-radius: var(--radius);
  padding: 18px 16px 22px;
  font-size: 17px;
  font-weight: 800;
  min-height: 84px;
  cursor: pointer;
  text-align: center;
  transition:
    transform 0.1s ease,
    border-color 0.2s ease,
    box-shadow 0.2s ease;
}

.fcard:hover:not(.mine):not(.dead) {
  transform: translateY(-2px);
  border-color: rgba(25, 227, 255, 0.4);
}

.fcard.chosen {
  border-color: var(--yellow);
  box-shadow: 0 0 20px rgba(255, 214, 10, 0.35);
}

.fcard.mine,
.fcard.dead {
  cursor: default;
  opacity: 0.6;
}

.minetag {
  position: absolute;
  top: 8px;
  right: 10px;
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--cyan);
}

.fcard .medal {
  position: absolute;
  top: -12px;
  left: -8px;
  font-size: 30px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

#btn-medals {
  display: block;
  margin: 10px auto;
}

/* final reveal */

.frow {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--edge);
  border-radius: 14px;
  padding: 12px 16px;
  opacity: 0;
  transform: translateY(14px) scale(0.97);
  transition:
    opacity 0.4s ease,
    transform 0.4s cubic-bezier(0.2, 1.2, 0.4, 1);
}

.frow.in {
  opacity: 1;
  transform: none;
}

.frow.top {
  border-color: var(--yellow);
  box-shadow: 0 0 26px rgba(255, 214, 10, 0.3);
}

.f-text {
  font-size: 18px;
  font-weight: 800;
}

.frow.top .f-text {
  font-size: 22px;
  color: var(--yellow);
}

.f-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--muted);
}

.f-medals {
  flex: 1;
  letter-spacing: 0.04em;
}

/* ---------- podium ---------- */

#podium-tiers {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  margin: 26px auto 10px;
  max-width: 560px;
}

.tier {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  text-align: center;
}

.tier-p {
  animation: popin 0.4s ease both;
}

.tier-av {
  font-size: 38px;
}

.tier-name {
  font-weight: 800;
  font-size: 15px;
}

.tier-score {
  color: var(--muted);
  font-size: 13px;
}

.crown {
  font-size: 30px;
  animation: crownbounce 1.6s ease infinite;
}

@keyframes crownbounce {
  50% {
    transform: translateY(-7px) rotate(-6deg);
  }
}

.tier-block {
  border-radius: 12px 12px 0 0;
  background: var(--panel2);
  border: 1px solid var(--edge);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
}

.t1 .tier-block {
  height: 110px;
  background: linear-gradient(180deg, rgba(255, 214, 10, 0.25), var(--panel2));
  border-color: rgba(255, 214, 10, 0.5);
}

.t2 .tier-block {
  height: 78px;
}

.t3 .tier-block {
  height: 56px;
}

.bestbox {
  max-width: 560px;
  margin: 18px auto;
  text-align: center;
  background: var(--panel);
  border: 2px solid var(--pink);
  border-radius: var(--radius);
  padding: 14px 18px;
  box-shadow: 0 0 26px rgba(255, 46, 136, 0.25);
}

.best-k {
  color: var(--pink);
  letter-spacing: 0.25em;
  font-size: 12px;
  font-weight: 800;
  margin: 0;
}

.best-t {
  font-size: 20px;
  font-weight: 800;
  margin: 8px 0;
}

.best-a {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}

#btn-again {
  display: block;
  margin: 18px auto 0;
}

#podium-wait {
  margin-top: 18px;
}

/* ---------- fuse, toasts, overlays ---------- */

#fuse {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
  z-index: 30;
}

#fuse-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--cyan), var(--yellow));
  transform-origin: left;
  box-shadow: 0 0 14px rgba(25, 227, 255, 0.5);
}

#fuse-fill.danger {
  background: var(--red);
  box-shadow: 0 0 18px rgba(255, 84, 112, 0.7);
}

#toasts {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
}

.toast {
  background: var(--panel2);
  border: 1px solid var(--edge);
  border-radius: 12px;
  padding: 10px 18px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(-8px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.toast.show {
  opacity: 1;
  transform: none;
}

#net-overlay {
  position: fixed;
  inset: 0;
  background: rgba(18, 14, 35, 0.7);
  backdrop-filter: blur(3px);
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
}

.net-box {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--yellow);
  animation: flicker 1.4s linear infinite;
}

#confetti {
  position: fixed;
  inset: 0;
  z-index: 70;
  pointer-events: none;
}

/* ---------- responsive ---------- */

@media (min-width: 640px) {
  .vs-wrap {
    flex-direction: row;
    align-items: stretch;
  }

  .acard {
    flex: 1;
  }
}

@media (max-width: 420px) {
  .modes {
    flex-direction: column;
    width: 100%;
  }

  .sname {
    min-width: 64px;
    font-size: 14px;
  }
}
