/* Novel Radar — Linear-inspired, data-dense ranking dashboard */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-raised: #f1f5f9;
  --fg: #0f172a;
  --fg-secondary: #475569;
  --fg-tertiary: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #eff6ff;
  --fanqie: #ef4444;
  --qidian: #b91c1c;
  --gold: #f59e0b;
  --silver: #94a3b8;
  --bronze: #b45309;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow-sm: 0 1px 2px 0 rgba(15, 23, 42, 0.04);
  --shadow: 0 1px 3px 0 rgba(15, 23, 42, 0.08), 0 4px 12px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 12px 28px -6px rgba(15, 23, 42, 0.12);
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --transition: 150ms cubic-bezier(0.2, 0, 0, 1);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --container: 1200px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 24px;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.topbar-inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  height: 72px;
  max-width: none;
  padding: 0 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  flex-shrink: 0;
}

.brand-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 22%;
  overflow: hidden;
}

.brand:hover .brand-mark {
  transform: translateY(-1px);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.brand-name {
  font-size: 24px;
  font-weight: 680;
  letter-spacing: -0.03em;
}

.platform-tabs.cir-tabs {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow:
    0 1px 1px rgba(15, 23, 42, 0.04),
    0 20px 40px -24px rgba(15, 23, 42, 0.18);
  overflow-x: auto;
  scroll-behavior: smooth;
  scrollbar-width: none;
  -ms-overflow-style: none;
  flex: 0 1 auto;
  min-width: 0;
  margin: 0 auto;
}

.platform-tabs.cir-tabs::-webkit-scrollbar {
  display: none;
}

.platform-tab.cir-tabs__t {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 36px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fg-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.platform-tab.cir-tabs__t:hover {
  color: var(--fg);
}

.platform-tab-short {
  display: none;
}

.platform-tab.cir-tabs__t.active {
  background: var(--fg);
  color: var(--surface);
  box-shadow:
    0 1px 1px rgba(15, 23, 42, 0.06),
    0 8px 18px -10px rgba(15, 23, 42, 0.5);
}

.cir-tabs__t.disabled,
.cir-tabs__t:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
  width: 340px;
  max-width: 100%;
  flex: 0 0 auto;
  justify-self: end;
}

.search-icon {
  position: absolute;
  left: 14px;
  width: 18px;
  height: 18px;
  color: var(--fg-tertiary);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 46px;
  padding: 0 40px 0 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  font-size: 15px;
  outline: none;
  transition: var(--transition);
}

.search input:hover {
  border-color: var(--border-strong);
}

.search input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.search-clear {
  position: absolute;
  right: 10px;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--surface-raised);
  color: var(--fg-tertiary);
  font-size: 18px;
  line-height: 1;
  opacity: 0;
  pointer-events: none;
  transition: var(--transition);
}

.search.has-value .search-clear {
  opacity: 1;
  pointer-events: auto;
}

.search-clear:hover {
  background: var(--border);
  color: var(--fg);
}

/* ---------- main / controls ---------- */
.main {
  flex: 1;
  padding-top: 36px;
  padding-bottom: 64px;
}

.control-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.control-row {
  display: flex;
  align-items: center;
  gap: 16px;
}

.platform-heading-row {
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.platform-name {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--fg);
}

.filter-row {
  align-items: center;
  flex-wrap: wrap;
  gap: 14px 24px;
}

.category-row {
  align-items: flex-start;
}

.filter-block {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.filter-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  line-height: 34px;
}

.gender-block {
  flex: 0 0 auto;
  min-width: 0;
}

.rank-block {
  flex: 0 1 auto;
  min-width: 0;
}

.category-block {
  flex: 1 1 auto;
  min-width: 0;
  align-items: flex-start;
}

/* ---------- cir-tabs (capsule tabs) ---------- */
.cir-tabs {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow:
    0 1px 1px rgba(15, 23, 42, 0.04),
    0 20px 40px -24px rgba(15, 23, 42, 0.18);
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  max-width: 100%;
}

.cir-tabs::-webkit-scrollbar {
  display: none;
}

.cir-tabs__t {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--fg-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.cir-tabs__t:hover {
  color: var(--fg);
}

.cir-tabs__t.active {
  background: var(--fg);
  color: var(--surface);
  box-shadow:
    0 1px 1px rgba(15, 23, 42, 0.06),
    0 8px 18px -10px rgba(15, 23, 42, 0.5);
}

.cir-tabs__t:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.32);
}

.rank-groups {
  display: inline-flex;
  flex-wrap: wrap;
  width: auto;
  max-width: 100%;
}

.rank-groups .cir-tabs__t {
  flex: 0 0 auto;
}

/* Qidian has many rank groups; keep tabs compact so more fit in one row. */
[data-platform="qidian"] .rank-groups .cir-tabs__t {
  padding: 0 12px;
  font-size: 12px;
}

/* ---------- category cards ---------- */
.category-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
}

.category-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.category-card:hover:not(:disabled) {
  background: var(--surface-raised);
  color: var(--fg);
  border-color: var(--border-strong);
}

.category-card.active {
  background: var(--fg);
  color: var(--surface);
  border-color: var(--fg);
  box-shadow:
    0 1px 1px rgba(15, 23, 42, 0.06),
    0 6px 14px -8px rgba(15, 23, 42, 0.45);
}

.category-card:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ---------- rank subtype selector ---------- */
.subtype-row {
  display: none;
}

.subtype-row.is-visible {
  display: flex;
}

.subtype-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 100%;
}

.subtype-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg-secondary);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.subtype-card:hover {
  background: var(--surface-raised);
  color: var(--fg);
  border-color: var(--border-strong);
}

.subtype-card.active {
  background: var(--fg);
  color: var(--surface);
  border-color: var(--fg);
  box-shadow:
    0 1px 1px rgba(15, 23, 42, 0.06),
    0 6px 14px -8px rgba(15, 23, 42, 0.45);
}

/* ---------- meta cluster ---------- */
.meta-cluster {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.result-count {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill, 999px);
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-secondary);
}

.snapshot-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--success);
}

.snapshot-footer {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 13px;
  color: var(--fg-secondary);
}

.snapshot-footer.error .snapshot-dot {
  background: var(--danger);
}

/* ---------- results table (desktop) ---------- */
.results {
  position: relative;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.rank-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.rank-table th,
.rank-table td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid var(--border);
}

.rank-table th {
  background: var(--surface-raised);
  color: var(--fg-secondary);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.rank-table tbody tr {
  transition: background var(--transition);
}

.rank-table tbody tr:hover {
  background: #f8fafc;
}

.rank-table tbody tr:last-child td {
  border-bottom: 0;
}

.col-rank {
  width: 64px;
  text-align: center;
}

.col-cover {
  width: 76px;
  padding-left: 0;
  padding-right: 0;
}

.rank-table.hide-cover .col-cover,
.rank-table.hide-words .col-words,
.rank-table.hide-score .col-score,
.rank-table.hide-status .col-status {
  display: none;
}

.col-title {
  min-width: 220px;
}

.col-author,
.col-category,
.col-words,
.col-score,
.col-status {
  white-space: nowrap;
}

.col-score {
  width: 120px;
}

.col-status {
  width: 80px;
}

.rank-cell {
  display: flex;
  justify-content: center;
}

.rank-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  color: var(--fg-secondary);
  background: var(--surface-raised);
  font-family: var(--mono);
}

.rank-badge.gold {
  background: #fff7ed;
  color: #c2410c;
}

.rank-badge.silver {
  background: #f1f5f9;
  color: #475569;
}

.rank-badge.bronze {
  background: #fffbeb;
  color: #92400e;
}

.cover-thumb {
  width: 68px;
  height: auto;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  object-position: center top;
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.cover-thumb.placeholder {
  display: grid;
  place-items: center;
  font-size: 10px;
  color: var(--fg-tertiary);
}

.title-cell {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.title-link {
  font-weight: 600;
  color: var(--fg);
  transition: color var(--transition);
}

.title-link:hover {
  color: var(--primary);
}

.title-cell .abstract {
  font-size: 12px;
  color: var(--fg-tertiary);
  line-height: 1.45;
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta-text {
  color: var(--fg-secondary);
}

.score-cell {
  font-family: var(--mono);
  font-weight: 600;
  color: var(--fg);
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-pill, 999px);
  font-size: 12px;
  font-weight: 500;
}

.status-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.status-badge.ongoing {
  background: #ecfdf5;
  color: #047857;
}

.status-badge.ongoing::before {
  background: var(--success);
}

.status-badge.completed {
  background: #f1f5f9;
  color: #475569;
}

.status-badge.completed::before {
  background: var(--fg-tertiary);
}

/* ---------- mobile cards ---------- */
.cards {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.book-card {
  display: flex;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
  transition: transform var(--transition), box-shadow var(--transition);
}

.book-card:active {
  transform: scale(0.995);
}

.card-rank {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 32px;
}

.card-rank .rank-badge {
  width: 32px;
  height: 32px;
}

.card-cover {
  width: 88px;
  height: auto;
  aspect-ratio: 3 / 4;
  flex-shrink: 0;
}

.card-cover .cover-thumb {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

.card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
}

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg);
  line-height: 1.35;
}

.card-title a:hover {
  color: var(--primary);
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  font-size: 13px;
  color: var(--fg-secondary);
}

.card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 12px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--fg-secondary);
}

.stat-pill strong {
  color: var(--fg);
  font-weight: 600;
}

.card-abstract {
  font-size: 13px;
  color: var(--fg-secondary);
  line-height: 1.55;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    max-height 260ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 220ms cubic-bezier(0.22, 1, 0.36, 1),
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1),
    padding 220ms ease;
}

.abstract-para {
  margin: 0 0 0.55em;
  text-indent: 2em;
}

.abstract-para:last-child {
  margin-bottom: 0;
}

.book-card.is-expanded .card-abstract {
  max-height: 200px;
  opacity: 1;
  transform: translateY(0);
  padding-top: 8px;
}

.abstract-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.abstract-toggle::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  transition: transform 200ms ease;
}

.book-card.is-expanded .abstract-toggle::after {
  transform: rotate(180deg);
}

.card-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 13px;
  color: var(--fg-secondary);
}

.card-metric strong {
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 700;
  color: var(--fg);
}

/* mobile-only components (hidden on desktop) */
.search-toggle,
.rank-trigger,
.search-overlay,
.rank-sheet {
  display: none;
}

/* category dropdown trigger (used by platforms with category_style='dropdown') */
.category-trigger {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 34px;
  padding: 0 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    color 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.category-trigger:hover {
  background: var(--surface-raised);
  border-color: var(--border-strong);
}

.category-trigger svg {
  flex-shrink: 0;
  color: var(--fg-tertiary);
}

/* category selection sheet / modal */
.category-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1002;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.category-sheet.is-open {
  display: flex;
}

.category-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 260ms ease;
}

.category-sheet.is-open .category-sheet-backdrop {
  opacity: 1;
}

.category-sheet-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: min(600px, 80vh);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96);
  opacity: 0;
  transition:
    transform 200ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.category-sheet.is-open .category-sheet-panel {
  transform: scale(1);
  opacity: 1;
}

.category-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.category-sheet-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.category-sheet-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--fg-secondary);
  cursor: pointer;
}

.category-sheet-body {
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.category-sheet-body .category-card {
  flex: 0 0 auto;
  height: 36px;
  padding: 0 16px;
  font-size: 13px;
}

/* mobile platform selector (replaces tab bar on small screens) */
.platform-select-trigger {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--fg);
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition:
    background-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
    box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.platform-select-trigger:hover {
  background: var(--surface-raised);
  border-color: var(--border-strong);
}

.platform-select-trigger svg {
  flex-shrink: 0;
  color: var(--fg-tertiary);
}

/* platform selection sheet / modal */
.platform-sheet {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1003;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.platform-sheet.is-open {
  display: flex;
}

.platform-sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  opacity: 0;
  transition: opacity 260ms ease;
}

.platform-sheet.is-open .platform-sheet-backdrop {
  opacity: 1;
}

.platform-sheet-panel {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: min(600px, 80vh);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: scale(0.96);
  opacity: 0;
  transition:
    transform 200ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

.platform-sheet.is-open .platform-sheet-panel {
  transform: scale(1);
  opacity: 1;
}

.platform-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--border);
}

.platform-sheet-header h3 {
  font-size: 17px;
  font-weight: 700;
}

.platform-sheet-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--fg-secondary);
  cursor: pointer;
}

.platform-sheet-body {
  padding: 12px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.platform-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface-raised);
  color: var(--fg);
  font-size: 15px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition:
    background-color 180ms ease,
    color 180ms ease;
}

.platform-option:hover {
  background: var(--border);
}

.platform-option.active {
  background: var(--fg);
  color: var(--surface);
}

.platform-option .check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  opacity: 0;
}

.platform-option.active .check {
  opacity: 1;
}

/* ---------- empty / error / loading ---------- */
.empty-state,
.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 80px 24px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  color: var(--fg-secondary);
}

.error-state {
  color: #b91c1c;
  background: #fef2f2;
  border-color: #fecaca;
}

.empty-state h3,
.error-state h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg);
}

.error-state h3 {
  color: #991b1b;
}

.skeleton-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
}

.skeleton-row {
  height: 52px;
  background: linear-gradient(90deg, var(--surface-raised) 25%, #e2e8f0 50%, var(--surface-raised) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-sm);
  animation: shimmer 1.4s infinite linear;
  margin-bottom: 10px;
}

.skeleton-row.head {
  height: 40px;
  margin-bottom: 12px;
}

.skeleton-row:last-child {
  margin-bottom: 0;
}

@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- tooltip ---------- */
.tooltip {
  position: fixed;
  pointer-events: none;
  z-index: 2000;
  max-width: 420px;
  padding: 12px 14px;
  background: var(--surface);
  color: var(--fg);
  font-size: 13px;
  line-height: 1.55;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--transition), transform var(--transition);
}

.tooltip .abstract-para {
  margin: 0 0 0.05em;
  text-indent: 2em;
  text-align: justify;
}

.tooltip .abstract-para:last-child {
  margin-bottom: 0;
}

.tooltip.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- footer ---------- */
.footer {
  margin-top: auto;
  padding: 24px 0;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 12px;
  color: var(--fg-tertiary);
}

/* ---------- desktop enlargement ---------- */
@media (min-width: 769px) {
  .control-bar {
    padding: 28px;
    gap: 22px;
  }

  .control-row {
    gap: 18px;
  }

  .platform-name {
    font-size: 24px;
  }

  .filter-label {
    font-size: 14px;
    line-height: 40px;
  }

  .cir-tabs {
    padding: 6px;
    gap: 6px;
  }

  .cir-tabs__t {
    height: 40px;
    padding: 0 18px;
    font-size: 14px;
  }

  .category-card,
  .subtype-card {
    height: 36px;
    padding: 0 16px;
    font-size: 14px;
  }

  .result-count {
    padding: 6px 14px;
    font-size: 14px;
  }

  .snapshot-footer {
    font-size: 14px;
  }
}

/* ---------- responsive ---------- */
@media (max-width: 1024px) {
  .topbar-inner {
    gap: 16px;
  }

  .search {
    width: 200px;
  }

  .title-cell .abstract {
    max-width: 220px;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 0 14px;
  }

  /* topbar: logo | platform selector | search icon */
  .topbar-inner {
    position: relative;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 58px;
    gap: 12px;
    flex-wrap: nowrap;
    padding: 0 14px;
  }

  .brand-name {
    display: none;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
  }

  .platform-tabs.cir-tabs {
    display: none;
  }

  .platform-select-trigger {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    min-width: 140px;
    max-width: calc(100% - 130px);
    height: 40px;
    padding: 0 18px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--fg);
    font-size: 15px;
    font-weight: 600;
    text-align: center;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    transition:
      background-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
      border-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .platform-select-trigger:active {
    background: var(--surface-raised);
  }

  .platform-select-trigger svg {
    display: none;
  }

  .platform-select-trigger span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .search {
    order: 0;
    flex: 0 0 auto;
    min-width: 0;
    width: auto;
    margin-left: 0;
  }

  .search input,
  .search .search-icon,
  .search .search-clear {
    display: none;
  }

  .search-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 34px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--fg-secondary);
    -webkit-tap-highlight-color: transparent;
    transition:
      background-color 220ms cubic-bezier(0.22, 1, 0.36, 1),
      color 220ms cubic-bezier(0.22, 1, 0.36, 1),
      box-shadow 220ms cubic-bezier(0.22, 1, 0.36, 1);
  }

  .search-toggle:active {
    background: var(--surface-raised);
    color: var(--fg);
  }

  /* search overlay */
  .search-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1001;
  }

  .search-overlay.is-open {
    display: block;
  }

  .search-overlay-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.35);
    opacity: 0;
    transition: opacity 260ms ease;
  }

  .search-overlay.is-open .search-overlay-backdrop {
    opacity: 1;
  }

  .search-overlay-inner {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    transform: translateY(-20px);
    opacity: 0;
    transition:
      transform 260ms cubic-bezier(0.22, 1, 0.36, 1),
      opacity 260ms ease;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .search-overlay.is-open .search-overlay-inner {
    transform: translateY(0);
    opacity: 1;
  }

  .search-overlay-top {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 2;
  }

  .search-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    flex-shrink: 0;
    border: 0;
    border-radius: var(--radius);
    background: transparent;
    color: var(--fg-secondary);
    -webkit-tap-highlight-color: transparent;
  }

  .search.search--overlay {
    display: flex;
    flex: 1;
    width: auto;
    margin-left: 0;
  }

  .search.search--overlay input {
    display: block;
    height: 40px;
    padding-left: 38px;
    padding-right: 34px;
    font-size: 15px;
  }

  .search.search--overlay .search-icon {
    display: block;
    left: 12px;
  }

  .search.search--overlay .search-clear {
    display: grid;
    right: 10px;
  }

  .search-overlay-results {
    flex: 1;
    padding: 14px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* main & controls */
  .main {
    padding-top: 44px;
    padding-bottom: 40px;
  }

  .control-bar {
    padding: 14px 12px 12px;
    gap: 12px;
    border-radius: var(--radius);
    margin-top: 6px;
    margin-bottom: 18px;
  }

  .control-row {
    gap: 10px;
  }

  .platform-heading-row {
    flex-wrap: nowrap;
    gap: 10px;
  }

  .platform-name {
    font-size: 16px;
    font-weight: 700;
  }

  .meta-cluster {
    margin-left: auto;
    gap: 8px;
  }

  .result-count {
    display: none;
  }

  .snapshot {
    font-size: 12px;
    color: var(--fg-tertiary);
  }

  .snapshot-dot {
    width: 5px;
    height: 5px;
  }

  .filter-row {
    flex-direction: row;
    align-items: stretch;
    flex-wrap: nowrap;
    gap: 10px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-bottom: 2px;
  }

  .filter-row::-webkit-scrollbar {
    display: none;
  }

  .filter-block {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    flex: 0 0 auto;
    min-width: 0;
  }

  .filter-label {
    display: none;
  }

  .gender-block {
    flex: 0 0 auto;
  }

  .rank-block {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    align-items: center;
  }

  .rank-groups {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    max-width: 100%;
  }

  .rank-trigger {
    display: none;
  }

  /* 多榜单平台在移动端使用底部选择器；番茄等少量榜单保留胶囊按钮 */
  .control-bar.use-rank-selector .rank-groups {
    display: none;
  }

  .control-bar.use-rank-selector .rank-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: fit-content;
    max-width: 100%;
    min-width: 0;
    height: 42px;
    padding: 0 18px;
    border: 1px solid #dbe4ef;
    border-radius: 999px;
    background:
      linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 250, 252, 0.98));
    color: var(--fg);
    box-shadow:
      inset 0 1px 0 rgba(255, 255, 255, 0.9),
      0 1px 2px rgba(15, 23, 42, 0.04),
      0 12px 28px -20px rgba(15, 23, 42, 0.26);
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
  }


  .control-bar.use-rank-selector #rank-trigger-text {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    min-width: 88px;
    max-width: min(52vw, 220px);
    height: 100%;
    padding: 0;
    color: var(--fg);
    font-size: 15px;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .control-bar.use-rank-selector .rank-trigger svg {
    display: none;
  }

  .gender-tabs {
    width: auto;
    max-width: none;
  }

  .gender-tabs .cir-tabs__t {
    height: 34px;
    padding: 0 14px;
    font-size: 13px;
  }

  .category-row {
    display: block;
  }

  .category-block {
    width: 100%;
  }

  .category-cards {
    display: none;
  }

  .category-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    height: 40px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--fg);
    font-size: 14px;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
  }

  .category-trigger svg {
    color: var(--fg-tertiary);
  }

  /* category sheet */
  .category-sheet {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1002;
  }

  .category-sheet.is-open {
    display: block;
  }

  .category-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    transition: opacity 260ms ease;
  }

  .category-sheet.is-open .category-sheet-backdrop {
    opacity: 1;
  }

  .category-sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 75vh;
    background: var(--surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -8px 40px rgba(15, 23, 42, 0.18);
    transform: translateY(100%);
    transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
  }

  .category-sheet.is-open .category-sheet-panel {
    transform: translateY(0);
  }

  .category-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border);
  }

  .category-sheet-header h3 {
    font-size: 17px;
    font-weight: 700;
  }

  .category-sheet-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: var(--radius);
    background: var(--surface-raised);
    color: var(--fg-secondary);
  }

  .category-sheet-body {
    padding: 8px 16px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
  }

  .category-sheet-body .category-card {
    flex: 0 0 auto;
    height: 38px;
    padding: 0 18px;
    font-size: 14px;
  }

  /* platform sheet */
  .platform-sheet {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1003;
    padding: 0;
  }

  .platform-sheet.is-open {
    display: block;
  }

  .platform-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    transition: opacity 260ms ease;
  }

  .platform-sheet.is-open .platform-sheet-backdrop {
    opacity: 1;
  }

  .platform-sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 75vh;
    background: var(--surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -8px 40px rgba(15, 23, 42, 0.18);
    transform: translateY(100%);
    transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
  }

  .platform-sheet.is-open .platform-sheet-panel {
    transform: translateY(0);
  }

  .platform-sheet-body {
    padding: 8px 16px 24px;
  }

  .platform-option {
    height: 52px;
    padding: 0 18px;
    font-size: 16px;
  }

  /* rank sheet */
  .rank-sheet {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1002;
  }

  .rank-sheet.is-open {
    display: block;
  }

  .rank-sheet-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.45);
    opacity: 0;
    transition: opacity 260ms ease;
  }

  .rank-sheet.is-open .rank-sheet-backdrop {
    opacity: 1;
  }

  .rank-sheet-panel {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    max-height: 75vh;
    background: var(--surface);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    box-shadow: 0 -8px 40px rgba(15, 23, 42, 0.18);
    transform: translateY(100%);
    transition: transform 280ms cubic-bezier(0.22, 1, 0.36, 1);
    display: flex;
    flex-direction: column;
  }

  .rank-sheet.is-open .rank-sheet-panel {
    transform: translateY(0);
  }

  .rank-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 16px 12px;
    border-bottom: 1px solid var(--border);
  }

  .rank-sheet-header h3 {
    font-size: 17px;
    font-weight: 700;
  }

  .rank-sheet-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: var(--radius);
    background: var(--surface-raised);
    color: var(--fg-secondary);
  }

  .rank-sheet-body {
    padding: 8px 16px 24px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .rank-sheet-body .rank-sheet-item {
    flex: 0 0 auto;
    width: 100%;
    min-height: 48px;
    padding: 0 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    color: var(--fg);
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    white-space: normal;
    cursor: pointer;
    transition:
      background-color 180ms ease,
      color 180ms ease,
      border-color 180ms ease,
      box-shadow 180ms ease;
  }

  .rank-sheet-body .rank-sheet-item.active {
    background: var(--fg);
    color: var(--surface);
    border-color: var(--fg);
    box-shadow:
      0 1px 1px rgba(15, 23, 42, 0.08),
      0 10px 22px -14px rgba(15, 23, 42, 0.55);
  }

  .rank-sheet-body .rank-sheet-item.disabled,
  .rank-sheet-body .rank-sheet-item:disabled {
    opacity: 0.5;
    cursor: not-allowed;
  }

  /* results cards */
  .table-wrap {
    display: none;
  }

  .cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .book-card {
    position: relative;
    display: block;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    transition:
      transform 160ms ease,
      box-shadow 160ms ease,
      background-color 160ms ease;
    -webkit-tap-highlight-color: transparent;
  }

  .card-main {
    display: flex;
    gap: 14px;
  }

  .book-card.is-first {
    border-color: var(--gold);
    box-shadow:
      0 1px 3px rgba(15, 23, 42, 0.08),
      0 8px 24px -6px rgba(245, 158, 11, 0.22);
  }

  .book-card.no-cover {
    padding: 15px 15px 13px;
    background:
      linear-gradient(135deg, rgba(37, 99, 235, 0.055), rgba(255, 255, 255, 0) 42%),
      var(--surface);
    overflow: hidden;
  }


  .book-card.no-cover.is-first {
    background:
      linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(255, 255, 255, 0) 42%),
      var(--surface);
  }

  .book-card:active {
    transform: scale(0.985);
    background: #f8fafc;
  }

  .card-rank {
    position: absolute;
    top: 4px;
    left: 4px;
    min-width: auto;
    z-index: 1;
  }

  .card-rank .rank-badge {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 13px;
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.18);
  }

  .card-rank .rank-badge.gold {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #fff;
    width: 34px;
    height: 34px;
    font-size: 15px;
  }

  .card-rank .rank-badge.silver {
    background: linear-gradient(135deg, #cbd5e1, #94a3b8);
    color: #fff;
  }

  .card-rank .rank-badge.bronze {
    background: linear-gradient(135deg, #d97706, #b45309);
    color: #fff;
  }

  .book-card.no-cover .card-rank {
    top: 16px;
    left: 16px;
  }

  .book-card.no-cover .card-rank .rank-badge {
    width: 32px;
    height: 32px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 800;
    box-shadow:
      0 1px 2px rgba(15, 23, 42, 0.08),
      0 8px 18px -12px rgba(15, 23, 42, 0.45);
  }

  .book-card.no-cover .card-rank .rank-badge.gold {
    width: 34px;
    height: 34px;
  }

  .card-cover {
    width: 88px;
    flex-shrink: 0;
    margin-left: 0;
    align-self: flex-start;
    border-radius: var(--radius-sm);
    overflow: hidden;
  }

  .card-cover .cover-thumb {
    width: 100%;
    height: auto;
    aspect-ratio: 3 / 4;
    object-fit: cover;
    object-position: center top;
    border-radius: var(--radius-sm);
    display: block;
  }

  .card-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
  }

  .card-header {
    align-items: flex-start;
    gap: 8px;
  }

  .book-card.no-cover .card-main {
    display: block;
  }

  .book-card.no-cover .card-body {
    justify-content: flex-start;
    gap: 8px;
  }

  .book-card.no-cover .card-header,
  .book-card.no-cover .card-author {
    padding-left: 44px;
  }

  .book-card.no-cover .card-header {
    min-height: 34px;
    align-items: center;
  }

  .card-title {
    font-size: 17px;
    font-weight: 700;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .card-title a {
    display: block;
  }

  .book-card.no-cover .card-title {
    font-size: 18px;
    line-height: 1.32;
  }

  .card-author {
    font-size: 14px;
    color: var(--fg-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .card-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .book-card.no-cover .card-chips {
    gap: 7px;
    padding-top: 2px;
  }

  .chip {
    display: inline-flex;
    align-items: center;
    height: 26px;
    padding: 0 10px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--fg-secondary);
    background: var(--surface-raised);
    border: 1px solid var(--border);
    white-space: nowrap;
  }

  .book-card.no-cover .chip {
    min-width: 0;
    max-width: 100%;
    height: 28px;
    border-radius: 8px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .book-card.no-cover .chip.category {
    max-width: min(100%, 242px);
  }

  .chip.category {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: #bfdbfe;
  }

  .chip.status.ongoing {
    color: #047857;
    background: #ecfdf5;
    border-color: #a7f3d0;
  }

  .chip.status.completed {
    color: #475569;
    background: #f1f5f9;
    border-color: #e2e8f0;
  }

  .card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100%;
  }

  .book-card.no-cover .card-footer {
    margin-top: 2px;
    padding-top: 9px;
    border-top: 1px solid rgba(226, 232, 240, 0.82);
  }

  .card-actions {
    display: flex;
    align-items: center;
    gap: 12px;
  }

  .card-metric {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;
    font-size: 13px;
    color: var(--fg-tertiary);
  }

  .card-metric strong {
    font-size: 18px;
    font-weight: 700;
    color: var(--fg);
    letter-spacing: -0.01em;
  }

  .book-card.no-cover .card-metric {
    margin-left: auto;
    font-size: 13px;
  }

  .book-card.no-cover .card-metric strong {
    font-size: 20px;
  }

  .abstract-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    border: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
  }

  .book-card.is-expanded .card-abstract {
    max-height: 2000px;
  }

  /* loading skeleton cards */
  .skeleton-table {
    display: none;
  }

  .skeleton-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
  }

  .skeleton-card {
    display: flex;
    gap: 14px;
    padding: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
  }

  .skeleton-cover {
    width: 96px;
    height: 128px;
    flex-shrink: 0;
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    animation: shimmer 1.4s infinite linear;
  }

  .skeleton-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .skeleton-line {
    height: 14px;
    border-radius: var(--radius-sm);
    background: var(--surface-raised);
    animation: shimmer 1.4s infinite linear;
  }

  .skeleton-line.short {
    width: 60%;
  }

  .skeleton-line.thin {
    height: 10px;
    width: 40%;
  }

  /* empty / error states */
  .empty-state,
  .error-state {
    padding: 64px 24px;
  }

  .footer {
    padding: 20px 0;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 12px;
  }

  .topbar-inner {
    gap: 8px;
  }

  .platform-tab.cir-tabs__t {
    padding: 0 10px;
    font-size: 12px;
  }

  .book-card {
    gap: 14px;
    padding: 12px;
  }

  .card-rank {
    top: 2px;
    left: 2px;
  }

  .card-rank .rank-badge {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }

  .card-rank .rank-badge.gold {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .card-cover {
    width: 88px;
  }

  .skeleton-cover {
    width: 88px;
    height: 117px;
  }

  .card-title {
    font-size: 16px;
  }

  .card-metric strong {
    font-size: 17px;
  }
}
