/* ============================================================
   LEY·LINES — Menu stylesheet
   All menu, settings, pause, and results styles.
   Depends on CSS custom properties from styles.css + hud.css.
   ============================================================ */

/* ================================================================
   MENU ROOT WRAPPER
   ================================================================ */
#menu {
  position: absolute;
  inset: 0;
  pointer-events: none;
  font-family: var(--font-body);
  color: var(--ink);
}

/* ================================================================
   SHARED: menu glass panel
   ================================================================ */
.m-panel {
  background: rgba(10, 7, 18, 0.82);
  border: 1px solid rgba(233, 196, 106, 0.22);
  border-radius: 16px;
  backdrop-filter: blur(18px) saturate(1.5);
  -webkit-backdrop-filter: blur(18px) saturate(1.5);
  box-shadow:
    0 0 60px rgba(123, 108, 246, 0.15),
    0 4px 40px rgba(0, 0, 0, 0.7),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  position: relative;
  overflow: hidden;
}

/* Top-edge shimmer */
.m-panel::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent 5%, rgba(233,196,106,0.4) 50%, transparent 95%);
  pointer-events: none;
}

/* ================================================================
   SHARED MENU BUTTON
   ================================================================ */
.m-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  padding: 10px 20px;
  border-radius: 10px;
  border: 1px solid rgba(233, 196, 106, 0.22);
  background: rgba(233, 196, 106, 0.07);
  color: var(--ink);
  cursor: pointer;
  pointer-events: auto;
  position: relative;
  overflow: hidden;
  transition:
    background 150ms ease-out,
    border-color 150ms ease-out,
    box-shadow 150ms ease-out,
    transform 100ms ease-out,
    color 150ms ease-out;
  white-space: nowrap;
  text-transform: uppercase;
}

.m-btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background 150ms ease-out;
}
.m-btn:hover::after { background: rgba(255, 255, 255, 0.04); }
.m-btn:hover:not(:disabled) {
  border-color: rgba(233, 196, 106, 0.45);
  box-shadow: 0 0 16px rgba(233, 196, 106, 0.18);
}
.m-btn:active:not(:disabled) { transform: scale(0.96); }
.m-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.m-btn:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

/* Primary / CTA variant — gold gradient */
.m-btn--primary {
  background: linear-gradient(135deg, rgba(123, 108, 246, 0.28), rgba(233, 196, 106, 0.18));
  border-color: rgba(233, 196, 106, 0.5);
  color: var(--gold);
  text-shadow: 0 0 12px rgba(233, 196, 106, 0.45);
  box-shadow: 0 0 24px rgba(123, 108, 246, 0.18), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  font-size: 0.88rem;
  padding: 13px 40px;
  letter-spacing: 0.2em;
}
.m-btn--primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(233, 196, 106, 0.1), transparent);
  transform: translateX(-100%);
  transition: transform 0.55s ease;
}
.m-btn--primary:hover:not(:disabled)::before { transform: translateX(100%); }
.m-btn--primary:hover:not(:disabled) {
  background: linear-gradient(135deg, rgba(123, 108, 246, 0.42), rgba(233, 196, 106, 0.28));
  border-color: rgba(233, 196, 106, 0.75);
  box-shadow: 0 0 36px rgba(233, 196, 106, 0.3), 0 0 18px rgba(123, 108, 246, 0.28);
}

/* Danger variant */
.m-btn--danger {
  border-color: rgba(255, 84, 112, 0.28);
  background: rgba(255, 84, 112, 0.07);
  color: var(--ink);
}
.m-btn--danger:hover:not(:disabled) {
  background: rgba(255, 84, 112, 0.15);
  border-color: rgba(255, 84, 112, 0.5);
  box-shadow: 0 0 16px rgba(255, 84, 112, 0.2);
}

/* Ghost / secondary */
.m-btn--ghost {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
}
.m-btn--ghost:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

/* ================================================================
   ENTRANCE ANIMATIONS
   ================================================================ */
@keyframes menu-fade-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes menu-fade-out {
  from { opacity: 1; }
  to   { opacity: 0; }
}

@keyframes menu-scale-in {
  from { opacity: 0; transform: translate(-50%,-50%) scale(0.92); }
  to   { opacity: 1; transform: translate(-50%,-50%) scale(1); }
}

@keyframes sigil-spin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes sigil-spin-rev {
  to { transform: rotate(-360deg); }
}

@keyframes sigil-pulse {
  0%, 100% { opacity: 0.07; }
  50%       { opacity: 0.13; }
}

@keyframes menu-glow-pulse {
  0%, 100% { text-shadow: 0 0 28px rgba(233,196,106,0.45), 0 0 6px rgba(255,255,255,0.2); }
  50%       { text-shadow: 0 0 44px rgba(233,196,106,0.7), 0 0 10px rgba(255,255,255,0.35); }
}

/* ================================================================
   MAIN MENU SCREEN
   ================================================================ */
#menu-main {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

#menu-main.is-visible {
  animation: menu-fade-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.menu-main-inner {
  width: min(980px, 94vw);
  max-height: 92vh;
  overflow-y: auto;
  overflow-x: hidden;
  pointer-events: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(233,196,106,0.2) transparent;
  padding: 36px 40px 32px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.menu-main-inner::-webkit-scrollbar { width: 4px; }
.menu-main-inner::-webkit-scrollbar-track { background: transparent; }
.menu-main-inner::-webkit-scrollbar-thumb { background: rgba(233,196,106,0.2); border-radius: 2px; }

/* Title block */
.menu-title-block {
  text-align: center;
  position: relative;
  padding-bottom: 4px;
  pointer-events: none;
}

.menu-sigil-bg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 280px;
  height: 280px;
  pointer-events: none;
  animation: sigil-spin 55s linear infinite, sigil-pulse 6s ease-in-out infinite;
  opacity: 0.09;
}

.menu-sigil-bg .sigil-ring-outer {
  animation: sigil-spin-rev 38s linear infinite;
  transform-origin: 60px 60px;
}

.menu-game-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 5.5vw, 3.2rem);
  letter-spacing: 0.45em;
  text-indent: 0.45em;
  color: var(--gold-bright);
  animation: menu-glow-pulse 4s ease-in-out infinite;
  line-height: 1;
  position: relative;
}

.menu-game-subtitle {
  font-family: var(--font-display);
  font-size: clamp(0.62rem, 1.4vw, 0.8rem);
  font-weight: 500;
  letter-spacing: 0.28em;
  color: var(--arcane-bright);
  text-transform: uppercase;
  opacity: 0.78;
  margin-top: 10px;
  font-style: italic;
  position: relative;
}

/* Section header */
.menu-section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.menu-section-label {
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-variant: small-caps;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  text-transform: uppercase;
  flex-shrink: 0;
}
.menu-section-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, rgba(233,196,106,0.2), transparent);
}

/* ================================================================
   MODE CARDS GRID
   ================================================================ */
.menu-modes {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.mode-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 12px 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(14, 10, 28, 0.6);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  cursor: pointer;
  pointer-events: auto;
  transition:
    border-color 180ms ease-out,
    background 180ms ease-out,
    box-shadow 180ms ease-out,
    transform 120ms ease-out;
  position: relative;
  overflow: hidden;
}

.mode-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.18), transparent);
  opacity: 0.5;
}

.mode-card:hover {
  background: rgba(20, 14, 40, 0.75);
  border-color: rgba(233, 196, 106, 0.3);
  box-shadow: 0 0 18px rgba(233, 196, 106, 0.1);
  transform: translateY(-2px);
}

.mode-card.is-selected {
  border-color: rgba(233, 196, 106, 0.6);
  background: rgba(233, 196, 106, 0.08);
  box-shadow: 0 0 24px rgba(233, 196, 106, 0.22), inset 0 0 20px rgba(233,196,106,0.04);
  transform: translateY(-2px);
}

.mode-card.is-selected::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 12px;
  border: 2px solid rgba(233, 196, 106, 0.6);
  pointer-events: none;
  box-shadow: inset 0 0 8px rgba(233,196,106,0.1);
}

.mode-card:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.mode-card:active { transform: translateY(0) scale(0.97); }

.mode-card__icon {
  font-size: 1.3rem;
  line-height: 1;
  filter: drop-shadow(0 0 6px currentColor);
}
.mode-card__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--ink);
}
.mode-card__tagline {
  font-family: var(--font-body);
  font-size: 0.58rem;
  font-variant: small-caps;
  letter-spacing: 0.12em;
  color: var(--arcane-bright);
  opacity: 0.8;
}
.mode-card__desc {
  font-family: var(--font-body);
  font-size: 0.62rem;
  color: var(--ink-dim);
  line-height: 1.55;
  flex: 1;
}
.mode-card__best {
  font-family: var(--font-display);
  font-size: 0.62rem;
  color: var(--gold);
  letter-spacing: 0.08em;
  margin-top: auto;
  padding-top: 6px;
  border-top: 1px solid rgba(233,196,106,0.12);
}

/* ================================================================
   DIFFICULTY SELECTOR
   ================================================================ */
.menu-difficulty {
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.diff-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding: 12px 14px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(14, 10, 28, 0.55);
  cursor: pointer;
  pointer-events: auto;
  transition: border-color 160ms ease-out, background 160ms ease-out, box-shadow 160ms ease-out, transform 120ms ease-out;
  position: relative;
  overflow: hidden;
}

.diff-card::before {
  content: '';
  position: absolute;
  inset: 0 0 auto 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
}

.diff-card:hover {
  background: rgba(20, 14, 40, 0.7);
  border-color: rgba(233, 196, 106, 0.25);
  transform: translateY(-2px);
}

.diff-card.is-selected {
  border-color: var(--diff-color, rgba(233,196,106,0.55));
  background: rgba(233, 196, 106, 0.06);
  box-shadow: 0 0 20px rgba(233, 196, 106, 0.15);
  transform: translateY(-1px);
}

.diff-card.is-selected::after {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: 10px;
  border: 2px solid var(--diff-color, rgba(233,196,106,0.55));
  pointer-events: none;
}

.diff-card:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.diff-card:active { transform: scale(0.97); }

/* Acolyte = frost, Adept = arcane, Archmage = danger */
.diff-card[data-diff="easy"]   { --diff-color: rgba(95, 208, 255, 0.55); }
.diff-card[data-diff="normal"] { --diff-color: rgba(123, 108, 246, 0.55); }
.diff-card[data-diff="hard"]   { --diff-color: rgba(255, 84, 112, 0.55); }

.diff-card[data-diff="easy"].is-selected   { background: rgba(95, 208, 255, 0.06); box-shadow: 0 0 20px rgba(95,208,255,0.15); }
.diff-card[data-diff="normal"].is-selected { background: rgba(123, 108, 246, 0.06); box-shadow: 0 0 20px rgba(123,108,246,0.15); }
.diff-card[data-diff="hard"].is-selected   { background: rgba(255, 84, 112, 0.06); box-shadow: 0 0 20px rgba(255,84,112,0.15); }

.diff-card__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: var(--ink);
}
.diff-card[data-diff="easy"].is-selected   .diff-card__name { color: var(--frost); }
.diff-card[data-diff="normal"].is-selected .diff-card__name { color: var(--arcane-bright); }
.diff-card[data-diff="hard"].is-selected   .diff-card__name { color: var(--danger); }

.diff-card__hint {
  font-family: var(--font-body);
  font-size: 0.6rem;
  color: var(--ink-dim);
  line-height: 1.5;
}

/* ================================================================
   MODIFIER CHIPS
   ================================================================ */
.menu-modifiers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mod-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 20px;
  border: 1px solid rgba(123, 108, 246, 0.25);
  background: rgba(123, 108, 246, 0.07);
  color: var(--ink-dim);
  cursor: pointer;
  pointer-events: auto;
  transition:
    border-color 150ms ease-out,
    background 150ms ease-out,
    color 150ms ease-out,
    box-shadow 150ms ease-out,
    transform 100ms ease-out;
  position: relative;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  font-weight: 600;
  text-transform: uppercase;
}

.mod-chip:hover:not(:disabled) {
  border-color: rgba(123, 108, 246, 0.45);
  background: rgba(123, 108, 246, 0.14);
  color: var(--ink);
  transform: translateY(-1px);
}
.mod-chip.is-active {
  border-color: rgba(233, 196, 106, 0.55);
  background: rgba(233, 196, 106, 0.1);
  color: var(--gold);
  box-shadow: 0 0 12px rgba(233, 196, 106, 0.18);
}
.mod-chip.is-locked {
  border-color: rgba(255, 84, 112, 0.35);
  background: rgba(255, 84, 112, 0.08);
  color: var(--danger);
  cursor: default;
  opacity: 0.75;
}
.mod-chip:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}
.mod-chip:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.mod-chip:active:not(:disabled) { transform: scale(0.95); }

.mod-chip__icon {
  font-size: 0.85rem;
  line-height: 1;
}

/* Tooltip */
.mod-chip__tooltip {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 160px;
  max-width: 220px;
  background: rgba(8, 5, 18, 0.97);
  border: 1px solid rgba(233, 196, 106, 0.3);
  border-radius: 8px;
  padding: 8px 10px;
  font-family: var(--font-body);
  font-size: 0.68rem;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.55;
  color: var(--ink-dim);
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 120ms ease-out, visibility 120ms ease-out;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.75);
  white-space: normal;
}
.mod-chip__tooltip::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: rgba(233, 196, 106, 0.3);
}
.mod-chip:hover .mod-chip__tooltip {
  opacity: 1;
  visibility: visible;
}

/* ================================================================
   MAP SELECTOR
   ================================================================ */
.menu-map-selector {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.map-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid rgba(95, 208, 255, 0.2);
  background: rgba(95, 208, 255, 0.05);
  color: var(--ink-dim);
  cursor: pointer;
  pointer-events: auto;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 600;
  transition: border-color 150ms ease-out, background 150ms ease-out, color 150ms ease-out, box-shadow 150ms ease-out, transform 100ms ease-out;
}
.map-chip:hover {
  border-color: rgba(95, 208, 255, 0.4);
  color: var(--frost);
  transform: translateY(-1px);
}
.map-chip.is-selected {
  border-color: rgba(95, 208, 255, 0.6);
  background: rgba(95, 208, 255, 0.1);
  color: var(--frost);
  box-shadow: 0 0 12px rgba(95, 208, 255, 0.15);
}
.map-chip:focus-visible { outline: 2px solid var(--frost); outline-offset: 2px; }
.map-chip:active { transform: scale(0.96); }
.map-chip__custom-badge {
  font-family: var(--font-body);
  font-size: 0.55rem;
  font-variant: small-caps;
  letter-spacing: 0.15em;
  color: var(--toxin);
  opacity: 0.8;
}

/* ================================================================
   MENU BOTTOM ACTION ROW
   ================================================================ */
.menu-action-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

/* ================================================================
   SETTINGS MODAL
   ================================================================ */
#menu-settings {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 120;
  pointer-events: auto;
  background: rgba(5, 4, 12, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 180ms ease-out, visibility 180ms ease-out;
}

#menu-settings.is-open {
  opacity: 1;
  visibility: visible;
}

.settings-card {
  width: min(440px, 90vw);
  padding: 32px 36px 28px;
  pointer-events: auto;
  animation: menu-scale-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

#menu-settings:not(.is-open) .settings-card {
  animation: none;
}

.settings-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  color: var(--gold);
  text-align: center;
  margin-bottom: 24px;
  text-shadow: 0 0 18px rgba(233, 196, 106, 0.4);
}

/* Settings rows */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.settings-row__label {
  font-family: var(--font-body);
  font-size: 0.72rem;
  font-variant: small-caps;
  letter-spacing: 0.16em;
  color: var(--ink-dim);
  text-transform: uppercase;
  flex-shrink: 0;
}

.settings-row__control {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* Volume slider */
.settings-slider-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  justify-content: flex-end;
}

.settings-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 130px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
  pointer-events: auto;
  position: relative;
}
.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(233, 196, 106, 0.5);
  border: 2px solid rgba(233, 196, 106, 0.4);
  transition: box-shadow 150ms ease-out, transform 100ms ease-out;
}
.settings-slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 14px rgba(233, 196, 106, 0.75);
  transform: scale(1.15);
}
.settings-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gold);
  cursor: pointer;
  border: 2px solid rgba(233, 196, 106, 0.4);
  box-shadow: 0 0 8px rgba(233, 196, 106, 0.5);
}
.settings-slider:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 4px;
}

.settings-slider-val {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--gold);
  min-width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Toggle switch */
.settings-toggle {
  display: flex;
  align-items: center;
  gap: 0;
  cursor: pointer;
  pointer-events: auto;
}

.settings-toggle__track {
  width: 38px;
  height: 22px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  position: relative;
  transition: background 160ms ease-out, border-color 160ms ease-out, box-shadow 160ms ease-out;
  flex-shrink: 0;
}
.settings-toggle.is-on .settings-toggle__track {
  background: rgba(123, 108, 246, 0.45);
  border-color: rgba(123, 108, 246, 0.65);
  box-shadow: 0 0 12px rgba(123, 108, 246, 0.3);
}
.settings-toggle__thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transition: transform 160ms cubic-bezier(0.34, 1.56, 0.64, 1), background 160ms ease-out, box-shadow 160ms ease-out;
}
.settings-toggle.is-on .settings-toggle__thumb {
  transform: translateX(16px);
  background: var(--arcane-bright);
  box-shadow: 0 0 8px rgba(123, 108, 246, 0.5);
}
.settings-toggle:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 12px;
}

/* Quality select */
.settings-select {
  -webkit-appearance: none;
  appearance: none;
  background: rgba(14, 10, 28, 0.8);
  border: 1px solid rgba(233, 196, 106, 0.22);
  border-radius: 8px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.1em;
  padding: 7px 28px 7px 10px;
  cursor: pointer;
  pointer-events: auto;
  outline: none;
  transition: border-color 150ms ease-out, box-shadow 150ms ease-out;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%239a8fc0'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  min-width: 100px;
  text-transform: uppercase;
}
.settings-select:hover { border-color: rgba(233, 196, 106, 0.4); }
.settings-select:focus { border-color: rgba(233, 196, 106, 0.55); box-shadow: 0 0 10px rgba(233, 196, 106, 0.15); }
.settings-select option {
  background: #0a0712;
  color: var(--ink);
}

/* Settings divider */
.settings-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(233,196,106,0.15), transparent);
  margin: 4px 0;
}

/* ================================================================
   PAUSE OVERLAY
   ================================================================ */
#menu-pause {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: auto;
  background: rgba(5, 4, 12, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 200ms ease-out, visibility 200ms ease-out;
}

#menu-pause.is-visible {
  opacity: 1;
  visibility: visible;
  animation: menu-fade-in 0.3s ease-out both;
}

.pause-card {
  width: min(340px, 88vw);
  padding: 36px 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 0;
  align-items: center;
  pointer-events: auto;
}

.pause-glyph {
  font-size: 2.4rem;
  line-height: 1;
  color: var(--arcane-bright);
  filter: drop-shadow(0 0 16px var(--arcane));
  margin-bottom: 10px;
}

.pause-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: 0.3em;
  text-indent: 0.3em;
  color: var(--gold);
  text-shadow: 0 0 24px rgba(233, 196, 106, 0.45);
  margin-bottom: 6px;
}

.pause-sub {
  font-family: var(--font-body);
  font-size: 0.7rem;
  font-variant: small-caps;
  letter-spacing: 0.18em;
  color: var(--ink-dim);
  margin-bottom: 28px;
  text-align: center;
}

.pause-actions {
  display: flex;
  flex-direction: column;
  gap: 9px;
  width: 100%;
}

.pause-actions .m-btn {
  width: 100%;
  justify-content: center;
}

/* ================================================================
   RESULTS OVERLAY
   ================================================================ */
#menu-results {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 110;
  pointer-events: auto;
  background: rgba(5, 4, 12, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 250ms ease-out, visibility 250ms ease-out;
}

#menu-results.is-visible {
  opacity: 1;
  visibility: visible;
  animation: menu-fade-in 0.5s ease-out both;
}

.results-card {
  width: min(480px, 90vw);
  padding: 44px 44px 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  pointer-events: auto;
}

@keyframes results-glyph-in {
  from { opacity: 0; transform: scale(0.5) rotate(-20deg); filter: blur(4px); }
  to   { opacity: 1; transform: scale(1) rotate(0deg); filter: blur(0); }
}

.results-glyph {
  font-size: clamp(2.8rem, 7vw, 4rem);
  line-height: 1;
  margin-bottom: 14px;
  animation: results-glyph-in 0.55s cubic-bezier(0.22,1,0.36,1) 0.1s both;
  filter: drop-shadow(0 0 18px currentColor);
}

.results-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.4rem, 4vw, 2rem);
  letter-spacing: 0.2em;
  text-align: center;
  margin-bottom: 8px;
  text-shadow: 0 0 22px currentColor, 0 0 5px rgba(255,255,255,0.25);
}

.results-meta {
  font-family: var(--font-body);
  font-size: 0.75rem;
  color: var(--ink-dim);
  text-align: center;
  letter-spacing: 0.12em;
  margin-bottom: 20px;
}

/* State colors */
#menu-results.is-won .results-glyph  { color: var(--gold); }
#menu-results.is-won .results-title  { color: var(--gold); }
#menu-results.is-lost .results-glyph { color: var(--danger); }
#menu-results.is-lost .results-title { color: var(--danger); }

/* Score block */
.results-score-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding: 16px 0;
  margin-bottom: 20px;
}

.results-score-label {
  font-family: var(--font-body);
  font-size: 0.6rem;
  font-variant: small-caps;
  letter-spacing: 0.22em;
  color: var(--ink-dim);
  text-transform: uppercase;
}

.results-score-value {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2rem, 6vw, 2.8rem);
  color: var(--gold);
  letter-spacing: 0.06em;
  text-shadow: 0 0 28px rgba(233, 196, 106, 0.55);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.results-best-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--gold-bright);
  padding: 4px 12px;
  border-radius: 20px;
  background: rgba(233, 196, 106, 0.12);
  border: 1px solid rgba(233, 196, 106, 0.35);
  box-shadow: 0 0 12px rgba(233, 196, 106, 0.2);
  text-transform: uppercase;
}

@keyframes best-badge-pop {
  0%   { transform: scale(0.7); opacity: 0; }
  60%  { transform: scale(1.1); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}
.results-best-badge { animation: best-badge-pop 0.4s cubic-bezier(0.22,1,0.36,1) 0.4s both; }

.results-prev-best {
  font-family: var(--font-body);
  font-size: 0.62rem;
  color: var(--ink-dim);
  letter-spacing: 0.08em;
}

.results-actions {
  display: flex;
  gap: 10px;
  width: 100%;
  justify-content: center;
  flex-wrap: wrap;
}

.results-actions .m-btn {
  flex: 1;
  min-width: 130px;
  justify-content: center;
}

/* ================================================================
   RESPONSIVE — 760px
   ================================================================ */
@media (max-width: 860px) {
  .menu-modes {
    grid-template-columns: repeat(3, 1fr);
  }
  .menu-main-inner {
    padding: 24px 20px 20px;
    gap: 18px;
  }
}

@media (max-width: 680px) {
  .menu-modes {
    grid-template-columns: repeat(2, 1fr);
  }
  .menu-difficulty {
    flex-direction: column;
    gap: 7px;
  }
  .diff-card {
    flex-direction: row;
    gap: 12px;
    padding: 10px 14px;
  }
  .menu-action-row {
    flex-direction: column;
    align-items: stretch;
  }
  .menu-action-row .m-btn--primary {
    width: 100%;
  }
  .menu-action-row-left {
    justify-content: center;
  }
  .settings-card {
    padding: 24px 22px 22px;
  }
  .results-card,
  .pause-card {
    padding: 28px 24px 24px;
  }
}

@media (max-width: 500px) {
  .menu-modes {
    grid-template-columns: 1fr 1fr;
  }
  .menu-main-inner {
    padding: 18px 14px 16px;
  }
  .menu-game-title {
    font-size: 1.7rem;
  }
}

/* ================================================================
   ACCESSIBILITY
   ================================================================ */
@media (prefers-reduced-motion: reduce) {
  .menu-sigil-bg,
  .menu-sigil-bg .sigil-ring-outer {
    animation: sigil-pulse 8s ease-in-out infinite;
  }
  .menu-game-title {
    animation: none;
  }
  .results-glyph,
  .results-best-badge,
  #menu-main.is-visible,
  #menu-pause.is-visible,
  #menu-results.is-visible {
    animation: none;
  }
  .settings-card {
    animation: none;
  }
}

/* ================================================================
   HIDDEN UTILITY
   ================================================================ */
.menu-hidden {
  display: none !important;
}
