:root {
  --bg: #0b0e14;
  --accent: #6ee7b7;
  --text: #cbd5e1;
  --ui-scale: 1;
  --hud-edge: 14px;
  --hud-card-width: 156px;
  --leaderboard-min-width: var(--hud-card-width);
  --hud-font-size: 0.95rem;
  --leaderboard-font-size: 0.9rem;
  --leaderboard-auto-scale: 1;
  --stats-panel-width: var(--hud-card-width);
  --hud-card-height: 128px;
  --hud-card-screen-inset: 0px;
  --hud-card-top-inset: 0px;
  --control-size: 150px;
  --control-size-target: 150px;
  --control-knob-size: 60px;
  --sprint-button-size: 150px;
  --control-stack-gap: 9px;
  --control-stack-edge: 14px;
  --utility-button-size: 79px;
  --action-size: 120px;
  --action-edge: 14px;
  --mode-button-size: 52px;
  --mode-button-right: 148px;
  --mode-button-bottom: 48px;
  --power-slot-2-right: 135px;
  --power-slot-2-bottom: 98px;
  --royal-command-size: 52px;
  --royal-guard-right: 48px;
  --royal-guard-bottom: 148px;
  --royal-hunt-right: 98px;
  --royal-hunt-bottom: 135px;
  --ra-cannon-size: 52px;
  --ra-cannon-right: 48px;
  --ra-cannon-bottom: 210px;
  --drop-power-right: 135px;
  --drop-power-bottom: 210px;
  --game-back-size: 52px;
  --power-size: 58px;
  --power-top: 12px;
  --menu-padding: 34px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  width: 100%;
  height: 100%;
  height: 100dvh; /* track the visible viewport on mobile */
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, sans-serif;
  touch-action: none;
}

/* Installed iOS web apps report dynamic viewport units without the home-indicator
   region. Legacy vh includes the full edge-to-edge canvas in standalone mode. */
@media (display-mode: standalone), (display-mode: fullscreen) {
  html, body { height: 100vh; }
}

body.playing,
body.playing * {
  -webkit-user-select: none !important;
  user-select: none !important;
  -webkit-touch-callout: none !important;
}

#game { display: block; position: fixed; top: 0; left: 0; cursor: crosshair; }
body.spectating #game { cursor: grab; }
body.spectating.spectator-panning #game { cursor: grabbing; }

.hidden { display: none !important; }

/* ---- Overlays ---- */
.overlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 30%, rgba(20,26,38,0.9), rgba(8,10,16,0.96));
  z-index: 20;
}

#menu {
  padding-top: max(10px, calc(env(safe-area-inset-top, 0px) + 8px));
  padding-right: max(10px, calc(env(safe-area-inset-right, 0px) + 8px));
  padding-bottom: max(10px, calc(env(safe-area-inset-bottom, 0px) + 8px));
  padding-left: max(10px, calc(env(safe-area-inset-left, 0px) + 8px));
}

.card {
  text-align: center;
  padding: var(--menu-padding);
  background: #12161f;
  border: 1px solid #232a37;
  border-radius: 16px;
  width: min(90vw, 380px);
  max-height: calc(var(--view-height, 100dvh) - 24px);
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.menu-card {
  display: flex;
  flex-direction: column;
  width: min(100%, 460px);
  max-height: 100%;
}

.card h1 { margin: 0 0 6px; font-size: 2rem; letter-spacing: 0.5px; }
.card h1 .dot { color: var(--accent); }
.tag { margin: 0 0 22px; color: #94a3b8; }

.game-mode-label {
  display: block;
  margin: -2px 0 7px;
  color: #94a3b8;
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: 0.03em;
  text-align: center;
}

#name-input,
#clan-input,
#account-login-input,
#account-password-input,
#account-confirm-input,
#map-select,
#offline-map-select,
#species-select,
#rank-select {
  width: 100%;
  padding: 12px 14px;
  font-size: 1rem;
  background: #0b0e14;
  border: 1px solid #2a3240;
  border-radius: 9px;
  color: var(--text);
  margin-bottom: 14px;
  text-align: center;
}
#map-select,
#offline-map-select,
#species-select,
#rank-select {
  appearance: none;
  cursor: pointer;
}
#map-select,
#offline-map-select {
  text-align: center;
  text-align-last: center;
}
#map-select option,
#offline-map-select option { text-align: center; }
#name-input:focus,
#clan-input:focus,
#account-login-input:focus,
#account-password-input:focus,
#account-confirm-input:focus,
#map-select:focus,
#offline-map-select:focus,
#species-select:focus,
#rank-select:focus { outline: none; border-color: var(--accent); }

button {
  width: 100%;
  background: var(--accent);
  color: #06241a;
  border: none;
  border-radius: 9px;
  padding: 12px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
button:hover { filter: brightness(1.08); }
button:active { transform: scale(0.98); }
button:disabled { filter: grayscale(0.6) brightness(0.7); cursor: default; }

.menu-primary-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.menu-primary-actions .menu-primary-btn {
  min-width: 0;
  border: 1px solid rgba(167,243,208,0.42);
  background: linear-gradient(145deg, #6ee7b7, #34d399);
  color: #052e24;
  letter-spacing: 0.035em;
  box-shadow: 0 8px 22px rgba(16,185,129,0.2), inset 0 1px 0 rgba(255,255,255,0.28);
}
.menu-primary-actions .menu-primary-btn:hover { filter: brightness(1.08); }

.download-btn {
  margin-top: 10px;
  border: 1px solid rgba(56,189,248,0.72);
  background: linear-gradient(135deg, rgba(3,105,161,0.42), rgba(14,116,144,0.28));
  color: #e0f2fe;
  letter-spacing: 0.045em;
}
.download-btn:hover { background: linear-gradient(135deg, rgba(3,105,161,0.62), rgba(14,116,144,0.46)); }
.secondary-btn {
  margin-top: 10px;
  background: transparent;
  color: var(--text);
  border: 1px solid #2a3240;
}
.secondary-btn:hover { filter: none; background: rgba(148,163,184,0.08); }

.menu-secondary-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  margin-bottom: 14px;
}
.menu-secondary-actions .secondary-btn {
  min-width: 0;
  margin: 0;
  padding-inline: 8px;
  font-size: 0.92rem;
}

.flight-gps-launch-btn {
  border-color: rgba(56,189,248,0.56);
  background: linear-gradient(135deg, rgba(3,105,161,0.2), rgba(15,23,42,0.42));
  color: #e0f2fe;
  letter-spacing: 0.035em;
}
.flight-gps-launch-btn:hover { background: linear-gradient(135deg, rgba(3,105,161,0.34), rgba(15,23,42,0.56)); }

/* ---- Offline Flight GPS ---- */
#flight-gps-overlay {
  z-index: 58;
  padding-top: max(10px, calc(env(safe-area-inset-top, 0px) + 8px));
  padding-right: max(10px, calc(env(safe-area-inset-right, 0px) + 8px));
  padding-bottom: max(10px, calc(env(safe-area-inset-bottom, 0px) + 8px));
  padding-left: max(10px, calc(env(safe-area-inset-left, 0px) + 8px));
  background:
    radial-gradient(circle at 50% 28%, rgba(14,165,233,0.13), transparent 35%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.018) 0 1px, transparent 1px 52px),
    #080b12;
  touch-action: pan-y;
}
.flight-gps-card {
  width: min(96vw, 920px);
  max-height: 100%;
  padding: clamp(14px, 2.6vw, 26px);
  border-color: rgba(56,189,248,0.34);
  background: rgba(12,16,24,0.94);
  box-shadow: 0 24px 80px rgba(0,0,0,0.74), inset 0 0 0 1px rgba(255,255,255,0.025);
  overflow-y: auto;
}
.flight-gps-header {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) auto minmax(110px, 1fr);
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}
.flight-gps-heading {
  grid-column: 2;
  display: grid;
  gap: 2px;
  justify-items: center;
}
.flight-gps-heading > span {
  color: #7dd3fc;
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.flight-gps-heading h2 {
  margin: 0;
  color: #f8fafc;
  font-size: clamp(1.35rem, 3vw, 1.9rem);
  letter-spacing: 0.025em;
}
.flight-offline-badge {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  padding: 6px 9px;
  border: 1px solid rgba(110,231,183,0.38);
  border-radius: 999px;
  background: rgba(6,78,59,0.22);
  color: #a7f3d0;
  font-size: 0.65rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.flight-gps-close-btn {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(148,163,184,0.35);
  border-radius: 999px;
  background: rgba(15,23,42,0.78);
  color: #e2e8f0;
  font-size: 1.55rem;
  line-height: 1;
}
.flight-gps-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  margin: 0 0 12px;
  padding: 7px 12px;
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 10px;
  background: rgba(2,6,23,0.48);
  color: #cbd5e1;
  font-size: 0.82rem;
  font-weight: 700;
}
.flight-gps-status-dot {
  width: 9px;
  height: 9px;
  flex: 0 0 9px;
  border-radius: 50%;
  background: #64748b;
  box-shadow: 0 0 0 4px rgba(100,116,139,0.12);
}
.flight-gps-status.tracking .flight-gps-status-dot {
  background: #6ee7b7;
  box-shadow: 0 0 0 4px rgba(110,231,183,0.12), 0 0 14px rgba(110,231,183,0.52);
}
.flight-gps-status.error .flight-gps-status-dot {
  background: #fb7185;
  box-shadow: 0 0 0 4px rgba(251,113,133,0.12);
}
.flight-instrument-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(10px, 2vw, 18px);
}
.flight-instrument {
  display: grid;
  justify-items: center;
  align-content: start;
  gap: 7px;
  min-width: 0;
  padding: clamp(10px, 2vw, 16px);
  border: 1px solid rgba(56,189,248,0.2);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 45%, rgba(14,165,233,0.09), transparent 62%),
    rgba(2,6,23,0.5);
}
.flight-instrument-label {
  color: #94a3b8;
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.flight-speed-dial,
.flight-altimeter {
  position: relative;
  width: clamp(180px, 28vw, 270px);
  aspect-ratio: 1;
  border: 1px solid rgba(148,163,184,0.24);
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 48%, #0b1019 0 47%, transparent 48%),
    repeating-conic-gradient(from 240deg, rgba(226,232,240,0.42) 0 1deg, transparent 1deg 12deg),
    #090d14;
  box-shadow: inset 0 0 30px rgba(0,0,0,0.82), 0 8px 24px rgba(0,0,0,0.34);
}
.flight-speed-dial::before {
  content: "";
  position: absolute;
  inset: 7%;
  border-radius: 50%;
  background: conic-gradient(from 240deg, #38bdf8 0deg var(--flight-speed-progress), rgba(71,85,105,0.5) var(--flight-speed-progress) 240deg, transparent 240deg 360deg);
  -webkit-mask: radial-gradient(circle, transparent 0 76%, #000 77% 100%);
  mask: radial-gradient(circle, transparent 0 76%, #000 77% 100%);
  filter: drop-shadow(0 0 7px rgba(56,189,248,0.34));
}
.flight-speed-tick {
  position: absolute;
  z-index: 2;
  color: #94a3b8;
  font-size: clamp(0.62rem, 1.6vw, 0.78rem);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.flight-speed-tick-zero { left: 14%; bottom: 18%; }
.flight-speed-tick-mid { left: 50%; top: 10%; transform: translateX(-50%); }
.flight-speed-tick-max { right: 10%; bottom: 18%; }
.flight-speed-needle {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 50%;
  width: 3px;
  height: 35%;
  border-radius: 999px;
  background: linear-gradient(to top, #f8fafc, #38bdf8);
  box-shadow: 0 0 10px rgba(56,189,248,0.68);
  transform: translateX(-50%) rotate(var(--flight-speed-angle));
  transform-origin: 50% 100%;
  transition: transform 0.12s linear;
}
.flight-speed-hub {
  position: absolute;
  z-index: 5;
  left: 50%;
  top: 50%;
  width: 15px;
  height: 15px;
  border: 3px solid #bae6fd;
  border-radius: 50%;
  background: #0f172a;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 12px rgba(56,189,248,0.62);
}
.flight-speed-readout,
.flight-altitude-readout {
  position: absolute;
  z-index: 3;
  left: 50%;
  top: 65%;
  display: grid;
  justify-items: center;
  transform: translate(-50%, -50%);
}
.flight-speed-readout output,
.flight-altitude-readout output {
  color: #f8fafc;
  font-size: clamp(1.55rem, 5vw, 2.65rem);
  font-weight: 850;
  line-height: 0.95;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(56,189,248,0.28);
}
.flight-speed-readout small,
.flight-altitude-readout small {
  margin-top: 5px;
  color: #7dd3fc;
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}
.flight-altimeter {
  overflow: hidden;
  background:
    linear-gradient(90deg, transparent 0 18%, rgba(56,189,248,0.08) 18% 19%, transparent 19% 81%, rgba(56,189,248,0.08) 81% 82%, transparent 82%),
    repeating-linear-gradient(0deg, transparent 0 15px, rgba(148,163,184,0.18) 15px 16px),
    radial-gradient(circle, #0b1019 0 67%, #090d14 68% 100%);
}
.flight-altimeter::after {
  content: "ALT";
  position: absolute;
  left: 50%;
  top: 16%;
  transform: translateX(-50%);
  color: #94a3b8;
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0.18em;
}
.flight-altimeter-mark {
  position: absolute;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, #38bdf8 0 16%, transparent 16% 84%, #38bdf8 84% 100%);
  opacity: 0.65;
}
.flight-altimeter-mark-a { top: 31%; }
.flight-altimeter-mark-b { top: 50%; }
.flight-altimeter-mark-c { top: 69%; }
.flight-altitude-readout { top: 51%; }
.flight-altitude-readout output { font-size: clamp(1.45rem, 4.5vw, 2.45rem); }
.flight-secondary-reading {
  color: #bae6fd;
  font-size: 0.78rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.flight-speed-unit-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 32px;
}
.flight-speed-unit-btn {
  min-height: 30px;
  margin: 0;
  padding: 5px 11px;
  border: 1px solid rgba(56,189,248,0.42);
  border-radius: 999px;
  background: rgba(14,165,233,0.1);
  color: #bae6fd;
  box-shadow: none;
  font-size: 0.67rem;
  font-weight: 850;
  letter-spacing: 0.02em;
  text-transform: none;
  touch-action: manipulation;
}
.flight-speed-unit-btn:hover,
.flight-speed-unit-btn:focus-visible {
  border-color: #7dd3fc;
  background: rgba(14,165,233,0.2);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.12);
  transform: none;
}
.flight-speed-unit-btn:active {
  background: rgba(14,165,233,0.28);
  transform: scale(0.97);
}
.flight-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}
.flight-metric {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 9px 8px;
  border: 1px solid rgba(148,163,184,0.18);
  border-radius: 10px;
  background: rgba(2,6,23,0.42);
}
.flight-metric span {
  color: #64748b;
  font-size: 0.6rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.flight-metric strong {
  overflow: hidden;
  color: #e2e8f0;
  font-size: clamp(0.74rem, 2vw, 0.92rem);
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.flight-gps-note {
  max-width: 760px;
  margin: 10px auto 0;
  color: #94a3b8;
  font-size: 0.72rem;
  line-height: 1.45;
}
.flight-gps-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: min(100%, 520px);
  margin: 11px auto 0;
}
.flight-gps-actions .secondary-btn { margin: 0; }

#download-overlay { padding: 16px; z-index: 55; }
.download-card {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(92vw, 420px);
  padding: clamp(22px, 6vw, 34px);
  border-color: rgba(56,189,248,0.42);
  background:
    radial-gradient(circle at 50% 15%, rgba(14,165,233,0.17), transparent 45%),
    #12161f;
}
.download-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border: 1px solid rgba(56,189,248,0.55);
  border-radius: 18px;
  background: rgba(3,105,161,0.24);
  color: #7dd3fc;
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1;
}
.download-card h2 { margin: 0; color: #f8fafc; }
.download-card p {
  margin: 0 0 4px;
  color: #cbd5e1;
  line-height: 1.55;
}
.download-card button { margin-top: 4px; }

.menu-ad-slot {
  position: relative;
  width: 100%;
  min-height: 100px;
  flex: 0 0 100px;
  display: grid;
  place-items: center;
  margin-top: auto;
  padding: 8px;
  overflow: hidden;
  border: 1px dashed rgba(148,163,184,0.34);
  border-radius: 10px;
  background:
    linear-gradient(135deg, rgba(110,231,183,0.035), rgba(56,189,248,0.035)),
    rgba(2,6,23,0.42);
  color: #64748b;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

/* ---- Quick guide ---- */
#guide-overlay {
  z-index: 45;
  padding: clamp(8px, 2vw, 22px);
  padding-top: max(clamp(8px, 2vw, 22px), calc(env(safe-area-inset-top, 0px) + 4px));
  padding-right: max(clamp(8px, 2vw, 22px), env(safe-area-inset-right, 0px));
  padding-bottom: max(clamp(8px, 2vw, 22px), calc(env(safe-area-inset-bottom, 0px) + 4px));
  padding-left: max(clamp(8px, 2vw, 22px), env(safe-area-inset-left, 0px));
  background:
    radial-gradient(circle at 18% 12%, rgba(110,231,183,0.15), transparent 28%),
    radial-gradient(circle at 84% 88%, rgba(56,189,248,0.1), transparent 30%),
    rgba(5,8,13,0.97);
  touch-action: pan-y;
}
.guide-card {
  position: relative;
  display: flex;
  width: min(96vw, 1040px);
  height: min(100%, 820px);
  max-height: 100%;
  padding: 0;
  overflow: hidden;
  border-color: rgba(110,231,183,0.22);
  background:
    linear-gradient(145deg, rgba(255,255,255,0.025), transparent 40%),
    #10151e;
  text-align: center;
  flex-direction: column;
  box-shadow: 0 26px 90px rgba(0,0,0,0.75), 0 0 0 1px rgba(255,255,255,0.025);
  touch-action: pan-y;
}
.guide-header {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(74px, 1fr) auto minmax(74px, 1fr);
  align-items: center;
  gap: 16px;
  padding: 16px clamp(16px, 3vw, 28px);
  border-bottom: 1px solid rgba(148,163,184,0.16);
  background: rgba(9,13,20,0.94);
}
.guide-header::after { content: ""; grid-column: 3; }
.guide-header > div {
  display: grid;
  grid-column: 2;
  gap: 1px;
  justify-items: center;
  text-align: center;
}
.guide-header span,
.guide-section-heading span,
.guide-detail-category {
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.guide-header h2 {
  margin: 0;
  color: #f8fafc;
  font-size: clamp(1.3rem, 4vw, 1.8rem);
  line-height: 1.1;
}
.guide-close-btn {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  width: auto;
  min-width: 74px;
  padding: 9px 16px;
  font-size: 0.86rem;
}
.guide-browser,
.guide-detail {
  min-height: 0;
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: rgba(110,231,183,0.5) transparent;
  touch-action: pan-y;
}
.guide-browser { padding: clamp(14px, 2.5vw, 26px); }
.guide-intro {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(110,231,183,0.22);
  border-radius: 14px;
  background: linear-gradient(120deg, rgba(16,185,129,0.14), rgba(15,23,42,0.5));
}
.guide-intro > div:last-child { text-align: center; }
.guide-intro-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(110,231,183,0.62);
  border-radius: 14px;
  color: #d1fae5;
  background: rgba(6,78,59,0.52);
  font-size: 0.8rem;
  font-weight: 950;
  letter-spacing: 0.08em;
}
.guide-intro strong { color: #f0fdf4; font-size: clamp(0.92rem, 2.4vw, 1.05rem); }
.guide-intro p { margin: 4px 0 0; color: #94a3b8; font-size: 0.78rem; line-height: 1.4; }
.guide-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 0 0 18px;
  padding: 10px;
  overflow: visible;
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 14px;
  background: linear-gradient(145deg, rgba(255,255,255,0.035), rgba(2,6,23,0.58));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.015);
}
.guide-tab {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  padding: 8px 7px;
  border: 1px solid #2a3443;
  border-radius: 9px;
  background: #0b1018;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.1;
  white-space: normal;
}
.guide-tab[aria-selected="true"] {
  border-color: rgba(110,231,183,0.72);
  color: #052e22;
  background: var(--accent);
  box-shadow: 0 0 16px rgba(110,231,183,0.18);
}
.guide-section-heading {
  display: grid;
  justify-items: center;
  gap: 5px;
  margin-bottom: 13px;
  text-align: center;
}
.guide-section-heading > div { display: grid; gap: 2px; justify-items: center; }
.guide-section-heading h3 {
  margin: 0;
  color: #f8fafc;
  font-size: clamp(1.08rem, 3vw, 1.35rem);
}
.guide-section-heading p {
  max-width: 430px;
  margin: 0;
  color: #64748b;
  font-size: 0.74rem;
  line-height: 1.35;
  text-align: center;
}
.guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 12px;
  padding-bottom: 4px;
}
.guide-grid > [role="listitem"] { min-width: 0; }
.guide-tile {
  --guide-color: #6ee7b7;
  min-width: 0;
  min-height: 164px;
  display: grid;
  grid-template-rows: 88px auto;
  gap: 10px;
  padding: 10px;
  overflow: hidden;
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 14px;
  background: linear-gradient(160deg, rgba(255,255,255,0.035), rgba(3,7,18,0.68));
  color: #e2e8f0;
  text-align: center;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.015);
}
.guide-tile:hover,
.guide-tile:focus-visible {
  border-color: var(--guide-color);
  filter: none;
  outline: none;
  transform: translateY(-2px);
  box-shadow: 0 10px 26px rgba(0,0,0,0.34), 0 0 18px var(--guide-glow, rgba(110,231,183,0.2));
}
.guide-tile-copy { min-width: 0; padding: 0 2px 2px; }
.guide-tile-category {
  display: block;
  margin-bottom: 3px;
  color: var(--guide-color);
  font-size: 0.57rem;
  font-weight: 900;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}
.guide-tile strong {
  display: block;
  overflow: hidden;
  color: #f8fafc;
  font-size: 0.88rem;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.guide-tile p {
  display: -webkit-box;
  margin: 4px 0 0;
  overflow: hidden;
  color: #94a3b8;
  font-size: 0.68rem;
  font-weight: 650;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}
.guide-artwork {
  --guide-color: #6ee7b7;
  position: relative;
  min-width: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid var(--guide-border, rgba(110,231,183,0.3));
  border-radius: 10px;
  background:
    radial-gradient(circle at 50% 42%, var(--guide-soft, rgba(110,231,183,0.2)), transparent 48%),
    linear-gradient(145deg, rgba(255,255,255,0.035), rgba(2,6,23,0.8));
}
.guide-artwork::before {
  content: "";
  position: absolute;
  inset: 12% 20%;
  border-radius: 50%;
  background: var(--guide-color);
  opacity: 0.09;
  filter: blur(18px);
}
.guide-artwork-canvas {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.guide-detail {
  display: flex;
  padding: clamp(16px, 3vw, 30px);
  flex-direction: column;
}
.guide-detail-back {
  width: max-content;
  margin: 0 auto 18px;
  padding: 7px 0;
  background: transparent;
  color: #94a3b8;
  font-size: 0.78rem;
}
.guide-detail-back:hover { color: #f8fafc; filter: none; }
.guide-detail-layout {
  display: grid;
  grid-template-columns: minmax(230px, 0.72fr) minmax(0, 1.28fr);
  gap: clamp(20px, 4vw, 42px);
  align-items: start;
}
.guide-detail-content { text-align: center; }
.guide-detail-art .guide-artwork {
  width: 100%;
  min-height: 300px;
  border-radius: 18px;
}
.guide-detail-content h3 {
  margin: 6px 0 5px;
  color: #f8fafc;
  font-size: clamp(1.6rem, 5vw, 2.5rem);
  line-height: 1.02;
}
.guide-detail-summary {
  margin: 0 0 18px;
  color: var(--guide-detail-color, #6ee7b7);
  font-size: clamp(0.9rem, 2.4vw, 1.08rem);
  font-weight: 800;
}
.guide-detail-copy { display: grid; gap: 10px; }
.guide-instruction,
.guide-detail-facts li {
  display: grid;
  grid-template-columns: 118px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}
.guide-instruction-copy {
  padding: 9px;
  border: 1px solid rgba(148,163,184,0.12);
  border-radius: 12px;
  background: rgba(2,6,23,0.28);
}
.guide-instruction-art {
  --guide-color: #6ee7b7;
  position: relative;
  display: block;
  width: 118px;
  height: 72px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--guide-border, rgba(110,231,183,0.3));
  border-radius: 9px;
  background:
    radial-gradient(circle at 50% 45%, var(--guide-soft, rgba(110,231,183,0.16)), transparent 56%),
    rgba(3,7,18,0.82);
  color: #f8fafc;
  box-shadow: none;
  isolation: isolate;
}
.guide-instruction-art::after {
  content: "\2197";
  position: absolute;
  right: 4px;
  bottom: 4px;
  z-index: 2;
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.45);
  border-radius: 6px;
  background: rgba(2,6,23,0.82);
  color: #f8fafc;
  font-size: 0.72rem;
  line-height: 1;
}
.guide-instruction-art:hover,
.guide-instruction-art:focus-visible {
  border-color: var(--guide-color);
  filter: brightness(1.12);
  outline: 2px solid var(--guide-color);
  outline-offset: 2px;
}
.guide-instruction-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}
.guide-detail-copy p {
  margin: 0;
  color: #cbd5e1;
  font-size: 0.88rem;
  line-height: 1.55;
  text-align: center;
}
.guide-detail-facts {
  display: grid;
  gap: 8px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}
.guide-detail-facts li {
  padding: 9px;
  border: 1px solid rgba(148,163,184,0.15);
  border-radius: 10px;
  background: rgba(2,6,23,0.45);
  color: #aebdce;
  font-size: 0.78rem;
  line-height: 1.4;
  text-align: center;
}
.guide-detail-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: auto;
  padding-top: 24px;
}
.guide-detail-nav button { margin: 0; font-size: 0.84rem; }

.guide-illustration-viewer {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  padding-top: max(14px, calc(env(safe-area-inset-top, 0px) + 8px));
  padding-right: max(14px, env(safe-area-inset-right, 0px));
  padding-bottom: max(14px, calc(env(safe-area-inset-bottom, 0px) + 8px));
  padding-left: max(14px, env(safe-area-inset-left, 0px));
  place-items: center;
  background: rgba(2,6,13,0.92);
  backdrop-filter: blur(10px);
}
.guide-illustration-panel {
  width: min(94vw, 880px);
  max-height: 100%;
  display: grid;
  gap: 14px;
  padding: clamp(14px, 3vw, 24px);
  overflow-y: auto;
  border: 1px solid var(--guide-border, rgba(110,231,183,0.42));
  border-radius: 20px;
  background: #0c121c;
  box-shadow: 0 28px 90px rgba(0,0,0,0.72), 0 0 36px var(--guide-soft, rgba(110,231,183,0.12));
}
.guide-illustration-header {
  display: grid;
  grid-template-columns: minmax(76px, 1fr) auto minmax(76px, 1fr);
  align-items: center;
  gap: 18px;
}
.guide-illustration-header::before { content: ""; }
.guide-illustration-header > div {
  display: grid;
  grid-column: 2;
  gap: 2px;
  justify-items: center;
  text-align: center;
}
.guide-illustration-header span {
  color: var(--guide-color, #6ee7b7);
  font-size: 0.66rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.guide-illustration-header h3 {
  margin: 0;
  color: #f8fafc;
  font-size: clamp(1.15rem, 4vw, 1.7rem);
}
.guide-illustration-header button {
  grid-column: 3;
  justify-self: end;
  width: auto;
  min-width: 76px;
  padding: 9px 14px;
  font-size: 0.82rem;
}
.guide-illustration-stage {
  width: 100%;
  aspect-ratio: 24 / 13;
  overflow: hidden;
  border: 1px solid var(--guide-border, rgba(110,231,183,0.38));
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 45%, var(--guide-soft, rgba(110,231,183,0.18)), transparent 58%),
    linear-gradient(145deg, rgba(255,255,255,0.035), rgba(2,6,23,0.9));
}
#guide-illustration-canvas {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
#guide-illustration-caption {
  margin: 0;
  color: #cbd5e1;
  font-size: clamp(0.86rem, 2.5vw, 1rem);
  line-height: 1.5;
  text-align: center;
}

@media (max-width: 650px) {
  #menu {
    align-items: stretch;
    padding-top: max(0px, calc(env(safe-area-inset-top, 0px) - 2px));
    padding-bottom: 25px;
  }
  #guide-overlay {
    padding-top: max(0px, calc(env(safe-area-inset-top, 0px) - 6px));
    padding-bottom: 25px;
  }
  #flight-gps-overlay {
    align-items: center;
    padding-top: max(4px, calc(env(safe-area-inset-top, 0px) + 2px));
    padding-bottom: 25px;
  }
  .flight-gps-card {
    width: 100%;
    max-height: 100%;
    border-radius: 18px;
  }
  .flight-speed-dial,
  .flight-altimeter { width: clamp(150px, 38vw, 220px); }
  .flight-metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #menu > .menu-card {
    width: 100%;
    height: 100%;
    max-height: 100%;
    padding: clamp(16px, 4.2vw, 22px);
    border-radius: 20px;
  }
  .menu-card .tag { margin-bottom: 16px; }
  .guide-card {
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 16px;
  }
  .guide-header { grid-template-columns: minmax(62px, 1fr) auto minmax(62px, 1fr); gap: 8px; padding: 12px 14px; }
  .guide-header span { font-size: 0.56rem; }
  .guide-close-btn { min-width: 62px; padding: 8px 12px; }
  .guide-browser { padding: 12px; }
  .guide-intro { gap: 10px; padding: 11px; }
  .guide-intro-mark { width: 40px; height: 40px; border-radius: 11px; }
  .guide-tabs { gap: 6px; margin: 0 0 15px; padding: 8px; }
  .guide-tab { min-height: 38px; padding: 7px 4px; font-size: 0.65rem; }
  .guide-section-heading { display: grid; gap: 5px; }
  .guide-section-heading p { max-width: none; text-align: center; }
  .guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .guide-tile { min-height: 148px; grid-template-rows: 76px auto; padding: 8px; }
  .guide-tile strong { font-size: 0.8rem; }
  .guide-detail { padding: 14px; }
  .guide-detail-back { margin-bottom: 10px; }
  .guide-detail-layout { grid-template-columns: 1fr; gap: 16px; }
  .guide-detail-art .guide-artwork { min-height: 150px; }
  .guide-detail-content h3 { margin-top: 4px; }
  .guide-detail-summary { margin-bottom: 12px; }
  .guide-detail-copy p { font-size: 0.82rem; }
  .guide-instruction,
  .guide-detail-facts li { grid-template-columns: 96px minmax(0, 1fr); gap: 9px; }
  .guide-instruction-art { width: 96px; height: 64px; }
  .guide-illustration-panel { width: 100%; gap: 10px; padding: 12px; border-radius: 16px; }
  .guide-illustration-header { grid-template-columns: minmax(62px, 1fr) auto minmax(62px, 1fr); gap: 8px; }
  .guide-illustration-header button { min-width: 62px; padding-inline: 10px; }
  .guide-illustration-stage { border-radius: 12px; }
  .guide-detail-facts { margin-top: 13px; }
  .guide-detail-nav { padding-top: 16px; }
}

@media (max-width: 540px) {
  .flight-gps-card { padding: 10px; }
  .flight-gps-header {
    grid-template-columns: minmax(72px, 1fr) auto minmax(72px, 1fr);
    gap: 7px;
    margin-bottom: 6px;
  }
  .flight-offline-badge { max-width: 86px; padding: 5px 7px; font-size: 0.53rem; }
  .flight-gps-close-btn { width: 34px; height: 34px; }
  .flight-gps-status { min-height: 30px; margin-bottom: 7px; padding-block: 5px; font-size: 0.74rem; }
  .flight-instrument-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .flight-instrument { gap: 4px; padding: 7px 5px; border-radius: 13px; }
  .flight-instrument-label { font-size: 0.58rem; letter-spacing: 0.08em; }
  .flight-speed-dial,
  .flight-altimeter { width: clamp(120px, 34vw, 158px); }
  .flight-speed-readout output,
  .flight-altitude-readout output { font-size: clamp(1.25rem, 6vw, 1.65rem); }
  .flight-speed-unit-row { min-height: 28px; gap: 5px; }
  .flight-speed-unit-btn { min-height: 27px; padding: 4px 8px; font-size: 0.6rem; }
  .flight-secondary-reading { font-size: 0.68rem; }
  .flight-metric-grid { gap: 6px; margin-top: 7px; }
  .flight-metric { gap: 2px; padding: 6px; }
  .flight-metric span { font-size: 0.53rem; }
  .flight-metric strong { font-size: 0.72rem; }
  .flight-gps-note { margin-top: 7px; font-size: 0.62rem; line-height: 1.3; }
  .flight-gps-actions {
    position: static;
    margin-top: 7px;
    padding-top: 0;
    background: transparent;
    box-shadow: none;
  }
  .flight-gps-actions button { padding-block: 9px; }
}

@media (max-width: 360px) {
  .menu-secondary-actions { gap: 7px; }
  .guide-grid { grid-template-columns: 1fr; }
  .guide-tile { grid-template-columns: 98px minmax(0, 1fr); grid-template-rows: auto; min-height: 104px; }
}

@media (max-height: 520px) and (orientation: landscape) {
  #flight-gps-overlay { padding-block: max(5px, env(safe-area-inset-top, 0px)); }
  .flight-gps-card { padding: 5px 10px; overflow-y: auto; }
  .flight-gps-header { margin-bottom: 3px; }
  .flight-gps-heading { gap: 0; }
  .flight-gps-heading > span { font-size: 0.53rem; }
  .flight-gps-heading h2 { font-size: 1.12rem; }
  .flight-offline-badge { padding: 4px 7px; font-size: 0.52rem; }
  .flight-gps-close-btn { width: 30px; height: 30px; font-size: 1.25rem; }
  .flight-gps-status { min-height: 24px; margin-bottom: 4px; padding-block: 3px; font-size: 0.7rem; }
  .flight-instrument-grid { gap: 8px; }
  .flight-instrument { gap: 2px; padding: 4px 8px; border-radius: 12px; }
  .flight-instrument-label { font-size: 0.55rem; }
  .flight-speed-dial,
  .flight-altimeter { width: clamp(92px, 28vh, 125px); }
  .flight-speed-readout output,
  .flight-altitude-readout output { font-size: clamp(1.1rem, 5vh, 1.45rem); }
  .flight-speed-unit-row { min-height: 24px; gap: 5px; }
  .flight-speed-unit-btn { min-height: 24px; padding: 2px 8px; font-size: 0.58rem; }
  .flight-secondary-reading { font-size: 0.64rem; }
  .flight-metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 6px;
    margin-top: 4px;
  }
  .flight-metric { gap: 1px; padding: 3px 5px; }
  .flight-metric span { font-size: 0.5rem; }
  .flight-metric strong { font-size: 0.68rem; }
  .flight-gps-note { margin-top: 4px; font-size: 0.52rem; line-height: 1.15; }
  .flight-gps-actions { margin-top: 4px; }
  .flight-gps-actions button { padding-block: 5px; font-size: 0.76rem; }
  .guide-card { height: 100%; }
  .guide-header { padding-block: 9px; }
  .guide-browser { padding-block: 10px; }
  .guide-intro { margin-bottom: 8px; padding-block: 8px; }
  .guide-tabs { margin-bottom: 10px; padding-block: 6px 9px; }
  .guide-detail-art .guide-artwork { min-height: 190px; }
}

.account-summary {
  margin: -8px 0 14px;
  padding: 6px;
  border: 1px solid rgba(148,163,184,0.22);
  border-radius: 10px;
  background: rgba(2,6,23,0.42);
  color: #94a3b8;
  font-size: 0.78rem;
}
.account-summary > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.account-summary > #account-guest-summary { display: block; }
.account-summary strong {
  color: #cbd5e1;
  font-weight: 750;
}
.account-entry-options {
  display: grid;
  grid-template-columns: 1fr;
  gap: 5px;
}
.account-entry-choice {
  position: relative;
  min-width: 0;
  min-height: 50px;
  display: grid;
  place-content: center;
  gap: 3px;
  padding: 7px 5px;
  border: 1px solid #2a3240;
  background: rgba(15,23,42,0.72);
  color: #94a3b8;
  font-size: 0.68rem;
  line-height: 1.05;
}
.account-entry-choice span { font-weight: 850; }
.account-mode-switch small {
  min-height: 0.7rem;
  color: transparent;
  font-size: 0.58rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.account-mode-switch button.active::before {
  content: "\2713";
  position: absolute;
  top: 3px;
  right: 5px;
  color: #6ee7b7;
  font-size: 0.72rem;
  font-weight: 950;
}
.account-mode-switch button.active small { color: #6ee7b7; }
#account-signed-in-summary {
  position: relative;
  justify-content: center;
  padding: 5px 6px;
}
.account-signed-in-copy {
  display: grid;
  gap: 2px;
  justify-items: center;
  text-align: center;
}
.account-text-btn {
  width: auto;
  margin-top: 3px;
  padding: 5px 8px;
  border: 1px solid rgba(148,163,184,0.2);
  border-radius: 7px;
  background: rgba(15,23,42,0.42);
  color: #94a3b8;
  font-size: 0.68rem;
}
.account-text-btn:hover {
  border-color: rgba(248,113,113,0.38);
  color: #fca5a5;
  filter: none;
}
.account-card { width: min(92vw, 430px); }
.account-card h2 { margin: 0 0 7px; }
.account-card > p:not(.account-form-status) {
  margin: 0 0 16px;
  color: #94a3b8;
  font-size: 0.86rem;
  line-height: 1.4;
}
.account-mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-bottom: 16px;
  padding: 4px;
  border-radius: 10px;
  background: #0b0e14;
}
.account-mode-switch button {
  position: relative;
  display: grid;
  gap: 2px;
  padding: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: #94a3b8;
  font-size: 0.82rem;
}
.account-mode-switch button.active {
  border: 2px solid #6ee7b7;
  background: linear-gradient(180deg, rgba(52,211,153,0.3), rgba(5,150,105,0.2));
  color: #ecfdf5;
  box-shadow: 0 0 0 2px rgba(110,231,183,0.12), 0 0 16px rgba(52,211,153,0.18);
}
.account-field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 750;
  text-align: left;
}
.account-field input { margin: 0 !important; text-align: left !important; }
.account-form-status {
  min-height: 20px;
  margin: 4px 0 8px;
  color: #fca5a5;
  font-size: 0.78rem;
}
.account-form-status.success { color: #6ee7b7; }

.hint { margin: 18px 0 0; font-size: 0.8rem; color: #64748b; }
.status { margin: 8px 0 0; font-size: 0.78rem; color: #64748b; }
.royal-aspiration-card {
  width: min(90vw, 440px);
  overflow: hidden;
}
.royal-aspiration-card h2 {
  margin: 0 0 8px;
  color: #f8fafc;
  font-size: clamp(1.35rem, 5vw, 1.8rem);
}
.royal-aspiration-card > p {
  margin: 0 0 20px;
  color: #94a3b8;
  line-height: 1.4;
}
.royal-aspiration-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.royal-aspiration-choice {
  min-width: 0;
  display: grid;
  place-items: center;
  gap: 5px;
  padding: 16px 10px;
  color: #fff;
}
.royal-aspiration-choice span {
  font-size: 1.15rem;
  line-height: 1;
}
.royal-aspiration-choice small {
  max-width: 100%;
  overflow: hidden;
  font-size: 0.7rem;
  font-weight: 650;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.royal-aspiration-choice.king {
  background: linear-gradient(135deg, #9a6400, #facc15);
  color: #261500;
}
.royal-aspiration-choice.queen {
  background: linear-gradient(135deg, #86198f, #f0abfc);
  color: #2e0735;
}
.royal-aspiration-card .royal-aspiration-hint {
  margin: 16px 0 0;
  color: #64748b;
  font-size: 0.75rem;
}

/* ---- Settings ---- */
#settings-overlay {
  padding: 12px;
  background:
    radial-gradient(circle at 50% 48%, rgba(110,231,183,0.1), transparent 27%),
    repeating-linear-gradient(0deg, rgba(255,255,255,0.026) 0 1px, transparent 1px 64px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.026) 0 1px, transparent 1px 64px),
    #0b0e14;
}
.settings-card {
  width: min(96vw, 1000px);
  padding: clamp(14px, 2.4vw, 26px);
  background: rgba(12,16,24,0.82);
  border-color: rgba(148,163,184,0.3);
  box-shadow: 0 22px 70px rgba(0,0,0,0.7), inset 0 0 0 1px rgba(255,255,255,0.025);
  backdrop-filter: blur(8px);
  text-align: left;
}
.settings-card h2 {
  margin: 0 0 16px;
  text-align: center;
  color: #f8fafc;
  font-size: clamp(1.3rem, 5vw, 1.6rem);
}
.settings-section {
  margin-bottom: 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid #232a37;
}
.settings-section:last-of-type { border-bottom: none; margin-bottom: 8px; }
.settings-layout-section { padding-bottom: 4px; }
.settings-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.settings-actions button { margin: 0; }
.settings-sprint-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
}
.settings-sprint-mode legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  padding: 0;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.settings-sprint-mode label { min-width: 0; cursor: pointer; }
.settings-sprint-mode input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.settings-sprint-mode label > span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 7px 10px;
  border: 1px solid rgba(148,163,184,0.3);
  border-radius: 12px;
  background: rgba(15,23,42,0.72);
  color: #cbd5e1;
  font-size: 0.78rem;
  font-weight: 750;
  text-align: center;
}
.settings-sprint-mode input:checked + span {
  border-color: #fbbf24;
  background: rgba(120,53,15,0.36);
  color: #fef3c7;
  box-shadow: 0 0 0 2px rgba(251,191,36,0.14), inset 0 0 0 1px rgba(255,255,255,0.04);
}
.settings-sprint-mode input:focus-visible + span { outline: 2px solid #6ee7b7; outline-offset: 2px; }
.sprint-mode-icon {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid rgba(251,191,36,0.62);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(251,191,36,0.24), rgba(12,16,24,0.8));
  color: #451a03;
  font-size: 0.58rem;
  font-weight: 950;
}
.sprint-mode-icon.analog::after {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: linear-gradient(145deg, #fef3c7, #f59e0b 64%, #92400e);
  box-shadow: 0 2px 5px rgba(0,0,0,0.42);
}
.sprint-mode-icon.button { background: linear-gradient(145deg, #fef3c7, #f59e0b 64%, #92400e); }
.settings-section h3 {
  margin: 0 0 10px;
  color: #94a3b8;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.settings-hint {
  margin: 0 0 10px;
  color: #64748b;
  font-size: 0.76rem;
  line-height: 1.4;
}
.layout-orientation-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 0 0 8px;
}
.layout-orientation-picker button {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 2px 8px;
  min-height: 48px;
  margin: 0;
  padding: 8px 12px;
  border: 1px solid #334155;
  background: #161d29;
  color: #cbd5e1;
  text-align: left;
}
.layout-orientation-picker button > span {
  grid-row: 1 / 3;
  color: #94a3b8;
  font-size: 1.55rem;
  line-height: 1;
}
.layout-orientation-picker button > span.portrait-icon { transform: rotate(90deg); }
.layout-orientation-picker button small {
  color: #f59e0b;
  font-size: 0.62rem;
  font-weight: 850;
  text-transform: uppercase;
}
.layout-orientation-picker button.selected {
  border-color: var(--accent);
  background: rgba(16,185,129,0.13);
  color: #f8fafc;
}
.layout-orientation-picker button.saved small { color: #4ade80; }
.layout-editor-setup-status {
  margin: 0 0 7px;
  color: #fbbf24;
  font-size: 0.72rem;
  font-weight: 750;
  line-height: 1.35;
}
.layout-editor-setup-status.complete { color: #4ade80; }
.layout-editor-setup-status.attention { animation: layout-required-pulse 0.55s ease-in-out 2; }
@keyframes layout-required-pulse {
  50% { color: #fff; text-shadow: 0 0 10px rgba(251,191,36,0.8); }
}
.layout-editor-save-btn {
  width: 100%;
  margin: 0 0 10px;
}
.settings-actions button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
.settings-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--text);
  font-size: 0.88rem;
}
.settings-row:last-child { margin-bottom: 0; }
.settings-toggle-row { justify-content: space-between; cursor: pointer; }
.settings-toggle-row input[type="checkbox"] {
  width: 40px;
  height: 22px;
  flex: 0 0 auto;
  appearance: none;
  position: relative;
  background: #2a3240;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.settings-toggle-row input[type="checkbox"]::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #cbd5e1;
  transition: transform 0.15s ease;
}
.settings-toggle-row input[type="checkbox"]:checked { background: var(--accent); }
.settings-toggle-row input[type="checkbox"]:checked::before {
  transform: translateX(18px);
  background: #06241a;
}
.settings-slider-row span { flex: 0 0 auto; min-width: 42px; }
.settings-slider-row strong {
  flex: 0 0 auto;
  min-width: 36px;
  text-align: right;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.settings-slider-row input[type="range"] {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  accent-color: var(--accent);
}

#layout-editor-preview {
  position: relative;
  width: min(100%, calc(46vh * var(--layout-preview-aspect, 1.777778)));
  aspect-ratio: var(--layout-preview-aspect, 1.777778);
  margin: 0 auto 10px;
  border: 1px solid rgba(110,231,183,0.26);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 50%, rgba(110,231,183,0.1), transparent 24%),
    linear-gradient(rgba(255,255,255,0.038) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.038) 1px, transparent 1px),
    #0b0e14;
  background-size: auto, 12.5% 22.222%, 12.5% 22.222%, auto;
  overflow: hidden;
  touch-action: none;
  box-shadow: inset 0 0 50px rgba(0,0,0,0.6), 0 12px 32px rgba(0,0,0,0.32);
}
#layout-editor-preview.portrait {
  width: min(72vw, calc(46vh * var(--layout-preview-aspect, 0.5625)));
  max-width: 360px;
}
.layout-preview-spawn {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.layout-spawn-ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 15%;
  aspect-ratio: 1;
  border: 1px solid rgba(110,231,183,0.52);
  border-radius: 50%;
  box-shadow: 0 0 20px rgba(110,231,183,0.16), inset 0 0 18px rgba(110,231,183,0.08);
  transform: translate(-50%, -50%);
}
.layout-spawn-ring.ring-one { animation: layout-spawn-pulse 2.4s ease-out infinite; }
.layout-spawn-ring.ring-two { animation: layout-spawn-pulse 2.4s 1.2s ease-out infinite; }
@keyframes layout-spawn-pulse {
  from { opacity: 0.8; transform: translate(-50%, -50%) scale(0.45); }
  to { opacity: 0; transform: translate(-50%, -50%) scale(1.35); }
}
.layout-preview-spider {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 7%;
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  filter: drop-shadow(0 5px 5px rgba(0,0,0,0.72));
}
.layout-preview-spider .leg {
  position: absolute;
  left: -20%;
  top: calc(50% - 1px);
  width: 140%;
  height: 2px;
  border-radius: 999px;
  background: #4d8f76;
  box-shadow: 0 1px 1px rgba(0,0,0,0.8);
}
.layout-preview-spider .leg-one { transform: rotate(36deg); }
.layout-preview-spider .leg-two { transform: rotate(14deg); }
.layout-preview-spider .leg-three { transform: rotate(-14deg); }
.layout-preview-spider .leg-four { transform: rotate(-36deg); }
.layout-preview-spider b,
.layout-preview-spider::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border-radius: 50%;
  background: linear-gradient(145deg, #8af1ca, #279c76 70%);
  transform: translate(-50%, -50%);
}
.layout-preview-spider b { width: 48%; height: 62%; }
.layout-preview-spider::after { top: 31%; width: 34%; height: 34%; }

.layout-preview-card {
  position: absolute;
  top: 3.5%;
  width: 18%;
  height: 24%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4%;
  padding: 1.2%;
  overflow: hidden;
  border: 1px solid rgba(148,163,184,0.3);
  border-radius: 10px;
  background: rgba(12,16,24,0.72);
  box-shadow: 0 8px 22px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.025);
  color: #e2e8f0;
  font-size: clamp(5px, 0.82vw, 10px);
  text-align: center;
  backdrop-filter: blur(4px);
  pointer-events: none;
  transition: left 0.18s ease, right 0.18s ease;
}
.layout-preview-stats { left: 2.5%; }
.layout-preview-leaderboard { right: 2.5%; }
#layout-editor-preview.hud-swapped .layout-preview-stats { left: auto; right: 2.5%; }
#layout-editor-preview.hud-swapped .layout-preview-leaderboard { right: auto; left: 2.5%; }
.layout-preview-score {
  flex: 0 0 auto;
  font-weight: 750;
  white-space: nowrap;
}
.layout-preview-score strong { color: #6ee7b7; }
.layout-preview-cooldown {
  flex: 0 0 auto;
  display: grid;
  gap: 2px;
  width: 90%;
  color: #94a3b8;
  font-size: 0.72em;
  font-weight: 850;
}
.layout-preview-cooldown i {
  display: block;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255,255,255,0.12);
}
.layout-preview-cooldown b { display: block; width: 74%; height: 100%; background: #6ee7b7; }
.layout-preview-minimap {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  width: 46%;
  max-height: 52%;
  aspect-ratio: 1;
  border: 1px solid rgba(110,231,183,0.42);
  border-radius: 50%;
  background:
    linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px),
    rgba(2,6,23,0.72);
  background-size: 25% 25%;
}
.layout-preview-minimap i,
.layout-preview-minimap b {
  position: absolute;
  width: 8%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ef4444;
}
.layout-preview-minimap i:first-child { left: 25%; top: 30%; }
.layout-preview-minimap i:nth-child(2) { right: 22%; bottom: 25%; background: #facc15; }
.layout-preview-minimap b { left: 47%; top: 46%; width: 11%; background: #6ee7b7; box-shadow: 0 0 5px #6ee7b7; }
.layout-preview-leaderboard > strong {
  color: #94a3b8;
  font-size: 0.9em;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.layout-preview-leaderboard ol {
  display: grid;
  gap: 0.22em;
  margin: 0;
  padding-left: 1.8em;
  font-size: 0.9em;
  line-height: 1.15;
}
.layout-preview-leaderboard li:first-child { color: #facc15; }
.layout-preview-leaderboard li:nth-child(2) { color: #6ee7b7; font-weight: 800; }

.layout-preview-life-stack {
  position: absolute;
  left: 50%;
  top: 0;
  z-index: 2;
  width: 25%;
  min-width: 100px;
  max-width: 260px;
  padding: 1.1% 1.3% 1.25%;
  transform: translateX(-50%);
  border: 1px solid rgba(148,163,184,0.3);
  border-radius: 0 0 9px 9px;
  background: rgba(12,16,24,0.78);
  box-shadow: 0 7px 20px rgba(0,0,0,0.34), inset 0 0 0 1px rgba(255,255,255,0.035);
  color: #cbd5e1;
  font-size: clamp(5px, 0.68vw, 9px);
  line-height: 1;
  pointer-events: none;
}
.layout-preview-life-row + .layout-preview-life-row {
  margin-top: 5%;
  padding-top: 5%;
  border-top: 1px solid rgba(248,113,113,0.26);
}
.layout-preview-life-row > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4%;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}
.layout-preview-life-row span b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layout-preview-life-row span strong { color: #4ade80; font-variant-numeric: tabular-nums; }
.layout-preview-life-row.victim { color: #fecdd3; }
.layout-preview-life-row.victim span strong { color: #fb7185; }
.layout-preview-life-row > i {
  display: block;
  width: 100%;
  height: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15,23,42,0.95);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.72);
}
.layout-preview-life-row > i > b {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #4ade80;
  box-shadow: 0 0 7px rgba(74,222,128,0.62);
}
.layout-preview-life-row.victim > i > b {
  width: 72%;
  background: #fb7185;
  box-shadow: 0 0 7px rgba(251,113,133,0.68);
}

.layout-snap-guide {
  position: absolute;
  z-index: 5;
  display: none;
  pointer-events: none;
  filter: drop-shadow(0 0 4px rgba(34,211,238,0.86));
}
.layout-snap-guide.active { display: block; }
.layout-snap-guide.vertical {
  top: 0;
  bottom: 0;
  width: 1px;
  border-left: 1px dashed rgba(103,232,249,0.9);
}
.layout-snap-guide.horizontal {
  left: 0;
  right: 0;
  height: 1px;
  border-top: 1px dashed rgba(103,232,249,0.9);
}

.layout-editor-chip {
  position: absolute;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: #e2e8f0;
  cursor: grab;
  user-select: none;
  touch-action: none;
  transform: translate(-50%, -50%) scale(var(--chip-scale, 1));
  transform-origin: center;
  z-index: 4;
}
.layout-editor-chip * { pointer-events: none; }
.layout-editor-chip:active { cursor: grabbing; }
.layout-editor-chip.selected {
  z-index: 6;
  filter: drop-shadow(0 0 8px rgba(251,191,36,0.75));
}
.layout-editor-chip.selected::after,
.layout-editor-chip:focus-visible::after {
  content: "";
  position: absolute;
  inset: -5px;
  border: 2px solid #fbbf24;
  border-radius: inherit;
  box-shadow: 0 0 0 2px rgba(251,191,36,0.2);
  pointer-events: none;
}
.layout-control-movement { left: 10%; top: 82%; width: 12%; aspect-ratio: 1; }
.layout-control-sprint-analog,
.layout-control-sprint-button { left: 24%; top: 82%; width: 12%; aspect-ratio: 1; }
.layout-control-shoot { left: 91%; top: 83%; width: 12%; aspect-ratio: 1; }
.layout-control-web { left: 78%; top: 83%; width: 7%; aspect-ratio: 1; }
.layout-control-power-two { left: 80%; top: 70%; width: 7%; aspect-ratio: 1; }
.layout-control-guard { left: 91%; top: 59%; width: 7%; aspect-ratio: 1; }
.layout-control-hunt { left: 84%; top: 63%; width: 7%; aspect-ratio: 1; }
.layout-control-special-weapons { left: 91%; top: 43%; width: 7%; aspect-ratio: 1; }
.layout-control-drop-power { left: 80%; top: 56%; width: 7%; aspect-ratio: 1; }
.layout-control-game-back { left: 50%; top: 91%; width: 7%; aspect-ratio: 1; }

.layout-preview-game-back {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border: 1px solid rgba(148,163,184,0.55);
  border-radius: 999px;
  background: rgba(15,23,42,0.94);
  color: #f8fafc;
  box-shadow: 0 6px 16px rgba(0,0,0,0.38), inset 0 0 0 1px rgba(255,255,255,0.04);
  font-size: 1.4rem;
  font-weight: 700;
  line-height: 1;
}

.layout-preview-analog-shell {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  padding: 6%;
  border: 1px solid rgba(148,163,184,0.24);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(15,23,42,0.42), rgba(2,6,23,0.62));
  box-shadow: 0 8px 22px rgba(0,0,0,0.4), inset 0 0 0 1px rgba(255,255,255,0.035);
}
.layout-preview-stick {
  position: relative;
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid rgba(110,231,183,0.48);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(110,231,183,0.16), rgba(12,16,24,0.55));
  box-shadow: 0 7px 18px rgba(0,0,0,0.42), inset 0 0 0 1px rgba(255,255,255,0.06);
}
.layout-preview-stick.sprint {
  border-color: rgba(251,191,36,0.58);
  background: radial-gradient(circle, rgba(251,191,36,0.17), rgba(12,16,24,0.58));
}
.layout-preview-stick i {
  display: grid;
  width: 42%;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, rgba(190,255,232,0.95), rgba(34,197,154,0.78));
  color: #064e3b;
  font-size: clamp(5px, 0.65vw, 8px);
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
  box-shadow: 0 5px 12px rgba(0,0,0,0.38), inset 0 0 0 1px rgba(255,255,255,0.2);
}
.layout-preview-stick.sprint i {
  background: linear-gradient(145deg, #fef3c7, #f59e0b 64%, #92400e);
  color: #451a03;
}
.layout-preview-shoot,
.layout-preview-sprint-button,
.layout-preview-power,
.layout-preview-command,
.layout-preview-special-weapons {
  display: grid;
  width: 100%;
  height: 100%;
  place-content: center;
  border-radius: 50%;
  text-align: center;
  text-transform: uppercase;
}
.layout-preview-shoot {
  gap: 2%;
  background: radial-gradient(circle at 38% 30%, #d1fae5, rgba(110,231,183,0.95) 48%, rgba(20,184,166,0.95));
  color: #052e22;
  font-size: clamp(7px, 1.2vw, 14px);
  font-weight: 900;
  box-shadow: 0 9px 24px rgba(0,0,0,0.52), inset 0 0 0 1px rgba(255,255,255,0.15);
}
.layout-preview-shoot small {
  font-size: 0.62em;
  font-weight: 700;
  text-transform: none;
}
.layout-preview-sprint-button {
  gap: 3%;
  border: 2px solid rgba(251,191,36,0.7);
  background: radial-gradient(circle at 38% 30%, #fef3c7, #f59e0b 54%, #92400e);
  color: #451a03;
  font-size: clamp(6px, 1vw, 12px);
  font-weight: 950;
  box-shadow: 0 9px 24px rgba(0,0,0,0.5), 0 0 16px rgba(251,191,36,0.24), inset 0 0 0 1px rgba(255,255,255,0.2);
}
.layout-preview-sprint-button small { font-size: 0.52em; font-weight: 800; text-transform: none; }
.layout-preview-power,
.layout-preview-command,
.layout-preview-special-weapons {
  gap: 2%;
  padding: 4%;
  border: 1px solid rgba(148,163,184,0.48);
  background: rgba(15,23,42,0.92);
  color: #e2e8f0;
  font-size: clamp(5px, 0.72vw, 9px);
  font-weight: 850;
  box-shadow: 0 7px 20px rgba(0,0,0,0.46), inset 0 0 0 1px rgba(255,255,255,0.045);
}
.layout-preview-power small,
.layout-preview-command small { color: #94a3b8; font-size: 0.7em; font-weight: 800; }
.layout-preview-power.power-two { color: #c4b5fd; }
.layout-preview-command b { font-size: 1.75em; line-height: 1; }
.layout-preview-command.guard {
  border-color: #67e8f9;
  color: #ecfeff;
  background: radial-gradient(circle at 38% 28%, #155e75, #0f172a 72%);
  box-shadow: 0 7px 20px rgba(0,0,0,0.46), 0 0 14px rgba(34,211,238,0.38), inset 0 0 0 1px rgba(255,255,255,0.08);
}
.layout-preview-command.hunt { color: #fbbf24; }
.layout-preview-command.drop {
  border-color: rgba(248,113,113,0.62);
  color: #fecaca;
  background: radial-gradient(circle at 38% 28%, #7f1d1d, #1c1917 72%);
  box-shadow: 0 7px 20px rgba(0,0,0,0.46), 0 0 14px rgba(248,113,113,0.28), inset 0 0 0 1px rgba(255,255,255,0.07);
}
.layout-preview-special-weapons {
  gap: 2%;
  border: 1px solid #fde68a;
  background:
    radial-gradient(circle at 68% 24%, #fff 0 3%, transparent 4%),
    radial-gradient(circle at 31% 72%, #67e8f9 0 5%, transparent 6%),
    radial-gradient(circle at 38% 28%, #fef9c3, #eab308 47%, #78350f 100%);
  color: #451a03;
  font-size: clamp(5px, 0.72vw, 9px);
  font-weight: 950;
  box-shadow: 0 7px 20px rgba(0,0,0,0.46), 0 0 14px rgba(250,204,21,0.55), inset 0 0 0 1px rgba(255,255,255,0.28);
}
.layout-preview-special-weapons b { font-size: 0.82em; line-height: 1; }
.layout-preview-special-weapons small { font-size: 0.7em; font-weight: 900; }

@media (min-width: 700px) {
  .settings-card > .settings-section:first-of-type {
    display: grid;
    grid-template-columns: auto minmax(180px, 0.65fr) minmax(320px, 1.35fr);
    align-items: center;
    gap: 16px;
    margin-bottom: 12px;
    padding-bottom: 12px;
  }
  .settings-card > .settings-section:first-of-type h3,
  .settings-card > .settings-section:first-of-type .settings-row { margin: 0; }
}

@media (max-height: 620px) {
  .settings-card h2 { margin-bottom: 8px; }
  .settings-section { margin-bottom: 9px; padding-bottom: 8px; }
  .settings-section h3 { margin-bottom: 6px; }
  .settings-row { margin-bottom: 6px; }
  .settings-hint { margin-bottom: 6px; }
  #layout-editor-preview { width: min(100%, 760px); }
}

#landscape-guard {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 60;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: transparent;
  text-align: center;
}
.landscape-guard-card {
  display: grid;
  place-items: center;
  gap: 10px;
  color: #f8fafc;
  text-shadow: 0 2px 5px rgba(0,0,0,0.95), 0 0 12px rgba(0,0,0,0.8);
}
.landscape-guard-card strong { font-size: 1.35rem; }
.landscape-guard-card small { color: #94a3b8; font-size: 0.85rem; }
.landscape-phone {
  width: 72px;
  height: 42px;
  border: 4px solid var(--accent);
  border-radius: 9px;
  box-shadow: 0 0 20px rgba(110,231,183,0.22);
  animation: landscape-phone-rotate 1.8s ease-in-out infinite;
  transform-origin: center;
}
.landscape-phone::after {
  content: "";
  display: block;
  width: 4px;
  height: 4px;
  margin: 15px 0 0 60px;
  border-radius: 50%;
  background: var(--accent);
}
@keyframes landscape-phone-rotate {
  0%, 18% { transform: rotate(90deg); }
  52%, 88%, 100% { transform: rotate(0deg); }
}
kbd {
  background: #0b0e14; border: 1px solid #2a3240; border-radius: 5px;
  padding: 1px 6px; font-family: inherit; font-size: 0.85em;
}
.boot-error {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 50;
  padding: 10px 12px;
  border: 1px solid rgba(248,113,113,0.65);
  border-radius: 8px;
  background: rgba(30,10,12,0.94);
  color: #fee2e2;
  font-size: 0.82rem;
  line-height: 1.35;
  text-align: center;
}
.boot-status {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 18;
  transform: translate(-50%, -50%);
  max-width: min(82vw, 340px);
  padding: 12px 14px;
  border: 1px solid rgba(110,231,183,0.42);
  border-radius: 8px;
  background: rgba(12,16,24,0.9);
  color: #d1fae5;
  font-size: 0.92rem;
  line-height: 1.35;
  text-align: center;
  box-shadow: 0 10px 28px rgba(0,0,0,0.42);
}

/* ---- HUD ---- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }

.victim-effect-prompt {
  --victim-prompt-color: #fb7185;
  position: fixed;
  top: max(calc(env(safe-area-inset-top, 0px) + 78px), 16vh);
  left: 50%;
  z-index: 18;
  width: max-content;
  max-width: min(86vw, 520px);
  padding: 0;
  transform: translateX(-50%);
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--victim-prompt-color);
  font-size: clamp(0.76rem, 2vw, 0.92rem);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1.2;
  text-align: center;
  text-shadow: 0 2px 4px rgba(0,0,0,0.94), 0 0 8px rgba(0,0,0,0.72);
  text-wrap: balance;
  pointer-events: none;
  animation: victim-effect-prompt-in 180ms ease-out both;
}

@keyframes victim-effect-prompt-in {
  from { opacity: 0; transform: translate(-50%, -8px) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

body.spectating .victim-effect-prompt { display: none !important; }

@media (max-height: 500px) and (orientation: landscape) {
  .victim-effect-prompt {
    top: max(calc(env(safe-area-inset-top, 0px) + 70px), 18vh);
  }
}

.game-back-btn {
  position: fixed;
  right: 50%;
  bottom: max(10px, calc(env(safe-area-inset-bottom, 0px) + 8px));
  z-index: 40;
  width: var(--game-back-size);
  min-width: 0;
  height: var(--game-back-size);
  padding: 0;
  transform: translateX(50%);
  border: 1px solid #334155;
  border-radius: 999px;
  background: rgba(15,23,42,0.9);
  color: #e2e8f0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.38);
  font-size: calc(var(--game-back-size) * 0.62);
  font-weight: 600;
  line-height: 1;
  pointer-events: auto;
  touch-action: manipulation;
  user-select: none;
}
.game-back-btn:hover,
.game-back-btn:focus-visible { border-color: rgba(110,231,183,0.75); }

.game-back-confirm {
  z-index: 80;
  pointer-events: none;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background:
    radial-gradient(circle at 50% 44%, rgba(110,231,183,0.12), transparent 30%),
    rgba(5,8,13,0.88);
  backdrop-filter: blur(8px);
}
.game-back-confirm-card {
  pointer-events: auto;
  width: min(88vw, 390px);
  padding: clamp(22px, 5vw, 30px);
  overflow: hidden;
  border-color: rgba(110,231,183,0.38);
  background: linear-gradient(155deg, rgba(25,33,46,0.98), rgba(12,16,24,0.98));
  box-shadow:
    0 24px 70px rgba(0,0,0,0.72),
    inset 0 0 0 1px rgba(255,255,255,0.035),
    0 0 32px rgba(52,211,153,0.08);
}
.game-back-confirm-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin: 0 auto 13px;
  border: 2px solid rgba(110,231,183,0.7);
  border-radius: 999px;
  background: rgba(16,185,129,0.12);
  color: #a7f3d0;
  font-size: 2rem;
  font-weight: 300;
  line-height: 1;
  box-shadow: 0 0 18px rgba(52,211,153,0.16);
}
.game-back-confirm-card h2 {
  margin: 0 0 8px;
  color: #f8fafc;
  font-size: clamp(1.35rem, 5vw, 1.7rem);
}
.game-back-confirm-card p {
  margin: 0 0 20px;
  color: #94a3b8;
  line-height: 1.45;
}
.game-back-confirm-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.game-back-confirm-actions button {
  position: relative;
  z-index: 1;
  margin: 0;
  pointer-events: auto;
  touch-action: manipulation;
}
#game-back-leave-btn {
  border-color: #34d399;
  background: linear-gradient(145deg, #34d399, #059669);
  color: #042f24;
  box-shadow: 0 8px 22px rgba(5,150,105,0.24);
}
#game-back-leave-btn:hover,
#game-back-leave-btn:focus-visible { border-color: #a7f3d0; }

.spectator-panel {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: 70;
  display: grid;
  grid-template-areas: "back copy zoom";
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  box-sizing: border-box;
  width: min(720px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  padding: 8px;
  transform: translateX(-50%);
  border: 1px solid rgba(110,231,183,0.35);
  border-radius: 12px;
  background: rgba(7,11,18,0.88);
  box-shadow: 0 10px 32px rgba(0,0,0,0.48), inset 0 0 0 1px rgba(255,255,255,0.035);
  backdrop-filter: blur(7px);
  pointer-events: auto;
}
.spectator-panel button {
  width: auto;
  min-width: 40px;
  padding: 8px 11px;
  border: 1px solid #334155;
  background: rgba(15,23,42,0.9);
  color: #e2e8f0;
  font-size: 0.78rem;
  touch-action: manipulation;
  user-select: none;
}
.spectator-back-btn {
  grid-area: back;
  white-space: nowrap;
}
.offline-panel {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top, 0px));
  left: 50%;
  z-index: 16;
  display: grid;
  grid-template-columns: auto minmax(190px, auto);
  align-items: center;
  gap: 12px;
  width: auto;
  max-width: calc(100vw - 32px);
  padding: 8px;
  transform: translateX(-50%);
  border: 1px solid rgba(56,189,248,0.42);
  border-radius: 12px;
  background: rgba(7,11,18,0.9);
  box-shadow: 0 10px 32px rgba(0,0,0,0.48), inset 0 0 0 1px rgba(255,255,255,0.035);
  backdrop-filter: blur(7px);
  pointer-events: auto;
}
.offline-panel button {
  width: auto;
  min-width: 40px;
  padding: 8px 11px;
  border: 1px solid #334155;
  background: rgba(15,23,42,0.9);
  color: #e2e8f0;
  font-size: 0.78rem;
  white-space: nowrap;
}
.offline-copy {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: #f8fafc;
  text-align: center;
}
.offline-copy strong { color: #38bdf8; font-size: 0.82rem; }
.offline-copy small { color: #94a3b8; font-size: 0.65rem; }
.offline-panel.collapsed {
  left: max(10px, calc(env(safe-area-inset-left, 0px) + 8px));
  grid-template-columns: auto;
  gap: 0;
  padding: 0;
  transform: none;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.offline-panel.collapsed .offline-copy { display: none; }
.offline-panel.collapsed button {
  padding: 7px 9px;
  opacity: 0.68;
}
.offline-panel.collapsed button:hover,
.offline-panel.collapsed button:focus-visible { opacity: 1; }
.spectator-copy {
  grid-area: copy;
  display: grid;
  gap: 2px;
  min-width: 0;
  color: #f8fafc;
  text-align: center;
}
.spectator-copy strong { font-size: 0.82rem; }
.spectator-copy strong span { color: var(--accent); }
.spectator-copy small {
  overflow: hidden;
  color: #94a3b8;
  font-size: 0.65rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.spectator-zoom {
  grid-area: zoom;
  display: grid;
  grid-template-columns: 34px 48px 34px;
  align-items: center;
  gap: 4px;
}
.spectator-zoom button {
  min-width: 34px;
  padding: 7px 0;
  color: #d1fae5;
  font-size: 1rem;
}
#spectator-zoom-value {
  color: #cbd5e1;
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}
body.spectating #stats-summary,
body.spectating #action-cooldown,
body.spectating #effect-timer,
body.spectating #royal-summon-timer,
body.spectating #companion-bar,
body.spectating #self-life-hud { display: none !important; }

@media (max-width: 650px) {
  .spectator-panel {
    top: max(8px, env(safe-area-inset-top, 0px));
    gap: 7px;
    width: calc(100vw - 20px);
    max-width: none;
    padding: 6px;
  }
  .spectator-panel button { padding: 7px 9px; }
  .spectator-copy small { font-size: 0.58rem; }
  .spectator-zoom { grid-template-columns: 30px 40px 30px; }
  .spectator-zoom button { min-width: 30px; }
}

@media (max-width: 540px) {
  .spectator-panel {
    grid-template-areas:
      "back zoom"
      "copy copy";
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 5px;
  }
  .spectator-back-btn { justify-self: start; }
  .spectator-zoom { justify-self: end; }
  .spectator-copy small {
    overflow: visible;
    line-height: 1.25;
    text-overflow: clip;
    white-space: normal;
  }
}

#self-life-hud {
  --life-color: hsl(120, 92%, 52%);
  position: absolute;
  top: env(safe-area-inset-top, 0px);
  left: 50%;
  width: clamp(100px, 25vw, 260px);
  padding: 6px 8px 7px;
  transform: translateX(-50%);
  border: 1px solid rgba(148,163,184,0.3);
  border-radius: 9px;
  background: rgba(12,16,24,0.76);
  box-shadow: 0 7px 20px rgba(0,0,0,0.34), inset 0 0 0 1px rgba(255,255,255,0.035);
  backdrop-filter: blur(5px);
}
#self-life-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  margin-bottom: 4px;
  color: #cbd5e1;
  font-size: clamp(0.56rem, 1.7vw, 0.72rem);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
#self-life-value {
  color: var(--life-color);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}
#self-life-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15,23,42,0.95);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.7);
}
#self-life-fill {
  width: 100%;
  height: 100%;
  transform: scaleX(1);
  transform-origin: left center;
  border-radius: inherit;
  background: var(--life-color);
  box-shadow: 0 0 10px color-mix(in srgb, var(--life-color) 62%, transparent);
  transition: transform 70ms linear, background-color 120ms linear;
}

#victim-life-hud {
  --victim-life-color: #fb7185;
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid rgba(248,113,113,0.26);
}

#victim-life-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  margin-bottom: 4px;
  color: #fecdd3;
  font-size: clamp(0.56rem, 1.7vw, 0.72rem);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#victim-life-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#victim-life-value {
  flex: 0 0 auto;
  color: var(--victim-life-color);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

#victim-life-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15,23,42,0.95);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.7);
}

#victim-life-fill {
  width: 100%;
  height: 100%;
  transform: scaleX(1);
  transform-origin: left center;
  border-radius: inherit;
  background: var(--victim-life-color);
  box-shadow: 0 0 10px color-mix(in srgb, var(--victim-life-color) 68%, transparent);
  transition: transform 70ms linear, background-color 120ms linear;
}

#web-slow-hud {
  --web-slow-color: #60a5fa;
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid rgba(96,165,250,0.3);
}

#web-slow-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  margin-bottom: 4px;
  color: #bfdbfe;
  font-size: clamp(0.56rem, 1.7vw, 0.72rem);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

#web-slow-value {
  flex: 0 0 auto;
  color: #dbeafe;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0;
}

#web-slow-track {
  width: 100%;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(15,23,42,0.95);
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.7);
}

#web-slow-fill {
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  border-radius: inherit;
  background: linear-gradient(90deg, #2563eb, var(--web-slow-color), #dbeafe);
  box-shadow: 0 0 10px rgba(96,165,250,0.68);
  transition: transform 70ms linear;
}

.power-icon {
  --power-color: #6ee7b7;
  position: absolute;
  top: calc(var(--power-top) + env(safe-area-inset-top));
  left: 50%;
  width: var(--power-size);
  height: var(--power-size);
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--power-color) 64%, transparent);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 35%, color-mix(in srgb, var(--power-color) 34%, transparent), transparent 58%),
    rgba(12,16,24,0.78);
  box-shadow:
    0 10px 26px rgba(0,0,0,0.38),
    0 0 18px color-mix(in srgb, var(--power-color) 30%, transparent),
    inset 0 0 0 1px rgba(255,255,255,0.06);
  backdrop-filter: blur(5px);
}
.power-icon::after {
  content: "";
  position: absolute;
  inset: 6px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.08);
}
.power-icon-glyph {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--power-color) 82%, white) 0 24%, var(--power-color) 25% 48%, rgba(15,23,42,0.92) 49% 100%);
  box-shadow: 0 0 13px color-mix(in srgb, var(--power-color) 55%, transparent);
}
.power-icon-glyph::before,
.power-icon-glyph::after {
  content: "";
  position: absolute;
  display: block;
}
.power-icon-count {
  position: absolute;
  right: -5px;
  bottom: -5px;
  min-width: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(2,6,23,0.96);
  border: 1px solid color-mix(in srgb, var(--power-color) 72%, transparent);
  color: #f8fafc;
  font-size: 0.72rem;
  line-height: 17px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 0 10px rgba(0,0,0,0.42);
}
.power-icon-count:empty { display: none; }
.power-icon.power-electric .power-icon-glyph::before,
.power-icon.power-laser .power-icon-glyph::before {
  left: 11px;
  top: 3px;
  width: 14px;
  height: 28px;
  background: #f8fafc;
  clip-path: polygon(58% 0, 16% 45%, 45% 45%, 30% 100%, 86% 36%, 55% 36%);
  filter: drop-shadow(0 0 7px var(--power-color));
}
.power-icon.power-freeze .power-icon-glyph::before {
  left: 16px;
  top: 4px;
  width: 2px;
  height: 26px;
  background: #f8fafc;
  border-radius: 999px;
  box-shadow: 0 0 8px var(--power-color);
}
.power-icon.power-freeze .power-icon-glyph::after {
  left: 4px;
  top: 16px;
  width: 26px;
  height: 2px;
  background: #f8fafc;
  border-radius: 999px;
  box-shadow:
    0 0 8px var(--power-color),
    0 0 0 0 transparent;
  transform: rotate(45deg);
}
.power-icon.power-poison .power-icon-glyph::before,
.power-icon.power-leech .power-icon-glyph::before {
  left: 10px;
  top: 7px;
  width: 15px;
  height: 20px;
  border-radius: 55% 55% 55% 12%;
  background: #d9f99d;
  transform: rotate(-38deg);
  box-shadow: 0 0 9px var(--power-color);
}
.power-icon.power-poison .power-icon-glyph::after {
  right: 5px;
  top: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(236,253,245,0.88);
  box-shadow: -19px 19px 0 -1px rgba(134,239,172,0.72), -2px 21px 0 -2px rgba(134,239,172,0.54);
}
.power-icon.power-fireworks .power-icon-glyph::before {
  left: 15px;
  top: 15px;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff7ad;
  box-shadow:
    0 -13px 0 0 #fff7ad,
    10px -8px 0 -1px #fb923c,
    13px 2px 0 -1px #facc15,
    6px 12px 0 -1px #fb923c,
    -7px 11px 0 -1px #facc15,
    -13px 0 0 -1px #fb923c,
    -9px -10px 0 -1px #facc15;
}
.power-icon.power-invisible .power-icon-glyph::before {
  left: 5px;
  top: 10px;
  width: 24px;
  height: 14px;
  border: 2px solid #ecfeff;
  border-radius: 50%;
  background: color-mix(in srgb, var(--power-color) 58%, transparent);
  box-shadow: 0 0 9px var(--power-color);
}
.power-icon.power-invisible .power-icon-glyph::after {
  left: 8px;
  top: 16px;
  width: 22px;
  height: 2px;
  border-radius: 999px;
  background: #ecfeff;
  transform: rotate(-42deg);
  box-shadow: 0 0 6px var(--power-color);
}
.power-icon.power-shield .power-icon-glyph::before {
  left: 8px;
  top: 5px;
  width: 18px;
  height: 23px;
  border: 2px solid #f0f9ff;
  border-radius: 9px 9px 12px 12px;
  background: color-mix(in srgb, var(--power-color) 42%, transparent);
  clip-path: polygon(50% 0, 100% 18%, 88% 70%, 50% 100%, 12% 70%, 0 18%);
  box-shadow: 0 0 10px var(--power-color);
}
.power-icon.power-cleanse .power-icon-glyph::before {
  left: 14px;
  top: 5px;
  width: 7px;
  height: 24px;
  border-radius: 2px;
  background: #fefce8;
  box-shadow: 0 0 9px var(--power-color);
}
.power-icon.power-cleanse .power-icon-glyph::after {
  left: 5px;
  top: 14px;
  width: 24px;
  height: 7px;
  border-radius: 2px;
  background: #fefce8;
  box-shadow: 0 0 9px var(--power-color);
}
.power-icon.power-zombify .power-icon-glyph::before {
  left: 9px;
  top: 8px;
  width: 16px;
  height: 18px;
  border-radius: 50% 50% 42% 42%;
  background: #ddd6fe;
  box-shadow: 0 0 10px var(--power-color);
}
.power-icon.power-zombify .power-icon-glyph::after {
  left: 13px;
  top: 15px;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #312e81;
  box-shadow: 6px 0 0 #312e81, 3px 6px 0 0 #312e81;
}
.power-icon.power-mines .power-icon-glyph::before {
  left: 9px;
  top: 9px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #020617;
  border: 2px solid #f59e0b;
  box-shadow: 0 0 10px var(--power-color);
}
.power-icon.power-mines .power-icon-glyph::after {
  left: 15px;
  top: 2px;
  width: 4px;
  height: 30px;
  border-radius: 999px;
  background: #f8fafc;
  transform: rotate(45deg);
}
.power-icon.power-rpg .power-icon-glyph::before {
  left: 6px;
  top: 12px;
  width: 24px;
  height: 10px;
  background: #f8fafc;
  clip-path: polygon(0 18%, 62% 18%, 100% 50%, 62% 82%, 0 82%);
  filter: drop-shadow(0 0 7px var(--power-color));
}
.power-icon.power-rpg .power-icon-glyph::after {
  left: 3px;
  top: 14px;
  width: 8px;
  height: 6px;
  background: #fb923c;
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
}
.power-icon.power-surge .power-icon-glyph::before,
.power-icon.power-bite .power-icon-glyph::before,
.power-icon.power-dizzy .power-icon-glyph::before {
  left: 8px;
  top: 8px;
  width: 18px;
  height: 18px;
  border: 3px solid #f8fafc;
  border-radius: 50%;
  border-left-color: transparent;
  box-shadow: 0 0 9px var(--power-color);
}
.power-icon.power-bite .power-icon-glyph::after {
  left: 9px;
  top: 6px;
  width: 6px;
  height: 20px;
  border-radius: 999px 999px 2px 2px;
  background: #fee2e2;
  transform: rotate(18deg);
  box-shadow: 10px 2px 0 -1px #fee2e2;
}
.power-icon.power-dizzy .power-icon-glyph::after {
  left: 7px;
  top: 7px;
  width: 20px;
  height: 20px;
  border: 2px dashed #facc15;
  border-radius: 50%;
}

#leaderboard {
  position: absolute;
  top: calc(var(--hud-edge) + env(safe-area-inset-top));
  right: calc(var(--hud-edge) + env(safe-area-inset-right));
  background: rgba(12,16,24,0.7);
  border: 1px solid #232a37;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px;
  width: var(--leaderboard-min-width);
  min-width: var(--leaderboard-min-width);
  max-width: var(--leaderboard-min-width);
  height: var(--hud-card-height);
  min-height: var(--hud-card-height);
  max-height: var(--hud-card-height);
  overflow: hidden;
  backdrop-filter: blur(4px);
  text-align: center;
}
#leaderboard h3 {
  width: 100%;
  margin: 0;
  font-size: 0.8rem;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #94a3b8;
}
#lb-list {
  flex: 1 1 auto;
  display: grid;
  grid-auto-rows: auto;
  align-items: center;
  align-content: center;
  gap: 3px;
  width: 100%;
  max-width: 100%;
  height: auto;
  min-height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: leaderboard-rank;
  font-size: calc(var(--leaderboard-font-size) * var(--leaderboard-auto-scale, 1));
  text-align: center;
}
#lb-list li {
  counter-increment: leaderboard-rank;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
  white-space: nowrap;
  text-align: center;
}
#lb-list li::before {
  content: counter(leaderboard-rank) ".";
  flex: 0 0 auto;
  min-width: 1.15em;
  text-align: right;
  color: inherit;
}
.leaderboard-entry-text {
  flex: 0 1 auto;
  min-width: 0;
  max-width: calc(100% - 1.15em - 3px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}
#lb-list li.me { color: var(--accent); font-weight: 700; }
#lb-list li.king { color: #facc15; font-weight: 800; text-shadow: 0 0 8px rgba(250,204,21,0.28); }
#lb-list li.prince { color: #e2e8f0; font-weight: 750; text-shadow: 0 0 7px rgba(226,232,240,0.22); }
#lb-list li.queen { color: #f0abfc; font-weight: 800; text-shadow: 0 0 8px rgba(240,171,252,0.3); }
#lb-list li.princess { color: #ddd6fe; font-weight: 750; text-shadow: 0 0 7px rgba(221,214,254,0.24); }
#lb-list li.king.me { color: #facc15; }
#lb-list li.prince.me { color: #e2e8f0; }
#lb-list li.queen.me { color: #f0abfc; }
#lb-list li.princess.me { color: #ddd6fe; }

#stats {
  position: absolute;
  top: calc(var(--hud-edge) + env(safe-area-inset-top));
  left: calc(var(--hud-edge) + env(safe-area-inset-left));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 3px;
  background: rgba(12,16,24,0.7);
  border: 1px solid #232a37;
  border-radius: 10px;
  padding: 8px;
  width: var(--stats-panel-width);
  min-width: var(--stats-panel-width);
  max-width: var(--stats-panel-width);
  height: auto;
  min-height: var(--hud-card-height);
  overflow: hidden;
  font-size: var(--hud-font-size);
  backdrop-filter: blur(4px);
}
body.hud-swapped #leaderboard {
  right: auto;
  left: calc(var(--hud-edge) + env(safe-area-inset-left));
}
body.hud-swapped #stats {
  left: auto;
  right: calc(var(--hud-edge) + env(safe-area-inset-right));
}
#stats strong { color: var(--accent); }
#stats span { white-space: nowrap; }
#stats-summary {
  order: 1;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-size: 0.66rem;
  line-height: 1;
}
#stats-summary > span {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
#stat-score {
  min-width: 0;
  letter-spacing: -0.015em;
  white-space: nowrap;
}
#action-cooldown,
#effect-timer,
#royal-summon-timer,
#companion-bar {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
#action-cooldown {
  order: 2;
  --action-timer-color: #6ee7b7;
  width: 100%;
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 3px 5px;
  border: 1px solid color-mix(in srgb, var(--action-timer-color) 42%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--action-timer-color) 8%, rgba(7,11,18,0.8));
  box-sizing: border-box;
}
#action-cooldown-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: #e2e8f0;
  font-size: 0.58rem;
  font-weight: 750;
  line-height: 1;
  letter-spacing: 0.025em;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
#action-cooldown-label > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
#stat-web {
  color: var(--action-timer-color);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
}
#action-cooldown-track {
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148,163,184,0.18);
}
#action-cooldown-fill {
  width: 100%;
  height: 100%;
  transform-origin: left center;
  transform: scaleX(1);
  background: linear-gradient(90deg, var(--action-timer-color), #fbbf24);
  transition: transform 80ms linear;
}
#minimap,
#mini-map-2 {
  order: 6;
  /* A growing flex height can diverge from the canvas backing-store aspect
     after an orientation reflow and stretch every rendered marker. */
  flex: 0 0 auto;
  position: static;
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  height: auto;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: 1;
  margin: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  box-shadow: none;
  cursor: default;
}
#mini-map-2 {
  overflow: hidden;
  contain: paint;
}
#minimap[hidden] { display: none; }
#effect-timer {
  order: 3;
  --effect-timer-color: #a78bfa;
  width: 100%;
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 3px 5px;
  border: 1px solid color-mix(in srgb, var(--effect-timer-color) 42%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--effect-timer-color) 8%, rgba(7,11,18,0.8));
  box-sizing: border-box;
}
#effect-timer.hidden { display: none; }
#effect-timer-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: #e2e8f0;
  font-size: 0.58rem;
  font-weight: 750;
  line-height: 1;
  letter-spacing: 0.025em;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
#effect-timer-label strong {
  color: var(--effect-timer-color);
  font-variant-numeric: tabular-nums;
}
#effect-timer-label span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
#effect-timer-track {
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148,163,184,0.18);
}
#effect-timer-fill {
  width: 100%;
  height: 100%;
  transform-origin: left center;
  transform: scaleX(0);
  background: linear-gradient(90deg, #a78bfa, #f0abfc);
  transition: transform 80ms linear, background 120ms ease;
}

#royal-summon-timer {
  order: 4;
  --royal-timer-color: #facc15;
  width: 100%;
  display: grid;
  gap: 2px;
  margin-top: 0;
  padding: 3px 5px;
  border: 1px solid color-mix(in srgb, var(--royal-timer-color) 42%, transparent);
  border-radius: 8px;
  background: color-mix(in srgb, var(--royal-timer-color) 8%, rgba(7,11,18,0.8));
  box-sizing: border-box;
}
#royal-summon-timer.hidden { display: none; }
#royal-summon-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: #e2e8f0;
  font-size: 0.58rem;
  font-weight: 750;
  line-height: 1;
  letter-spacing: 0.025em;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}
#royal-summon-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
#royal-summon-time {
  color: var(--royal-timer-color);
  font-variant-numeric: tabular-nums;
}
#royal-summon-track {
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(148,163,184,0.18);
}
#royal-summon-fill {
  width: 100%;
  height: 100%;
  transform: scaleX(0);
  transform-origin: left center;
  background: linear-gradient(90deg, var(--royal-timer-color), #fff7ad);
  transition: transform 100ms linear;
}

#companion-bar {
  order: 5;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 2px;
  min-height: 0;
  padding: 0;
}
#companion-bar.hidden { display: none; }
.companion-row {
  flex: 1 1 0;
  width: auto;
  min-width: 0;
  min-height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  overflow: hidden;
}
.companion-row.hidden { display: none; }
.companion-row-label {
  flex: 0 0 auto;
  color: #94a3b8;
  font-size: 0.48rem;
  font-weight: 750;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.companion-items {
  min-width: 0;
  max-width: calc(100% - 30px);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  overflow: hidden;
}
.companion-chip {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 16px;
  height: 16px;
  border-radius: 5px;
  border: 1px solid rgba(148,163,184,0.24);
  background: rgba(15,23,42,0.72);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}
.companion-chip.feeding {
  border-color: rgba(110,231,183,0.72);
  box-shadow: 0 0 10px rgba(110,231,183,0.22), inset 0 0 0 1px rgba(255,255,255,0.08);
}
.companion-icon {
  position: relative;
  width: 14px;
  height: 11px;
  transform: scale(0.8);
}
.companion-icon::before,
.companion-icon::after {
  content: "";
  position: absolute;
  display: block;
}
.companion-icon.minion::before {
  left: 2px;
  top: 2px;
  width: 10px;
  height: 7px;
  border-radius: 999px;
  background: #6ee7b7;
}
.companion-icon.minion::after { display: none; }
.companion-icon.minion.tarantula::before { background: var(--skin-tarantula-body, #8b5a2b); }
.companion-icon.minion.widow::before { background: var(--skin-widow-body, #050508); box-shadow: inset 0 0 0 1px var(--skin-widow-mark, #ef4444); }
.companion-icon.minion.cyborg::before { background: var(--skin-cyborg-body, #94a3b8); box-shadow: inset 0 0 0 1px var(--skin-cyborg-accent, #38bdf8); }
.companion-icon.minion.zombie::before { background: #a78bfa; }
.companion-icon.leech::before {
  left: 1px;
  top: 2px;
  width: 12px;
  height: 7px;
  border-radius: 45% 55% 55% 45%;
  background: linear-gradient(135deg, #111827, #e2e8f0 48%, #475569);
}
.companion-icon.leech::after { display: none; }
.companion-size {
  position: absolute;
  top: -11px;
  left: 50%;
  transform: translateX(-50%);
  min-width: 16px;
  color: #e2e8f0;
  font-size: 0.58rem;
  line-height: 10px;
  text-align: center;
  font-weight: 800;
  text-shadow: 0 1px 3px rgba(0,0,0,0.9);
  font-variant-numeric: tabular-nums;
}
.companion-count {
  position: absolute;
  right: -5px;
  bottom: -6px;
  min-width: 14px;
  padding: 0 3px;
  border-radius: 999px;
  background: rgba(2,6,23,0.92);
  border: 1px solid rgba(110,231,183,0.55);
  color: #d1fae5;
  font-size: 0.58rem;
  line-height: 12px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* ---- Touch analog controls ---- */
#movement-control-stack,
#sprint-control-stack {
  position: fixed;
  left: calc(var(--control-stack-edge) + env(safe-area-inset-left));
  bottom: calc(var(--control-stack-edge) + env(safe-area-inset-bottom));
  width: auto;
  display: grid;
  place-items: center;
  padding: 6px;
  border: 1px solid rgba(148,163,184,0.24);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(15,23,42,0.32), rgba(2,6,23,0.54));
  box-shadow: 0 12px 34px rgba(0,0,0,0.34), inset 0 0 0 1px rgba(255,255,255,0.035);
  z-index: 14;
  pointer-events: none;
  touch-action: none;
  user-select: none;
}
#sprint-control-stack {
  left: calc(var(--control-stack-edge) + var(--control-size) + var(--control-stack-gap) + 14px + env(safe-area-inset-left));
}
#joystick,
#sprint-joystick {
  position: relative;
  flex: 0 0 auto;
  width: var(--control-size);
  height: var(--control-size);
  border-radius: 50%;
  z-index: 15;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  box-shadow: 0 10px 28px rgba(0,0,0,0.42), inset 0 0 0 1px rgba(255,255,255,0.06);
}
#joystick {
  border: 2px solid rgba(110,231,183,0.48);
  background: radial-gradient(circle at 50% 50%, rgba(110,231,183,0.16), rgba(12,16,24,0.46));
}
#joystick-knob,
#sprint-joystick-knob {
  position: absolute;
  border-radius: 50%;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  box-shadow: 0 7px 18px rgba(0,0,0,0.38), inset 0 0 0 1px rgba(255,255,255,0.2);
}
#joystick-knob {
  width: var(--control-knob-size);
  height: var(--control-knob-size);
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, rgba(190,255,232,0.92), rgba(34,197,154,0.74));
}

#sprint-joystick {
  border: 2px solid rgba(251,191,36,0.58);
  background: radial-gradient(circle at 50% 50%, rgba(251,191,36,0.17), rgba(12,16,24,0.55));
}
#sprint-joystick-knob {
  width: var(--control-knob-size);
  height: var(--control-knob-size);
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, #fef3c7, #f59e0b 64%, #92400e);
  color: #fde68a;
  border: 1px solid rgba(255,255,255,0.32);
}
#joystick-knob span,
#sprint-joystick-knob span {
  color: #451a03;
  font-size: clamp(0.38rem, 1.8vmin, 0.54rem);
  font-weight: 900;
  line-height: 1;
  text-transform: uppercase;
}
#joystick-knob span { color: #064e3b; }
#sprint-joystick.active {
  border-color: #fbbf24;
  background: radial-gradient(circle at 50% 50%, rgba(251,191,36,0.3), rgba(69,26,3,0.55));
  box-shadow: 0 8px 22px rgba(0,0,0,0.46), 0 0 18px rgba(251,191,36,0.36), inset 0 0 0 1px rgba(255,255,255,0.08);
}
#sprint-joystick.unavailable { opacity: 0.44; }

#sprint-hold-btn {
  position: fixed;
  left: calc(var(--control-stack-edge) + var(--control-size) + var(--control-stack-gap) + 14px + env(safe-area-inset-left));
  bottom: calc(var(--control-stack-edge) + env(safe-area-inset-bottom));
  width: var(--sprint-button-size);
  height: var(--sprint-button-size);
  display: grid;
  place-items: center;
  padding: 0;
  border: 2px solid rgba(251,191,36,0.7);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #fef3c7, #f59e0b 54%, #92400e);
  color: #451a03;
  z-index: 15;
  box-shadow: 0 10px 28px rgba(0,0,0,0.48), 0 0 18px rgba(251,191,36,0.24), inset 0 0 0 1px rgba(255,255,255,0.22);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}
#sprint-hold-btn span {
  display: grid;
  gap: 3px;
  color: inherit;
  font-size: 0.82rem;
  font-weight: 950;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
}
#sprint-hold-btn small { font-size: 0.55rem; font-weight: 800; text-transform: none; }
#sprint-hold-btn.active,
#sprint-hold-btn.pressed {
  filter: brightness(1.12);
  box-shadow: 0 10px 28px rgba(0,0,0,0.48), 0 0 24px rgba(251,191,36,0.62), inset 0 0 0 2px rgba(255,255,255,0.28);
  transform: scale(0.96);
}
#sprint-hold-btn.unavailable { opacity: 0.44; filter: saturate(0.45); }

/* ---- Mobile shoot and stored-power selector ---- */
#mobile-shoot-btn {
  position: fixed;
  right: calc(var(--action-edge) + env(safe-area-inset-right));
  bottom: calc(var(--action-edge) + env(safe-area-inset-bottom));
  width: var(--action-size);
  height: var(--action-size);
  display: grid;
  place-items: center;
  padding: 0;
  font-size: 0.92rem;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, #d1fae5, rgba(110,231,183,0.95) 48%, rgba(20,184,166,0.95));
  z-index: 15;
  box-shadow: 0 10px 28px rgba(0,0,0,0.52), 0 0 0 1px rgba(255,255,255,0.15) inset;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}
#mobile-shoot-btn:active,
#mobile-shoot-btn.pressed {
  filter: brightness(1.12);
  transform: scale(0.96);
}
#mobile-shoot-btn span {
  display: grid;
  gap: 2px;
  color: #052e22;
  line-height: 1;
  text-align: center;
  font-weight: 850;
  text-transform: uppercase;
}
#mobile-shoot-btn small {
  font-size: 0.65rem;
  font-weight: 700;
  opacity: 0.72;
  text-transform: none;
}
.power-slot-btn {
  --mode-color: #a78bfa;
  position: fixed;
  width: var(--mode-button-size);
  height: var(--mode-button-size);
  display: grid;
  place-content: center;
  gap: 2px;
  padding: 0 4px;
  border: 1px solid rgba(148,163,184,0.42);
  border-radius: 50%;
  background: rgba(15,23,42,0.9);
  color: #e2e8f0;
  z-index: 15;
  box-shadow: 0 8px 22px rgba(0,0,0,0.46), inset 0 0 0 1px rgba(255,255,255,0.04);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  font-size: 0.66rem;
  line-height: 1;
}
.power-slot-btn::before {
  content: "";
  position: absolute;
  inset: -6px;
  padding: 3px;
  border-radius: 50%;
  background: #3f3f46;
  -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  box-shadow: 0 0 0 1px rgba(15,23,42,0.9), 0 3px 10px rgba(0,0,0,0.48);
  pointer-events: none;
  transition: background 90ms linear, box-shadow 140ms ease;
}
.power-slot-btn.power-ring-running::before {
  background: conic-gradient(
    from -90deg,
    var(--power-ring-timer-color) calc(var(--power-ring-progress) * 1turn),
    #3f3f46 0
  );
  box-shadow: 0 0 0 1px rgba(15,23,42,0.9), 0 0 11px color-mix(in srgb, var(--power-ring-timer-color) 72%, transparent), 0 3px 10px rgba(0,0,0,0.48);
}
.power-slot-btn::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--power-flash-color, #22c55e);
  opacity: 0;
  pointer-events: none;
}
.power-slot-btn.power-button-engaged::after {
  animation: power-button-engagement-flash 620ms ease-out;
}
@keyframes power-button-engagement-flash {
  0% { opacity: 0.92; box-shadow: inset 0 0 18px rgba(255,255,255,0.62), 0 0 18px var(--power-flash-color, #22c55e); }
  38% { opacity: 0.68; }
  100% { opacity: 0; box-shadow: inset 0 0 0 rgba(255,255,255,0), 0 0 0 var(--power-flash-color, #22c55e); }
}
#web-mode-btn {
  right: calc(var(--mode-button-right) + env(safe-area-inset-right));
  bottom: calc(var(--mode-button-bottom) + env(safe-area-inset-bottom));
}
#power-slot-2-btn {
  right: calc(var(--power-slot-2-right) + env(safe-area-inset-right));
  bottom: calc(var(--power-slot-2-bottom) + env(safe-area-inset-bottom));
}
.power-slot-btn .web-mode-label { font-weight: 850; text-transform: uppercase; }
.power-slot-btn .web-mode-detail {
  max-width: 100%;
  overflow: hidden;
  color: #94a3b8;
  font-size: 0.52rem;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.power-slot-btn .power-icon {
  position: relative;
  top: auto;
  left: auto;
  width: calc(var(--mode-button-size) * 0.42);
  height: calc(var(--mode-button-size) * 0.42);
  margin: 0 auto;
  transform: none;
  border: 0;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}
.power-slot-btn .power-icon::after { display: none; }
.power-slot-btn .power-icon-glyph {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border-radius: 0;
  background: none;
  color: #f8fafc;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Segoe UI Symbol", sans-serif;
  font-size: calc(var(--mode-button-size) * 0.34);
  font-weight: 800;
  line-height: 1;
  box-shadow: none;
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--power-color) 70%, transparent));
}
.power-slot-btn .power-icon .power-icon-glyph::before,
.power-slot-btn .power-icon .power-icon-glyph::after {
  content: none;
  display: none;
}
.power-slot-btn .power-icon-count {
  right: -3px;
  bottom: -2px;
  min-width: 17px;
  padding-inline: 4px;
  font-size: 0.62rem;
  line-height: 15px;
}
.power-slot-btn.has-power-icon {
  gap: 0;
  padding: 2px;
}
.power-slot-btn.has-power-icon .web-mode-label { display: none; }
.power-slot-btn.has-power-icon .web-mode-detail {
  max-width: calc(var(--mode-button-size) - 8px);
  margin-top: -1px;
  font-size: 0.47rem;
}
.power-slot-btn.power {
  border-color: var(--mode-color);
  background: radial-gradient(circle at 38% 28%, color-mix(in srgb, var(--mode-color) 36%, #0f172a), #0f172a 72%);
  color: #fff;
  box-shadow: 0 7px 20px rgba(0,0,0,0.46), 0 0 15px color-mix(in srgb, var(--mode-color) 48%, transparent), inset 0 0 0 1px rgba(255,255,255,0.08);
}
.power-slot-btn.power .web-mode-detail { color: rgba(255,255,255,0.82); }
.power-slot-btn.unavailable { opacity: 0.48; }
.power-slot-btn.power-button-engaged.unavailable,
.power-slot-btn.power-ring-running.unavailable { opacity: 0.82; }
.power-slot-btn:active { transform: scale(0.94); }

.royal-command-btn {
  position: fixed;
  width: var(--royal-command-size);
  height: var(--royal-command-size);
  display: grid;
  place-content: center;
  gap: 1px;
  padding: 2px;
  border: 1px solid rgba(148,163,184,0.48);
  border-radius: 50%;
  background: rgba(15,23,42,0.92);
  color: #cbd5e1;
  z-index: 15;
  box-shadow: 0 7px 20px rgba(0,0,0,0.46), inset 0 0 0 1px rgba(255,255,255,0.045);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  line-height: 1;
}
#royal-guard-btn {
  right: calc(var(--royal-guard-right) + env(safe-area-inset-right));
  bottom: calc(var(--royal-guard-bottom) + env(safe-area-inset-bottom));
}
#royal-hunt-btn {
  right: calc(var(--royal-hunt-right) + env(safe-area-inset-right));
  bottom: calc(var(--royal-hunt-bottom) + env(safe-area-inset-bottom));
}
#drop-power-btn {
  right: calc(var(--drop-power-right) + env(safe-area-inset-right));
  bottom: calc(var(--drop-power-bottom) + env(safe-area-inset-bottom));
  border-color: rgba(248,113,113,0.55);
  color: #fecaca;
  background: radial-gradient(circle at 38% 28%, #7f1d1d, #1c1917 72%);
}
.royal-command-btn > span {
  font-size: calc(var(--royal-command-size) * 0.34);
  line-height: 1;
}
.royal-command-btn > small {
  font-size: calc(var(--royal-command-size) * 0.15);
  font-weight: 900;
  letter-spacing: 0.02em;
  line-height: 1;
  text-transform: uppercase;
}
.royal-command-btn.guard.active {
  border-color: #67e8f9;
  color: #ecfeff;
  background: radial-gradient(circle at 38% 28%, #155e75, #0f172a 72%);
  box-shadow: 0 7px 20px rgba(0,0,0,0.46), 0 0 15px rgba(34,211,238,0.48), inset 0 0 0 1px rgba(255,255,255,0.08);
}
.royal-command-btn.hunt.active {
  border-color: #fbbf24;
  color: #fffbeb;
  background: radial-gradient(circle at 38% 28%, #b45309, #1c1917 72%);
  box-shadow: 0 7px 20px rgba(0,0,0,0.46), 0 0 15px rgba(245,158,11,0.48), inset 0 0 0 1px rgba(255,255,255,0.08);
}
.royal-command-btn.unavailable {
  opacity: 0.48;
  filter: saturate(0.55);
}
.royal-command-btn.hero-shield.active {
  border-color: #7dd3fc;
  color: #f0f9ff;
  background: radial-gradient(circle at 38% 28%, #075985, #0f172a 72%);
  box-shadow: 0 7px 20px rgba(0,0,0,0.46), 0 0 16px rgba(56,189,248,0.58), inset 0 0 0 1px rgba(255,255,255,0.09);
}
.royal-command-btn:active { transform: scale(0.94); }

.ra-cannon-btn {
  position: fixed;
  right: calc(var(--ra-cannon-right) + env(safe-area-inset-right));
  bottom: calc(var(--ra-cannon-bottom) + env(safe-area-inset-bottom));
  width: var(--ra-cannon-size);
  height: var(--ra-cannon-size);
  display: grid;
  place-content: center;
  gap: 1px;
  padding: 2px;
  overflow: hidden;
  border: 1px solid #fde68a;
  border-radius: 50%;
  background:
    radial-gradient(circle at 73% 24%, #fff 0 3%, transparent 4%),
    radial-gradient(circle at 28% 70%, #67e8f9 0 5%, transparent 6%),
    radial-gradient(circle at 38% 28%, #fef9c3, #eab308 45%, #78350f 100%);
  color: #451a03;
  z-index: 16;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 18px rgba(250,204,21,0.62), inset 0 0 0 1px rgba(255,255,255,0.3);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  line-height: 1;
}
.ra-cannon-btn::before,
.ra-cannon-btn::after {
  content: "";
  position: absolute;
  width: 8%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #f472b6;
  box-shadow: 0 0 7px currentColor;
  animation: ra-jewel-shimmer 1.15s ease-in-out infinite alternate;
}
.ra-cannon-btn::before { top: 23%; left: 17%; color: #f472b6; }
.ra-cannon-btn::after { right: 16%; bottom: 20%; color: #a78bfa; animation-delay: -0.55s; }
.ra-cannon-btn.op {
  border-color: #f5d0fe;
  background:
    radial-gradient(circle at 72% 23%, #fff 0 5%, transparent 6%),
    linear-gradient(135deg, transparent 42%, rgba(232,121,249,0.94) 44% 48%, transparent 50%),
    radial-gradient(circle at 40% 34%, #fdf4ff 0 7%, #e879f9 30%, #7c3aed 62%, #1e1b4b 100%);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 26px rgba(232,121,249,0.82), inset 0 0 0 1px rgba(255,255,255,0.52);
}
.ra-cannon-btn.op::before { color: #f0abfc; background: #f0abfc; }
.ra-cannon-btn.op::after { color: #fde047; background: #fde047; }
.ra-cannon-btn.op .ra-cannon-glyph {
  font-family: "Segoe UI", sans-serif;
  font-size: calc(var(--ra-cannon-size) * 0.19);
  letter-spacing: -0.03em;
  text-shadow: 0 1px 0 #3b0764, 0 0 10px rgba(232,121,249,0.96);
}
.ra-cannon-btn.gods-hand {
  border-color: #fef3c7;
  background:
    radial-gradient(circle at 72% 23%, #fff 0 5%, transparent 6%),
    linear-gradient(135deg, transparent 42%, rgba(103,232,249,0.94) 44% 48%, transparent 50%),
    radial-gradient(circle at 40% 34%, #fff7d6 0 7%, #facc15 30%, #a855f7 62%, #172554 100%);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 26px rgba(103,232,249,0.82), inset 0 0 0 1px rgba(255,255,255,0.52);
}
.ra-cannon-btn.gods-hand::before { color: #67e8f9; background: #67e8f9; }
.ra-cannon-btn.gods-hand::after { color: #fde047; background: #fde047; }
.ra-cannon-btn.gods-hand .ra-cannon-glyph {
  font-family: "Segoe UI", sans-serif;
  font-size: calc(var(--ra-cannon-size) * 0.2);
  letter-spacing: -0.04em;
  text-shadow: 0 1px 0 #581c87, 0 0 10px rgba(103,232,249,0.96);
}
.ra-cannon-btn.gust-of-ra {
  border-color: #e0f2fe;
  background:
    radial-gradient(circle at 70% 22%, #fff 0 4%, transparent 5%),
    radial-gradient(circle at 27% 73%, #fde047 0 4%, transparent 5%),
    radial-gradient(circle at 40% 32%, #fff 0 8%, #bae6fd 28%, #38bdf8 52%, #075985 100%);
  color: #082f49;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 21px rgba(125,211,252,0.72), inset 0 0 0 1px rgba(255,255,255,0.48);
}
.ra-cannon-btn.gust-of-ra::before { color: #f8fafc; background: #f8fafc; }
.ra-cannon-btn.gust-of-ra::after { color: #e0f2fe; background: #e0f2fe; }
.ra-cannon-btn.gust-of-ra .ra-cannon-glyph {
  font-family: "Segoe UI", sans-serif;
  font-size: calc(var(--ra-cannon-size) * 0.2);
  letter-spacing: -0.04em;
  text-shadow: 0 1px 0 #fff, 0 0 7px rgba(255,255,255,0.7);
}
.ra-cannon-btn.medusas-wrath {
  border-color: #e7e5e4;
  background:
    radial-gradient(ellipse at 34% 38%, #fff 0 5%, #d6d3d1 6% 11%, transparent 12%),
    radial-gradient(ellipse at 66% 38%, #fff 0 5%, #d6d3d1 6% 11%, transparent 12%),
    repeating-linear-gradient(135deg, transparent 0 8px, rgba(255,255,255,0.08) 9px 10px),
    radial-gradient(circle at 42% 32%, #f5f5f4 0 8%, #a8a29e 34%, #57534e 64%, #1c1917 100%);
  color: #f5f5f4;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 24px rgba(214,211,209,0.68), inset 0 0 0 1px rgba(255,255,255,0.42);
}
.ra-cannon-btn.medusas-wrath::before { color: #f5f5f4; background: #f5f5f4; }
.ra-cannon-btn.medusas-wrath::after { color: #a8a29e; background: #a8a29e; }
.ra-cannon-btn.medusas-wrath .ra-cannon-glyph {
  font-family: "Segoe UI", sans-serif;
  font-size: calc(var(--ra-cannon-size) * 0.16);
  letter-spacing: -0.055em;
  text-shadow: 0 1px 0 #292524, 0 0 9px rgba(245,245,244,0.9);
}
.ra-cannon-btn.geniefier {
  border-color: #e9d5ff;
  background:
    radial-gradient(circle at 70% 22%, #fff 0 4%, transparent 5%),
    radial-gradient(circle at 25% 72%, #67e8f9 0 5%, transparent 6%),
    radial-gradient(circle at 40% 34%, #f5f3ff 0 8%, #c084fc 34%, #7e22ce 62%, #3b0764 100%);
  color: #f5f3ff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 22px rgba(192,132,252,0.76), inset 0 0 0 1px rgba(255,255,255,0.42);
}
.ra-cannon-btn.geniefier::before { color: #67e8f9; background: #67e8f9; }
.ra-cannon-btn.geniefier::after { color: #f5d0fe; background: #f5d0fe; }
.ra-cannon-btn.geniefier .ra-cannon-glyph {
  font-family: "Segoe UI", sans-serif;
  font-size: calc(var(--ra-cannon-size) * 0.155);
  letter-spacing: -0.055em;
  text-shadow: 0 1px 0 #581c87, 0 0 8px rgba(224,242,254,0.9);
}
.ra-cannon-btn.red-flame {
  border-color: #fecaca;
  background:
    radial-gradient(circle at 70% 22%, #fff7ed 0 4%, transparent 5%),
    radial-gradient(circle at 25% 72%, #fde047 0 5%, transparent 6%),
    radial-gradient(circle at 40% 34%, #fef08a 0 8%, #f97316 34%, #dc2626 64%, #450a0a 100%);
  color: #fff7ed;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 22px rgba(239,68,68,0.74), inset 0 0 0 1px rgba(255,255,255,0.38);
}
.ra-cannon-btn.red-flame::before { color: #fde047; background: #fde047; }
.ra-cannon-btn.red-flame::after { color: #fb923c; background: #fb923c; }
.ra-cannon-btn.red-flame .ra-cannon-glyph {
  font-family: "Segoe UI", sans-serif;
  font-size: calc(var(--ra-cannon-size) * 0.15);
  letter-spacing: -0.055em;
  text-shadow: 0 1px 0 #7f1d1d, 0 0 8px rgba(254,240,138,0.92);
}
.ra-cannon-btn.gatling-gun {
  border-color: #cbd5e1;
  background:
    radial-gradient(circle at 70% 22%, #fff 0 4%, transparent 5%),
    radial-gradient(circle at 25% 72%, #fbbf24 0 5%, transparent 6%),
    radial-gradient(circle at 40% 34%, #e2e8f0 0 8%, #64748b 34%, #334155 64%, #020617 100%);
  color: #f8fafc;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 22px rgba(148,163,184,0.68), inset 0 0 0 1px rgba(255,255,255,0.42);
}
.ra-cannon-btn.gatling-gun::before { color: #fbbf24; background: #fbbf24; }
.ra-cannon-btn.gatling-gun::after { color: #f8fafc; background: #f8fafc; }
.ra-cannon-btn.gatling-gun .ra-cannon-glyph {
  font-family: "Segoe UI", sans-serif;
  font-size: calc(var(--ra-cannon-size) * 0.19);
  letter-spacing: -0.04em;
  text-shadow: 0 1px 0 #020617, 0 0 8px rgba(251,191,36,0.9);
}
.ra-cannon-btn.gatling-gun.firing,
.ra-cannon-btn.gatling-gun.pressed {
  animation: gatling-gun-firing 0.09s linear infinite alternate;
  border-color: #fbbf24;
}
.ra-cannon-btn.gravity-well {
  border-color: #ddd6fe;
  background:
    radial-gradient(circle at 70% 22%, #fff 0 4%, transparent 5%),
    linear-gradient(135deg, transparent 42%, rgba(167,139,250,0.9) 44% 48%, transparent 50%),
    radial-gradient(circle at 40% 34%, #ede9fe 0 7%, #7c3aed 32%, #4c1d95 60%, #020617 100%);
  color: #ede9fe;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 24px rgba(167,139,250,0.78), inset 0 0 0 1px rgba(255,255,255,0.46);
}
.ra-cannon-btn.gravity-well::before { color: #c4b5fd; background: #c4b5fd; }
.ra-cannon-btn.gravity-well::after { color: #f8fafc; background: #f8fafc; }
.ra-cannon-btn.gravity-well .ra-cannon-glyph {
  font-family: "Segoe UI", sans-serif;
  font-size: calc(var(--ra-cannon-size) * 0.14);
  letter-spacing: -0.04em;
  text-shadow: 0 1px 0 #1e1b4b, 0 0 9px rgba(196,181,253,0.95);
}
.ra-cannon-btn.phantom-step {
  border-color: #cffafe;
  background:
    radial-gradient(circle at 70% 22%, #fff 0 4%, transparent 5%),
    radial-gradient(circle at 25% 72%, #f0fdfa 0 5%, transparent 6%),
    radial-gradient(circle at 40% 34%, #ecfeff 0 8%, #67e8f9 32%, #0e7490 62%, #083344 100%);
  color: #ecfeff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 22px rgba(103,232,249,0.76), inset 0 0 0 1px rgba(255,255,255,0.5);
}
.ra-cannon-btn.phantom-step::before { color: #a5f3fc; background: #a5f3fc; }
.ra-cannon-btn.phantom-step::after { color: #f8fafc; background: #f8fafc; }
.ra-cannon-btn.phantom-step .ra-cannon-glyph {
  font-family: "Segoe UI", sans-serif;
  font-size: calc(var(--ra-cannon-size) * 0.15);
  letter-spacing: -0.04em;
  text-shadow: 0 1px 0 #083344, 0 0 9px rgba(165,243,252,0.95);
}
.ra-cannon-btn.silk-barrage {
  border-color: #f1f5f9;
  background:
    radial-gradient(circle at 70% 22%, #fff 0 4%, transparent 5%),
    repeating-linear-gradient(135deg, transparent 0 7px, rgba(255,255,255,0.14) 8px 9px),
    radial-gradient(circle at 40% 34%, #f8fafc 0 8%, #cbd5e1 34%, #64748b 64%, #1e293b 100%);
  color: #f8fafc;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 20px rgba(226,232,240,0.7), inset 0 0 0 1px rgba(255,255,255,0.48);
}
.ra-cannon-btn.silk-barrage::before { color: #f8fafc; background: #f8fafc; }
.ra-cannon-btn.silk-barrage::after { color: #cbd5e1; background: #cbd5e1; }
.ra-cannon-btn.silk-barrage .ra-cannon-glyph {
  font-family: "Segoe UI", sans-serif;
  font-size: calc(var(--ra-cannon-size) * 0.155);
  letter-spacing: -0.04em;
  text-shadow: 0 1px 0 #1e293b, 0 0 8px rgba(248,250,252,0.9);
}
.ra-cannon-btn.venom-cloud {
  border-color: #d9f99d;
  background:
    radial-gradient(circle at 70% 22%, #f7fee7 0 4%, transparent 5%),
    radial-gradient(circle at 25% 72%, #a3e635 0 5%, transparent 6%),
    radial-gradient(circle at 40% 34%, #ecfccb 0 8%, #4ade80 32%, #166534 62%, #052e16 100%);
  color: #ecfccb;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 22px rgba(74,222,128,0.74), inset 0 0 0 1px rgba(255,255,255,0.4);
}
.ra-cannon-btn.venom-cloud::before { color: #bef264; background: #bef264; }
.ra-cannon-btn.venom-cloud::after { color: #86efac; background: #86efac; }
.ra-cannon-btn.venom-cloud .ra-cannon-glyph {
  font-family: "Segoe UI", sans-serif;
  font-size: calc(var(--ra-cannon-size) * 0.145);
  letter-spacing: -0.04em;
  text-shadow: 0 1px 0 #052e16, 0 0 8px rgba(190,242,100,0.92);
}
.ra-cannon-btn.mirror-ward {
  border-color: #e0f2fe;
  background:
    radial-gradient(circle at 72% 23%, #fff 0 6%, transparent 7%),
    linear-gradient(135deg, transparent 40%, rgba(255,255,255,0.55) 46% 50%, transparent 56%),
    radial-gradient(circle at 40% 34%, #f0f9ff 0 8%, #7dd3fc 32%, #0369a1 62%, #0c1a2e 100%);
  color: #f0f9ff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 22px rgba(125,211,252,0.78), inset 0 0 0 1px rgba(255,255,255,0.6);
}
.ra-cannon-btn.mirror-ward::before { color: #f8fafc; background: #f8fafc; }
.ra-cannon-btn.mirror-ward::after { color: #bae6fd; background: #bae6fd; }
.ra-cannon-btn.mirror-ward .ra-cannon-glyph {
  font-family: "Segoe UI", sans-serif;
  font-size: calc(var(--ra-cannon-size) * 0.15);
  letter-spacing: -0.04em;
  text-shadow: 0 1px 0 #0c1a2e, 0 0 8px rgba(240,249,255,0.95);
}
.ra-cannon-btn.overclock {
  border-color: #fef08a;
  background:
    radial-gradient(circle at 70% 22%, #fff 0 4%, transparent 5%),
    linear-gradient(135deg, transparent 42%, rgba(253,224,71,0.9) 44% 48%, transparent 50%),
    radial-gradient(circle at 40% 34%, #fefce8 0 7%, #fbbf24 32%, #b45309 62%, #451a03 100%);
  color: #fffbeb;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 24px rgba(251,191,36,0.8), inset 0 0 0 1px rgba(255,255,255,0.46);
}
.ra-cannon-btn.overclock::before { color: #fde047; background: #fde047; }
.ra-cannon-btn.overclock::after { color: #fff7ed; background: #fff7ed; }
.ra-cannon-btn.overclock .ra-cannon-glyph {
  font-family: "Segoe UI", sans-serif;
  font-size: calc(var(--ra-cannon-size) * 0.19);
  letter-spacing: -0.03em;
  text-shadow: 0 1px 0 #451a03, 0 0 9px rgba(253,224,71,0.95);
}
.ra-cannon-btn.vortex-trap {
  border-color: #99f6e4;
  background:
    radial-gradient(circle at 70% 22%, #f0fdfa 0 4%, transparent 5%),
    radial-gradient(circle at 25% 72%, #5eead4 0 5%, transparent 6%),
    radial-gradient(circle at 40% 34%, #ccfbf1 0 8%, #2dd4bf 32%, #115e59 62%, #042f2c 100%);
  color: #ccfbf1;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 22px rgba(45,212,191,0.74), inset 0 0 0 1px rgba(255,255,255,0.4);
}
.ra-cannon-btn.vortex-trap::before { color: #5eead4; background: #5eead4; }
.ra-cannon-btn.vortex-trap::after { color: #99f6e4; background: #99f6e4; }
.ra-cannon-btn.vortex-trap .ra-cannon-glyph {
  font-family: "Segoe UI", sans-serif;
  font-size: calc(var(--ra-cannon-size) * 0.15);
  letter-spacing: -0.04em;
  text-shadow: 0 1px 0 #042f2c, 0 0 8px rgba(153,246,228,0.92);
}
.ra-cannon-btn.siphon-fang {
  border-color: #fecdd3;
  background:
    radial-gradient(circle at 70% 22%, #fff1f2 0 4%, transparent 5%),
    radial-gradient(circle at 25% 72%, #fb7185 0 5%, transparent 6%),
    radial-gradient(circle at 40% 34%, #fecaca 0 8%, #dc2626 34%, #7f1d1d 64%, #1c0607 100%);
  color: #fef2f2;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 22px rgba(220,38,38,0.76), inset 0 0 0 1px rgba(255,255,255,0.38);
}
.ra-cannon-btn.siphon-fang::before { color: #fda4af; background: #fda4af; }
.ra-cannon-btn.siphon-fang::after { color: #fecaca; background: #fecaca; }
.ra-cannon-btn.siphon-fang .ra-cannon-glyph {
  font-family: "Segoe UI", sans-serif;
  font-size: calc(var(--ra-cannon-size) * 0.155);
  letter-spacing: -0.04em;
  text-shadow: 0 1px 0 #1c0607, 0 0 8px rgba(253,164,175,0.92);
}
.ra-cannon-btn.quake-stomp {
  border-color: #fed7aa;
  background:
    radial-gradient(circle at 70% 22%, #fff7ed 0 4%, transparent 5%),
    radial-gradient(circle at 25% 72%, #78350f 0 5%, transparent 6%),
    radial-gradient(circle at 40% 34%, #fef3c7 0 8%, #f59e0b 32%, #92400e 62%, #1c0a02 100%);
  color: #fff7ed;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 22px rgba(245,158,11,0.76), inset 0 0 0 1px rgba(255,255,255,0.4);
}
.ra-cannon-btn.quake-stomp::before { color: #fbbf24; background: #fbbf24; }
.ra-cannon-btn.quake-stomp::after { color: #78350f; background: #78350f; }
.ra-cannon-btn.quake-stomp .ra-cannon-glyph {
  font-family: "Segoe UI", sans-serif;
  font-size: calc(var(--ra-cannon-size) * 0.145);
  letter-spacing: -0.04em;
  text-shadow: 0 1px 0 #1c0a02, 0 0 8px rgba(251,191,36,0.92);
}
.ra-cannon-btn.cloak-burst {
  border-color: #ddd6fe;
  background:
    radial-gradient(circle at 72% 23%, rgba(255,255,255,0.5) 0 5%, transparent 6%),
    linear-gradient(135deg, transparent 42%, rgba(139,92,246,0.7) 44% 48%, transparent 50%),
    radial-gradient(circle at 40% 34%, #4c1d95 0 8%, #2e1065 40%, #0a0118 100%);
  color: #ede9fe;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 24px rgba(124,58,237,0.68), inset 0 0 0 1px rgba(255,255,255,0.34);
  opacity: 0.94;
}
.ra-cannon-btn.cloak-burst::before { color: #c4b5fd; background: #c4b5fd; }
.ra-cannon-btn.cloak-burst::after { color: #4c1d95; background: #4c1d95; }
.ra-cannon-btn.cloak-burst .ra-cannon-glyph {
  font-family: "Segoe UI", sans-serif;
  font-size: calc(var(--ra-cannon-size) * 0.15);
  letter-spacing: -0.04em;
  text-shadow: 0 1px 0 #0a0118, 0 0 9px rgba(196,181,253,0.9);
}
.ra-cannon-btn.red-flame.firing,
.ra-cannon-btn.red-flame.pressed {
  animation: red-flame-firing 0.22s ease-in-out infinite alternate;
  border-color: #fef08a;
}
.ra-cannon-glyph {
  position: relative;
  z-index: 1;
  font-family: Georgia, serif;
  font-size: calc(var(--ra-cannon-size) * 0.31);
  font-weight: 950;
  text-shadow: 0 1px 0 #fff7ad;
}
.ra-cannon-label {
  position: relative;
  z-index: 1;
  max-width: calc(var(--ra-cannon-size) - 8px);
  overflow: hidden;
  font-size: calc(var(--ra-cannon-size) * 0.14);
  font-weight: 950;
  text-overflow: clip;
  white-space: nowrap;
  text-transform: uppercase;
}
.ra-cannon-btn.cooldown {
  border-color: rgba(253,230,138,0.55);
  filter: saturate(0.55);
  opacity: 0.72;
}
.ra-cannon-btn.ready { animation: ra-ready-pulse 1.8s ease-in-out infinite; }
.ra-cannon-btn.op.ready { animation-name: op-ready-pulse; }
.ra-cannon-btn.gods-hand.ready { animation-name: gods-hand-ready-pulse; }
.ra-cannon-btn.gust-of-ra.ready { animation-name: gust-ready-pulse; }
.ra-cannon-btn.medusas-wrath.ready { animation-name: medusa-ready-pulse; }
.ra-cannon-btn.geniefier.ready { animation-name: geniefier-ready-pulse; }
.ra-cannon-btn.red-flame.ready { animation-name: red-flame-ready-pulse; }
.ra-cannon-btn.gatling-gun.ready { animation-name: gatling-gun-ready-pulse; }
.ra-cannon-btn.gravity-well.ready { animation-name: gravity-well-ready-pulse; }
.ra-cannon-btn.phantom-step.ready { animation-name: phantom-step-ready-pulse; }
.ra-cannon-btn.silk-barrage.ready { animation-name: silk-barrage-ready-pulse; }
.ra-cannon-btn.venom-cloud.ready { animation-name: venom-cloud-ready-pulse; }
.ra-cannon-btn.mirror-ward.ready { animation-name: mirror-ward-ready-pulse; }
.ra-cannon-btn.overclock.ready { animation-name: overclock-ready-pulse; }
.ra-cannon-btn.vortex-trap.ready { animation-name: vortex-trap-ready-pulse; }
.ra-cannon-btn.siphon-fang.ready { animation-name: siphon-fang-ready-pulse; }
.ra-cannon-btn.quake-stomp.ready { animation-name: quake-stomp-ready-pulse; }
.ra-cannon-btn.cloak-burst.ready { animation-name: cloak-burst-ready-pulse; }
.ra-cannon-btn.red-flame.ready.firing,
.ra-cannon-btn.red-flame.ready.pressed { animation: red-flame-firing 0.22s ease-in-out infinite alternate; }
.ra-cannon-btn.gatling-gun.ready.firing,
.ra-cannon-btn.gatling-gun.ready.pressed { animation: gatling-gun-firing 0.09s linear infinite alternate; }
.ra-cannon-btn:active { transform: scale(0.92); }
@keyframes ra-jewel-shimmer {
  from { opacity: 0.45; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1.55); }
}
@keyframes ra-ready-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 13px rgba(250,204,21,0.46), inset 0 0 0 1px rgba(255,255,255,0.3); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 25px rgba(250,204,21,0.9), inset 0 0 0 1px rgba(255,255,255,0.42); }
}
@keyframes op-ready-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 16px rgba(232,121,249,0.58), inset 0 0 0 1px rgba(255,255,255,0.42); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 34px rgba(240,171,252,0.96), inset 0 0 0 2px rgba(255,255,255,0.7); }
}
@keyframes gods-hand-ready-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 16px rgba(103,232,249,0.58), inset 0 0 0 1px rgba(255,255,255,0.42); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 34px rgba(250,204,21,0.96), inset 0 0 0 2px rgba(255,255,255,0.7); }
}
@keyframes gust-ready-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 14px rgba(125,211,252,0.5), inset 0 0 0 1px rgba(255,255,255,0.42); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 28px rgba(224,242,254,0.96), inset 0 0 0 1px rgba(255,255,255,0.68); }
}
@keyframes medusa-ready-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 14px rgba(168,162,158,0.54), inset 0 0 0 1px rgba(255,255,255,0.38); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 30px rgba(245,245,244,0.96), inset 0 0 0 1px rgba(255,255,255,0.68); }
}
@keyframes geniefier-ready-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 14px rgba(192,132,252,0.54), inset 0 0 0 1px rgba(255,255,255,0.38); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 29px rgba(103,232,249,0.9), inset 0 0 0 1px rgba(255,255,255,0.68); }
}
@keyframes red-flame-ready-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 14px rgba(239,68,68,0.52), inset 0 0 0 1px rgba(255,255,255,0.36); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 28px rgba(249,115,22,0.9), inset 0 0 0 1px rgba(255,255,255,0.62); }
}
@keyframes red-flame-firing {
  from { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 20px rgba(239,68,68,0.75), inset 0 0 0 1px rgba(255,255,255,0.46); }
  to { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 34px rgba(253,224,71,0.95), inset 0 0 0 2px rgba(255,255,255,0.68); }
}
@keyframes gatling-gun-ready-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 14px rgba(148,163,184,0.52), inset 0 0 0 1px rgba(255,255,255,0.4); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 28px rgba(251,191,36,0.82), inset 0 0 0 1px rgba(255,255,255,0.66); }
}
@keyframes gatling-gun-firing {
  from { transform: translate(-1px, 0) rotate(-0.8deg); box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 18px rgba(148,163,184,0.72), inset 0 0 0 1px rgba(255,255,255,0.5); }
  to { transform: translate(1px, 0) rotate(0.8deg); box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 30px rgba(251,191,36,0.9), inset 0 0 0 2px rgba(255,255,255,0.68); }
}
@keyframes gravity-well-ready-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 14px rgba(167,139,250,0.5), inset 0 0 0 1px rgba(255,255,255,0.38); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 30px rgba(196,181,253,0.94), inset 0 0 0 1px rgba(255,255,255,0.64); }
}
@keyframes phantom-step-ready-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 14px rgba(103,232,249,0.5), inset 0 0 0 1px rgba(255,255,255,0.42); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 28px rgba(236,254,255,0.94), inset 0 0 0 1px rgba(255,255,255,0.68); }
}
@keyframes silk-barrage-ready-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 13px rgba(203,213,225,0.5), inset 0 0 0 1px rgba(255,255,255,0.4); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 27px rgba(248,250,252,0.94), inset 0 0 0 1px rgba(255,255,255,0.66); }
}
@keyframes venom-cloud-ready-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 14px rgba(74,222,128,0.5), inset 0 0 0 1px rgba(255,255,255,0.34); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 28px rgba(190,242,100,0.9), inset 0 0 0 1px rgba(255,255,255,0.6); }
}
@keyframes mirror-ward-ready-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 14px rgba(125,211,252,0.52), inset 0 0 0 1px rgba(255,255,255,0.46); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 30px rgba(240,249,255,0.96), inset 0 0 0 2px rgba(255,255,255,0.74); }
}
@keyframes overclock-ready-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 14px rgba(251,191,36,0.52), inset 0 0 0 1px rgba(255,255,255,0.4); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 30px rgba(253,224,71,0.96), inset 0 0 0 2px rgba(255,255,255,0.68); }
}
@keyframes vortex-trap-ready-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 14px rgba(45,212,191,0.5), inset 0 0 0 1px rgba(255,255,255,0.36); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 28px rgba(153,246,228,0.9), inset 0 0 0 1px rgba(255,255,255,0.62); }
}
@keyframes siphon-fang-ready-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 14px rgba(220,38,38,0.52), inset 0 0 0 1px rgba(255,255,255,0.34); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 28px rgba(251,113,133,0.9), inset 0 0 0 1px rgba(255,255,255,0.58); }
}
@keyframes quake-stomp-ready-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 14px rgba(245,158,11,0.52), inset 0 0 0 1px rgba(255,255,255,0.36); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 28px rgba(251,191,36,0.9), inset 0 0 0 1px rgba(255,255,255,0.6); }
}
@keyframes cloak-burst-ready-pulse {
  0%, 100% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 14px rgba(124,58,237,0.46), inset 0 0 0 1px rgba(255,255,255,0.3); }
  50% { box-shadow: 0 8px 24px rgba(0,0,0,0.5), 0 0 28px rgba(196,181,253,0.86), inset 0 0 0 1px rgba(255,255,255,0.56); }
}

@media (max-width: 700px), (pointer: coarse) {
  :root {
    --hud-card-screen-inset: 28px;
    --hud-card-top-inset: 8px;
  }
  #self-life-hud {
    top: env(safe-area-inset-top, 0px);
  }
  #leaderboard {
    top: var(--hud-card-top-inset);
    right: var(--hud-card-screen-inset);
    border-top-width: 0;
    border-radius: 12px 20px 10px 10px;
    gap: 4px;
    padding: 6px 7px;
    padding-top: max(8px, calc(env(safe-area-inset-top) - 23px));
  }
  #leaderboard h3 {
    flex: 0 0 auto;
    font-size: 0.75rem;
    line-height: 1;
  }
  #lb-list {
    width: 100%;
    max-width: 100%;
    margin-inline: auto;
    gap: 2px;
    font-size: calc(clamp(0.66rem, calc(var(--leaderboard-min-width) * 0.073), 0.76rem) * var(--leaderboard-auto-scale, 1));
    line-height: 1.05;
  }
  #lb-list li {
    width: 100%;
    max-width: 100%;
  }
  #stats {
    top: var(--hud-card-top-inset);
    left: var(--hud-card-screen-inset);
    border-top-width: 0;
    border-radius: 20px 12px 10px 10px;
    padding: 6px;
    padding-top: max(8px, calc(env(safe-area-inset-top) - 23px));
    padding-bottom: 4px;
    gap: 1px;
  }
  body.hud-swapped #leaderboard {
    right: auto;
    left: var(--hud-card-screen-inset);
    border-radius: 20px 12px 10px 10px;
  }
  body.hud-swapped #stats {
    left: auto;
    right: var(--hud-card-screen-inset);
    border-radius: 12px 20px 10px 10px;
  }
  #stats-summary {
    gap: 6px;
    font-size: 0.6rem;
    line-height: 1;
  }
  #action-cooldown {
    gap: 1px;
    padding: 0 3px;
  }
  #action-cooldown-label { font-size: 0.48rem; }
  #action-cooldown-track { height: 3px; }
  #royal-summon-timer {
    gap: 1px;
    padding: 0 3px;
  }
  #royal-summon-label { font-size: 0.48rem; }
  #royal-summon-track { height: 3px; }
  #effect-timer { gap: 1px; margin: 0; padding: 0 3px; }
  #effect-timer-label { font-size: 0.48rem; }
  #effect-timer-track { height: 3px; }
  #companion-bar { gap: 1px; }
  .companion-row {
    min-height: 14px;
    gap: 3px;
  }
  .companion-row-label { font-size: 0.46rem; }
  .companion-items { gap: 2px; }
  .companion-chip {
    width: 14px;
    height: 14px;
    border-radius: 4px;
  }
  .companion-icon { transform: scale(0.78); }
  .companion-size,
  .companion-count { display: none; }
  .hint { font-size: max(0.7rem, 2.7vmin); }
}

@media (pointer: coarse) and (orientation: portrait) {
  body.playing:not(.spectating) #landscape-guard { display: flex; }
}

@media (max-width: 420px) {
  .royal-aspiration-actions { grid-template-columns: 1fr; }
  #mobile-shoot-btn {
    font-size: 0.76rem;
  }
  .power-slot-btn {
    padding-inline: 2px;
    font-size: 0.58rem;
  }
  .power-slot-btn small { font-size: 0.47rem; }
}
