/* ==================================================================
   ui/main-menu.css

   Game-like main menu for Quiet Remains (qure).

   Layout (top-down):
     - .menu-bg-canvas + stars + vignette  (full-screen background,
       blurred procedural planets rendered by main-menu.js)
     - .menu-corner    top-left brand / nav / actions / auth
     - .menu-stage     centered hero planet (sharp foreground)
     - .menu-overlay   full-shell panels for Knowledge / Settings /
                       Account screens (toggled by .menu-nav buttons)
     - .menu-footbar   bottom strip
   ================================================================== */

/* Global hide helper - works on every element regardless of display mode. */
.main-menu .is-hidden { display: none !important; }

/* ---------- root surface ---------- */
.main-menu {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: auto;
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", system-ui, sans-serif;
  background:
    radial-gradient(ellipse at 18% 22%, rgba(118, 225, 255, 0.12), transparent 38%),
    radial-gradient(ellipse at 82% 18%, rgba(126, 255, 220, 0.08), transparent 32%),
    radial-gradient(ellipse at 50% 96%, rgba(255, 212, 148, 0.06), transparent 44%),
    linear-gradient(180deg, #02060e 0%, #04101e 50%, #02080f 100%);
  transition: opacity 0.6s var(--ease-out-expo), visibility 0.6s var(--ease-out-expo);
  overflow: hidden;
}

.main-menu.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* ---------- background canvas (blurred planets) ---------- */
.menu-bg-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  pointer-events: none;
  filter: blur(6px) saturate(1.1);
  opacity: 0.86;
}

.menu-bg-stars {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background-image:
    radial-gradient(circle at 12% 22%, rgba(255,255,255,0.7) 0 1px, transparent 2px),
    radial-gradient(circle at 26% 64%, rgba(255,255,255,0.42) 0 1px, transparent 2px),
    radial-gradient(circle at 38% 14%, rgba(180,232,255,0.5) 0 1px, transparent 2px),
    radial-gradient(circle at 52% 84%, rgba(255,214,148,0.32) 0 1px, transparent 2px),
    radial-gradient(circle at 64% 32%, rgba(255,255,255,0.55) 0 1px, transparent 2px),
    radial-gradient(circle at 76% 72%, rgba(126,255,220,0.4) 0 1px, transparent 2px),
    radial-gradient(circle at 88% 18%, rgba(255,255,255,0.4) 0 1px, transparent 2px),
    radial-gradient(circle at 92% 58%, rgba(180,232,255,0.34) 0 1px, transparent 2px);
  opacity: 0.78;
  animation: menuStarDrift 38s linear infinite;
}

@keyframes menuStarDrift {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-12px, -8px, 0); }
}

.menu-bg-vignette {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  background:
    radial-gradient(circle at 60% 50%, transparent 28%, rgba(2, 6, 12, 0.5) 78%),
    linear-gradient(180deg, rgba(2, 6, 12, 0.18), rgba(2, 6, 12, 0.46)),
    linear-gradient(90deg, rgba(2, 6, 12, 0.48) 0%, rgba(2, 6, 12, 0) 38%);
}

/* ---------- top-left brand block (vertically centered) ---------- */
.menu-corner {
  position: absolute;
  z-index: 10; /* above overlay so nav stays accessible on every page */
  top: 50%;
  left: clamp(28px, 4vw, 56px);
  transform: translateY(-50%);
  width: min(46vw, 560px);
  display: grid;
  gap: 22px;
  pointer-events: auto;
  transition: top 0.5s var(--ease-out-expo), transform 0.5s var(--ease-out-expo);
}

/* Compact corner shown while a full-page overlay is open: title + nav only,
   pinned to the top-left so the page below has room to breathe. */
.menu-corner.is-compact {
  top: clamp(28px, 4vw, 56px);
  transform: none;
  gap: 16px;
}
.menu-corner.is-compact .menu-actions,
.menu-corner.is-compact .menu-auth,
.menu-corner.is-compact .menu-profile { display: none; }
.menu-corner.is-compact .menu-title {
  font-size: clamp(36px, 4.4vw, 64px);
}

.menu-kicker {
  font-size: 11px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(180, 232, 255, 0.78);
  font-weight: 700;
}

.menu-title {
  margin: 0;
  font-size: clamp(54px, 7vw, 110px);
  line-height: 0.9;
  letter-spacing: -0.045em;
  font-weight: 750;
  color: rgba(244, 250, 255, 0.98);
  text-wrap: balance;
  text-shadow:
    0 0 36px rgba(118, 225, 255, 0.18),
    0 4px 38px rgba(0, 0, 0, 0.6);
}

.menu-title .mark {
  background: linear-gradient(135deg, rgba(255,255,255,0.98), rgba(118, 225, 255, 0.92) 46%, rgba(126, 255, 220, 0.92));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-shadow:
    0 0 22px rgba(118, 225, 255, 0.32),
    0 0 38px rgba(126, 255, 220, 0.18);
}

.menu-title em {
  display: block;
  font-style: normal;
  color: rgba(244, 250, 255, 0.66);
  font-size: 0.32em;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 14px;
}

.menu-beta-mark {
  display: inline-block;
  justify-self: start;
  margin: 0 0 -14px 4px;
  padding: 0;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: rgba(214, 244, 255, 0.92);
  text-shadow:
    0 0 16px rgba(118, 225, 255, 0.6),
    0 0 4px rgba(118, 225, 255, 0.75),
    0 1px 2px rgba(0, 0, 0, 0.7);
  -webkit-text-stroke: 0.3px rgba(214, 244, 255, 0.7);
  pointer-events: none;
  animation: beta-drift 5.2s ease-in-out infinite;
  transform-origin: left center;
}

@keyframes beta-drift {
  0%   { transform: translate(0, 0)    rotate(0deg);     opacity: 0.78; }
  50%  { transform: translate(2px, -1px) rotate(-1.2deg); opacity: 1;    }
  100% { transform: translate(0, 0)    rotate(0deg);     opacity: 0.78; }
}

@media (prefers-reduced-motion: reduce) {
  .menu-beta-mark { animation: none; }
}

.menu-subtitle {
  max-width: 32ch;
  margin: 0;
  font-size: clamp(14px, 1.2vw, 17px);
  line-height: 1.55;
  color: rgba(220, 236, 252, 0.72);
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.6);
}

/* ---------- nav row ---------- */
.menu-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
  border-radius: 999px;
  border: 1px solid rgba(180, 232, 255, 0.18);
  background: linear-gradient(165deg, rgba(8, 18, 32, 0.66), rgba(2, 8, 16, 0.78));
  backdrop-filter: blur(14px);
  width: fit-content;
  max-width: 100%;
  box-shadow:
    0 18px 40px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.menu-nav-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(220, 240, 255, 0.72);
  font: inherit;
  cursor: pointer;
  transition: background 0.22s var(--ease-out-expo),
              border-color 0.22s var(--ease-out-expo),
              color 0.22s var(--ease-out-expo),
              transform 0.22s var(--ease-out-expo);
}

.menu-nav-button:hover {
  background: rgba(118, 225, 255, 0.08);
  border-color: rgba(118, 225, 255, 0.22);
  color: rgba(244, 250, 255, 0.96);
  transform: translateY(-1px);
}

.menu-nav-button.is-active {
  background: linear-gradient(135deg, rgba(118, 225, 255, 0.26), rgba(126, 255, 220, 0.14));
  border-color: rgba(118, 225, 255, 0.5);
  color: rgba(244, 250, 255, 1);
  box-shadow: 0 0 24px rgba(118, 225, 255, 0.22), inset 0 0 0 1px rgba(118, 225, 255, 0.22);
}

.menu-nav-key {
  font-size: 9px;
  letter-spacing: 0.18em;
  color: rgba(180, 232, 255, 0.55);
  font-weight: 700;
}

.menu-nav-button.is-active .menu-nav-key { color: rgba(180, 232, 255, 0.95); }

.menu-nav-label {
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
}

/* ---------- status strip ---------- */
.menu-status-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  padding: 14px 18px;
  border-radius: 18px;
  border: 1px solid rgba(180, 232, 255, 0.16);
  background: linear-gradient(165deg, rgba(10, 24, 42, 0.72), rgba(4, 12, 22, 0.82));
  backdrop-filter: blur(12px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  max-width: 520px;
}

.menu-stat { display: grid; gap: 4px; min-width: 0; }

.menu-stat-key {
  font-size: 9px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(180, 232, 255, 0.6);
}

.menu-stat-value {
  font-size: 12px;
  color: rgba(244, 250, 255, 0.92);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- actions row ---------- */
.menu-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.menu-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  color: rgba(220, 236, 252, 0.5);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

/* ---------- shared button primitive ---------- */
.menu-button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  padding: 13px 22px;
  cursor: pointer;
  font: inherit;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
  color: rgba(244, 250, 255, 0.96);
  background: rgba(8, 18, 32, 0.5);
  backdrop-filter: blur(8px);
  transition: transform 0.28s var(--ease-out-expo),
              border-color 0.28s var(--ease-out-expo),
              background 0.28s var(--ease-out-expo),
              box-shadow 0.28s var(--ease-out-expo);
}

.menu-button:hover {
  transform: translateY(-2px);
  border-color: rgba(118, 225, 255, 0.5);
  background: rgba(8, 18, 32, 0.7);
  box-shadow: 0 0 28px rgba(118, 225, 255, 0.2), 0 8px 24px rgba(0, 0, 0, 0.36);
}

.menu-button:active { transform: translateY(0); transition-duration: 0.12s; }
.menu-button[disabled] { opacity: 0.45; pointer-events: none; }

.menu-button.primary {
  background: linear-gradient(135deg, rgba(118, 225, 255, 0.4), rgba(126, 255, 220, 0.26));
  border-color: rgba(118, 225, 255, 0.55);
  color: rgba(255, 255, 255, 0.98);
}

.menu-button.primary:hover {
  background: linear-gradient(135deg, rgba(118, 225, 255, 0.58), rgba(126, 255, 220, 0.36));
  box-shadow: 0 0 36px rgba(118, 225, 255, 0.34), 0 12px 28px rgba(0, 0, 0, 0.36);
}

.menu-button.ghost {
  background: rgba(8, 18, 32, 0.32);
  border-color: rgba(255, 255, 255, 0.18);
  color: rgba(220, 236, 252, 0.78);
}

.menu-button.ghost:hover {
  border-color: rgba(180, 232, 255, 0.46);
  color: rgba(244, 250, 255, 0.96);
}

.menu-button.danger {
  border-color: rgba(255, 162, 162, 0.36);
  color: rgba(255, 200, 200, 0.86);
}

.menu-button.danger:hover {
  border-color: rgba(255, 162, 162, 0.7);
  background: rgba(255, 80, 80, 0.08);
  color: rgba(255, 220, 220, 0.96);
}

/* ---------- center stage with the big featured planet ---------- */
.menu-stage {
  position: absolute;
  z-index: 4;
  right: clamp(24px, 4vw, 80px);
  top: 50%;
  transform: translateY(-50%);
  width: clamp(380px, 46vw, 760px);
  height: clamp(380px, 46vw, 760px);
  /* The wrapper itself stays click-through so it never eats clicks
     from the corner UI; only the hero canvas accepts pointers. */
  pointer-events: none;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 24px 80px rgba(0, 0, 0, 0.6));
  transition: opacity 0.6s var(--ease-out-expo), transform 0.6s var(--ease-out-expo);
}

.menu-hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  /* Drag-to-rotate uses pointer events on this canvas. */
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.menu-hero-canvas:active { cursor: grabbing; }

.menu-stage-ring {
  position: absolute;
  inset: 4%;
  border-radius: 50%;
  border: 1px solid rgba(180, 232, 255, 0.12);
  box-shadow:
    inset 0 0 80px rgba(118, 225, 255, 0.06),
    0 0 80px rgba(118, 225, 255, 0.06);
  pointer-events: none;
  animation: menuStageBreathe 12s ease-in-out infinite;
}

@keyframes menuStageBreathe {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50%      { transform: scale(1.018); opacity: 1; }
}

.menu-stage-tag {
  position: absolute;
  bottom: 6%;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(180, 232, 255, 0.78);
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(180, 232, 255, 0.22);
  background: rgba(4, 12, 22, 0.62);
  backdrop-filter: blur(10px);
  white-space: nowrap;
}

.menu-stage.is-hidden {
  opacity: 0.18;
  transform: translateY(-50%) scale(0.94);
  filter: drop-shadow(0 24px 80px rgba(0, 0, 0, 0.6)) blur(4px);
}

/* ---------- auth panel + profile chip ---------- */
.menu-auth {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
  border-radius: 22px;
  border: 1px solid rgba(180, 232, 255, 0.18);
  background: linear-gradient(165deg, rgba(14, 28, 48, 0.7), rgba(4, 10, 22, 0.82));
  backdrop-filter: blur(14px);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  max-width: 520px;
}

.menu-auth-eyebrow {
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(180, 232, 255, 0.84);
  font-weight: 700;
}

.menu-auth-copy {
  margin: 0;
  font-size: 12px;
  line-height: 1.55;
  color: rgba(212, 232, 252, 0.66);
}

.menu-auth-row { display: flex; flex-wrap: wrap; gap: 10px; }

.menu-auth-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(244, 250, 255, 0.96);
  font: inherit;
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: none;
  cursor: pointer;
  transition: transform 0.22s, border-color 0.22s, box-shadow 0.22s, background 0.22s;
}

.menu-auth-button:hover {
  transform: translateY(-1px);
  border-color: rgba(180, 236, 255, 0.5);
  box-shadow: 0 0 22px rgba(140, 220, 255, 0.22);
}

.menu-auth-button[disabled] { opacity: 0.42; pointer-events: none; }

.menu-auth-button.discord {
  background: linear-gradient(135deg, rgba(88, 101, 242, 0.42), rgba(48, 56, 148, 0.32));
  border-color: rgba(120, 132, 252, 0.5);
}

.menu-auth-button.google {
  background: linear-gradient(135deg, rgba(252, 252, 252, 0.18), rgba(220, 232, 248, 0.08));
  border-color: rgba(220, 232, 248, 0.34);
}

.menu-auth-button.email {
  background: linear-gradient(135deg, rgba(140, 220, 255, 0.28), rgba(80, 140, 220, 0.18));
  border-color: rgba(150, 220, 255, 0.5);
}

.menu-auth-email {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.menu-auth-email input[type="email"] {
  appearance: none;
  border: 1px solid rgba(150, 220, 255, 0.24);
  border-radius: 999px;
  background: rgba(4, 10, 22, 0.78);
  color: rgba(244, 250, 255, 0.96);
  font: inherit;
  font-size: 13px;
  padding: 11px 16px;
  outline: none;
  transition: border-color 0.22s, box-shadow 0.22s;
  min-width: 0;
}

.menu-auth-email input[type="email"]:focus {
  border-color: rgba(180, 236, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(140, 220, 255, 0.18);
}

.menu-auth-status {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
  color: rgba(180, 232, 255, 0.78);
  min-height: 14px;
}

.menu-auth-status.error { color: rgba(255, 162, 162, 0.86); }
.menu-auth-status.ok    { color: rgba(160, 248, 210, 0.86); }

.menu-auth.is-hidden,
.menu-profile.is-hidden { display: none; }

.menu-profile {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px 18px;
  border-radius: 22px;
  border: 1px solid rgba(150, 220, 255, 0.26);
  background: linear-gradient(165deg, rgba(20, 38, 64, 0.72), rgba(6, 14, 26, 0.86));
  backdrop-filter: blur(14px);
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  max-width: 520px;
}

.menu-profile-avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(140, 220, 255, 0.42), rgba(60, 120, 200, 0.32));
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 700;
  color: rgba(244, 250, 255, 0.96);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18), 0 0 22px rgba(140, 220, 255, 0.22);
  background-size: cover;
  background-position: center;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.menu-profile-meta { display: grid; gap: 2px; min-width: 0; }

.menu-profile-name {
  font-size: 14px;
  font-weight: 700;
  color: rgba(244, 252, 255, 0.98);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-profile-email {
  font-size: 11px;
  color: rgba(200, 224, 248, 0.62);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.menu-profile-logout {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: rgba(244, 250, 255, 0.78);
  font: inherit;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.22s, color 0.22s, background 0.22s;
}

.menu-profile-logout:hover {
  border-color: rgba(255, 162, 162, 0.6);
  color: rgba(255, 220, 220, 0.96);
  background: rgba(255, 80, 80, 0.06);
}

/* ---------- full-page screens (Knowledge / Settings / Account) ----------
   These are NOT centered modal cards - they're proper pages that take
   over the whole viewport while leaving the brand corner visible so
   the player can navigate back via the nav row. */
.menu-overlay {
  position: absolute;
  z-index: 8;
  inset: 0;
  /* Top padding clears the compact corner header (title + nav).
     Left padding clears nothing - the page lives full-width. */
  padding: clamp(180px, 22vh, 260px) clamp(40px, 6vw, 120px) clamp(80px, 10vh, 140px);
  background:
    radial-gradient(ellipse at 70% 30%, rgba(118, 225, 255, 0.10), transparent 50%),
    radial-gradient(ellipse at 30% 80%, rgba(126, 255, 220, 0.06), transparent 46%),
    linear-gradient(180deg, rgba(2, 6, 12, 0.92) 0%, rgba(4, 12, 22, 0.96) 100%);
  backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  animation: menuOverlayIn 0.36s var(--ease-out-expo) both;
}

.menu-overlay-panel {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

.menu-overlay-close { display: none; } /* full pages don't need a close X */

@keyframes menuOverlayIn {
  from { opacity: 0; transform: translateY(8px); filter: blur(6px); }
  to   { opacity: 1; transform: translateY(0);   filter: blur(0); }
}

.menu-overlay.is-hidden { display: none; }

.menu-overlay-panel {
  display: none;
  flex-direction: column;
  gap: 20px;
  flex: 1;
  min-height: 0;
  position: relative;
}

.menu-overlay[data-screen="knowledge"] .menu-overlay-panel[data-screen="knowledge"],
.menu-overlay[data-screen="settings"]  .menu-overlay-panel[data-screen="settings"],
.menu-overlay[data-screen="account"]   .menu-overlay-panel[data-screen="account"] {
  display: flex;
}

.menu-overlay-close {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(180, 232, 255, 0.24);
  background: rgba(8, 18, 32, 0.78);
  color: rgba(220, 236, 252, 0.86);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: border-color 0.22s, color 0.22s, transform 0.22s;
}

.menu-overlay-close:hover {
  border-color: rgba(180, 232, 255, 0.6);
  color: rgba(244, 250, 255, 0.98);
  transform: rotate(90deg);
}

.menu-section-header {
  display: grid;
  gap: 6px;
  max-width: 64ch;
}

.menu-section-eyebrow {
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(180, 232, 255, 0.7);
  font-weight: 700;
}

.menu-section-title {
  margin: 0;
  font-size: clamp(28px, 3vw, 38px);
  letter-spacing: -0.02em;
  font-weight: 700;
  color: rgba(244, 250, 255, 0.98);
}

.menu-section-copy {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: rgba(212, 232, 252, 0.68);
}

/* ---------- KNOWLEDGE ---------- */
.menu-knowledge {
  display: grid;
  grid-template-columns: minmax(220px, 280px) minmax(0, 1fr);
  gap: 18px;
  flex: 1;
  min-height: 0;
}

.menu-knowledge-list {
  list-style: none;
  margin: 0;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: linear-gradient(165deg, rgba(8, 18, 32, 0.62), rgba(2, 8, 16, 0.7));
  overflow-y: auto;
  display: grid;
  gap: 4px;
  align-content: start;
}

.menu-knowledge-list::-webkit-scrollbar { width: 8px; }
.menu-knowledge-list::-webkit-scrollbar-thumb { background: rgba(180, 232, 255, 0.18); border-radius: 999px; }

.menu-knowledge-entry {
  appearance: none;
  width: 100%;
  text-align: left;
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  background: transparent;
  color: rgba(220, 236, 252, 0.78);
  font: inherit;
  cursor: pointer;
  transition: background 0.22s, border-color 0.22s, transform 0.22s;
}

.menu-knowledge-entry:hover {
  background: rgba(118, 225, 255, 0.06);
  border-color: rgba(118, 225, 255, 0.18);
  transform: translateX(2px);
}

.menu-knowledge-entry.is-active {
  background: linear-gradient(135deg, rgba(118, 225, 255, 0.18), rgba(126, 255, 220, 0.06));
  border-color: rgba(118, 225, 255, 0.36);
  color: rgba(244, 250, 255, 0.98);
}

.menu-knowledge-entry-region {
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(180, 232, 255, 0.6);
  font-weight: 700;
}

.menu-knowledge-entry-title {
  font-size: 13px;
  font-weight: 600;
  color: rgba(244, 250, 255, 0.94);
}

.menu-knowledge-reader {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px 26px;
  border-radius: 18px;
  border: 1px solid rgba(180, 232, 255, 0.16);
  background:
    radial-gradient(ellipse at 12% 0%, rgba(118, 225, 255, 0.08), transparent 38%),
    linear-gradient(165deg, rgba(10, 24, 42, 0.74), rgba(4, 12, 22, 0.86));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
  overflow-y: auto;
  min-height: 0;
}

.menu-knowledge-reader::-webkit-scrollbar { width: 10px; }
.menu-knowledge-reader::-webkit-scrollbar-thumb { background: rgba(180, 232, 255, 0.18); border-radius: 999px; }

.menu-knowledge-header {
  display: grid;
  gap: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 14px;
}

.menu-knowledge-region {
  font-size: 9px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(180, 232, 255, 0.7);
  font-weight: 700;
}

.menu-knowledge-title {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.01em;
  color: rgba(244, 250, 255, 0.98);
}

.menu-knowledge-body {
  font-size: 14px;
  line-height: 1.7;
  color: rgba(220, 236, 252, 0.84);
}

.menu-knowledge-body p { margin: 0 0 12px; }
.menu-knowledge-body p:last-child { margin-bottom: 0; }

.menu-knowledge-placeholder {
  color: rgba(180, 232, 255, 0.5);
  font-style: italic;
}

/* ---------- SETTINGS ---------- */
.menu-settings {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  padding-right: 6px;
}

.menu-settings::-webkit-scrollbar { width: 10px; }
.menu-settings::-webkit-scrollbar-thumb { background: rgba(180, 232, 255, 0.18); border-radius: 999px; }

.menu-settings-group {
  display: grid;
  gap: 12px;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  background: linear-gradient(165deg, rgba(10, 22, 38, 0.62), rgba(4, 12, 22, 0.74));
  align-content: start;
}

.menu-settings-group-title {
  margin: 0;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: rgba(180, 232, 255, 0.78);
  font-weight: 700;
}

.menu-settings-grid { display: grid; gap: 12px; }

.menu-setting-row { display: grid; gap: 6px; }

.menu-setting-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  color: rgba(220, 236, 252, 0.82);
  font-weight: 600;
}

.menu-setting-value {
  font-size: 11px;
  color: rgba(180, 232, 255, 0.86);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.menu-setting-row input[type="range"] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(118, 225, 255, 0.45), rgba(126, 255, 220, 0.32));
  outline: none;
}

.menu-setting-row input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(244, 250, 255, 0.98);
  border: 2px solid rgba(118, 225, 255, 0.72);
  box-shadow: 0 0 12px rgba(118, 225, 255, 0.42);
  cursor: pointer;
}

.menu-setting-row input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: rgba(244, 250, 255, 0.98);
  border: 2px solid rgba(118, 225, 255, 0.72);
  box-shadow: 0 0 12px rgba(118, 225, 255, 0.42);
  cursor: pointer;
}

.menu-setting-row select {
  appearance: none;
  background: rgba(4, 12, 22, 0.78);
  border: 1px solid rgba(180, 232, 255, 0.24);
  border-radius: 12px;
  color: rgba(244, 250, 255, 0.96);
  font: inherit;
  font-size: 12px;
  padding: 8px 14px;
  cursor: pointer;
}

.menu-setting-row select:focus {
  outline: none;
  border-color: rgba(180, 232, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(140, 220, 255, 0.18);
}

.menu-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.menu-toggle input { display: none; }

.menu-toggle-track {
  width: 36px;
  height: 20px;
  border-radius: 999px;
  background: rgba(180, 232, 255, 0.16);
  border: 1px solid rgba(180, 232, 255, 0.24);
  position: relative;
  transition: background 0.22s, border-color 0.22s;
}

.menu-toggle-track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(244, 250, 255, 0.96);
  box-shadow: 0 0 8px rgba(118, 225, 255, 0.32);
  transition: transform 0.22s var(--ease-out-expo);
}

.menu-toggle input:checked + .menu-toggle-track {
  background: linear-gradient(90deg, rgba(118, 225, 255, 0.5), rgba(126, 255, 220, 0.34));
  border-color: rgba(118, 225, 255, 0.6);
}

.menu-toggle input:checked + .menu-toggle-track::after { transform: translateX(16px); }

.menu-settings-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.menu-settings-foot-note {
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(160, 248, 210, 0.78);
}

/* ---------- ACCOUNT ---------- */
.menu-account {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 18px;
}

.menu-account-card {
  display: grid;
  gap: 12px;
  padding: 22px 24px;
  border-radius: 22px;
  border: 1px solid rgba(180, 232, 255, 0.18);
  background: linear-gradient(165deg, rgba(10, 22, 38, 0.74), rgba(4, 12, 22, 0.84));
  box-shadow:
    0 16px 40px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.menu-account-card-title {
  font-size: 10px;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: rgba(180, 232, 255, 0.84);
  font-weight: 700;
}

.menu-account-card-body {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(220, 236, 252, 0.82);
}

.menu-account-card-body strong { color: rgba(244, 250, 255, 0.98); font-weight: 700; }

.menu-account-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}

/* ---------- footer ---------- */
.menu-footbar {
  position: absolute;
  z-index: 6;
  left: clamp(20px, 3vw, 40px);
  right: clamp(20px, 3vw, 40px);
  bottom: clamp(16px, 2vw, 28px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(180, 232, 255, 0.46);
}

/* ---------- welcome modal (post-magic-link landing) ----------
   Overlays the entire menu after a successful magic-link sign-in.
   Lets the player optionally link Discord/Google so future visits
   are one click, then hands them off to the field. */
.menu-welcome {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: clamp(20px, 4vw, 60px);
  pointer-events: auto;
}
.menu-welcome.is-hidden { display: none !important; }

.menu-welcome-backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 30%, rgba(118, 200, 255, 0.18), transparent 55%),
    rgba(2, 6, 14, 0.78);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  cursor: pointer;
  animation: welcomeFade 0.5s ease-out;
}
@keyframes welcomeFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.menu-welcome-card {
  position: relative;
  z-index: 1;
  width: min(560px, 92vw);
  display: grid;
  gap: 20px;
  padding: clamp(36px, 5vw, 56px) clamp(28px, 5vw, 52px);
  border-radius: 28px;
  background:
    radial-gradient(ellipse at 30% 0%, rgba(118, 200, 255, 0.12), transparent 60%),
    linear-gradient(165deg, rgba(14, 28, 48, 0.88), rgba(4, 10, 22, 0.94));
  border: 1px solid rgba(180, 232, 255, 0.22);
  box-shadow:
    0 40px 110px rgba(0, 0, 0, 0.6),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 1px 0 rgba(255, 255, 255, 0.08) inset;
  text-align: center;
  animation: welcomeRise 0.6s var(--ease-out-expo, cubic-bezier(0.16, 1, 0.3, 1));
  overflow: hidden;
}
@keyframes welcomeRise {
  from { transform: translateY(18px) scale(0.97); opacity: 0; }
  to   { transform: translateY(0)    scale(1);    opacity: 1; }
}

.menu-welcome-glow {
  position: absolute;
  pointer-events: none;
  top: -120px;
  left: 50%;
  width: 480px;
  height: 240px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse at center, rgba(124, 200, 255, 0.42), transparent 65%);
  filter: blur(40px);
  opacity: 0.7;
}

.menu-welcome-eyebrow {
  font-size: 11px;
  letter-spacing: 0.36em;
  text-transform: uppercase;
  color: rgba(140, 220, 255, 0.92);
  font-weight: 700;
}

.menu-welcome-title {
  margin: 0;
  font-size: clamp(28px, 4vw, 38px);
  line-height: 1.18;
  font-weight: 700;
  color: #f4faff;
  letter-spacing: -0.01em;
}

.menu-welcome-copy {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
  color: rgba(212, 232, 252, 0.78);
}

.menu-welcome-providers {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 6px;
}

.menu-welcome-actions {
  display: grid;
  gap: 10px;
  justify-items: center;
  margin-top: 6px;
}

.menu-welcome-actions .menu-button.primary {
  min-width: 220px;
  padding: 14px 36px;
  font-size: 13px;
  letter-spacing: 0.22em;
}

.menu-welcome-skip {
  appearance: none;
  background: none;
  border: 0;
  color: rgba(180, 220, 248, 0.55);
  font: inherit;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  padding: 6px 12px;
  cursor: pointer;
  transition: color 0.18s;
}
.menu-welcome-skip:hover { color: rgba(220, 240, 255, 0.92); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .menu-stage {
    width: clamp(280px, 56vw, 520px);
    height: clamp(280px, 56vw, 520px);
    right: 4vw;
    top: auto;
    bottom: 12vh;
    transform: none;
    opacity: 0.85;
  }
  .menu-stage.is-hidden { transform: scale(0.94); }
  .menu-corner { width: min(80vw, 560px); }
}

@media (max-width: 720px) {
  .menu-stage { display: none; }
  .menu-corner { width: calc(100vw - 36px); }
}
