/* ── App shell ─────────────────────────────────────────────── */
.app-shell {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  min-height: 0;
  overflow: hidden;
  background: var(--ink);
}

.page {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.page::-webkit-scrollbar,
.rail::-webkit-scrollbar,
.chip-scroll::-webkit-scrollbar {
  display: none;
}

.page:focus {
  outline: none;
}

.page-inner {
  padding-top: 6px;
}

.tab-page {
  padding-bottom: var(--page-bottom-safe);
}

.page.loading {
  overflow: hidden;
}

.source-banner {
  position: relative;
  z-index: 70;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 34px;
  padding: calc(var(--safe-top) + 8px) var(--page-gutter) 8px;
  color: var(--ink);
  background: var(--pink);
  font-size: var(--fs-caption);
  font-weight: 700;
  line-height: 1.3;
}

.source-banner span {
  flex: 1 1 auto;
  min-width: 0;
  line-height: 1.45;
}

.source-banner a {
  margin-left: auto;
  padding: 4px 9px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.55);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

/* Mock source: everything on the page is local placeholder content. */
.source-banner.is-mock {
  color: var(--text);
  background: #34343d;
}

/* Real catalogue failed to load: the provider already fell back to mock. */
.source-banner.is-fallback {
  color: var(--text);
  background: #7a3038;
}

/* ── Top bars / brand ─────────────────────────────────────── */
.home-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-3);
  padding: calc(var(--safe-top) + 18px) var(--page-gutter) 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--ink);
  background: linear-gradient(145deg, var(--pink-strong), var(--pink) 52%, #E888A2);
  border-radius: 13px;
  box-shadow: 0 8px 22px rgba(255, 158, 180, 0.24), inset 0 1px rgba(255, 255, 255, 0.55);
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 3px;
  border: 1px solid rgba(11, 11, 13, 0.16);
  border-radius: 10px;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.brand-copy small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.24em;
  line-height: 1.1;
}

.brand-copy strong {
  color: var(--text);
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: background 0.2s, border-color 0.2s, transform 0.2s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--line-strong);
}

.icon-btn:active {
  transform: scale(0.94);
}

.icon-btn.small {
  width: 32px;
  height: 32px;
}

.coin-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  color: var(--gold);
  background: rgba(255, 209, 138, 0.08);
  border: 1px solid rgba(255, 209, 138, 0.22);
  border-radius: var(--radius-pill);
  font-size: var(--fs-caption);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: background 0.2s;
}

.coin-pill:hover {
  background: rgba(255, 209, 138, 0.13);
}

.page-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 8px;
  min-height: calc(58px + var(--safe-top));
  padding: calc(var(--safe-top) + 8px) var(--page-gutter) 8px;
  background: linear-gradient(180deg, rgba(11, 11, 13, 0.98) 58%, rgba(11, 11, 13, 0));
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.page-topbar .topbar-title {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-topbar .topbar-sub {
  display: block;
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-align: center;
}

.topbar-btn {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: background 0.2s, transform 0.2s;
}

.topbar-btn:hover {
  background: rgba(255, 255, 255, 0.11);
}

.topbar-btn:active {
  transform: scale(0.93);
}

.topbar-spacer {
  width: 38px;
  height: 38px;
}

/* ── Headings / sections ──────────────────────────────────── */
.page-heading {
  padding: 10px var(--page-gutter) 0;
}

.page-heading .kicker {
  margin-bottom: 6px;
}

.page-heading h1 {
  color: var(--text);
  font-size: var(--fs-3xl);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.06;
}

.page-heading .heading-copy {
  max-width: 310px;
  margin-top: 7px;
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.55;
}

/* Intro line under a page-topbar (secondary pages such as 发现 / 收藏). */
.page-lead {
  max-width: 330px;
  margin: 2px var(--page-gutter) 0;
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.55;
}

.kicker {
  color: var(--pink);
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.section {
  margin-top: 28px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 var(--page-gutter) 12px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.section-title::before {
  content: "";
  flex: 0 0 auto;
  width: 3px;
  height: 17px;
  background: var(--pink);
  border-radius: 2px;
  box-shadow: 0 0 14px rgba(255, 158, 180, 0.4);
}

.section-title h2 {
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: -0.025em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.section-title small {
  color: var(--muted-dim);
  font-size: var(--fs-2xs);
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.section-link {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  color: var(--muted);
  font-size: var(--fs-caption);
  white-space: nowrap;
  transition: color 0.2s;
}

.section-link:hover {
  color: var(--pink);
}

/* ── Buttons / chips ──────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 18px;
  color: var(--text);
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font-size: var(--fs-base);
  font-weight: 700;
  line-height: 1;
  transition: transform 0.18s var(--ease-out), background 0.2s, opacity 0.2s;
}

.btn:hover {
  background: #25252B;
}

.btn:active {
  transform: scale(0.975);
}

.btn:disabled {
  opacity: 0.42;
}

.btn-primary {
  color: var(--ink);
  background: var(--pink);
  border-color: var(--pink);
  box-shadow: 0 8px 26px rgba(255, 158, 180, 0.18);
}

.btn-primary:hover {
  background: var(--pink-strong);
}

.btn-white {
  color: var(--ink);
  background: #FFFFFF;
  border-color: #FFFFFF;
}

.btn-white:hover {
  background: #F2F2F0;
}

.btn-ghost {
  color: var(--text);
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(255, 255, 255, 0.14);
  backdrop-filter: blur(10px);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-danger {
  color: var(--ink);
  background: var(--error);
  border-color: var(--error);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 36px;
  padding: 0 13px;
  border-radius: 10px;
  font-size: var(--fs-sm);
}

.btn-lg {
  min-height: 52px;
  padding: 0 22px;
  border-radius: var(--radius-md);
  font-size: var(--fs-md);
}

.btn-round {
  border-radius: var(--radius-pill);
}

.btn .spinner {
  width: 14px;
  height: 14px;
  border: 1.5px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.chip-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 0 var(--page-gutter) 4px;
  scrollbar-width: none;
  scroll-snap-type: x proximity;
}

.chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  font-size: var(--fs-caption);
  font-weight: 600;
  white-space: nowrap;
  scroll-snap-align: start;
  transition: color 0.2s, background 0.2s, border-color 0.2s;
}

.chip:hover {
  color: var(--text);
  border-color: var(--line-strong);
}

.chip[aria-pressed="true"],
.chip.is-active {
  color: var(--ink);
  background: var(--text);
  border-color: var(--text);
  font-weight: 800;
}

.chip-pink[aria-pressed="true"] {
  color: var(--ink);
  background: var(--pink);
  border-color: var(--pink);
}

/* ── Drama cards / rails ──────────────────────────────────── */
.rail {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 0 var(--page-gutter) 6px;
  scroll-padding-left: var(--page-gutter);
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.rail > * {
  scroll-snap-align: start;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px 11px;
  padding: 0 var(--page-gutter);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 12px;
  padding: 0 var(--page-gutter);
}

.drama-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  color: var(--text);
  border-radius: var(--radius-sm);
}

.rail .drama-card {
  flex: 0 0 122px;
  width: 122px;
}

.drama-card .poster {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 3 / 4;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-md);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
}

.drama-card .poster::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 54%, rgba(0, 0, 0, 0.58) 100%);
  pointer-events: none;
}

.drama-card .poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease-out), filter 0.4s;
}

.drama-card:hover .poster img {
  transform: scale(1.045);
  filter: brightness(1.06);
}

.poster .poster-top {
  position: absolute;
  top: 7px;
  right: 7px;
  z-index: 2;
  display: flex;
  gap: 5px;
}

.poster .ep-badge,
.poster .hot-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 19px;
  padding: 0 6px;
  color: rgba(255, 255, 255, 0.92);
  background: rgba(0, 0, 0, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 6px;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.01em;
  backdrop-filter: blur(6px);
}

.poster .hot-badge {
  color: var(--ink);
  background: var(--pink);
  border-color: var(--pink);
}

.poster .poster-play {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  color: var(--ink);
  background: rgba(247, 247, 245, 0.92);
  border-radius: 50%;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.28);
}

.drama-card h3 {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 8px;
  color: var(--text);
  font-size: var(--fs-sm);
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.drama-card .meta,
.drama-card .stats {
  overflow: hidden;
  color: var(--muted);
  font-size: var(--fs-2xs);
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.drama-card .meta {
  margin-top: 4px;
  color: var(--text-dim);
}

.drama-card .stats {
  margin-top: 2px;
  color: var(--muted-dim);
  font-variant-numeric: tabular-nums;
}

.drama-card .stats b {
  color: var(--muted);
  font-weight: 500;
}

/* Wide "spotlight" cards used in Trending. */
.spotlight-card {
  position: relative;
  display: flex;
  flex: 0 0 248px;
  align-items: flex-end;
  width: 248px;
  height: 150px;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  isolation: isolate;
}

.spotlight-card > img {
  position: absolute;
  inset: 0;
  z-index: -2;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.65s var(--ease-out);
}

.spotlight-card:hover > img {
  transform: scale(1.05);
}

.spotlight-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(8, 8, 10, 0.82) 0%, rgba(8, 8, 10, 0.2) 65%, rgba(8, 8, 10, 0.06) 100%),
    linear-gradient(0deg, rgba(8, 8, 10, 0.92) 0%, transparent 65%);
}

.spotlight-rank {
  position: absolute;
  top: 10px;
  left: 12px;
  color: var(--pink);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.spotlight-card .spotlight-body {
  width: 100%;
  padding: 14px;
}

.spotlight-card h3 {
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-md);
  font-weight: 800;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spotlight-card p {
  overflow: hidden;
  margin-top: 3px;
  color: rgba(247, 247, 245, 0.65);
  font-size: var(--fs-2xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spotlight-card .spotlight-stats {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.spotlight-card .spotlight-stats b {
  color: var(--pink);
  font-weight: 700;
}

/* ── Meta / badges / data source ───────────────────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 8px;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: var(--fs-2xs);
  font-weight: 600;
}

.tag-pink {
  color: var(--pink);
  background: var(--pink-wash);
  border-color: rgba(255, 158, 180, 0.22);
}

.tag-gold {
  color: var(--gold);
  background: rgba(255, 209, 138, 0.08);
  border-color: rgba(255, 209, 138, 0.2);
}

.tag-green {
  color: var(--green);
  background: rgba(139, 216, 176, 0.08);
  border-color: rgba(139, 216, 176, 0.2);
}

.status-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: var(--fs-caption);
}

.mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.divider {
  height: 1px;
  margin: var(--space-4) 0;
  background: var(--line);
}

.surface {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
}

/* ── Tabs / segmented ─────────────────────────────────────── */
.segmented {
  display: grid;
  grid-auto-columns: 1fr;
  grid-auto-flow: column;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line-soft);
  border-radius: 13px;
}

.segmented button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 10px;
  color: var(--muted);
  border-radius: 9px;
  font-size: var(--fs-caption);
  font-weight: 700;
  transition: color 0.2s, background 0.2s;
}

.segmented button:hover {
  color: var(--text);
}

.segmented button[aria-selected="true"],
.segmented button.is-active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.095);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.14);
}

.sub-tabs {
  display: flex;
  gap: 24px;
  padding: 0 var(--page-gutter);
  border-bottom: 1px solid var(--line-soft);
}

.sub-tab {
  position: relative;
  min-height: 44px;
  color: var(--muted);
  font-size: var(--fs-base);
  font-weight: 700;
}

.sub-tab[aria-selected="true"] {
  color: var(--text);
}

.sub-tab[aria-selected="true"]::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: -1px;
  left: 0;
  height: 2px;
  background: var(--pink);
  border-radius: 3px;
  box-shadow: 0 0 10px rgba(255, 158, 180, 0.4);
}

.sub-tab .count {
  margin-left: 5px;
  color: var(--muted-dim);
  font-size: var(--fs-2xs);
  font-variant-numeric: tabular-nums;
}

/* ── Search ───────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 46px;
  padding: 0 13px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  transition: border-color 0.2s, background 0.2s;
}

.search-wrap:focus-within {
  background: var(--panel-raised);
  border-color: rgba(255, 158, 180, 0.52);
  box-shadow: 0 0 0 3px rgba(255, 158, 180, 0.08);
}

.search-wrap > svg {
  flex: 0 0 auto;
  color: var(--muted);
}

.search-wrap input {
  width: 100%;
  min-width: 0;
  height: 100%;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
  font-size: var(--fs-base);
}

.search-wrap input::placeholder {
  color: var(--muted-dim);
}

.search-clear {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50%;
}

.search-clear:hover {
  color: var(--text);
}

.search-field-row {
  padding: 4px var(--page-gutter) 0;
}

/* ── Rank list ────────────────────────────────────────────── */
.rank-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 4px var(--page-gutter) 0;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 76px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line-soft);
}

.rank-row:last-child {
  border-bottom: 0;
}

.rank-num {
  flex: 0 0 24px;
  color: var(--muted-dim);
  font-family: var(--font-mono);
  font-size: var(--fs-md);
  font-weight: 700;
  font-style: italic;
  text-align: center;
}

.rank-row:nth-child(1) .rank-num {
  color: var(--pink);
}

.rank-row:nth-child(2) .rank-num {
  color: #D7C9D0;
}

.rank-row:nth-child(3) .rank-num {
  color: #C9A08C;
}

.rank-thumb {
  flex: 0 0 50px;
  width: 50px;
  height: 66px;
  overflow: hidden;
  background: var(--panel);
  border-radius: 9px;
}

.rank-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.rank-copy h3 {
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-base);
  font-weight: 700;
  letter-spacing: -0.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-copy p {
  overflow: hidden;
  margin-top: 3px;
  color: var(--muted);
  font-size: var(--fs-2xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-copy .rank-metric {
  margin-top: 5px;
  color: var(--text-dim);
  font-size: var(--fs-xs);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.rank-copy .rank-metric b {
  color: var(--pink);
}

.rank-arrow {
  flex: 0 0 auto;
  color: var(--muted-dim);
}

/* ── Empty / error / loading states ───────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  padding: 44px 28px;
  text-align: center;
}

.icon-disc {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  margin-bottom: 17px;
  color: var(--pink);
  background: radial-gradient(circle at 40% 30%, rgba(255, 158, 180, 0.15), rgba(255, 158, 180, 0.05));
  border: 1px solid rgba(255, 158, 180, 0.18);
  border-radius: 22px;
}

.empty-state h2 {
  color: var(--text);
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.empty-state p {
  max-width: 260px;
  margin-top: 7px;
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.6;
}

.empty-state .btn {
  margin-top: 20px;
}

.error-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 420px;
  padding: 40px 28px;
  text-align: center;
}

.error-state .icon-disc {
  color: var(--error);
  background: rgba(255, 160, 172, 0.08);
  border-color: rgba(255, 160, 172, 0.18);
}

.error-state h2 {
  font-size: var(--fs-xl);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.error-state p {
  max-width: 290px;
  margin-top: 8px;
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.65;
}

.error-state code {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 8px;
  color: var(--error);
  background: rgba(255, 160, 172, 0.06);
  border-radius: 6px;
  font-family: var(--font-mono);
  font-size: var(--fs-2xs);
}

.error-state .btn {
  margin-top: 22px;
}

.loading-screen {
  padding: calc(var(--safe-top) + 18px) var(--page-gutter) 88px;
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.055);
  border-radius: 8px;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.07), transparent);
  animation: shimmer 1.5s infinite;
}

.skeleton-line {
  height: 11px;
  margin-bottom: 9px;
}

.skeleton-title {
  width: 48%;
  height: 24px;
  margin-bottom: 14px;
}

.skeleton-hero {
  height: 286px;
  margin: 16px 0 28px;
  border-radius: var(--radius-xl);
}

.skeleton-row {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.skeleton-card {
  flex: 1;
  height: 150px;
  border-radius: var(--radius-md);
}

.route-progress {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 80;
  height: 2px;
  overflow: hidden;
  pointer-events: none;
}

.route-progress::after {
  content: "";
  display: block;
  width: 38%;
  height: 100%;
  background: linear-gradient(90deg, transparent, var(--pink), transparent);
  animation: route-progress 1.1s ease-in-out infinite;
}

.inline-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px var(--page-gutter);
  color: var(--muted);
  font-size: var(--fs-caption);
}

.indeterminate {
  position: relative;
  height: 3px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-pill);
}

.indeterminate::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  width: 36%;
  background: linear-gradient(90deg, transparent, var(--pink), transparent);
  animation: indeterminate 1.4s ease-in-out infinite;
}

@keyframes indeterminate {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(390%); }
}

@keyframes shimmer {
  100% { transform: translateX(100%); }
}

@keyframes route-progress {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(340%); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Bottom navigation ────────────────────────────────────── */
.tabbar {
  position: absolute;
  right: 10px;
  bottom: calc(10px + var(--safe-bottom));
  left: 10px;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  height: var(--nav-height);
  padding: 6px 4px;
  background: rgba(20, 20, 23, 0.9);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.5), inset 0 1px rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  transition: transform 0.3s var(--ease-out), opacity 0.22s;
}

.tabbar.is-hidden {
  transform: translateY(calc(100% + 20px));
  opacity: 0;
  pointer-events: none;
}

.tabbar a {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  /* Unselected #9999A3 / selected #FF9EB4 — brand tokens, not shortjoy #777780. */
  color: #9999a3;
  border-radius: 16px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.2s, background 0.2s;
}

.tabbar a:hover {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.035);
}

.tabbar a[aria-current="page"] {
  color: #ff9eb4;
}

.tabbar a[aria-current="page"] .nav-label {
  color: #ff9eb4;
}

.tabbar a[aria-current="page"] svg {
  color: #ff9eb4;
  filter: drop-shadow(0 0 7px rgba(255, 158, 180, 0.32));
}

.tabbar a[aria-current="page"]::before {
  content: "";
  position: absolute;
  top: 2px;
  width: 16px;
  height: 2px;
  background: var(--pink);
  border-radius: 2px;
  opacity: 0.7;
}

.tabbar .nav-icon {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
}

.tabbar .nav-label {
  line-height: 1;
}

/* ── Toast ────────────────────────────────────────────────── */
.toast-root {
  position: absolute;
  right: 0;
  bottom: calc(90px + var(--safe-bottom));
  left: 0;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 18px;
  pointer-events: none;
}

.toast {
  max-width: 340px;
  padding: 10px 15px;
  color: var(--text);
  background: rgba(29, 29, 34, 0.96);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-pill);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.42);
  font-size: var(--fs-caption);
  line-height: 1.4;
  text-align: center;
  animation: toast-in 0.28s var(--ease-out);
}

.toast.is-out {
  animation: toast-out 0.22s ease forwards;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(6px) scale(0.98); }
}

/* ── Bottom sheet / modal ─────────────────────────────────── */
.overlay-root {
  position: absolute;
  inset: 0;
  z-index: 150;
  pointer-events: none;
}

.overlay-root > * {
  pointer-events: auto;
}

.sheet-backdrop {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 0;
  background: rgba(4, 4, 6, 0.72);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  animation: fade-in 0.22s ease;
}

.sheet {
  width: 100%;
  max-height: 82%;
  overflow-y: auto;
  padding: 8px 18px calc(20px + var(--safe-bottom));
  background: #131316;
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 28px 28px 0 0;
  box-shadow: 0 -26px 80px rgba(0, 0, 0, 0.55);
  animation: sheet-up 0.36s var(--ease-out);
}

.sheet.is-closing {
  animation: sheet-down 0.22s ease forwards;
}

.sheet-handle {
  width: 38px;
  height: 4px;
  margin: 0 auto 14px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-pill);
}

.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.sheet-head h2 {
  color: var(--text);
  font-size: var(--fs-lg);
  font-weight: 800;
  letter-spacing: -0.025em;
}

.sheet-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: var(--fs-caption);
  line-height: 1.55;
}

.sheet-close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.06);
  border-radius: 50%;
}

.sheet-body {
  color: var(--text-dim);
  font-size: var(--fs-base);
  line-height: 1.65;
}

.sheet-body p + p {
  margin-top: 8px;
}

.sheet-actions {
  display: flex;
  gap: 9px;
  margin-top: 18px;
}

.sheet-actions .btn {
  flex: 1;
}

.sheet-note {
  display: flex;
  gap: 8px;
  margin-top: 13px;
  padding: 10px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  font-size: var(--fs-2xs);
  line-height: 1.55;
}

@keyframes fade-in {
  from { opacity: 0; }
}

@keyframes sheet-up {
  from { transform: translateY(100%); }
}

@keyframes sheet-down {
  to { transform: translateY(100%); }
}

/* ── Misc ─────────────────────────────────────────────────── */
.inline-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  font-size: var(--fs-2xs);
  line-height: 1.55;
}

.inline-note svg {
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--pink);
}

.pill-note {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
  padding: 0 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-pill);
  font-size: var(--fs-2xs);
  font-weight: 600;
}

.demo-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 0 8px;
  color: var(--pink);
  background: var(--pink-wash);
  border: 1px solid rgba(255, 158, 180, 0.22);
  border-radius: 6px;
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.demo-badge::before {
  content: "";
  width: 5px;
  height: 5px;
  background: currentColor;
  border-radius: 50%;
  box-shadow: 0 0 7px currentColor;
}

.hairline {
  height: 1px;
  background: var(--line);
}

.stack-2 { display: grid; gap: var(--space-2); }
.stack-3 { display: grid; gap: var(--space-3); }
.stack-4 { display: grid; gap: var(--space-4); }
.row-center { display: flex; align-items: center; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.flex-1 { flex: 1; min-width: 0; }
.text-pink { color: var(--pink); }
.text-gold { color: var(--gold); }
.tabular { font-variant-numeric: tabular-nums; }

/* The BFF banner already consumed the top safe area. */
.source-banner + .page {
  --safe-top: 0px;
}
