@import url("colors.css");

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #0A0A0F;
  color: var(--off-white);
  font-family: var(--font-sans);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

#root { height: 100vh; width: 100vw; }

/* ===== Stage ===== */
.stage {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background:
    radial-gradient(ellipse at 50% 50%, #15151E 0%, #08080C 70%),
    #08080C;
}

/* faint grid */
.stage::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(253,218,36,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(253,218,36,0.04) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      rgba(255,255,255,0.012) 0px,
      rgba(255,255,255,0.012) 1px,
      transparent 1px,
      transparent 3px
    );
  pointer-events: none;
  z-index: 1;
}

/* ===== Top bar ===== */
.topbar {
  position: relative;
  z-index: 5;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  background: rgba(8,8,12,0.6);
  backdrop-filter: blur(8px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}
.brand-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
}
.brand-mark svg { width: 100%; height: 100%; }
.brand-name {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: var(--stellar-white);
}
.brand-name b {
  font-style: normal;
  font-weight: 600;
  color: var(--stellar-yellow);
}
.brand-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-400);
  padding: 4px 8px;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 999px;
}

.hud-stats {
  display: flex;
  gap: 8px;
  align-items: center;
}
.stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  padding: 6px 14px;
  border-radius: 6px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  min-width: 84px;
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-400);
}
.stat-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--stellar-white);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
}
.stat-value.accent { color: var(--stellar-yellow); }
.stat-value.danger { color: #FF5A6E; }

/* ===== Arena container ===== */
.arena-wrap {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.arena {
  position: relative;
  width: min(92vh, 92vw, 980px);
  aspect-ratio: 1 / 1;
  display: grid;
  place-items: center;
}
.arena svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* ===== Bottom bar ===== */
.bottombar {
  position: relative;
  z-index: 5;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  border-top: 1px solid rgba(255,255,255,0.06);
  background: rgba(8,8,12,0.6);
  backdrop-filter: blur(8px);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--ink-400);
  text-transform: uppercase;
}
.kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  margin: 0 4px;
  border: 1px solid rgba(255,255,255,0.18);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--stellar-white);
  background: rgba(255,255,255,0.04);
}

/* ===== Player chip cluster (centered legend in topbar) ===== */
.players {
  display: flex;
  gap: 6px;
  align-items: center;
}
.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px 5px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--stellar-white);
  transition: opacity var(--dur-base) var(--ease);
}
.chip-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid rgba(0,0,0,0.4);
}
.chip.out {
  opacity: 0.35;
  text-decoration: line-through;
  text-decoration-color: rgba(255,255,255,0.4);
}
.chip.you {
  outline: 1px solid var(--stellar-yellow);
  outline-offset: 1px;
}

/* ===== Overlay (start / round end) ===== */
.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(8,8,12,0.55), rgba(8,8,12,0.92));
  backdrop-filter: blur(2px);
  pointer-events: auto;
}
.overlay-card {
  width: min(560px, 88%);
  padding: 36px 40px;
  background: #0F0F14;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.overlay-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--stellar-yellow), var(--lilac), var(--teal), var(--stellar-yellow));
  background-size: 200% 100%;
  animation: shimmer 3s linear infinite;
}
@keyframes shimmer {
  to { background-position: -200% 0; }
}
.overlay-eyebrow {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--stellar-yellow);
  margin-bottom: 12px;
}
.overlay-title {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 500;
  font-size: 56px;
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
  color: var(--stellar-white);
}
.overlay-title b {
  font-style: normal;
  font-weight: 600;
  color: var(--stellar-yellow);
}
.overlay-sub {
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-300);
  margin-bottom: 28px;
  max-width: 420px;
  margin-left: auto;
  margin-right: auto;
}
.overlay-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.btn {
  appearance: none;
  border: 1px solid rgba(255,255,255,0.18);
  background: transparent;
  color: var(--stellar-white);
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 12px 22px;
  border-radius: 4px;
  cursor: pointer;
  transition: all var(--dur-fast) var(--ease);
}
.btn:hover { background: rgba(255,255,255,0.05); border-color: rgba(255,255,255,0.3); }
.btn.primary {
  background: var(--stellar-yellow);
  color: var(--stellar-black);
  border-color: var(--stellar-yellow);
  font-weight: 700;
}
.btn.primary:hover { background: #FFE85C; border-color: #FFE85C; }
.btn:active { transform: scale(0.98); }

.legend {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 24px 0 20px;
  text-align: left;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-300);
  padding: 6px 8px;
  background: rgba(255,255,255,0.02);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 4px;
}
.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

/* ===== Big result text ===== */
.result-rank {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-400);
  text-transform: uppercase;
}
.result-rank b {
  color: var(--stellar-yellow);
  font-weight: 700;
}

/* hide-on-out animation */
@keyframes pulseOut {
  0% { transform: scale(1); opacity: 1; }
  40% { transform: scale(1.18); opacity: 1; }
  100% { transform: scale(0.92); opacity: 0.35; }
}

/* ball trail glow style applied inline via SVG filters */
.shake {
  animation: shake 0.35s var(--ease);
}
@keyframes shake {
  0%, 100% { transform: translate(0,0); }
  20% { transform: translate(-4px, 2px); }
  40% { transform: translate(3px, -3px); }
  60% { transform: translate(-2px, 3px); }
  80% { transform: translate(2px, -1px); }
}
