:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #20242c;
  --muted: #69717d;
  --line: #dfe4ea;
  --accent: #116b5f;
  --accent-strong: #0b4d44;
  --warn: #b45309;
  --danger: #b42318;
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: clip;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

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

input,
button {
  font: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 64px;
  padding: 0 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
}

.topbar.legacy-topbar {
  min-height: 70px;
  padding: 0 max(24px, calc((100vw - 1280px) / 2 + 24px));
  border-bottom: 1px solid #e2e8f0;
  background: rgba(255, 255, 255, .95);
  box-shadow: none;
}

.legacy-topbar .brand {
  color: #0f172a;
  font-size: 20px;
}

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

.legacy-logo-img {
  display: block;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 4px 6px rgba(234, 88, 12, .16);
}

.legacy-logo-text {
  display: grid;
  gap: 2px;
  white-space: nowrap;
}

.legacy-logo-text strong {
  color: #0f172a;
  font-size: 18px;
  line-height: 1;
}

.legacy-logo-text small {
  color: #ea580c;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
}

.legacy-topbar .nav {
  gap: 5px;
}

.legacy-topbar .nav a {
  padding: 8px 15px;
  border-radius: 999px;
  color: #64748b;
  font-size: 14px;
  font-weight: 600;
}

.legacy-topbar .nav a:hover,
.legacy-topbar .nav a.active {
  background: #eff6ff;
  color: #2563eb;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-left: auto;
}

.btn-text {
  padding: 6px 12px;
  color: #64748b;
  font-size: 14px;
  font-weight: 700;
}

.btn-text:hover {
  color: #1e293b;
}

.btn-outline {
  padding: 8px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  color: #1e293b;
  font-size: 14px;
  font-weight: 700;
}

.btn-outline:hover {
  border-color: #94a3b8;
  background: #f8fafc;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  padding: 9px 20px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #ea580c, #c2410c);
  color: #fff;
  box-shadow: 0 4px 10px rgba(234, 88, 12, .25);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.btn-download:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(234, 88, 12, .35);
}

.user-profile-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  background: #f1f5f9;
}

.user-profile-btn:hover {
  background: #e2e8f0;
}

.user-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #fff;
  color: #ea580c;
  box-shadow: 0 2px 4px rgba(0, 0, 0, .05);
  font-size: 12px;
  font-weight: 800;
}

.user-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  object-fit: cover;
}

.legacy-nav-username {
  max-width: 150px;
  overflow: hidden;
  padding-right: 8px;
  color: #1e293b;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.legacy-logout {
  padding: 4px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #94a3b8;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.legacy-logout:hover {
  background: #fef2f2;
  color: #ef4444;
}

.mobile-nav-toggle,
.mobile-nav-panel {
  display: none;
}

.brand {
  font-size: 22px;
  font-weight: 800;
  color: var(--accent-strong);
}

.nav {
  display: flex;
  gap: 16px;
  color: var(--muted);
}

.nav a:hover,
.nav a.active {
  color: var(--text);
}

.session {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.main {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

body.client-embed {
  background: #fff;
}

body.client-embed .topbar,
body.client-embed .mobile-nav-panel {
  display: none;
}

body.client-embed .site-footer {
  display: none;
}

body.client-embed .main {
  width: 100%;
  min-height: 100vh;
  padding: 0;
}

.site-footer {
  margin-top: 24px;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
}

.site-footer-inner {
  width: min(1280px, calc(100vw - 48px));
  margin: 0 auto;
  padding: 42px 0 22px;
}

.footer-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) repeat(4, minmax(130px, 1fr));
  gap: 32px;
}

.footer-brand h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  color: #0f172a;
  font-size: 18px;
  font-weight: 900;
}

.footer-logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  overflow: hidden;
  border-radius: 6px;
  background: #ea580c;
  box-shadow: 0 4px 10px rgba(234, 88, 12, .18);
}

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

.footer-desc {
  max-width: 360px;
  margin: 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.75;
}

.footer-col h4 {
  margin: 0 0 14px;
  color: #0f172a;
  font-size: 15px;
  font-weight: 900;
}

.footer-col ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  color: #64748b;
  font-size: 14px;
  list-style: none;
}

.footer-col a:hover {
  color: #ea580c;
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 34px;
  padding-top: 18px;
  border-top: 1px solid #eef2f7;
  color: #64748b;
  font-size: 13px;
}

.footer-sep {
  margin: 0 5px;
}

.footer-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.footer-status a {
  margin-right: 6px;
}

.footer-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
}

@media (max-width: 900px) {
  .footer-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .footer-brand {
    grid-column: 1 / -1;
  }

  .footer-bottom {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .site-footer {
    margin-top: 14px;
  }

  .site-footer-inner {
    width: min(1280px, calc(100% - 20px));
    padding: 12px 0 10px;
  }

  .footer-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 14px;
  }

  .footer-brand {
    display: none;
  }

  .footer-grid .footer-col {
    display: block;
    min-width: 0;
  }

  .footer-grid .footer-col ul {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 10px;
  }

  .footer-col h4 {
    margin: 0 0 5px;
    font-size: 13px;
  }

  .footer-col ul {
    gap: 5px;
    font-size: 12px;
    line-height: 1.35;
  }

  .footer-col li {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .footer-bottom {
    gap: 5px;
    margin-top: 9px;
    padding-top: 9px;
    font-size: 12px;
    line-height: 1.45;
  }

  .footer-sep {
    margin: 0 3px;
  }

  .footer-status {
    flex-wrap: wrap;
    gap: 5px;
  }

  .footer-status-dot {
    width: 5px;
    height: 5px;
  }
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 440px);
  gap: 32px;
  align-items: end;
  min-height: 260px;
  padding: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: stretch;
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, #ffffff 0%, #eef6f3 100%);
}

.hero-copy h1,
.page-heading h1 {
  margin: 8px 0 12px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.12;
}

.hero-copy p,
.page-heading p {
  max-width: 720px;
}

.hero-search {
  max-width: 680px;
  margin-top: 24px;
}

.home-member-card {
  display: grid;
  align-content: space-between;
  gap: 18px;
  padding: 22px;
  border: 1px solid #cddbd7;
  border-radius: 8px;
  background: #fff;
}

.home-member-card strong,
.hero-stat {
  display: block;
  font-size: 22px;
  color: var(--accent-strong);
}

.home-member-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.home-band {
  margin-top: 28px;
}

.page-heading {
  padding: 22px 0 6px;
}

.hero h1 {
  max-width: 720px;
  margin: 8px 0 12px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1.08;
}

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

.searchbar {
  position: relative;
  display: flex;
  gap: 10px;
  align-items: stretch;
}

.searchbar.wide {
  max-width: 760px;
}

.searchbar input {
  min-width: 0;
  flex: 1;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

.button.secondary {
  background: #fff;
  color: var(--accent-strong);
}

.grid {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.panel h2,
.section-title h2,
.section-title h1 {
  margin: 0 0 14px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 28px 0 14px;
}

.book-grid,
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.book-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.book-card {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 14px;
  min-height: 106px;
  padding: 8px 16px 8px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.book-card:hover {
  border-color: #a8c9c1;
  box-shadow: 0 8px 24px rgba(17, 107, 95, .08);
}

.book-cover {
  position: relative;
  overflow: hidden;
  display: grid;
  width: 120px;
  aspect-ratio: 4 / 3;
  place-items: center;
  border-radius: 6px;
  background: #e4f0ed;
  color: var(--accent-strong);
  font-weight: 800;
}

.book-cover.large {
  width: 140px;
  aspect-ratio: 4 / 3;
  font-size: 28px;
}

.book-cover-image {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.book-cover-fallback {
  position: relative;
  z-index: 0;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
}

.book-body {
  min-width: 0;
}

.book-body h3 {
  margin: 2px 0 8px;
  font-size: 17px;
  line-height: 1.35;
}

.book-category-tag {
  display: inline-flex;
  max-width: 100%;
  margin: 0 0 8px;
  padding: 3px 8px;
  border-radius: 4px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.3;
}

.book-desc {
  display: -webkit-box;
  overflow: hidden;
  color: var(--muted);
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.book-detail-head {
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.book-detail-head h1 {
  margin: 0 0 10px;
}

.detail-summary {
  margin-top: 18px;
  color: var(--text);
}

.status-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.status-badge,
.section-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid #cddbd7;
  border-radius: 999px;
  background: #f5faf8;
  color: var(--accent-strong);
}

.status-badge.category-badge {
  border-color: transparent;
  color: #fff;
}

.section-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.state-grid,
.account-overview {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.state-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.state-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.state-item strong {
  display: block;
  margin-top: 6px;
}

.notice,
.empty {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
}

.notice.strong {
  color: var(--accent-strong);
  border-color: #b9d6cf;
  background: #f5faf8;
}

.mini-card {
  display: grid;
  gap: 10px;
}

.mini-card h3 {
  margin: 0;
}

.mini-card p {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
}

.mini-card ul {
  margin: 0;
  padding-left: 18px;
}

.plan-card {
  display: grid;
  gap: 12px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.price {
  font-size: 26px;
  font-weight: 800;
  color: var(--accent-strong);
}

.suggestion-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.suggestion-row button {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  cursor: pointer;
}

.category-list,
.category-list ul {
  margin: 0;
  padding-left: 18px;
}

.category-list li {
  margin: 8px 0;
}

.category-list a {
  color: var(--accent-strong);
}

.announcement-list {
  display: grid;
  gap: 12px;
}

.announcement-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.announcement-item h3,
.announcement-item p {
  margin: 0;
}

.debug {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.debug summary {
  cursor: pointer;
  padding: 12px 0 0;
}

.debug pre {
  max-height: 360px;
  padding: 12px;
  border-radius: 8px;
  background: #f3f5f7;
}

.debug:not([open]) pre {
  display: none;
}

.card {
  display: grid;
  gap: 10px;
  min-height: 142px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.card h3 {
  margin: 0;
  font-size: 18px;
}

.list {
  display: grid;
  gap: 10px;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.stack {
  display: grid;
  gap: 18px;
}

.legacy-download-page {
  width: min(1180px, calc(100% - 32px));
  margin: 28px auto 50px;
}

.legacy-download-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: stretch;
  padding: 34px;
  border: 1px solid #dfe7f2;
  border-radius: 20px;
  background:
    radial-gradient(circle at 82% 18%, rgba(249, 115, 22, 0.2), transparent 30%),
    linear-gradient(135deg, #111827 0%, #1f2937 58%, #4a2e2a 100%);
  color: #fff;
  box-shadow: 0 18px 44px rgba(15, 23, 42, 0.16);
}

.legacy-download-kicker {
  display: inline-flex;
  margin-bottom: 14px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: #fed7aa;
  font-size: 13px;
  font-weight: 700;
}

.legacy-download-hero h1 {
  margin: 0 0 12px;
  font-size: 36px;
  line-height: 1.18;
}

.legacy-download-hero p {
  max-width: 620px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 16px;
  line-height: 1.8;
}

.legacy-download-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}

.legacy-download-primary,
.legacy-download-secondary,
.legacy-download-card a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
}

.legacy-download-primary {
  background: #f97316;
  color: #fff;
  box-shadow: 0 12px 24px rgba(249, 115, 22, 0.28);
}

.legacy-download-secondary {
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.legacy-download-badge {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  min-height: 190px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.08);
  text-align: center;
}

.legacy-download-badge strong {
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border-radius: 24px;
  background: linear-gradient(135deg, #fb923c, #ea580c);
  color: #fff;
  font-size: 30px;
  box-shadow: 0 18px 30px rgba(249, 115, 22, 0.32);
}

.legacy-download-badge span {
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.legacy-download-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
}

.legacy-download-card {
  display: grid;
  align-content: start;
  gap: 12px;
  min-height: 230px;
  padding: 24px;
  border: 1px solid #dfe7f2;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 14px 34px rgba(15, 23, 42, 0.06);
}

.client-mark {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 16px;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
}

.client-mark.windows {
  background: linear-gradient(135deg, #2563eb, #0f766e);
}

.client-mark.android {
  background: linear-gradient(135deg, #22c55e, #15803d);
}

.client-mark.ios {
  background: linear-gradient(135deg, #64748b, #111827);
}

.legacy-download-card h2 {
  margin: 0;
  color: #0f172a;
  font-size: 20px;
}

.legacy-download-card p {
  margin: 0;
  color: #64748b;
  font-size: 14px;
  line-height: 1.75;
}

.legacy-download-card a {
  justify-self: start;
  margin-top: auto;
  border: 1px solid #0f766e;
  background: #fff;
  color: #0f766e;
}

.legacy-download-note {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 20px;
  padding: 16px 18px;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 14px;
}

.legacy-download-note strong {
  flex: 0 0 auto;
  color: #ea580c;
}

.auth-page {
  display: grid;
  min-height: calc(100vh - 160px);
  place-items: center;
}

.auth-card {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.auth-card label {
  display: grid;
  gap: 6px;
}

.auth-card input {
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.login-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.login-options .button {
  min-width: 0;
  padding: 0 10px;
  color: var(--muted);
  cursor: not-allowed;
}

.contact-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.contact-actions .button {
  cursor: not-allowed;
}

.contact-panel,
.sync-panel {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.contact-card {
  display: grid;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.contact-card h4 {
  margin: 0;
}

.contact-bound {
  margin: 0;
  font-weight: 700;
  color: var(--accent-strong);
}

.contact-form {
  display: grid;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.contact-form label {
  display: grid;
  gap: 6px;
}

.contact-form input {
  height: 40px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.alert {
  padding: 10px 12px;
  border: 1px solid #fecaca;
  border-radius: 6px;
  background: #fff1f2;
  color: var(--danger);
}

.suggestions {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 88px;
  z-index: 10;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 12px 32px rgba(0, 0, 0, .08);
}

.suggestions button {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  background: #fff;
  text-align: left;
  cursor: pointer;
}

.suggestions button:hover {
  background: #f1f5f4;
}

.tabs {
  display: flex;
  gap: 8px;
}

.tabs button {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.tabs button.active {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.detail {
  min-height: 220px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.reader-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: calc(100vh - 160px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.reader-side {
  padding: 22px;
  border-right: 1px solid var(--line);
}

.reader-canvas {
  display: grid;
  place-items: center;
  padding: 32px;
  color: var(--muted);
}

pre {
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: 420px;
  padding: 12px 14px;
  border-radius: 6px;
  background: #17202a;
  color: #fff;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .hero,
  .home-hero,
  .grid.two,
  .reader-shell {
    grid-template-columns: 1fr;
  }

  .topbar {
    position: sticky;
    top: 0;
    display: flex;
    flex-wrap: nowrap;
    min-height: 52px;
    padding: 8px 12px;
    gap: 10px;
    background: rgba(255, 255, 255, .98);
  }

  .topbar.legacy-topbar {
    min-height: 52px;
    padding: 8px 12px;
  }

  .mobile-nav-toggle {
    display: inline-flex;
    flex-direction: column;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    border: 1px solid #e2e8f0;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 3px 8px rgba(15, 23, 42, .05);
  }

  .mobile-nav-toggle span {
    display: block;
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: #334155;
  }

  .legacy-brand,
  .brand {
    flex: 0 1 auto;
    min-width: 0;
  }

  .topbar:not(.legacy-topbar) .brand {
    display: block;
    flex: 1 1 auto;
    max-width: calc(100vw - 150px);
    overflow: hidden;
    color: #0f766e;
    font-size: 16px;
    line-height: 1;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .legacy-brand {
    gap: 8px;
    max-width: calc(100vw - 154px);
  }

  .legacy-logo-text {
    min-width: 0;
    overflow: hidden;
  }

  .legacy-logo-img {
    width: 34px;
    height: 34px;
    flex-basis: 34px;
    border-radius: 8px;
  }

  .legacy-logo-text strong {
    font-size: 15px;
  }

  .legacy-logo-text small {
    font-size: 10px;
    letter-spacing: .4px;
  }

  .topbar > .nav {
    display: none;
  }

  .header-actions,
  .session {
    flex: 0 0 auto;
    margin-left: auto;
    gap: 8px;
  }

  .topbar:not(.legacy-topbar) .session {
    gap: 6px;
  }

  .topbar:not(.legacy-topbar) .session [data-auth-name] {
    display: none;
  }

  .topbar:not(.legacy-topbar) .session .button {
    min-height: 34px;
    padding: 7px 10px;
    border-radius: 9px;
    font-size: 12px;
    white-space: nowrap;
  }

  .header-actions {
    justify-content: flex-end;
    min-width: 0;
  }

  .header-actions:has([data-legacy-user-actions]:not(.hidden)) .btn-download {
    display: none;
  }

  .header-actions [data-legacy-guest-actions] {
    display: none !important;
  }

  .btn-download {
    min-height: 34px;
    padding: 8px 10px;
    border-radius: 9px;
    font-size: 12px;
    white-space: nowrap;
  }

  .btn-download svg {
    display: none;
  }

  .btn-text,
  .btn-outline {
    padding: 7px 8px;
    font-size: 13px;
  }

  .user-profile-btn {
    width: 38px;
    height: 38px;
    justify-content: center;
    padding: 3px;
  }

  .legacy-nav-username {
    display: none;
  }

  .legacy-logout {
    display: none;
  }

  .main {
    width: 100%;
    padding: 16px 0 38px;
  }

  .mobile-nav-panel {
    position: fixed;
    top: 52px;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 4000;
    display: none;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    pointer-events: none;
    visibility: hidden;
  }

  .mobile-nav-panel.open {
    display: block;
    pointer-events: auto;
    visibility: visible;
  }

  .mobile-nav-mask {
    position: absolute;
    inset: 0;
    width: 100%;
    max-width: 100%;
    background: rgba(15, 23, 42, .46);
    opacity: 0;
    transition: opacity .18s ease;
  }

  .mobile-nav-panel.open .mobile-nav-mask {
    opacity: 1;
  }

  .mobile-nav-drawer {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: min(82vw, 286px);
    overflow-y: auto;
    padding: 12px;
    background: #fff;
    box-shadow: 16px 0 38px rgba(15, 23, 42, .18);
    transform: translateX(-102%);
    transition: transform .22s cubic-bezier(.4, 0, .2, 1);
  }

  .mobile-nav-panel.open .mobile-nav-drawer {
    transform: translateX(0);
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  .mobile-nav-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 12px;
    border-bottom: 1px solid #eef2f7;
  }

  .mobile-nav-brand {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .mobile-nav-brand img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
  }

  .mobile-nav-brand span {
    display: grid;
    gap: 2px;
  }

  .mobile-nav-brand strong {
    color: #0f172a;
    font-size: 16px;
  }

  .mobile-nav-brand small {
    color: #ea580c;
    font-size: 10px;
    font-weight: 800;
  }

  .mobile-nav-close {
    width: 32px;
    height: 32px;
    border: 1px solid #e2e8f0;
    border-radius: 50%;
    background: #fff;
    color: #64748b;
    font-size: 22px;
    line-height: 1;
  }

  .mobile-nav-links {
    display: grid;
    gap: 3px;
    padding: 12px 0;
  }

  .mobile-nav-links a {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 42px;
    padding: 0 10px 0 14px;
    border-radius: 10px;
    color: #1e293b;
    font-size: 15px;
    font-weight: 800;
  }

  .mobile-nav-links a::after {
    content: "›";
    color: #94a3b8;
    font-size: 22px;
    font-weight: 400;
  }

  .mobile-nav-links a:hover {
    background: #fff7ed;
    color: #ea580c;
  }

  .mobile-nav-actions {
    display: grid;
    gap: 8px;
    padding-top: 9px;
    border-top: 1px solid #eef2f7;
  }

  .mobile-primary-action,
  .mobile-secondary-action {
    display: grid;
    min-height: 40px;
    place-items: center;
    border-radius: 10px;
    font-weight: 900;
  }

  .mobile-primary-action {
    background: linear-gradient(135deg, #ea580c, #c2410c);
    color: #fff;
  }

  .mobile-secondary-action {
    border: 1px solid #e2e8f0;
    background: #fff;
    color: #334155;
  }

  .mobile-nav-links a:active,
  .mobile-primary-action:active,
  .mobile-secondary-action:active {
    transform: scale(.99);
  }

  .hero {
    padding: 24px;
  }

  .home-hero {
    padding: 22px;
  }

  .legacy-download-page {
    width: min(1180px, calc(100% - 20px));
    margin: 6px auto 22px;
  }

  .legacy-download-hero {
    grid-template-columns: 1fr;
    gap: 7px;
    padding: 11px 12px;
    border-radius: 14px;
  }

  .legacy-download-kicker {
    margin-bottom: 5px;
    padding: 2px 8px;
    font-size: 11px;
  }

  .legacy-download-hero h1 {
    margin-bottom: 5px;
    font-size: 20px;
    line-height: 1.16;
  }

  .legacy-download-hero p {
    display: -webkit-box;
    overflow: hidden;
    font-size: 12.5px;
    line-height: 1.42;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .legacy-download-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    margin-top: 8px;
  }

  .legacy-download-primary,
  .legacy-download-secondary {
    min-height: 34px;
    padding: 0 8px;
    border-radius: 8px;
    font-size: 12px;
  }

  .legacy-download-badge {
    display: none;
  }

  .legacy-download-badge strong {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    font-size: 20px;
  }

  .legacy-download-grid {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 8px;
  }

  .legacy-download-card {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 5px 10px;
    min-height: 0;
    padding: 10px;
    border-radius: 12px;
  }

  .client-mark {
    grid-row: span 2;
    width: 42px;
    height: 42px;
    border-radius: 13px;
    font-size: 11px;
  }

  .legacy-download-card h2 {
    align-self: end;
    font-size: 15.5px;
    line-height: 1.25;
  }

  .legacy-download-card p {
    font-size: 12px;
    line-height: 1.34;
  }

  .legacy-download-card a {
    grid-column: 1 / -1;
    justify-self: stretch;
    min-height: 32px;
    margin-top: 2px;
    border-radius: 8px;
    font-size: 13px;
  }

  .legacy-download-note {
    align-items: flex-start;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 11px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.6;
  }

  .book-detail-head,
  .book-card {
    grid-template-columns: 1fr;
  }

  .reader-side {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
}

@media (max-width: 340px) {
  .topbar,
  .topbar.legacy-topbar {
    gap: 8px;
    padding: 8px 10px;
  }

  .legacy-logo-img {
    width: 32px;
    height: 32px;
    flex-basis: 32px;
  }

  .legacy-logo-text strong {
    font-size: 14px;
  }

  .legacy-brand {
    max-width: calc(100vw - 142px);
  }

  .legacy-logo-text small {
    display: none;
  }

  .header-actions:has([data-legacy-user-actions]:not(.hidden)) {
    gap: 4px;
  }

  .header-actions:has([data-legacy-user-actions]:not(.hidden)) .user-profile-btn {
    width: 34px;
    height: 34px;
  }

  .btn-download {
    padding: 8px 9px;
  }
}

@media (max-width: 560px) {
  .book-card,
  .std-row,
  .std-list-card {
    min-width: 0;
  }

  .book-card h3,
  .std-title,
  .std-code {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .book-meta,
  .std-meta,
  .std-tags {
    flex-wrap: wrap;
    min-width: 0;
  }

  .footer-col a {
    display: inline-block;
    max-width: 100%;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 560px) {
  .legacy-download-hero {
    padding: 10px 11px;
  }

  .legacy-download-kicker {
    margin-bottom: 3px;
  }

  .legacy-download-hero h1 {
    margin-bottom: 4px;
    font-size: 19px;
  }

  .legacy-download-actions {
    margin-top: 7px;
  }

  .legacy-download-primary,
  .legacy-download-secondary {
    min-height: 32px;
    font-size: 11.5px;
  }

  .legacy-download-card {
    grid-template-columns: 38px minmax(0, 1fr);
    padding: 9px 10px;
  }

  .client-mark {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    font-size: 10px;
  }

  .legacy-download-card h2 {
    font-size: 14.5px;
  }

  .legacy-download-card p {
    display: -webkit-box;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .legacy-download-card a {
    min-height: 30px;
    font-size: 12px;
  }
}

@media (max-width: 340px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  main,
  main > *,
  .container,
  .panel,
  .card,
  .page-shell,
  .content-shell {
    min-width: 0;
    max-width: 100%;
  }

  img,
  picture,
  video,
  canvas,
  iframe {
    max-width: 100%;
  }

  input,
  textarea,
  select,
  button {
    max-width: 100%;
  }

  table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  dialog {
    width: min(560px, calc(100% - 20px));
    max-width: calc(100vw - 20px);
    max-height: calc(100dvh - 20px);
  }

  .toast {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    left: 12px;
    max-width: none;
  }
}
