:root {
  --eazo-safe-area-top: max(56px, env(safe-area-inset-top, 0px));
  --eazo-safe-area-bottom: max(34px, env(safe-area-inset-bottom, 0px));
  --bg: #050008;
  --ink: #fff8cf;
  --muted: rgba(255, 248, 207, .72);
  --pink: #ff2dbd;
  --hot: #ff4b2e;
  --gold: #ffd500;
  --lime: #3cff54;
  --blue: #2e51ff;
  --cyan: #14f7ff;
  --card: rgba(12, 2, 22, .86);
  --line: rgba(255, 213, 0, .36);
  --shadow-pink: 0 0 14px rgba(255, 45, 189, .65), 0 0 34px rgba(255, 45, 189, .25);
  --shadow-gold: 0 0 13px rgba(255, 213, 0, .7), 0 0 38px rgba(255, 213, 0, .28);
  font-family: ui-rounded, "Arial Rounded MT Bold", "Trebuchet MS", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); color: var(--ink); }
body {
  margin: 0;
  min-width: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 45, 189, .28), transparent 28%),
    radial-gradient(circle at 86% 0%, rgba(255, 213, 0, .22), transparent 31%),
    radial-gradient(circle at 50% 100%, rgba(46, 81, 255, .22), transparent 40%),
    linear-gradient(180deg, #050008 0%, #120015 58%, #06000a 100%);
}
button { font: inherit; }

.app {
  position: relative;
  min-height: 100svh;
  padding-top: var(--eazo-safe-area-top);
  padding-bottom: var(--eazo-safe-area-bottom);
  overflow: hidden;
  isolation: isolate;
}

.app::before,
.app::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
}
.app::before {
  background-image:
    linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, .035) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(circle at center, black, transparent 78%);
}
.app::after {
  background:
    conic-gradient(from 45deg at 0 0, transparent 0 25%, rgba(255, 213, 0, .18) 0 26%, transparent 0 100%),
    conic-gradient(from 225deg at 100% 100%, transparent 0 25%, rgba(255, 45, 189, .16) 0 26%, transparent 0 100%);
  opacity: .9;
}

.stage {
  width: min(100%, 980px);
  margin: 0 auto;
  padding: 12px clamp(14px, 4vw, 28px) 0;
  min-width: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  min-width: 0;
}

.brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--gold);
  text-transform: uppercase;
  font-weight: 950;
  letter-spacing: .04em;
  text-shadow: var(--shadow-gold);
  font-size: clamp(16px, 4vw, 22px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.brand .token {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex: 0 0 auto;
  background: radial-gradient(circle at 32% 28%, #fff9a8 0 10%, var(--gold) 11% 54%, #ff7a00 55% 100%);
  box-shadow: var(--shadow-gold);
  display: grid;
  place-items: center;
  color: #2b0600;
  font-size: 17px;
}

.lang {
  min-height: 44px;
  min-width: 104px;
  border: 2px solid var(--cyan);
  background: rgba(20, 247, 255, .08);
  color: #efffff;
  border-radius: 999px;
  padding: 0 12px;
  box-shadow: 0 0 18px rgba(20, 247, 255, .35), inset 0 0 14px rgba(20, 247, 255, .12);
  cursor: pointer;
  white-space: nowrap;
  font-weight: 900;
  flex: 0 0 auto;
}
.lang .seg { opacity: .5; }
.lang .seg.on { opacity: 1; color: #fff; text-shadow: 0 0 10px var(--cyan); }

.marquee {
  border: 2px solid var(--line);
  border-radius: 16px;
  height: 35px;
  overflow: hidden;
  background: #0f0019;
  box-shadow: inset 0 0 0 2px rgba(255, 45, 189, .18), var(--shadow-pink);
  margin-bottom: 10px;
}
.marquee-track {
  width: max-content;
  display: flex;
  animation: marquee 10s linear infinite;
  color: var(--pink);
  text-shadow: 0 0 8px var(--pink), 0 0 15px var(--gold);
  font-size: 16px;
  font-weight: 950;
  line-height: 31px;
  letter-spacing: .16em;
  white-space: nowrap;
}
.marquee-track span { padding-right: 28px; }

.machine {
  position: relative;
  border-radius: 28px;
  padding: clamp(12px, 3vw, 22px);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, .10), transparent 12%),
    linear-gradient(135deg, rgba(255, 45, 189, .20), rgba(255, 213, 0, .10) 46%, rgba(46, 81, 255, .18)),
    var(--card);
  border: 3px solid rgba(255, 213, 0, .82);
  box-shadow: 0 0 0 5px rgba(255, 45, 189, .22), 0 18px 60px rgba(0, 0, 0, .48), var(--shadow-gold);
  min-width: 0;
}
.machine::before {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 22px;
  border: 2px dotted rgba(255, 248, 207, .48);
  pointer-events: none;
  animation: blink .75s steps(2, end) infinite;
}

.hud {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
  min-width: 0;
}
.label {
  justify-self: start;
  color: #07000a;
  background: linear-gradient(90deg, var(--gold), #fff27d, var(--pink));
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 1000;
  text-transform: uppercase;
  letter-spacing: .06em;
  box-shadow: var(--shadow-gold);
  animation: pulse 1s ease-in-out infinite;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.invites {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: 15px;
  border: 2px solid var(--pink);
  color: #fff;
  background: rgba(255, 45, 189, .13);
  padding: 0 10px;
  font-weight: 950;
  text-shadow: var(--shadow-pink);
  white-space: nowrap;
}

.percent-wrap {
  display: grid;
  place-items: center;
  margin: 2px 0 8px;
  min-width: 0;
}
.percent {
  font-family: "Courier New", "SFMono-Regular", "PingFang SC", monospace;
  font-size: clamp(46px, 15vw, 112px);
  line-height: .92;
  font-weight: 950;
  letter-spacing: -.08em;
  color: #fffde7;
  text-shadow: 0 0 9px #fff, 0 0 28px var(--gold), 0 0 46px var(--pink);
  padding: 4px 8px;
  max-width: 100%;
  overflow: hidden;
}
.percent small { font-size: .33em; letter-spacing: -.03em; color: var(--gold); }

.bar-shell {
  position: relative;
  width: 100%;
  height: clamp(38px, 8vw, 58px);
  border-radius: 999px;
  background: linear-gradient(180deg, #1c042b, #08000d);
  border: 3px solid #fff08a;
  box-shadow: inset 0 5px 16px rgba(0, 0, 0, .72), var(--shadow-gold);
  overflow: hidden;
}
.bar-fill {
  position: absolute;
  inset: 4px auto 4px 4px;
  width: 99.99%;
  max-width: calc(100% - 8px);
  border-radius: 999px;
  background:
    linear-gradient(105deg, transparent 0 38%, rgba(255, 255, 255, .72) 45%, transparent 52%) 0 0 / 180px 100%,
    linear-gradient(90deg, var(--pink), var(--gold) 52%, var(--lime));
  box-shadow: inset 0 4px 8px rgba(255, 255, 255, .42), inset 0 -8px 13px rgba(83, 0, 86, .36), 0 0 24px rgba(255, 213, 0, .52);
  transition: width .75s cubic-bezier(.16, 1, .3, 1);
  animation: sheen 1.15s linear infinite;
}
.bar-lock {
  position: absolute;
  right: 3px;
  top: 3px;
  bottom: 3px;
  width: 8px;
  border-radius: 999px;
  background: repeating-linear-gradient(45deg, #050008 0 4px, #ff2dbd 4px 8px, #ffd500 8px 12px);
  box-shadow: 0 0 15px #ff2dbd;
}

.hint {
  margin: 12px 4px 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.25;
  text-align: center;
  font-weight: 800;
}

.people {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
  min-width: 0;
}
.person {
  position: relative;
  min-height: 106px;
  min-width: 0;
  border: 2px solid rgba(255, 248, 207, .55);
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .01)), rgba(0, 0, 0, .36);
  color: var(--ink);
  padding: 8px 6px;
  cursor: pointer;
  overflow: hidden;
  touch-action: manipulation;
  box-shadow: 0 0 0 1px rgba(255, 45, 189, .22), 0 0 18px rgba(20, 247, 255, .12);
  transition: transform .18s ease, opacity .2s ease, border-color .2s ease;
}
.person:active:not(:disabled) { transform: scale(.96); }
.person:disabled {
  opacity: .43;
  cursor: not-allowed;
  filter: saturate(.45);
}
.avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  margin: 0 auto 6px;
  display: grid;
  place-items: center;
  font-weight: 1000;
  color: #09000f;
  border: 2px solid rgba(255, 255, 255, .86);
  box-shadow: 0 0 16px currentColor;
  position: relative;
  overflow: hidden;
}
.avatar::before {
  content: "";
  position: absolute;
  width: 44px;
  height: 24px;
  border-radius: 50% 50% 40% 40%;
  background: rgba(0, 0, 0, .22);
  top: -7px;
  transform: rotate(-8deg);
}
.avatar::after {
  content: "";
  position: absolute;
  width: 20px;
  height: 11px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .28);
  bottom: 8px;
}
.avatar span { position: relative; z-index: 1; }
.pname, .rel {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
.pname { font-weight: 950; font-size: 13px; }
.rel { color: rgba(255, 248, 207, .68); font-size: 11px; margin-top: 2px; }

.float {
  position: absolute;
  left: 50%;
  top: 34px;
  transform: translate(-50%, 0);
  z-index: 4;
  font-family: "Courier New", monospace;
  font-size: 18px;
  font-weight: 1000;
  pointer-events: none;
  animation: floatUp .9s ease forwards;
  text-shadow: 0 0 10px currentColor;
  white-space: nowrap;
}
.ripple {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: 3px solid var(--cyan);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: ripple .55s ease-out forwards;
}

.utility {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 10px;
}
.quiet-end {
  min-height: 44px;
  border: 1px solid rgba(255, 248, 207, .32);
  background: rgba(255, 255, 255, .04);
  color: rgba(255, 248, 207, .74);
  border-radius: 999px;
  padding: 0 14px;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 850;
}

.countdown {
  margin-top: 10px;
  min-height: 44px;
  display: none;
  place-items: center;
  color: var(--gold);
  font-weight: 1000;
  text-transform: uppercase;
  text-shadow: var(--shadow-gold);
}
.countdown.show { display: grid; }

.summary {
  position: relative;
  display: none;
  border-radius: 28px;
  border: 3px solid var(--gold);
  background:
    radial-gradient(circle at 80% 8%, rgba(255, 45, 189, .28), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, .10), transparent 16%),
    rgba(8, 0, 14, .92);
  padding: clamp(16px, 4vw, 28px);
  box-shadow: var(--shadow-gold), 0 20px 60px rgba(0, 0, 0, .55);
  min-width: 0;
}
.summary.show { display: block; }
.summary h1 {
  margin: 0 0 12px;
  font-size: clamp(24px, 7vw, 44px);
  line-height: 1;
  color: var(--pink);
  text-shadow: var(--shadow-pink);
  text-transform: uppercase;
  overflow-wrap: anywhere;
}
.summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}
.stat {
  border-radius: 16px;
  border: 1px solid rgba(255, 248, 207, .28);
  padding: 10px;
  background: rgba(255, 255, 255, .05);
  min-width: 0;
}
.stat b {
  display: block;
  font-family: "Courier New", monospace;
  font-size: clamp(18px, 5vw, 28px);
  color: #fff;
  text-shadow: 0 0 14px var(--cyan);
  overflow-wrap: anywhere;
}
.stat span { color: rgba(255, 248, 207, .72); font-size: 12px; font-weight: 850; }
.summary p {
  margin: 8px 0;
  line-height: 1.35;
  color: rgba(255, 248, 207, .86);
  font-weight: 800;
  overflow-wrap: anywhere;
}
.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.primary, .share, .details-toggle {
  min-height: 48px;
  border-radius: 16px;
  border: 0;
  cursor: pointer;
  white-space: nowrap;
  font-weight: 1000;
  text-transform: uppercase;
}
.primary { background: linear-gradient(90deg, var(--gold), #fff690); color: #230006; box-shadow: var(--shadow-gold); }
.share { background: linear-gradient(90deg, var(--pink), var(--blue)); color: #fff; box-shadow: var(--shadow-pink); }
.details-toggle {
  grid-column: 1 / -1;
  background: rgba(255, 255, 255, .06);
  color: var(--ink);
  border: 2px solid rgba(20, 247, 255, .42);
}
.toast {
  min-height: 24px;
  margin-top: 8px;
  color: var(--cyan);
  font-weight: 900;
  text-shadow: 0 0 10px var(--cyan);
}
.details {
  margin-top: 10px;
  display: none;
  max-height: 220px;
  overflow: auto;
  border-radius: 16px;
  border: 1px solid rgba(255, 248, 207, .22);
}
.details.show { display: block; }
.row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 9px 10px;
  border-bottom: 1px solid rgba(255, 248, 207, .14);
  font-weight: 850;
}
.row:last-child { border-bottom: 0; }
.row span:first-child { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pos { color: var(--lime); }
.neg { color: #ff684d; }
.zero { color: var(--muted); }

.confetti-piece, .coin {
  position: fixed;
  width: 9px;
  height: 14px;
  pointer-events: none;
  z-index: 20;
  animation: pop 900ms ease-out forwards;
}
.coin {
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--gold);
  border: 2px solid #fff690;
  box-shadow: var(--shadow-gold);
}

@media (min-width: 720px) {
  .live-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(280px, .88fr);
    gap: 16px;
    align-items: start;
  }
  .people { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 0; }
  .hint { grid-column: 1 / -1; }
  .person { min-height: 124px; }
  .avatar { width: 60px; height: 60px; }
  .utility { grid-column: 2; }
  .countdown { grid-column: 1 / -1; }
}

@media (max-width: 374px) {
  .stage { padding-left: 10px; padding-right: 10px; }
  .people { gap: 6px; }
  .person { min-height: 98px; padding-inline: 4px; }
  .avatar { width: 44px; height: 44px; }
  .pname { font-size: 12px; }
  .rel { font-size: 10px; }
  .summary-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
  }
  .bar-fill { background-position: 0 0; }
}

@keyframes marquee { to { transform: translateX(-50%); } }
@keyframes blink { 50% { opacity: .38; } }
@keyframes pulse { 50% { transform: scale(1.035); filter: saturate(1.3); } }
@keyframes sheen { to { background-position: 180px 0, 0 0; } }
@keyframes floatUp { to { opacity: 0; transform: translate(-50%, -54px) scale(1.18); } }
@keyframes ripple { to { width: 210px; height: 210px; opacity: 0; } }
@keyframes pop {
  0% { transform: translate(0, 0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) rotate(540deg) scale(.55); opacity: 0; }
}
