:root {
  color-scheme: light;
  --bg: #dbeedc;
  --paper: #f2f8e8;
  --panel: rgba(248, 255, 236, 0.91);
  --panel-strong: #fbfff3;
  --line: #bfd0ad;
  --line-strong: #8aaa70;
  --text: #102313;
  --muted: #526347;
  --yellow: #d5f06a;
  --red: #3f8f4a;
  --black: #0f1d12;
  --blue: #27786a;
  --green: #2f9a4c;
  --moss: #6fa043;
  --fern: #88c755;
  --cave: #283528;
  --cave-deep: #121b14;
  --shadow: 0 22px 54px rgba(18, 35, 18, 0.18);
  --soft-shadow: 0 12px 30px rgba(18, 35, 18, 0.13);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 18% 14%, rgba(140, 207, 84, 0.34), transparent 19rem),
    radial-gradient(circle at 88% 2%, rgba(43, 107, 58, 0.28), transparent 24rem),
    radial-gradient(ellipse at 50% -20%, rgba(250, 255, 229, .52) 0 20%, transparent 56%),
    linear-gradient(180deg, #3a4a35 0%, #dfeeda 30%, var(--bg) 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .86;
  background-image:
    linear-gradient(118deg, rgba(17, 27, 19, .34) 0 8%, transparent 8% 100%),
    linear-gradient(244deg, rgba(17, 27, 19, .28) 0 10%, transparent 10% 100%),
    radial-gradient(ellipse at 12% 100%, rgba(32, 54, 34, .20), transparent 22rem),
    radial-gradient(ellipse at 88% 100%, rgba(32, 54, 34, .22), transparent 24rem),
    linear-gradient(rgba(28, 51, 31, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(28, 51, 31, .05) 1px, transparent 1px);
  background-size: 220px 170px, 260px 190px, auto, auto, 42px 42px, 42px 42px;
  background-position: -40px -50px, right -50px top -70px, 0 0, 0 0, 0 0, 0 0;
  mask-image: linear-gradient(to bottom, black, rgba(0,0,0,.72) 54%, transparent 94%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    conic-gradient(from 210deg at 7% 2%, transparent 0 21deg, rgba(18, 27, 20, .56) 21deg 39deg, transparent 39deg 360deg),
    conic-gradient(from 210deg at 24% 0%, transparent 0 20deg, rgba(18, 27, 20, .45) 20deg 38deg, transparent 38deg 360deg),
    conic-gradient(from 210deg at 48% 1%, transparent 0 19deg, rgba(18, 27, 20, .50) 19deg 38deg, transparent 38deg 360deg),
    conic-gradient(from 210deg at 73% 0%, transparent 0 20deg, rgba(18, 27, 20, .47) 20deg 39deg, transparent 39deg 360deg),
    conic-gradient(from 210deg at 93% 2%, transparent 0 22deg, rgba(18, 27, 20, .58) 22deg 42deg, transparent 42deg 360deg),
    linear-gradient(180deg, rgba(16, 27, 17, .78) 0 8%, transparent 26%);
}
a { color: inherit; }
.skip-link {
  position: absolute;
  left: -999px;
  top: 1rem;
  z-index: 10;
  padding: .75rem 1rem;
  color: var(--black);
  background: var(--yellow);
  border: 2px solid var(--black);
  border-radius: 999px;
}
.skip-link:focus { left: 1rem; }
.shell { width: min(1160px, calc(100% - 32px)); margin: 0 auto; padding: 22px 0 42px; }
.topbar {
  position: sticky;
  top: 16px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(244, 255, 232, .84);
  backdrop-filter: blur(18px);
  box-shadow: var(--soft-shadow);
}
.brand, .nav, .status, .hero-actions, .control-row, .eyebrow, .panel-header { display: flex; align-items: center; gap: 10px; }
.brand { text-decoration: none; font-weight: 850; letter-spacing: -.02em; }
.brand-mark, .mini-pokeball {
  position: relative;
  display: inline-block;
  flex: none;
  border: 2px solid var(--black);
  border-radius: 50%;
  background: linear-gradient(to bottom, var(--red) 0 45%, var(--black) 45% 55%, #fff 55% 100%);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.56);
}
.brand-mark { width: 34px; height: 34px; }
.mini-pokeball { width: 18px; height: 18px; border-width: 1.5px; }
.brand-mark::after, .mini-pokeball::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 32%;
  height: 32%;
  border: inherit;
  border-radius: 50%;
  background: #fff;
  transform: translate(-50%, -50%);
}
.nav { flex-wrap: wrap; justify-content: center; }
.nav a, .nav span {
  padding: 8px 11px;
  border-radius: 999px;
  color: var(--muted);
  text-decoration: none;
  font-size: .92rem;
}
.nav a:hover, .nav a[aria-current="page"], .nav span[aria-current="page"] { color: var(--text); background: rgba(47, 154, 76, .13); }
.status { color: var(--muted); font-size: .88rem; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px rgba(47,165,106,.12); }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr);
  gap: 20px;
  align-items: stretch;
  padding: 64px 0 26px;
}
.hero-copy, .hero-panel, .section, .binder-page {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 28px;
  box-shadow: var(--shadow);
}
.hero-copy {
  position: relative;
  overflow: hidden;
  padding: clamp(28px, 5vw, 54px);
}
.hero-copy::after {
  content: "";
  position: absolute;
  right: clamp(20px, 5vw, 58px);
  bottom: clamp(18px, 4vw, 42px);
  width: clamp(92px, 16vw, 172px);
  aspect-ratio: 1;
  border: 10px solid var(--black);
  border-radius: 50%;
  opacity: .075;
  background: linear-gradient(to bottom, var(--fern) 0 45%, var(--black) 45% 55%, #f6ffe9 55% 100%);
}
.eyebrow, .kicker {
  margin: 0 0 10px;
  color: var(--red);
  font-size: .76rem;
  font-weight: 850;
  letter-spacing: .14em;
  text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 10ch; margin-bottom: 18px; font-size: clamp(3rem, 8vw, 6.4rem); line-height: .88; letter-spacing: -.075em; }
h2 { margin-bottom: 10px; font-size: clamp(1.55rem, 2.6vw, 2.25rem); letter-spacing: -.04em; }
.lead { position: relative; max-width: 760px; color: var(--muted); font-size: clamp(1.02rem, 1.7vw, 1.22rem); line-height: 1.65; }
.lead strong { color: var(--text); }
.button, .chip {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 10px 15px;
  font-weight: 850;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, background-color .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.button.primary, .chip.active { color: #fff; background: linear-gradient(135deg, #1f7a3b, #55a83f); border-color: #277a39; box-shadow: 0 8px 18px rgba(31, 122, 59, .22); }
.button.ghost, .chip { color: var(--text); background: #fbfff3; }
.button:hover, .chip:hover { transform: translateY(-1px); }
.hero-panel { padding: 22px; background: var(--panel-strong); }
.panel-header { padding-bottom: 18px; color: var(--muted); }
.panel-header code { font: inherit; font-weight: 750; }
.window-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--red); }
.window-dot:nth-child(2) { background: var(--yellow); }
.window-dot:nth-child(3) { background: var(--green); }
.metrics { display: grid; gap: 10px; margin: 0 0 18px; }
.metrics div { padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: #f0f8df; }
dt { color: var(--muted); font-size: .76rem; text-transform: uppercase; letter-spacing: .12em; }
dd { margin: 4px 0 0; font-size: 1.28rem; font-weight: 900; }
.panel-note, .section p, .info-card span { color: var(--muted); line-height: 1.6; }
.section { margin: 20px 0; padding: 24px; }
.controls {
  display: grid;
  gap: 16px;
}
.controls > div + * { width: 100%; }
.filters-panel {
  display: grid;
  gap: 12px;
  min-width: min(100%, 440px);
  max-width: min(100%, 720px);
}
.set-tabs {
  flex-wrap: wrap;
  gap: 10px;
}
.control-row {
  flex-wrap: wrap;
  justify-content: flex-start;
}
.search-label { color: var(--muted); font-size: .76rem; font-weight: 850; letter-spacing: .12em; text-transform: uppercase; }
.search-input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 12px 16px;
  color: var(--text);
  background: #fff;
  font: inherit;
}
.search-input::placeholder { color: #9b9288; }
.search-input:focus { outline: 3px solid rgba(136, 199, 85, .38); border-color: var(--fern); }
.binder-section { position: relative; display: grid; grid-template-columns: 34px 1fr; gap: 0; margin: 26px 0; }
.binder-spine {
  display: grid;
  place-items: center;
  gap: 34px;
  padding: 38px 0;
  border: 1px solid #264f2d;
  border-right: 0;
  border-radius: 24px 0 0 24px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.12) 0 1px, transparent 1px) 0 0 / 9px 100%,
    linear-gradient(180deg, #2f6f34, #173f23);
  box-shadow: var(--soft-shadow);
}
.binder-spine span { width: 14px; height: 14px; border-radius: 50%; background: #fff; box-shadow: inset 0 0 0 3px var(--black); }
.binder-page {
  border-radius: 0 28px 28px 0;
  padding: clamp(18px, 3vw, 30px);
  background:
    radial-gradient(circle at 18% 14%, rgba(73, 118, 56, .09), transparent 9rem),
    radial-gradient(circle at 85% 22%, rgba(73, 118, 56, .08), transparent 10rem),
    linear-gradient(90deg, rgba(29, 51, 31, .055) 0 1px, transparent 1px) 0 0 / 33.333% 100%,
    linear-gradient(180deg, rgba(29, 51, 31, .055) 0 1px, transparent 1px) 0 0 / 100% 33.333%,
    var(--paper);
}
.section-heading.split { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.section-badge { flex: none; padding: 8px 12px; border-radius: 999px; color: var(--black); background: #d8f28a; border: 1px solid #a7c95c; font-weight: 900; }
.binder-pages { display: grid; gap: 28px; margin-top: 22px; }
.binder-subpage { padding-top: 6px; border-top: 1px solid var(--line); }
.binder-subpage:first-child { border-top: 0; padding-top: 0; }
.subpage-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; color: var(--muted); }
.subpage-heading h3 { margin: 0; color: var(--text); font-size: 1.12rem; }
.pocket-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(12px, 2vw, 18px); margin-top: 20px; }
.pocket {
  position: relative;
  min-height: 330px;
  padding: 13px;
  border: 1px solid rgba(29,29,31,.12);
  border-radius: 18px;
  background: rgba(253, 255, 246, .78);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.72), 0 12px 26px rgba(29,29,31,.08);
  transition: transform .18s ease, box-shadow .18s ease;
}
.pocket::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(29,29,31,.07);
  border-radius: 14px;
  pointer-events: none;
}
.status-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 850;
  color: #fff;
  background: var(--black);
  border: 1px solid rgba(255,255,255,.5);
}
.status-missing { background: #826343; }
.status-owned { background: var(--green); }
.pocket[hidden] { display: none; }
.pocket:hover { transform: translateY(-3px); box-shadow: inset 0 0 0 1px rgba(255,255,255,.72), 0 16px 34px rgba(29,29,31,.12); }
.pocket img { display: block; width: min(100%, 232px); margin: 0 auto; border-radius: 12px; box-shadow: 0 10px 24px rgba(29,29,31,.18); }
.card-art-link { position: relative; z-index: 1; display: block; border-radius: 14px; }
.card-art-link:focus { outline: 3px solid rgba(136, 199, 85, .62); outline-offset: 4px; }
.card-meta { position: relative; z-index: 1; margin-top: 12px; display: grid; gap: 3px; text-align: center; }
.card-meta strong { font-size: 1rem; }
.card-meta span { color: var(--muted); font-size: .85rem; }
.card-meta .rarity { color: var(--blue); font-weight: 850; }
.price-list { position: relative; z-index: 1; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 12px 0 0; }
.price-list div { padding: 9px; border: 1px solid var(--line); border-radius: 12px; text-align: center; background: #f8ffe9; }
.price-list dd { font-size: .98rem; }
.card-links { position: relative; z-index: 1; display: flex; justify-content: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.card-links a { padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 999px; color: var(--text); background: #fbfff3; font-size: .82rem; font-weight: 850; text-decoration: none; }
.card-links a.disabled { color: #8e8580; border-color: #d1ccc3; cursor: not-allowed; }
.card-links a:hover { background: #e9f9c8; border-color: #91bd52; }
.card-links a.disabled:hover { background: #fff; border-color: #d1ccc3; }
.empty { display: grid; place-content: center; text-align: center; min-height: 330px; border-style: dashed; color: var(--muted); background: rgba(255,255,255,.42); }
.empty span { display: block; color: var(--text); font-weight: 900; font-size: 1.15rem; }
.empty em { color: var(--red); font-style: normal; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.info-card { padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: #fbfff3; }
.info-card strong { display: block; margin-bottom: 8px; font-size: 1.05rem; }
.loading { margin: 0; padding: 24px; border: 1px dashed var(--line-strong); border-radius: 18px; color: var(--muted); text-align: center; background: rgba(251,255,243,.68); }
.error { color: #991b1b; border-color: rgba(227, 53, 43, .55); }
.footer { display: flex; justify-content: space-between; gap: 14px; padding-top: 18px; color: var(--muted); font-size: .9rem; }

@media (max-width: 920px) {
  .topbar, .controls, .section-heading.split, .footer { align-items: flex-start; flex-direction: column; }
  .topbar { border-radius: 24px; }
  .hero { grid-template-columns: 1fr; padding-top: 36px; }
  .pocket-grid, .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
  .shell { width: min(100% - 20px, 1180px); }
  .binder-section { grid-template-columns: 24px 1fr; }
  .pocket-grid, .card-grid { grid-template-columns: 1fr; }
  .pocket { min-height: 300px; }
  .nav { justify-content: flex-start; }
}

/* Combined collection details + browser controls */
.collection-summary {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) minmax(280px, 1fr) minmax(320px, 1.15fr);
  gap: 22px;
  align-items: stretch;
  margin-top: 36px;
  background: var(--panel);
}
.collection-copy,
.collection-details,
.collection-controls {
  min-width: 0;
}
.collection-copy {
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 8px;
}
.collection-copy h1 {
  max-width: 14ch;
  margin-bottom: 8px;
  font-size: clamp(2.15rem, 4.2vw, 4.1rem);
  line-height: .95;
  letter-spacing: -.055em;
}
.collection-details,
.collection-controls {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--panel);
}
.collection-controls {
  display: grid;
  gap: 14px;
}
.controls-heading h2 {
  margin-bottom: 8px;
}
.search-label,
.select-label {
  color: var(--muted);
  font-size: .76rem;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.search-input,
.select-input {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 12px 16px;
  color: var(--text);
  background-color: #fff;
  font: inherit;
}
.select-input {
  appearance: none;
  padding-right: 44px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--text) 50%),
    linear-gradient(135deg, var(--text) 50%, transparent 50%),
    linear-gradient(135deg, rgba(47, 154, 76, .13), rgba(136, 199, 85, .20));
  background-position:
    calc(100% - 22px) 52%,
    calc(100% - 16px) 52%,
    100% 0;
  background-size: 6px 6px, 6px 6px, 42px 100%;
  background-repeat: no-repeat;
  cursor: pointer;
}
.search-input:focus,
.select-input:focus {
  outline: 3px solid rgba(136, 199, 85, .38);
  border-color: var(--fern);
}
@media (max-width: 1040px) {
  .collection-summary {
    grid-template-columns: 1fr 1fr;
    margin-top: 36px;
  }
  .collection-controls {
    grid-column: 1 / -1;
  }
}
@media (max-width: 720px) {
  .collection-summary {
    grid-template-columns: 1fr;
  }
}
