/* ==========================================================
   GRIDMANIAC — HUD / UI
   ========================================================== */
:root {
  --bg: #04060d;
  --panel: rgba(10, 16, 32, 0.62);
  --panel-strong: rgba(8, 12, 26, 0.86);
  --line: rgba(120, 220, 255, 0.22);
  --cyan: #38f3ff;
  --cyan-soft: rgba(56, 243, 255, 0.35);
  --magenta: #ff3df2;
  --amber: #ffb640;
  --red: #ff3d5a;
  --green: #7dff8c;
  --text: #e6f4ff;
  --muted: #8ea6c4;
  --font-display: 'Orbitron', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Rajdhani', 'Segoe UI', system-ui, sans-serif;
  --radius: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#app {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
}

#scene-root {
  position: absolute;
  inset: 0;
}

#scene-root canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.hidden {
  display: none !important;
}

kbd {
  font-family: var(--font-display);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
}

/* ---------- Glass panels ---------- */
.team-card,
#timer-wrap,
#log,
#action-bar,
#hint,
.overlay .panel {
  background: linear-gradient(160deg, rgba(20, 32, 60, 0.7), rgba(6, 10, 22, 0.72));
  border: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

/* ---------- Top HUD ---------- */
#hud-top {
  position: absolute;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  width: min(1180px, calc(100% - 36px));
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 18px;
  align-items: start;
  pointer-events: none;
  animation: slideDown 0.6s cubic-bezier(.2, .9, .3, 1.2);
}

.team-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 18px;
  border-radius: var(--radius);
  position: relative;
  overflow: hidden;
}

.team-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent);
  transform: translateX(-100%);
  animation: sheen 5s infinite;
}

.team-card.ai {
  justify-self: end;
  text-align: right;
}

.team-card.player {
  justify-self: start;
}

.team-emblem {
  width: 44px;
  height: 44px;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(140deg, #9bd85a, #3d5a1e);
  box-shadow: 0 0 20px var(--cyan-soft);
  position: relative;
}

.team-emblem::after {
  content: '';
  position: absolute;
  inset: 13px 8px 17px;
  border-radius: 6px 6px 10px 10px;
  background: linear-gradient(180deg, #ffd27a, #ff8c1a);
  box-shadow: 0 0 10px #ffb640;
}

.team-card.ai .team-emblem {
  background: linear-gradient(140deg, #ff5a6e, #5a0f1a);
}

.team-card.ai .team-emblem::after {
  background: linear-gradient(180deg, #ff8a8a, #ff1f3d);
}

.team-name {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 16px;
  letter-spacing: 3px;
}

.tag {
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  letter-spacing: 2px;
  vertical-align: middle;
  background: var(--cyan);
  color: #021018;
}

.team-card.ai .tag {
  background: var(--red);
  color: #fff;
}

.team-status {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--green);
  margin-top: 4px;
  text-shadow: 0 0 8px currentColor;
}

.team-status.down {
  color: var(--red);
}

.team-status.locked {
  color: var(--amber);
}

.team-meta {
  font-size: 14px;
  color: var(--muted);
  letter-spacing: 1px;
  margin-top: 2px;
}

.team-meta b {
  color: var(--text);
  font-family: var(--font-display);
  font-size: 13px;
}

/* ---------- Timer ---------- */
#timer-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 26px 12px;
  border-radius: 0 0 24px 24px;
  border-top: none;
  min-width: 250px;
}

#phase-label {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 4px;
  color: var(--cyan);
  text-shadow: 0 0 12px var(--cyan);
}

#timer {
  position: relative;
  width: 86px;
  height: 86px;
  margin: 6px 0 4px;
}

#timer svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

#timer circle {
  fill: none;
  stroke-width: 7;
}

#timer .track {
  stroke: rgba(255, 255, 255, 0.08);
}

#timer .bar {
  stroke: var(--cyan);
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 0;
  filter: drop-shadow(0 0 6px var(--cyan));
  transition: stroke 0.3s;
}

#timer-num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 30px;
  text-shadow: 0 0 14px var(--cyan-soft);
}

#timer.warn .bar {
  stroke: var(--red);
  filter: drop-shadow(0 0 8px var(--red));
}

#timer.warn #timer-num {
  color: var(--red);
  animation: pulse 0.5s infinite alternate;
}

#timer.idle .bar {
  stroke: var(--magenta);
  filter: drop-shadow(0 0 6px var(--magenta));
}

#timer.idle #timer-num {
  font-size: 18px;
  color: var(--magenta);
}

#round-label {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--muted);
}

/* ---------- Banner ---------- */
#banner {
  position: absolute;
  top: 42%;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-50%) scale(0.92);
  transition: opacity 0.35s, transform 0.45s cubic-bezier(.2, .9, .3, 1.3);
}

#banner.show {
  opacity: 1;
  transform: translateY(-50%) scale(1);
}

#banner h2 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(30px, 5.5vw, 72px);
  letter-spacing: 0.18em;
  background: linear-gradient(90deg, var(--cyan), #fff, var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 0 22px rgba(56, 243, 255, 0.55));
}

#banner p {
  font-size: clamp(14px, 1.6vw, 20px);
  letter-spacing: 0.4em;
  color: var(--text);
  margin-top: 6px;
  text-shadow: 0 0 10px #000;
}

#banner.danger h2 {
  background: linear-gradient(90deg, var(--red), #fff, var(--amber));
  -webkit-background-clip: text;
  background-clip: text;
}

/* ---------- Log ---------- */
#log {
  position: absolute;
  left: 18px;
  top: 150px;
  width: 290px;
  max-height: 42vh;
  overflow: hidden;
  border-radius: var(--radius);
  padding: 12px 14px;
  pointer-events: none;
}

.log-title {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 3px;
  color: var(--muted);
  margin-bottom: 8px;
}

#log-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

#log-list li {
  font-size: 14px;
  line-height: 1.25;
  padding-left: 10px;
  border-left: 2px solid var(--cyan);
  animation: fadeIn 0.4s;
}

#log-list li.ai {
  border-color: var(--red);
}

#log-list li.sys {
  border-color: var(--magenta);
  color: var(--muted);
}

#log-list li.good {
  border-color: var(--green);
  color: var(--green);
}

#log-list li.bad {
  border-color: var(--red);
  color: #ff9aa8;
}

/* ---------- Hint ---------- */
#hint {
  position: absolute;
  bottom: 150px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 20px;
  border-radius: 40px;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
}

#hint b {
  color: var(--cyan);
}

/* ---------- Action bar ---------- */
#action-bar {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  display: flex;
  align-items: stretch;
  gap: 18px;
  padding: 12px;
  border-radius: 20px;
  animation: slideUp 0.6s cubic-bezier(.2, .9, .3, 1.2);
}

#action-bar.disabled .weapon {
  opacity: 0.35;
  pointer-events: none;
  filter: grayscale(0.7);
}

.pos-control-wrap {
  display: flex;
}

.pos-btn {
  position: relative;
  width: 156px;
  padding: 10px 12px 10px 58px;
  text-align: left;
  border-radius: 14px;
  border: 1px solid rgba(125, 255, 140, 0.4);
  background: linear-gradient(160deg, rgba(20, 60, 40, 0.45), rgba(10, 24, 20, 0.7));
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.25s, background 0.25s;
  font-family: var(--font-body);
}

.pos-btn svg {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 38px;
  height: 38px;
  transform: translateY(-50%);
  color: var(--green);
  transition: transform 0.2s;
}

.pos-btn .w-name {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--green);
}

.pos-btn .w-desc {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.1;
  font-weight: 700;
}

.pos-btn kbd {
  position: absolute;
  right: 8px;
  top: 8px;
}

.pos-btn:hover {
  transform: translateY(-4px);
  border-color: var(--green);
  box-shadow: 0 10px 25px rgba(125, 255, 140, 0.25);
}

.pos-btn.active {
  border-color: var(--green);
  background: linear-gradient(160deg, rgba(125, 255, 140, 0.25), rgba(10, 24, 20, 0.85));
  box-shadow: 0 0 0 1px var(--green), 0 0 25px rgba(125, 255, 140, 0.4);
  transform: translateY(-5px);
}

.pos-btn.set .w-desc {
  color: #fff;
  text-shadow: 0 0 8px rgba(125, 255, 140, 0.6);
}

.weapons {
  display: flex;
  gap: 12px;
}

.weapon {
  position: relative;
  width: 168px;
  padding: 10px 12px 10px 64px;
  text-align: left;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(40, 60, 100, 0.35), rgba(10, 14, 28, 0.6));
  color: var(--text);
  cursor: pointer;
  transition: transform 0.18s, border-color 0.18s, box-shadow 0.25s, background 0.25s;
  font-family: var(--font-body);
}

.weapon svg {
  position: absolute;
  left: 10px;
  top: 50%;
  width: 44px;
  height: 44px;
  transform: translateY(-50%);
  fill: #9fb4d4;
  transition: fill 0.2s, filter 0.2s;
}

.weapon svg .glow {
  fill: var(--cyan);
  filter: drop-shadow(0 0 4px var(--cyan));
}

.weapon .w-name {
  display: block;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 2px;
}

.weapon .w-desc {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-top: 2px;
  line-height: 1.1;
}

.weapon kbd {
  position: absolute;
  right: 8px;
  top: 8px;
}

.weapon:hover {
  transform: translateY(-4px);
  border-color: var(--cyan-soft);
  box-shadow: 0 10px 30px rgba(56, 243, 255, 0.15);
}

.weapon.active {
  border-color: var(--cyan);
  background: linear-gradient(160deg, rgba(56, 243, 255, 0.25), rgba(10, 14, 28, 0.7));
  box-shadow: 0 0 0 1px var(--cyan), 0 0 30px rgba(56, 243, 255, 0.35), inset 0 0 30px rgba(56, 243, 255, 0.15);
  transform: translateY(-6px);
}

.weapon.active svg {
  fill: #fff;
  filter: drop-shadow(0 0 8px var(--cyan));
}

.weapon[data-weapon='grenade'] svg .glow {
  fill: var(--magenta);
  filter: drop-shadow(0 0 4px var(--magenta));
}

.weapon[data-weapon='mines'] svg .glow {
  fill: var(--amber);
  filter: drop-shadow(0 0 4px var(--amber));
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  justify-content: center;
}

.controls button {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 12px;
  border-radius: 12px;
  cursor: pointer;
  padding: 10px 18px;
  transition: transform 0.15s, box-shadow 0.2s, opacity 0.2s;
}

.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}

.ghost:hover {
  border-color: var(--cyan);
}

.lock {
  border: none;
  color: #02121a;
  background: linear-gradient(90deg, var(--cyan), #8dffd6);
  box-shadow: 0 0 24px rgba(56, 243, 255, 0.5);
  min-width: 150px;
}

.lock kbd {
  color: #02121a;
  border-color: rgba(0, 0, 0, 0.3);
}

.lock:not(:disabled):hover {
  transform: scale(1.04);
  box-shadow: 0 0 36px rgba(56, 243, 255, 0.8);
}

.lock:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  box-shadow: none;
  filter: grayscale(0.6);
}

.lock.ready {
  animation: readyPulse 1.1s infinite;
}

/* ---------- Overlays ---------- */
.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at center, rgba(4, 8, 20, 0.35), rgba(2, 3, 8, 0.85));
  z-index: 10;
  animation: fadeIn 0.6s;
}

.overlay .panel {
  width: min(860px, calc(100% - 40px));
  padding: 44px 48px 36px;
  border-radius: 24px;
  text-align: center;
  position: relative;
  /* Pixel-perfect gradient border: native 1px border stroke with zero subpixel jitter across all browser engines.
     Eliminates subpixel rounding gaps, Retina/high-DPI offsets, and scroll displacement. */
  border: 1px solid transparent;
  background-image:
    linear-gradient(160deg, rgba(20, 32, 60, 0.72), rgba(6, 10, 22, 0.75)),
    linear-gradient(125deg, var(--cyan) 0%, rgba(56, 243, 255, 0.35) 25%, rgba(120, 220, 255, 0.15) 50%, rgba(255, 61, 242, 0.45) 75%, var(--magenta) 100%);
  background-origin: padding-box, border-box;
  background-clip: padding-box, border-box;
  background-repeat: no-repeat;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 25px rgba(255, 61, 242, 0.14);
}

.overlay .panel::before {
  /* Deprecated fragile -webkit-mask-composite: xor which misaligned across browser engines */
  display: none !important;
}

.kicker {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 6px;
  color: var(--muted);
}

.title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(44px, 8vw, 96px);
  letter-spacing: 0.12em;
  margin: 8px 0 26px;
  color: #fff;
  text-shadow: 0 0 30px rgba(56, 243, 255, 0.7), 0 0 80px rgba(56, 243, 255, 0.3);
}

.title span {
  color: var(--magenta);
  text-shadow: 0 0 30px rgba(255, 61, 242, 0.8), 0 0 80px rgba(255, 61, 242, 0.3);
}

.rules {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 26px;
  text-align: left;
}


.rule {
  display: flex;
  gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
}

.rule b {
  font-family: var(--font-display);
  font-size: 22px;
  color: var(--cyan);
  text-shadow: 0 0 12px var(--cyan);
}

.rule h3 {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 3px;
  margin-bottom: 4px;
}

.rule p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.25;
}

.cta {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: 8px;
  padding: 16px 56px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  color: #02121a;
  background: linear-gradient(90deg, var(--cyan), #9dffe0, var(--cyan));
  background-size: 200% 100%;
  box-shadow: 0 0 40px rgba(56, 243, 255, 0.55);
  animation: shimmer 3s linear infinite;
  transition: transform 0.2s, box-shadow 0.2s;
}

.cta:hover {
  transform: scale(1.06);
  box-shadow: 0 0 70px rgba(56, 243, 255, 0.9);
}

.cta:disabled {
  opacity: 0.5;
  cursor: wait;
}

.controls-hint {
  margin-top: 18px;
  color: var(--muted);
  font-size: 14px;
  letter-spacing: 1px;
}

#end-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(24px, 4.2vw, 42px);
  letter-spacing: 2px;
  line-height: 1.2;
  margin-bottom: 14px;
  max-width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
}

#end-title.win {
  color: var(--green);
  text-shadow: 0 0 40px rgba(125, 255, 140, 0.7);
}

#end-title.lose {
  color: var(--red);
  text-shadow: 0 0 40px rgba(255, 61, 90, 0.7);
}

#end-title.draw {
  color: var(--amber);
  text-shadow: 0 0 40px rgba(255, 182, 64, 0.7);
}

#end-sub {
  color: var(--muted);
  font-size: 20px;
  letter-spacing: 2px;
  margin-bottom: 28px;
}

#end-screen {
  background: radial-gradient(ellipse at center, rgba(4, 8, 20, 0.15), rgba(2, 3, 8, 0.7));
}

/* ---------- Toast ---------- */
#toast {
  position: absolute;
  top: 140px;
  left: 50%;
  transform: translate(-50%, -20px);
  padding: 10px 20px;
  border-radius: 10px;
  background: rgba(60, 8, 20, 0.85);
  border: 1px solid var(--red);
  color: #ffd6dc;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 20;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.noscript {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 22px;
}

/* ---------- Animations ---------- */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translate(-50%, -30px);
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translate(-50%, 30px);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
}

@keyframes pulse {
  to {
    transform: scale(1.15);
  }
}

@keyframes sheen {

  0%,
  70% {
    transform: translateX(-100%);
  }

  100% {
    transform: translateX(100%);
  }
}

@keyframes shimmer {
  to {
    background-position: -200% 0;
  }
}

@keyframes readyPulse {
  50% {
    box-shadow: 0 0 44px rgba(56, 243, 255, 0.95);
  }
}

/* ---------- Responsive: Hide desktop log & team meta on smaller screens ---------- */
@media (max-width: 980px) {
  #log {
    display: none;
  }

  .team-meta {
    display: none;
  }
}

/* ---------- Multiplayer Mode Selector ---------- */
.mode-select-wrap {
  width: 100%;
  margin: 14px 0 18px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mode-label {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--cyan);
  text-align: left;
}

.mode-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.mode-btn {
  background: rgba(12, 20, 38, 0.75);
  border: 1px solid rgba(120, 220, 255, 0.2);
  border-radius: 10px;
  padding: 10px 8px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.mode-btn:hover {
  background: rgba(24, 40, 72, 0.85);
  border-color: var(--cyan);
}

.mode-btn.active {
  background: linear-gradient(180deg, rgba(30, 60, 110, 0.85), rgba(16, 32, 64, 0.95));
  border-color: var(--cyan);
  box-shadow: 0 0 18px rgba(56, 243, 255, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.mode-btn .m-title {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
}

.mode-btn .m-sub {
  font-size: 11px;
  color: var(--muted);
}

.mode-btn.active .m-title {
  color: var(--cyan);
}

/* ---------- CTA row ---------- */
.cta-row {
  display: flex;
  gap: 14px;
  width: 100%;
  margin: 10px 0;
}

.cta-row .cta {
  flex: 1.2;
}

.cta-secondary {
  flex: 1;
  background: rgba(18, 30, 56, 0.8);
  border: 1px solid rgba(120, 220, 255, 0.3);
  border-radius: 12px;
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.5px;
  cursor: pointer;
  padding: 14px 18px;
  transition: all 0.2s ease;
}

.cta-secondary:hover {
  background: rgba(28, 48, 88, 0.9);
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(56, 243, 255, 0.3);
  color: #fff;
}

/* ---------- CTA column ---------- */
.cta-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
  margin: 12px 0 6px 0;
}

.cta-col .cta,
.cta-col .cta-secondary {
  width: 100%;
  flex: none;
}

/* ---------- Pass & Play Screen ---------- */
.pass-panel {
  max-width: 480px;
  text-align: center;
  animation: scaleIn 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.pass-tag {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 3px;
  color: var(--amber);
  margin-bottom: 8px;
}

.pass-title {
  font-family: var(--font-display);
  font-size: 28px;
  margin-bottom: 12px;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 0 25px rgba(56, 243, 255, 0.5);
}

.pass-desc {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

/* ---------- Interactive Tutorial Screen & Translucent Bottom Card ---------- */
#tutorial-screen {
  position: absolute;
  inset: 0;
  background: transparent !important;
  pointer-events: none;
  display: flex !important;
  align-items: flex-end !important;
  justify-content: center !important;
  padding: 0 20px 24px 20px;
  z-index: 15;
  animation: fadeIn 0.4s;
}

#tutorial-screen.hidden {
  display: none !important;
}

.tutorial-card {
  width: min(980px, calc(100% - 32px));
  background: rgba(8, 14, 28, 0.65);
  border: 1px solid rgba(56, 243, 255, 0.45);
  border-radius: var(--radius);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.8), 0 0 30px rgba(56, 243, 255, 0.2);
  overflow: hidden;
  pointer-events: auto;
  animation: slideUp 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.tut-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 18px;
  border-bottom: 1px solid rgba(120, 220, 255, 0.15);
  background: rgba(0, 0, 0, 0.3);
}

.tut-tag-group {
  display: flex;
  align-items: center;
  gap: 16px;
}

.tut-tag {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--cyan);
}

.tut-step-num {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--amber);
}

.tut-close-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 4px 12px;
  transition: all 0.18s;
}

.tut-close-btn:hover {
  color: #fff;
  border-color: var(--red);
  background: rgba(255, 61, 90, 0.2);
}

.tut-main-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  padding: 12px 20px 14px 20px;
  align-items: center;
}

.tut-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tut-title {
  font-family: var(--font-display);
  font-size: 20px;
  letter-spacing: 1.5px;
  color: #fff;
}

.tut-desc {
  font-size: 15px;
  color: var(--text);
  line-height: 1.4;
}

.tut-bullet {
  background: rgba(56, 243, 255, 0.08);
  border-left: 3px solid var(--cyan);
  padding: 6px 12px;
  border-radius: 0 6px 6px 0;
  font-size: 13px;
  color: #e0f6ff;
  line-height: 1.35;
}

.tut-footer {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 170px;
}

.tut-footer .cta {
  padding: 10px 16px;
  font-size: 12px;
}

.tut-footer .ghost {
  padding: 8px 14px;
  font-size: 12px;
}

@media (max-width: 760px) {
  .tut-main-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .tut-footer {
    flex-direction: row;
    min-width: auto;
  }
}

/* ---------- HUD Team Variants ---------- */
.hud-players-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.team-card.titan {
  border-left: 3px solid #ff3d5a;
}

.team-card.viper {
  border-left: 3px solid #2ee66b;
}

.team-card.spectre {
  border-left: 3px solid #b53dff;
}

.team-card.eliminated {
  opacity: 0.38;
  filter: grayscale(80%);
}

.team-card.eliminated .team-name {
  text-decoration: line-through;
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.92);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ---------- Mid-game Exit Button in Timer ---------- */
.timer-exit-btn {
  margin-top: 6px;
  background: rgba(255, 61, 90, 0.08);
  border: 1px solid rgba(255, 61, 90, 0.3);
  border-radius: 6px;
  color: #ff99aa;
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  cursor: pointer;
  padding: 4px 12px;
  transition: all 0.2s ease;
  pointer-events: auto;
}

.timer-exit-btn:hover {
  background: rgba(255, 61, 90, 0.28);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 0 12px rgba(255, 61, 90, 0.4);
  transform: translateY(-1px);
}

/* ---------- Exit Confirmation Modal ---------- */
.exit-panel {
  max-width: 440px;
  text-align: center;
  animation: scaleIn 0.25s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.modal-tag {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--red);
  margin-bottom: 8px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 24px;
  margin-bottom: 12px;
  letter-spacing: 2px;
  color: #fff;
  text-shadow: 0 0 20px rgba(255, 61, 90, 0.5);
}

.modal-desc {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 24px;
}

.cta-danger {
  background: linear-gradient(135deg, #ff3d5a, #c41834) !important;
  color: #fff !important;
  border-color: #ff3d5a !important;
  box-shadow: 0 0 25px rgba(255, 61, 90, 0.4) !important;
}

.cta-danger:hover {
  box-shadow: 0 0 35px rgba(255, 61, 90, 0.7) !important;
}

/* ---------- Complete Gameplay Manual Modal ---------- */
.manual-panel {
  width: min(920px, calc(100% - 32px));
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: rgba(8, 14, 28, 0.88);
  border: 1px solid rgba(56, 243, 255, 0.45);
  border-radius: var(--radius);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 40px rgba(56, 243, 255, 0.25);
  overflow: hidden;
  animation: scaleIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.manual-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 1px solid rgba(56, 243, 255, 0.2);
  background: rgba(0, 0, 0, 0.4);
}

.manual-title {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 2.5px;
  color: #fff;
  margin: 0;
  text-shadow: 0 0 16px rgba(56, 243, 255, 0.5);
}

.manual-content {
  padding: 20px 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  scrollbar-width: thin;
  scrollbar-color: var(--cyan) rgba(0, 0, 0, 0.3);
}

.manual-section {
  position: relative;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px 18px;
}

.sec-badge {
  display: inline-block;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--cyan);
  background: rgba(56, 243, 255, 0.12);
  border: 1px solid rgba(56, 243, 255, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 6px;
}

.sec-title {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 1.5px;
  color: #fff;
  margin: 0 0 6px 0;
}

.sec-desc {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 12px;
}

.manual-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 680px) {
  .manual-grid-2 {
    grid-template-columns: 1fr;
  }
}

.manual-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  padding: 12px 14px;
}

.manual-card h4 {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 1.2px;
  color: var(--cyan);
  margin: 0 0 6px 0;
}

.manual-card p {
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
  margin: 0;
}

.manual-weapons {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.weapon-card {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 12px 16px;
  transition: all 0.2s ease;
}

.weapon-card.highlight {
  border-color: rgba(255, 182, 64, 0.5);
  background: rgba(255, 182, 64, 0.05);
}

.w-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.w-icon {
  font-size: 18px;
}

.w-head h4 {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 1.5px;
  color: #fff;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.w-key {
  font-family: var(--font-display);
  font-size: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--cyan);
  margin-left: auto;
}

.badge-updated {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 1px;
  color: #02121a;
  background: var(--amber);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.w-list {
  margin: 6px 0 10px 18px;
  font-size: 13px;
  color: var(--text);
  line-height: 1.5;
}

.w-list li {
  margin-bottom: 4px;
}

.w-stat {
  font-size: 12px;
  color: var(--muted);
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding-top: 6px;
  margin-top: 6px;
}

.w-stat b {
  color: var(--cyan);
}

.manual-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 14px 24px;
  border-top: 1px solid rgba(56, 243, 255, 0.2);
  background: rgba(0, 0, 0, 0.4);
}

.tut-manual-btn {
  background: rgba(56, 243, 255, 0.1);
  border: 1px solid rgba(56, 243, 255, 0.35);
  border-radius: 6px;
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 4px 10px;
  transition: all 0.18s;
}

.tut-manual-btn:hover {
  background: rgba(56, 243, 255, 0.25);
  border-color: var(--cyan);
  color: #fff;
}

/* =====================================================================
   Online play: main menu, matchmaking, private rooms, join, connection
   ===================================================================== */
#start-screen .panel {
  max-height: calc(100vh - 24px);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  /* Firefox: no visible scrollbar */
  -ms-overflow-style: none;
}

#start-screen .panel::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

#start-screen .menu-wrap {
  padding: 4px 6px;
}

/* room for hover lift + glow so nothing overflows */

/* Modals must sit above the start screen (z-index 10) regardless of DOM order. */
#name-modal {
  z-index: 25;
}

#manual-modal {
  z-index: 18;
}

#scorecard-modal {
  z-index: 17;
}

#match-modal,
#room-modal,
#join-modal,
#exit-modal {
  z-index: 16;
}

#hologram-countdown {
  z-index: 50;
}

#start-screen .title {
  margin-bottom: 14px;
}

.menu-wrap {
  width: 100%;
  margin: 6px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.menu-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 0 4px;
}

.mode-label {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 3px;
  color: var(--cyan);
  font-weight: 700;
  text-shadow: 0 0 10px rgba(56, 243, 255, 0.4);
}

.player-callsign-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(8, 20, 42, 0.9), rgba(5, 12, 26, 0.95));
  border: 1px solid rgba(56, 243, 255, 0.35);
  border-radius: 10px;
  padding: 4px 10px;
  box-shadow: 0 0 12px rgba(56, 243, 255, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: all 0.2s ease;
}

.player-callsign-wrap:focus-within {
  border-color: var(--cyan);
  box-shadow: 0 0 20px rgba(56, 243, 255, 0.45);
}

.callsign-label {
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--muted);
  user-select: none;
  white-space: nowrap;
}

.callsign-box {
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.player-name-input {
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  width: 105px;
  padding: 2px 0;
  text-shadow: 0 0 8px rgba(56, 243, 255, 0.5);
  transition: all 0.2s ease;
}

.player-name-input::placeholder {
  color: rgba(255, 255, 255, 0.3);
  font-weight: 700;
  letter-spacing: 1.5px;
}

.btn-lock-name {
  background: rgba(56, 243, 255, 0.18);
  border: 1px solid var(--cyan);
  color: var(--cyan);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
  padding: 3px 7px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 0 8px rgba(56, 243, 255, 0.25);
}

.btn-lock-name:hover {
  background: var(--cyan);
  color: #030d1c;
  box-shadow: 0 0 14px var(--cyan);
  transform: translateY(-1px);
}

.callsign-lock-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #7dff8c;
  background: rgba(125, 255, 140, 0.12);
  border: 1px solid rgba(125, 255, 140, 0.45);
  padding: 2px 6px;
  border-radius: 4px;
  user-select: none;
  white-space: nowrap;
  text-shadow: 0 0 6px rgba(125, 255, 140, 0.5);
}

.callsign-lock-badge.hidden {
  display: none !important;
}

.callsign-box.is-locked .player-name-input {
  color: var(--cyan);
  cursor: default;
  text-shadow: 0 0 12px rgba(56, 243, 255, 0.7);
  user-select: none;
}

.callsign-count {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--muted);
  user-select: none;
  min-width: 24px;
  text-align: right;
}

.callsign-count.hidden {
  display: none !important;
}

.btn-trophy-icon {
  margin-right: 4px;
  filter: drop-shadow(0 0 8px rgba(255, 215, 0, 0.6));
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.menu-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: left;
  padding: 14px 16px;
  border-radius: 14px;
  cursor: pointer;
  color: var(--text);
  background: linear-gradient(180deg, rgba(18, 30, 56, 0.85), rgba(10, 16, 32, 0.9));
  border: 1px solid rgba(120, 220, 255, 0.24);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.menu-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--cyan);
  box-shadow: 0 0 26px rgba(56, 243, 255, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  background: linear-gradient(180deg, rgba(26, 46, 86, 0.9), rgba(12, 20, 40, 0.95));
}

.menu-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.menu-btn.primary {
  border-color: var(--cyan);
  background: linear-gradient(135deg, rgba(20, 70, 96, 0.9), rgba(10, 24, 48, 0.95));
  box-shadow: 0 0 30px rgba(56, 243, 255, 0.3);
}

.menu-btn .m-badge {
  flex: 0 0 auto;
  min-width: 46px;
  text-align: center;
  padding: 8px 6px;
  border-radius: 10px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 13px;
  letter-spacing: 1px;
  color: #02121a;
  background: linear-gradient(135deg, var(--cyan), #9dffe0);
  box-shadow: 0 0 14px rgba(56, 243, 255, 0.5);
}

.menu-btn:nth-child(2) .m-badge {
  background: linear-gradient(135deg, var(--magenta), #ffa0f7);
  box-shadow: 0 0 14px rgba(255, 61, 242, 0.5);
}

.menu-btn .m-text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.menu-btn .m-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 1.5px;
}

.menu-btn .m-sub {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.2;
}

.menu-split {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.menu-split .menu-btn {
  flex: 1;
}

.size-pick {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(8, 16, 32, 0.65);
  border: 1px solid rgba(56, 243, 255, 0.2);
  border-radius: 10px;
}

.size-label {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--cyan);
  font-weight: 700;
  margin-right: auto;
}

.size-btn {
  min-width: 44px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  color: var(--text);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 13px;
  background: rgba(12, 20, 38, 0.85);
  border: 1px solid rgba(120, 220, 255, 0.24);
  transition: all 0.15s ease;
}

.size-btn:hover {
  border-color: var(--cyan);
}

.size-btn.active {
  color: var(--cyan);
  border-color: var(--cyan);
  background: rgba(30, 60, 110, 0.85);
  box-shadow: 0 0 14px rgba(56, 243, 255, 0.4);
}

/* ---- shared modal polish ---- */
.net-panel {
  max-width: 520px;
  width: min(520px, calc(100% - 32px));
  padding: 32px 34px 28px;
}

.net-panel .modal-tag {
  color: var(--cyan);
}

.net-panel .modal-title {
  text-shadow: 0 0 20px rgba(56, 243, 255, 0.5);
}

.cta-col .cta.hidden {
  display: none;
}

.cta-col .cta:disabled {
  cursor: not-allowed;
  animation: none;
  box-shadow: none;
  filter: grayscale(0.6);
}

/* ---- matchmaking radar ---- */
.radar {
  position: relative;
  width: 120px;
  height: 120px;
  margin: 4px auto 14px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: radial-gradient(circle, rgba(56, 243, 255, 0.12), transparent 70%);
}

.radar span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--cyan);
  opacity: 0;
  animation: radarPing 2.4s ease-out infinite;
}

.radar span:nth-child(2) {
  animation-delay: 0.8s;
}

.radar span:nth-child(3) {
  animation-delay: 1.6s;
}

@keyframes radarPing {
  0% {
    transform: scale(0.15);
    opacity: 0.9;
  }

  100% {
    transform: scale(1);
    opacity: 0;
  }
}

.mm-timer {
  font-family: var(--font-display);
  font-size: 16px;
  letter-spacing: 2px;
  color: var(--cyan);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}

/* ---- private room lobby ---- */
.room-code {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(34px, 9vw, 54px);
  letter-spacing: 0.28em;
  padding: 10px 0 10px 0.28em;
  margin: 4px 0 14px;
  border-radius: 14px;
  user-select: all;
  color: #fff;
  text-shadow: 0 0 24px rgba(56, 243, 255, 0.8);
  background: rgba(56, 243, 255, 0.07);
  border: 1px dashed var(--cyan-soft);
}

.room-link-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.room-link {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  background: rgba(8, 12, 26, 0.8);
  border: 1px solid var(--line);
}

.room-link-row .cta-secondary {
  flex: 0 0 auto;
  padding: 10px 14px;
  font-size: 11px;
  letter-spacing: 1.5px;
}

.slot-list {
  list-style: none;
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding: 0;
  text-align: left;
}

.slot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.slot.open {
  opacity: 0.55;
  border-style: dashed;
}

.slot-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 10px currentColor;
}

.slot-name {
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 2px;
  flex: 1;
}

.slot-tag {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 1.5px;
  padding: 3px 8px;
  border-radius: 6px;
  color: #02121a;
  background: var(--amber);
}

.slot-tag:nth-of-type(2) {
  background: var(--cyan);
}

/* ---- join room ---- */
.join-code {
  width: 100%;
  text-align: center;
  text-transform: uppercase;
  padding: 14px 0 14px 0.3em;
  margin: 4px 0 8px;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 34px;
  letter-spacing: 0.3em;
  color: #fff;
  background: rgba(8, 12, 26, 0.85);
  border: 1px solid var(--cyan-soft);
  border-radius: 14px;
  outline: none;
}

.join-code:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 24px rgba(56, 243, 255, 0.4);
}

.join-error {
  min-height: 22px;
  color: var(--red);
  font-size: 15px;
  margin-bottom: 14px;
}

/* ---- connection banner ---- */
#conn-banner {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 40;
  padding: 8px 18px;
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 2px;
  border-radius: 999px;
  color: #1c1200;
  background: var(--amber);
  box-shadow: 0 0 24px rgba(255, 182, 64, 0.6);
  animation: connPulse 1.2s ease-in-out infinite;
}

#conn-banner.hidden {
  display: none;
}

@keyframes connPulse {
  50% {
    opacity: 0.65;
  }
}

/* ---- HUD status per opponent (booleans only: locked / waiting / offline / out) ---- */
.team-status[data-state='choosing'] {
  color: var(--cyan);
}

.team-status[data-state='locked'] {
  color: var(--green);
}

.team-status[data-state='offline'] {
  color: var(--amber);
  animation: connPulse 1.2s ease-in-out infinite;
}

.team-status[data-state='out'] {
  color: var(--red);
}

.team-card.me {
  box-shadow: 0 0 0 1px rgba(56, 243, 255, 0.4), 0 0 22px rgba(56, 243, 255, 0.18);
}

/* =====================================================================
   Mobile Landscape Recommendation Prompt
   ===================================================================== */
.landscape-prompt {
  position: fixed;
  top: max(12px, env(safe-area-inset-top, 12px));
  left: 50%;
  transform: translateX(-50%);
  width: min(460px, calc(100% - 20px));
  z-index: 100;
  pointer-events: auto;
  animation: slideDown 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.landscape-prompt.hidden {
  display: none !important;
}

.lp-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 14px;
  background: linear-gradient(140deg, rgba(8, 18, 36, 0.94), rgba(4, 10, 22, 0.97));
  border: 1px solid var(--cyan);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.75), 0 0 20px rgba(56, 243, 255, 0.3);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.lp-icon-box {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--cyan);
}

.lp-phone-svg {
  width: 30px;
  height: 30px;
  animation: rotatePhone 2.6s ease-in-out infinite;
}

@keyframes rotatePhone {

  0%,
  25% {
    transform: rotate(0deg);
  }

  55%,
  80% {
    transform: rotate(-90deg);
  }

  95%,
  100% {
    transform: rotate(0deg);
  }
}

.lp-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lp-badge {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 1.5px;
  color: var(--cyan);
  font-weight: 700;
}

.lp-text {
  font-size: 13px;
  color: var(--text);
  line-height: 1.3;
  margin: 0;
}

.lp-text b {
  color: var(--cyan);
}

.lp-dismiss {
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  transition: all 0.15s ease;
}

.lp-dismiss:hover,
.lp-dismiss:active {
  background: rgba(255, 61, 90, 0.25);
  border-color: var(--red);
  color: #fff;
}

@media (orientation: landscape) {
  .landscape-prompt {
    display: none !important;
  }
}

/* =====================================================================
   Comprehensive Mobile & Tablet Responsive Layouts
   ===================================================================== */

/* ---------- Tablet Screens (601px to 980px) ---------- */
@media (max-width: 980px) {

  /* Top HUD on Tablet */
  #hud-top {
    top: max(8px, env(safe-area-inset-top, 8px));
    width: min(calc(100% - 20px), 940px);
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: start;
    gap: 8px;
  }

  .team-card {
    padding: 6px 10px;
    gap: 8px;
    border-radius: 12px;
    min-width: 0;
  }

  .team-emblem {
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
  }

  .team-emblem::after {
    inset: 9px 5px 12px;
  }

  .team-name {
    font-size: 12px;
    letter-spacing: 1.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 140px;
  }

  .tag {
    font-size: 8px;
    padding: 1px 4px;
    letter-spacing: 1px;
  }

  .team-status {
    font-size: 9px;
    letter-spacing: 1px;
    margin-top: 2px;
  }

  .team-meta {
    display: none;
  }

  #timer-wrap {
    min-width: 130px;
    padding: 6px 14px 8px;
    border-radius: 0 0 20px 20px;
  }

  #timer {
    width: 54px;
    height: 54px;
    margin: 3px 0;
  }

  #timer-num {
    font-size: 18px;
  }

  #phase-label {
    font-size: 9px;
    letter-spacing: 2px;
  }

  #round-label {
    font-size: 8px;
    letter-spacing: 1.5px;
  }

  .timer-exit-btn {
    font-size: 9px;
    padding: 3px 8px;
    letter-spacing: 1px;
  }

  /* Action Bar on Tablet: Single balanced row with flexible items */
  #action-bar {
    bottom: max(8px, env(safe-area-inset-bottom, 8px));
    width: min(calc(100% - 16px), 760px);
    padding: 8px 10px;
    gap: 8px;
    border-radius: 16px;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: stretch;
  }

  .pos-control-wrap {
    flex: 0 0 auto;
    display: flex;
  }

  .pos-btn {
    width: auto;
    min-width: 95px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  .pos-btn svg {
    position: static;
    transform: none;
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
  }

  .pos-btn .w-name {
    font-size: 10px;
    letter-spacing: 1px;
  }

  .pos-btn .w-desc {
    font-size: 9px;
  }

  .pos-btn kbd,
  .weapon kbd {
    display: none;
  }

  .weapons {
    gap: 6px;
    flex: 1;
    min-width: 0;
    display: flex;
  }

  .weapon {
    width: auto;
    flex: 1;
    min-width: 0;
    padding: 8px 6px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
  }

  .weapon svg {
    position: static;
    transform: none;
    width: 26px;
    height: 26px;
    margin-bottom: 2px;
  }

  .weapon .w-name {
    font-size: 10px;
    letter-spacing: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .weapon .w-desc {
    display: none;
  }

  .controls {
    gap: 4px;
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .controls button {
    padding: 6px 10px;
    font-size: 10px;
    letter-spacing: 1px;
    min-width: 90px;
  }

  .lock {
    min-width: 90px;
  }

  #hint {
    bottom: 96px;
    font-size: 11px;
    padding: 6px 14px;
    white-space: normal;
    text-align: center;
    max-width: calc(100% - 20px);
  }

  /* Start Screen & Menu on Tablet */
  .overlay .panel {
    width: min(840px, calc(100% - 32px));
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding: 28px 24px 22px;
  }

  .menu-header-row {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
  }

  .player-callsign-wrap {
    width: auto;
  }

  .menu-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }

  .rules {
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-bottom: 16px;
  }

  .rule {
    padding: 10px 12px;
    gap: 10px;
  }

  .rule b {
    font-size: 16px;
  }

  .rule h3 {
    font-size: 11px;
    letter-spacing: 2px;
  }

  .rule p {
    font-size: 12px;
  }

  .cta-row {
    gap: 8px;
    margin: 10px 0;
  }

  .cta-secondary {
    padding: 12px 10px;
    font-size: 11px;
    letter-spacing: 1px;
    white-space: nowrap;
  }

  /* Scorecard & Modals on Tablet */
  .scorecard-panel {
    width: min(920px, calc(100% - 24px));
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }

  .scorecard-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 10px 16px;
  }

  .scorecard-tabs {
    display: none;
  }

  .net-panel {
    width: min(500px, calc(100% - 24px));
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
  }
}

/* ---------- Mobile Portrait Screens (<= 640px) ---------- */
@media (max-width: 640px) {

  /* Panels and Overlays */
  .overlay {
    padding: max(8px, env(safe-area-inset-top, 8px)) max(8px, env(safe-area-inset-right, 8px)) max(8px, env(safe-area-inset-bottom, 8px)) max(8px, env(safe-area-inset-left, 8px));
    box-sizing: border-box;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .overlay .panel {
    padding: 16px 12px 14px;
    width: 100%;
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 16px;
    box-sizing: border-box;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }

  .overlay .panel::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
  }

  .title {
    font-size: clamp(28px, 8.5vw, 44px);
    letter-spacing: 0.08em;
    margin: 4px 0 10px;
  }

  .kicker {
    font-size: 9px;
    letter-spacing: 2px;
  }

  /* Menu Header Row (Combat mode label + Player Callsign Box) */
  .menu-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding: 0;
  }

  .mode-label {
    text-align: center;
    font-size: 10px;
    letter-spacing: 2px;
  }

  .player-callsign-wrap {
    width: 100%;
    justify-content: space-between;
    padding: 6px 10px;
    border-radius: 10px;
    box-sizing: border-box;
  }

  .callsign-label {
    font-size: 10px;
    letter-spacing: 1.5px;
    white-space: nowrap;
  }

  .callsign-box {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .player-name-input {
    width: 95px;
    font-size: 12px;
    letter-spacing: 1.5px;
  }

  .btn-lock-name {
    padding: 4px 8px;
    font-size: 9px;
  }

  .menu-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .menu-btn {
    padding: 10px 12px;
    gap: 10px;
    border-radius: 12px;
  }

  .menu-btn .m-badge {
    min-width: 36px;
    padding: 6px 4px;
    font-size: 11px;
  }

  .menu-btn .m-title {
    font-size: 12px;
    letter-spacing: 1px;
  }

  .menu-btn .m-sub {
    font-size: 11px;
    line-height: 1.25;
  }

  .size-pick {
    padding: 6px 8px;
    justify-content: space-between;
    border-radius: 10px;
  }

  .size-label {
    font-size: 9px;
    letter-spacing: 1.5px;
  }

  .size-btn {
    flex: 1;
    height: 36px;
    min-width: 44px;
    font-size: 13px;
  }

  .rules {
    grid-template-columns: 1fr;
    gap: 6px;
    margin-bottom: 12px;
  }

  .rule {
    padding: 8px 10px;
    gap: 10px;
  }

  .rule b {
    font-size: 15px;
  }

  .rule h3 {
    font-size: 10px;
    letter-spacing: 1.5px;
  }

  .rule p {
    font-size: 11px;
    line-height: 1.35;
  }

  .cta-row {
    flex-direction: column;
    gap: 8px;
    margin: 8px 0;
  }

  .cta-row .cta,
  .cta-row .cta-secondary {
    width: 100%;
    padding: 12px 14px;
    font-size: 12px;
    letter-spacing: 1.5px;
    box-sizing: border-box;
  }

  .controls-hint {
    font-size: 10px;
    margin-top: 8px;
  }

  /* Modals on Mobile */
  .net-panel {
    padding: 14px 12px 14px;
    width: 100%;
    border-radius: 16px;
    box-sizing: border-box;
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
  }

  .modal-title {
    font-size: 17px;
    margin-bottom: 6px;
  }

  .room-code {
    font-size: clamp(20px, 6.5vw, 28px);
    letter-spacing: 0.16em;
    padding: 6px 0 6px 0.16em;
    margin: 2px 0 8px;
    border-radius: 10px;
  }

  .room-link-row {
    display: flex;
    flex-direction: row;
    gap: 6px;
    margin-bottom: 8px;
    align-items: stretch;
  }

  .room-link {
    flex: 1;
    min-width: 0;
    font-size: 11px;
    padding: 6px 8px;
    height: 36px;
    box-sizing: border-box;
    border-radius: 8px;
  }

  .room-link-row .cta-secondary {
    width: auto;
    flex: 0 0 auto;
    padding: 6px 10px;
    height: 36px;
    font-size: 10px;
    letter-spacing: 1px;
    white-space: nowrap;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
  }

  .slot-list {
    gap: 5px;
    margin: 4px 0 8px;
  }

  .slot {
    padding: 6px 8px;
    gap: 6px;
    border-radius: 8px;
  }

  .slot-dot {
    width: 10px;
    height: 10px;
    flex: 0 0 auto;
  }

  .slot-name {
    font-size: 11px;
    letter-spacing: 1px;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .slot-tag {
    font-size: 8px;
    letter-spacing: 0.5px;
    padding: 2px 5px;
    border-radius: 4px;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .room-ready-section {
    margin: 6px 0 8px;
    padding: 8px 10px;
    gap: 6px;
    border-radius: 10px;
  }

  .lobby-action-row {
    display: flex;
    gap: 6px;
    width: 100%;
    align-items: stretch;
  }

  .lobby-action-row .cta {
    flex: 1;
    min-width: 0;
    padding: 8px 6px;
    font-size: 11px;
    letter-spacing: 1px;
    height: 42px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    border-radius: 10px;
  }

  .room-ready-status {
    font-size: 9px;
    letter-spacing: 1px;
  }

  #room-status {
    font-size: 10px;
    margin: 2px 0 6px;
    line-height: 1.25;
  }

  .exit-panel {
    max-width: min(380px, 100%);
    margin: 0 auto;
  }

  .join-code {
    font-size: 24px;
    height: 46px;
    letter-spacing: 0.2em;
  }

  .manual-panel {
    width: 100%;
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }

  .manual-header {
    padding: 10px 12px;
  }

  .manual-title {
    font-size: 15px;
    letter-spacing: 1.5px;
  }

  .manual-content {
    padding: 10px 12px;
    gap: 10px;
  }

  .manual-section {
    padding: 8px 10px;
  }

  .sec-title {
    font-size: 12px;
  }

  .manual-footer {
    padding: 8px 12px;
    flex-direction: column;
    gap: 6px;
  }

  .manual-footer .cta,
  .manual-footer .cta-secondary {
    width: 100%;
    padding: 10px;
    font-size: 11px;
  }

  /* Toast notification on mobile */
  #toast {
    top: max(60px, env(safe-area-inset-top, 60px));
    font-size: 12px;
    padding: 6px 14px;
    max-width: min(360px, calc(100% - 24px));
    box-sizing: border-box;
  }

  /* Banners on mobile */
  #banner h2 {
    font-size: clamp(22px, 6vw, 34px);
    letter-spacing: 0.1em;
  }

  #banner p {
    font-size: clamp(10px, 2.8vw, 13px);
    letter-spacing: 0.15em;
  }

  /* 3D Simulation Tutorial Card on mobile */
  #tutorial-screen {
    padding: 0 8px max(8px, env(safe-area-inset-bottom, 8px)) 8px;
  }

  .tutorial-card {
    width: 100%;
    border-radius: 14px;
  }

  .tut-header {
    padding: 6px 10px;
    flex-wrap: wrap;
    gap: 6px;
  }

  .tut-tag-group {
    gap: 6px;
    flex-wrap: wrap;
  }

  .tut-tag,
  .tut-step-num {
    font-size: 9px;
    letter-spacing: 1px;
  }

  .tut-manual-btn,
  .tut-close-btn {
    font-size: 9px;
    padding: 2px 6px;
  }

  .tut-main-row {
    padding: 8px 10px 10px;
    gap: 8px;
  }

  .tut-title {
    font-size: 14px;
    letter-spacing: 1px;
  }

  .tut-desc {
    font-size: 11px;
    line-height: 1.35;
  }

  .tut-bullet {
    font-size: 10px;
    padding: 4px 8px;
  }

  .tut-footer {
    gap: 6px;
  }

  .tut-footer .cta,
  .tut-footer .ghost {
    padding: 6px 10px;
    font-size: 10px;
    letter-spacing: 1px;
  }

  /* Compact Action Bar in Portrait Mobile: 2-tier stacked with perfect alignment */
  #action-bar {
    width: calc(100% - 14px);
    flex-wrap: wrap;
    padding: 7px;
    gap: 6px;
    border-radius: 16px;
    bottom: max(8px, env(safe-area-inset-bottom, 8px));
    box-sizing: border-box;
  }

  /* Row 1: 4 action buttons (Position, Laser, Grenade, Mines) */
  .pos-control-wrap {
    flex: 1 1 calc(25% - 5px);
    min-width: 0;
    display: flex;
  }

  .weapons {
    flex: 3 3 calc(75% - 5px);
    min-width: 0;
    gap: 5px;
    display: flex;
  }

  .pos-btn,
  .weapon {
    width: 100%;
    min-width: 0;
    height: 48px;
    padding: 4px 2px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    box-sizing: border-box;
  }

  .pos-btn svg,
  .weapon svg {
    position: static;
    transform: none;
    width: 20px;
    height: 20px;
    margin-bottom: 2px;
  }

  .pos-btn .w-name,
  .weapon .w-name {
    font-size: 9px;
    letter-spacing: 0.8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .pos-btn .w-desc,
  .weapon .w-desc {
    display: none !important;
  }

  .pos-btn kbd,
  .weapon kbd {
    display: none !important;
  }

  /* Row 2: Controls spanning full width */
  .controls {
    flex: 1 0 100%;
    width: 100%;
    display: flex;
    flex-direction: row;
    gap: 6px;
    margin-top: 1px;
  }

  .controls button {
    height: 42px;
    border-radius: 10px;
    font-size: 11px;
    letter-spacing: 1px;
    min-width: 0;
  }

  #btn-axis {
    flex: 1;
  }

  #btn-lock {
    flex: 1.4;
    font-size: 12px;
    letter-spacing: 1.5px;
  }

  /* Tactical Hint positioned cleanly ABOVE the 2-tier action bar */
  #hint {
    bottom: calc(max(8px, env(safe-area-inset-bottom, 8px)) + 116px);
    font-size: 11px;
    padding: 6px 14px;
    white-space: normal;
    text-align: center;
    max-width: calc(100% - 20px);
  }

  /* Top HUD in Narrow Portrait */
  #hud-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 4px;
    width: calc(100% - 10px);
    top: max(6px, env(safe-area-inset-top, 6px));
  }

  #hud-players-left,
  #hud-players-right {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
  }

  .team-card {
    padding: 4px 6px;
    border-radius: 8px;
    gap: 6px;
    min-width: 0;
    width: 100%;
    box-sizing: border-box;
  }

  .team-emblem {
    width: 24px;
    height: 24px;
    flex: 0 0 auto;
  }

  .team-info {
    min-width: 0;
    flex: 1;
  }

  .team-name {
    font-size: 10px;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }

  .tag {
    font-size: 8px;
    padding: 1px 4px;
  }

  .team-status {
    font-size: 8px;
    letter-spacing: 0.5px;
  }

  .team-meta {
    display: none;
  }

  #timer-wrap {
    min-width: 76px;
    padding: 3px 6px 5px;
    flex: 0 0 auto;
    border-radius: 0 0 14px 14px;
  }

  #timer {
    width: 42px;
    height: 42px;
    margin: 1px 0;
  }

  #timer-num {
    font-size: 15px;
  }

  #phase-label {
    font-size: 8px;
    letter-spacing: 1px;
  }

  #round-label {
    font-size: 7px;
  }

  .timer-exit-btn {
    font-size: 8px;
    padding: 2px 6px;
    margin-top: 3px;
  }

  /* Scorecard on Mobile */
  .scorecard-panel {
    width: calc(100% - 16px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
    border-radius: 16px;
  }

  .scorecard-header {
    padding: 12px 14px 8px;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .scorecard-title {
    font-size: 18px;
  }

  .scorecard-desc {
    margin: 2px 14px 6px;
    font-size: 11px;
  }

  .scorecard-tabs {
    display: flex;
    gap: 6px;
    padding: 4px 14px 8px;
  }

  .score-tab-btn {
    padding: 7px 8px;
    font-size: 10px;
    letter-spacing: 1px;
    text-align: center;
  }

  .scorecard-grid {
    grid-template-columns: 1fr;
    padding: 6px 12px;
    gap: 10px;
  }

  .scorecard-col.hidden-tab {
    display: none !important;
  }

  .score-table-header,
  .score-row {
    grid-template-columns: 36px 1fr 50px;
    padding: 6px 8px;
    font-size: 11px;
  }

  .score-rows-container {
    max-height: 240px;
    min-height: 140px;
  }

  .scorecard-footer {
    padding: 8px 12px;
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }

  #btn-scorecard-scroll-me {
    width: 100%;
    height: 38px;
    font-size: 11px;
  }

  /* Name Modal on Mobile */
  .name-modal-panel {
    width: calc(100% - 20px);
    padding: 20px 16px 16px;
  }

  .name-modal-input {
    height: 48px;
    font-size: 18px;
    padding: 0 48px 0 16px;
  }

  /* Celebratory Display on Mobile */
  .celebration-card {
    padding: 24px 16px;
    width: min(340px, calc(100% - 24px));
    border-radius: 20px;
  }

  .celebration-title {
    font-size: clamp(16px, 4.5vw, 22px);
    letter-spacing: 2px;
  }

  .celebration-scene {
    width: 180px;
    height: 140px;
    margin: 4px 0 14px;
  }

  .cel-ring.ring-a {
    width: 140px;
    height: 140px;
  }

  .cel-ring.ring-b {
    width: 165px;
    height: 165px;
  }

  .cel-ring.ring-c {
    width: 110px;
    height: 110px;
  }

  .holo-slice {
    font-size: clamp(64px, 16vw, 92px);
  }

  .celebration-tier {
    font-size: 9px;
    padding: 4px 12px;
    margin-bottom: 14px;
  }
}

/* ---------- Mobile Landscape (Low height screens: height <= 520px) ---------- */
@media (max-height: 520px) and (orientation: landscape) {
  #start-screen .panel {
    max-height: calc(100vh - 12px);
    max-height: calc(100dvh - 12px);
    padding: 12px 16px;
  }

  .title {
    font-size: 24px;
    margin: 2px 0 6px;
  }

  .rules {
    display: none;
    /* Auto-collapse verbose rules in low-height landscape so menu fits on screen */
  }

  .menu-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 6px;
  }

  .menu-btn {
    padding: 6px 10px;
    border-radius: 10px;
  }

  .menu-wrap {
    margin: 2px 0 6px;
  }

  .cta-row {
    flex-direction: row !important;
    margin: 4px 0;
    gap: 8px;
  }

  .cta-row .cta,
  .cta-row .cta-secondary {
    padding: 8px 14px;
    font-size: 11px;
    letter-spacing: 1px;
  }

  .controls-hint {
    display: none;
  }

  #hud-top {
    top: max(4px, env(safe-area-inset-top, 4px));
    gap: 6px;
  }

  .team-card {
    padding: 3px 8px;
  }

  .team-emblem {
    width: 24px;
    height: 24px;
  }

  #timer-wrap {
    padding: 2px 10px 4px;
    min-width: 110px;
  }

  #timer {
    width: 36px;
    height: 36px;
    margin: 1px 0;
  }

  #timer-num {
    font-size: 13px;
  }

  #phase-label {
    font-size: 8px;
    letter-spacing: 1px;
  }

  #round-label {
    font-size: 7px;
  }

  #action-bar {
    bottom: max(4px, env(safe-area-inset-bottom, 4px));
    padding: 4px 8px;
    gap: 6px;
    flex-wrap: nowrap !important;
    height: 42px;
  }

  .pos-control-wrap {
    flex: 0 0 auto !important;
  }

  .weapons {
    flex: 1 !important;
    gap: 4px;
  }

  .pos-btn,
  .weapon {
    padding: 3px 6px;
    height: 34px;
  }

  .pos-btn svg,
  .weapon svg {
    width: 18px;
    height: 18px;
    margin-bottom: 1px;
  }

  .pos-btn .w-name,
  .weapon .w-name {
    font-size: 8px;
    letter-spacing: 0.5px;
  }

  .pos-btn .w-desc,
  .weapon .w-desc {
    display: none !important;
  }

  .controls {
    flex: 0 0 auto !important;
    flex-direction: row !important;
    gap: 4px;
  }

  .controls button {
    padding: 4px 8px;
    font-size: 9px;
    height: 34px;
    min-width: auto;
  }

  #btn-lock {
    min-width: 76px;
  }

  #hint {
    bottom: 52px;
    font-size: 10px;
    padding: 2px 10px;
  }

  .net-panel {
    padding: 10px 14px;
    max-height: calc(100vh - 8px);
    max-height: calc(100dvh - 8px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .lobby-action-row {
    display: flex;
    gap: 6px;
  }

  .lobby-action-row .cta {
    padding: 6px 10px;
    height: 36px;
    font-size: 10px;
  }

  .radar {
    width: 60px;
    height: 60px;
    margin: 2px auto 6px;
  }

  .mm-timer {
    font-size: 12px;
    margin-bottom: 3px;
  }

  .room-code {
    font-size: 24px;
    padding: 3px 0;
    margin: 2px 0 6px;
  }
}

/* =====================================================================
   Room Ready Section & Player Slots
   ===================================================================== */
.room-ready-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px 0 14px;
  padding: 12px 14px;
  background: rgba(8, 16, 32, 0.7);
  border: 1px solid rgba(56, 243, 255, 0.2);
  border-radius: 12px;
}

.lobby-action-row {
  display: flex;
  gap: 10px;
  width: 100%;
  align-items: stretch;
}

.lobby-action-row .cta {
  flex: 1;
  min-width: 0;
}

.lobby-action-row .cta.hidden {
  display: none !important;
}

#btn-room-start:not(:disabled) {
  animation: readyPulse 1.1s infinite;
  box-shadow: 0 0 30px rgba(56, 243, 255, 0.8);
}

.cta-ready {
  background: linear-gradient(135deg, rgba(20, 80, 60, 0.9), rgba(12, 40, 30, 0.95)) !important;
  border-color: var(--green) !important;
  color: #fff !important;
  box-shadow: 0 0 16px rgba(46, 230, 107, 0.3) !important;
  padding: 12px 18px !important;
  font-size: 13px !important;
  letter-spacing: 2px !important;
  transition: all 0.2s ease !important;
}

.cta-ready:hover {
  box-shadow: 0 0 28px rgba(46, 230, 107, 0.6) !important;
  transform: translateY(-1px);
}

.cta-ready.is-ready {
  background: linear-gradient(135deg, #1aa34a, #0d662c) !important;
  border-color: #5bff9b !important;
  color: #fff !important;
  box-shadow: 0 0 25px rgba(46, 230, 107, 0.7) !important;
}

.room-ready-status {
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--muted);
  text-align: center;
}

.room-ready-status.all-ready {
  color: var(--green);
  text-shadow: 0 0 10px rgba(46, 230, 107, 0.5);
  font-weight: 700;
}

.slot-tag.ready {
  background: var(--green);
  color: #02121a;
  box-shadow: 0 0 8px rgba(46, 230, 107, 0.6);
  font-weight: 900;
}

.slot-tag.waiting {
  background: rgba(255, 255, 255, 0.12);
  color: var(--muted);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

/* =====================================================================
   Scorecard / Leaderboard Modal & Two Columns
   ===================================================================== */
.scorecard-panel {
  width: min(940px, calc(100% - 24px));
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  background: rgba(8, 14, 28, 0.94);
  border: 1px solid rgba(56, 243, 255, 0.45);
  border-radius: var(--radius);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.95), 0 0 45px rgba(56, 243, 255, 0.25);
  overflow: hidden;
  animation: scaleIn 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.scorecard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px 10px;
  border-bottom: 1px solid rgba(56, 243, 255, 0.18);
  background: rgba(0, 0, 0, 0.4);
}

.scorecard-title-wrap {
  text-align: left;
}

.scorecard-title {
  font-family: var(--font-display);
  font-size: 24px;
  letter-spacing: 2.5px;
  color: #fff;
  margin: 0;
  text-shadow: 0 0 16px rgba(56, 243, 255, 0.5);
}

.scorecard-desc {
  font-size: 13px;
  color: var(--muted);
  margin: 6px 24px 8px;
  text-align: left;
  letter-spacing: 0.5px;
}

.scorecard-tabs {
  display: none;
  gap: 8px;
  padding: 4px 20px 10px;
  background: rgba(0, 0, 0, 0.2);
}

.score-tab-btn {
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.5px;
  cursor: pointer;
  background: rgba(12, 22, 42, 0.8);
  border: 1px solid rgba(56, 243, 255, 0.2);
  color: var(--muted);
  transition: all 0.2s;
}

.score-tab-btn.active {
  color: #fff;
  border-color: var(--cyan);
  background: rgba(20, 60, 100, 0.85);
  box-shadow: 0 0 14px rgba(56, 243, 255, 0.4);
}

.scorecard-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 12px 24px;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.scorecard-col {
  display: flex;
  flex-direction: column;
  background: rgba(4, 9, 20, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px 14px;
  min-height: 0;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.5);
}

.scorecard-col.col-humans {
  border-top: 3px solid var(--cyan);
}

.scorecard-col.col-warden {
  border-top: 3px solid var(--magenta);
}

.score-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.col-headline {
  font-family: var(--font-display);
  font-size: 14px;
  letter-spacing: 2px;
  color: #fff;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.col-badge {
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 1.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
}

.score-table-header {
  display: grid;
  grid-template-columns: 46px 1fr 65px;
  gap: 8px;
  padding: 6px 10px;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 2px;
  color: var(--muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.th-wins {
  text-align: right;
}

.score-rows-container {
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 2px;
  flex: 1;
  min-height: 180px;
  max-height: 380px;
  scrollbar-width: thin;
  scrollbar-color: var(--cyan) rgba(0, 0, 0, 0.4);
}

.score-rows-container::-webkit-scrollbar {
  width: 5px;
}

.score-rows-container::-webkit-scrollbar-thumb {
  background: rgba(56, 243, 255, 0.4);
  border-radius: 4px;
}

.score-row {
  display: grid;
  grid-template-columns: 46px 1fr 65px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
  font-family: var(--font-display);
  font-size: 13px;
  letter-spacing: 1.5px;
  color: var(--text);
  transition: all 0.2s ease;
}

.score-row:hover {
  background: rgba(56, 243, 255, 0.08);
  border-color: rgba(56, 243, 255, 0.3);
}

.score-rank {
  font-weight: 900;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
}

.score-row.rank-1 .score-rank {
  color: #ffd700;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.6);
}

.score-row.rank-2 .score-rank {
  color: #d1d5db;
  text-shadow: 0 0 10px rgba(209, 213, 219, 0.6);
}

.score-row.rank-3 .score-rank {
  color: #cd7f32;
  text-shadow: 0 0 10px rgba(205, 127, 50, 0.6);
}

.score-name {
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 6px;
}

.score-wins {
  text-align: right;
  font-weight: 900;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

.score-row.is-me {
  background: linear-gradient(90deg, rgba(56, 243, 255, 0.18), rgba(12, 36, 68, 0.35)) !important;
  border: 1px solid var(--cyan) !important;
  box-shadow: 0 0 18px rgba(56, 243, 255, 0.4), inset 0 0 10px rgba(56, 243, 255, 0.15) !important;
}

.score-row.is-me .score-name {
  color: var(--cyan);
  text-shadow: 0 0 8px rgba(56, 243, 255, 0.6);
}

.score-row.rank-highlight-pulse {
  animation: rankPulse 1.6s ease-in-out infinite;
}

@keyframes rankPulse {

  0%,
  100% {
    box-shadow: 0 0 18px rgba(56, 243, 255, 0.4);
  }

  50% {
    box-shadow: 0 0 32px rgba(56, 243, 255, 0.85);
  }
}

.you-pill {
  font-size: 8px;
  letter-spacing: 1px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--cyan);
  color: #02121a;
  font-weight: 900;
}

.scorecard-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  border-top: 1px solid rgba(56, 243, 255, 0.18);
  background: rgba(0, 0, 0, 0.4);
}

.scorecard-user-info {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-info-label {
  color: var(--muted);
}

.user-info-name {
  color: var(--cyan);
  font-weight: 900;
  text-shadow: 0 0 10px rgba(56, 243, 255, 0.6);
}

/* =====================================================================
   Holographic Digital Countdown 3, 2, 1
   ===================================================================== */
.holo-countdown {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(6, 18, 38, 0.75), rgba(2, 4, 10, 0.9));
  animation: fadeIn 0.3s;
}

.holo-countdown.hidden {
  display: none !important;
}

.holo-count-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  perspective: 1000px;
}

.holo-count-tag {
  font-family: var(--font-display);
  font-size: clamp(11px, 2.5vw, 15px);
  letter-spacing: 6px;
  color: var(--cyan);
  font-weight: 700;
  margin-bottom: 12px;
  text-shadow: 0 0 14px var(--cyan);
}

.holo-disc-wrap {
  position: relative;
  width: min(280px, 70vw);
  height: min(280px, 70vw);
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
}

.holo-3d-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}

.holo-ring-1 {
  border: 2px dashed rgba(56, 243, 255, 0.6);
  box-shadow: 0 0 25px rgba(56, 243, 255, 0.4);
  animation: holoSpinRing 6s linear infinite;
}

.holo-ring-2 {
  inset: 18px;
  border: 1.5px solid rgba(255, 61, 242, 0.5);
  box-shadow: 0 0 20px rgba(255, 61, 242, 0.3);
  animation: holoSpinRingRev 4.5s linear infinite;
}

.holo-ring-3 {
  inset: 38px;
  border: 2px dotted rgba(56, 243, 255, 0.8);
  animation: holoSpinRing 3s linear infinite;
}

@keyframes holoSpinRing {
  0% {
    transform: rotateZ(0deg) rotateX(25deg);
  }

  100% {
    transform: rotateZ(360deg) rotateX(25deg);
  }
}

@keyframes holoSpinRingRev {
  0% {
    transform: rotateZ(360deg) rotateY(25deg);
  }

  100% {
    transform: rotateZ(0deg) rotateY(25deg);
  }
}

.holo-digital-number {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(80px, 22vw, 150px);
  line-height: 1;
  text-align: center;
  white-space: nowrap;
  color: #fff;
  text-shadow: 0 0 30px #38f3ff, 0 0 60px #38f3ff, 0 0 100px rgba(56, 243, 255, 0.8);
  animation: holoDigitPop 0.8s cubic-bezier(0.18, 0.89, 0.32, 1.28) infinite;
  transform-style: preserve-3d;
  transform-origin: center center;
  pointer-events: none;
}

.holo-digital-number.is-word {
  font-size: clamp(34px, 9.5vw, 68px);
  letter-spacing: clamp(4px, 1.5vw, 8px);
  text-indent: clamp(4px, 1.5vw, 8px);
  color: #7dff8c;
  text-shadow: 0 0 30px #7dff8c, 0 0 60px rgba(125, 255, 140, 0.8), 0 0 90px rgba(56, 243, 255, 0.8);
}

@keyframes holoDigitPop {
  0% {
    transform: translate(-50%, -50%) scale(1.3) rotateY(-20deg);
    opacity: 0;
    filter: blur(4px);
  }

  25% {
    transform: translate(-50%, -50%) scale(1.0) rotateY(0deg);
    opacity: 1;
    filter: blur(0);
  }

  85% {
    transform: translate(-50%, -50%) scale(0.98);
    opacity: 1;
  }

  100% {
    transform: translate(-50%, -50%) scale(0.9);
    opacity: 0.6;
  }
}

.holo-count-sub {
  font-family: var(--font-display);
  font-size: clamp(11px, 2.2vw, 13px);
  letter-spacing: 3px;
  color: var(--muted);
  margin-top: 14px;
}

/* =====================================================================
   End Screen: Rotating Holographic Digital Top 10 Rank
   ===================================================================== */
.end-holo-rank {
  margin: 18px auto 22px;
  padding: 16px 20px;
  max-width: 380px;
  background: linear-gradient(135deg, rgba(8, 24, 48, 0.85), rgba(4, 12, 26, 0.95));
  border: 1px solid rgba(56, 243, 255, 0.6);
  border-radius: 18px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 0 35px rgba(56, 243, 255, 0.35), inset 0 0 20px rgba(56, 243, 255, 0.2);
  perspective: 600px;
  animation: scaleIn 0.4s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

.end-holo-rank.hidden {
  display: none !important;
}

.holo-rank-scanlines {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(56, 243, 255, 0.05) 3px, rgba(56, 243, 255, 0.05) 6px);
  pointer-events: none;
}

.holo-rank-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(14px, 3.5vw, 18px);
  letter-spacing: 4px;
  color: var(--cyan);
  text-shadow: 0 0 14px var(--cyan);
  margin-bottom: 8px;
}

.holo-3d-scene {
  position: relative;
  height: 100px;
  display: grid;
  place-items: center;
  transform-style: preserve-3d;
}

.holo-cylinder {
  position: absolute;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  border: 1px solid rgba(56, 243, 255, 0.35);
  box-shadow: 0 0 20px rgba(56, 243, 255, 0.25);
  transform: rotateX(75deg);
  pointer-events: none;
}

.holo-ring-axis {
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 61, 242, 0.4);
  transform: rotateX(75deg);
  animation: holoSpinRing 5s linear infinite;
  pointer-events: none;
}

.holo-rotating-number {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(54px, 12vw, 76px);
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 20px #38f3ff, 0 0 45px #38f3ff, 0 0 70px rgba(56, 243, 255, 0.7);
  display: inline-block;
  transform-style: preserve-3d;
  animation: holoNumber3DRotate 4s linear infinite;
}

@keyframes holoNumber3DRotate {
  0% {
    transform: perspective(400px) rotateY(0deg) translateZ(8px);
    text-shadow: 0 0 20px #38f3ff, 0 0 45px #38f3ff;
  }

  25% {
    transform: perspective(400px) rotateY(90deg) translateZ(8px);
    text-shadow: 0 0 10px #38f3ff, 0 0 20px #38f3ff;
  }

  50% {
    transform: perspective(400px) rotateY(180deg) translateZ(8px);
    text-shadow: 0 0 20px #ff3df2, 0 0 45px #ff3df2;
  }

  75% {
    transform: perspective(400px) rotateY(270deg) translateZ(8px);
    text-shadow: 0 0 10px #38f3ff, 0 0 20px #38f3ff;
  }

  100% {
    transform: perspective(400px) rotateY(360deg) translateZ(8px);
    text-shadow: 0 0 20px #38f3ff, 0 0 45px #38f3ff;
  }
}

.holo-rank-badge {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 2px;
  color: #02121a;
  background: linear-gradient(90deg, var(--cyan), #8dffd6);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 900;
  display: inline-block;
  margin-top: 8px;
  box-shadow: 0 0 14px rgba(56, 243, 255, 0.5);
}


/* =====================================================================
   Full-Screen Celebratory Display: World Rank Top 10
   ===================================================================== */
.celebration-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(3, 8, 18, 0.93);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  cursor: pointer;
  user-select: none;
  animation: fadeIn 0.4s ease-out;
}

.celebration-overlay.hidden {
  display: none !important;
}

.celebration-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 50% 50%, rgba(56, 243, 255, 0.2), transparent 60%),
    radial-gradient(circle at 50% 40%, rgba(255, 61, 242, 0.14), transparent 50%),
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(56, 243, 255, 0.04) 3px, rgba(56, 243, 255, 0.04) 6px);
  pointer-events: none;
}

.celebration-card {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 36px 44px;
  max-width: 580px;
  width: 90%;
  background: linear-gradient(135deg, rgba(10, 26, 52, 0.92), rgba(4, 12, 28, 0.98));
  border: 2px solid rgba(56, 243, 255, 0.85);
  border-radius: 28px;
  box-shadow: 0 0 65px rgba(56, 243, 255, 0.5), 0 0 110px rgba(255, 61, 242, 0.3), inset 0 0 35px rgba(56, 243, 255, 0.25);
  animation: scaleIn 0.5s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.celebration-tag {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 5px;
  color: #ff3df2;
  text-shadow: 0 0 12px rgba(255, 61, 242, 0.8);
  margin-bottom: 8px;
}

.celebration-title {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(20px, 4.5vw, 32px);
  letter-spacing: 4px;
  color: #fff;
  text-shadow: 0 0 18px #38f3ff, 0 0 35px #38f3ff;
  margin: 0 0 16px 0;
}

.celebration-scene {
  position: relative;
  width: 220px;
  height: 180px;
  display: grid;
  place-items: center;
  perspective: 600px;
  transform-style: preserve-3d;
  margin: 8px 0 18px;
}

.celebration-3d-rings {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.cel-ring {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
}

.cel-ring.ring-a {
  width: 170px;
  height: 170px;
  border: 2px solid rgba(56, 243, 255, 0.65);
  box-shadow: 0 0 25px rgba(56, 243, 255, 0.5);
  transform: rotateX(72deg);
  animation: celRingSpinA 6s linear infinite;
}

.cel-ring.ring-b {
  width: 205px;
  height: 205px;
  border: 1px dashed rgba(255, 61, 242, 0.6);
  box-shadow: 0 0 22px rgba(255, 61, 242, 0.4);
  transform: rotateX(68deg) rotateY(25deg);
  animation: celRingSpinB 4.5s linear infinite reverse;
}

.cel-ring.ring-c {
  width: 135px;
  height: 135px;
  border: 1.5px dotted rgba(125, 255, 140, 0.65);
  transform: rotateX(78deg);
  animation: celRingSpinA 8s linear infinite;
}

@keyframes celRingSpinA {
  0% {
    transform: rotateX(72deg) rotateZ(0deg);
  }

  100% {
    transform: rotateX(72deg) rotateZ(360deg);
  }
}

@keyframes celRingSpinB {
  0% {
    transform: rotateX(68deg) rotateY(25deg) rotateZ(0deg);
  }

  100% {
    transform: rotateX(68deg) rotateY(25deg) rotateZ(360deg);
  }
}

.celebration-rank-3d {
  position: relative;
  width: 150px;
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  transform-style: preserve-3d;
  animation: celHolo3DRotate 5.2s linear infinite;
}

@keyframes celHolo3DRotate {
  0% {
    transform: rotateX(14deg) rotateY(0deg);
  }

  25% {
    transform: rotateX(6deg) rotateY(90deg);
  }

  50% {
    transform: rotateX(-14deg) rotateY(180deg);
  }

  75% {
    transform: rotateX(-6deg) rotateY(270deg);
  }

  100% {
    transform: rotateX(14deg) rotateY(360deg);
  }
}

.holo-slice {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(88px, 19vw, 138px);
  line-height: 1;
  backface-visibility: visible;
  pointer-events: none;
  user-select: none;
  transform-style: preserve-3d;
}

.slice-f2 {
  transform: translateZ(18px);
  color: rgba(220, 250, 255, 0.45);
  -webkit-text-stroke: 2px rgba(56, 243, 255, 0.95);
  text-shadow: 0 0 20px #38f3ff, 0 0 45px rgba(56, 243, 255, 0.8), 0 0 80px rgba(56, 243, 255, 0.5);
  filter: drop-shadow(0 0 8px rgba(56, 243, 255, 0.7));
}

.slice-f1 {
  transform: translateZ(9px);
  color: rgba(56, 243, 255, 0.28);
  -webkit-text-stroke: 1.5px rgba(56, 243, 255, 0.75);
  text-shadow: 0 0 15px rgba(56, 243, 255, 0.6), 0 0 35px rgba(56, 243, 255, 0.4);
}

.slice-mid {
  transform: translateZ(0px);
  color: rgba(125, 255, 140, 0.32);
  -webkit-text-stroke: 1.5px rgba(125, 255, 140, 0.8);
  text-shadow: 0 0 20px #7dff8c, 0 0 45px rgba(125, 255, 140, 0.6);
}

.slice-b1 {
  transform: translateZ(-9px);
  color: rgba(255, 61, 242, 0.28);
  -webkit-text-stroke: 1.5px rgba(255, 61, 242, 0.75);
  text-shadow: 0 0 15px rgba(255, 61, 242, 0.6), 0 0 35px rgba(255, 61, 242, 0.4);
}

.slice-b2 {
  transform: translateZ(-18px);
  color: rgba(255, 220, 250, 0.45);
  -webkit-text-stroke: 2px rgba(255, 61, 242, 0.95);
  text-shadow: 0 0 20px #ff3df2, 0 0 45px rgba(255, 61, 242, 0.8), 0 0 80px rgba(255, 61, 242, 0.5);
  filter: drop-shadow(0 0 8px rgba(255, 61, 242, 0.7));
}

/* Mandatory Name Modal Styles */
.name-modal-panel {
  max-width: 480px;
  border-color: rgba(56, 243, 255, 0.7);
  box-shadow: 0 0 60px rgba(56, 243, 255, 0.3), inset 0 0 20px rgba(56, 243, 255, 0.15);
}

.name-modal-input-wrap {
  position: relative;
  width: 100%;
  margin: 18px 0 10px;
}

.name-modal-input {
  width: 100%;
  height: 54px;
  background: rgba(5, 14, 30, 0.9);
  border: 1.5px solid rgba(56, 243, 255, 0.55);
  border-radius: 12px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 3px;
  text-align: center;
  text-transform: uppercase;
  padding: 0 54px 0 20px;
  box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.6), 0 0 15px rgba(56, 243, 255, 0.15);
  transition: all 0.25s ease;
}

.name-modal-input:focus {
  outline: none;
  border-color: #38f3ff;
  box-shadow: 0 0 25px rgba(56, 243, 255, 0.6), inset 0 0 14px rgba(56, 243, 255, 0.25);
}

.name-modal-count {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan);
  opacity: 0.8;
  pointer-events: none;
}

.celebration-tier {
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #03141f;
  background: linear-gradient(90deg, #38f3ff, #8dffd6, #ff3df2);
  padding: 6px 18px;
  border-radius: 999px;
  margin-bottom: 20px;
  box-shadow: 0 0 20px rgba(56, 243, 255, 0.6);
}

.celebration-prompt {
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 2.5px;
  color: rgba(255, 255, 255, 0.85);
  margin: 0;
  animation: celPulse 1.8s ease-in-out infinite;
}

@keyframes celPulse {

  0%,
  100% {
    opacity: 0.6;
    transform: scale(0.98);
  }

  50% {
    opacity: 1;
    transform: scale(1.02);
    text-shadow: 0 0 10px #38f3ff;
  }
}