/* Catalog page. Builds on the tokens and nav in styles.css. */
.nav nav a[aria-current="page"] { color: var(--text); box-shadow: inset 0 -2px 0 var(--orange); }

.catalog { max-width: 1240px; margin: 0 auto; padding: clamp(24px, 4vw, 48px) var(--gutter) 72px; font-size: 16px; }
.cat-head h1 { font-size: clamp(34px, 5vw, 56px); }
.cat-note { color: var(--muted); font-size: 15px; margin-top: 12px; }

/* Toolbar */
.cat-tools { display: grid; gap: 14px; margin: 28px 0 22px; }
.cat-search label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.cat-search input { width: 100%; min-height: 52px; padding: 0 20px; border-radius: 16px; border: 2px solid var(--border); background: var(--panel); color: var(--text); font: inherit; font-size: 17px; }
.cat-search input::placeholder { color: #9EB2C8; }
.cat-search input:focus { outline: none; border-color: var(--blue); box-shadow: none; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 38px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--border); background: rgba(12, 32, 56, 0.7); color: var(--sub); font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
.chip:hover { color: var(--text); border-color: var(--border-strong); }
.chip[aria-pressed="true"] { border-color: var(--orange); background: rgba(255, 122, 26, 0.18); color: #FFD9BD; }
.chip.th[aria-pressed="true"] { border-color: #F2B90F; background: #3A2A05; color: #FFD75A; }
.chip.sth[aria-pressed="true"] { border-color: #A855F7; background: #2B1250; color: #EBD8FF; }
.cat-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.cat-select { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.cat-select select { min-height: 38px; padding: 0 12px; border-radius: 12px; border: 1.5px solid var(--border); background: var(--panel); color: var(--text); font: inherit; font-size: 14px; font-weight: 700; letter-spacing: 0; text-transform: none; }
.cat-count { margin-left: auto; color: var(--muted); font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* List + detail */
.cat-body { display: grid; grid-template-columns: minmax(280px, 380px) minmax(0, 1fr); gap: 24px; align-items: start; }
.cat-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.cat-row { display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 8px 14px 8px 8px; border-radius: 16px; border: 1.5px solid transparent; color: var(--text); text-decoration: none; }
.cat-row:hover { background: rgba(12, 32, 56, 0.7); }
.cat-row[aria-current="true"] { background: var(--panel); border-color: var(--orange); }
.cat-thumb { width: 76px; height: 54px; border-radius: 12px; background: radial-gradient(ellipse at 50% 85%, #1B4273, #0A1A30 70%); display: grid; place-items: center; overflow: hidden; }
.cat-thumb img { width: 88%; height: 88%; object-fit: contain; }
.cat-row strong { display: block; font-weight: 800; font-size: 16px; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-row small { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; border: 1.5px solid; font-size: 12px; font-weight: 900; letter-spacing: 0.04em; white-space: nowrap; }
.badge.th { background: #3A2A05; border-color: #F2B90F; color: #FFD75A; }
.badge.sth { background: #2B1250; border-color: #A855F7; color: #EBD8FF; }
.badge.series { background: rgba(59, 155, 255, 0.14); border-color: var(--border-strong); color: #CFE4FF; }
.badge.year { background: rgba(34, 197, 94, 0.12); border-color: #1F7A43; color: var(--ok-text); }
.badge.line { background: transparent; border-color: var(--border); color: var(--sub); }
.cat-empty { padding: 40px 20px; text-align: center; color: var(--muted); border: 1.5px dashed var(--border); border-radius: 16px; }

.cat-detail { position: sticky; top: 88px; max-height: calc(100vh - 104px); overflow-y: auto; padding: 20px; border-radius: 24px; border: 1.5px solid var(--border); background: var(--bg-alt); }
.cat-detail:empty { display: none; }
.cat-back { display: none; }
.stage { display: grid; place-items: center; aspect-ratio: 16 / 9; border-radius: 18px; background: radial-gradient(ellipse 70% 30% at 50% 82%, rgba(0, 0, 0, 0.55), transparent 70%), radial-gradient(ellipse at 50% 100%, #24558F, #0C2038 62%, #081424); overflow: hidden; }
.stage img { width: 82%; max-height: 86%; object-fit: contain; filter: drop-shadow(0 18px 16px rgba(0, 0, 0, 0.5)); }
.cat-detail h2 { font-size: clamp(26px, 3vw, 36px); margin: 20px 0 12px; }
.cat-detail h3 { font-size: 13px; font-weight: 900; letter-spacing: 0.18em; text-transform: uppercase; color: var(--orange); margin: 28px 0 12px; }
.cat-detail .badges { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-desc { color: var(--sub); margin-top: 16px; max-width: 62ch; }
.ids { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 20px 0 0; }
.ids div { padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--border); }
.ids dt { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.ids dd { margin: 2px 0 0; font-weight: 800; font-variant-numeric: tabular-nums; }
.guide { padding: 16px 18px; border-radius: 16px; border: 1.5px solid #F2B90F; background: #2A1F06; }
.guide.sth { border-color: #A855F7; background: #1F0F3A; }
.guide p { color: #F4E7BF; }
.guide.sth p { color: #E6D6FB; }
.guide ul { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.guide li { position: relative; padding-left: 28px; font-weight: 600; }
.guide li::before { content: "✓"; position: absolute; left: 0; top: 0; font-weight: 900; color: #FFD75A; }
.guide.sth li::before { color: #C89BFF; }
.table-wrap { overflow-x: auto; border-radius: 14px; border: 1px solid var(--border); }
.cat-detail table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 520px; }
.cat-detail th { text-align: left; padding: 10px 14px; font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); background: var(--panel); }
.cat-detail td { padding: 10px 14px; border-top: 1px solid var(--border); vertical-align: top; }
.cat-detail td:last-child { color: var(--sub); }
.specs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.specs li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--border); }
.specs li.rumor { border-style: dashed; border-color: #8A5A16; background: rgba(58, 42, 5, 0.45); }
.specs .field { font-size: 12px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.specs .value { font-weight: 700; grid-column: 1; }
.specs .src { grid-column: 1; font-size: 13px; color: var(--muted); }
.specs .conf { grid-column: 2; grid-row: 1 / span 3; align-self: center; text-align: right; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--sub); }
.specs .conf i { display: block; width: 64px; height: 6px; margin-top: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--blue) var(--pct), #16345C var(--pct)); }
.tag { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; vertical-align: 1px; }
.tag.official { background: var(--ok-bg); color: var(--ok-text); }
.tag.community { background: #12305A; color: #CFE4FF; }
.tag.rumor { background: #5A3A08; color: #FFD75A; }
.notes { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.notes li { padding: 12px 14px; border-left: 3px solid var(--border-strong); background: rgba(12, 32, 56, 0.6); border-radius: 0 12px 12px 0; }
.notes cite { display: block; margin-top: 4px; font-style: normal; font-size: 13px; color: var(--muted); }
.cat-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 28px; }
.btn-ghost { background: transparent; box-shadow: none; border: 2px solid var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--panel); }

@media (max-width: 880px) {
  .cat-body { grid-template-columns: 1fr; }
  .cat-detail { position: static; max-height: none; overflow: visible; padding: 16px; }
  .cat-body:not(.open) .cat-detail { display: none; }
  .cat-body.open .cat-list { display: none; }
  .cat-back { display: inline-flex; align-items: center; min-height: 44px; margin-bottom: 12px; padding: 0 16px; border-radius: 999px; border: 1.5px solid var(--border); background: var(--panel); color: var(--text); font: inherit; font-size: 14px; font-weight: 800; cursor: pointer; }
  .cat-count { margin-left: 0; width: 100%; }
}
