/* ============================================================
   Warcraft III main menu — fan homage, rebuilt in code.
   All artwork procedural / CSS-painted. No external assets.
   ============================================================ */

:root {
  --ink:        #05060a;
  --stone-deep: #10131a;
  --stone:      #1c202a;
  --stone-lite: #262b38;
  --edge-dark:  #07080c;
  --bronze:     #6b5420;
  --bronze-lt:  #a98736;
  --gold:       #d9b36a;
  --gold-bright:#ffe9a8;
  --gold-dim:   #8a6f3a;
  --ember:      #ff7a2a;
  --text-dim:   #97a0ad;
  --serif:      Georgia, "Times New Roman", "Palatino Linotype", serif;

  /* self-authored stone grain (SVG turbulence) */
  --noise: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='matrix' values='0 0 0 0 1 0 0 0 0 0.95 0 0 0 0 0.85 0 0 0 0.05 0'/></filter><rect width='140' height='140' filter='url(%23n)'/></svg>");
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* author display values must never defeat the hidden attribute */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  background: var(--ink);
  color: var(--gold);
  font-family: var(--serif);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.sr-only {
  position: absolute; width: 1px; height: 1px;
  clip-path: inset(50%); overflow: hidden; white-space: nowrap;
}

/* ============================== SCENE CANVASES ============================== */
#scene   { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

#grainFx {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; opacity: 0; z-index: 30;
  mix-blend-mode: overlay; transition: opacity .4s ease;
}
body.grain-on #grainFx { opacity: .085; }

.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 5;
  background:
    radial-gradient(115% 88% at 50% 42%, transparent 46%, rgba(2,3,6,.5) 80%, rgba(1,1,3,.82) 100%),
    linear-gradient(180deg, rgba(0,0,0,.32), transparent 18% 76%, rgba(0,0,0,.52));
}

/* ============================== LOGO ============================== */
#logoBlock {
  position: fixed; z-index: 10;
  left: clamp(12px, 4vw, 64px);
  top: clamp(10px, 3.5vh, 44px);
  width: clamp(230px, 30vw, 420px);
  opacity: 0; transform: translateY(-10px);
  transition: opacity 1s ease .15s, transform 1s ease .15s;
}
body.entered #logoBlock { opacity: 1; transform: none; }

#logoMark { display: block; width: 100%; height: auto; overflow: visible; }

.logo-word {
  font-family: var(--serif);
  font-size: 63px;
  font-weight: 700;
  letter-spacing: 1.5px;
}
#logoWord     { fill: url(#goldGrad); stroke: #3a2506; stroke-width: 1.6; }

.logo-sheen { fill: url(#sheenGrad); }

#logoSub {
  font-family: var(--serif);
  font-size: 27px;
  letter-spacing: 9px;
  fill: url(#goldGradHi);
}
#logoSubFan {
  font-family: Verdana, Geneva, sans-serif;
  font-size: 8.5px;
  letter-spacing: 3px;
  fill: #6f7887;
}

/* slow sheen sweep across wordmark */
#logoMark::after { content: none; }
@keyframes sheenSweep { 0%, 62% { transform: translateX(-130%) skewX(-18deg);} 88%, 100% { transform: translateX(240%) skewX(-18deg);} }
#sheenRect { animation: sheenSweep 11s ease-in-out infinite; }

/* ============================== MENU STACK ============================== */
#menuStack {
  position: fixed; z-index: 12;
  right: clamp(16px, 6vw, 110px);
  top: 50%; transform: translateY(-47%);
  display: flex; flex-direction: column; gap: 11px;
  width: clamp(220px, 23vw, 310px);
}

.menu-btn {
  position: relative;
  height: clamp(46px, 5.6vh, 56px);
  border: 1px solid #05060a;
  cursor: pointer;
  font-family: var(--serif);
  color: var(--gold);
  font-size: clamp(17px, 1.35vw, 21px);
  letter-spacing: .08em;
  background:
    var(--noise),
    linear-gradient(178deg,
      #2b303d 0%, #20242f 34%, #171a23 58%, #12151d 80%, #161a24 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 236, 170, .14),
    inset 0 -1px 0 rgba(0, 0, 0, .75),
    0 0 0 2px var(--edge-dark),
    0 0 0 3px #57451c,
    0 0 0 4px #191307,
    0 7px 16px rgba(0, 0, 0, .6),
    0 2px 3px rgba(0, 0, 0, .5);
  transition: filter .09s ease, box-shadow .12s ease, transform .06s ease, color .09s ease;
  opacity: 0; transform: translateX(26px);
}
body.entered .menu-btn {
  opacity: 1; transform: none;
  transition: opacity .5s ease calc(.35s + var(--i, 0) * .075s),
              transform .5s cubic-bezier(.2,.9,.3,1.2) calc(.35s + var(--i, 0) * .075s),
              filter .09s ease, box-shadow .12s ease, color .09s ease;
}

.menu-btn > span {
  position: relative; z-index: 2;
  display: inline-block;
  text-shadow:
    0 -1px 1px rgba(0, 0, 0, .9),
    0 1px 0 rgba(255, 233, 168, .16),
    0 2px 6px rgba(0, 0, 0, .6);
}

/* corner rivets */
.menu-btn::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background-image:
    radial-gradient(circle at 8px 8px,                 rgba(196,156,84,.5) 0 1.5px, transparent 2.2px),
    radial-gradient(circle at calc(100% - 8px) 8px,    rgba(196,156,84,.5) 0 1.5px, transparent 2.2px),
    radial-gradient(circle at 8px calc(100% - 8px),    rgba(196,156,84,.38) 0 1.5px, transparent 2.2px),
    radial-gradient(circle at calc(100% - 8px) calc(100% - 8px), rgba(196,156,84,.38) 0 1.5px, transparent 2.2px);
}

.menu-btn:hover, .menu-btn:focus-visible {
  filter: brightness(1.28) saturate(1.05);
  color: var(--gold-bright);
  box-shadow:
    inset 0 1px 0 rgba(255, 240, 190, .28),
    inset 0 -1px 0 rgba(0, 0, 0, .75),
    0 0 0 2px var(--edge-dark),
    0 0 0 3px #8a6f2e,
    0 0 0 4px #191307,
    0 7px 18px rgba(0, 0, 0, .65),
    0 0 22px rgba(240, 182, 82, .32),
    0 0 46px rgba(240, 170, 60, .14);
}
.menu-btn:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 4px; }

.menu-btn:active {
  transform: translateY(2px);
  filter: brightness(.94);
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, .8),
    inset 0 -1px 0 rgba(255, 236, 170, .06),
    0 0 0 2px var(--edge-dark),
    0 0 0 3px #57451c,
    0 2px 5px rgba(0, 0, 0, .6);
}

/* keyboard-only focus ring when tabbing through stack quickly */
.menu-btn.kbd-focus { filter: brightness(1.22); }

/* ============================== VERSION + LEGAL ============================== */
#versionTag {
  position: fixed; z-index: 11;
  left: clamp(10px, 1.6vw, 22px); bottom: clamp(26px, 4vh, 40px);
  font-family: Verdana, Geneva, sans-serif;
  font-size: 11px; color: #7d8593; letter-spacing: .04em;
  text-shadow: 0 1px 2px #000;
  opacity: 0; transition: opacity 1s ease .8s;
}
body.entered #versionTag { opacity: .95; }

#legalLine {
  position: fixed; z-index: 11;
  left: 0; right: 0; bottom: 0;
  padding: 6px 14px 7px;
  text-align: center;
  font-family: Verdana, Geneva, sans-serif;
  font-size: 9.5px; letter-spacing: .03em; color: #666f7d;
  background: linear-gradient(180deg, rgba(3,4,7,0), rgba(3,4,7,.72));
  text-shadow: 0 1px 2px #000;
  opacity: 0; transition: opacity 1s ease .9s;
}
body.entered #legalLine { opacity: 1; }

/* ============================== SHARED BUTTONS ============================== */
.big-btn, .mini-btn {
  font-family: var(--serif); cursor: pointer;
  color: var(--gold); letter-spacing: .07em;
  border: 1px solid #05060a;
  background: var(--noise), linear-gradient(178deg, #262b37, #181c25 55%, #13161e);
  box-shadow: inset 0 1px 0 rgba(255,236,170,.13), inset 0 -1px 0 rgba(0,0,0,.7),
              0 0 0 2px var(--edge-dark), 0 0 0 3px #4d3e18, 0 4px 10px rgba(0,0,0,.55);
  transition: filter .09s ease, box-shadow .12s ease, transform .06s ease, color .09s ease;
}
.big-btn { font-size: 16.5px; padding: 11px 26px; }
.mini-btn { font-size: 13.5px; padding: 8px 16px; }
.big-btn:hover, .mini-btn:hover, .big-btn:focus-visible, .mini-btn:focus-visible {
  filter: brightness(1.25); color: var(--gold-bright);
  box-shadow: inset 0 1px 0 rgba(255,240,190,.25), inset 0 -1px 0 rgba(0,0,0,.7),
              0 0 0 2px var(--edge-dark), 0 0 0 3px #8a6f2e, 0 4px 12px rgba(0,0,0,.6),
              0 0 18px rgba(240,182,82,.28);
}
.big-btn:focus-visible, .mini-btn:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }
.big-btn:active, .mini-btn:active { transform: translateY(2px); filter: brightness(.93); }
.big-btn.dim { color: var(--text-dim); }
.big-btn[disabled], .mini-btn[disabled] { opacity: .55; cursor: wait; filter: saturate(.4); }

kbd {
  font-family: Verdana, sans-serif; font-size: .82em;
  border: 1px solid #3c4353; border-bottom-width: 2px; border-radius: 3px;
  padding: 0 5px; color: #aab3c0; background: #14171f;
}

/* ============================== PANEL LAYER ============================== */
#panelLayer {
  position: fixed; inset: 0; z-index: 40;
  display: grid; place-items: center;
  background: rgba(2, 3, 6, .45);
}
#panelLayer::before {
  content: ""; position: absolute; inset: 0;
  backdrop-filter: blur(2.5px) brightness(.82);
  -webkit-backdrop-filter: blur(2.5px) brightness(.82);
}

.panel {
  position: relative; z-index: 2;
  width: min(760px, 94vw);
  max-height: min(86vh, 720px);
  display: flex; flex-direction: column;
  border: 1px solid #000;
  background:
    var(--noise),
    linear-gradient(180deg, #20242f 0%, #171b24 40%, #12151d 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,236,170,.1), inset 0 0 0 1px rgba(0,0,0,.6),
    0 0 0 2px #57451c, 0 0 0 3px #0a0803, 0 0 0 4px rgba(138,111,46,.5),
    0 24px 70px rgba(0,0,0,.85), 0 0 90px rgba(255,120,40,.05);
  animation: panelDrop .32s cubic-bezier(.18,.9,.26,1.15);
}
@keyframes panelDrop {
  from { opacity: 0; transform: translateY(-26px) scale(.985); }
  to   { opacity: 1; transform: none; }
}

.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px 11px 20px;
  border-bottom: 1px solid #57451c;
  background: linear-gradient(180deg, #262b38, #181c26);
  box-shadow: inset 0 -6px 14px rgba(0,0,0,.35);
}
.panel-head h2 {
  font-size: 21px; letter-spacing: .12em; font-weight: 700;
  color: var(--gold-bright);
  text-shadow: 0 -1px 1px rgba(0,0,0,.9), 0 0 14px rgba(240,182,82,.25);
}
.panel-close {
  width: 30px; height: 30px; cursor: pointer;
  font-size: 19px; line-height: 1; color: var(--gold);
  background: linear-gradient(180deg, #2a2f3c, #15181f);
  border: 1px solid #05060a; box-shadow: 0 0 0 1px #4d3e18, inset 0 1px 0 rgba(255,236,170,.12);
}
.panel-close:hover, .panel-close:focus-visible { filter: brightness(1.3); color: #ffb08a; }
.panel-close:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }

.panel-intro { padding: 12px 20px 0; color: var(--text-dim); font-style: italic; font-size: 14px; }

.panel-body-scroll { overflow-y: auto; scrollbar-width: thin; scrollbar-color: #57451c #10131a; }

.panel-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 12px 16px;
  border-top: 1px solid #57451c;
  background: linear-gradient(180deg, rgba(0,0,0,.12), rgba(0,0,0,.32));
}
.esc-hint { font-family: Verdana, sans-serif; font-size: 10px; color: #67707e; letter-spacing: .05em; }
.esc-hint.light { color: #8d96a4; }

.panel > :not(.panel-head):not(.panel-foot) { padding-left: 20px; padding-right: 20px; }

/* ============================== CAMPAIGN ============================== */
.race-tabs {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 14px 20px 4px;
}
.race-tab {
  display: inline-flex; align-items: center; gap: 7px;
  font-family: var(--serif); font-size: 14.5px; letter-spacing: .04em;
  color: var(--text-dim); cursor: pointer; padding: 7px 13px;
  background: linear-gradient(180deg, #191d26, #10131a);
  border: 1px solid #05060a; box-shadow: 0 0 0 1px #33301c;
  transition: filter .09s ease, color .09s ease, box-shadow .12s ease;
}
.race-tab[aria-selected="true"] {
  color: var(--gold-bright);
  box-shadow: 0 0 0 1px #8a6f2e, 0 0 14px rgba(240,182,82,.22);
  filter: brightness(1.18);
}
.race-tab:hover { filter: brightness(1.22); }
.race-tab:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }

.crest { width: 15px; height: 15px; display: inline-block; filter: drop-shadow(0 1px 1px #000); }
.crest-prologue { background: conic-gradient(from 45deg, #c9d2df 0 25%, #7d8797 0 50%, #c9d2df 0 75%, #7d8797 0); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.crest-human    { background: linear-gradient(160deg, #9db7e6, #3d5fa8 60%, #24365f); clip-path: polygon(50% 0, 100% 28%, 92% 100%, 8% 100%, 0 28%); }
.crest-undead   { background: radial-gradient(circle at 50% 38%, #e8f0da 0 26%, #4c5f43 30%, #22291d 70%); clip-path: polygon(50% 0, 100% 38%, 82% 100%, 18% 100%, 0 38%); }
.crest-orc      { background: linear-gradient(150deg, #b8452c, #6d1f12 65%, #3a100a); clip-path: polygon(50% 0, 100% 100%, 50% 78%, 0 100%); }
.crest-nightelf { background: radial-gradient(circle at 62% 40%, #d7ecdc 0 22%, transparent 24%), linear-gradient(150deg, #3f6d54, #17281f 70%); clip-path: circle(50%); }

.chapter-book { padding-top: 10px; padding-bottom: 6px; }
.chapter-book h3 {
  font-size: 17px; color: var(--gold); letter-spacing: .05em;
  text-shadow: 0 -1px 1px rgba(0,0,0,.9);
}
.campaign-blurb { color: var(--text-dim); font-size: 13.5px; font-style: italic; margin: 5px 0 10px; }

.chapter-list { list-style: none; display: flex; flex-direction: column; gap: 7px; }
.chapter {
  width: 100%; text-align: left; cursor: pointer;
  display: grid; grid-template-columns: 118px 1fr; gap: 4px 14px; align-items: baseline;
  padding: 9px 13px; color: inherit; font-family: var(--serif);
  background: linear-gradient(180deg, rgba(255,236,170,.045), rgba(0,0,0,.18));
  border: 1px solid #05060a; box-shadow: inset 0 1px 0 rgba(255,236,170,.07);
  transition: filter .09s ease, box-shadow .12s ease;
}
.chapter b { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #8d96a4; font-family: Verdana, sans-serif; }
.chapter span { font-size: 15px; color: var(--gold); letter-spacing: .03em; }
.chapter:hover, .chapter:focus-visible { filter: brightness(1.3); box-shadow: inset 0 0 0 1px #8a6f2e, 0 0 14px rgba(240,182,82,.18); }
.chapter:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.chapter:active { filter: brightness(.92); }

.chapter-note { margin-top: 12px; font-family: Verdana, sans-serif; font-size: 10px; color: #5d6674; }

/* ============================== CUSTOM GAME ============================== */
.custom-layout {
  display: grid; grid-template-columns: 1.25fr .9fr; gap: 18px;
  padding-top: 16px; padding-bottom: 8px;
  min-height: 0;
}
.map-list-wrap {
  border: 1px solid #05060a; box-shadow: inset 0 0 0 1px #3a3018, inset 0 0 24px rgba(0,0,0,.5);
  background: #0c0f15; overflow-y: auto; max-height: 46vh;
  scrollbar-width: thin; scrollbar-color: #57451c #0c0f15;
}
.map-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.map-table th {
  position: sticky; top: 0; text-align: left;
  font-family: Verdana, sans-serif; font-size: 10px; letter-spacing: .12em; text-transform: uppercase;
  color: #8d96a4; padding: 8px 10px;
  background: linear-gradient(180deg, #232834, #171b23);
  border-bottom: 1px solid #57451c;
}
.map-table th.num, .map-table td.num { text-align: right; }
.map-table td { padding: 7px 10px; color: var(--gold); border-bottom: 1px solid rgba(87,69,28,.22); }
.map-row { cursor: pointer; transition: filter .07s ease, background .07s ease; }
.map-row:hover { filter: brightness(1.35); }
.map-row[aria-selected="true"] {
  background: linear-gradient(90deg, rgba(240,182,82,.16), rgba(240,182,82,.05));
  box-shadow: inset 2px 0 0 var(--gold-bright);
}
.map-row:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: -2px; }
.map-row td:first-child { font-style: italic; }

.map-preview { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
#minimap {
  width: 100%; aspect-ratio: 1; height: auto;
  image-rendering: pixelated;
  border: 1px solid #05060a; box-shadow: 0 0 0 1px #57451c, inset 0 0 18px rgba(0,0,0,.6);
  background: #0a0d12;
}
.map-meta { display: flex; flex-direction: column; gap: 3px; font-family: Verdana, sans-serif; }
.map-meta strong { color: var(--gold-bright); font-size: 13.5px; letter-spacing: .02em; }
.map-meta span { color: #8d96a4; font-size: 11px; }
.create-msg { min-height: 1.2em; font-size: 12px; color: #9fd49f; font-family: Verdana, sans-serif; }
.create-msg.err { color: #e2a089; }

/* ============================== BATTLE.NET ============================== */
.panel-bnet .bnet-body { padding-top: 16px; padding-bottom: 10px; display: flex; flex-direction: column; gap: 13px; }
.bnet-body .field { display: grid; grid-template-columns: 128px 1fr; align-items: center; gap: 12px; }
.bnet-body .field span { font-family: Verdana, sans-serif; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: #8d96a4; }
.bnet-body select, .bnet-body input[type="text"], .bnet-body input[type="password"] {
  font-family: Verdana, sans-serif; font-size: 13.5px; color: #e8ddba;
  background: #0b0e14; padding: 9px 10px;
  border: 1px solid #05060a; box-shadow: inset 0 0 0 1px #3a3018, inset 0 2px 6px rgba(0,0,0,.6);
}
.bnet-body select:focus-visible, .bnet-body input:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 1px; }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; font-family: Verdana, sans-serif; font-size: 11.5px; color: #97a0ad; }
.check input { accent-color: #b08429; width: 15px; height: 15px; }
.check input:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; }
.mute-row { font-size: 12.5px; color: var(--gold); }
.bnet-actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.bnet-status {
  min-height: 2.4em; padding: 8px 12px; font-family: Verdana, sans-serif; font-size: 12px;
  border: 1px solid rgba(87,69,28,.5); background: rgba(6,8,12,.55);
  color: #9aa3b1;
}
.bnet-status.err { color: #eda48d; border-color: #6e3a26; background: rgba(30,8,4,.35); }
.bnet-status.busy { color: #d8c793; }
.bnet-note { font-size: 10px; color: #5d6674; font-family: Verdana, sans-serif; }

/* ============================== OPTIONS ============================== */
.options-grid {
  display: grid; grid-template-columns: 1.15fr 1fr; gap: 18px;
  padding-top: 16px; padding-bottom: 8px;
}
.opt-group {
  border: 1px solid rgba(87,69,28,.55); padding: 14px 16px 16px;
  display: flex; flex-direction: column; gap: 13px;
  background: rgba(8,10,14,.35);
}
.opt-group legend {
  padding: 0 8px; font-size: 12px; letter-spacing: .16em; text-transform: uppercase;
  font-family: Verdana, sans-serif; color: var(--gold);
}
.slider-row { display: grid; grid-template-columns: 118px 1fr 34px; align-items: center; gap: 10px; }
.slider-row span { font-family: Verdana, sans-serif; font-size: 11px; color: #97a0ad; }
.slider-row output { font-family: Verdana, sans-serif; font-size: 11px; color: var(--gold-bright); text-align: right; }

input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; cursor: pointer; }
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  background: linear-gradient(180deg, #05070b, #171b24);
  box-shadow: inset 0 0 0 1px #3a3018, inset 0 2px 4px rgba(0,0,0,.7);
}
input[type="range"]::-moz-range-track {
  height: 8px;
  background: linear-gradient(180deg, #05070b, #171b24);
  box-shadow: inset 0 0 0 1px #3a3018, inset 0 2px 4px rgba(0,0,0,.7);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 22px; margin-top: -7px;
  background: linear-gradient(180deg, #3a4152, #1c212c 45%, #141821);
  border: 1px solid #05060a; box-shadow: 0 0 0 1px #8a6f2e, inset 0 1px 0 rgba(255,236,170,.25);
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 22px; border-radius: 0;
  background: linear-gradient(180deg, #3a4152, #1c212c 45%, #141821);
  border: 1px solid #05060a; box-shadow: 0 0 0 1px #8a6f2e, inset 0 1px 0 rgba(255,236,170,.25);
}
input[type="range"]:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 3px; }

.seg-row { display: flex; flex-direction: column; gap: 8px; }
.seg-row > span { font-family: Verdana, sans-serif; font-size: 11px; color: #97a0ad; }
.segmented { display: inline-flex; }
.segmented button {
  font-family: Verdana, sans-serif; font-size: 11px; padding: 7px 14px; cursor: pointer;
  color: var(--text-dim); background: linear-gradient(180deg, #191d26, #10131a);
  border: 1px solid #05060a; box-shadow: 0 0 0 1px #33301c;
}
.segmented button + button { margin-left: -1px; }
.segmented button[aria-pressed="true"] {
  color: var(--gold-bright); filter: brightness(1.2);
  box-shadow: 0 0 0 1px #8a6f2e, 0 0 12px rgba(240,182,82,.2);
  position: relative; z-index: 1;
}
.segmented button:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 2px; z-index: 2; }
.opt-note { font-size: 10px; color: #5d6674; font-family: Verdana, sans-serif; }

/* ============================== CREDITS ============================== */
.credits-screen {
  position: fixed; inset: 0; z-index: 50;
  display: flex; flex-direction: column;
  background:
    radial-gradient(90% 60% at 50% 108%, rgba(255,122,42,.08), transparent 60%),
    linear-gradient(180deg, #04050a, #010204 70%);
  animation: creditsFade .8s ease;
}
@keyframes creditsFade { from { opacity: 0; } to { opacity: 1; } }
.credits-head { background: linear-gradient(180deg, rgba(20,23,31,.9), rgba(10,12,17,.85)); }
.credits-viewport { flex: 1; overflow: hidden; position: relative; }
.credits-roll {
  position: absolute; left: 0; right: 0; top: 100%;
  text-align: center; will-change: transform;
}
.credits-roll .c-role {
  margin-top: 34px; font-family: Verdana, sans-serif; font-size: 11px;
  letter-spacing: .3em; text-transform: uppercase; color: #79839200;
  color: #798392;
}
.credits-roll .c-name { margin-top: 6px; font-size: 21px; color: var(--gold-bright); letter-spacing: .06em; text-shadow: 0 0 18px rgba(240,182,82,.25); }
.credits-roll .c-small { font-size: 13px; color: var(--gold); }
.credits-roll .c-title {
  font-size: 30px; letter-spacing: .18em; color: var(--gold);
  margin: 60px 0 8px; text-shadow: 0 2px 12px rgba(0,0,0,.9);
}
.credits-roll .c-body { max-width: 520px; margin: 10px auto 0; color: #97a0ad; font-size: 13.5px; line-height: 1.65; font-style: italic; }
.credits-foot { justify-content: center; background: linear-gradient(0deg, rgba(2,3,5,.9), transparent); }

/* ============================== EXIT FLOW ============================== */
#exitDialog {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: rgba(2,3,6,.55);
}
.exit-box {
  width: min(430px, 92vw);
  padding: 26px 28px 24px; text-align: center;
  border: 1px solid #000;
  background: var(--noise), linear-gradient(180deg, #20242f, #12151d);
  box-shadow: 0 0 0 2px #57451c, 0 0 0 3px #0a0803, 0 24px 70px rgba(0,0,0,.9);
  animation: panelDrop .28s cubic-bezier(.18,.9,.26,1.15);
}
.exit-box h2 { font-size: 24px; letter-spacing: .14em; color: var(--gold-bright); margin-bottom: 12px; }
.exit-box p { color: var(--gold); font-size: 16px; line-height: 1.5; }
.exit-sub { display: block; margin-top: 6px; font-size: 12.5px; font-style: italic; color: #8d96a4; }
.exit-actions { display: flex; gap: 14px; justify-content: center; margin-top: 22px; }

#blackout {
  position: fixed; inset: 0; z-index: 70;
  background: #010102;
  opacity: 0; pointer-events: none;
  transition: opacity 1.5s ease;
  display: grid; place-items: center;
}
#blackout.on { opacity: 1; pointer-events: auto; }
#returnBox { opacity: 0; transform: translateY(8px); transition: opacity 1s ease .9s, transform 1s ease .9s; text-align: center; padding: 20px; }
#blackout.settled #returnBox { opacity: 1; transform: none; }
.return-title { font-size: 30px; letter-spacing: .12em; color: #b98a4a; text-shadow: 0 0 26px rgba(255,122,42,.28); }
.return-sub { margin: 10px 0 26px; font-family: Verdana, sans-serif; font-size: 11.5px; letter-spacing: .14em; color: #67707e; text-transform: uppercase; }

/* ============================== ARRIVAL GATE ============================== */
#gate {
  position: fixed; inset: 0; z-index: 80;
  display: grid; place-items: center;
  background: radial-gradient(70% 60% at 50% 58%, #0a0c14, #030308 70%);
  transition: opacity .9s ease;
}
#gate.leaving { opacity: 0; pointer-events: none; }
.gate-inner { text-align: center; padding: 20px; }
.gate-rune { display: flex; gap: 7px; justify-content: center; margin-bottom: 26px; }
.gate-rune span {
  width: 7px; height: 34px; background: linear-gradient(180deg, #ffcf7a, var(--ember));
  box-shadow: 0 0 14px rgba(255,122,42,.55);
  animation: runePulse 2.2s ease-in-out infinite;
}
.gate-rune span:nth-child(2) { animation-delay: .35s; height: 42px; }
.gate-rune span:nth-child(3) { animation-delay: .7s; }
@keyframes runePulse { 0%, 100% { opacity: .35; transform: scaleY(.82); } 50% { opacity: 1; transform: scaleY(1); } }

.gate-title {
  font-family: var(--serif); font-weight: 700;
  font-size: clamp(40px, 7vw, 64px); letter-spacing: .06em;
  color: #ecc76f;
  text-shadow: 0 -1px 1px #000, 0 3px 18px rgba(240,180,80,.3);
}
.gate-title em { font-style: normal; color: #f4dfa4; }
.gate-sub { margin-top: 10px; font-family: Verdana, sans-serif; font-size: 11px; letter-spacing: .42em; color: #8d96a4; }

.gate-progress {
  width: min(320px, 70vw); height: 12px; margin: 34px auto 0;
  border: 1px solid #000; box-shadow: 0 0 0 1px #57451c, inset 0 2px 5px rgba(0,0,0,.8);
  background: #0a0c12; overflow: hidden;
}
.gate-bar {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, #8a5a19, #e0a33c 60%, #ffd98a);
  box-shadow: 0 0 12px rgba(240,180,80,.5);
  transition: width .18s ease;
}
.gate-prompt {
  margin-top: 30px; font-size: 19px; letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold-bright);
  animation: promptPulse 1.7s ease-in-out infinite;
}
@keyframes promptPulse { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }
.gate-note { margin-top: 16px; font-family: Verdana, sans-serif; font-size: 10.5px; color: #67707e; letter-spacing: .06em; }

/* ============================== RESPONSIVE ============================== */
@media (max-width: 980px) {
  .custom-layout, .options-grid { grid-template-columns: 1fr; }
  .map-list-wrap { max-height: 34vh; }
}

@media (max-width: 760px) {
  body { overflow: hidden; }
  #logoBlock {
    left: 50%; transform: translateX(-50%);
    top: max(10px, env(safe-area-inset-top));
    width: min(78vw, 330px);
  }
  body.entered #logoBlock { transform: translateX(-50%); }
  #menuStack {
    left: 50%; right: auto; transform: translateX(-50%);
    top: auto; bottom: calc(max(30px, env(safe-area-inset-bottom)) + 34px);
    width: min(86vw, 340px); gap: 9px;
  }
  body.entered .menu-btn { transform: none; }
  .menu-btn { height: 50px; font-size: 17px; }
  #versionTag { left: 12px; bottom: calc(max(8px, env(safe-area-inset-bottom)) + 52px); }
  #legalLine { font-size: 8.5px; padding: 5px 10px 6px; }
  .panel { width: 96vw; max-height: 78vh; }
  .chapter { grid-template-columns: 96px 1fr; }
  .bnet-body .field { grid-template-columns: 1fr; gap: 5px; }
  .slider-row { grid-template-columns: 96px 1fr 30px; }
}

/* short landscape phones */
@media (max-height: 480px) and (orientation: landscape) {
  #menuStack { top: 50%; bottom: auto; transform: translateY(-50%); width: 300px; }
  .menu-btn { height: 42px; }
  #logoBlock { width: 200px; }
}

/* ============================== REDUCED MOTION ============================== */
@media (prefers-reduced-motion: reduce) {
  #sheenRect, .gate-rune span, .gate-prompt { animation: none !important; }
  .menu-btn, #logoBlock, #versionTag, #legalLine { transition-duration: .01s !important; }
  .panel, .exit-box, .credits-screen { animation: none !important; }
}
