:root {
  --bg: #080808;
  --surface: #111111;
  --surface-2: #171717;
  --border: #222222;
  --red: #ff2020;
  --gold: #ffd700;
  --gold-dim: #c8a600;
  --white: #f0f0f0;
  --grey: #555555;
  --green: #00ff88;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display: "Bebas Neue", Impact, sans-serif;
  --heavy: "Anton", Impact, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--white);
  background: radial-gradient(ellipse at 50% 35%, #1c1c1c 0%, #080808 65%);
  font-family: var(--mono);
  overflow-x: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 120 120' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
  opacity: 0.035;
  pointer-events: none;
  z-index: 9999;
}

button,
input {
  font: inherit;
}

button {
  min-height: 48px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--white);
  background: var(--surface);
  cursor: pointer;
  letter-spacing: 0;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: var(--gold-dim);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.screen {
  min-height: 100vh;
  width: 100%;
  padding: 32px;
}

.screen[hidden],
[hidden] {
  display: none !important;
}

.screen-center {
  display: grid;
  place-items: center;
  text-align: center;
}

.brand {
  margin: 0 0 28px;
  font-family: var(--display);
  font-size: clamp(72px, 16vw, 180px);
  line-height: 0.85;
  letter-spacing: 0;
  color: var(--gold);
  text-shadow: 0 0 22px rgba(255, 32, 32, 0.22);
}

.display-title {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(48px, 9vw, 112px);
  line-height: 0.95;
  letter-spacing: 0;
}

.mono-kicker,
.mono-note,
.field-label {
  font-family: var(--mono);
  color: #aaa;
  letter-spacing: 0;
}

.mono-kicker {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
}

.mono-note {
  margin: 12px 0 0;
  font-size: 13px;
}

.load-wrap {
  width: min(440px, calc(100vw - 48px));
}

.load-bar {
  width: 100%;
  height: 14px;
  border: 1px solid #333;
  border-radius: 999px;
  overflow: hidden;
  background: #070707;
}

.load-bar span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--gold));
  transition: width 220ms ease;
}

.lobby-shell,
.room-shell {
  width: min(520px, calc(100vw - 40px));
}

.field-label {
  display: block;
  margin: 0 0 8px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
}

.text-input {
  width: 100%;
  height: 54px;
  border: 1px solid #333;
  border-radius: 6px;
  padding: 0 16px;
  color: var(--white);
  background: rgba(8, 8, 8, 0.82);
  outline: none;
  text-transform: none;
}

.text-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.14);
}

.button-stack {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.join-row,
.room-actions {
  display: grid;
  grid-template-columns: 1fr 140px 140px;
  gap: 12px;
}

.join-row {
  grid-template-columns: 1fr 140px;
}

.danger-btn {
  border-color: rgba(255, 32, 32, 0.46);
  color: #ffb7b7;
}

.code-input {
  text-align: center;
  text-transform: uppercase;
  font-family: var(--display);
  font-size: 30px;
}

.primary-btn,
.secondary-btn,
.gold-btn {
  font-family: var(--display);
  font-size: 28px;
  line-height: 1;
}

.primary-btn {
  background: var(--red);
  border-color: #ff5b5b;
  color: #fff;
}

.secondary-btn {
  background: #141414;
  border-color: #333;
}

.gold-btn {
  background: var(--gold);
  border-color: #ffe669;
  color: #101010;
}

.queue-mark {
  width: 96px;
  height: 96px;
  margin-bottom: 28px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.ellipsis::after {
  content: "";
  animation: ellipsis 1.4s steps(4, end) infinite;
}

.room-code {
  margin: 0 0 22px;
  font-family: var(--display);
  font-size: clamp(110px, 24vw, 220px);
  line-height: 0.8;
  color: var(--gold);
  text-shadow: 0 0 34px rgba(255, 215, 0, 0.24);
  animation: pulseText 1.8s ease-in-out infinite;
}

.streak-badge {
  display: inline-block;
  margin: 18px 0 0;
  padding: 8px 12px;
  border: 1px solid rgba(255, 215, 0, 0.45);
  border-radius: 999px;
  color: var(--gold);
  background: rgba(255, 215, 0, 0.09);
  font-family: var(--mono);
  font-size: 13px;
}

.fighter-list {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.fighter-list-row {
  display: grid;
  grid-template-columns: 54px 1fr 86px;
  align-items: center;
  min-height: 44px;
  border: 1px solid #282828;
  border-radius: 6px;
  padding: 0 12px;
  background: rgba(17, 17, 17, 0.76);
  text-align: left;
}

.fighter-list-row strong {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 400;
}

.fighter-card-mini {
  grid-template-columns: 42px minmax(0, 1fr) 74px 86px 108px;
  column-gap: 10px;
  min-height: 58px;
}

.fighter-card-mini strong {
  overflow-wrap: anywhere;
}

.fighter-record,
.fighter-streak,
.fighter-ready,
.fighter-slot {
  color: #bcbcbc;
  font-family: var(--mono);
  font-size: 12px;
  text-transform: uppercase;
}

.fighter-record,
.fighter-streak {
  color: var(--gold);
}

.topic-screen h2 {
  width: min(1100px, calc(100vw - 48px));
  margin: 0;
  color: var(--gold);
  font-family: var(--heavy);
  font-size: clamp(52px, 10vw, 150px);
  line-height: 0.95;
  letter-spacing: 0;
  animation: topicSlam 420ms cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.countdown-screen {
  background: radial-gradient(ellipse at center, #2a0c0c 0%, #080808 68%);
}

#countdown-number {
  font-family: var(--display);
  font-size: clamp(160px, 34vw, 420px);
  line-height: 0.75;
  color: var(--white);
  animation: countdownPop 880ms ease both;
}

.battle-screen {
  position: relative;
  display: grid;
  min-height: 100vh;
  padding: 82px 24px 96px;
}

.topic-strip {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  min-height: 44px;
  padding: 12px 18px;
  border-bottom: 1px solid #282828;
  background: rgba(8, 8, 8, 0.86);
  color: #bbb;
  font-size: 13px;
  text-align: center;
}

.battle-timer {
  position: fixed;
  top: 62px;
  left: 50%;
  z-index: 8;
  width: 110px;
  height: 82px;
  transform: translateX(-50%);
  border: 1px solid #333;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(8, 8, 8, 0.86);
  color: var(--gold);
  font-family: var(--display);
  font-size: 72px;
  line-height: 1;
}

.battle-timer.danger {
  color: var(--red);
}

.battle-timer.flash {
  animation: timerFlash 500ms steps(2, start) infinite;
}

.battle-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  width: min(1500px, 100%);
  margin: auto;
}

.fighter-pane {
  min-height: min(72vh, 720px);
  border: 2px solid #252525;
  border-radius: 8px;
  padding: 18px;
  background: rgba(17, 17, 17, 0.66);
  opacity: 0.62;
  transform: scale(0.985);
  transition: opacity 180ms ease, transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.fighter-pane.active {
  opacity: 1;
  transform: scale(1);
  border-color: var(--red);
  animation: activeGlow 1.5s ease-in-out infinite;
}

.fighter-pane header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.fighter-pane h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: var(--display);
  font-size: clamp(44px, 6vw, 86px);
  font-weight: 400;
  line-height: 0.92;
}

.live-pill {
  display: none;
  padding: 8px 10px;
  border-radius: 999px;
  color: #06190f;
  background: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.fighter-pane.active .live-pill {
  display: inline-block;
}

.fighter-pane video {
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 18px 0 12px;
  border: 1px solid #292929;
  border-radius: 6px;
  object-fit: cover;
  background: #050505;
}

.waveform {
  width: 100%;
  height: 64px;
  border-radius: 6px;
  background: #070707;
}

.fighter-status {
  min-height: 24px;
  margin: 12px 0 0;
  color: #bdbdbd;
}

.battle-overlay {
  position: fixed;
  inset: 0;
  z-index: 15;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.72);
}

.battle-overlay > div,
.battle-overlay > p {
  grid-area: 1 / 1;
}

.battle-overlay p {
  margin-top: 96px;
  font-family: var(--display);
  font-size: clamp(42px, 8vw, 96px);
}

.spinner {
  width: 64px;
  height: 64px;
  border: 4px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.reaction-dock {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 50;
  display: flex;
  gap: 8px;
  transform: translateX(-50%);
  padding: 8px;
  border: 1px solid #2d2d2d;
  border-radius: 999px;
  background: rgba(8, 8, 8, 0.82);
}

.reaction-dock button {
  width: 48px;
  min-height: 48px;
  border-radius: 50%;
  font-size: 22px;
}

.floating-reaction {
  position: fixed;
  bottom: 72px;
  z-index: 60;
  font-size: 42px;
  pointer-events: none;
  animation: floatReaction 2.5s ease-out forwards;
}

.verdict-screen {
  position: relative;
  padding: 88px 24px 120px;
}

.verdict-screen.dimmed {
  background: rgba(0, 0, 0, 0.28);
}

.winner-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 12;
  transform: translateY(-105%);
  padding: 12px 24px;
  color: #090909;
  background: var(--gold);
  text-align: center;
  font-family: var(--display);
  font-size: clamp(42px, 7vw, 92px);
  line-height: 0.9;
  transition: transform 520ms cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.winner-banner.visible {
  transform: translateY(0);
}

.verdict-grid {
  display: grid;
  grid-template-columns: minmax(220px, 360px) minmax(280px, 1fr) minmax(220px, 360px);
  gap: 18px;
  min-height: calc(100vh - 160px);
  align-items: stretch;
}

.verdict-fighter {
  border: 2px solid #282828;
  border-radius: 8px;
  padding: 22px;
  background: rgba(17, 17, 17, 0.76);
  transition: transform 260ms ease, border-color 260ms ease, box-shadow 260ms ease, opacity 260ms ease;
}

.verdict-fighter.winner {
  border-color: var(--gold);
  box-shadow: 0 0 40px rgba(255, 215, 0, 0.24);
}

.verdict-fighter.loser {
  border-color: rgba(255, 32, 32, 0.46);
  opacity: 0.74;
  transform: scale(0.965);
}

.verdict-fighter h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-family: var(--display);
  font-size: clamp(44px, 6vw, 90px);
  line-height: 0.9;
  font-weight: 400;
}

.fighter-record-line {
  margin: 10px 0 0;
  color: var(--gold);
  font-family: var(--mono);
  font-size: 13px;
  text-transform: uppercase;
}

.score {
  margin: 28px 0 18px;
  color: var(--gold);
  font-family: var(--display);
  font-size: clamp(90px, 14vw, 180px);
  line-height: 0.75;
}

.breakdown {
  min-height: 110px;
  margin: 0;
  color: #d0d0d0;
  font-size: 15px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.roast-stage {
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
  border-top: 1px solid #272727;
  border-bottom: 1px solid #272727;
  padding: 24px;
}

.but-first {
  margin: 0 0 18px;
  color: var(--red);
  font-family: var(--display);
  font-size: clamp(48px, 8vw, 112px);
  line-height: 0.9;
}

.finishing-roast {
  max-width: 920px;
  margin: 0;
  color: var(--white);
  font-family: var(--heavy);
  font-size: clamp(36px, 6vw, 94px);
  line-height: 1.02;
  letter-spacing: 0;
  opacity: 0;
  transform: translateY(20px) scale(0.95);
}

.finishing-roast.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 300ms ease, transform 300ms ease;
}

.share-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 28px;
}

.share-actions button {
  min-width: 150px;
  padding: 0 20px;
}

.card-preview {
  width: min(420px, 100%);
  margin-top: 18px;
  border: 1px solid #333;
  border-radius: 6px;
}

.hype-cams {
  position: fixed;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 18;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  pointer-events: none;
}

.hype-cam {
  width: min(240px, 36vw);
  margin: 0;
  border: 1px solid rgba(255, 215, 0, 0.52);
  border-radius: 8px;
  overflow: hidden;
  background: #050505;
  box-shadow: 0 0 28px rgba(255, 32, 32, 0.18);
  opacity: 0.45;
}

.hype-cam.has-stream {
  opacity: 1;
}

.hype-cam video {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: #030303;
}

.hype-cam figcaption {
  padding: 7px 10px;
  color: #090909;
  background: var(--gold);
  font-family: var(--display);
  font-size: 22px;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.confetti {
  position: fixed;
  top: -16px;
  z-index: 20;
  width: 10px;
  height: 16px;
  pointer-events: none;
  animation: confettiFall 1.8s ease-in forwards;
}

.shake {
  animation: shake 400ms linear;
}

#verdict-card-hidden {
  position: fixed;
  left: -9999px;
  top: 0;
  display: none;
  width: 1200px;
  height: 630px;
  padding: 48px 64px;
  color: var(--white);
  background: #080808;
  border: 10px solid #ffd700;
  font-family: var(--display);
  overflow: hidden;
}

.card-header {
  color: #ffd700;
  font-family: var(--display);
  font-size: 88px;
  line-height: 0.85;
  text-align: center;
}

.card-vs {
  display: grid;
  grid-template-columns: 1fr 100px 120px 100px 1fr;
  align-items: center;
  gap: 18px;
  margin: 36px 0 24px;
  text-align: center;
}

.card-player {
  overflow-wrap: anywhere;
  font-size: 58px;
}

.card-score {
  color: #ffd700;
  font-size: 92px;
}

.card-divider {
  color: #ff2020;
  font-size: 60px;
}

.card-roast {
  display: grid;
  place-items: center;
  min-height: 190px;
  color: #f0f0f0;
  font-family: var(--heavy);
  font-size: 46px;
  line-height: 1.02;
  text-align: center;
}

.card-winner,
.card-url {
  text-align: center;
}

.card-winner {
  color: #ffd700;
  font-size: 36px;
  line-height: 1.08;
  max-width: 960px;
  margin: 0 auto;
}

.card-url {
  margin-top: 12px;
  color: #777;
  font-family: var(--mono);
  font-size: 18px;
}

.card-built {
  position: absolute;
  right: 34px;
  top: 28px;
  color: #ffd700;
  font-family: var(--mono);
  font-size: 18px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes ellipsis {
  0% {
    content: "";
  }
  25% {
    content: ".";
  }
  50% {
    content: "..";
  }
  75%,
  100% {
    content: "...";
  }
}

@keyframes pulseText {
  0%,
  100% {
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.16);
  }
  50% {
    text-shadow: 0 0 42px rgba(255, 215, 0, 0.42);
  }
}

@keyframes topicSlam {
  from {
    opacity: 0;
    transform: translateY(-80px) scale(1.08);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes countdownPop {
  0% {
    opacity: 0;
    transform: scale(0.6);
  }
  35% {
    opacity: 1;
    transform: scale(1.08);
  }
  100% {
    opacity: 0;
    transform: scale(0.88);
  }
}

@keyframes activeGlow {
  0%,
  100% {
    box-shadow: 0 0 20px rgba(255, 32, 32, 0.18);
  }
  50% {
    box-shadow: 0 0 46px rgba(255, 32, 32, 0.42);
  }
}

@keyframes timerFlash {
  50% {
    background: rgba(255, 32, 32, 0.22);
  }
}

@keyframes floatReaction {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-120px) scale(1.3);
  }
}

@keyframes confettiFall {
  to {
    transform: translateY(115vh) rotate(520deg);
    opacity: 0;
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-10px);
  }
  40% {
    transform: translateX(8px);
  }
  60% {
    transform: translateX(-6px);
  }
  80% {
    transform: translateX(4px);
  }
}

@media (max-width: 860px) {
  .screen {
    padding: 24px 16px;
  }

  .join-row,
  .room-actions,
  .battle-grid,
  .verdict-grid {
    grid-template-columns: 1fr;
  }

  .battle-screen {
    padding: 74px 12px 96px;
  }

  .battle-timer {
    position: sticky;
    top: 52px;
    margin: 0 auto 12px;
    transform: none;
  }

  .fighter-pane {
    min-height: auto;
  }

  .verdict-screen {
    padding: 86px 14px 120px;
  }

  .roast-stage {
    order: -1;
    min-height: 360px;
  }

  .reaction-dock {
    max-width: calc(100vw - 18px);
  }

  .hype-cams {
    left: 10px;
    right: 10px;
    bottom: 92px;
  }

  .hype-cam {
    width: min(156px, 43vw);
  }

  .hype-cam figcaption {
    font-size: 18px;
  }
}
