:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #eef3f8;
  --ink: #182230;
  --muted: #607086;
  --line: #dce4ee;
  --brand: #0e7a6f;
  --brand-dark: #075b55;
  --accent: #d9483b;
  --success: #16804d;
  --danger: #b42318;
  --shadow: 0 20px 60px rgba(22, 34, 51, 0.10);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 190px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: #fff;
  background: var(--brand);
  border-radius: 8px;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.topnav {
  display: flex;
  flex: 1;
  gap: 8px;
  justify-content: center;
  min-width: 0;
}

.topnav a {
  padding: 9px 12px;
  color: var(--muted);
  border-radius: 8px;
}

.topnav a:hover {
  color: var(--brand-dark);
  background: var(--surface-soft);
}

.user-pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 5px 10px;
  color: var(--brand-dark);
  background: #e1f4ef;
  border: 1px solid #bde4dc;
  border-radius: 8px;
  font-size: 13px;
  white-space: nowrap;
}

.badge.muted {
  color: var(--muted);
  background: var(--surface-soft);
  border-color: var(--line);
}

.badge.success {
  color: var(--success);
  background: #e8f6ee;
  border-color: #c6ead6;
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 26px clamp(16px, 4vw, 48px) 44px;
}

.hero-shell {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 22px;
  align-items: stretch;
  min-height: 420px;
}

.hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 420px;
  padding: clamp(28px, 6vw, 68px);
  color: #fff;
  background:
    linear-gradient(90deg, rgba(9, 46, 48, 0.90), rgba(9, 46, 48, 0.56)),
    url("assets/pages/page-001.webp") center top / cover;
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero-copy .eyebrow,
.hero-copy p {
  color: rgba(255, 255, 255, 0.82);
}

.hero-copy h1 {
  max-width: 720px;
  margin: 12px 0 16px;
  font-size: clamp(36px, 7vw, 72px);
  line-height: 1.05;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 660px;
  margin: 0;
  font-size: 18px;
  line-height: 1.75;
}

.price-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 32px;
}

.price-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 7px 13px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
}

.price-strip .new-price {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 800;
}

.account-panel,
.payment-panel,
.reader-panel,
.quiz-panel,
.upload-panel,
.table-panel,
.login-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.account-panel,
.payment-panel,
.upload-panel,
.login-card {
  padding: 22px;
}

.panel-head,
.section-head,
.reader-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.panel-head h2,
.section-head h2 {
  margin: 4px 0 0;
  font-size: 24px;
}

.panel-head p,
.section-head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.eyebrow {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
}

.tabs,
.category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tabs {
  margin: 20px 0 16px;
}

.tab,
.category-btn,
.ghost-btn,
.icon-btn,
.actions button {
  min-height: 36px;
  padding: 7px 12px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tab.active,
.category-btn.active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(14, 122, 111, 0.14);
}

.primary-btn,
.primary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  color: #fff;
  background: var(--brand);
  border: 1px solid var(--brand);
  border-radius: 8px;
  font-weight: 800;
}

.primary-btn:hover,
.primary-link:hover {
  background: var(--brand-dark);
}

.form-message {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.member-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
  padding: 14px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.member-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.content-band,
.quiz-panel {
  margin-top: 24px;
}

.content-band {
  padding: 24px 0 4px;
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.category-catalog {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.category-group {
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(22, 34, 51, 0.06);
}

.category-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.category-group-head span {
  color: var(--muted);
  font-size: 12px;
}

.category-chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.category-chip {
  min-height: 32px;
  padding: 6px 10px;
  color: var(--muted);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.category-chip.active {
  color: #fff;
  background: var(--brand);
  border-color: var(--brand);
}

.material-card {
  display: grid;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(22, 34, 51, 0.08);
  overflow: hidden;
}

.cover-button {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5.4;
  padding: 0;
  background: #e8edf4;
  border: 0;
  overflow: hidden;
}

.cover-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  transition: transform 0.2s ease;
}

.cover-button:hover img {
  transform: scale(1.03);
}

.material-body {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.material-body h3 {
  min-height: 48px;
  margin: 0;
  font-size: 19px;
  line-height: 1.3;
}

.material-body p {
  min-height: 48px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.material-meta,
.card-price {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.card-price strong {
  color: var(--accent);
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 20px;
  margin-top: 24px;
  align-items: start;
}

.reader-panel {
  overflow: hidden;
}

.reader-head {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.reader-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 42px;
  padding: 0;
  font-size: 28px;
  line-height: 1;
}

.page-jump {
  display: grid;
  grid-template-columns: 76px auto;
  align-items: center;
  gap: 8px;
}

.page-jump input {
  min-height: 38px;
  padding: 8px;
}

.page-jump span {
  color: var(--muted);
  white-space: nowrap;
}

.reader-stage {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 620px;
  padding: 20px;
  background: #dfe6ef;
  overflow: auto;
}

#pdfPage {
  display: block;
  width: min(100%, 900px);
  max-height: 76vh;
  object-fit: contain;
  background: #fff;
  box-shadow: 0 18px 40px rgba(22, 34, 51, 0.18);
  user-select: none;
}

#pdfPage.blurred {
  filter: blur(5px);
}

.reader-empty,
.empty-box {
  display: grid;
  place-items: center;
  min-height: 180px;
  padding: 24px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
  text-align: center;
}

.lock-overlay {
  position: absolute;
  inset: 20px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 12px;
  padding: 24px;
  color: #fff;
  background: rgba(24, 34, 48, 0.76);
  border-radius: 8px;
  text-align: center;
}

.payment-panel {
  position: sticky;
  top: 92px;
}

.pay-code {
  display: block;
  width: min(260px, 100%);
  aspect-ratio: 1;
  margin: 20px auto;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.quiz-panel {
  padding: 22px;
}

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

.question-card {
  margin: 0;
  padding: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.question-card legend {
  padding: 0 6px;
  font-weight: 800;
  line-height: 1.5;
}

.option-row {
  display: flex;
  grid-template-columns: none;
  align-items: flex-start;
  gap: 10px;
  margin-top: 10px;
  color: var(--ink);
}

.option-row input {
  width: 18px;
  min-height: 18px;
  margin-top: 2px;
}

.quiz-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 18px;
}

.site-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 16px;
  padding: 24px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  max-width: min(360px, calc(100vw - 48px));
  padding: 12px 16px;
  color: #fff;
  background: var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.qr-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.48);
}

.qr-dialog {
  width: min(760px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.qr-preview {
  display: grid;
  place-items: center;
  margin-top: 18px;
  padding: 18px;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.qr-preview canvas {
  width: min(100%, 420px);
  height: auto;
  background: #fff;
  border-radius: 8px;
}

.qr-link {
  margin: 14px 0 0;
  color: var(--muted);
  word-break: break-all;
}

.hidden {
  display: none !important;
}

.admin-body {
  background: #f4f6f8;
}

.admin-main {
  max-width: 1480px;
}

.admin-login {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 24px;
  align-items: center;
  min-height: 520px;
}

.admin-login h1 {
  margin: 10px 0;
  font-size: clamp(34px, 6vw, 64px);
  line-height: 1.08;
}

.admin-login p {
  max-width: 720px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.8;
}

.admin-shell {
  display: grid;
  gap: 22px;
}

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

.stat-card {
  display: grid;
  gap: 8px;
  min-height: 130px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 10px 26px rgba(22, 34, 51, 0.06);
}

.stat-card span,
.stat-card small {
  color: var(--muted);
}

.stat-card strong {
  font-size: 30px;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.table-panel {
  overflow: hidden;
}

.table-panel .panel-head {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.table-panel .panel-head.compact {
  padding: 16px 0 12px;
  border-bottom: 0;
}

.member-toolbar,
.member-edit-grid,
.form-actions {
  display: grid;
  gap: 14px;
}

.member-toolbar {
  grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(160px, 220px));
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.member-create-form,
.member-edit-form {
  padding: 0 20px 20px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.member-create-form {
  border-top: 0;
  border-bottom: 1px solid var(--line);
}

.member-edit-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.member-note {
  display: block;
  margin-top: 14px;
}

.form-actions {
  grid-template-columns: repeat(2, minmax(120px, max-content));
  margin-top: 16px;
  align-items: center;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 13px;
}

td small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
}

.table-input {
  width: min(360px, 44vw);
  min-width: 220px;
}

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

.actions .danger {
  color: #fff;
  background: var(--danger);
  border-color: var(--danger);
}

.proof-link {
  color: var(--brand-dark);
  font-weight: 800;
}

@media (max-width: 1180px) {
  .material-grid,
  .category-catalog,
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-shell,
  .workspace-grid,
  .admin-grid,
  .member-toolbar,
  .member-edit-grid,
  .admin-login {
    grid-template-columns: 1fr;
  }

  .payment-panel {
    position: static;
  }
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
  }

  .topnav {
    order: 3;
    width: 100%;
    justify-content: flex-start;
    overflow-x: auto;
  }

  .user-pill {
    margin-left: auto;
  }

  .hero-copy {
    min-height: 500px;
    padding: 28px 20px;
  }

  .material-grid,
  .category-catalog,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .panel-head,
  .section-head,
  .reader-head,
  .quiz-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .reader-tools {
    justify-content: space-between;
  }

  .reader-stage {
    min-height: 420px;
    padding: 12px;
  }

  .account-panel,
  .payment-panel,
  .quiz-panel,
  .upload-panel,
  .login-card {
    padding: 18px;
  }
}
