:root {
  --ink: #f4efe6;
  --muted: #c4b8a4;
  --soap: #f3a7be;
  --soap-hot: #ff7aa0;
  --blood: #d61f32;
  --gold: #f0c14b;
  --void: #070605;
  --hud: rgba(8, 6, 5, 0.55);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--void);
  color: var(--ink);
  font-family: Oswald, Impact, "Arial Narrow", sans-serif;
  overflow: hidden;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

img {
  -webkit-user-drag: none;
  user-select: none;
}

button,
input {
  font: inherit;
}

#app {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  overflow: hidden;
}

.scene {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  cursor: crosshair;
}

.scene.is-player {
  cursor: pointer;
}

.bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 40%;
  transform: scale(1.04);
  pointer-events: none;
  transition: filter 0.8s ease;
}

.vignette {
  position: absolute;
  inset: 0;
  pointer-events: none;
  transition: opacity 0.8s ease;
  background:
    radial-gradient(ellipse at 50% 42%, transparent 18%, rgba(0, 0, 0, 0.42) 70%, rgba(0, 0, 0, 0.78) 100%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.38) 0%, transparent 18%, transparent 72%, rgba(0, 0, 0, 0.7) 100%);
}

.light-wash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 244, 210, 0.22), transparent 42%);
  animation: wash-flicker 4.8s steps(2, end) infinite;
  mix-blend-mode: screen;
  transition: opacity 0.8s ease;
}

.light-rig {
  position: absolute;
  top: calc(6px + var(--safe-top));
  left: 50%;
  width: min(92vw, 560px);
  transform: translateX(-50%);
  z-index: 4;
  pointer-events: none;
  transition: opacity 0.8s ease;
}

.light {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 10px rgba(255, 244, 200, 0.85)) drop-shadow(0 0 28px rgba(255, 220, 140, 0.45));
  animation: tube-flicker 3.6s infinite;
}

.light-glow {
  position: absolute;
  left: 6%;
  right: 6%;
  top: 70%;
  height: 90px;
  background: radial-gradient(ellipse at 50% 0%, rgba(255, 236, 180, 0.55), transparent 70%);
  filter: blur(8px);
  animation: glow-flicker 3.6s infinite;
}

.hud {
  position: absolute;
  top: calc(42px + var(--safe-top));
  left: 0;
  right: 0;
  z-index: 6;
  padding: 0 16px;
  text-align: center;
}

.brand-kicker {
  margin: 0;
  letter-spacing: 0.38em;
  text-transform: uppercase;
  font-size: 0.68rem;
  color: var(--soap);
  text-shadow: 0 0 12px rgba(243, 167, 190, 0.45);
}

.brand {
  margin: 2px 0 10px;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  letter-spacing: 0.08em;
  line-height: 0.9;
  text-transform: uppercase;
  text-shadow: 0 2px 0 #000, 0 0 18px rgba(0, 0, 0, 0.7);
}

.meter-wrap {
  max-width: 420px;
  margin: 0 auto;
  padding: 8px 10px 10px;
  background: var(--hud);
  border: 1px solid rgba(243, 167, 190, 0.28);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45), inset 0 0 0 1px rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(6px);
}

.meter-label {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: baseline;
  margin-bottom: 6px;
  font-size: 0.78rem;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.meter-label span:first-child {
  justify-self: start;
}

.meter-label span:last-child {
  justify-self: end;
  color: var(--gold);
  letter-spacing: 0.08em;
  font-weight: 700;
}

.fight-timer {
  justify-self: center;
  color: #ff2a2a;
  letter-spacing: 0.1em;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-shadow: 0 0 10px rgba(255, 42, 42, 0.45);
}

.fight-timer.is-done {
  animation: timer-blink 0.7s steps(2, end) infinite;
}

.meter {
  position: relative;
  height: 16px;
  overflow: hidden;
  background: #1a120f;
  border: 1px solid rgba(240, 193, 75, 0.25);
}

.meter-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #7a1020 0%, var(--blood) 48%, var(--soap-hot) 100%);
  box-shadow: 0 0 16px rgba(214, 31, 50, 0.65);
  transition: width 0.12s linear;
}

.meter-segments {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  pointer-events: none;
}

.meter-segments i {
  border-right: 1px solid rgba(0, 0, 0, 0.55);
}

.meter-segments i:last-child {
  border-right: 0;
}

.status-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.5);
  font-size: 0.68rem;
  letter-spacing: 0.18em;
}

.badge.live::before,
.badge.fight::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #ff3b3b;
  box-shadow: 0 0 8px #ff3b3b;
  animation: pulse 1.1s infinite;
}

.badge.fight {
  color: var(--soap);
  border-color: rgba(243, 167, 190, 0.5);
}

.badge.fight::before {
  background: var(--soap-hot);
  box-shadow: 0 0 8px var(--soap-hot);
}

.viewers {
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
}

.live-board {
  position: absolute;
  top: 26%;
  bottom: 18%;
  left: 0;
  right: 0;
  z-index: 7;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
  padding: 0 6px;
}

.live-col {
  list-style: none;
  margin: 0;
  padding: 4px 6px;
  width: min(31vw, 132px);
  max-height: 100%;
  overflow: hidden;
  background: transparent;
  border: 0;
}

.live-left {
  text-align: left;
}

.live-right {
  text-align: right;
}

.live-row {
  display: block;
  padding: 5px 0;
  border-bottom: 0;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(0.78rem, 3.4vw, 1.05rem);
  letter-spacing: 0.04em;
  line-height: 1.05;
  text-transform: uppercase;
  animation: prize-slam 0.45s cubic-bezier(0.12, 0.8, 0.24, 1.15);
}

.live-row:last-child {
  border-bottom: 0;
}

.live-left .live-row {
  color: #fff;
  text-shadow: 0 2px 0 #000;
}

.live-num {
  color: var(--gold);
  margin-right: 0.2em;
}

.live-right .live-row {
  color: var(--gold);
  text-shadow: 0 2px 0 #000;
}

.live-right .live-row.is-special {
  color: var(--soap);
}

.live-total.is-empty {
  visibility: hidden;
}

.live-total {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(54px + var(--safe-bottom));
  z-index: 8;
  margin: 0;
  text-align: center;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(1.7rem, 8vw, 2.5rem);
  letter-spacing: 0.08em;
  color: var(--gold);
  text-shadow: 0 3px 0 #000, 0 0 18px rgba(240, 193, 75, 0.4);
  pointer-events: none;
  animation: sol-glow 1.7s ease-in-out infinite;
}

.live-total.is-empty {
  animation: none;
}

.live-total.is-slam {
  animation:
    total-slam 0.58s cubic-bezier(0.12, 0.8, 0.24, 1.18),
    sol-glow 1.7s ease-in-out infinite;
}

.total-burst {
  position: absolute;
  inset: 0;
  z-index: 7;
  pointer-events: none;
  background: radial-gradient(circle at 50% 82%, rgba(255, 220, 120, 0.55), rgba(255, 80, 80, 0.12) 42%, transparent 70%);
  opacity: 0;
}

.total-burst.is-on {
  animation: total-burst 0.55s ease-out;
}

.scene.round-over .bg {
  filter: brightness(0.7);
}

.scene.round-over .light-rig,
.scene.round-over .light-wash {
  opacity: 0;
}

.scene.round-over .light,
.scene.round-over .light-glow {
  animation: none;
}

.scene.round-over .live-board,
.scene.round-over .live-total {
  filter: none;
}

body[data-role="spectator"] .bag-pivot {
  width: min(44vw, 230px);
}

.bag-stage {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.bag-pivot {
  position: absolute;
  left: 50%;
  top: 27%;
  width: min(50vw, 250px);
  transform: translateX(-50%);
  transform-origin: 50% 2%;
  pointer-events: none;
  will-change: transform;
}

.bag {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(10px 18px 16px rgba(0, 0, 0, 0.55));
  pointer-events: none;
}

.hit-zone {
  position: absolute;
  left: 50%;
  top: 66.7%;
  width: 40%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  pointer-events: auto;
  cursor: pointer;
}

.is-player .hit-zone {
  box-shadow: 0 0 0 2px rgba(243, 167, 190, 0.16);
}

.bag-shadow {
  position: absolute;
  left: 50%;
  bottom: 11%;
  width: min(46vw, 220px);
  height: 22px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.55), transparent 70%);
  filter: blur(2px);
}

.float-layer {
  position: absolute;
  inset: 0;
  z-index: 8;
  pointer-events: none;
}

.floater {
  position: absolute;
  left: 50%;
  top: 48%;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(2.2rem, 12vw, 3.6rem);
  letter-spacing: 0.08em;
  color: #fff;
  text-shadow: 0 3px 0 #000, 0 0 18px rgba(255, 80, 80, 0.6);
  animation: float-away 0.55s ease-out forwards;
  white-space: nowrap;
}

.floater.miss {
  color: #c9c9c9;
  font-size: clamp(1.4rem, 8vw, 2.1rem);
  text-shadow: 0 2px 0 #000;
}

.prize-overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  background: rgba(0, 0, 0, 0.42);
}

.prize-overlay[hidden] {
  display: none;
}

.prize-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55), rgba(214, 31, 50, 0.2) 40%, transparent 70%);
  animation: prize-flash 0.7s ease-out;
}

.prize-content {
  position: relative;
  text-align: center;
  padding: 0 18px;
  animation: prize-slam 0.55s cubic-bezier(0.12, 0.8, 0.24, 1.15);
}

.prize-kicker {
  margin: 0;
  letter-spacing: 0.45em;
  color: var(--soap);
  font-size: 0.85rem;
}

.prize-name {
  margin: 6px 0 4px;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(3.2rem, 16vw, 5.4rem);
  line-height: 0.85;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  text-shadow:
    0 4px 0 #7a1020,
    0 8px 0 #000,
    0 0 28px rgba(255, 80, 110, 0.55);
}

.prize-detail {
  margin: 0 0 8px;
  color: var(--soap);
  letter-spacing: 0.16em;
  font-size: 0.95rem;
}

.prize-pct {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.28em;
  font-size: 0.9rem;
}

.summary-overlay {
  position: absolute;
  inset: 0;
  z-index: 14;
  display: grid;
  place-items: center;
  padding: 18px 14px 88px;
  background: rgba(0, 0, 0, 0.72);
}

.summary-overlay[hidden] {
  display: none;
}

.summary-content {
  width: min(100%, 420px);
  text-align: center;
  animation: prize-slam 0.6s cubic-bezier(0.12, 0.8, 0.24, 1.15);
}

.summary-title {
  margin: 6px 0 14px;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(2.4rem, 12vw, 3.8rem);
  line-height: 0.85;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-shadow:
    0 4px 0 #7a1020,
    0 8px 0 #000,
    0 0 24px rgba(255, 80, 110, 0.5);
}

.summary-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 10px 10px 4px;
  background: rgba(8, 6, 5, 0.72);
  border: 1px solid rgba(243, 167, 190, 0.28);
}

.summary-item {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 8px;
  align-items: baseline;
  padding: 6px 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-align: left;
}

.summary-item:last-child {
  border-bottom: 0;
}

.summary-index {
  color: var(--muted);
}

.summary-name {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: 1.15rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.summary-value {
  color: var(--gold);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
}

.summary-item.is-special .summary-value {
  color: var(--soap);
}

.summary-total {
  margin: 0;
  font-family: "Bebas Neue", Impact, sans-serif;
  font-size: clamp(2rem, 10vw, 2.8rem);
  letter-spacing: 0.08em;
  color: var(--gold);
  text-shadow: 0 3px 0 #000, 0 0 20px rgba(240, 193, 75, 0.4);
}

.gate,
.gate input,
.gate button {
  touch-action: manipulation;
}

.gate {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  padding: 10px 14px calc(10px + var(--safe-bottom));
  background: linear-gradient(180deg, transparent, rgba(0, 0, 0, 0.88) 38%);
}

.fighter-status {
  text-align: center;
  margin-bottom: 6px;
  color: var(--soap);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.reset-btn {
  display: block;
  margin: 0 auto 8px;
  height: 34px;
  padding: 0 14px;
  border: 1px solid rgba(243, 167, 190, 0.45);
  background: #1b0d12;
  color: var(--soap);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
}

.reset-btn:active {
  transform: translateY(1px);
}

.auth-form {
  display: flex;
  gap: 8px;
  max-width: 420px;
  margin: 0 auto;
}

.auth-form input {
  flex: 1;
  min-width: 0;
  height: 38px;
  padding: 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(10, 8, 7, 0.72);
  color: var(--ink);
  letter-spacing: 0.08em;
  outline: none;
}

.auth-form input:focus {
  border-color: rgba(243, 167, 190, 0.7);
}

.auth-form button {
  height: 38px;
  padding: 0 14px;
  border: 1px solid rgba(243, 167, 190, 0.45);
  background: #1b0d12;
  color: var(--soap);
  letter-spacing: 0.16em;
  cursor: pointer;
}

.auth-form button:active {
  transform: translateY(1px);
}

.gate-msg {
  min-height: 1.1em;
  margin: 6px 0 0;
  text-align: center;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.shake {
  animation: shake 0.28s linear;
}

@keyframes tube-flicker {
  0%,
  8%,
  12%,
  100% {
    opacity: 1;
    filter: drop-shadow(0 0 10px rgba(255, 244, 200, 0.85)) drop-shadow(0 0 28px rgba(255, 220, 140, 0.45));
  }
  9% {
    opacity: 0.35;
    filter: none;
  }
  86% {
    opacity: 1;
  }
  87% {
    opacity: 0.2;
  }
  89% {
    opacity: 1;
  }
}

@keyframes glow-flicker {
  0%,
  8%,
  12%,
  100% {
    opacity: 0.9;
  }
  9%,
  87% {
    opacity: 0.15;
  }
  89% {
    opacity: 0.85;
  }
}

@keyframes wash-flicker {
  0%,
  86%,
  100% {
    opacity: 1;
  }
  87% {
    opacity: 0.35;
  }
  89% {
    opacity: 1;
  }
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

@keyframes float-away {
  0% {
    transform: translate(-50%, 0) scale(0.7);
    opacity: 0;
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -8px) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -70px) scale(1.08);
  }
}

@keyframes sol-glow {
  0%,
  100% {
    text-shadow: 0 3px 0 #000, 0 0 12px rgba(240, 193, 75, 0.35);
    filter: brightness(0.95);
  }
  50% {
    text-shadow:
      0 3px 0 #000,
      0 0 22px rgba(255, 230, 120, 0.95),
      0 0 48px rgba(240, 193, 75, 0.75),
      0 0 72px rgba(255, 160, 40, 0.4);
    filter: brightness(1.2);
  }
}

@keyframes timer-blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.15;
  }
}

@keyframes total-slam {
  0% {
    transform: scale(3.4);
    opacity: 0;
    text-shadow: 0 0 40px rgba(255, 230, 140, 1), 0 0 80px rgba(255, 180, 40, 0.9);
  }
  55% {
    transform: scale(0.9);
    opacity: 1;
    text-shadow:
      0 3px 0 #000,
      0 0 28px rgba(255, 220, 90, 1),
      0 0 64px rgba(240, 193, 75, 0.85);
  }
  100% {
    transform: scale(1);
    text-shadow: 0 3px 0 #000, 0 0 18px rgba(240, 193, 75, 0.4);
  }
}

@keyframes total-burst {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes prize-slam {
  0% {
    transform: scale(3.2) rotate(-8deg);
    opacity: 0;
  }
  60% {
    transform: scale(0.92) rotate(1deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

@keyframes prize-flash {
  0% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  50% {
    transform: translateX(6px);
  }
  75% {
    transform: translateX(-3px);
  }
}

@media (min-width: 760px) {
  .bag-pivot {
    width: min(28vw, 260px);
    top: 24%;
  }
}

@media (max-height: 700px) {
  .brand {
    font-size: 1.55rem;
    margin-bottom: 6px;
  }

  .bag-pivot {
    top: 30%;
    width: min(48vw, 220px);
  }
}
