/* ==========================================================================
   B.A.T — portal
   Chill, minimal, airy. Anthracite, powdered rose, lots of space.
   Colour jobs: --acc = interface · --ok = active/ours · --amber = Romans ·
   --red = hostile / destructive. Nothing else gets a colour.
   ========================================================================== */

:root {
  --bg:        #16171a;
  --bg-2:      #1b1c20;
  --surface:   rgba(255,255,255,.028);
  --surface-2: rgba(255,255,255,.05);
  --line:      rgba(255,255,255,.07);
  --line-2:    rgba(255,255,255,.12);

  --txt:   #ebe8e4;
  --txt-2: #a9a7a6;
  --txt-3: #6f6e70;
  --txt-4: #4a4a4e;

  --acc:      #e3a6b8;
  --acc-2:    #c98aa0;
  --acc-soft: rgba(227,166,184,.12);
  --acc-line: rgba(227,166,184,.28);

  --ok:    #9cc5a8;
  --amber: #d8b98f;
  --red:   #dc9a9a;

  --serif: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --sans:  "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono:  "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --r:    16px;
  --r-sm: 10px;
  --col:  680px;
  --ease: cubic-bezier(.22,.61,.36,1);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--txt);
  font: 400 16px/1.65 var(--sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input { font: inherit; color: inherit; }
::selection { background: var(--acc-soft); color: var(--txt); }
:focus-visible { outline: 1.5px solid var(--acc); outline-offset: 3px; border-radius: 6px; }

.emblem { width: 20px; height: 20px; color: var(--acc); flex: none; }
.emblem--lg { width: 44px; height: 44px; }

/* ── Backdrop ─────────────────────────────────────────────────────────── */
.backdrop { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
#sphere { position: absolute; inset: 0; width: 100%; height: 100%; }
.code-rain {
  position: absolute; inset: 0;
  display: flex; justify-content: center;
  opacity: .085;
  transition: opacity 2.4s var(--ease);
  -webkit-mask-image: radial-gradient(ellipse 60% 70% at 50% 50%, #000 20%, transparent 78%);
          mask-image: radial-gradient(ellipse 60% 70% at 50% 50%, #000 20%, transparent 78%);
}
.code-rain pre {
  margin: 0;
  font: 400 12.5px/2.1 var(--mono);
  color: var(--txt);
  white-space: pre;
  filter: blur(.35px);
  animation: rain 160s linear infinite;
}
@keyframes rain { from { transform: translateY(0); } to { transform: translateY(-50%); } }
body[data-stage="app"] .code-rain { opacity: .04; }
.grain {
  position: absolute; inset: -50%;
  opacity: .035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* ── Stages ───────────────────────────────────────────────────────────── */
.stage {
  position: fixed; inset: 0; z-index: 2;
  display: grid; place-items: center;
  padding: 24px 16px;
  opacity: 0; visibility: hidden;
  transition: opacity .9s var(--ease), visibility 0s linear .9s;
}
body[data-stage="terminal"] .stage--terminal,
body[data-stage="login"]    .stage--login {
  opacity: 1; visibility: visible;
  transition: opacity .9s var(--ease) .15s, visibility 0s;
}
.stage--app {
  position: relative; display: block; place-items: normal; min-height: 100vh;
  padding: 0 16px 160px;
}
body[data-stage="app"] .stage--app {
  opacity: 1; visibility: visible;
  transition: opacity 1s var(--ease) .2s, visibility 0s;
}
body:not([data-stage="app"]) .stage--app { position: fixed; pointer-events: none; }

/* ── Terminal ─────────────────────────────────────────────────────────── */
.term {
  width: min(720px, 100%);
  background: rgba(20,21,24,.62);
  -webkit-backdrop-filter: blur(18px) saturate(1.1);
          backdrop-filter: blur(18px) saturate(1.1);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 30px 80px -30px rgba(0,0,0,.6);
  overflow: hidden;
  transform: translateY(8px) scale(.99);
  transition: transform 1s var(--ease);
}
body[data-stage="terminal"] .term { transform: none; }
.term__bar {
  display: flex; align-items: center; gap: 7px;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
}
.term__bar span { width: 10px; height: 10px; border-radius: 50%; background: var(--txt-4); opacity: .55; }
.term__bar em { margin-left: auto; margin-right: auto; transform: translateX(-20px); font: 400 11.5px var(--mono); color: var(--txt-3); font-style: normal; }
.term__body {
  padding: 18px 20px 22px;
  font: 400 13px/1.75 var(--mono);
  color: var(--txt-2);
  min-height: 360px;
  max-height: min(78vh, 640px);
  overflow-y: auto;
  scrollbar-width: none;
}
.term__body::-webkit-scrollbar { display: none; }
.tl { white-space: pre-wrap; word-break: break-word; min-height: 1.75em; animation: tl-in .35s var(--ease) both; }
@keyframes tl-in { from { opacity: 0; transform: translateY(2px); } }
.tl .ok   { color: var(--ok); }
.tl .dim  { color: var(--txt-3); }
.tl .acc  { color: var(--acc); }
.tl .err  { color: var(--red); }
.tl .t    { color: var(--txt-4); }
.ascii { margin: 18px 0 10px; }
.ascii svg { display: block; width: min(100%, 340px); height: auto; overflow: visible; }
.ascii path { animation: tl-in .5s var(--ease) both; }
.ascii__blk { fill: var(--acc); }
.ascii__ln { fill: none; stroke: var(--acc-2); stroke-width: 1.1; opacity: .75; }
.term__motto { color: var(--txt-3); margin-bottom: 14px; }

.term__prompt { display: flex; gap: 10px; align-items: baseline; margin-top: 6px; }
.term__ps { color: var(--txt); white-space: nowrap; }
.term__ps b { color: var(--acc); font-weight: 400; }
.term__field { position: relative; flex: 1; min-width: 0; }
.term__field input {
  position: absolute; inset: 0; width: 100%;
  opacity: 0; border: 0; background: none; caret-color: transparent;
  font: inherit;
}
.term__mirror { color: var(--txt); white-space: pre; }
.caret {
  display: inline-block; width: .6em; height: 1.1em;
  margin-left: 1px; vertical-align: -.2em;
  background: var(--acc); border-radius: 1.5px;
  animation: blink 1.1s steps(1) infinite;
}
.term__prompt.is-busy .caret { animation: none; opacity: .3; }
@keyframes blink { 50% { opacity: 0; } }

/* ── Login ────────────────────────────────────────────────────────────── */
.login { width: min(340px, 100%); text-align: center; }
.login .emblem--lg { opacity: .9; }
.login__title {
  margin: 14px 0 0;
  font: 400 54px/1 var(--serif);
  letter-spacing: .01em;
}
.login__sub { margin: 10px 0 40px; color: var(--txt-3); font-size: 14.5px; }
.login__form { display: grid; gap: 22px; text-align: left; }
.fld { display: grid; gap: 6px; }
.fld__lab { font: 400 11.5px var(--mono); color: var(--txt-3); letter-spacing: .04em; }
.fld__in {
  width: 100%;
  padding: 8px 0 10px;
  border: 0; border-bottom: 1px solid var(--line-2);
  background: none; outline: none;
  font-size: 16px;
  transition: border-color .3s var(--ease);
}
.fld__in:focus { border-bottom-color: var(--acc); }
.login__msg { margin: -6px 0 0; min-height: 1.4em; font-size: 13.5px; color: var(--txt-2); }
.login__msg.is-err { color: var(--red); }

/* Every button shares the "Enter as a visitor" look: a rose pill that
   brightens and lifts on hover, with an arrow that nudges forward. Buttons
   whose markup carries no arrow get one drawn by ::after. */
.btn, .linkbtn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 46px; padding: 0 22px;
  border: 0; border-radius: 999px;
  background: var(--acc); color: #221a1d;
  font-size: 15px; font-weight: 600;
  box-shadow: 0 12px 40px -14px rgba(227,166,184,.55);
  transition: background .3s var(--ease), transform .3s var(--ease), box-shadow .3s var(--ease);
}
.btn:hover:not(:disabled), .linkbtn:hover { background: #ebb6c6; transform: translateY(-1px); box-shadow: 0 16px 44px -14px rgba(227,166,184,.7); }
.btn svg, .linkbtn svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform .3s var(--ease); }
.btn:not(:has(svg))::after, .linkbtn:not(:has(svg))::after {
  content: ""; width: 17px; height: 17px; flex: none;
  background: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h14M13 6l6 6-6 6'/%3E%3C/svg%3E") center / contain no-repeat;
  transition: transform .3s var(--ease);
}
.btn:hover:not(:disabled) svg, .linkbtn:hover svg,
.btn:hover:not(:disabled)::after, .linkbtn:hover::after { transform: translateX(3px); }
.btn--visitor { width: 100%; height: 54px; }

.login__or {
  display: flex; align-items: center; gap: 14px;
  margin: 30px 0;
  color: var(--txt-4); font: 400 11.5px var(--mono);
}
.login__or::before, .login__or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login__hint { margin: 12px 0 0; color: var(--txt-3); font-size: 13px; }

/* ── Corner buttons (terminal + login) ────────────────────────────────── */
.corner-btn {
  position: fixed; top: 16px; right: 16px; z-index: 5;
  height: 36px; min-width: 36px; padding: 0 10px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: 999px;
  color: var(--txt-3);
  border: 1px solid transparent;
  font: 400 12px var(--mono);
  opacity: 0; visibility: hidden;
  transition: opacity .6s var(--ease), color .25s, border-color .25s;
}
.corner-btn--lang { right: 60px; }
.corner-btn:hover { color: var(--txt); border-color: var(--line-2); }
.corner-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
body[data-stage="terminal"] .corner-btn,
body[data-stage="login"] .corner-btn { opacity: 1; visibility: visible; }

/* ── App ──────────────────────────────────────────────────────────────── */
.topbar {
  max-width: var(--col); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 26px 0 0;
}
.topbar__brand { display: inline-flex; align-items: center; gap: 10px; font: 500 13px var(--mono); letter-spacing: .08em; color: var(--txt-2); }
.topbar__acts { display: flex; align-items: center; gap: 6px; }
.topbar__btn {
  height: 30px; min-width: 30px; padding: 0 8px;
  display: inline-grid; place-items: center;
  border-radius: 999px;
  color: var(--txt-3); font: 500 11.5px var(--mono); letter-spacing: .04em;
  transition: color .2s, background .2s;
}
.topbar__btn:hover { color: var(--txt); background: var(--surface-2); }
.topbar__btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 11px 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font: 400 11.5px var(--mono); color: var(--txt-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--txt-3); }
.badge.is-member::before { background: var(--ok); }

.view { max-width: var(--col); margin: 0 auto; }
.view > * { animation: rise .7s var(--ease) both; }
.view > *:nth-child(2) { animation-delay: .08s; }
.view > *:nth-child(3) { animation-delay: .16s; }
.view > *:nth-child(4) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

.eyebrow { display: block; font: 400 12px var(--mono); color: var(--txt-3); letter-spacing: .04em; }
.eyebrow b { color: var(--acc); font-weight: 400; }

.hero { padding: clamp(72px, 14vh, 140px) 0 72px; }
.hero h1 {
  margin: 18px 0 0;
  font: 400 clamp(52px, 11vw, 92px)/.95 var(--serif);
  letter-spacing: -.01em;
}
.hero h1 em { color: var(--acc); }
.hero p { margin: 26px 0 0; max-width: 30em; color: var(--txt-2); font-size: 18px; line-height: 1.6; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 34px; }

.sec { padding: 56px 0; border-top: 1px solid var(--line); }
.sec h2 { margin: 12px 0 0; font: 400 clamp(34px, 6vw, 44px)/1.05 var(--serif); }
.sec h2 em { color: var(--acc); }
.sec > p { margin: 16px 0 0; color: var(--txt-2); max-width: 34em; }

/* recruitment */
.steps { list-style: none; margin: 34px 0 0; padding: 0; display: grid; gap: 10px; counter-reset: s; }
.steps li {
  display: grid; grid-template-columns: 34px 1fr; gap: 14px;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color .3s var(--ease), background .3s var(--ease);
}
.steps li:hover { border-color: var(--line-2); background: var(--surface-2); }
.steps li::before {
  counter-increment: s; content: "0" counter(s);
  font: 400 12px/1.9 var(--mono); color: var(--acc);
}
.steps b { display: block; font-weight: 500; }
.steps span { display: block; margin-top: 3px; color: var(--txt-2); font-size: 15px; }

.reqs { list-style: none; margin: 28px 0 0; padding: 0; }
.reqs li { position: relative; padding: 11px 0 11px 26px; border-bottom: 1px solid var(--line); color: var(--txt-2); font-size: 15px; }
.reqs li:last-child { border-bottom: 0; }
.reqs li::before { content: ""; position: absolute; left: 4px; top: 21px; width: 7px; height: 7px; border-radius: 50%; border: 1.3px solid var(--acc); }

.kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin: 28px 0 0; }
.kv--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.kv > div { padding: 14px 18px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.kv dt { font: 400 11.5px var(--mono); color: var(--txt-3); }
.kv dd { margin: 4px 0 0; font-weight: 500; overflow-wrap: break-word; }
.kv dd.is-ok { color: var(--ok); }
.kv dd.is-amber { color: var(--amber); }
.kv dd.is-acc { color: var(--acc); }
.kv dd.is-red { color: var(--red); }

/* team preview */
.cmd {
  display: flex; align-items: center; gap: 22px;
  margin-top: 30px; padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
/* Minecraft head, with the initial as a placeholder until (unless) it loads. */
.face {
  position: relative; flex: none;
  width: 40px; height: 40px;
  border-radius: 10px;
  background: var(--surface-2);
  display: grid; place-items: center; overflow: hidden;
}
.face img { position: absolute; inset: 14%; width: 72%; height: 72%; image-rendering: pixelated; opacity: 0; transition: opacity .4s; }
.face.is-loaded img { opacity: 1; }
.face.is-loaded .face__ph { opacity: 0; }
.face__ph { font: 400 15px var(--serif); color: var(--txt-3); }
.face--lg { width: 76px; height: 76px; border-radius: 14px; }
.face--lg .face__ph { font-size: 28px; }
.face--xl { width: 92px; height: 92px; border-radius: 16px; }
.face--xl .face__ph { font-size: 34px; }
.cmd__name { font: 400 28px/1.1 var(--serif); }
.cmd__role { margin-top: 4px; font: 400 12px var(--mono); color: var(--acc); letter-spacing: .04em; }
.cmd__line { margin-top: 8px; color: var(--txt-2); font-size: 14.5px; }

.ladder { list-style: none; margin: 18px 0 0; padding: 0; }
.ladder li {
  display: grid; grid-template-columns: 34px 150px 1fr; gap: 12px; align-items: baseline;
  padding: 13px 4px;
  border-bottom: 1px solid var(--line);
}
.ladder li:last-child { border-bottom: 0; }
.ladder .n { font: 400 12px var(--mono); color: var(--txt-4); }
.ladder .t { font-weight: 500; }
.ladder .d { color: var(--txt-2); font-size: 14.5px; }
.ladder .is-branch .n { color: var(--acc-2); }
.locked-note {
  display: flex; align-items: center; gap: 10px;
  margin-top: 20px; padding: 14px 18px;
  border: 1px dashed var(--line-2); border-radius: var(--r-sm);
  color: var(--txt-3); font-size: 14px;
}
.locked-note svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; }

.foot { padding: 40px 0 0; border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; font: 400 12px var(--mono); color: var(--txt-4); }

/* empty tabs */
.empty { padding: clamp(110px, 24vh, 220px) 0 40px; text-align: center; }
.empty h1 { margin: 16px 0 0; font: 400 clamp(44px, 9vw, 64px)/1 var(--serif); }
.empty p { margin: 16px auto 0; max-width: 26em; color: var(--txt-3); }

/* ── Dock ─────────────────────────────────────────────────────────────── */
.dock {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 10;
  display: flex; align-items: center; gap: 2px;
  padding: 6px;
  background: rgba(30,31,35,.72);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
          backdrop-filter: blur(16px) saturate(1.2);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: 0 20px 50px -20px rgba(0,0,0,.7);
  transform: translate(-50%, 30px);
  opacity: 0; visibility: hidden;
  transition: transform .8s var(--ease), opacity .8s var(--ease), visibility 0s linear .8s;
}
body[data-stage="app"] .dock {
  transform: translate(-50%, 0); opacity: 1; visibility: visible;
  transition: transform .8s var(--ease) .5s, opacity .8s var(--ease) .5s, visibility 0s;
}
.dock__sep { width: 1px; height: 24px; margin: 0 5px; background: var(--line-2); }
.dock__it {
  position: relative;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border-radius: 13px;
  color: var(--txt-2);
  transition: transform .28s var(--ease), color .2s, background .2s;
}
.dock__it svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.dock__it:hover { transform: translateY(-3px) scale(1.1); color: var(--txt); background: var(--surface-2); }
.dock__it[aria-current="page"] { color: var(--acc); }
.dock__it[aria-current="page"]::after {
  content: ""; position: absolute; bottom: 3px; left: 50%;
  width: 4px; height: 4px; margin-left: -2px; border-radius: 50%; background: var(--acc);
}
.dock__it.is-locked { color: var(--txt-4); }
.dock__it.is-locked:hover { color: var(--txt-3); transform: none; background: none; }
.dock__lock {
  position: absolute; right: 4px; top: 4px;
  width: 15px; height: 15px;
  display: grid; place-items: center;
  border-radius: 50%; background: #2a2b30; color: var(--txt-2);
}
.dock__lock svg { width: 9px; height: 9px; stroke-width: 2.2; }
.dock__it--lang { font: 500 11.5px var(--mono); letter-spacing: .04em; }
.dock__tip {
  position: absolute; bottom: calc(100% + 12px); left: 50%;
  padding: 5px 10px;
  border-radius: 8px;
  background: #26272c; border: 1px solid var(--line);
  font: 400 12px var(--sans); color: var(--txt); white-space: nowrap;
  opacity: 0; transform: translate(-50%, 4px);
  pointer-events: none;
  transition: opacity .2s, transform .2s var(--ease);
}
.dock__it:hover .dock__tip, .dock__it:focus-visible .dock__tip { opacity: 1; transform: translate(-50%, 0); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 128px; z-index: 11;
  padding: 10px 16px;
  border-radius: 12px;
  background: #26272c; border: 1px solid var(--line-2);
  font-size: 14px; color: var(--txt);
  transform: translate(-50%, 8px); opacity: 0;
  transition: opacity .3s, transform .3s var(--ease);
  pointer-events: none;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }

.noscript { position: fixed; inset: 0; display: grid; place-items: center; color: var(--txt-2); }

/* ── Shared bits ──────────────────────────────────────────────────────── */
.mono { font-family: var(--mono); font-size: 12.5px; }
.void { font: 400 12.5px var(--mono); color: var(--txt-3); border-bottom: 1px dotted var(--txt-4); }
.note { margin: 16px 0 0; color: var(--txt-3); font-size: 14px; max-width: 40em; }
.h2 { margin: 48px 0 0; font: 400 32px/1.1 var(--serif); }
.sec__sub { margin-top: 36px; }
.linkbtn { margin-top: 26px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 999px;
  font: 400 11.5px var(--mono); white-space: nowrap;
  border: 1px solid currentColor;
}
.chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.chip--ok    { color: var(--ok); border-color: rgba(156,197,168,.3); }
.chip--amber { color: var(--amber); border-color: rgba(216,185,143,.3); }
.chip--acc   { color: var(--acc); border-color: var(--acc-line); }
.chip--red   { color: var(--red); border-color: rgba(220,154,154,.3); }
.chip--dim   { color: var(--txt-3); border-color: var(--line-2); }
.lvl { font: 400 11.5px var(--mono); color: var(--txt-3); white-space: nowrap; }

.btn--sm { height: 36px; padding: 0 16px; font-size: 13.5px; gap: 8px; }
.btn--sm::after, .btn--sm svg { width: 15px; height: 15px; }
.btn--danger { background: var(--red); color: #2a1718; box-shadow: 0 12px 40px -14px rgba(220,154,154,.5); }
.btn--danger:hover:not(:disabled) { background: #e6b0b0; box-shadow: 0 16px 44px -14px rgba(220,154,154,.65); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }

.liaison {
  max-width: var(--col); margin: 14px auto 0; padding: 10px 16px;
  border-radius: var(--r-sm); border: 1px solid rgba(216,185,143,.25);
  color: var(--txt-2); font-size: 14px;
}
.liaison b { color: var(--amber); font-weight: 500; margin-right: 6px; }

/* page head (every tab but home) */
.phead { padding: clamp(64px, 12vh, 120px) 0 8px; }
.phead h1 { margin: 12px 0 0; font: 400 clamp(46px, 9vw, 72px)/1 var(--serif); }
.phead h1 em { color: var(--acc); }
.phead p { margin: 18px 0 0; color: var(--txt-2); font-size: 17px; max-width: 34em; }

/* sub-tabs */
.subtabs {
  display: flex; gap: 4px; flex-wrap: wrap;
  margin: 36px 0 0; padding: 4px;
  width: fit-content; max-width: 100%;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface);
}
.subtab {
  display: inline-flex; align-items: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 10px;
  font-size: 14px; color: var(--txt-2);
  transition: background .2s, color .2s;
}
.subtab:hover { color: var(--txt); }
.subtab[aria-selected="true"] { background: var(--surface-2); color: var(--txt); box-shadow: inset 0 0 0 1px var(--line); }
.subtab.is-locked { color: var(--txt-4); }
.subtab svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.subview { padding-top: 8px; animation: rise .5s var(--ease) both; }

/* hierarchy */
.ranks { list-style: none; margin: 24px 0 0; padding: 0; }
.rank { border-bottom: 1px solid var(--line); }
.rank:last-child { border-bottom: 0; }
.rank.is-branch { margin-top: 18px; border-top: 1px dashed var(--line-2); }
.rank__row {
  display: grid; grid-template-columns: 34px 170px 1fr 18px; gap: 12px; align-items: baseline;
  padding: 16px 4px; list-style: none; cursor: default;
}
details > .rank__row { cursor: pointer; }
.rank__row::-webkit-details-marker { display: none; }
.rank__row .n { font: 400 12px var(--mono); color: var(--txt-4); }
.rank__row .t { font-weight: 500; }
.rank__row .d { color: var(--txt-2); font-size: 14.5px; }
.rank__row svg { width: 16px; height: 16px; fill: none; stroke: var(--txt-3); stroke-width: 1.6; align-self: center; transition: transform .3s var(--ease); }
details[open] > .rank__row svg { transform: rotate(90deg); }
details > .rank__row:hover .t { color: var(--acc); }
.rank__branch { font: italic 400 15px var(--serif); color: var(--acc-2); margin-left: 4px; }
.rank__body { padding: 4px 4px 28px 50px; animation: rise .4s var(--ease) both; }
.rank__body > p { margin: 10px 0 0; color: var(--txt-2); }
.rank__body .kv { margin-top: 20px; }

/* org chart */
.org { display: grid; grid-template-columns: 1fr 240px; gap: 20px; margin-top: 30px; align-items: start; }
.org__main { display: grid; gap: 0; }
.org__tier { position: relative; padding: 0 0 26px 22px; }
.org__tier::before { content: ""; position: absolute; left: 4px; top: 10px; bottom: 0; width: 1px; background: var(--line-2); }
.org__tier:last-child::before { display: none; }
.org__tier::after { content: ""; position: absolute; left: 0; top: 6px; width: 9px; height: 9px; border-radius: 50%; border: 1.3px solid var(--acc); background: var(--bg); }
.org__rank { font: 400 22px/1.2 var(--serif); }
.org__rank .n { font: 400 11.5px var(--mono); color: var(--txt-4); margin-right: 10px; vertical-align: 3px; }
.org__people { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.org__side { position: relative; padding-top: 2px; }
.org__tier--branch { padding-left: 22px; border-left: 1px dashed var(--line-2); padding-bottom: 6px; }
.org__tier--branch::before { display: none; }
.org__tier--branch::after { left: -5px; border-style: dashed; }
.person {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 14px 6px 6px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--surface);
  text-align: left; max-width: 100%;
  transition: border-color .2s, background .2s, transform .25s var(--ease);
}
.person:hover { border-color: var(--line-2); background: var(--surface-2); transform: translateY(-1px); }
.person__txt { display: grid; min-width: 0; }
.person__name { font-size: 14.5px; font-weight: 500; overflow-wrap: anywhere; }
.person__role { font-size: 12.5px; color: var(--txt-3); }
.ally {
  display: flex; gap: 18px; align-items: flex-start;
  margin-top: 14px; padding: 20px;
  border-radius: var(--r); border: 1px solid var(--line); background: var(--surface);
}
.ally__name { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; font: 400 26px/1.1 var(--serif); }
.ally p { margin: 10px 0 0; color: var(--txt-2); font-size: 14.5px; }

/* rules */
.rules { margin-top: 30px; }
.rules__head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; justify-content: space-between; }
.rules h2 { margin: 0; font: 400 32px/1.1 var(--serif); }
.rules__h2 { margin-top: 48px !important; }
.rulelist { list-style: none; margin: 18px 0 0; padding: 0; }
.rulelist li { display: grid; grid-template-columns: 110px 1fr; gap: 14px; padding: 16px 4px; border-bottom: 1px solid var(--line); }
.rulelist li:last-child { border-bottom: 0; }
.rulelist .n { font: 400 12.5px/1.9 var(--mono); color: var(--acc); }
.rule { color: var(--txt-2); }
.rule b, .rule em { color: var(--txt); font-weight: 500; }
.rule em { font-style: normal; color: var(--acc); }

/* missions & operations */
.missions { display: grid; gap: 12px; margin-top: 20px; }
.mission { padding: 22px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.mission__top { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.mission__name { margin-top: 6px; font: 400 24px/1.15 var(--serif); }
.mission .kv { margin-top: 18px; }
.mission > p { margin: 16px 0 0; color: var(--txt-2); font-size: 14.5px; }
.tbl-wrap { margin-top: 20px; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.tbl th { text-align: left; padding: 12px 16px; font: 400 11.5px var(--mono); color: var(--txt-3); border-bottom: 1px solid var(--line); }
.tbl td { padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--txt-2); vertical-align: top; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl b { color: var(--txt); font-weight: 500; }

/* relations */
.relations { display: grid; gap: 12px; margin-top: 24px; }
.relation {
  padding: 22px 22px 22px 24px;
  border-radius: var(--r); border: 1px solid var(--line); background: var(--surface);
  box-shadow: inset 3px 0 0 var(--txt-4);
}
.relation--amber { box-shadow: inset 3px 0 0 var(--amber); }
.relation--rose  { box-shadow: inset 3px 0 0 var(--acc); }
.relation--grn   { box-shadow: inset 3px 0 0 var(--ok); }
.relation--red   { box-shadow: inset 3px 0 0 var(--red); }
.relation__top { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; }
.relation__name { font: 400 28px/1.1 var(--serif); }
.relation__stance { margin-top: 6px; font: 400 12px var(--mono); color: var(--txt-3); }
.relation p { margin: 14px 0 0; color: var(--txt-2); font-size: 15px; }

/* history */
.eras { display: flex; gap: 8px; margin-top: 28px; }
.era { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line-2); color: var(--txt-2); font: 400 13px var(--mono); }
.era.is-on { color: var(--acc); border-color: var(--acc-line); background: var(--acc-soft); }
.chapter { margin-top: 30px; padding: 26px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.chapter__head { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; }
.chapter h2 { margin: 0; font: 400 44px/1 var(--serif); }
.chapter p { margin: 14px 0 0; color: var(--txt-2); }
.timeline { list-style: none; margin: 30px 0 0; padding: 0 0 0 24px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 1px; background: linear-gradient(var(--line-2), var(--line) 90%, transparent); }
.timeline li { position: relative; padding: 0 0 30px; }
.timeline li::before { content: ""; position: absolute; left: -24px; top: 7px; width: 9px; height: 9px; border-radius: 50%; border: 1.3px solid var(--acc); background: var(--bg); }
.timeline li:last-child::before { background: var(--acc); }
.timeline__date { font: 400 12px var(--mono); color: var(--txt-3); }
.timeline__date .void { font-size: 12px; }
.timeline h3 { margin: 6px 0 0; font: 400 25px/1.15 var(--serif); }
.timeline p { margin: 6px 0 0; color: var(--txt-2); font-size: 15px; }

/* map */
.map { margin-top: 24px; }
.map__view {
  position: relative; overflow: hidden;
  aspect-ratio: 4 / 3; max-height: 70vh;
  border-radius: var(--r); border: 1px solid var(--line); background: #1a1c1f;
  touch-action: none; cursor: grab;
}
.map__view.is-drag { cursor: grabbing; }
.map__stage { position: absolute; inset: 0; transform-origin: 0 0; }
.map__terrain { position: absolute; inset: 0; width: 100%; height: 100%; }
.route { fill: none; stroke: rgba(227,166,184,.22); stroke-dasharray: 5 9; }
.route--live { animation: route 40s linear infinite; }
@keyframes route { to { stroke-dashoffset: -280; } }
.map__zoom { position: absolute; right: 12px; top: 12px; display: grid; gap: 6px; z-index: 2; }
.zbtn {
  width: 34px; height: 34px; border-radius: 10px;
  background: rgba(30,31,35,.8); border: 1px solid var(--line-2);
  color: var(--txt-2); font: 400 16px var(--mono);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.zbtn:hover { color: var(--txt); }
.map__hint { position: absolute; left: 12px; bottom: 10px; font: 400 11px var(--mono); color: var(--txt-3); pointer-events: none; }
.map__disc { margin: 10px 0 0; font: 400 11.5px var(--mono); color: var(--txt-4); }
.map__side { display: grid; grid-template-columns: 1fr 200px; gap: 12px; margin-top: 16px; }
.map__info, .map__legend { padding: 20px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.map__info .note { margin: 0; }
.map__infotop { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.map__infotop b { font: 400 24px/1.15 var(--serif); }
.map__info p { margin: 10px 0 0; color: var(--txt-2); font-size: 14.5px; }
.map__info .kv { margin-top: 16px; }
.map__legend ul { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 9px; font-size: 13.5px; color: var(--txt-2); }
.map__legend li { display: flex; align-items: center; gap: 10px; }
.mk-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--txt-3); }
.mk-dot--member { background: var(--ok); }
.mk-dot--ally { background: var(--amber); }
.mk-dot--classified { background: var(--acc); }
.mk-dot--hostile { background: var(--red); }
.mk-dot--territory { background: none; border: 1.3px dashed var(--txt-3); }
.mk {
  position: absolute; width: 0; height: 0;
  --c: var(--txt-3);
  transform: scale(calc(1 / var(--z, 1)));
}
.mk--member { --c: var(--ok); }
.mk--ally { --c: var(--amber); }
.mk--classified { --c: var(--acc); }
.mk--hostile { --c: var(--red); }
.mk__pin { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 4px rgba(0,0,0,.25); }
.mk--pending .mk__pin { background: none; border: 1.3px dashed var(--txt-2); }
.mk__ring { position: absolute; left: -13px; top: -13px; width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--c); opacity: 0; transition: opacity .25s; }
.mk--hq .mk__ring, .mk.is-sel .mk__ring { opacity: .7; }
.mk__lab {
  position: absolute; left: 14px; top: -9px; white-space: nowrap;
  font: 400 11.5px var(--mono); color: var(--txt);
  padding: 2px 7px; border-radius: 6px; background: rgba(22,23,26,.75);
}
.mk--flip .mk__lab { left: auto; right: 14px; }
.mk:hover .mk__lab, .mk.is-sel .mk__lab { color: var(--c); }

/* join */
.contacts { display: grid; gap: 10px; margin-top: 20px; }
.contact { display: flex; align-items: center; gap: 18px; padding: 16px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); }
.contact__name { font: 400 28px/1.1 var(--serif); }
.channels { list-style: none; margin: 20px 0 0; padding: 0; }
.channels li { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; padding: 14px 4px; border-bottom: 1px solid var(--line); }
.channels li:last-child { border-bottom: 0; }
.channels b { display: block; font-weight: 500; }
.channels span { display: block; color: var(--txt-3); font-size: 14px; }
.channels li > div:last-child { display: flex; align-items: center; gap: 10px; }

/* panels (HQ, dev, archive) */
.panels { display: grid; gap: 14px; margin-top: 30px; }
.panel { padding: 24px; border-radius: var(--r); border: 1px solid var(--line); background: var(--surface); margin-top: 14px; }
.panels .panel { margin-top: 0; }
.panel__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.panel__title { font: 400 26px/1.1 var(--serif); }
.panel__note { margin: 16px 0 0; color: var(--txt-2); font-size: 14.5px; }
.panel .kv { margin-top: 18px; }
.node { margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--line); }
.node__top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.node__name { margin-top: 4px; font: 400 21px var(--serif); }
.danger {
  display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap;
  margin-top: 22px; padding: 18px 20px;
  border-radius: var(--r-sm); border: 1px solid rgba(220,154,154,.25); background: rgba(220,154,154,.05);
}
.danger > div { flex: 1 1 280px; }
.danger b { color: var(--red); font-weight: 500; }
.danger p { margin: 6px 0 0; color: var(--txt-2); font-size: 14px; }

/* overlay */
.ov {
  position: fixed; inset: 0; z-index: 20;
  display: grid; place-items: center; padding: 16px;
  background: rgba(10,10,12,.6);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .3s var(--ease);
}
.ov[hidden] { display: none; }
.ov.is-open { opacity: 1; }
.ov__panel {
  position: relative; width: min(600px, 100%); max-height: calc(100vh - 32px); overflow-y: auto;
  padding: clamp(24px, 4vw, 34px);
  border-radius: 20px; border: 1px solid var(--line-2); background: #1c1d21;
  box-shadow: 0 40px 100px -30px rgba(0,0,0,.8);
  transform: translateY(10px); transition: transform .35s var(--ease);
}
.ov.is-open .ov__panel { transform: none; }
.ov__close { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: var(--txt-3); }
.ov__close:hover { color: var(--txt); background: var(--surface-2); }
.ov__close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.file__top { display: flex; gap: 20px; align-items: center; padding-right: 30px; }
.file__name { margin: 4px 0 0; font: 400 34px/1.05 var(--serif); }
.file__name.is-void .void { font-size: 15px; }
.file__chips { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }
.file > p { margin: 20px 0 0; color: var(--txt-2); }
.em .fld { margin-top: 24px; }
.em .btn { margin-top: 18px; width: 100%; }
.em__done { margin: 18px 0 0; color: var(--txt-2); font-size: 14.5px; }
.em__done b { color: var(--red); font-weight: 500; }

/* developer mode */
.dev { margin-top: 18px; }
.devbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.devsec { margin-top: 22px; }
.devsec h3 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 22px 0 10px; font: 400 22px var(--serif); }
.devrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px 0; border-bottom: 1px solid var(--line); }
.devrow__b { flex: 0 0 100%; font: 400 11.5px var(--mono); color: var(--acc-2); }
.devf { display: grid; gap: 4px; flex: 0 1 112px; min-width: 76px; }
.devf--wide { flex: 1 1 150px; }
.devf span { font: 400 11px var(--mono); color: var(--txt-3); }
.devf__i {
  width: 100%; height: 34px; padding: 0 10px;
  border-radius: 8px; border: 1px solid var(--line-2); background: rgba(0,0,0,.2);
  color: var(--txt); font-size: 14px; outline: none;
}
.devf__i:focus { border-color: var(--acc-line); }
select.devf__i { appearance: auto; }
.devacc { margin-top: 12px; padding: 16px; border-radius: var(--r-sm); border: 1px solid var(--line); }
.devacc__top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.devacc__top .btn { margin-left: auto; }
.devpw { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; margin-top: 10px; }
.devpw__msg { align-self: center; font: 400 12px var(--mono); color: var(--txt-3); }
.devpw__msg.is-red { color: var(--red); }
.devpw__msg.is-ok { color: var(--ok); }
.devbundles { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 12px; font: 400 12px var(--mono); color: var(--txt-3); }
.devchk { display: inline-flex; align-items: center; gap: 5px; color: var(--txt-2); }
.devbtns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.devpre { margin: 12px 0 0; padding: 12px 14px; border-radius: 10px; background: rgba(0,0,0,.25); border: 1px solid var(--line); font: 400 13px var(--mono); color: var(--txt); overflow-x: auto; }
.devpre--token { word-break: break-all; white-space: pre-wrap; color: var(--acc); }
#dev-lockstate.is-ok { color: var(--ok); }
#dev-lockstate.is-red { color: var(--red); }

/* "dodge this." */
.dodge {
  position: fixed; inset: 0; z-index: 30; pointer-events: none;
  display: grid; place-items: center;
  font: italic 400 clamp(60px, 14vw, 160px) var(--serif); color: var(--acc);
  animation: dodge 1.6s var(--ease) both;
}
@keyframes dodge {
  0% { opacity: 0; transform: translateX(-30px); filter: blur(8px); }
  25% { opacity: 1; transform: none; filter: none; }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translateX(40px) skewX(-8deg); filter: blur(6px); }
}

/* ── Small screens ────────────────────────────────────────────────────── */
@media (max-width: 760px) {
  .kv--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .org { grid-template-columns: 1fr; }
  .map__side { grid-template-columns: 1fr; }
  .rank__row { grid-template-columns: 30px 1fr 18px; }
  .rank__row .d { grid-column: 2; grid-row: 2; }
  .rank__row svg { grid-column: 3; grid-row: 1; }
  .rank__body { padding-left: 4px; }
}
@media (max-width: 560px) {
  .term__body { padding: 14px 14px 18px; font-size: 12px; min-height: 300px; }
  .kv, .kv--4 { grid-template-columns: 1fr; }
  .rulelist li { grid-template-columns: 1fr; gap: 4px; }
  .file__top { flex-direction: column; align-items: flex-start; }
  .topbar__brand { font-size: 12px; }
  .ally { flex-direction: column; }
  .map__view { aspect-ratio: 1 / 1; }
  .ladder li { grid-template-columns: 28px 1fr; }
  .ladder .d { grid-column: 2; }
  .cmd { gap: 16px; padding: 18px; }
  .dock__it { width: 40px; height: 40px; }
  .dock__sep { margin: 0 2px; }
  .dock__tip { display: none; }
}

@media (max-width: 420px) {
  .dock { padding: 5px; gap: 0; }
  .dock__it { width: 35px; height: 40px; border-radius: 11px; }
  .dock__it svg { width: 19px; height: 19px; }
  .dock__sep { margin: 0 3px; }
  .dock__lock { right: 1px; top: 3px; }
}

/* ── Reduced motion ───────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; transition-delay: 0s !important; }
  .code-rain pre { animation: none; }
}
