/* SHIPSHOW: late-night game show. Deep stage purple, hot pink and marquee
   yellow, cream ticket-stub cards. Display font Titan One; numerals always
   render in Rubik (.num). Emoji are the only art. */

:root {
  --bg: #171130;
  --bg2: #241a4d;
  --card: #fff7ea;
  --ink: #2b2233;
  --pink: #ff4d9d;
  --pink-d: #c2226c;
  --yellow: #ffd23f;
  --yellow-d: #c79a00;
  --cyan: #29e0ff;
  --green: #30d158;
  --muted: #9b8fd0;
  --font-show: 'Titan One', system-ui, sans-serif;
  --font-num: 'Rubik', system-ui, sans-serif;
}

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

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

body {
  background:
    radial-gradient(1100px 600px at 50% -10%, #3b2a7a55, transparent 60%),
    radial-gradient(900px 500px at 85% 110%, #ff4d9d22, transparent 60%),
    radial-gradient(700px 500px at 10% 100%, #29e0ff14, transparent 60%), var(--bg);
  color: #fff;
  font-family: var(--font-num);
  overflow-x: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: 0;
}

.hidden {
  display: none !important;
}

.num {
  font-family: var(--font-num);
}

h1,
h2,
.brand,
.big-btn,
.done-stamp,
.onair {
  font-family: var(--font-show);
  font-weight: 400;
  letter-spacing: 0.02em;
}

h2 {
  color: var(--yellow);
  text-shadow: 0 3px 0 #00000055;
  font-size: clamp(26px, 4vw, 40px);
  margin: 10px 0 18px;
  text-align: center;
}

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

.screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#s-home {
  justify-content: center;
  padding: 24px 16px 48px;
}

.marquee {
  position: relative;
  padding: 18px 36px;
  text-align: center;
}

.marquee h1 {
  margin: 0;
  font-size: clamp(56px, 13vw, 130px);
  line-height: 1;
  color: var(--yellow);
  text-shadow:
    0 4px 0 var(--yellow-d),
    0 9px 0 #00000088,
    0 0 60px #ffd23f55;
  transform: rotate(-2deg);
}

.marquee h1 span {
  color: var(--pink);
  text-shadow:
    0 4px 0 var(--pink-d),
    0 9px 0 #00000088,
    0 0 60px #ff4d9d66;
}

.bulbs {
  height: 14px;
  margin: 0 -10px;
  background-image: radial-gradient(circle 5px, #ffd23f 0 4px, #ffffff22 5px, transparent 6px);
  background-size: 34px 14px;
  background-position: 8px 0;
  animation: chase 0.9s steps(2) infinite;
}

.bulbs.flip {
  animation-delay: 0.45s;
}

@keyframes chase {
  to {
    background-position: 42px 0;
  }
}

.tagline {
  color: var(--muted);
  font-size: clamp(14px, 2.4vw, 19px);
  margin: 14px 0 30px;
  text-align: center;
}

.home-card {
  background: #ffffff10;
  border: 1px solid #ffffff22;
  border-radius: 22px;
  padding: 26px;
  width: min(420px, 94vw);
  display: flex;
  flex-direction: column;
  gap: 16px;
  backdrop-filter: blur(6px);
}

.id-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-av {
  font-size: 42px;
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  background: #ffffff14;
  border-radius: 16px;
}

.av-btn {
  background: #ffffff14;
  color: #fff;
  border-radius: 12px;
  width: 34px;
  height: 62px;
  font-size: 26px;
}

.av-btn:hover {
  background: #ffffff28;
}

input,
textarea {
  font-family: var(--font-num);
  font-size: 18px;
  color: #fff;
  background: #00000035;
  border: 2px solid #ffffff2c;
  border-radius: 14px;
  padding: 14px 16px;
  outline: none;
  min-width: 0;
}

input:focus,
textarea:focus {
  border-color: var(--cyan);
}

#home-name {
  flex: 1;
}

#home-code {
  width: 110px;
  text-transform: uppercase;
  text-align: center;
  letter-spacing: 0.25em;
  font-weight: 800;
}

.big-btn {
  font-size: clamp(18px, 2.6vw, 24px);
  color: var(--ink);
  background: var(--yellow);
  border-radius: 16px;
  padding: 14px 26px;
  box-shadow:
    0 6px 0 var(--yellow-d),
    0 12px 24px #00000066;
  transition:
    transform 0.06s,
    box-shadow 0.06s;
}

.big-btn:hover {
  filter: brightness(1.05);
}

.big-btn:active {
  transform: translateY(5px);
  box-shadow:
    0 1px 0 var(--yellow-d),
    0 4px 10px #00000066;
}

.big-btn:disabled {
  opacity: 0.6;
  transform: none;
}

.big-btn.alt {
  background: var(--pink);
  color: #fff;
  box-shadow:
    0 6px 0 var(--pink-d),
    0 12px 24px #00000066;
}

.big-btn.alt:active {
  box-shadow:
    0 1px 0 var(--pink-d),
    0 4px 10px #00000066;
}

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

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

.home-err {
  color: #ff8a8a;
  text-align: center;
  font-weight: 600;
}

.home-hint {
  color: var(--muted);
  margin-top: 26px;
  text-align: center;
  font-size: 14px;
  padding: 0 12px;
}

/* ---------- stage chrome ---------- */

#s-stage {
  justify-content: flex-start;
}

#topbar {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 6px;
  flex-wrap: wrap;
}

.brand {
  font-size: 22px;
  color: var(--yellow);
  text-shadow: 0 2px 0 #00000077;
  transform: rotate(-2deg);
}

.brand span {
  color: var(--pink);
}

.pill {
  background: #ffffff14;
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.pill.phase {
  color: var(--cyan);
}

.pill.btn {
  color: #fff;
  border: 1px solid #ffffff22;
}

.pill.btn:hover {
  background: #ffffff28;
}

.top-spacer {
  flex: 1;
}

#timer {
  width: 100%;
  height: 8px;
  background: #00000050;
}

#timer-fill {
  height: 100%;
  width: 100%;
  background: var(--green);
  border-radius: 0 4px 4px 0;
  transition: width 0.25s linear;
}

#timer-fill.mid {
  background: var(--yellow);
}

#timer-fill.low {
  background: #ff5d5d;
  animation: pulse 0.5s infinite alternate;
}

@keyframes pulse {
  to {
    filter: brightness(1.6);
  }
}

#players {
  width: 100%;
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  overflow-x: auto;
  scrollbar-width: none;
}

.pchip {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  background: #ffffff12;
  border: 1px solid #ffffff1c;
  border-radius: 999px;
  padding: 6px 12px 6px 7px;
  white-space: nowrap;
  flex: 0 0 auto;
}

.pchip.you {
  border-color: var(--cyan);
  box-shadow: 0 0 12px #29e0ff33;
}

.pchip.off {
  opacity: 0.38;
}

.pav {
  font-size: 22px;
}

.pname {
  font-weight: 600;
  font-size: 14px;
}

.pscore {
  color: var(--yellow);
  font-weight: 800;
  font-size: 14px;
}

.pzzz {
  font-size: 11px;
  color: var(--muted);
}

.stamp {
  position: absolute;
  top: -7px;
  right: -4px;
  background: var(--green);
  color: #0c2912;
  font-weight: 800;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 999px;
  transform: rotate(8deg);
  animation: stampIn 0.25s cubic-bezier(0.2, 2.4, 0.4, 1);
}

.stamp.voted {
  background: var(--cyan);
  color: #082833;
}

@keyframes stampIn {
  from {
    transform: scale(2.4) rotate(20deg);
    opacity: 0;
  }
}

#arena {
  width: min(880px, 100%);
  padding: 8px 16px 90px;
  flex: 1;
}

.view {
  animation: viewIn 0.3s ease-out;
}

@keyframes viewIn {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

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

.lobby-code-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  background: #ffffff0e;
  border: 1px dashed #ffffff33;
  border-radius: 22px;
  padding: 26px;
}

.lobby-code {
  font-size: clamp(54px, 12vw, 96px);
  font-weight: 800;
  letter-spacing: 0.3em;
  margin-right: -0.3em;
  color: var(--yellow);
  text-shadow: 0 4px 0 #00000066;
}

.lobby-link {
  color: var(--cyan);
  font-size: 15px;
  word-break: break-all;
  text-align: center;
}

.lobby-status {
  text-align: center;
  color: var(--pink);
  font-weight: 800;
  font-size: 20px;
  animation: pulse 1s infinite alternate;
}

.lobby-rules {
  color: var(--muted);
  text-align: center;
  max-width: 560px;
  margin: 18px auto 0;
  line-height: 1.6;
}

/* ---------- countdown ---------- */

#v-countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
}

.onair {
  font-size: clamp(26px, 5vw, 44px);
  color: var(--pink);
  text-shadow: 0 3px 0 #00000066;
}

.count-num {
  font-size: clamp(120px, 30vw, 240px);
  font-weight: 800;
  color: var(--yellow);
  text-shadow:
    0 8px 0 var(--yellow-d),
    0 16px 40px #000000aa;
  line-height: 1;
  animation: pop 1s infinite;
}

@keyframes pop {
  0% {
    transform: scale(1.18);
  }
  30% {
    transform: scale(1);
  }
}

/* ---------- prompt + write ---------- */

.prompt-card {
  background: var(--card);
  color: var(--ink);
  border-radius: 20px;
  padding: 26px 30px;
  font-size: clamp(22px, 3.6vw, 34px);
  font-weight: 800;
  text-align: center;
  box-shadow:
    0 10px 0 #00000044,
    0 18px 50px #00000066;
  transform: rotate(-0.6deg);
  margin: 8px 0 20px;
}

.prompt-card.small {
  font-size: clamp(16px, 2.4vw, 22px);
  padding: 16px 20px;
  transform: rotate(0.4deg);
}

#write-quip {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#quip-input {
  font-size: 22px;
  font-weight: 600;
  resize: none;
}

.quip-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.quip-count {
  color: var(--muted);
}

.write-done {
  text-align: center;
  padding: 30px 0;
}

.done-stamp {
  display: inline-block;
  font-size: 54px;
  color: var(--green);
  border: 5px solid var(--green);
  border-radius: 14px;
  padding: 4px 26px;
  transform: rotate(-7deg);
  animation: stampIn 0.3s cubic-bezier(0.2, 2.4, 0.4, 1);
}

.write-waiting {
  color: var(--muted);
  margin: 18px 0;
}

.write-count {
  text-align: center;
  color: var(--muted);
  margin-top: 14px;
  font-size: 13px;
}

/* ---------- doodle pad ---------- */

#write-doodle {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  justify-content: center;
  flex-wrap: wrap;
}

.pad-wrap {
  background: var(--card);
  padding: 10px;
  border-radius: 18px;
  box-shadow:
    0 10px 0 #00000044,
    0 18px 50px #00000066;
  transform: rotate(0.5deg);
}

#pad {
  display: block;
  width: min(440px, 82vw);
  height: min(440px, 82vw);
  border-radius: 10px;
  touch-action: none;
  cursor: crosshair;
}

.pad-tools {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 200px;
}

.pad-colors {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  gap: 8px;
}

.pcolor {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  border: 3px solid #ffffff2a;
}

.pcolor.active {
  border-color: #fff;
  transform: scale(1.1);
}

.pcolor.eraser {
  background-image: linear-gradient(45deg, #ddd 25%, transparent 25%, transparent 75%, #ddd 75%);
  background-size: 10px 10px;
}

.pad-tools-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.pad-widths {
  display: flex;
  gap: 6px;
}

.pwidth {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #ffffff14;
  display: grid;
  place-items: center;
}

.pwidth span {
  background: #fff;
  border-radius: 50%;
  display: block;
}

.pwidth.active {
  outline: 2px solid var(--cyan);
}

.tool-btn {
  background: #ffffff14;
  color: #fff;
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 600;
}

.tool-btn:hover {
  background: #ffffff28;
}

.ink {
  height: 6px;
  background: #00000050;
  border-radius: 3px;
  overflow: hidden;
}

#ink-fill {
  height: 100%;
  width: 0;
  background: var(--pink);
}

/* ---------- vote ---------- */

#ballot {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin: 6px 0 14px;
}

.bcard {
  position: relative;
  background: var(--card);
  color: var(--ink);
  border-radius: 16px;
  padding: 20px;
  font-size: 19px;
  font-weight: 700;
  text-align: center;
  box-shadow:
    0 7px 0 #00000044,
    0 12px 30px #00000055;
  transform: rotate(var(--tilt, 0deg));
  transition:
    transform 0.1s,
    box-shadow 0.1s;
  border: 4px solid transparent;
  animation: dealIn 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) backwards;
}

.bcard:nth-child(2n) {
  animation-delay: 0.06s;
}

.bcard:nth-child(3n) {
  animation-delay: 0.12s;
}

@keyframes dealIn {
  from {
    opacity: 0;
    transform: translateY(26px) rotate(var(--tilt, 0deg)) scale(0.92);
  }
}

.bcard:not(:disabled):hover {
  transform: rotate(0deg) translateY(-4px) scale(1.03);
}

.bcard.picked {
  border-color: var(--pink);
  box-shadow:
    0 7px 0 var(--pink-d),
    0 0 28px #ff4d9d88;
}

.bcard.picked::after {
  content: 'MY VOTE';
  position: absolute;
  top: -12px;
  right: -8px;
  background: var(--pink);
  color: #fff;
  font-weight: 800;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
  transform: rotate(8deg);
}

.bcard.mine {
  opacity: 0.55;
  cursor: default;
}

.mine-tag {
  position: absolute;
  top: -10px;
  left: -6px;
  background: #6b6b6b;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 3px 9px;
  border-radius: 999px;
  transform: rotate(-6deg);
}

.bcard p {
  margin: 0;
}

.bdoodle {
  width: 100%;
  height: auto;
  border-radius: 8px;
}

.vote-hint {
  text-align: center;
  color: var(--muted);
  font-weight: 600;
}

.vote-late {
  text-align: center;
  color: var(--cyan);
  font-weight: 700;
}

/* ---------- reveal ---------- */

#reveal-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

.rcard {
  background: var(--card);
  color: var(--ink);
  border-radius: 18px;
  padding: 20px 24px;
  width: min(620px, 100%);
  box-shadow:
    0 8px 0 #00000044,
    0 14px 36px #00000055;
  animation: revealIn 0.45s cubic-bezier(0.2, 1.6, 0.4, 1);
}

@keyframes revealIn {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.9) rotate(-2deg);
  }
}

.rcard.winner {
  border: 5px solid var(--yellow);
  box-shadow:
    0 8px 0 var(--yellow-d),
    0 0 50px #ffd23f66;
  transform: scale(1.04);
}

.rcard.winner .rtext::before {
  content: '🏆 ';
}

.rtext {
  font-size: clamp(20px, 3vw, 28px);
  font-weight: 800;
  margin: 0 0 12px;
  text-align: center;
}

.rdoodle {
  display: block;
  margin: 0 auto 12px;
  width: min(230px, 64vw);
  height: auto;
  border-radius: 10px;
  border: 2px solid #00000012;
}

.rmeta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  font-weight: 700;
}

.rauthor {
  font-size: 17px;
}

.rvotes {
  color: var(--pink-d);
}

.rgain {
  color: #1c7c3f;
  font-weight: 800;
  animation: gainPop 0.4s cubic-bezier(0.2, 2, 0.4, 1);
}

@keyframes gainPop {
  from {
    transform: scale(2);
  }
}

.rvoters {
  margin-top: 8px;
  font-size: 18px;
  opacity: 0.85;
}

.tumbleweed {
  text-align: center;
  color: var(--muted);
  font-size: 20px;
  font-weight: 700;
  padding: 30px;
}

.sweep-banner {
  font-family: var(--font-show);
  font-size: clamp(30px, 6vw, 52px);
  color: var(--pink);
  text-shadow:
    0 3px 0 var(--pink-d),
    0 8px 30px #ff4d9d77;
  transform: rotate(-4deg);
  animation: stampIn 0.4s cubic-bezier(0.2, 2.4, 0.4, 1);
}

/* ---------- scores ---------- */

#board {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(640px, 100%);
  margin: 0 auto;
}

.brow {
  display: grid;
  grid-template-columns: 36px 34px minmax(80px, auto) 1fr 64px auto;
  align-items: center;
  gap: 10px;
  background: #ffffff10;
  border: 1px solid #ffffff1c;
  border-radius: 14px;
  padding: 10px 14px;
  animation: viewIn 0.3s ease-out backwards;
}

.brow:nth-child(2) {
  animation-delay: 0.05s;
}

.brow:nth-child(3) {
  animation-delay: 0.1s;
}

.brow:nth-child(n + 4) {
  animation-delay: 0.15s;
}

.brow.you {
  border-color: var(--cyan);
}

.brank {
  font-size: 20px;
  text-align: center;
}

.bav {
  font-size: 24px;
}

.bname {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bbar {
  height: 12px;
  background: #00000045;
  border-radius: 6px;
  overflow: hidden;
}

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

.bscore {
  text-align: right;
  font-weight: 800;
  color: var(--yellow);
}

.bdelta {
  color: var(--green);
  font-weight: 800;
  animation: gainPop 0.4s cubic-bezier(0.2, 2, 0.4, 1);
}

.next-hint {
  text-align: center;
  color: var(--muted);
  margin-top: 20px;
  font-weight: 600;
}

/* ---------- showdown ---------- */

#v-showdown {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
}

#champ {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.champ-card {
  background: var(--card);
  color: var(--ink);
  border: 6px solid var(--yellow);
  border-radius: 24px;
  padding: 30px 50px;
  text-align: center;
  box-shadow:
    0 10px 0 var(--yellow-d),
    0 0 80px #ffd23f55;
  animation: revealIn 0.5s cubic-bezier(0.2, 1.6, 0.4, 1);
}

.champ-crown {
  font-size: 54px;
  animation: crownDrop 0.7s cubic-bezier(0.3, 1.8, 0.4, 1);
}

@keyframes crownDrop {
  from {
    transform: translateY(-80px) rotate(-30deg);
    opacity: 0;
  }
}

.champ-av {
  font-size: 84px;
  line-height: 1.1;
}

.champ-name {
  font-family: var(--font-show);
  font-size: clamp(30px, 6vw, 48px);
}

.champ-score {
  font-weight: 800;
  color: var(--pink-d);
  font-size: 22px;
}

.champ-title {
  margin-top: 10px;
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 13px;
  color: #00000077;
}

.champ-none {
  font-size: 24px;
  font-weight: 700;
  text-align: center;
  color: var(--muted);
}

.champ-next {
  color: var(--muted);
  font-weight: 600;
}

/* ---------- reactions ---------- */

#reactbar {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 6px;
  background: #00000066;
  border: 1px solid #ffffff22;
  border-radius: 999px;
  padding: 6px 10px;
  backdrop-filter: blur(8px);
  z-index: 30;
}

.rbtn {
  font-size: 24px;
  background: transparent;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  transition: transform 0.08s;
}

.rbtn:hover {
  transform: scale(1.3) rotate(-8deg);
  background: #ffffff18;
}

.rbtn:active {
  transform: scale(0.9);
}

.floaty {
  position: fixed;
  bottom: 70px;
  z-index: 40;
  pointer-events: none;
  animation: floatUp 2.5s ease-out forwards;
  text-align: center;
}

.floaty-e {
  font-size: 40px;
  display: block;
}

.floaty-av {
  font-size: 17px;
  display: block;
  margin-top: -6px;
}

@keyframes floatUp {
  to {
    transform: translateY(-72vh) translateX(var(--drift, 0px)) rotate(10deg);
    opacity: 0;
  }
}

/* ---------- toast + fx ---------- */

#toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--card);
  color: var(--ink);
  font-weight: 800;
  border-radius: 999px;
  padding: 11px 22px;
  z-index: 60;
  box-shadow: 0 8px 30px #000000aa;
  animation: stampIn 0.25s cubic-bezier(0.2, 2, 0.4, 1);
  max-width: 90vw;
  text-align: center;
}

#fx {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

/* ---------- phone ---------- */

@media (max-width: 640px) {
  #topbar .brand {
    display: none;
  }

  #arena {
    padding: 6px 10px 86px;
  }

  .prompt-card {
    padding: 18px;
  }

  #ballot {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
  }

  .bcard {
    padding: 14px;
    font-size: 16px;
  }

  .pad-tools {
    width: min(440px, 82vw);
  }

  .pad-colors {
    grid-template-columns: repeat(9, 1fr);
  }

  .pcolor {
    width: 100%;
    height: 34px;
  }

  .brow {
    grid-template-columns: 26px 28px minmax(60px, auto) 1fr 52px auto;
    gap: 6px;
    padding: 8px 10px;
  }
}
