:root {
  --bg: #070708;
  --bg-elev: #111114;
  --bg-card: #16161a;
  --bg-card-hover: #1c1c22;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #fafafa;
  --muted: #d4d4d8;
  --faint: #a1a1aa;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.16);
  --good: #34d399;
  --warn: #fbbf24;
  --font-display: "Sora", sans-serif;
  --font-body: "IBM Plex Sans", sans-serif;
  --r: 14px;
  --r-sm: 10px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.45);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-body);
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(59, 130, 246, 0.18), transparent 55%),
    radial-gradient(ellipse 60% 40% at 90% 0%, rgba(16, 185, 129, 0.08), transparent 50%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.55;
  letter-spacing: 0.01em;
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app-shell { min-height: 100vh; padding-bottom: 5rem; }

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.9rem 1.25rem;
  background: rgba(7, 7, 8, 0.82);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.topbar-brand-row { display: flex; align-items: center; gap: 0.55rem; min-width: 0; }
.brand { display: flex; align-items: center; gap: 0.7rem; text-decoration: none; color: var(--text); }
.brand-mark {
  width: 28px; height: 28px; border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #22d3ee);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.12), 0 8px 20px rgba(37, 99, 235, 0.35);
}
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 1.08rem; letter-spacing: -0.01em; line-height: 1.2; }
.topbar-info {
  appearance: none;
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.topbar-info:hover,
.topbar-info[aria-expanded="true"] {
  border-color: var(--line-strong);
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}
.eyebrow {
  font-size: 0.7rem; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 0.35rem;
}

.featured {
  padding: 1.25rem 1.25rem 0.5rem;
  border-bottom: 1px solid var(--line);
}
.featured-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem;
  margin-bottom: 0.9rem;
}
.featured-title {
  font-family: var(--font-display); font-weight: 700; font-size: 1.4rem;
  letter-spacing: -0.015em; line-height: 1.25;
}
.featured-nav { display: flex; gap: 0.4rem; }
.featured-rail {
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 0.75rem;
  scrollbar-width: thin;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  cursor: grab;
}
.featured-rail.is-dragging {
  cursor: grabbing;
  user-select: none;
}
.featured-seq {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(160px, 200px);
  gap: 0.85rem;
  flex: 0 0 auto;
  padding-right: 0.85rem;
}
.feat-card {
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  cursor: pointer;
  color: inherit;
  text-align: left;
  font: inherit;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}
.feat-card:hover {
  transform: translateY(-3px);
  border-color: rgba(59, 130, 246, 0.35);
  background: var(--bg-card-hover);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}
.feat-media {
  position: relative;
  aspect-ratio: 5 / 8;
  overflow: hidden;
  background: #0c0c0e;
}
.feat-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
  display: block;
  background: #0c0c0e;
  padding: 0.2rem 0.12rem 0.3rem;
}
.feat-banner {
  top: 1rem;
  left: -1.2rem;
  width: 5.8rem;
}
.feat-banner .m-pack-banner-text {
  font-size: 0.55rem;
}
.feat-body {
  padding: 0.75rem 0.8rem 0.9rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  background: transparent;
}
.feat-name {
  color: var(--text);
  font-weight: 600;
  font-size: 0.92rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.feat-set {
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}
.feat-foot {
  margin-top: auto;
  padding-top: 0.45rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.market {
  display: grid; grid-template-columns: 260px minmax(0, 1fr);
  gap: 0; min-height: 70vh;
}
@media (max-width: 960px) {
  .market { grid-template-columns: 1fr; }
  .filters {
    position: fixed; inset: 0 auto 0 0; width: min(320px, 88vw); z-index: 50;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow);
  }
  .filters.open { transform: translateX(0); }
  .filters-toggle { display: inline-flex !important; }
}

.filters {
  border-right: 1px solid var(--line);
  background: rgba(10, 10, 12, 0.92);
  padding: 1.1rem 1rem 2rem;
  overflow-y: auto;
}
.filters-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.filters-head h2 { font-family: var(--font-display); font-size: 1rem; font-weight: 800; }
.filter-block { display: block; margin-bottom: 1.15rem; }
.filter-label {
  display: block; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint); margin-bottom: 0.45rem;
}
.chip-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  appearance: none; border: 1px solid var(--line); background: transparent;
  color: var(--muted); border-radius: 999px; padding: 0.35rem 0.7rem;
  font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.chip:hover { border-color: var(--line-strong); color: var(--text); }
.chip.active {
  background: var(--accent-soft); border-color: rgba(59, 130, 246, 0.45); color: #dbeafe;
}

.catalog { padding: 1rem 1.15rem 2.5rem; }
.catalog-toolbar {
  display: flex; gap: 0.65rem; align-items: center; margin-bottom: 0.85rem;
}
.search-wrap {
  flex: 1; display: flex; align-items: center; gap: 0.55rem;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 0.65rem 0.85rem;
  transition: border-color 0.15s ease;
}
.search-wrap:focus-within { border-color: rgba(59, 130, 246, 0.5); }
.search-icon { color: var(--faint); font-size: 1rem; }
.search-wrap input {
  flex: 1; border: 0; outline: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 0.95rem;
}
.toolbar-actions { display: flex; gap: 0.45rem; }
.filters-toggle { display: none; }

.select {
  width: 100%; appearance: none;
  background: var(--bg-elev) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%71717a' d='M1 1l5 5 5-5'/%3E%3C/svg%3E") right 0.75rem center no-repeat;
  border: 1px solid var(--line); color: var(--text); border-radius: var(--r-sm);
  padding: 0.6rem 2rem 0.6rem 0.75rem; font: inherit; font-size: 0.85rem;
}
.select-compact { width: auto; min-width: 140px; }

.set-picker { position: relative; }
.set-picker-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.set-picker-btn:hover { border-color: var(--line-strong); background: var(--bg-card); }
.set-picker.open .set-picker-btn {
  border-color: rgba(59, 130, 246, 0.45);
  background: var(--bg-card);
}
.set-picker-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.set-picker-caret {
  color: var(--faint);
  font-size: 0.75rem;
  transition: transform 0.16s ease;
}
.set-picker.open .set-picker-caret { transform: rotate(180deg); }
.set-picker-menu {
  margin-top: 0.4rem;
  max-height: min(280px, 42vh);
  overflow-y: auto;
  background: #141418;
  border: 1px solid var(--line-strong);
  border-radius: var(--r-sm);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  padding: 0.35rem;
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}
.set-picker.open .set-picker-menu {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}
.set-picker-menu[hidden] { display: none; }
.set-picker.open .set-picker-menu[hidden] { display: block; }
.set-picker-option {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 8px;
  padding: 0.5rem 0.55rem;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 550;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease, color 0.12s ease;
}
.set-picker-option:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}
.set-picker-option.active {
  background: var(--accent-soft);
  color: #bfdbfe;
}
.set-picker-option .set-count {
  flex: none;
  color: var(--faint);
  font-size: 0.72rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.set-picker-option.active .set-count { color: #93c5fd; }
.set-picker-heading {
  padding: 0.6rem 0.55rem 0.3rem;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint);
}
.set-picker-heading:not(:first-child) { border-top: 1px solid var(--line); margin-top: 0.3rem; }
.set-picker-empty {
  padding: 0.7rem 0.55rem;
  color: var(--faint);
  font-size: 0.8rem;
  text-align: center;
}

.icon-btn, .text-btn {
  appearance: none; border: 1px solid var(--line); background: var(--bg-elev);
  color: var(--text); border-radius: var(--r-sm); cursor: pointer; font: inherit;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}
.icon-btn {
  width: 40px; height: 40px; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1.15rem;
}
.icon-btn:hover, .text-btn:hover { border-color: var(--line-strong); background: var(--bg-card); }
.text-btn {
  padding: 0.45rem 0.75rem; font-size: 0.8rem; font-weight: 650; color: var(--muted);
}

.batch-strip {
  display: flex; gap: 0.45rem; flex-wrap: wrap; margin-bottom: 1rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 168px));
  justify-content: start;
  gap: 0.85rem;
}
@media (min-width: 1200px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(156px, 176px)); }
}

.grid.is-checklist { display: block; }
.checklist {
  width: 100%; border-collapse: collapse; font-size: 0.85rem;
  border: 1px solid var(--line); border-radius: var(--r-sm); overflow: hidden;
}
.checklist th {
  text-align: left; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--faint); background: var(--bg-elev);
  padding: 0.6rem 0.75rem; border-bottom: 1px solid var(--line-strong);
}
.checklist td {
  padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); color: var(--muted);
  vertical-align: top;
}
.checklist tbody tr:last-child td { border-bottom: 0; }
.checklist tbody tr:hover td { background: var(--bg-card); }
.checklist .cl-name { color: var(--text); font-weight: 600; }
.checklist .cl-grade, .checklist .cl-lang { white-space: nowrap; }
@media (max-width: 640px) {
  .checklist { font-size: 0.78rem; }
  .checklist th, .checklist td { padding: 0.45rem 0.5rem; }
}

.grid-skeleton { display: contents; }
.skel-card {
  aspect-ratio: 3/4.6; border-radius: var(--r); background: linear-gradient(90deg, #141418, #1b1b22, #141418);
  background-size: 200% 100%; animation: shimmer 1.2s linear infinite;
}
@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.m-card {
  background: var(--bg-card); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; cursor: pointer; text-align: left; color: inherit;
  display: flex; flex-direction: column;
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
  animation: cardIn 0.35s ease both;
  perspective: 900px;
}
.m-card:hover {
  border-color: rgba(59, 130, 246, 0.35);
  background: var(--bg-card-hover);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.m-card-media {
  position: relative;
  aspect-ratio: 5 / 8;
  background: #0c0c0e;
  overflow: hidden;
  perspective: 760px;
}
.m-card-tilt {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transform: rotateX(0deg) rotateY(0deg);
  transition: transform 0.35s ease;
  will-change: transform;
}
.m-card.is-tilting .m-card-tilt {
  transition: transform 0.08s ease-out;
}
.m-card-media img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center top;
  display: block;
  background: #0c0c0e;
  padding: 0.2rem 0.12rem 0.3rem;
}
.m-card-media img.pack-fallback {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 150%;
  height: 150%;
  max-width: none;
  padding: 0;
  margin: 0;
  object-fit: contain;
  object-position: center;
  background: transparent;
  transform: translate3d(-50%, -50%, 0);
}
.m-card-glare {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  z-index: 3;
  mix-blend-mode: soft-light;
  transition: opacity 0.25s ease;
  background: radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.35), transparent 55%);
}
.m-card.is-tilting .m-card-glare { opacity: 1; }
.m-card-media .ph {
  width: 100%; height: 100%; display: grid; place-items: center;
  color: var(--faint); font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase;
}
.m-pack-banner {
  --banner-fold: #6b6b73;
  position: absolute;
  top: 1.2rem;
  left: -1.35rem;
  z-index: 2;
  width: 6.6rem;
  padding: 0.28rem 0 0.3rem;
  text-align: center;
  transform: rotate(-45deg);
  isolation: isolate;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.28) inset,
    0 -1px 0 rgba(0, 0, 0, 0.28) inset,
    0 8px 18px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
.m-pack-banner::before,
.m-pack-banner::after {
  content: "";
  position: absolute;
  top: 100%;
  width: 0;
  height: 0;
  border-style: solid;
  z-index: 0;
}
.m-pack-banner::before {
  left: 0;
  border-width: 0.4rem 0.4rem 0 0;
  border-color: var(--banner-fold) transparent transparent transparent;
}
.m-pack-banner::after {
  right: 0;
  border-width: 0.4rem 0 0 0.4rem;
  border-color: var(--banner-fold) transparent transparent transparent;
}
.m-pack-shine {
  position: absolute;
  inset: -35% -55%;
  background: linear-gradient(
    110deg,
    transparent 28%,
    rgba(255, 255, 255, 0.12) 40%,
    rgba(255, 255, 255, 0.78) 50%,
    rgba(255, 255, 255, 0.12) 60%,
    transparent 72%
  );
  transform: translateX(-140%) skewX(-12deg);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  animation: foilPulse 4.8s ease-in-out infinite;
}
.m-pack-banner.is-shining .m-pack-shine {
  animation: foilSweep 1.15s cubic-bezier(0.33, 0.2, 0.25, 1) both, foilPulse 4.8s ease-in-out 1.2s infinite;
}
.m-pack-banner-text {
  position: relative;
  z-index: 2;
  display: block;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 0.61rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.15;
  white-space: nowrap;
  padding: 0 0.65rem;
  -webkit-text-stroke: 0.25px currentColor;
  paint-order: stroke fill;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.2);
}
.m-pack-banner.tone-silver {
  --banner-fold: #5c5c66;
  background: linear-gradient(180deg, #fafafa 0%, #d4d4d8 42%, #a1a1aa 100%);
  color: #18181b;
}
.m-pack-banner.tone-gold {
  --banner-fold: #8a6508;
  background: linear-gradient(180deg, #fff1c2 0%, #e8b923 45%, #b8860b 100%);
  color: #3b2a08;
}
.m-pack-banner.tone-gold .m-pack-banner-text {
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}
.m-pack-banner.tone-black {
  --banner-fold: #000;
  background: linear-gradient(180deg, #52525b 0%, #18181b 55%, #09090b 100%);
  color: #fafafa;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.14) inset,
    0 -1px 0 rgba(0, 0, 0, 0.55) inset,
    0 8px 18px rgba(0, 0, 0, 0.5);
}
.m-pack-banner.tone-black .m-pack-banner-text {
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.55);
}
.m-pack-banner.tone-blue {
  --banner-fold: #1e3a8a;
  background: linear-gradient(180deg, #bfdbfe 0%, #3b82f6 48%, #1d4ed8 100%);
  color: #eff6ff;
}
.m-pack-banner.flat {
  position: relative;
  top: auto;
  left: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  max-width: 100%;
  margin: 0 0 0.85rem;
  padding: 0.42rem 0.95rem;
  transform: none;
  border-radius: 4px;
  overflow: hidden;
  isolation: isolate;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.28) inset,
    0 -1px 0 rgba(0, 0, 0, 0.28) inset,
    0 4px 12px rgba(0, 0, 0, 0.28);
}
.m-pack-banner.flat::before,
.m-pack-banner.flat::after {
  display: none;
}
.m-pack-banner.flat .m-pack-banner-text {
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  padding: 0;
  overflow: visible;
  text-overflow: unset;
}
@keyframes foilSweep {
  0% { opacity: 0; transform: translateX(-140%) skewX(-12deg); }
  18% { opacity: 1; }
  100% { opacity: 0; transform: translateX(140%) skewX(-12deg); }
}
@keyframes foilPulse {
  0%, 58% { opacity: 0; transform: translateX(-140%) skewX(-12deg); }
  68% { opacity: 1; }
  86% { opacity: 0.2; transform: translateX(140%) skewX(-12deg); }
  100% { opacity: 0; transform: translateX(140%) skewX(-12deg); }
}
.m-card-body { padding: 0.75rem 0.8rem 0.9rem; display: flex; flex-direction: column; gap: 0.35rem; flex: 1; }
.m-card-name {
  color: var(--text); font-weight: 600; font-size: 0.92rem; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.m-card-set { color: var(--muted); font-size: 0.8rem; line-height: 1.45; }
.m-card-foot {
  margin-top: auto; padding-top: 0.45rem;
  display: flex; align-items: center; justify-content: space-between; gap: 0.5rem;
}
.grade-pill {
  font-size: 0.68rem; font-weight: 800; padding: 0.2rem 0.45rem; border-radius: 6px;
  background: rgba(255,255,255,0.06); color: #e4e4e7;
}
.grade-pill.g10 { background: rgba(16, 185, 129, 0.16); color: #6ee7b7; }
.grade-pill.g9 { background: rgba(59, 130, 246, 0.16); color: #93c5fd; }
.qty-pill {
  font-family: var(--font-display); font-weight: 800; font-size: 0.78rem; color: #93c5fd;
}

.empty {
  grid-column: 1 / -1; padding: 3rem 1rem; text-align: center; color: var(--muted);
}

.pager {
  display: flex; align-items: center; justify-content: center; gap: 1rem;
  margin-top: 1.5rem; color: var(--muted); font-size: 0.85rem;
}

.results-pill {
  position: fixed; left: 50%; bottom: 1.25rem; transform: translateX(-50%);
  z-index: 30; background: rgba(20, 20, 24, 0.92); border: 1px solid var(--line-strong);
  color: var(--text); border-radius: 999px; padding: 0.55rem 1rem;
  font-size: 0.82rem; font-weight: 650; backdrop-filter: blur(12px);
  box-shadow: var(--shadow); animation: pillIn 0.35s ease both;
}
@keyframes pillIn {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.previous {
  padding: 2rem 1.25rem 1.5rem;
  border-top: 1px solid var(--line);
}
.previous-head { max-width: 40rem; cursor: pointer; list-style: none; }
.previous-head::-webkit-details-marker { display: none; }
.previous-collapse[open] > .previous-head { margin-bottom: 1.1rem; }
.previous-head:hover .previous-title { color: #dbeafe; }
.previous-caret {
  display: inline-block; font-size: 0.9rem; color: var(--faint);
  transform: rotate(-90deg); transition: transform 0.16s ease;
}
.previous-collapse[open] .previous-caret { transform: rotate(0deg); }
.previous-title {
  font-family: var(--font-display); font-weight: 700; font-size: 1.35rem;
  letter-spacing: -0.015em; line-height: 1.25; margin-top: 0.15rem;
}
.previous-note {
  color: var(--muted); font-size: 0.9rem; margin-top: 0.45rem; line-height: 1.5;
}
.previous-groups { display: grid; gap: 1.5rem; }
.previous-group-title {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--faint); margin-bottom: 0.6rem;
}
.previous-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.75rem;
}
.previous-card {
  appearance: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  text-align: left;
  padding: 1rem 1.05rem;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--bg-card);
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.15s ease;
}
.previous-card:hover {
  border-color: rgba(59, 130, 246, 0.35);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
}
.previous-card.active {
  border-color: rgba(59, 130, 246, 0.55);
  background: rgba(59, 130, 246, 0.1);
}
.previous-card-name {
  font-weight: 650;
  font-size: 0.95rem;
  line-height: 1.35;
}
.previous-card-meta {
  color: var(--muted);
  font-size: 0.8rem;
}

.site-foot {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  align-items: center;
  padding: 1.5rem 1.25rem; color: var(--faint); font-size: 0.78rem;
  border-top: 1px solid var(--line); margin-top: 1rem;
}
.site-foot-sync {
  color: var(--faint);
}

.drawer[hidden] { display: none; }
.drawer {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center;
  padding: 1rem;
}
.drawer-backdrop {
  position: absolute; inset: 0; background: rgba(0,0,0,0.62);
  animation: fadeIn 0.2s ease both;
}
.drawer-panel {
  position: relative; z-index: 1; width: min(920px, 100%);
  max-height: min(88vh, 720px);
  background: #101014; border: 1px solid var(--line-strong);
  border-radius: 18px; box-shadow: var(--shadow);
  animation: riseIn 0.22s ease both;
  overflow: hidden;
}
.drawer-panel.is-shining {
  animation: riseIn 0.22s ease both, panelGlow 0.9s ease both;
}
@keyframes panelGlow {
  0% { box-shadow: var(--shadow), 0 0 0 0 rgba(255, 255, 255, 0); }
  35% { box-shadow: var(--shadow), 0 0 0 1px rgba(255, 255, 255, 0.18), 0 0 36px rgba(255, 255, 255, 0.12); }
  100% { box-shadow: var(--shadow), 0 0 0 0 rgba(255, 255, 255, 0); }
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes riseIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.drawer.closing .drawer-backdrop { animation: fadeOut 0.18s ease both; }
.drawer.closing .drawer-panel { animation: riseOut 0.18s ease both; }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes riseOut {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(12px) scale(0.98); }
}
.drawer-close {
  position: absolute; top: 0.75rem; right: 0.75rem; z-index: 2;
  width: 36px; height: 36px; border-radius: 999px; border: 1px solid var(--line);
  background: rgba(0,0,0,0.55); color: var(--text); font-size: 1.25rem; cursor: pointer;
}
.info-drawer { z-index: 90; }
.info-panel {
  width: min(720px, 100%);
  max-height: min(88vh, 760px);
  overflow: auto;
}
.info-body { padding: 1.6rem 1.5rem 1.5rem; }
.info-body .eyebrow { margin-bottom: 0.45rem; }
.info-body h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.35rem, 3vw, 1.7rem);
  letter-spacing: -0.02em;
  line-height: 1.25;
  margin-bottom: 0.75rem;
}
.info-lead {
  color: var(--muted);
  font-size: 0.98rem;
  line-height: 1.55;
  margin-bottom: 1.25rem;
  max-width: 52ch;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.15rem;
}
.info-card {
  padding: 0.95rem 1rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}
.info-card h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
  letter-spacing: -0.01em;
}
.info-card p {
  color: var(--faint);
  font-size: 0.86rem;
  line-height: 1.5;
}
.info-foot {
  color: var(--faint);
  font-size: 0.84rem;
  line-height: 1.5;
  border-top: 1px solid var(--line);
  padding-top: 0.95rem;
}
.info-foot a { color: #93c5fd; text-decoration: none; }
.info-foot a:hover { text-decoration: underline; }
@media (max-width: 640px) {
  .info-grid { grid-template-columns: 1fr; }
  .info-body { padding: 1.35rem 1.15rem 1.25rem; }
}
.drawer-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(240px, 0.95fr);
  align-items: stretch;
  min-height: min(72vh, 620px);
  max-height: min(88vh, 720px);
}
.drawer-media {
  position: relative;
  background: #0a0a0c;
  display: grid;
  place-items: center;
  padding: 1rem 0.75rem 1rem 1rem;
  min-height: 0;
  overflow: hidden;
}
.drawer-media::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    115deg,
    transparent 35%,
    rgba(255, 255, 255, 0.04) 44%,
    rgba(255, 255, 255, 0.22) 50%,
    rgba(255, 255, 255, 0.04) 56%,
    transparent 65%
  );
  transform: translateX(-140%) skewX(-12deg);
  opacity: 0;
  pointer-events: none;
  z-index: 1;
  animation: foilPulse 5.2s ease-in-out infinite;
}
.drawer-media.is-shining::after {
  animation: foilSweep 1.2s cubic-bezier(0.33, 0.2, 0.25, 1) both, foilPulse 5.2s ease-in-out 1.25s infinite;
}
.drawer-media img {
  width: 100%;
  height: 100%;
  max-height: min(76vh, 640px);
  object-fit: contain;
  display: block;
}
.drawer-media img.pack-fallback {
  width: min(640px, 145%);
  max-width: none;
  max-height: min(88vh, 820px);
  margin: 0 auto;
  padding: 0;
  background: transparent;
  object-fit: contain;
}
.drawer-media img.slab-burst {
  animation: slabBurstIn 0.7s cubic-bezier(0.16, 0.84, 0.28, 1) both;
}
.drawer-media.has-burst::before {
  content: "";
  position: absolute;
  inset: 18% 22%;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.45), transparent 68%);
  pointer-events: none;
  z-index: 2;
  animation: slabBurstFlash 0.7s ease-out both;
}
@keyframes slabBurstIn {
  0% {
    opacity: 0;
    filter: blur(10px) brightness(1.6);
    transform: scale(0.72);
  }
  55% {
    opacity: 1;
    filter: blur(0) brightness(1.15);
    transform: scale(1.04);
  }
  100% {
    opacity: 1;
    filter: none;
    transform: scale(1);
  }
}
@keyframes slabBurstFlash {
  0% { opacity: 0; transform: scale(0.4); }
  35% { opacity: 1; }
  100% { opacity: 0; transform: scale(1.35); }
}
.drawer-body {
  padding: 1.5rem 1.5rem 1.5rem 1.1rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.15rem;
  min-width: 0;
  border-left: 1px solid var(--line);
}
.drawer-body h3 {
  font-family: var(--font-display); font-size: clamp(1.25rem, 2.4vw, 1.65rem); font-weight: 700;
  letter-spacing: -0.015em; margin-bottom: 0.4rem; color: var(--text); line-height: 1.3;
}
.drawer-set { color: var(--muted); font-size: 0.95rem; margin-bottom: 0.85rem; line-height: 1.45; }
.drawer-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0.65rem; margin-bottom: 0.65rem; }
.drawer-cert {
  color: var(--text);
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 1rem;
}
.badge {
  display: inline-flex; align-items: center; padding: 0.25rem 0.55rem; border-radius: 7px;
  background: var(--accent-soft); color: #bfdbfe; font-size: 0.78rem; font-weight: 800;
}
.meta-muted { color: var(--muted); font-size: 0.88rem; }

@media (max-width: 760px) {
  .drawer { place-items: end center; padding: 0; }
  .drawer-panel {
    width: 100%;
    max-height: min(92vh, 900px);
    border-radius: 20px 20px 0 0;
    overflow: auto;
  }
  .drawer-layout {
    grid-template-columns: 1fr;
    min-height: 0;
    max-height: none;
  }
  .drawer-media {
    padding: 1rem 1rem 0.25rem;
    max-height: 48vh;
  }
  .drawer-media img { max-height: 44vh; }
  .drawer-body {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding: 1.1rem 1.2rem 1.5rem;
    justify-content: flex-start;
  }
}
