:root {
  color-scheme: dark;
  --bg: #050b10;
  --panel: #0b171d;
  --panel-2: #102129;
  --line: #213b45;
  --text: #eefafb;
  --muted: #89a8b0;
  --cyan: #5cebdc;
  --cyan-soft: #12393a;
  --violet: #8e83ff;
  --gold: #ffd071;
  --shadow: 0 24px 70px rgba(0, 0, 0, .42);
  --glow: 0 0 34px rgba(92, 235, 220, .12);
  --rail-w: 216px;
  --rail-collapsed: 60px;
  --rail-gap: 12px;
  /* Content only reserves the collapsed strip; flyout overlays the page. */
  --rail-pad: calc(var(--rail-collapsed) + var(--rail-gap) * 2);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: 20px; }
body {
  position: relative;
  min-height: 100vh;
  overflow-x: hidden;
  margin: 0;
  padding-left: var(--rail-pad);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  line-height: 1.5;
  background: linear-gradient(180deg, #071218 0, var(--bg) 38rem);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: .22;
  pointer-events: none;
  background-image: linear-gradient(rgba(92,235,220,.08) 1px, transparent 1px), linear-gradient(90deg, rgba(92,235,220,.08) 1px, transparent 1px);
  background-size: 54px 54px;
  mask-image: linear-gradient(to bottom, #000, transparent 76%);
}
button, input, select { font: inherit; }
a { color: var(--cyan); }
::selection { color: #031010; background: var(--cyan); }
.shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
/* Left flyout: collapsed icon rail, expands on hover / keyboard focus. */
.topbar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 12px;
  position: fixed;
  z-index: 80;
  top: var(--rail-gap);
  left: var(--rail-gap);
  bottom: var(--rail-gap);
  width: var(--rail-collapsed);
  margin: 0;
  padding: 10px 8px 12px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgba(120,189,193,.2);
  border-radius: 16px;
  background: rgba(7,18,24,.92);
  box-shadow: 0 12px 36px rgba(0,0,0,.28);
  backdrop-filter: blur(18px) saturate(140%);
  scrollbar-width: thin;
  scrollbar-color: #31555e transparent;
  transition: width .22s ease, padding .22s ease, box-shadow .22s ease, border-color .22s ease;
}
/* Hover/focus expand only on fine pointers — touch uses the mobile drawer. */
@media (hover: hover) and (pointer: fine) {
  .topbar:hover,
  .topbar:focus-within {
    width: var(--rail-w);
    padding: 12px 10px 14px;
    border-color: rgba(120,189,193,.32);
    box-shadow: 0 18px 50px rgba(0,0,0,.4), 0 0 0 1px rgba(92,235,220,.06);
  }
  .topbar:hover .brand,
  .topbar:focus-within .brand {
    justify-content: flex-start;
    gap: 10px;
    padding: 10px 12px 10px 10px;
    font-size: .82rem;
    letter-spacing: .1em;
  }
  .topbar:hover nav a,
  .topbar:focus-within nav a {
    justify-content: flex-start;
    gap: 10px;
    padding: 7px 10px 7px 12px;
    font-size: .78rem;
  }
}
.nav-toggle,
.nav-backdrop { display: none; }
.brand {
  display: inline-flex; align-items: center; justify-content: center; gap: 0; flex: 0 0 auto;
  min-height: 42px;
  padding: 8px;
  overflow: hidden;
  white-space: nowrap;
  color: var(--text); text-decoration: none; font-size: 0; font-weight: 900; letter-spacing: 0;
  border: 1px solid transparent; border-radius: 10px;
  transition: color .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease, font-size .18s ease, letter-spacing .18s ease, gap .18s ease, justify-content .18s ease, padding .18s ease;
}
.brand::before {
  content: ""; width: 9px; height: 9px; border-radius: 2px; background: var(--cyan);
  box-shadow: 0 0 0 4px rgba(92,235,220,.1), 0 0 18px var(--cyan); transform: rotate(45deg);
  transition: box-shadow .18s ease, transform .18s ease;
}
.brand span { color: var(--cyan); font-size: inherit; transition: color .18s ease; }
.brand:hover, .brand:focus-visible {
  color: #f4fffe; border-color: rgba(92,235,220,.35);
  background: rgba(18,48,52,.55); box-shadow: 0 0 0 1px rgba(92,235,220,.08), 0 10px 28px rgba(0,0,0,.2);
  outline: none;
}
.brand:hover::before, .brand:focus-visible::before {
  box-shadow: 0 0 0 5px rgba(92,235,220,.16), 0 0 22px rgba(92,235,220,.75);
  transform: rotate(45deg) scale(1.08);
}
.brand:hover span, .brand:focus-visible span { color: #9af8ef; }
.brand[aria-current="page"] { border-color: rgba(92,235,220,.22); background: rgba(14,40,44,.4); }
nav {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  flex-wrap: nowrap;
  justify-content: flex-start;
  gap: 2px;
  min-height: 0;
  width: 100%;
}
nav a {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: 100%;
  min-height: 42px;
  padding: 7px;
  overflow: hidden;
  white-space: nowrap;
  color: var(--muted);
  text-decoration: none;
  font-size: 0;
  font-weight: 760;
  line-height: 1.2;
  border-radius: 10px;
  transition: color .15s ease, background .15s ease, gap .18s ease, padding .18s ease, justify-content .18s ease, font-size .15s ease;
}
nav a::before,.tool-card::before,.section-head .eyebrow::before,.btn[href$=".zip"]::before { content: ""; flex: 0 0 auto; background: center/contain no-repeat; filter: drop-shadow(0 0 7px rgba(92,235,220,.2)); }
nav a::before { width: 28px; height: 28px; }
nav a[href$="farming.html"]::before,.tool-card[href$="farming.html"]::before,.page-farming .section-head .eyebrow::before { background-image: url("ui-icons/farming.png"); }
nav a[href$="party.html"]::before,.tool-card[href$="party.html"]::before,.page-party .section-head .eyebrow::before { background-image: url("ui-icons/party.png"); }
nav a[href$="pals.html"]::before,.tool-card[href$="pals.html"]::before,.page-pals .section-head .eyebrow::before { background-image: url("ui-icons/pals.png"); }
nav a[href$="skills.html"]::before,.tool-card[href$="skills.html"]::before,.page-skills .section-head .eyebrow::before { background-image: url("ui-icons/skills.png"); }
nav a[href$="habitat.html"]::before,.tool-card[href$="habitat.html"]::before,.page-habitat .section-head .eyebrow::before { background-image: url("ui-icons/habitat.png"); }
nav a[href$="dungeons.html"]::before,.tool-card[href$="dungeons.html"]::before,.page-dungeons .section-head .eyebrow::before { background-image: url("ui-icons/dungeons.png"); }
nav a[href$="mod.html"]::before,.tool-card[href$="mod.html"]::before,.page-mod .section-head .eyebrow::before { background-image: url("ui-icons/mod.png"); }
nav a[href*="#install"]::before,nav a[href$="install.html"]::before,.page-install .section-head .eyebrow::before,.page-mod #install .eyebrow::before,.btn[href$=".zip"]::before { background-image: url("ui-icons/install.png"); }
nav a:hover { color: var(--text); background: rgba(92,235,220,.06); }
nav a[aria-current="page"] {
  color: var(--text);
  background: linear-gradient(90deg, rgba(32,105,104,.42), rgba(17,43,48,.55));
}
nav a[aria-current="page"]::after {
  content: "";
  position: absolute;
  top: 9px;
  bottom: 9px;
  left: 0;
  width: 3px;
  height: auto;
  border-radius: 0 2px 2px 0;
  background: var(--cyan);
  box-shadow: 0 0 10px rgba(92,235,220,.45);
}
.section { padding: 72px 0; }
/* Stacked like Farming Lab: full-width title, short line under it, optional data-tag. */
.section-head {
  display: grid;
  gap: 10px;
  justify-items: start;
  align-items: start;
  margin-bottom: 28px;
  text-align: left;
}
.section-head > div { min-width: 0; width: 100%; }
.section-head h1 {
  margin: 0;
  max-width: none;
  font-size: clamp(1.9rem, 3.4vw, 2.9rem);
  line-height: 1.12;
  letter-spacing: -.04em;
  text-wrap: balance;
}
.section-head > p {
  max-width: 42rem;
  margin: 0;
  color: var(--muted);
  font-size: .98rem;
  line-height: 1.5;
}
.eyebrow { margin: 0 0 10px; color: var(--cyan); font-size: .76rem; font-weight: 850; letter-spacing: .16em; text-transform: uppercase; }
.section-head .eyebrow { display: flex; align-items: center; gap: 8px; }
.section-head .eyebrow::before { width: 56px; height: 56px; }
.section-head .data-tag { margin-top: 4px; }
.data-tag { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; padding: 7px 11px; color: var(--cyan); border: 1px solid #286568; border-radius: 999px; background: rgba(16,43,46,.72); font-size: .73rem; font-weight: 780; }
.data-tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 12px var(--cyan); }
.card { padding: 24px; border: 1px solid var(--line); border-radius: 16px; background: linear-gradient(145deg, rgba(14,30,37,.95), rgba(8,18,23,.95)); box-shadow: 0 18px 50px rgba(0,0,0,.2); }
.card h2, .card h3 { margin-top: 0; }
.card p, .card li { color: var(--muted); }
.card code { padding: .1rem .35rem; border-radius: 4px; background: #1c2b31; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 17px; color: #062023; text-decoration: none; border-radius: 10px; background: linear-gradient(100deg, var(--cyan), #8cf2d5); box-shadow: 0 10px 28px rgba(92,235,220,.15); font-weight: 850; }
.btn[href$=".zip"]::before { width: 28px; height: 28px; filter: brightness(.22) saturate(1.2); }
.btn[href$=".zip"]:has(.btn-icon)::before { display: none; }
.btn.secondary { color: #c8f5f2; border: 1px solid #3c7779; background: linear-gradient(180deg, #15393d, #102b30); }
.btn .btn-icon {
  flex: 0 0 auto; width: 22px; height: 22px; object-fit: contain;
}
.btn[href$=".zip"] .btn-icon {
  width: 28px; height: 28px; border-radius: 6px; object-fit: cover;
  box-shadow: 0 0 0 1px rgba(0,0,0,.22);
}
.btn.workshop {
  color: #f3f7ff;
  background: linear-gradient(100deg, #1b2838, #2a475e 55%, #66c0f4);
  box-shadow: 0 10px 28px rgba(23, 40, 58, .35);
}
.btn.workshop:hover { filter: brightness(1.06); }
.btn.workshop .btn-icon { width: 24px; height: 24px; border-radius: 0; box-shadow: none; }
.workshop-card {
  display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 14px; align-items: center;
  margin-top: 12px; padding: 12px; border: 1px solid #2a505a; border-radius: 14px;
  background: linear-gradient(145deg, rgba(18, 34, 48, .95), rgba(8, 18, 23, .96));
  text-decoration: none; color: inherit; transition: border-color .18s ease, transform .18s ease;
}
.workshop-card:hover { border-color: #66c0f4; transform: translateY(-2px); }
.workshop-card img {
  width: 120px; height: 68px; object-fit: cover; border-radius: 8px;
  border: 1px solid #314e62; background: #0b141c;
}
.workshop-card strong { display: block; color: var(--text); font-size: .92rem; }
.workshop-card span { display: block; margin-top: 4px; color: var(--muted); font-size: .74rem; line-height: 1.4; }
.install-lead .home-actions { margin: 0 0 16px; }
.install-lead .home-actions .btn { margin-bottom: 0; }
.home-hero { display: grid; grid-template-columns: minmax(0,1.2fr) minmax(320px,.8fr); gap: 48px; align-items: center; min-height: 540px; padding: 66px 0; }
.home-hero h1 { margin: 0; font-size: clamp(3.4rem, 7vw, 6.5rem); line-height: 1.02; letter-spacing: -.07em; overflow: visible; }
/* Tight line-height + background-clip:text was clipping the bottom of "play." */
.home-hero h1 span {
  display: block;
  padding-bottom: .08em;
  color: transparent;
  background: linear-gradient(105deg, var(--cyan), #9af8ef 46%, var(--violet));
  -webkit-background-clip: text;
  background-clip: text;
}
.home-copy { max-width: 650px; margin: 22px 0 0; color: var(--muted); font-size: 1.05rem; }
.home-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.tool-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tool-card { position: relative; display: block; min-height: 170px; padding: 20px 82px 20px 20px; color: var(--text); text-decoration: none; border: 1px solid var(--line); border-radius: 15px; background: linear-gradient(145deg, #0e2027, #09161b); transition: transform .2s ease, border-color .2s ease; }
.tool-card::before { position: absolute; top: 14px; right: 13px; width: 76px; height: 76px; opacity: .98; }
.tool-card:hover { transform: translateY(-3px); border-color: #3c8987; }
.tool-card small { color: var(--cyan); font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.tool-card strong { display: block; margin-top: 8px; font-size: 1.08rem; }
.tool-card span { display: block; margin-top: 7px; color: var(--muted); font-size: .8rem; }
.content-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.shot { width: 100%; margin-top: 0; border: 1px solid var(--line); border-radius: 10px; display: block; }
.shot-button {
  display: block; width: 100%; margin-top: 14px; padding: 0; border: 0; border-radius: 10px;
  background: transparent; cursor: zoom-in; position: relative;
}
.shot-button:hover .shot, .shot-button:hover img { border-color: #3c8987; }
.shot-button:focus-visible { outline: 2px solid var(--cyan); outline-offset: 3px; }
.shot-button::after {
  content: "Click to enlarge"; position: absolute; right: 10px; bottom: 10px;
  padding: 4px 8px; border-radius: 999px; color: #062023; background: rgba(92,235,220,.9);
  font-size: .62rem; font-weight: 850; letter-spacing: .04em; text-transform: uppercase;
  opacity: 0; transition: opacity .18s ease; pointer-events: none;
}
.shot-button:hover::after, .shot-button:focus-visible::after { opacity: 1; }
.dots { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.dots .shot-button { margin-top: 0; }
.dots img { width: 100%; border: 1px solid var(--line); border-radius: 8px; display: block; }
.lightbox {
  max-width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 32px); padding: 0;
  border: 1px solid #356068; border-radius: 14px; background: #071218; color: var(--text);
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
}
.lightbox::backdrop { background: rgba(2, 8, 12, .78); backdrop-filter: blur(4px); }
.lightbox img { display: block; width: 100%; max-height: calc(100vh - 88px); object-fit: contain; background: #050b10; }
.lightbox-close-form { display: flex; justify-content: flex-end; margin: 0; padding: 8px 10px; border-bottom: 1px solid #1f3a42; }
.lightbox-close {
  min-height: 34px; padding: 0 12px; border: 1px solid #3c7779; border-radius: 8px;
  background: #123035; color: #c8f5f2; font-weight: 800; cursor: pointer;
}
.install-section { border-top: 1px solid rgba(148,174,181,.12); background: linear-gradient(180deg, rgba(8,18,24,.55), transparent 18rem); }
.install-section .section-head { margin-bottom: 8px; }
.install-section .install-hero { margin-top: 8px; }
.install-section .install-lead .btn { margin-top: 4px; }
footer { padding: 28px 0 44px; color: var(--muted); border-top: 1px solid rgba(148,174,181,.14); font-size: .78rem; }

/* Pal index */
.pal-index-shell { display: grid; gap: 16px; }
.matchup-guide,.status-guide { overflow: hidden; border: 1px solid #2a505a; border-radius: 17px; background: linear-gradient(145deg,#0d2027,#09171c); }
.guide-collapse > .status-guide-head {
  list-style: none; cursor: pointer; user-select: none;
  transition: background .15s ease;
}
.guide-collapse > .status-guide-head::-webkit-details-marker { display: none; }
.guide-collapse > .status-guide-head::after {
  content: "+"; margin-left: auto; color: var(--cyan); font-size: 1.05rem; font-weight: 900; line-height: 1;
}
.guide-collapse[open] > .status-guide-head::after { content: "−"; }
.guide-collapse > .status-guide-head:hover { background: rgba(92,235,220,.04); }
.guide-collapse:not([open]) > .status-guide-head { border-bottom: 0; }
.matchup-guide-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 7px; padding: 10px; }
.matchup-guide-grid article { display: grid; grid-template-columns: minmax(116px,1fr) minmax(96px,.9fr) minmax(82px,.8fr); gap: 8px; align-items: center; min-width: 0; padding: 9px 11px; border: 1px solid #294750; border-radius: 9px; background: #0a181e; }
.matchup-element { display: flex; align-items: center; gap: 7px; min-width: 0; }
.matchup-element img { width: 38px; height: 38px; object-fit: contain; }
.matchup-element strong { overflow: hidden; color: #f1ffff; font-size: .78rem; text-overflow: ellipsis; }
.matchup-relation { display: grid; gap: 3px; min-width: 0; color: #bad0d4; }
.matchup-guide-grid article b,.matchup-guide-grid article i { display: block; font-size: .66rem; font-style: normal; font-weight: 950; letter-spacing: .075em; line-height: 1; text-transform: uppercase; }
.matchup-guide-grid article b { color: #6ee4ae; }
.matchup-guide-grid article i { color: #ff8f8f; }
.matchup-target-list { display: flex; flex-wrap: wrap; gap: 3px 8px; min-width: 0; font-size: .68rem; }
.matchup-guide .matchup-target { display: inline-flex; align-items: center; gap: 4px; color: #d6e7e9; white-space: nowrap; }
.matchup-guide .matchup-target + .matchup-target::before { content: none; }
.matchup-guide .matchup-target img { width: 22px; height: 22px; object-fit: contain; }
.status-guide-head { display: flex; align-items: center; justify-content: flex-start; flex-wrap: wrap; gap: 10px 14px; padding: 14px 16px 11px; border-bottom: 1px solid var(--line); }
.status-guide-head h2 { margin: 0; color: var(--text); font-size: .86rem; letter-spacing: .04em; text-transform: uppercase; }
.status-guide-head span,.status-guide-note { color: var(--muted); font-size: .68rem; }
.status-guide-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); }
.status-effect { position: relative; min-width: 0; padding: 12px 14px 13px 17px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.status-effect:nth-child(4n) { border-right: 0; }
.status-effect:nth-last-child(-n+4) { border-bottom: 0; }
.status-effect::before { position: absolute; inset: 12px auto 12px 0; width: 3px; border-radius: 3px; background: var(--effect,#63eadf); content: ''; }
.status-effect-title { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.status-effect-title img { width: 40px; height: 40px; object-fit: contain; }
.status-effect strong { display: block; color: var(--effect,#63eadf); font-size: .9rem; }
.status-effect ul { display: grid; gap: 4px; margin: 0; padding-left: 20px; color: #aac1c6; font-size: .7rem; line-height: 1.38; }
.status-effect li { padding-left: 2px; }
.status-effect li::marker { color: var(--effect,#63eadf); }
.status-effect b { color: #edfafa; font-weight: 800; }
.status-burn { --effect: #ff8465; }
.status-soak { --effect: #62bfff; }
.status-ivy { --effect: #7ee090; }
.status-electric { --effect: #ffe15f; }
.status-freeze { --effect: #93edff; }
.status-muddy { --effect: #d1a06f; }
.status-blind { --effect: #bd9cff; }
.status-poison { --effect: #db79de; }
.status-guide-note { margin: 0; padding: 9px 16px; border-top: 1px solid var(--line); }
.status-guide-note b { color: var(--cyan); }
.pal-filter-panel { padding: 17px; border: 1px solid var(--line); border-radius: 16px; background: rgba(11,24,30,.94); box-shadow: var(--glow); }
.pal-filter-row { display: grid; grid-template-columns: minmax(220px,1.5fr) repeat(3,minmax(140px,.7fr)); gap: 10px; }
.pal-filter { display: grid; gap: 6px; color: var(--muted); font-size: .7rem; font-weight: 800; }
.pal-filter input, .pal-filter select { min-height: 42px; width: 100%; padding: 0 11px; color: var(--text); border: 1px solid #35505a; border-radius: 8px; outline: 0; background: #0c181d; }
.pal-filter input:focus, .pal-filter select:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(82,214,208,.12); }
.ability-filter-label { display: flex; justify-content: space-between; gap: 12px; margin: 15px 0 8px; color: #bdd6da; font-size: .72rem; font-weight: 800; }
.ability-filter-label span { color: var(--muted); font-weight: 600; }
.ability-filters { display: flex; flex-wrap: wrap; gap: 7px; }
.work-icon { display: inline-block; background: var(--work-color,#73e0db); filter: drop-shadow(0 0 5px color-mix(in srgb,var(--work-color,#73e0db) 44%,transparent)); -webkit-mask: var(--work-mask) center / 190% no-repeat; mask: var(--work-mask) center / 190% no-repeat; }
.work-kindling { --work-color: #ff7b55; --work-mask: url('work-icons/kindling.png'); }
.work-watering { --work-color: #58bfff; --work-mask: url('work-icons/watering.png'); }
.work-seeding { --work-color: #7ee785; --work-mask: url('work-icons/planting.png'); }
.work-electricity { --work-color: #ffe15b; --work-mask: url('work-icons/electricity.png'); }
.work-handiwork { --work-color: #f2b5dc; --work-mask: url('work-icons/handiwork.png'); }
.work-collection { --work-color: #9be567; --work-mask: url('work-icons/gathering.png'); }
.work-lumbering { --work-color: #d99a62; --work-mask: url('work-icons/lumbering.png'); }
.work-mining { --work-color: #b7c9d8; --work-mask: url('work-icons/mining.png'); }
.work-medicine { --work-color: #ff91ad; --work-mask: url('work-icons/medicine.png'); }
.work-cooling { --work-color: #8decff; --work-mask: url('work-icons/cooling.png'); }
.work-transporting { --work-color: #e8b866; --work-mask: url('work-icons/transporting.png'); }
.work-farming { --work-color: #c3a3ff; --work-mask: url('work-icons/farming.png'); }
.hunger-icon { display: inline-block; background: #ffc95f; filter: drop-shadow(0 0 5px rgba(255,201,95,.3)); -webkit-mask: url('work-icons/hunger.png') center / 125% no-repeat; mask: url('work-icons/hunger.png') center / 125% no-repeat; }
.ability-filter-button { display: inline-flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 14px 0 10px; color: #b7d2d6; border: 1px solid #304e58; border-radius: 999px; background: #0a171d; font-size: .79rem; font-weight: 820; cursor: pointer; }
.ability-filter-button .work-icon { width: 38px; height: 38px; flex: 0 0 38px; }
.ability-filter-button:hover { color: var(--text); border-color: #4b7b83; }
.ability-filter-button[aria-pressed="true"] { color: #cafffa; border-color: #3c8c89; background: #123035; }
.pal-result-line { display: flex; justify-content: space-between; gap: 14px; color: var(--muted); font-size: .75rem; }
.pal-index-layout { display: grid; grid-template-columns: minmax(0,1fr) 340px; gap: 16px; align-items: start; }
.pal-card-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.pal-card { display: grid; grid-template-columns: 72px minmax(0,1fr); gap: 12px; min-width: 0; padding: 12px; color: var(--text); text-align: left; border: 1px solid var(--line); border-radius: 13px; background: linear-gradient(145deg,#0d1d23,#08151a); cursor: pointer; transition: transform .16s ease, border-color .16s ease; }
.pal-card:hover { transform: translateY(-2px); border-color: #3c7279; }
.pal-card[aria-current="true"] { border-color: #45a5a0; box-shadow: inset 0 0 0 1px rgba(92,235,220,.12), var(--glow); }
.pal-card > img { width: 72px; height: 72px; object-fit: contain; border: 1px solid #31525c; border-radius: 12px; background: radial-gradient(circle at 45% 35%,#1b3d46,#08151a 72%); }
.pal-card-copy { min-width: 0; }
.pal-card-title { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pal-card-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; }
.pal-card-title small { flex: 0 0 auto; color: var(--muted); font-size: .65rem; }
.element-pills, .ability-pills { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.element-pill, .ability-pill { padding: 3px 6px; border-radius: 999px; font-size: .65rem; font-weight: 820; }
.element-pill { display: inline-flex; align-items: center; gap: 4px; }
.element-pill img { width: 18px; height: 18px; object-fit: contain; }
.element-pill { color: #d9d4ff; border: 1px solid #514c80; background: #1c1a39; }
.element-fire { color: #ff9b7b; border-color: #814536; background: #321b17; }
.element-water { color: #8ed7ff; border-color: #345f83; background: #15283a; }
.element-grass { color: #91e6a0; border-color: #3d7449; background: #18321e; }
.element-electric { color: #ffe787; border-color: #7b6a2f; background: #302a13; }
.element-ground { color: #e1b489; border-color: #79583a; background: #302318; }
.element-ice { color: #a8edff; border-color: #3f7580; background: #173036; }
.element-dragon { color: #d2a6ff; border-color: #6c468e; background: #2b193d; }
.element-dark { color: #c0a4dc; border-color: #59436d; background: #241a2d; }
.element-normal { color: #d4dddd; border-color: #566568; background: #20292b; }
.ability-pill { display: inline-flex; align-items: center; gap: 5px; min-height: 40px; padding: 3px 9px 3px 4px; color: #bff4f0; border: 1px solid #2f6869; background: #123033; font-size: .72rem; }
.ability-pill .work-icon { width: 34px; height: 34px; flex: 0 0 34px; }
.ability-pill b { color: var(--gold); font-size: .74rem; }
.pal-combat-hints { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.pal-matchup,.status-bubble { display: inline-flex; align-items: center; gap: 4px; min-height: 22px; padding: 2px 6px; border: 1px solid #334c54; border-radius: 999px; background: #0a171c; font-size: .65rem; font-weight: 780; line-height: 1.2; }
.pal-matchup small,.status-bubble small { font-size: .58rem; font-weight: 950; letter-spacing: .04em; text-transform: uppercase; }
.matchup-target { display: inline-flex; align-items: center; gap: 2px; }
.matchup-target + .matchup-target::before { color: #678087; content: '·'; margin-right: 2px; }
.matchup-target img { width: 16px; height: 16px; object-fit: contain; }
.pal-matchup-strong { color: #a7e8c5; border-color: #35634d; }
.pal-matchup-strong small { color: #62d79a; }
.pal-matchup-weak { color: #efb6b6; border-color: #684044; }
.pal-matchup-weak small { color: #f58282; }
.status-bubble { color: var(--effect,#b9d2d5); border-color: color-mix(in srgb,var(--effect,#b9d2d5) 46%,#233a42); background: color-mix(in srgb,var(--effect,#b9d2d5) 9%,#09171c); }
.status-bubble.partner-status { box-shadow: inset 0 0 0 1px color-mix(in srgb,var(--effect,#b9d2d5) 26%,transparent); }
.pal-card-empty { display: block; margin-top: 9px; color: var(--muted); font-size: .68rem; }
.pal-card-partner { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 5px; align-items: baseline; margin-top: 8px; font-size: .69rem; white-space: nowrap; }
.pal-card-partner small { color: var(--cyan); font-size: .62rem; font-weight: 900; letter-spacing: .045em; text-transform: uppercase; }
.pal-card-partner b { overflow: hidden; color: #b8d3d6; font-weight: 750; text-overflow: ellipsis; }
.pal-detail { position: sticky; top: 94px; overflow: hidden; border: 1px solid #315560; border-radius: 17px; background: linear-gradient(155deg,#10242b,#08151a); box-shadow: var(--shadow),var(--glow); }
.pal-detail-hero { display: grid; grid-template-columns: 112px minmax(0,1fr); gap: 14px; align-items: center; padding: 18px; border-bottom: 1px solid var(--line); }
.pal-detail-hero > img { width: 112px; height: 112px; object-fit: contain; border: 1px solid #3c646d; border-radius: 16px; background: radial-gradient(circle at 45% 35%,#214b54,#08151a 74%); }
.pal-detail-hero h2 { margin: 0; font-size: 1.35rem; line-height: 1.05; }
.pal-detail-number { display: block; margin-top: 5px; color: var(--muted); font-size: .68rem; }
.pal-detail-body { display: grid; gap: 17px; padding: 18px; }
.pal-detail-section h3 { margin: 0 0 8px; color: #c3dcdf; font-size: .7rem; letter-spacing: .08em; text-transform: uppercase; }
.pal-partner-skill { padding: 10px; border: 1px solid #315961; border-radius: 9px; background: linear-gradient(145deg,#102a2f,#0a1b21); }
.pal-partner-skill strong { display: block; color: var(--cyan); font-size: .76rem; }
.pal-partner-skill span { display: block; margin-top: 5px; color: #a8c4c8; font-size: .7rem; line-height: 1.5; }
.pal-learnset { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 6px; }
.pal-learnset-move { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 7px; align-items: center; min-width: 0; padding: 7px; color: var(--text); text-decoration: none; border: 1px solid #294952; border-radius: 9px; background: #0a1b21; }
.pal-learnset-move:hover { border-color: #4a8385; background: #10282d; }
.pal-learnset-move.is-starting { border-color: #3b8179; background: linear-gradient(145deg,#12312f,#0a1b21); }
.pal-learnset-move img { width: 32px; height: 32px; object-fit: contain; }
.pal-learnset-move span { min-width: 0; }
.pal-learnset-move small { display: block; color: var(--cyan); font-size: .52rem; font-weight: 900; letter-spacing: .04em; }
.pal-learnset-move strong { display: block; overflow: hidden; margin-top: 2px; font-size: .66rem; text-overflow: ellipsis; white-space: nowrap; }
.pal-work-list { display: grid; grid-template-columns: 1fr; gap: 6px; }
.pal-work-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 54px; padding: 7px 9px; border: 1px solid #29434d; border-radius: 8px; background: #0b1b21; font-size: .78rem; }
.pal-work-label { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.pal-work-row .work-icon { width: 42px; height: 42px; flex: 0 0 42px; }
.pal-work-row b { color: var(--gold); }
.pal-stat-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 6px; }
.pal-stat { padding: 7px; border: 1px solid #29434d; border-radius: 8px; background: #0b1b21; }
.pal-stat.has-icon { display: flex; align-items: center; gap: 8px; }
.pal-stat-icon { width: 36px; height: 36px; flex: 0 0 36px; }
.pal-stat small { display: block; color: var(--muted); font-size: .62rem; text-transform: uppercase; }
.pal-stat strong { display: block; margin-top: 2px; color: var(--text); font-size: .8rem; }
.pal-detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pal-detail-actions .btn { min-height: 39px; padding: 0 10px; font-size: .68rem; }
.pal-empty-results { grid-column: 1/-1; padding: 44px 20px; color: var(--muted); text-align: center; border: 1px dashed #35515a; border-radius: 13px; }

/* Habitat map */
.habitat-browser { position: relative; display: grid; grid-template-columns: 274px minmax(0,1fr); overflow: hidden; border: 1px solid transparent; border-radius: 20px; background: linear-gradient(var(--panel),var(--panel)) padding-box,linear-gradient(135deg,rgba(92,235,220,.42),rgba(35,59,69,.5) 42%,rgba(142,131,255,.3)) border-box; box-shadow: var(--shadow),var(--glow); }
.habitat-index { position: absolute; inset: 0 auto 0 0; display: grid; grid-template-rows: auto auto minmax(0,1fr); width: 274px; min-height: 0; overflow: hidden; border-right: 1px solid var(--line); background: #09151b; }
.habitat-search { display: grid; gap: 7px; padding: 17px 16px 13px; color: #c3dcdf; font-size: .74rem; font-weight: 800; }
.habitat-search input { width: 100%; min-height: 42px; padding: 0 12px; color: var(--text); border: 1px solid #35505a; border-radius: 9px; outline: 0; background: #0d1c22; }
.habitat-list-count { padding: 0 16px 11px; color: var(--muted); font-size: .68rem; }
.habitat-pal-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #31555e #0a171c; }
.habitat-pal { display: grid; grid-template-columns: 48px minmax(0,1fr); gap: 10px; align-items: center; width: 100%; min-height: 66px; padding: 8px 12px; color: #a8c0c5; text-align: left; border: 0; border-top: 1px solid rgba(64,93,102,.28); background: transparent; cursor: pointer; }
.habitat-pal:hover { color: var(--text); background: rgba(92,235,220,.045); }
.habitat-pal[aria-current="true"] { color: var(--text); background: linear-gradient(90deg,rgba(32,105,104,.4),rgba(17,43,48,.72)); box-shadow: inset 3px 0 var(--cyan); }
.habitat-pal-icon { width: 48px; height: 48px; object-fit: contain; border: 1px solid #2e4f58; border-radius: 10px; background: radial-gradient(circle at 45% 35%,#193841,#08151a 72%); }
.habitat-pal-copy { min-width: 0; }
.habitat-pal-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .79rem; }
.habitat-pal-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: .64rem; }
.habitat-stage { grid-column: 2; min-width: 0; background: #071218; }
.habitat-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 86px; padding: 13px 17px; border-bottom: 1px solid var(--line); background: #0c1a20; }
.habitat-selected { display: grid; grid-template-columns: 58px minmax(0,1fr); gap: 12px; align-items: center; min-width: 0; }
.habitat-selected img { width: 58px; height: 58px; object-fit: contain; border: 1px solid #365a63; border-radius: 12px; background: radial-gradient(circle at 45% 35%,#1b4048,#09161b 74%); }
.habitat-selected strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.habitat-selected span { display: block; margin-top: 3px; color: var(--muted); font-size: .7rem; }
.habitat-toggle-group,.habitat-map-tabs { display: flex; gap: 7px; }
.habitat-toggle,.habitat-map-tab { min-height: 36px; padding: 0 11px; color: #8eacb3; border: 1px solid #304e58; border-radius: 8px; background: #0a171d; font-size: .7rem; font-weight: 850; cursor: pointer; }
.habitat-toggle[aria-pressed="true"],.habitat-map-tab[aria-pressed="true"] { color: #c9fffa; border-color: #3d918e; background: #123035; }
.habitat-map-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; padding: 8px 17px; border-bottom: 1px solid #1b343d; }
.habitat-map-options span { color: var(--muted); font-size: .68rem; }
.habitat-map-frame { position: relative; aspect-ratio: 1; overflow: hidden; background: #071118; isolation: isolate; touch-action: none; cursor: grab; user-select: none; }
.habitat-map-frame.dragging { cursor: grabbing; }
.habitat-map-viewport { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.habitat-map-viewport > img,.habitat-map-viewport > canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.habitat-map-viewport > img { object-fit: contain; pointer-events: none; }
.habitat-map-viewport > canvas { z-index: 2; pointer-events: none; mix-blend-mode: screen; }
.habitat-map-message { display: none; position: absolute; z-index: 3; top: 50%; left: 50%; width: min(360px,calc(100% - 32px)); padding: 14px 16px; color: #c9dbde; text-align: center; border: 1px solid #35535c; border-radius: 11px; background: rgba(5,15,20,.88); transform: translate(-50%,-50%); }
.habitat-map-message.show { display: block; }
.habitat-zoom-controls { position: absolute; z-index: 4; right: 13px; bottom: 13px; display: flex; overflow: hidden; border: 1px solid #3b626c; border-radius: 9px; background: rgba(6,18,23,.88); }
.habitat-zoom-button { min-width: 38px; min-height: 38px; padding: 0 10px; color: #c7e2e5; border: 0; border-right: 1px solid #304e58; background: transparent; font-size: .82rem; font-weight: 900; cursor: pointer; }
.habitat-zoom-button:last-child { border-right: 0; }
.habitat-zoom-button:hover { color: #07191b; background: var(--cyan); }
.habitat-zoom-button:disabled { color: #58737a; cursor: default; background: transparent; }
.habitat-zoom-level { min-width: 64px; font-size: .67rem; }
.habitat-caption { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 49px; padding: 9px 17px; color: var(--muted); border-top: 1px solid #1b343d; font-size: .68rem; }
.habitat-legend { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }
.habitat-legend::before { content: ""; width: 11px; height: 11px; border-radius: 50%; background: #58ffd0; box-shadow: 0 0 12px rgba(88,255,208,.8); }

/* Dungeon map — habitat layout with filters + detail panel */
.dungeon-browser { position: relative; display: grid; grid-template-columns: 300px minmax(0,1fr); overflow: hidden; border: 1px solid transparent; border-radius: 20px; background: linear-gradient(var(--panel),var(--panel)) padding-box,linear-gradient(135deg,rgba(92,235,220,.42),rgba(35,59,69,.5) 42%,rgba(142,131,255,.3)) border-box; box-shadow: var(--shadow),var(--glow); }
.dungeon-index { position: absolute; inset: 0 auto 0 0; display: grid; grid-template-rows: auto auto minmax(0,1fr); width: 300px; min-height: 0; overflow: hidden; border-right: 1px solid var(--line); background: #09151b; }
.dungeon-filters { display: grid; gap: 9px; padding: 15px 14px 10px; border-bottom: 1px solid #1b343d; }
.dungeon-filters label { display: grid; gap: 5px; color: #c3dcdf; font-size: .68rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; }
.dungeon-filters input,.dungeon-filters select { width: 100%; min-height: 38px; padding: 0 10px; color: var(--text); border: 1px solid #35505a; border-radius: 8px; outline: 0; background: #0d1c22; font: inherit; font-size: .78rem; text-transform: none; letter-spacing: 0; font-weight: 600; }
.dungeon-list-count { padding: 8px 14px 6px; color: var(--muted); font-size: .68rem; }
.dungeon-list { min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-color: #31555e #0a171c; }
.dungeon-list-item { display: grid; grid-template-columns: 18px minmax(0,1fr); gap: 10px; align-items: center; width: 100%; min-height: 58px; padding: 8px 12px; color: #a8c0c5; text-align: left; border: 0; border-top: 1px solid rgba(64,93,102,.28); background: transparent; cursor: pointer; font: inherit; }
.dungeon-list-item:hover { color: var(--text); background: rgba(92,235,220,.045); }
.dungeon-list-item[aria-current="true"] { color: var(--text); background: linear-gradient(90deg,rgba(32,105,104,.4),rgba(17,43,48,.72)); box-shadow: inset 3px 0 var(--cyan); }
.dungeon-list-pin,.dungeon-pin-badge { width: 12px; height: 12px; border-radius: 50%; background: #78dcaa; box-shadow: 0 0 10px rgba(88,255,180,.55); }
.dungeon-pin-badge { width: 42px; height: 42px; border: 1px solid #365a63; border-radius: 12px; background: radial-gradient(circle at 45% 35%,#1b4048,#09161b 74%); position: relative; }
.dungeon-pin-badge::after { content: ""; position: absolute; inset: 0; margin: auto; width: 12px; height: 12px; border-radius: 50%; background: #5cebdc; box-shadow: 0 0 12px rgba(92,235,220,.85); }
.dungeon-list-copy { min-width: 0; }
.dungeon-list-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .76rem; }
.dungeon-list-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: .62rem; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dungeon-stage { grid-column: 2; min-width: 0; background: #071218; }
.dungeon-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 78px; padding: 12px 17px; border-bottom: 1px solid var(--line); background: #0c1a20; }
.dungeon-selected { display: grid; grid-template-columns: 42px minmax(0,1fr); gap: 12px; align-items: center; min-width: 0; }
.dungeon-selected strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dungeon-selected span,.dungeon-map-summary { display: block; margin-top: 3px; color: var(--muted); font-size: .7rem; }
.dungeon-map-frame { position: relative; aspect-ratio: 1; overflow: hidden; background: #071118; isolation: isolate; touch-action: none; cursor: grab; user-select: none; }
.dungeon-map-frame.dragging { cursor: grabbing; }
.dungeon-map-viewport { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.dungeon-map-viewport > img,.dungeon-map-viewport > canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.dungeon-map-viewport > img { object-fit: contain; pointer-events: none; }
.dungeon-map-viewport > canvas { z-index: 2; pointer-events: none; }
.dungeon-map-message { display: none; position: absolute; z-index: 3; top: 50%; left: 50%; width: min(360px,calc(100% - 32px)); padding: 14px 16px; color: #c9dbde; text-align: center; border: 1px solid #35535c; border-radius: 11px; background: rgba(5,15,20,.88); transform: translate(-50%,-50%); }
.dungeon-map-message.show { display: block; }
.dungeon-zoom-controls { position: absolute; z-index: 4; right: 13px; bottom: 13px; display: flex; overflow: hidden; border: 1px solid #3b626c; border-radius: 9px; background: rgba(6,18,23,.88); }
.dungeon-zoom-button { min-width: 38px; min-height: 38px; padding: 0 10px; color: #c7e2e5; border: 0; border-right: 1px solid #304e58; background: transparent; font-size: .82rem; font-weight: 900; cursor: pointer; }
.dungeon-zoom-button:last-child { border-right: 0; }
.dungeon-zoom-button:hover { color: #07191b; background: var(--cyan); }
.dungeon-zoom-button:disabled { color: #58737a; cursor: default; background: transparent; }
.dungeon-zoom-level { min-width: 64px; font-size: .67rem; }
.dungeon-detail { padding: 14px 17px 16px; border-top: 1px solid #1b343d; background: #0a161c; }
.dungeon-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.dungeon-detail h2 { margin: 0 0 8px; color: var(--cyan); font-size: .72rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.dungeon-detail ul { margin: 0; padding: 0 0 0 1.05rem; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.dungeon-detail li { margin: 0 0 4px; }


/* Download trust panel (next to primary download CTAs) */
.download-panel { display: grid; gap: 14px; margin-top: 22px; max-width: 720px; }
.download-panel .home-actions { margin-top: 0; }
.download-trust {
  display: grid; gap: 12px; padding: 14px 16px; border: 1px solid #2a505a; border-radius: 14px;
  background: linear-gradient(155deg, rgba(14,36,42,.94), rgba(8,18,22,.96));
  box-shadow: 0 12px 36px rgba(0,0,0,.22);
}
.download-saves { margin: 0; color: #c8f5f2; font-size: .86rem; line-height: 1.4; }
.download-saves strong { color: var(--cyan); font-weight: 850; }
.download-saves-detail { margin: 6px 0 0; color: var(--muted); font-size: .78rem; line-height: 1.45; }
.download-meta { display: grid; gap: 8px; margin: 0; }
.download-meta > div {
  display: grid; grid-template-columns: 108px minmax(0,1fr); gap: 10px; align-items: start;
  padding-top: 8px; border-top: 1px solid rgba(60,105,110,.35);
}
.download-meta > div:first-child { padding-top: 0; border-top: 0; }
.download-meta dt { margin: 0; color: var(--muted); font-size: .68rem; font-weight: 850; letter-spacing: .06em; text-transform: uppercase; }
.download-meta dd { margin: 0; color: var(--text); font-size: .78rem; line-height: 1.45; word-break: break-word; }
.download-meta a { color: var(--cyan); }
.download-meta code.hash {
  display: block; padding: 6px 8px; color: #bfeeea; border: 1px solid #2f555c; border-radius: 8px;
  background: #0a171c; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .62rem; line-height: 1.4; overflow-wrap: anywhere;
}
.download-trust details {
  border: 1px solid #2a4d55; border-radius: 10px; background: rgba(8,20,24,.72);
}
.download-trust summary {
  cursor: pointer; list-style: none; padding: 10px 12px; color: #d4f3f0; font-size: .76rem; font-weight: 800;
}
.download-trust summary::-webkit-details-marker { display: none; }
.download-trust summary::after { content: "+"; float: right; color: var(--cyan); font-weight: 900; }
.download-trust details[open] summary::after { content: "−"; }
.download-trust details > :not(summary) { padding: 0 12px 12px; color: var(--muted); font-size: .74rem; line-height: 1.5; }
.download-trust ul { margin: 6px 0 0; padding-left: 1.15rem; }
.download-trust li { margin: 4px 0; }
.download-trust li code { color: #c8e8e4; font-size: .7rem; }
.section-head .download-panel { margin-top: 18px; max-width: 640px; }

/* Install page — dedicated layout (do not reuse section-head flex) */
.install-layout { display: grid; gap: 36px; }
.install-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  gap: 28px 40px;
  align-items: start;
}
.install-lead { min-width: 0; }
.install-lead h1 { margin: 0; font-size: clamp(2.2rem, 4.8vw, 3.5rem); line-height: 1.05; letter-spacing: -.05em; }
.install-lede { max-width: 34rem; margin: 14px 0 22px; color: var(--muted); font-size: 1.05rem; line-height: 1.45; }
.install-lead .btn { margin-bottom: 16px; }
.install-lead .download-saves { margin-top: 0; font-size: .95rem; }
.install-lead .download-saves-detail { font-size: .88rem; }
.install-facts {
  display: grid; gap: 14px; padding: 18px 18px 16px; border: 1px solid #2a505a; border-radius: 16px;
  background: linear-gradient(155deg, rgba(14,36,42,.94), rgba(8,18,22,.96));
  box-shadow: 0 12px 36px rgba(0,0,0,.22);
}
.install-fact { display: grid; gap: 6px; padding-top: 12px; border-top: 1px solid rgba(60,105,110,.35); }
.install-fact:first-child { padding-top: 0; border-top: 0; }
.install-fact > span { color: var(--muted); font-size: .72rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.install-fact > strong { color: var(--text); font-size: 1rem; font-weight: 800; }
.install-fact > a { color: var(--cyan); font-size: .95rem; font-weight: 750; }
.install-fact code.hash {
  display: block; padding: 10px 11px; color: #bfeeea; border: 1px solid #2f555c; border-radius: 10px;
  background: #0a171c; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .72rem; line-height: 1.45; overflow-wrap: anywhere;
}
.install-steps {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px;
  margin: 0; padding: 0; list-style: none; counter-reset: install-step;
}
.install-steps li {
  position: relative; display: grid; gap: 8px; min-height: 140px; padding: 18px 16px 16px 16px;
  border: 1px solid var(--line); border-radius: 14px;
  background: linear-gradient(145deg, rgba(14,30,37,.95), rgba(8,18,23,.95));
  box-shadow: 0 14px 36px rgba(0,0,0,.16); counter-increment: install-step;
}
.install-steps li::before {
  content: counter(install-step);
  width: 2rem; height: 2rem; display: grid; place-items: center;
  color: #062023; border-radius: 9px; background: linear-gradient(100deg, var(--cyan), #8cf2d5);
  font-size: .9rem; font-weight: 900;
}
.install-steps strong { color: var(--text); font-size: 1rem; line-height: 1.25; }
.install-steps span { color: var(--muted); font-size: .9rem; line-height: 1.4; }
.install-more { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: start; }
.install-panel {
  border: 1px solid #2a4d55; border-radius: 12px; background: rgba(8,20,24,.72);
}
.install-panel summary {
  cursor: pointer; list-style: none; padding: 14px 16px; color: #e7f8f6; font-size: .95rem; font-weight: 800;
}
.install-panel summary::-webkit-details-marker { display: none; }
.install-panel summary::after { content: "+"; float: right; color: var(--cyan); font-weight: 900; }
.install-panel[open] summary::after { content: "−"; }
.install-list {
  margin: 0; padding: 0 16px 16px 1.35rem; color: var(--muted); font-size: .9rem; line-height: 1.5;
}
.install-list li { margin: 0 0 8px; padding-left: .15rem; }
.install-list li:last-child { margin-bottom: 0; }
.install-list code { padding: .08rem .32rem; color: #d4f3ef; border-radius: 4px; background: #1c2b31; font-size: .82em; }

@media (max-width: 920px) {
  .section-head { gap: 10px; }
  .install-hero { grid-template-columns: 1fr; }
  .install-steps { grid-template-columns: 1fr 1fr; }
  .install-more { grid-template-columns: 1fr; }
  .home-hero { grid-template-columns: 1fr; }
  .pal-filter-row { grid-template-columns: 1fr 1fr; }
  .pal-index-layout { grid-template-columns: 1fr; }
  .pal-detail { position: static; order: -1; }
  .pal-card-grid { grid-template-columns: repeat(3,1fr); }
  .matchup-guide-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .status-guide-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .status-effect:nth-child(4n) { border-right: 1px solid var(--line); }
  .status-effect:nth-last-child(-n+4) { border-bottom: 1px solid var(--line); }
  .status-effect:nth-child(2n) { border-right: 0; }
  .status-effect:nth-last-child(-n+2) { border-bottom: 0; }
  .habitat-browser { grid-template-columns: 234px minmax(0,1fr); }
  .habitat-index { width: 234px; }
  .dungeon-browser { grid-template-columns: 260px minmax(0,1fr); }
  .dungeon-index { width: 260px; }
  .dungeon-detail-grid { grid-template-columns: 1fr 1fr; }
}
/* Mobile: sticky header + left drawer (nav.js toggles body.nav-open). */
@media (max-width: 960px) {
  body { padding-left: 0; }

  .topbar {
    position: sticky;
    top: 0;
    left: auto;
    bottom: auto;
    z-index: 110;
    width: 100%;
    max-width: none;
    max-height: none;
    margin: 0;
    padding: 10px 14px;
    flex-direction: row;
    flex-wrap: nowrap;
    align-items: center;
    gap: 10px;
    overflow: visible;
    border-radius: 0;
    border-left: 0;
    border-right: 0;
    border-top: 0;
    /* No backdrop-filter: it would trap position:fixed nav inside the bar. */
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background: rgba(7, 18, 24, .96);
    box-shadow: 0 10px 28px rgba(0, 0, 0, .28);
  }
  .topbar.shell { width: 100%; max-width: none; }

  .nav-toggle {
    display: inline-flex;
    flex: 0 0 auto;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    width: 42px;
    height: 42px;
    margin: 0;
    padding: 0;
    border: 1px solid rgba(120, 189, 193, .28);
    border-radius: 10px;
    background: rgba(14, 40, 44, .65);
    cursor: pointer;
    color: var(--cyan);
  }
  .nav-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 1px;
    background: currentColor;
    transition: transform .2s ease, opacity .2s ease;
    transform-origin: center;
  }
  body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
  body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

  .brand {
    justify-content: flex-start;
    gap: 10px;
    min-height: 42px;
    padding: 8px 10px;
    font-size: .82rem;
    letter-spacing: .1em;
  }

  /* nav.js reparents #siteNav to body on mobile so z-index beats the backdrop. */
  #siteNav,
  body > nav[aria-label="Primary navigation"],
  .topbar nav {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 120;
    display: flex;
    width: min(288px, 88vw);
    margin: 0;
    padding: 18px 12px 24px;
    flex: none;
    flex-direction: column;
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 2px;
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior: contain;
    border: 0;
    border-right: 1px solid rgba(120, 189, 193, .22);
    border-radius: 0;
    background: rgba(5, 12, 16, .98);
    box-shadow: 18px 0 48px rgba(0, 0, 0, .45);
    transform: translateX(-105%);
    transition: transform .22s ease;
    pointer-events: none;
  }
  body.nav-open #siteNav,
  body.nav-open > nav[aria-label="Primary navigation"],
  body.nav-open .topbar nav {
    transform: translateX(0);
    pointer-events: auto;
  }

  #siteNav a,
  body > nav[aria-label="Primary navigation"] a,
  .topbar nav a {
    justify-content: flex-start;
    gap: 10px;
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    font-size: .84rem;
  }
  #siteNav a::before,
  body > nav[aria-label="Primary navigation"] a::before,
  .topbar nav a::before { width: 28px; height: 28px; }
  #siteNav a[aria-current="page"]::after,
  body > nav[aria-label="Primary navigation"] a[aria-current="page"]::after,
  .topbar nav a[aria-current="page"]::after {
    top: 10px;
    bottom: 10px;
    left: 0;
    right: auto;
    width: 3px;
    height: auto;
    border-radius: 0 2px 2px 0;
  }

  .nav-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 100;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(0, 0, 0, .55);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .nav-backdrop[hidden] { display: none !important; }
}
@media (max-width: 700px) {
  .shell { width: min(100% - 22px,1120px); }
  .section { padding: 48px 0; }
  .section-head { gap: 10px; }
  .install-steps { grid-template-columns: 1fr; }
  .install-steps li { min-height: 0; }
  .home-hero { gap: 32px; min-height: 0; padding: 50px 0; }
  .home-hero h1 { font-size: clamp(3rem,16vw,4.8rem); }
  .tool-grid,.content-grid { grid-template-columns: 1fr; }
  .pal-filter-row { grid-template-columns: 1fr; }
  .pal-card-grid { grid-template-columns: 1fr 1fr; }
  .matchup-guide-grid { grid-template-columns: 1fr; }
  .habitat-browser { grid-template-columns: 1fr; overflow: visible; }
  .habitat-index { position: static; grid-template-rows: auto auto auto; width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .habitat-stage { grid-column: 1; }
  .habitat-pal-list { display: flex; overflow-x: auto; overflow-y: hidden; }
  .habitat-pal { flex: 0 0 184px; border-top: 0; border-right: 1px solid rgba(64,93,102,.28); }
  .habitat-toolbar { align-items: flex-start; flex-direction: column; }
  .habitat-toggle-group { width: 100%; }
  .habitat-toggle { flex: 1; }
  .dungeon-browser { grid-template-columns: 1fr; overflow: visible; }
  .dungeon-index { position: static; grid-template-rows: auto auto auto; width: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .dungeon-stage { grid-column: 1; }
  .dungeon-list { max-height: 220px; }
  .dungeon-detail-grid { grid-template-columns: 1fr; }
  .dungeon-toolbar { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 480px) {
  .pal-card-grid { grid-template-columns: 1fr; }
  .status-guide-head { align-items: flex-start; flex-direction: column; gap: 3px; }
  .status-guide-grid { grid-template-columns: 1fr; }
  .status-effect,.status-effect:nth-child(2n),.status-effect:nth-child(4n),.status-effect:nth-last-child(-n+2),.status-effect:nth-last-child(-n+4) { border-right: 0; border-bottom: 1px solid var(--line); }
  .status-effect:last-child { border-bottom: 0; }
  .pal-detail-hero { grid-template-columns: 92px minmax(0,1fr); }
  .pal-detail-hero > img { width: 92px; height: 92px; }
  .habitat-map-options { align-items: flex-start; flex-direction: column; }
  .habitat-map-tabs { width: 100%; }
  .habitat-map-tab { flex: 1; }
  .habitat-caption { align-items: flex-start; flex-direction: column; gap: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition-duration: .01ms !important; }
}
