:root {
  color-scheme: dark;
  --bg: #090a0e;
  --ink: #fff6d8;
  --muted: #b7b1a1;
  --panel: rgba(16, 18, 24, 0.88);
  --panel-strong: rgba(28, 27, 34, 0.94);
  --line: rgba(255, 246, 216, 0.18);
  --hot: #ff4d32;
  --gold: #ffd15b;
  --cyan: #44f2df;
  --green: #77df59;
  --pink: #ff4fa3;
  --floor: #27212a;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.52);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    radial-gradient(circle at 18% 12%, rgba(255, 79, 163, 0.22), transparent 25rem),
    radial-gradient(circle at 82% 10%, rgba(68, 242, 223, 0.18), transparent 28rem),
    linear-gradient(135deg, #08090d 0%, #19121f 48%, #071519 100%);
  background-size: 34px 34px, 34px 34px, auto, auto, auto;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(1500px, 100%);
  margin: 0 auto;
  padding: 22px;
}

.stage {
  min-height: calc(100vh - 44px);
  border: 2px solid rgba(255, 209, 91, 0.26);
  background:
    linear-gradient(120deg, rgba(255, 77, 50, 0.08), transparent 36%, rgba(68, 242, 223, 0.08)),
    rgba(9, 10, 14, 0.82);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0.035) 1px, transparent 1px, transparent 4px);
  mix-blend-mode: screen;
  opacity: 0.26;
}

.topbar,
.panel-heading,
.prompt-row,
.controls,
.battle-banner,
.match-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.topbar {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr auto auto;
  margin-bottom: 18px;
}

.eyebrow,
.label {
  margin: 0 0 7px;
  color: var(--gold);
  font-size: 12px;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: var(--ink);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(48px, 8vw, 132px);
  font-weight: 900;
  line-height: 0.82;
  letter-spacing: 0;
  text-transform: uppercase;
  text-shadow: 5px 5px 0 #19121f, 9px 9px 0 rgba(255, 77, 50, 0.52);
}

.battle-banner,
.status-pill {
  align-self: center;
  border: 2px solid var(--line);
  background: rgba(7, 10, 13, 0.8);
  box-shadow: inset 0 0 28px rgba(68, 242, 223, 0.08);
  min-height: 56px;
}

.battle-banner {
  padding: 0 18px;
  color: var(--muted);
  text-transform: uppercase;
}

.battle-banner strong {
  color: var(--hot);
  font-size: 28px;
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
}

.status-pill {
  min-width: 132px;
  padding: 15px 16px;
  color: var(--cyan);
  text-align: center;
}

.performance-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(220px, 0.75fr) minmax(500px, 2.05fr) minmax(250px, 0.78fr);
  gap: 16px;
}

.lower-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1.25fr 0.95fr 1fr;
  gap: 16px;
  margin-top: 16px;
}

.panel,
.deck {
  border: 2px solid var(--line);
  background: var(--panel);
  box-shadow: inset 0 0 36px rgba(255, 209, 91, 0.04);
}

.panel {
  padding: 16px;
}

.panel-heading {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.panel-heading strong {
  color: var(--ink);
  font-size: 14px;
}

.beat-list {
  display: grid;
  gap: 10px;
}

.beat-card {
  width: 100%;
  border: 2px solid rgba(255, 246, 216, 0.14);
  background: rgba(7, 8, 10, 0.66);
  color: var(--ink);
  padding: 14px;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.beat-card:hover,
.beat-card.active {
  transform: translateX(5px);
  border-color: var(--gold);
  background: rgba(255, 209, 91, 0.13);
  box-shadow: 0 0 22px rgba(255, 209, 91, 0.14);
}

.beat-card {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 23px;
  letter-spacing: 0;
  text-transform: uppercase;
}

.beat-card span {
  display: block;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  margin-top: 8px;
}

.battle-queue {
  margin-top: 16px;
  border: 2px dashed rgba(68, 242, 223, 0.34);
  padding: 13px;
  background: rgba(68, 242, 223, 0.08);
}

.battle-queue span,
.battle-queue small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.battle-queue strong {
  display: block;
  margin: 7px 0;
  color: var(--cyan);
  text-transform: uppercase;
}

.deck {
  min-height: 500px;
  display: grid;
  grid-template-rows: minmax(320px, 1fr) auto auto;
  background: var(--panel-strong);
}

.meter-wrap {
  position: relative;
  min-height: 320px;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 209, 91, 0.16), transparent 22rem),
    linear-gradient(#08090d 0%, #10131b 58%, #171017 100%);
}

#meter {
  position: absolute;
  inset: auto 0 0;
  display: block;
  width: 100%;
  height: 48%;
  opacity: 0.44;
  mix-blend-mode: screen;
}

.arena {
  position: absolute;
  inset: 0;
}

.spotlight {
  position: absolute;
  top: -12%;
  width: 33%;
  height: 120%;
  background: linear-gradient(rgba(255, 209, 91, 0.22), transparent 68%);
  filter: blur(4px);
  opacity: 0.72;
  transform-origin: top center;
}

.spotlight.left {
  left: 17%;
  transform: rotate(18deg);
}

.spotlight.right {
  right: 17%;
  background: linear-gradient(rgba(68, 242, 223, 0.2), transparent 70%);
  transform: rotate(-18deg);
}

.crowd {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 28%;
  display: grid;
  grid-template-columns: repeat(18, 1fr);
  gap: 8px;
  align-items: end;
}

.crowd span {
  height: 42px;
  border-radius: 999px 999px 6px 6px;
  background: linear-gradient(var(--cyan), #1d4f58);
  opacity: 0.5;
  animation: crowdBounce 780ms ease-in-out infinite alternate;
}

.crowd span:nth-child(3n) {
  height: 58px;
  background: linear-gradient(var(--gold), #705524);
  animation-delay: 130ms;
}

.crowd span:nth-child(4n) {
  height: 50px;
  background: linear-gradient(var(--pink), #682346);
  animation-delay: 260ms;
}

.stage-lights {
  position: absolute;
  left: 14%;
  right: 14%;
  top: 9%;
  display: flex;
  justify-content: space-between;
}

.stage-lights i {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 30px var(--gold);
  animation: lightPulse 900ms ease-in-out infinite alternate;
}

.stage-lights i:nth-child(even) {
  background: var(--cyan);
  box-shadow: 0 0 30px var(--cyan);
  animation-delay: 220ms;
}

.stage-floor {
  position: absolute;
  left: -6%;
  right: -6%;
  bottom: -8%;
  height: 36%;
  background:
    linear-gradient(90deg, rgba(255, 209, 91, 0.18), transparent 22%, rgba(68, 242, 223, 0.2), transparent 76%, rgba(255, 79, 163, 0.18)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.08) 2px, transparent 2px, transparent 44px),
    var(--floor);
  transform: perspective(240px) rotateX(58deg);
  transform-origin: bottom center;
}

.rapper {
  position: absolute;
  left: 49%;
  bottom: 18%;
  width: 130px;
  height: 215px;
  transform: translateX(-50%);
  animation: rapperIdle 520ms ease-in-out infinite alternate;
  z-index: 3;
}

.head,
.cap,
.body,
.arm,
.leg,
.mic,
.op-head,
.op-body {
  position: absolute;
}

.head {
  left: 48px;
  top: 36px;
  width: 42px;
  height: 46px;
  border-radius: 50%;
  background: #d98b55;
  box-shadow: inset -8px -5px 0 rgba(0, 0, 0, 0.18);
}

.cap {
  left: 38px;
  top: 24px;
  width: 58px;
  height: 24px;
  border-radius: 16px 16px 4px 4px;
  background: var(--hot);
  z-index: 2;
}

.cap::after {
  content: "";
  position: absolute;
  right: -18px;
  top: 8px;
  width: 28px;
  height: 8px;
  background: var(--hot);
}

.body {
  left: 36px;
  top: 84px;
  width: 62px;
  height: 78px;
  border-radius: 14px 14px 8px 8px;
  background: linear-gradient(135deg, var(--cyan), #1d5961);
  border: 3px solid rgba(255, 246, 216, 0.85);
}

.arm {
  top: 94px;
  width: 21px;
  height: 70px;
  border-radius: 14px;
  background: #d98b55;
  transform-origin: top center;
}

.mic-arm {
  left: 88px;
  transform: rotate(-58deg);
}

.free-arm {
  left: 26px;
  animation: armWave 620ms ease-in-out infinite alternate;
}

.mic {
  left: 112px;
  top: 82px;
  width: 34px;
  height: 12px;
  border-radius: 8px;
  background: #111;
  border: 2px solid var(--ink);
  transform: rotate(-16deg);
}

.leg {
  top: 154px;
  width: 24px;
  height: 58px;
  border-radius: 12px;
  background: #181820;
}

.left-leg {
  left: 43px;
  transform: rotate(10deg);
}

.right-leg {
  left: 73px;
  transform: rotate(-8deg);
}

.word-burst {
  position: absolute;
  left: 118px;
  top: 42px;
  color: var(--gold);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 32px;
  opacity: 0;
  text-shadow: 3px 3px 0 #000;
  transform: rotate(-10deg);
}

.is-performing .word-burst {
  animation: wordPop 900ms steps(2, end) infinite;
}

.opponent {
  position: absolute;
  right: 14%;
  bottom: 23%;
  width: 70px;
  height: 130px;
  opacity: 0.8;
  transform: skewY(-4deg);
}

.op-head {
  left: 20px;
  top: 10px;
  width: 34px;
  height: 38px;
  border-radius: 50%;
  background: #8b5e42;
}

.op-body {
  left: 12px;
  top: 50px;
  width: 50px;
  height: 72px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--pink), #54203c);
}

.is-performing .rapper {
  animation-duration: 260ms;
}

.is-performing .crowd span {
  animation-duration: 380ms;
  opacity: 0.82;
}

.is-performing .stage-lights i {
  animation-duration: 340ms;
}

.countdown {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  color: var(--gold);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(82px, 17vw, 200px);
  line-height: 1;
  text-shadow: 6px 6px 0 #000, 0 0 34px rgba(255, 209, 91, 0.58);
  z-index: 5;
}

.prompt-row,
.controls {
  padding: 16px 20px;
  border-top: 2px solid var(--line);
  background: rgba(8, 9, 13, 0.75);
}

.prompt-row p {
  margin: 0;
  color: var(--ink);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(24px, 3.4vw, 42px);
  line-height: 1;
  letter-spacing: 0;
  text-transform: uppercase;
}

.icon-btn,
.primary,
.ghost {
  border: 2px solid var(--line);
  background: rgba(8, 10, 14, 0.82);
  color: var(--ink);
  min-height: 48px;
  text-transform: uppercase;
}

.icon-btn {
  width: 56px;
  color: var(--gold);
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: 30px;
}

.primary,
.ghost {
  padding: 0 18px;
  font-weight: 800;
}

.primary {
  background: var(--hot);
  border-color: var(--hot);
  color: #120707;
  box-shadow: 6px 6px 0 #000;
}

.primary.recording {
  background: var(--gold);
  border-color: var(--gold);
}

.ghost:hover,
.icon-btn:hover {
  border-color: var(--cyan);
  box-shadow: 0 0 22px rgba(68, 242, 223, 0.18);
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.score-ring {
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 4px solid var(--gold);
  background:
    radial-gradient(circle, rgba(255, 209, 91, 0.2), transparent 62%),
    rgba(0, 0, 0, 0.2);
  margin-bottom: 14px;
  position: relative;
  overflow: hidden;
}

.score-ring::before {
  content: "Crowd";
  position: absolute;
  top: 16px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.score-ring span {
  font-family: Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(76px, 8vw, 112px);
  line-height: 0.9;
  text-shadow: 5px 5px 0 #000;
}

.score-ring small {
  color: var(--muted);
  margin-top: -78px;
}

.match-readout {
  margin-bottom: 14px;
}

.match-readout div {
  flex: 1;
  border: 2px solid rgba(255, 246, 216, 0.14);
  padding: 10px;
  background: rgba(0, 0, 0, 0.18);
}

.match-readout span,
.match-readout strong {
  display: block;
  text-transform: uppercase;
}

.match-readout span {
  color: var(--muted);
  font-size: 11px;
}

.match-readout strong {
  margin-top: 4px;
  color: var(--cyan);
}

.score-bars {
  display: grid;
  gap: 12px;
}

.score-bars div {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

meter {
  width: 100%;
  height: 14px;
}

meter::-webkit-meter-bar {
  background: rgba(255, 255, 255, 0.12);
  border: 0;
}

meter::-webkit-meter-optimum-value {
  background: linear-gradient(90deg, var(--hot), var(--gold), var(--green));
}

.transcript {
  min-height: 170px;
  max-height: 220px;
  overflow: auto;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 19px;
  line-height: 1.42;
}

.empty {
  color: var(--muted);
  margin: 0;
}

.rhyme-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 170px;
  align-content: flex-start;
}

.rhyme-chip {
  border: 2px solid rgba(68, 242, 223, 0.36);
  background: rgba(68, 242, 223, 0.1);
  color: var(--ink);
  padding: 9px 11px;
  font-size: 13px;
  text-transform: uppercase;
}

.rhyme-chip.slant {
  border-color: rgba(255, 209, 91, 0.42);
  background: rgba(255, 209, 91, 0.1);
}

.coach-panel p {
  min-height: 112px;
  margin: 0 0 16px;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 18px;
  line-height: 1.45;
}

.full {
  width: 100%;
  margin-top: 10px;
}

@keyframes crowdBounce {
  from {
    transform: translateY(0) scaleY(0.92);
  }
  to {
    transform: translateY(-15px) scaleY(1.06);
  }
}

@keyframes lightPulse {
  from {
    opacity: 0.42;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1.16);
  }
}

@keyframes rapperIdle {
  from {
    transform: translateX(-50%) translateY(0) rotate(-1deg);
  }
  to {
    transform: translateX(-50%) translateY(-9px) rotate(1deg);
  }
}

@keyframes armWave {
  from {
    transform: rotate(32deg);
  }
  to {
    transform: rotate(-18deg);
  }
}

@keyframes wordPop {
  0% {
    opacity: 0;
    transform: translate(0, 0) rotate(-10deg) scale(0.7);
  }
  32% {
    opacity: 1;
    transform: translate(18px, -20px) rotate(-10deg) scale(1);
  }
  70% {
    opacity: 0;
    transform: translate(48px, -38px) rotate(-10deg) scale(1.2);
  }
}

@media (max-width: 1120px) {
  .topbar,
  .performance-grid,
  .lower-grid {
    grid-template-columns: 1fr;
  }

  .battle-banner,
  .status-pill {
    width: 100%;
    justify-content: center;
  }

  .beat-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 680px) {
  .shell {
    padding: 10px;
  }

  .stage {
    min-height: calc(100vh - 20px);
    padding: 12px;
  }

  .topbar,
  .controls,
  .prompt-row,
  .match-readout {
    align-items: stretch;
    flex-direction: column;
  }

  .primary,
  .ghost,
  .toggle {
    width: 100%;
    justify-content: center;
  }

  .beat-list {
    grid-template-columns: 1fr;
  }

  .deck {
    min-height: 520px;
  }

  .meter-wrap {
    min-height: 320px;
  }

  .rapper {
    left: 45%;
    transform: translateX(-50%) scale(0.86);
  }

  .opponent {
    right: 8%;
    transform: scale(0.82);
  }

  .crowd {
    gap: 4px;
  }
}
