/* Hyper Emerald v5.7 guide — shared stylesheet */

:root {
  --bg: #f3f6f2;
  --surface: #ffffff;
  --surface-2: #e9efe9;
  --ink: #15201b;
  --ink-2: #3d4c44;
  --muted: #5b6b62;
  --line: #d3ddd5;
  --accent: #1f8a5b;
  --accent-ink: #ffffff;
  --accent-soft: #dcefe4;
  --warn: #b7791f;
  --warn-soft: #fbefd9;
  --info: #2b6cb0;
  --info-soft: #dfeaf7;
  --danger: #b83232;
  --danger-soft: #f8dede;
  --box-bg: #fbfdfc;
  --box-border: #4a6fa5;
  --box-ink: #1b2a44;
  --key-bg: #2f3a35;
  --key-ink: #f3f6f2;
  --shadow: 0 1px 2px rgba(21, 32, 27, .08), 0 6px 18px rgba(21, 32, 27, .06);
  --radius: 6px;
  --font-display: "Archivo", "Arial Narrow", Arial, sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-pixel: "Silkscreen", "Courier New", monospace;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1613;
    --surface: #17211c;
    --surface-2: #1f2c25;
    --ink: #e6efe9;
    --ink-2: #c2d0c8;
    --muted: #97a89e;
    --line: #2c3b33;
    --accent: #46c48a;
    --accent-ink: #0f1613;
    --accent-soft: #1b3a2b;
    --warn: #e2a84a;
    --warn-soft: #3a2c14;
    --info: #6fa8e6;
    --info-soft: #172b40;
    --danger: #e26b6b;
    --danger-soft: #3d1c1c;
    --box-bg: #1c2733;
    --box-border: #7fa2d6;
    --box-ink: #e8eef8;
    --key-bg: #e6efe9;
    --key-ink: #15201b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #0f1613;
  --surface: #17211c;
  --surface-2: #1f2c25;
  --ink: #e6efe9;
  --ink-2: #c2d0c8;
  --muted: #97a89e;
  --line: #2c3b33;
  --accent: #46c48a;
  --accent-ink: #0f1613;
  --accent-soft: #1b3a2b;
  --warn: #e2a84a;
  --warn-soft: #3a2c14;
  --info: #6fa8e6;
  --info-soft: #172b40;
  --danger: #e26b6b;
  --danger-soft: #3d1c1c;
  --box-bg: #1c2733;
  --box-border: #7fa2d6;
  --box-ink: #e8eef8;
  --key-bg: #e6efe9;
  --key-ink: #15201b;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

img { max-width: 100%; height: auto; }

/* ---------- Header ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1360px; margin: 0 auto;
  padding: 0 20px; height: 56px;
  display: flex; align-items: center; gap: 16px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--ink); font-family: var(--font-display); font-weight: 800;
  font-size: 15px; letter-spacing: .01em; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand .mark {
  width: 26px; height: 26px; border-radius: 4px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center;
  font-family: var(--font-pixel); font-size: 11px; line-height: 1;
}
.brand .ver { color: var(--muted); font-weight: 500; }
.topbar .spacer { flex: 1; }
.search {
  position: relative; flex: 0 1 360px; min-width: 120px;
}
.search input {
  width: 100%; height: 36px; padding: 0 36px 0 12px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: var(--ink); font: inherit; font-size: 15px;
}
.search input::placeholder { color: var(--muted); }
.search kbd {
  position: absolute; right: 8px; top: 8px;
  font-family: var(--font-pixel); font-size: 9px; color: var(--muted);
  border: 1px solid var(--line); border-radius: 3px; padding: 2px 5px; line-height: 1;
}
.search-results {
  position: absolute; top: 42px; left: 0; right: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); max-height: 60vh; overflow: auto; z-index: 40;
}
.search-results:empty { display: none; }
.search-results a {
  display: block; padding: 10px 12px; border-bottom: 1px solid var(--line);
  color: var(--ink);
}
.search-results a:last-child { border-bottom: 0; }
.search-results a:hover, .search-results a.active { background: var(--surface-2); text-decoration: none; }
.search-results .r-page { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-family: var(--font-display); }
.search-results .r-title { font-weight: 600; }
.search-results .r-snip { font-size: 14px; color: var(--ink-2); }
.search-results .r-empty { padding: 12px; color: var(--muted); }
.icon-btn {
  height: 36px; min-width: 36px; padding: 0 10px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); cursor: pointer; font: inherit; font-size: 14px;
  display: inline-flex; align-items: center; gap: 6px;
}
.icon-btn:hover { background: var(--surface-2); }
.nav-toggle { display: none; }

/* ---------- Layout ---------- */
.shell {
  max-width: 1360px; margin: 0 auto; padding: 0 20px;
  display: grid; grid-template-columns: 250px minmax(0, 1fr) 220px; gap: 40px;
}
.sidenav {
  position: sticky; top: 56px; align-self: start;
  max-height: calc(100vh - 56px); overflow-y: auto;
  padding: 28px 0 40px;
  font-size: 15px;
}
.sidenav .group { margin-bottom: 20px; }
.sidenav .group-title {
  font-family: var(--font-display); font-weight: 700; font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
  margin: 0 0 6px 10px;
}
.sidenav a {
  display: block; padding: 6px 10px; border-radius: 4px; color: var(--ink-2);
  border-left: 2px solid transparent;
}
.sidenav a:hover { background: var(--surface-2); text-decoration: none; color: var(--ink); }
.sidenav a.current { color: var(--accent); font-weight: 600; border-left-color: var(--accent); background: var(--accent-soft); }
.sidenav .soon { color: var(--muted); font-size: 12px; margin-left: 6px; font-family: var(--font-pixel); }

main.content { padding: 32px 0 80px; min-width: 0; }
.prose { max-width: 72ch; }
.prose.wide { max-width: none; }

.toc-rail {
  position: sticky; top: 56px; align-self: start;
  padding: 32px 0; font-size: 13.5px;
  max-height: calc(100vh - 56px); overflow-y: auto;
}
.toc-rail .toc-title {
  font-family: var(--font-display); font-weight: 700; font-size: 11px;
  letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px;
}
.toc-rail a { display: block; padding: 4px 0 4px 10px; color: var(--muted); border-left: 2px solid var(--line); }
.toc-rail a.lvl3 { padding-left: 22px; font-size: 12.5px; }
.toc-rail a:hover { color: var(--ink); text-decoration: none; }
.toc-rail a.active { color: var(--accent); border-left-color: var(--accent); }

/* ---------- Typography ---------- */
.eyebrow {
  font-family: var(--font-display); font-weight: 700; font-size: 12px;
  letter-spacing: .14em; text-transform: uppercase; color: var(--accent); margin: 0 0 8px;
}
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.15; text-wrap: balance; color: var(--ink); }
h1 { font-size: 40px; font-weight: 800; letter-spacing: -.02em; margin: 0 0 12px; }
h2 { font-size: 26px; font-weight: 700; margin: 48px 0 12px; padding-top: 8px; letter-spacing: -.01em; }
h3 { font-size: 19px; font-weight: 700; margin: 30px 0 8px; }
h4 { font-size: 16px; font-weight: 700; margin: 20px 0 6px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-2); }
h2 .anchor, h3 .anchor { opacity: 0; margin-left: 8px; font-weight: 400; color: var(--muted); font-size: .8em; }
h2:hover .anchor, h3:hover .anchor { opacity: 1; }
.lede { font-size: 20px; color: var(--ink-2); margin: 0 0 24px; max-width: 60ch; }
p { margin: 0 0 14px; }
ul, ol { padding-left: 24px; margin: 0 0 14px; }
li { margin-bottom: 4px; }
li > ul, li > ol { margin-top: 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 36px 0; }
strong { font-weight: 650; }
code {
  font-family: var(--font-mono); font-size: .88em;
  background: var(--surface-2); padding: 1px 5px; border-radius: 3px;
}
pre {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; overflow-x: auto; font-size: 14px; line-height: 1.5; margin: 0 0 16px;
}
pre code { background: none; padding: 0; font-size: inherit; }
figure { margin: 18px 0; }
figure img { border: 1px solid var(--line); border-radius: 4px; image-rendering: pixelated; }
figcaption { font-size: 13.5px; color: var(--muted); margin-top: 6px; }
.gallery { display: flex; flex-wrap: wrap; gap: 14px; margin: 16px 0; }
.gallery figure { margin: 0; flex: 1 1 240px; max-width: 320px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; margin: 0 0 18px; border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; font-size: 15px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-family: var(--font-display); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--surface-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: var(--surface-2); }

/* ---------- Components ---------- */
.kbd, .key {
  display: inline-block; font-family: var(--font-pixel); font-size: 10px; line-height: 1;
  padding: 4px 6px 3px; border-radius: 4px; vertical-align: middle;
  background: var(--key-bg); color: var(--key-ink); letter-spacing: .02em;
  box-shadow: inset 0 -2px 0 rgba(0,0,0,.25);
  transform: translateY(-1px);
}
.key.dpad { border-radius: 50%; padding: 4px 5px 3px; }

.msg {
  margin: 14px 0 18px; padding: 12px 16px;
  background: var(--box-bg); color: var(--box-ink);
  border: 2px solid var(--box-border); border-radius: 4px;
  box-shadow: inset 0 0 0 2px var(--box-bg), inset 0 0 0 3px var(--box-border);
  font-size: 15.5px; line-height: 1.5;
}
.msg .who { display: block; font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .75; margin-bottom: 4px; }
.msg p { margin: 0 0 6px; }
.msg p:last-child { margin: 0; }

.callout {
  margin: 16px 0 20px; padding: 12px 16px 12px 16px;
  border-left: 4px solid var(--accent); background: var(--accent-soft);
  border-radius: 0 var(--radius) var(--radius) 0; font-size: 15.5px;
}
.callout .title { font-family: var(--font-display); font-weight: 700; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; display: block; margin-bottom: 4px; }
.callout p:last-child { margin: 0; }
.callout.warn { border-left-color: var(--warn); background: var(--warn-soft); }
.callout.info { border-left-color: var(--info); background: var(--info-soft); }
.callout.danger { border-left-color: var(--danger); background: var(--danger-soft); }
.callout.plain { border-left-color: var(--line); background: var(--surface-2); }

.tag {
  display: inline-block; font-family: var(--font-display); font-size: 11px; font-weight: 700;
  letter-spacing: .08em; text-transform: uppercase; padding: 2px 7px; border-radius: 3px;
  background: var(--surface-2); color: var(--ink-2); vertical-align: middle;
}
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.info { background: var(--info-soft); color: var(--info); }
.tag.danger { background: var(--danger-soft); color: var(--danger); }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 18px 0 24px; }
.card {
  display: block; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
}
.card:hover { border-color: var(--accent); text-decoration: none; }
.card h3 { margin: 0 0 6px; font-size: 16px; }
.card p { margin: 0; font-size: 14.5px; color: var(--ink-2); }
.card .eyebrow { margin-bottom: 4px; }

.steps { counter-reset: step; list-style: none; padding: 0; margin: 0 0 20px; }
.steps > li { position: relative; padding-left: 44px; margin-bottom: 18px; }
.steps > li::before {
  counter-increment: step; content: counter(step);
  position: absolute; left: 0; top: 0; width: 30px; height: 30px;
  border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  font-family: var(--font-display); font-weight: 800; font-size: 14px;
  display: grid; place-items: center;
}
.steps > li > strong:first-child { display: block; font-size: 17px; margin-bottom: 4px; }

dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 16px; font-size: 15.5px; }
dl.kv dt { color: var(--muted); font-family: var(--font-display); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; padding-top: 3px; }
dl.kv dd { margin: 0; }

.route-head {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 10px 16px;
  margin-top: 40px; padding-top: 10px; border-top: 3px solid var(--accent);
}
.route-head h2 { margin: 0; padding: 0; }
.route-head .meta { font-size: 13.5px; color: var(--muted); }

.hero {
  display: grid; grid-template-columns: 1fr; gap: 18px; margin-bottom: 36px;
}
.hero .stats { display: flex; flex-wrap: wrap; gap: 10px; }
.stat {
  padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  min-width: 120px;
}
.stat .n { font-family: var(--font-display); font-size: 22px; font-weight: 800; letter-spacing: -.02em; display: block; font-variant-numeric: tabular-nums; }
.stat .l { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-family: var(--font-display); font-weight: 700; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 18px; align-items: center; }
.filters input, .filters select {
  height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 15px;
}
.filters input { flex: 1 1 220px; }
.filters .count { color: var(--muted); font-size: 14px; }
.pill-row { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  font-size: 13px; padding: 2px 9px; border-radius: 20px; border: 1px solid var(--line);
  background: var(--surface); color: var(--ink-2); cursor: pointer; font-family: inherit;
}
.pill.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.party { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 4px; }
.mon {
  padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); min-width: 150px; font-size: 14px; flex: 1 1 150px; max-width: 220px;
}
.mon .name { font-weight: 650; display: flex; justify-content: space-between; gap: 8px; }
.mon .lv { font-family: var(--font-pixel); font-size: 9px; color: var(--muted); }
.mon .sub { color: var(--muted); font-size: 12.5px; }
.mon .moves { color: var(--ink-2); font-size: 12.5px; margin-top: 3px; line-height: 1.35; }

details { border: 1px solid var(--line); border-radius: var(--radius); padding: 0 14px; margin: 0 0 12px; background: var(--surface); }
details summary { cursor: pointer; padding: 10px 0; font-weight: 600; }
details[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 10px; }
details .body { padding-bottom: 12px; }

.pager { display: flex; justify-content: space-between; gap: 12px; margin-top: 56px; padding-top: 20px; border-top: 1px solid var(--line); }
.pager a { flex: 1; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); }
.pager a:hover { border-color: var(--accent); text-decoration: none; }
.pager a span { display: block; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; font-family: var(--font-display); font-weight: 700; }
.pager a.next { text-align: right; }

footer.site-footer {
  border-top: 1px solid var(--line); margin-top: 40px; padding: 24px 20px 40px;
  font-size: 14px; color: var(--muted);
}
footer.site-footer .inner { max-width: 1360px; margin: 0 auto; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

.src { font-size: 13px; color: var(--muted); }

.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 230px minmax(0, 1fr); }
  .toc-rail { display: none; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .nav-toggle { display: inline-flex; }
  .sidenav {
    display: none; position: fixed; top: 56px; left: 0; right: 0; bottom: 0; z-index: 25;
    background: var(--surface); padding: 16px 20px 40px; max-height: none; border-bottom: 1px solid var(--line);
  }
  .sidenav.open { display: block; }
  .search { flex: 1 1 auto; }
  .brand .ver, .brand .long { display: none; }
  h1 { font-size: 32px; }
  h2 { font-size: 23px; }
  body { font-size: 16px; }
  .topbar-inner { padding: 0 16px; }
  .shell { padding: 0 16px; }
  dl.kv { grid-template-columns: 1fr; gap: 2px 0; }
  dl.kv dd { margin-bottom: 8px; }
}
@media print {
  .topbar, .sidenav, .toc-rail, .pager, .search { display: none !important; }
  .shell { display: block; }
}
