/* Shared, ornament-free menu material. Forms, resource steppers and gameplay
   action buttons keep their current dimensions and semantics. */
:root {
  --asteria-menu-height:48px;
  --asteria-top-menu-height:53px;
  --asteria-banner-height:clamp(84px,10.625vw,272.4px);
  --core-header-height:var(--asteria-banner-height);
  --asteria-header-art:none;
  --button-metal-dark:#090a0c;
  --button-metal-mid:#4b4d50;
  --button-metal-light:#c9cbce;
}

/* Keep the movement token below interaction-state specificity. */
body .asteria-menu-button { --button-travel:0px; }

/* The existing top-nav ID keeps these shared rules above legacy menu skins. */
body :is(.asteria-menu-button,#globalNavigation > .crystal-button) {
  --menu-tip:20px;
  --button-bezel:6px;
  --button-depth:7px;
  --button-padding:11px;
  --button-crystal-color:var(--asteria-menu-button,var(--asteria-accent,#808080));
  --button-crystal-highlight:color-mix(in srgb,var(--button-crystal-color) 22%,white);
  --button-crystal-glow:color-mix(in srgb,var(--button-crystal-color) calc(var(--asteria-glow-intensity,.36) * 70%),transparent);
  position:relative!important;isolation:isolate;display:inline-flex;align-items:center;justify-content:center;gap:8px;
  min-height:var(--asteria-menu-height)!important;height:auto;min-width:0;
  box-sizing:border-box;
  padding:calc(var(--button-padding) - var(--button-depth) / 2 + var(--button-travel)) 28px calc(var(--button-padding) + var(--button-depth) / 2 - var(--button-travel))!important;
  border:0 solid transparent!important;border-radius:0!important;
  /* Stationary lower body. Nine-slice SVG keeps pointed ends the same width
     on short icon controls and long labels; it never tints with the crystal. */
  border-image:url("../assets/ui/steel-sidewall.svg") 0 20 fill / 0 var(--menu-tip) / 0 stretch!important;
  background:transparent!important;color:var(--asteria-text,#e5edf2)!important;box-shadow:none!important;
  font:600 .9rem/1.25 var(--asteria-font-body)!important;text-align:center;text-decoration:none;
  white-space:normal;overflow:visible!important;overflow-wrap:anywhere;cursor:pointer;
  filter:drop-shadow(0 5px 1px #000c) drop-shadow(0 7px 5px #0008);
  transition:padding 280ms cubic-bezier(.2,1.45,.45,1),filter 180ms ease;
  transform:none!important;
}
body .asteria-menu-button::before,body .asteria-menu-button::after {
  content:""!important;position:absolute;pointer-events:none;opacity:1!important;mask:none!important;
  border:0!important;border-radius:0!important;mix-blend-mode:normal!important;
  clip-path:polygon(0 50%,var(--menu-tip) 0,calc(100% - var(--menu-tip)) 0,100% 50%,calc(100% - var(--menu-tip)) 100%,var(--menu-tip) 100%);
  transition:transform 280ms cubic-bezier(.2,1.45,.45,1),filter 180ms ease,box-shadow 180ms ease;
  transform:translateY(var(--button-travel))!important;
}
body .asteria-menu-button::before {
  inset:0 0 var(--button-depth)!important;z-index:-2!important;
  /* Fixed achromatic forged metal: no accent or crystal variables in this layer. */
  background:linear-gradient(112deg,#ffffff14,transparent 14% 87%,#0009),repeating-linear-gradient(176deg,#ffffff08 0 .5px,#00000014 .5px 1px,transparent 1px 4px),linear-gradient(180deg,#a1a5a8 0%,#737a7f 3%,#42494e 9%,#2d3338 20%,#14191d 45%,#090c0f 58%,#242b30 80%,#596168 93%,#11161a 100%)!important;
  box-shadow:inset 0 1px #c3c7ca88,inset 0 -4px #030507,inset 2px 0 #70787f,inset -2px 0 #0b0e10!important;
}
body .asteria-menu-button::after {
  inset:var(--button-bezel) var(--button-bezel) calc(var(--button-bezel) + var(--button-depth))!important;z-index:-1!important;
  clip-path:polygon(0 50%,calc(var(--menu-tip) - var(--button-bezel) * .7) 0,calc(100% - var(--menu-tip) + var(--button-bezel) * .7) 0,100% 50%,calc(100% - var(--menu-tip) + var(--button-bezel) * .7) 100%,calc(var(--menu-tip) - var(--button-bezel) * .7) 100%)!important;
  --crystal-specular:color-mix(in srgb,var(--button-crystal-color) 25%,#f4f4f4);
  --crystal-caustic:color-mix(in srgb,var(--button-crystal-color) 60%,#dfdfdf);
  /* Continuous curved optical layers: no polygon texture or fixed colour. */
  background-image:radial-gradient(ellipse 75% 52% at 47% -8%,color-mix(in srgb,var(--crystal-specular) 86%,transparent) 0%,color-mix(in srgb,var(--crystal-specular) 44%,transparent) 32%,transparent 74%),radial-gradient(ellipse 88% 130% at 55% -41%,transparent 63%,color-mix(in srgb,var(--crystal-caustic) 28%,transparent) 67%,transparent 73%),radial-gradient(ellipse 64% 90% at 52% 112%,color-mix(in srgb,var(--crystal-caustic) 48%,transparent),transparent 76%),linear-gradient(180deg,#0007,transparent 30% 62%,#0008),radial-gradient(ellipse 80% 120% at 48% 43%,color-mix(in srgb,var(--button-crystal-color) 78%,#747474),color-mix(in srgb,var(--button-crystal-color) 59%,#151515) 54%,color-mix(in srgb,var(--button-crystal-color) 24%,#020202) 100%)!important;
  background-size:100% 100%!important;background-repeat:no-repeat!important;
  box-shadow:inset 0 1px 1px var(--button-crystal-highlight),inset 0 3px 3px #0007,inset 0 -3px 2px color-mix(in srgb,var(--button-crystal-color) 62%,#8f8f8f),inset 2px 0 3px #0009,inset -2px 0 3px #0009,inset 0 0 6px 2px #0007,inset 0 0 calc(5px + var(--asteria-glow-intensity,.36) * 16px) var(--button-crystal-glow)!important;
  filter:brightness(1);
}
body .asteria-menu-button:not(:disabled):not([aria-disabled="true"]):hover {
  --button-travel:-2px;filter:drop-shadow(0 5px 1px #000c) drop-shadow(0 8px 6px #0008);
}
body .asteria-menu-button:not(:disabled):not([aria-disabled="true"]):hover::before { filter:brightness(1.12); }
body .asteria-menu-button:not(:disabled):not([aria-disabled="true"]):hover::after { filter:brightness(1.22); }
body .asteria-menu-button:is(.active,[aria-selected="true"],[aria-pressed="true"],[aria-current="page"],[aria-expanded="true"])::after {
  filter:brightness(1.18);
  box-shadow:inset 0 2px 1px var(--button-crystal-highlight),inset 0 -3px var(--button-crystal-highlight),inset 0 0 4px 2px #000b,inset 0 0 calc(8px + var(--asteria-glow-intensity,.36) * 20px) var(--button-crystal-glow)!important;
}
/* Only the top face and its label travel. The lower sidewall stays anchored. */
body .asteria-menu-button:not(:disabled):not([aria-disabled="true"]):is(:active,[data-menu-pressed]) {
  --button-travel:4px;filter:drop-shadow(0 1px 1px #000b);transition-duration:70ms!important;
}
body .asteria-menu-button:not(:disabled):not([aria-disabled="true"]):is(:active,[data-menu-pressed])::before {
  transition-duration:70ms!important;filter:brightness(.94);
  box-shadow:inset 0 1px #7d858b,inset 0 -2px #030507,inset 2px 0 #515b63,inset -2px 0 #0b0e10!important;
}
body .asteria-menu-button:not(:disabled):not([aria-disabled="true"]):is(:active,[data-menu-pressed])::after {
  transition-duration:70ms!important;filter:brightness(1.35);
}
body .asteria-menu-button:focus-visible { outline:2px solid #c4eaff!important;outline-offset:3px; }
body .asteria-menu-button:is(:disabled,[aria-disabled="true"]) { --button-travel:0px;opacity:.5;cursor:not-allowed;filter:grayscale(1) drop-shadow(0 1px 1px #0008); }
body .asteria-menu-button:is(:disabled,[aria-disabled="true"])::after { filter:grayscale(1); }
body .asteria-menu-button > .edge-light { display:none!important; }

/* Reuse the existing independent colour areas; only the crystal consumes them. */
body :is(.react-workspace-shell,#player) .asteria-menu-button {
  --button-crystal-color:var(--asteria-dashboard-tab,var(--asteria-accent,#808080));
}
body :is(#globalNavigation,#accountControls) .crystal-button,body .asteria-header #settingsToggle {
  --button-crystal-color:var(--asteria-top-menu-button,var(--asteria-accent,#808080));
  --button-bezel:6px;
}

/* Compact controls are approximately 3/5 of the previous 88px design.
   The row is centred vertically; the split-button marker anchors its horizontal position. */
body .topbar.asteria-header {
  display:grid!important;grid-template-columns:minmax(0,1fr) auto!important;align-content:center!important;
  gap:10px!important;padding:0 16px 6px!important;
  height:var(--core-header-height)!important;min-height:var(--core-header-height)!important;
  background-image:linear-gradient(90deg,#02070c00 25%,#02070c30 48%,#02070c30),var(--asteria-header-art),linear-gradient(#09111b,#080f17)!important;
  background-size:cover,100% auto,cover!important;
  background-repeat:no-repeat!important;background-position:left 52%!important;
}
body .asteria-main-navigation { justify-content:flex-start;gap:7px;flex-wrap:nowrap; }
/* Measure the existing split control after fonts load; no duplicate navigation. */
body .asteria-header #globalNavigation { position:absolute;left:50%;top:50%;width:max-content;transform:translate(calc(0px - var(--compendium-trigger-offset,354px)),-50%); }
body .asteria-header .top-actions { position:absolute;right:16px;top:50%;transform:translateY(-50%); }
body .asteria-header .top-actions { margin:0!important;height:auto!important;justify-content:flex-end!important;gap:10px!important; }
body .asteria-account-controls { gap:7px; }
body :is(#globalNavigation,#accountControls) .crystal-button,
body .asteria-header #settingsToggle,
body #accountControls #loginToggle {
  --menu-tip:19px;
  min-height:var(--asteria-top-menu-height)!important;height:var(--asteria-top-menu-height)!important;
  --button-padding:10px;
  padding-inline:22px!important;font-size:.94rem!important;line-height:1.1!important;white-space:nowrap;
}
body #globalNavigation .crystal-arrow { width:45px!important;min-width:45px!important;padding-inline:10px!important; }
body .asteria-header #settingsToggle { width:53px!important;min-width:53px!important;padding-inline:10px!important;gap:5px!important; }
body .asteria-header #settingsToggle span { width:22px!important;height:2px!important; }
body #accountControls #loginToggle { order:0!important; }
body .compendium-split { gap:2px; }
body .compendium-quick-menu { width:380px;padding:12px; }
body .compendium-quick-menu .asteria-menu-button { display:flex;min-height:48px!important;padding-inline:24px!important;margin-block:5px;font-size:.88rem!important; }
body .compendium-quick-menu .asteria-menu-button span { font-size:1rem; }
body :is(.react-tabs,.workspace-tabs,.phase3-tabs,.phase4-tabs,.ecosystem-tabs,.codex-detail-tabs,.react-filter-tabs,.combat-action-tabs) { gap:8px; }
body .react-tabs { padding:8px!important; }
body .react-tabs .asteria-menu-button { flex-shrink:0; }

@media (max-width:1679px) {
  :root { --asteria-banner-height:clamp(57.6px,10.625vw,180px);--core-header-height:var(--asteria-banner-height); }
  body .topbar.asteria-header { grid-template-columns:minmax(0,1fr)!important;padding:0 16px 6px!important; }
  body .asteria-header .top-actions { justify-content:flex-end!important; }
  body .topbar.asteria-header { background-size:cover,auto calc(var(--asteria-banner-height) * 516 / 272),cover!important; }
  #mobileNavigationSlot,#mobileAccountSlot { display:block; }
  body #globalNavigation { position:static;left:auto;top:auto;width:auto;transform:none;display:flex;flex-direction:column;align-items:stretch;gap:12px;margin-bottom:18px; }
  #accountControls { display:flex;flex-direction:column;align-items:stretch;gap:12px;padding-block:16px;border-block:1px solid #54708766; }
  body :is(#globalNavigation,#accountControls) .crystal-button { white-space:normal;max-width:100%; }
  #settingsPanel .compendium-split > a { flex:1;min-width:0;padding-inline:16px!important; }
  .compendium-split { flex-wrap:wrap; }
  .compendium-quick-menu { position:static;width:100%!important;max-width:none;margin-top:8px;box-shadow:none;padding:6px!important; }
  .compendium-quick-menu:not([hidden]) { flex-basis:100%; }
  body #settingsPanel { width:420px!important;max-width:calc(100vw - 12px)!important;overflow-x:hidden!important; }
  #settingsPanel .edge-light { display:none!important; }
  #settingsPanel input { min-width:0;max-width:100%;box-sizing:border-box; }
  .library-groups,.library-results { grid-template-columns:repeat(2,minmax(0,1fr)); }
}
@media (max-width:600px) {

  .library-groups,.library-results { grid-template-columns:minmax(0,1fr); }
}
@media (prefers-reduced-motion:reduce) {
  body .asteria-menu-button { --button-travel:0px!important; }
  body .asteria-menu-button,body .asteria-menu-button::before,body .asteria-menu-button::after { transition:none!important;transform:none!important; }
}
/* Dashboard tab rows scroll as one full-width menu; labels never break mid-word. */
body :is(.react-gm-dashboard,.react-character-dashboard) .react-tabs .asteria-menu-button {
  flex:0 0 auto!important;min-width:max-content!important;white-space:nowrap!important;
}

/* Only the two dashboard navigation rows float; gameplay panels keep their skin. */
body :is(.react-character-dashboard,.react-gm-dashboard) .react-tabs[aria-label$="Dashboard menu"] {
  border:0!important;border-radius:0!important;background:transparent!important;box-shadow:none!important;backdrop-filter:none!important;
}
body :is(.react-character-dashboard,.react-gm-dashboard) .react-tabs[aria-label$="Dashboard menu"]::before,
body :is(.react-character-dashboard,.react-gm-dashboard) .react-tabs[aria-label$="Dashboard menu"]::after,
body :is(.react-character-dashboard,.react-gm-dashboard) .react-tabs[aria-label$="Dashboard menu"] > .edge-light { display:none!important; }
