/* =====================================================
   GLIMPSE — Core Styles
   Clean, minimal, deliberate
   ===================================================== */

/* -------------------------------
   Reset / Base
   ------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;

  width: 100%;
  height: 100%;

  background: #0b0d10;
  color: #ffffff;

  overflow: hidden;

  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    Roboto,
    Helvetica,
    Arial,
    sans-serif;

  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  --hud-font-display: "Space Grotesk", "Sora", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --hud-font-body: "Manrope", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --hud-radius-sm: 10px;
  --hud-radius-md: 14px;
  --hud-radius-lg: 18px;
  --hud-ease: cubic-bezier(.22, 1, .36, 1);
  --hud-fast: 160ms;
  --hud-mid: 260ms;
  --hud-slow: 420ms;
  --hud-glow-cyan: rgba(121, 216, 255, 0.38);
  --hud-glow-mint: rgba(142, 240, 191, 0.32);
  --hud-glow-gold: rgba(255, 214, 138, 0.32);
  --run-transition-progress: 0;
  --run-transition-ui-alpha: 1;

  --ui-space-1: 4px;
  --ui-space-2: 8px;
  --ui-space-3: 12px;
  --ui-space-4: 16px;
  --ui-space-5: 20px;
  --ui-space-6: 24px;

  --ui-radius-sm: 14px;
  --ui-radius-md: 18px;
  --ui-radius-lg: 22px;
  --ui-radius-xl: 28px;

  --ui-border-soft: rgba(195, 228, 255, 0.22);
  --ui-border-strong: rgba(183, 223, 255, 0.48);
  --ui-surface-base: rgba(12, 18, 30, 0.88);
  --ui-surface-raised: rgba(18, 26, 40, 0.94);
  --ui-surface-glow: radial-gradient(130% 130% at 10% -20%, rgba(115, 210, 255, 0.2), transparent 56%);
  --ui-text-primary: rgba(245, 250, 255, 0.96);
  --ui-text-muted: rgba(213, 231, 249, 0.9);

  --motion-enter: 220ms;
  --motion-emphasis: 340ms;
  --motion-reward: 520ms;
  --motion-exit: 180ms;
  --motion-ease-enter: cubic-bezier(.22, 1, .36, 1);
  --motion-ease-emphasis: cubic-bezier(.16, .84, .24, 1);
}

body[data-hud-motion-tier="balanced"] {
  --motion-enter: 180ms;
  --motion-emphasis: 280ms;
  --motion-reward: 420ms;
  --motion-exit: 150ms;
}

body[data-hud-motion-tier="high_load"] {
  --motion-enter: 140ms;
  --motion-emphasis: 210ms;
  --motion-reward: 320ms;
  --motion-exit: 130ms;
}

body[data-hud-motion-tier="reduced"] {
  --motion-enter: 80ms;
  --motion-emphasis: 100ms;
  --motion-reward: 120ms;
  --motion-exit: 80ms;
}

.ui-title {
  margin: 0;
  color: var(--ui-text-primary);
  font-family: var(--hud-font-display);
  font-weight: 820;
  font-size: clamp(17px, 1.1vw + 12px, 24px);
  letter-spacing: 0.03em;
  line-height: 1.14;
  text-shadow: 0 1px 12px rgba(11, 24, 40, 0.42);
}

.ui-subtitle {
  margin: 0;
  color: var(--ui-text-muted);
  font-family: var(--hud-font-body);
  font-weight: 670;
  font-size: 12.5px;
  letter-spacing: 0.02em;
  line-height: 1.45;
}

.ui-card {
  position: relative;
  border: 1px solid var(--ui-border-soft);
  border-radius: var(--ui-radius-xl);
  background:
    var(--ui-surface-glow),
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.01)),
    var(--ui-surface-base);
  color: var(--ui-text-primary);
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.42),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden;
}

.ui-card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0) 42%);
  opacity: 0.55;
}

.ui-card > * {
  position: relative;
  z-index: 1;
}

.ui-card--elevated {
  border-color: var(--ui-border-strong);
  background:
    radial-gradient(125% 140% at 8% -22%, rgba(138, 219, 255, 0.24), transparent 56%),
    radial-gradient(120% 125% at 98% 6%, rgba(255, 215, 148, 0.18), transparent 58%),
    var(--ui-surface-raised);
  box-shadow:
    0 26px 64px rgba(0, 0, 0, 0.5),
    0 0 34px rgba(112, 201, 255, 0.18),
    0 0 0 1px rgba(255, 255, 255, 0.07) inset;
}

.ui-btn {
  appearance: none;
  border: 1px solid var(--ui-border-soft);
  border-radius: var(--ui-radius-sm);
  min-height: 40px;
  padding: 9px 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.03)),
    rgba(18, 28, 42, 0.84);
  color: var(--ui-text-primary);
  font-family: var(--hud-font-body);
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.025em;
  line-height: 1.15;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: fit-content;
  max-width: min(100%, 320px);
  flex: 0 0 auto;
  white-space: nowrap;
  text-shadow: 0 1px 10px rgba(6, 17, 30, 0.42);
  cursor: pointer;
  transition:
    transform var(--motion-enter) var(--motion-ease-enter),
    border-color var(--motion-enter) var(--motion-ease-enter),
    box-shadow var(--motion-emphasis) var(--motion-ease-emphasis),
    background var(--motion-enter) var(--motion-ease-enter),
    color var(--motion-enter) var(--motion-ease-enter),
    filter var(--motion-enter) var(--motion-ease-enter);
}

/* Hard guard: key interactive button classes must never render as browser-default. */
button.ui-btn,
button.topbtn,
button.ambient-mode-option,
button.lb-tab,
button.shop-immersive-chip,
button.shop-palette-btn,
button.chest-reward-spin-btn {
  appearance: none !important;
  -webkit-appearance: none !important;
  border-style: solid !important;
  text-decoration: none !important;
  font-family: var(--hud-font-body) !important;
}

.ui-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--ui-border-strong);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.34),
    0 0 22px rgba(121, 216, 255, 0.3);
}

.ui-btn:active:not(:disabled) {
  transform: translateY(0) scale(0.985);
}

.ui-btn:disabled {
  opacity: 0.68;
  color: rgba(226, 236, 248, 0.78);
  cursor: default;
  filter: saturate(0.85);
}

.ui-btn:focus-visible {
  outline: 3px solid rgba(150, 216, 255, 0.92);
  outline-offset: 2px;
}

button {
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid transparent;
  border-radius: var(--ui-radius-sm);
  background: transparent;
  min-height: 36px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 760;
  letter-spacing: 0.02em;
  font-family: var(--hud-font-body);
  color: var(--ui-text-primary);
}

button:not(:disabled) {
  cursor: pointer;
}

button:not(.ui-btn):not(.topbtn):not(.ambient-mode-option):not(.lb-tab):not(.shop-immersive-chip):not(.shop-palette-btn):not(.chest-reward-spin-btn):not(.shop-preview-overlay-backdrop) {
  border-color: rgba(182, 210, 236, 0.32);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.03)),
    rgba(20, 33, 49, 0.86);
  color: rgba(242, 248, 255, 0.96);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.3),
    0 0 0 1px rgba(255, 255, 255, 0.06) inset;
  transition:
    transform var(--motion-enter) var(--motion-ease-enter),
    border-color var(--motion-enter) var(--motion-ease-enter),
    box-shadow var(--motion-emphasis) var(--motion-ease-emphasis),
    background var(--motion-enter) var(--motion-ease-enter);
}

button:not(.ui-btn):not(.topbtn):not(.ambient-mode-option):not(.lb-tab):not(.shop-immersive-chip):not(.shop-palette-btn):not(.chest-reward-spin-btn):not(.shop-preview-overlay-backdrop):hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: rgba(196, 228, 255, 0.5);
  box-shadow:
    0 14px 28px rgba(0, 0, 0, 0.34),
    0 0 22px rgba(127, 211, 255, 0.26),
    0 0 0 1px rgba(255, 255, 255, 0.09) inset;
}

button:not(.ui-btn):not(.topbtn):not(.ambient-mode-option):not(.lb-tab):not(.shop-immersive-chip):not(.shop-palette-btn):not(.chest-reward-spin-btn):not(.shop-preview-overlay-backdrop):active:not(:disabled) {
  transform: translateY(0) scale(0.985);
}

.ui-btn--primary-action {
  color: #071622;
  border-color: transparent;
  background:
    linear-gradient(180deg, rgba(191, 234, 255, 0.98), rgba(143, 200, 246, 0.95));
  box-shadow: 0 8px 22px rgba(59, 122, 171, 0.38);
  text-shadow: none;
}

.ui-btn--claim-reward {
  color: #0a1f14;
  border-color: transparent;
  background:
    linear-gradient(180deg, rgba(183, 246, 206, 0.98), rgba(135, 228, 172, 0.96));
  box-shadow: 0 8px 20px rgba(52, 134, 95, 0.34);
  text-shadow: none;
}

.ui-btn--purchase {
  color: #261300;
  border-color: rgba(255, 221, 177, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 227, 177, 0.98), rgba(255, 188, 124, 0.95));
  box-shadow: 0 10px 24px rgba(180, 101, 44, 0.3);
  text-shadow: none;
}

.ui-btn--equip {
  color: #061f24;
  border-color: rgba(171, 239, 255, 0.26);
  background:
    linear-gradient(180deg, rgba(173, 243, 255, 0.98), rgba(118, 219, 238, 0.94));
  box-shadow: 0 10px 24px rgba(53, 122, 143, 0.34);
  text-shadow: none;
}

.ui-btn--nav {
  border-color: rgba(174, 203, 232, 0.34);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(99, 127, 165, 0.42), rgba(24, 40, 63, 0.62));
}

.ui-btn--close {
  border-radius: 999px;
  border-color: rgba(210, 225, 238, 0.24);
  background: rgba(255, 255, 255, 0.065);
  color: rgba(244, 250, 255, 0.88);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  text-shadow: none;
}

.ui-btn--close:hover:not(:disabled) {
  border-color: rgba(226, 238, 248, 0.42);
  background: rgba(255, 255, 255, 0.105);
  color: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}

.ui-btn--close:focus-visible {
  outline-color: rgba(205, 232, 255, 0.82);
}

/* Fallback: keep close-like buttons consistent without the old heavy red skin. */
button:not(.shop-preview-overlay-backdrop).ui-btn--close,
button:not(.shop-preview-overlay-backdrop).streak-close-btn,
button:not(.shop-preview-overlay-backdrop).shop-close-btn,
button:not(.shop-preview-overlay-backdrop).shop-preview-overlay-close,
button:not(.shop-preview-overlay-backdrop)[id*="Close"],
button:not(.shop-preview-overlay-backdrop)[id*="close"],
button:not(.shop-preview-overlay-backdrop)[class*="close"],
button:not(.shop-preview-overlay-backdrop)[class*="Close"],
button:not(.shop-preview-overlay-backdrop)[aria-label*="Close"],
button:not(.shop-preview-overlay-backdrop)[aria-label*="close"] {
  border-radius: 999px !important;
  border: 1px solid rgba(210, 225, 238, 0.24) !important;
  background: rgba(255, 255, 255, 0.065) !important;
  color: rgba(244, 250, 255, 0.88) !important;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18) !important;
  text-shadow: none !important;
}

button:not(.shop-preview-overlay-backdrop).ui-btn--close:hover:not(:disabled),
button:not(.shop-preview-overlay-backdrop).streak-close-btn:hover:not(:disabled),
button:not(.shop-preview-overlay-backdrop).shop-close-btn:hover:not(:disabled),
button:not(.shop-preview-overlay-backdrop).shop-preview-overlay-close:hover:not(:disabled),
button:not(.shop-preview-overlay-backdrop)[id*="Close"]:hover:not(:disabled),
button:not(.shop-preview-overlay-backdrop)[id*="close"]:hover:not(:disabled),
button:not(.shop-preview-overlay-backdrop)[class*="close"]:hover:not(:disabled),
button:not(.shop-preview-overlay-backdrop)[class*="Close"]:hover:not(:disabled),
button:not(.shop-preview-overlay-backdrop)[aria-label*="Close"]:hover:not(:disabled),
button:not(.shop-preview-overlay-backdrop)[aria-label*="close"]:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(226, 238, 248, 0.42) !important;
  background: rgba(255, 255, 255, 0.105) !important;
  color: rgba(255, 255, 255, 0.96) !important;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22) !important;
}

button:not(.shop-preview-overlay-backdrop).ui-btn--close:focus-visible,
button:not(.shop-preview-overlay-backdrop).streak-close-btn:focus-visible,
button:not(.shop-preview-overlay-backdrop).shop-close-btn:focus-visible,
button:not(.shop-preview-overlay-backdrop).shop-preview-overlay-close:focus-visible,
button:not(.shop-preview-overlay-backdrop)[id*="Close"]:focus-visible,
button:not(.shop-preview-overlay-backdrop)[id*="close"]:focus-visible,
button:not(.shop-preview-overlay-backdrop)[class*="close"]:focus-visible,
button:not(.shop-preview-overlay-backdrop)[class*="Close"]:focus-visible,
button:not(.shop-preview-overlay-backdrop)[aria-label*="Close"]:focus-visible,
button:not(.shop-preview-overlay-backdrop)[aria-label*="close"]:focus-visible {
  outline: 3px solid rgba(205, 232, 255, 0.82);
  outline-offset: 2px;
}

/* Secondary fallback for close-like buttons that do not use the close class. */
button:not(.shop-preview-overlay-backdrop):not(.ui-btn--close)[aria-label*="Close"],
button:not(.shop-preview-overlay-backdrop):not(.ui-btn--close)[aria-label*="close"],
button:not(.shop-preview-overlay-backdrop):not(.ui-btn--close)[id*="Close"],
button:not(.shop-preview-overlay-backdrop):not(.ui-btn--close)[id*="close"],
button:not(.shop-preview-overlay-backdrop):not(.ui-btn--close)[class*="close"],
button:not(.shop-preview-overlay-backdrop):not(.ui-btn--close)[class*="Close"] {
  border-radius: 999px;
  border-color: rgba(210, 225, 238, 0.24);
  background: rgba(255, 255, 255, 0.065);
  color: rgba(244, 250, 255, 0.88);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  text-shadow: none;
}

button:not(.shop-preview-overlay-backdrop):not(.ui-btn--close)[aria-label*="Close"]:hover:not(:disabled),
button:not(.shop-preview-overlay-backdrop):not(.ui-btn--close)[aria-label*="close"]:hover:not(:disabled),
button:not(.shop-preview-overlay-backdrop):not(.ui-btn--close)[id*="Close"]:hover:not(:disabled),
button:not(.shop-preview-overlay-backdrop):not(.ui-btn--close)[id*="close"]:hover:not(:disabled),
button:not(.shop-preview-overlay-backdrop):not(.ui-btn--close)[class*="close"]:hover:not(:disabled),
button:not(.shop-preview-overlay-backdrop):not(.ui-btn--close)[class*="Close"]:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: rgba(226, 238, 248, 0.42);
  background: rgba(255, 255, 255, 0.105);
  color: rgba(255, 255, 255, 0.96);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}

.ui-btn--secondary {
  border-color: rgba(184, 208, 232, 0.34);
  border-radius: 999px;
  background:
    linear-gradient(180deg, rgba(108, 139, 178, 0.46), rgba(21, 37, 58, 0.74));
}

.ui-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid rgba(184, 214, 239, 0.32);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 760;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.08);
}

.ui-progress-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 1px rgba(220, 241, 255, 0.14) inset;
  overflow: hidden;
}

.ui-progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #60cbff 0%, #9ce8ff 55%, #ffe6a2 100%);
  box-shadow:
    0 0 16px rgba(107, 203, 255, 0.45),
    0 0 0 1px rgba(204, 241, 255, 0.24) inset;
  transition: width var(--motion-reward) var(--motion-ease-emphasis);
}

[data-ui-surface="missions"] {
  --ui-surface-glow: radial-gradient(130% 130% at 8% -16%, rgba(108, 241, 232, 0.26), transparent 56%);
}

[data-ui-surface="achievements"] {
  --ui-surface-glow: radial-gradient(130% 130% at 8% -16%, rgba(132, 237, 189, 0.24), transparent 56%);
}

[data-ui-surface="chests"] {
  --ui-surface-glow: radial-gradient(130% 130% at 8% -16%, rgba(137, 199, 255, 0.23), transparent 56%);
}

[data-ui-surface="streak"] {
  --ui-surface-glow: radial-gradient(130% 130% at 8% -16%, rgba(255, 171, 107, 0.28), transparent 56%);
}

[data-ui-surface="results"] {
  --ui-surface-glow: radial-gradient(130% 130% at 8% -16%, rgba(128, 216, 255, 0.26), transparent 56%);
}

[data-ui-surface="leaderboard"] {
  --ui-surface-glow: radial-gradient(130% 130% at 8% -16%, rgba(138, 183, 255, 0.24), transparent 56%);
}

[data-ui-surface="analysis"] {
  --ui-surface-glow: radial-gradient(130% 130% at 8% -16%, rgba(166, 228, 255, 0.24), transparent 56%);
}

[data-ui-surface="shop"] {
  --ui-surface-glow: radial-gradient(130% 130% at 8% -16%, rgba(142, 231, 207, 0.24), transparent 56%);
}

.lb-card {
  width: min(820px, calc(100vw - 24px));
  padding: 16px;
  display: grid;
  gap: 10px;
}

.lb-head,
.lb-actions,
.lb-controls,
.lb-pager,
.lb-nick,
.lb-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lb-head {
  justify-content: space-between;
  flex-wrap: wrap;
}

.lb-actions {
  justify-content: flex-end;
}

.lb-nick input {
  flex: 1 1 auto;
  min-width: 160px;
  border-radius: var(--ui-radius-sm);
  border: 1px solid rgba(181, 211, 239, 0.35);
  background: rgba(9, 20, 34, 0.72);
  color: var(--ui-text-primary);
  padding: 8px 10px;
}

.lb-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.lb-tab {
  appearance: none;
  border: 1px solid rgba(166, 197, 235, 0.24);
  border-radius: 999px;
  padding: 6px 10px;
  font: 760 11px/1 var(--hud-font-body);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: rgba(214, 230, 248, 0.88);
  background: rgba(117, 156, 201, 0.14);
  transition: border-color var(--motion-enter) var(--motion-ease-enter), background var(--motion-enter) var(--motion-ease-enter), transform var(--motion-enter) var(--motion-ease-enter);
}

.lb-tab.active {
  color: #061726;
  border-color: transparent;
  background: linear-gradient(180deg, rgba(181, 222, 255, 0.98), rgba(137, 193, 242, 0.95));
  box-shadow: 0 8px 20px rgba(48, 103, 145, 0.34);
}

.lb-board {
  border: 1px solid rgba(173, 209, 241, 0.18);
  border-radius: var(--ui-radius-md);
  overflow: hidden;
  background: rgba(8, 16, 29, 0.74);
}

.lb-row {
  display: grid;
  grid-template-columns: 76px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(162, 197, 227, 0.12);
}

.lb-row:last-child {
  border-bottom: 0;
}

.lb-row.head {
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-size: 10px;
  color: rgba(194, 217, 242, 0.82);
  background: rgba(116, 154, 200, 0.14);
}

.lb-row.lb-top3 {
  background:
    linear-gradient(90deg, rgba(255, 208, 138, 0.14), rgba(138, 189, 255, 0.08));
}

.lb-rank {
  font-weight: 820;
}

.lb-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-score {
  font: 820 15px/1 var(--hud-font-display);
  letter-spacing: 0.02em;
  color: rgba(232, 246, 255, 0.96);
}

.lb-self {
  border: 1px solid rgba(171, 209, 241, 0.2);
  border-radius: var(--ui-radius-md);
  padding: 10px 11px;
  background: rgba(10, 18, 31, 0.68);
}

.lb-self-grid {
  margin-top: 6px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 6px;
}

.lb-muted {
  color: rgba(206, 224, 241, 0.92);
}

.small {
  color: rgba(212, 230, 248, 0.92);
  line-height: 1.4;
}

.ui-card .small {
  color: rgba(221, 236, 252, 0.94);
}

#overlay .analysis-card {
  padding: 16px;
  border-radius: 20px;
  border: 1px solid rgba(255, 214, 162, 0.32);
  background:
    radial-gradient(128% 122% at 0% -18%, rgba(255, 210, 135, 0.2), transparent 62%),
    radial-gradient(120% 116% at 100% 0%, rgba(132, 219, 255, 0.16), transparent 58%),
    rgba(10, 16, 28, 0.95);
  box-shadow:
    0 24px 62px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.08) inset,
    0 0 24px rgba(255, 196, 120, 0.12);
}

#overlay .analysis-overlay-shell {
  width: min(980px, calc(100vw - 18px));
  max-height: calc(100vh - 18px);
  display: grid;
  place-items: center;
  padding: 8px;
  border-radius: 22px;
  border: 1px solid rgba(164, 218, 255, 0.22);
  background:
    radial-gradient(130% 120% at 0% -18%, rgba(132, 219, 255, 0.16), transparent 58%),
    radial-gradient(130% 120% at 100% 0%, rgba(255, 214, 162, 0.12), transparent 58%),
    rgba(8, 14, 24, 0.7);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.46),
    0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

#overlay .analysis-overlay-shell .analysis-card {
  width: min(920px, calc(100vw - 30px));
  max-height: calc(100vh - 40px);
  overflow: auto;
}

/* -------------------------------
   Canvas Layers
   ------------------------------- */

canvas {
  position: fixed;
  inset: 0;

  display: block;

  width: 100%;
  height: 100%;

  touch-action: none;
  user-select: none;
}

/* -------------------------------
   Tutorial Instruction
   (Director Text)
   ------------------------------- */

#tutorialInstruction {
  position: fixed;
  left: 50%;
  top: 18%; /* safely above ring + lens */
  transform: translate(-50%, -50%);

  z-index: 50;

  max-width: min(88vw, 720px);
  padding: 16px 24px;

  font-size: 24px;
  font-weight: 400;
  letter-spacing: 0.4px;
  line-height: 1.25;
  text-align: center;

  color: rgba(255, 255, 255, 0.96);

  background: rgba(10, 12, 16, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);

  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);

  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.55),
    inset 0 0 0 1px rgba(255, 255, 255, 0.04);

  opacity: 0;
  transform-origin: center;

  transition:
    opacity 0.22s ease,
    transform 0.22s ease;

  pointer-events: none;
}

#tutorialInstruction.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1.02);
}

/* -------------------------------
   Utility: Hidden (future-proof)
   ------------------------------- */

.hidden {
  display: none !important;
}

/* -------------------------------
   Selection / Highlight Hygiene
   ------------------------------- */

::selection {
  background: rgba(255, 255, 255, 0.12);
}

::-moz-selection {
  background: rgba(255, 255, 255, 0.12);
}

/* -------------------------------
   Run Transition Fade Sync
   ------------------------------- */

#topbar,
#ambientStreakAnchor,
#ambientModePicker,
#ambientChestAnchor,
#ambientXpBoostAnchor,
#ambientResultsDock,
#ambientRunNotification {
  transition: opacity 160ms ease-out;
  will-change: opacity;
}

body[data-run-transition-active="1"] #topbar,
body[data-run-transition-active="1"] #ambientStreakAnchor,
body[data-run-transition-active="1"] #ambientModePicker,
body[data-run-transition-active="1"] #ambientChestAnchor,
body[data-run-transition-active="1"] #ambientXpBoostAnchor,
body[data-run-transition-active="1"] #ambientResultsDock,
body[data-run-transition-active="1"] #ambientRunNotification {
  opacity: var(--run-transition-ui-alpha);
}

body[data-run-transition-active="1"][data-run-transition-ui-interactive="0"] #topbar,
body[data-run-transition-active="1"][data-run-transition-ui-interactive="0"] #ambientStreakAnchor,
body[data-run-transition-active="1"][data-run-transition-ui-interactive="0"] #ambientModePicker,
body[data-run-transition-active="1"][data-run-transition-ui-interactive="0"] #ambientChestAnchor,
body[data-run-transition-active="1"][data-run-transition-ui-interactive="0"] #ambientXpBoostAnchor,
body[data-run-transition-active="1"][data-run-transition-ui-interactive="0"] #ambientResultsDock,
body[data-run-transition-active="1"][data-run-transition-ui-interactive="0"] #ambientRunNotification {
  pointer-events: none;
}
