:root {
  --bg: #0b0d12;
  --surface-1: #11141b;
  --surface-2: #171b24;
  --surface-3: #1f2430;
  --line: rgba(233, 222, 196, .09);
  --line-strong: rgba(233, 222, 196, .18);
  --text: #ece6d8;
  --muted: #a39d90;
  --faint: #6f6a61;
  --gold: #d9a441;
  --gold-hi: #f2c96e;
  --gold-ink: #1a1305;
  --green: #5fd068;
  --red: #e0584f;
  --horde: #c2412f;
  --alliance: #4f7fd6;

  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px; --s8: 72px;
  --r1: 6px; --r2: 10px; --r3: 16px;
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  --ease: cubic-bezier(.22, 1, .36, 1);

  --shadow-1: 0 1px 0 rgba(255, 236, 196, .04) inset, 0 1px 2px rgba(0, 0, 0, .35), 0 4px 12px rgba(10, 6, 0, .25);
  --shadow-2: 0 1px 0 rgba(255, 236, 196, .06) inset, 0 6px 16px rgba(0, 0, 0, .35), 0 18px 40px rgba(20, 12, 0, .35);
  --shadow-3: 0 10px 24px rgba(0, 0, 0, .45), 0 28px 64px rgba(12, 8, 0, .55);

  --font-display: 'Cinzel', 'Times New Roman', serif;
  --font-body: 'Source Sans 3', system-ui, sans-serif;

  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 520px at 12% -8%, rgba(217, 164, 65, .10), transparent 60%),
    radial-gradient(900px 600px at 105% 10%, rgba(120, 70, 190, .07), transparent 55%),
    radial-gradient(1200px 700px at 50% 120%, rgba(40, 90, 120, .08), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 400 16px/1.7 var(--font-body);
  min-height: 100vh;
}
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .05;
  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='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body > * { position: relative; z-index: 1; }

h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
h1 { font-size: clamp(28px, 5vw, 44px); letter-spacing: -0.03em; }
h2 { font-size: clamp(20px, 3vw, 26px); }
h3 { font-size: 17px; letter-spacing: 0; }
p { margin: 0; }
a { color: var(--gold-hi); text-decoration: none; }
a:hover { text-decoration: underline; }
img { display: block; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--gold-hi); outline-offset: 2px; border-radius: var(--r1); }

/* ---------- shell ---------- */
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 var(--s4); }
@media (min-width: 720px) { .wrap { padding: 0 var(--s5); } }

.site-header {
  position: sticky; top: 0; z-index: 20;
  background: rgba(11, 13, 18, .82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.site-header .wrap { display: flex; align-items: center; gap: var(--s4); min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: var(--s2); font-family: var(--font-display); font-weight: 700; color: var(--text); font-size: 17px; }
.brand:hover { text-decoration: none; color: var(--gold-hi); }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(135deg, var(--gold-hi), #9a6a1c); box-shadow: 0 0 0 1px rgba(0,0,0,.4) inset, 0 4px 14px rgba(217,164,65,.35); display: grid; place-items: center; color: var(--gold-ink); font-size: 14px; }
.nav { display: flex; gap: var(--s1); margin-left: auto; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  padding: var(--s2) var(--s3); border-radius: var(--r1); color: var(--muted); font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: color .2s var(--ease), background-color .2s var(--ease);
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a:active { transform: scale(.97); }
.nav a[aria-current="page"] { color: var(--gold-hi); background: rgba(217, 164, 65, .1); }
@media (max-width: 719px) { .nav { margin-left: 0; width: 100%; padding-bottom: var(--s2); } }

.page-head { padding: var(--s7) 0 var(--s5); display: grid; gap: var(--s3); }
.eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.lede { color: var(--muted); max-width: 64ch; font-size: 17px; }

main { padding-bottom: var(--s8); }

.site-footer { border-top: 1px solid var(--line); padding: var(--s6) 0; color: var(--faint); font-size: 14px; }
.site-footer p + p { margin-top: var(--s2); }
.site-footer a { color: var(--muted); }

/* embed mode: the host page supplies the chrome */
.embed .site-header, .embed .site-footer, .embed .page-head, .embed .hide-in-embed { display: none !important; }
.embed body { background: var(--bg); min-height: 0; }
.embed body::before { position: absolute; }
.embed main { padding: var(--s4) 0; }
.embed .wrap { padding: 0 var(--s3); }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2);
  min-height: 40px; padding: 0 var(--s4); border-radius: var(--r1);
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  font: 600 15px/1 var(--font-body); cursor: pointer; white-space: nowrap;
  box-shadow: var(--shadow-1);
  transition: transform .25s var(--spring), background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.btn:hover { background: var(--surface-3); border-color: rgba(242, 201, 110, .35); text-decoration: none; }
.btn:active { transform: scale(.96); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-gold { background: linear-gradient(180deg, var(--gold-hi), var(--gold)); color: var(--gold-ink); border-color: transparent; box-shadow: 0 1px 0 rgba(255,255,255,.35) inset, 0 6px 18px rgba(217,164,65,.25); }
.btn-gold:hover { background: linear-gradient(180deg, #f7d68a, var(--gold-hi)); border-color: transparent; }
.btn[aria-pressed="true"] { border-color: var(--red); color: #ffb3ad; background: rgba(224, 88, 79, .12); }

.select, .input {
  min-height: 40px; padding: 0 var(--s3); border-radius: var(--r1);
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text); font: 500 15px var(--font-body);
  transition: border-color .2s var(--ease);
}
.select:hover, .input:hover { border-color: rgba(242, 201, 110, .35); }
.input { width: 100%; }

.toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3);
  padding: var(--s3); border: 1px solid var(--line); border-radius: var(--r2);
  background: var(--surface-1); box-shadow: var(--shadow-1);
}
.toolbar .spacer { flex: 1; }
.field { display: flex; align-items: center; gap: var(--s2); color: var(--muted); font-size: 14px; font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: var(--s2); }
.chip {
  display: inline-flex; align-items: center; gap: var(--s2); min-height: 36px; padding: 0 var(--s3) 0 var(--s2);
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface-1); color: var(--muted);
  font: 600 14px var(--font-body); cursor: pointer;
  transition: transform .25s var(--spring), border-color .2s var(--ease), color .2s var(--ease), background-color .2s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }
.chip:active { transform: scale(.95); }
.chip[aria-pressed="true"] { color: var(--text); border-color: var(--c, var(--gold)); background: color-mix(in srgb, var(--c, var(--gold)) 16%, var(--surface-1)); }
.chip img { width: 22px; height: 22px; border-radius: 50%; }

.panel { border: 1px solid var(--line); border-radius: var(--r3); background: var(--surface-1); box-shadow: var(--shadow-2); }

.icon { border-radius: var(--r1); box-shadow: 0 0 0 1px rgba(0,0,0,.6), 0 2px 6px rgba(0,0,0,.4); background: #000; }

.stat { display: grid; gap: 2px; }
.stat b { font: 700 22px/1.1 var(--font-display); color: var(--gold-hi); }
.stat span { font-size: 13px; color: var(--muted); font-weight: 600; }

.toast {
  position: fixed; left: 50%; bottom: var(--s5); z-index: 50; transform: translate(-50%, 20px); opacity: 0;
  padding: var(--s2) var(--s4); border-radius: var(--r2); background: var(--surface-3); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-3); font-weight: 600; pointer-events: none;
  transition: opacity .2s var(--ease), transform .35s var(--spring);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.notice { padding: var(--s3) var(--s4); border-radius: var(--r2); border: 1px solid rgba(224, 88, 79, .4); background: rgba(224, 88, 79, .08); }

/* ---------- tooltip ---------- */
.tip {
  position: fixed; z-index: 60; max-width: 320px; padding: var(--s3) var(--s4);
  background: rgba(8, 10, 16, .97); border: 1px solid rgba(242, 201, 110, .28); border-radius: var(--r2);
  box-shadow: var(--shadow-3); font-size: 14px; line-height: 1.55; pointer-events: none;
  opacity: 0; transform: translateY(4px); transition: opacity .12s var(--ease), transform .2s var(--ease);
}
.tip.show { opacity: 1; transform: none; }
.tip h4 { margin: 0 0 2px; font: 700 16px/1.3 var(--font-body); color: var(--text); }
.tip .tip-sub { color: var(--muted); font-size: 13px; margin-bottom: var(--s2); }
.tip .tip-next { color: var(--muted); margin-top: var(--s2); }
.tip .tip-next b { color: var(--text); font-weight: 600; }
.tip .tip-desc { color: #f1d98a; white-space: pre-line; }
.tip .tip-next { white-space: pre-line; }
.tip .tip-req { color: var(--red); margin-top: var(--s2); }
.tip .tip-classic { margin-top: var(--s2); padding-top: var(--s2); border-top: 1px solid var(--line); color: var(--faint); font-size: 13px; }
.tip .tip-hint { margin-top: var(--s2); color: var(--faint); font-size: 12px; }

/* ---------- hub ---------- */
.tool-grid { display: grid; gap: var(--s4); grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.tool-card {
  display: grid; gap: var(--s3); padding: var(--s5); border-radius: var(--r3); color: var(--text);
  border: 1px solid var(--line); background: linear-gradient(180deg, var(--surface-2), var(--surface-1));
  box-shadow: var(--shadow-2);
  transition: transform .35s var(--spring), border-color .2s var(--ease);
}
.tool-card:hover { transform: translateY(-3px); border-color: rgba(242, 201, 110, .35); text-decoration: none; }
.tool-card:active { transform: translateY(-1px) scale(.99); }
.tool-card .icons { display: flex; gap: var(--s1); }
.tool-card .icons img { width: 36px; height: 36px; }
.tool-card p { color: var(--muted); }
.tool-card .go { color: var(--gold-hi); font-weight: 700; font-size: 15px; }

/* Talent and perk buttons get clicked in quick bursts: without this, a double click selects
   the icon and rank text (blue highlight) and a drag picks up the image. */
/* Whole planner surfaces, not just the buttons: a double click on empty space next to a
   talent otherwise selects the nearest text, such as the tree title. */
.trees, .ltrees, .tree-tabs, .toolbar, .chips, .node, .lnode, .btn { -webkit-user-select: none; user-select: none; }
.toolbar input { -webkit-user-select: text; user-select: text; }
.node img, .lnode img, .chip img, .tree-tab img { -webkit-user-drag: none; pointer-events: none; }

/* ---------- language switch (standalone header only; embeds follow the host page) ---------- */
.lang-switch {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r2);
  border: 1px solid var(--line); background: var(--surface-1);
}
.lang-switch a {
  min-width: 34px; padding: 5px 6px; border-radius: 7px; text-align: center;
  font: 700 12px/1 var(--font-body); letter-spacing: .06em; color: var(--muted);
  transition: color .2s var(--ease), background-color .2s var(--ease), transform .25s var(--spring);
}
.lang-switch a:hover { color: var(--text); background: var(--surface-3); text-decoration: none; }
.lang-switch a:active { transform: scale(.94); }
.lang-switch a[aria-current="true"] { color: var(--gold-ink); background: linear-gradient(180deg, var(--gold-hi), var(--gold)); }
@media (max-width: 719px) {
  .site-header .lang-switch { order: 1; margin-left: auto; }
  .site-header .nav { order: 2; }
}
