/* HarborLab (海屿工坊) — Coastal Modern Engineering Design System */
:root {
  color-scheme: light;
  --page: #f2f6fa;
  --paper: #ffffff;
  --surface-tint: #f7fafc;
  --navy: #0b1f33;
  --navy-2: #13304a;
  --ink: #0f2438;
  --muted: #55697e;
  --line: #dbe4ee;
  --line-strong: #c2d1e0;
  --accent: #0e7490;
  --accent-hover: #0a5a70;
  --soft: #e6f5f8;
  --coral: #e85d3f;
  --coral-hover: #cf482b;
  --coral-soft: #fff1ec;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 2px 10px rgba(11, 31, 51, 0.045);
  --shadow-md: 0 12px 32px rgba(11, 31, 51, 0.09);
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, -apple-system, sans-serif;
  font-size: 16px;
}

* { box-sizing: border-box; }
html { scroll-padding-top: 86px; scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--page);
  background-image: radial-gradient(rgba(14, 116, 144, 0.08) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--ink);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
img { display: block; max-width: 100%; height: auto; }
h1, h2, h3, p { margin-block-start: 0; }
h1, h2, h3 { line-height: 1.28; color: var(--navy); }
h1 { font-size: clamp(1.85rem, 3.2vw, 2.55rem); margin-bottom: 14px; letter-spacing: -0.03em; font-weight: 800; }
h2 { font-size: 1.45rem; margin-bottom: 12px; letter-spacing: -0.02em; font-weight: 760; }
h3 { font-size: 1.08rem; margin-bottom: 8px; font-weight: 720; }
:focus-visible { outline: 3px solid #38bdf8; outline-offset: 2px; }

.wrap { width: min(1240px, calc(100% - 56px)); margin-inline: auto; }
.main-wrap { padding-block: 28px 64px; min-height: 70vh; }
.muted { color: var(--muted); }
.small { font-size: 0.86rem; }
.mono { font-family: var(--mono); font-size: 0.85em; }
.center { text-align: center; }
.sr-only, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip:focus { position: absolute; top: 12px; left: 12px; z-index: 50; padding: 10px 16px; color: #fff; background: var(--navy); border-radius: 8px; }

/* Top Accent Stripe & Frosted Architectural Header */
.top-stripe {
  height: 3px;
  background: linear-gradient(90deg, var(--navy) 0%, var(--accent) 55%, var(--coral) 100%);
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; gap: 28px; min-height: 70px; }
.brand { display: inline-flex; align-items: center; gap: 11px; white-space: nowrap; }
.brand img { width: 36px; height: 36px; border-radius: 10px; box-shadow: 0 3px 10px rgba(11, 31, 51, 0.16); }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 1.12rem; font-weight: 800; color: var(--navy); letter-spacing: -0.02em; }
.brand-text small { font-family: var(--mono); font-size: 0.64rem; letter-spacing: 0.18em; color: var(--accent); margin-top: 3px; font-weight: 700; }

.top-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-inline-start: 14px;
  padding: 4px;
  border-radius: 11px;
  background: var(--surface-tint);
  border: 1px solid var(--line);
}
.top-nav a {
  padding: 7px 14px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.16s, color 0.16s;
}
.top-nav a:hover { color: var(--navy); background: rgba(14, 116, 144, 0.08); }
.top-nav a[aria-current] {
  color: #fff;
  background: var(--navy);
  box-shadow: 0 2px 6px rgba(11, 31, 51, 0.18);
}
.user-link {
  margin-inline-start: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  padding: 8px 16px;
  white-space: nowrap;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--navy);
  transition: border-color 0.16s, background 0.16s, transform 0.16s;
}
.user-link:hover { border-color: var(--accent); background: var(--soft); color: var(--accent); }
.user-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--navy);
  color: #cbd5e1;
}
.footer-inner { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 20px 42px; padding-block: 32px; }
.footer-brand-row { display: flex; align-items: center; gap: 10px; color: #fff; }
.footer-brand-row strong { font-size: 1.02rem; letter-spacing: 0.01em; }
.footer-brand p { font-size: 0.84rem; margin: 8px 0 0; color: #94a3b8; }
.footer-links { display: flex; align-items: center; flex-wrap: wrap; gap: 12px 24px; font-size: 0.88rem; color: #cbd5e1; }
.footer-links a:hover { color: #38bdf8; }
.bottom-nav { display: none; }

/* Core Components */
.button {
  min-height: 46px;
  padding: 10px 20px;
  border: 1px solid transparent;
  border-radius: 10px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  color: #fff;
  background: var(--accent);
  font-size: 0.94rem;
  font-weight: 700;
  text-align: center;
  transition: background 0.18s, border-color 0.18s, transform 0.18s, box-shadow 0.18s;
}
.button:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 6px 16px rgba(14, 116, 144, 0.22); }
.button.coral { background: var(--coral); }
.button.coral:hover { background: var(--coral-hover); box-shadow: 0 6px 18px rgba(232, 93, 63, 0.28); }
.button.secondary { background: var(--paper); border-color: var(--line-strong); color: var(--navy); }
.button.secondary:hover { background: var(--soft); border-color: var(--accent); color: var(--accent); box-shadow: none; }
.button.wide { width: 100%; }
.button:disabled { opacity: 0.55; cursor: default; transform: none; box-shadow: none; }

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 3vw, 32px);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}
.back-link, .text-link, .inline-link, .section-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 680;
}
.back-link:hover, .section-link:hover, .inline-link:hover { color: var(--coral); }
.back-link { margin: 2px 0 18px; }
.text-link { display: inline-block; margin-top: 14px; }
.link-button { background: none; border: 0; color: var(--muted); text-decoration: underline; text-underline-offset: 3px; padding: 8px; font-size: 0.88rem; }
.link-button:hover { color: var(--coral); }

.price { color: var(--coral); font-variant-numeric: tabular-nums; font-weight: 820; font-size: 1.28rem; white-space: nowrap; }
.badge, .pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 720;
  letter-spacing: 0.02em;
}
.badge.neutral { background: #edf2f7; color: #475569; }
.badge.paid { color: #0f6b4f; background: #e1f6ee; }
.badge.cancelled, .badge.refunded { color: #5b6978; background: #eef2f6; }

.section-index {
  font-family: var(--mono);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: var(--accent);
  margin: 0 0 6px;
}
.section-index.spaced { margin-top: 26px; }
.eyebrow, .card-kicker {
  margin: 0 0 6px;
  color: var(--accent);
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.notice {
  margin-bottom: 18px;
  padding: 13px 16px;
  border-radius: 11px;
  border: 1px solid #bae6fd;
  background: #f0f9ff;
  color: #0c4a6e;
  font-size: 0.93rem;
}
.notice.error { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.notice.success { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }

/* Architectural Split Hero */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background:
    radial-gradient(620px 380px at 82% 18%, rgba(14, 116, 144, 0.34), transparent 70%),
    radial-gradient(420px 260px at 14% 92%, rgba(232, 93, 63, 0.18), transparent 72%),
    linear-gradient(135deg, #091a2b 0%, #102a43 58%, #0d253b 100%);
  color: #f8fafc;
  display: grid;
  grid-template-columns: 1.04fr 0.96fr;
  align-items: stretch;
  border: 1px solid rgba(56, 189, 248, 0.18);
  box-shadow: 0 22px 48px rgba(11, 31, 51, 0.16);
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.06) 1px, transparent 1px);
  background-size: 40px 40px;
}
.hero-copy {
  position: relative;
  z-index: 1;
  padding: clamp(32px, 4.5vw, 56px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(14, 116, 144, 0.25);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #bae6fd;
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  margin-bottom: 18px;
}
.kicker-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 10px var(--coral); }
.hero h1 {
  color: #fff;
  font-size: clamp(2.35rem, 4.4vw, 3.65rem);
  letter-spacing: -0.04em;
  line-height: 1.15;
  margin: 0 0 18px;
}
.hero h1 em {
  font-style: normal;
  background: linear-gradient(95deg, #38bdf8 0%, #7dd3fc 52%, #fb923c 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-description {
  max-width: 470px;
  margin-bottom: 26px;
  color: #cbd5e1;
  font-size: 0.98rem;
  line-height: 1.75;
}
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 30px; }
.hero-actions .hero-secondary {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(148, 163, 184, 0.34);
}
.hero-actions .hero-secondary:hover { background: rgba(255, 255, 255, 0.16); color: #fff; box-shadow: none; }
.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  padding-top: 22px;
  border-top: 1px solid rgba(148, 163, 184, 0.2);
}
.hero-metrics strong { display: block; font-family: var(--mono); font-size: 1.32rem; color: #fff; font-weight: 800; }
.hero-metrics span { display: block; font-size: 0.8rem; color: #94a3b8; margin-top: 2px; }

.hero-stage {
  position: relative;
  z-index: 1;
  padding: 24px 24px 24px 0;
  display: flex;
  align-items: stretch;
}
.hero-frame {
  position: relative;
  width: 100%;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: #0d2236;
  min-height: 360px;
}
.hero-image { width: 100%; height: 100%; object-fit: cover; object-position: center; }
.hero-caption {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  padding: 12px 15px;
  border-radius: 12px;
  background: rgba(11, 31, 51, 0.78);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.caption-tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: #38bdf8;
}
.hero-caption strong { font-size: 0.84rem; color: #f8fafc; font-weight: 600; }

/* Flagship Projects Section */
.featured-section, .catalog-section { margin-top: 44px; }
.main-wrap > .catalog-section:first-child { margin-top: 6px; }
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.section-head h1, .section-head h2 { margin: 0 0 4px; }
.section-head p, .count { color: var(--muted); font-size: 0.92rem; margin: 0; }

.featured-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.featured-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.featured-card:hover { transform: translateY(-4px); border-color: var(--accent); box-shadow: var(--shadow-md); }
.featured-media { position: relative; overflow: hidden; background: var(--navy); aspect-ratio: 16 / 10; }
.featured-media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s; }
.featured-card:hover .featured-media img { transform: scale(1.04); }
.featured-tag {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(11, 31, 51, 0.86);
  color: #38bdf8;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
}
.featured-copy { padding: 18px; display: flex; flex-direction: column; flex: 1; }
.featured-copy h3 { font-size: 1.08rem; color: var(--navy); margin-bottom: 8px; }
.featured-summary { color: var(--muted); font-size: 0.88rem; margin-bottom: 16px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.featured-meta { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--line); display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.featured-meta span { font-size: 0.82rem; color: var(--muted); }

/* Horizontal Category Bar & Full-Width Course Grid */
.catalog-head { margin-bottom: 18px; }
.search {
  width: min(100%, 390px);
  display: flex;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  gap: 6px;
  padding: 5px;
  box-shadow: var(--shadow-sm);
}
.search:focus-within { border-color: var(--accent); }
.search input { color: var(--ink); background: transparent; padding: 7px 11px; border: 0; width: 100%; min-width: 0; outline: none; }
.search button {
  padding: 7px 18px;
  border: 0;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  transition: background 0.16s;
}
.search button:hover { background: var(--accent); }

.category-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
  padding: 10px;
  border-radius: 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}
.category-bar a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 0.89rem;
  font-weight: 620;
  color: var(--muted);
  background: transparent;
  transition: background 0.16s, color 0.16s;
}
.category-bar a small {
  font-family: var(--mono);
  font-size: 0.74rem;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--page);
  color: var(--muted);
}
.category-bar a:hover { background: var(--soft); color: var(--accent); }
.category-bar a[aria-current] {
  background: var(--navy);
  color: #fff;
}
.category-bar a[aria-current] small {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.product-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.product-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 15px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.product-card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow-md); }
.cover { display: block; position: relative; background: var(--navy); overflow: hidden; }
.cover img { width: 100%; aspect-ratio: 16 / 10; height: auto; object-fit: cover; transition: transform 0.35s; }
.product-card:hover .cover img { transform: scale(1.03); }
.cover-chip {
  position: absolute;
  top: 11px;
  left: 11px;
  padding: 4px 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  color: var(--navy);
  font-size: 0.75rem;
  font-weight: 720;
  box-shadow: 0 2px 8px rgba(11, 31, 51, 0.15);
}
.card-body { padding: 17px; display: flex; flex-direction: column; flex: 1; }
.card-body h2, .card-body h3 { font-size: 1.04rem; margin-bottom: 8px; }
.card-body a:hover { color: var(--accent); }
.card-summary {
  color: var(--muted);
  font-size: 0.89rem;
  margin-bottom: 16px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-bottom {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
  margin-top: auto;
}
.card-meta { display: inline-flex; align-items: center; gap: 5px; font-size: 0.8rem; color: var(--muted); }
.library-grid .card-body .button { margin-top: 14px; }

.pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 14px; padding-top: 28px; font-size: 0.9rem; color: var(--muted); }
.pagination a, .pagination .disabled { border: 1px solid var(--line-strong); background: var(--paper); padding: 8px 16px; border-radius: 9px; font-weight: 620; }
.pagination a { color: var(--navy); }
.pagination a:hover { background: var(--navy); border-color: var(--navy); color: #fff; }
.pagination .disabled { opacity: 0.5; }
.page-indicator { font-family: var(--mono); font-size: 0.84rem; }

/* Product Detail */
.product-detail {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  border-radius: 20px;
  background: var(--paper);
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: var(--shadow-md);
}
.detail-image { background: var(--navy); }
.detail-image img { width: 100%; height: 100%; min-height: 350px; object-fit: cover; }
.detail-copy { padding: clamp(24px, 4vw, 42px); min-width: 0; display: flex; flex-direction: column; justify-content: center; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.detail-copy h1 { margin-top: 0; }
.lead { line-height: 1.75; color: var(--muted); }
.detail-price { display: flex; align-items: baseline; flex-wrap: wrap; gap: 10px 14px; margin: 18px 0 16px; }
.detail-price .price { font-size: 2.2rem; }
.detail-price span { font-size: 0.88rem; color: var(--muted); }

.course-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 22px; }
.fact-tile {
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-tint);
  border: 1px solid var(--line);
}
.fact-tile strong { display: block; font-family: var(--mono); font-size: 1.05rem; color: var(--navy); }
.fact-tile span { display: block; font-size: 0.78rem; color: var(--muted); margin-top: 2px; }

.detail-sections { display: grid; grid-template-columns: 1.55fr 1fr; gap: 18px; margin-top: 20px; align-items: start; }
.chapter-list { margin: 0 0 26px; padding-inline-start: 24px; }
.chapter-list li { padding: 10px 0; border-bottom: 1px solid var(--line); font-weight: 550; }
.chapter-list li::marker { color: var(--accent); font-family: var(--mono); font-weight: 700; }
.preview {
  margin: 0;
  border-left: 4px solid var(--coral);
  border-radius: 0 12px 12px 0;
  background: var(--surface-tint);
  padding: 18px 20px;
  color: var(--ink);
}
.preview strong { display: block; color: var(--navy); margin-bottom: 6px; }
.preview p { margin: 0; color: var(--muted); line-height: 1.75; }
.deliverables { list-style: none; padding: 0; margin: 0 0 16px; }
.deliverables li { display: flex; flex-direction: column; padding: 12px 0; border-bottom: 1px solid var(--line); }
.deliverables b { color: var(--navy); font-size: 0.95rem; }
.deliverables span { font-size: 0.87rem; color: var(--muted); margin-top: 3px; }

/* Auth, Account, Checkout, Support */
.narrow { max-width: 700px; margin-inline: auto; }
.auth-box { max-width: 470px; margin: 28px auto 60px; padding: 0; overflow: hidden; }
.auth-banner {
  background: linear-gradient(135deg, var(--navy) 0%, var(--navy-2) 100%);
  color: #fff;
  padding: 28px 30px 24px;
}
.auth-banner .eyebrow { color: #38bdf8; }
.auth-banner h1 { color: #fff; font-size: 1.7rem; margin: 4px 0 8px; }
.auth-banner p { margin: 0; color: #cbd5e1; font-size: 0.9rem; }
.auth-form { padding: 24px 30px 8px; }
.auth-switch { margin: 16px 30px 8px; font-size: 0.9rem; }
.auth-note { margin: 0 30px 26px; }

label:not(.payment-choice):not(.check) { display: block; font-weight: 660; font-size: 0.9rem; color: var(--navy); margin: 14px 0 6px; }
input:not([type=checkbox]):not([type=radio]):not([type=hidden]), textarea { font-size: 0.98rem; }
.panel input:not([type=checkbox]):not([type=radio]):not([type=hidden]), .panel textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  background: var(--surface-tint);
  color: var(--ink);
  padding: 10px 13px;
  transition: border-color 0.16s, background 0.16s;
}
.panel input:focus, .panel textarea:focus { border-color: var(--accent); background: #fff; outline: none; }
textarea { resize: vertical; min-height: 104px; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); }
.check { display: flex; align-items: flex-start; gap: 9px; font-size: 0.86rem; margin: 15px 0; color: var(--muted); }
.check input { margin: 0.28em 0 0; flex-shrink: 0; }
.check a, .auth-switch a, .reader a:not(.button) { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.auth-box form .button, .ticket .reply, .narrow textarea + .button { margin-top: 16px; }

.account-head, .order-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.account-head h1, .order-row h3 { margin: 6px 0 4px; }
.account-head p, .order-row p { margin-bottom: 0; overflow-wrap: anywhere; }
.order-badges { display: flex; gap: 6px; margin-bottom: 4px; }
.test-balance-card { border-left: 4px solid var(--accent); }
.test-balance-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.account-links { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 28px; }
.account-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.16s, transform 0.16s;
}
.account-links a:hover { border-color: var(--accent); transform: translateY(-2px); }
.account-links a strong { display: block; color: var(--navy); font-size: 1rem; }
.account-links a small { display: block; color: var(--muted); font-size: 0.82rem; margin-top: 3px; }
.account-links a span { color: var(--coral); font-size: 1.25rem; font-weight: 700; }

.order-row-action { display: flex; flex-direction: column; gap: 8px; align-items: end; flex-shrink: 0; }
.order-row-action .button { min-height: 38px; padding: 6px 14px; font-size: 0.88rem; }
.empty { text-align: center; padding-block: 52px; }
.empty-mark { display: block; color: var(--accent); font-size: 2.1rem; margin-bottom: 10px; }
.error-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 18px; }

/* Steps & Checkout */
.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.steps span {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 600;
}
.steps span em {
  font-style: normal;
  font-family: var(--mono);
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--page);
  font-size: 0.76rem;
}
.steps .done { border-color: #bae6fd; color: var(--accent); }
.steps .done em { background: var(--soft); color: var(--accent); }
.steps .active { background: var(--navy); border-color: var(--navy); color: #fff; }
.steps .active em { background: var(--coral); color: #fff; }

.checkout h1 { margin-top: 10px; }
.checkout-amount { font-size: 2.5rem; margin-bottom: 16px; }
.checkout-amount small { font-size: 0.6em; margin-right: 3px; }
.order-product { display: flex; align-items: center; gap: 15px; border-block: 1px solid var(--line); padding-block: 16px; }
.order-product img { width: 88px; height: 64px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.order-product h2 { font-size: 1.06rem; margin: 0 0 4px; }
.order-product p, .order-meta dt { color: var(--muted); font-size: 0.88rem; margin: 0; }
.order-meta { margin: 16px 0; }
.order-meta div { display: flex; justify-content: space-between; gap: 10px; padding-block: 6px; font-size: 0.9rem; }
.order-meta dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-weight: 550; }
.payment-options { border: 0; padding: 0; margin: 18px 0; min-width: 0; }
.payment-options legend { font-weight: 750; color: var(--navy); margin-bottom: 6px; }
.payment-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  margin-top: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  cursor: pointer;
  transition: border-color 0.16s, background 0.16s;
}
.payment-choice:has(input:checked) { border-color: var(--accent); background: var(--soft); }
.payment-choice input { flex: 0 0 17px; width: 17px; height: 17px; margin: 0; }
.payment-choice span { min-width: 0; }
.payment-method, .reply { background: var(--surface-tint); border: 1px solid var(--line); border-radius: 11px; padding: 14px 16px; margin: 12px 0; }
.payment-method p, .reply p { margin: 4px 0 0; }
.qr-frame { display: inline-block; padding: 14px; border-radius: 14px; background: #fff; border: 1px solid var(--line-strong); margin: 10px auto 14px; box-shadow: var(--shadow-sm); }
.payment-qr { margin: 0 auto; width: min(230px, 100%); }
.checkout form + form, .checkout a.button + form, .checkout .button + p, .checkout form + p { margin-top: 11px; }

/* Delivery & Teacher Contact */
.delivery-success { display: flex; align-items: center; gap: 15px; margin-bottom: 18px; }
.delivery-success > span {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  color: #fff;
  background: #0f766e;
  font-size: 1.25rem;
  font-weight: 800;
}
.delivery-success h1 { margin: 0 0 3px; font-size: 1.55rem; }
.delivery-success p { margin: 0; color: var(--muted); font-size: 0.92rem; }

.teacher-contact {
  justify-content: flex-start;
  gap: 13px;
  margin-top: 18px;
  padding: 14px 18px;
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 12px;
  background: linear-gradient(125deg, var(--navy) 0%, #143b5c 100%);
  text-align: start;
}
.teacher-contact:hover { background: linear-gradient(125deg, #102a43 0%, #0e5a74 100%); }
.teacher-contact-dot { width: 10px; height: 10px; flex: 0 0 10px; border-radius: 50%; background: var(--coral); box-shadow: 0 0 12px rgba(232, 93, 63, 0.9); }
.teacher-contact-label { flex: 1; }
.teacher-contact-label small { display: block; margin-top: 2px; color: #bae6fd; font-size: 0.82rem; font-weight: 500; }
.teacher-contact-arrow { font-size: 1.25rem; color: #38bdf8; }

.teacher-dialog {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100dvh - 32px);
  padding: clamp(20px, 5vw, 30px);
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 64px rgba(11, 31, 51, 0.32);
}
.teacher-dialog::backdrop { background: rgba(11, 31, 51, 0.65); backdrop-filter: blur(4px); }
.teacher-dialog h2 { margin: 0 36px 8px 0; }
.teacher-dialog p { color: var(--muted); }
.teacher-dialog-close { position: absolute; top: 10px; right: 10px; width: 42px; height: 42px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 1.4rem; }
.teacher-dialog-close:hover { background: var(--page); color: var(--navy); }
.teacher-qq { margin-bottom: 16px; padding: 14px; border-radius: 11px; background: var(--surface-tint); border: 1px solid var(--line); text-align: center; }
.teacher-qq span { display: block; color: var(--muted); font-size: 0.82rem; }
.teacher-qq strong { display: block; font-family: var(--mono); font-size: 1.55rem; color: var(--navy); letter-spacing: 0.08em; user-select: all; margin-top: 4px; }
.teacher-dialog .teacher-copy-status { margin: 6px 0; min-height: 1.5em; font-size: 0.84rem; text-align: center; color: var(--accent); font-weight: 600; }
@keyframes teacher-contact-pulse {
  from { box-shadow: 0 0 0 0 rgba(232, 93, 63, 0.45); }
  to { box-shadow: 0 0 0 10px rgba(232, 93, 63, 0); }
}
@media (prefers-reduced-motion: no-preference) {
  .teacher-contact { animation: teacher-contact-pulse 2.4s ease-out 2; }
}

.delivery-actions { display: grid; gap: 10px; margin: 16px 0 26px; }
.help-card {
  display: block;
  margin-top: 18px;
  padding: 16px 18px;
  border-radius: 12px;
  background: var(--soft);
  border: 1px solid #bae6fd;
  color: var(--navy);
}
.help-card:hover { background: #d6eef5; }
.help-card strong { display: block; color: var(--accent); margin-bottom: 3px; }
.help-card span { display: block; font-size: 0.86rem; color: var(--muted); }
.preserve-lines { white-space: pre-wrap; overflow-wrap: anywhere; }
.ticket-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ticket > p { margin: 9px 0; overflow-wrap: anywhere; }

/* Reader */
.reader-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); align-items: start; gap: 22px; max-width: 1120px; margin-inline: auto; }
.reader { line-height: 1.85; overflow-wrap: anywhere; }
.reader-centered { max-width: 840px; margin-inline: auto; }
.reader section { margin-block: 28px; }
.reader section h2 { display: flex; align-items: center; gap: 10px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.chapter-num {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 26px;
  padding-inline: 7px;
  border-radius: 7px;
  background: var(--soft);
  color: var(--accent);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 800;
}
.reader pre {
  overflow-x: auto;
  padding: 16px 18px;
  border-radius: 11px;
  background: var(--navy);
  color: #e6f4f8;
  border: 1px solid #1e3a5f;
  font: 0.88rem/1.6 var(--mono);
}
.reader-toc { position: sticky; top: 92px; padding: 20px; }
.reader-toc h2 { font-size: 1.05rem; margin-bottom: 12px; }
.reader-toc ol { padding-inline-start: 20px; margin-bottom: 0; }
.reader-toc li { padding-block: 5px; font-size: 0.87rem; color: var(--muted); }
.reader-toc a:hover { color: var(--accent); text-decoration: underline; }
.table-scroll { overflow-x: auto; margin: 14px 0; }
table { border-collapse: collapse; width: 100%; min-width: 420px; font-size: 0.9rem; }
th, td { border: 1px solid var(--line); padding: 9px 12px; text-align: left; vertical-align: top; }
th { background: var(--soft); color: var(--navy); font-weight: 700; }

@media (max-width: 1020px) {
  .hero { grid-template-columns: 1fr; }
  .hero-stage { padding: 0 24px 24px; }
  .hero-frame { min-height: 260px; max-height: 340px; }
  .featured-grid, .product-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .wrap { width: calc(100% - 28px); }
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .main-wrap { padding-block: 18px 36px; }
  .header-inner { min-height: 60px; gap: 12px; }
  .brand img { width: 32px; height: 32px; }
  .brand-text strong { font-size: 1rem; }
  .top-nav { display: none; }
  .user-link { font-size: 0.82rem; padding: 6px 12px; }
  .bottom-nav {
    display: flex;
    position: fixed;
    bottom: 0;
    inset-inline: 0;
    z-index: 30;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
    padding: 6px 8px calc(7px + env(safe-area-inset-bottom));
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 44px; color: var(--muted); font-size: 0.74rem; }
  .bottom-nav a[aria-current] { color: var(--accent); font-weight: 750; }
  .bottom-nav svg { width: 20px; height: 20px; stroke: currentColor; stroke-width: 1.8; fill: none; stroke-linecap: round; stroke-linejoin: round; }

  .hero { border-radius: 16px; }
  .hero-copy { padding: 26px 20px 20px; }
  .hero h1 { font-size: clamp(2rem, 9vw, 2.7rem); }
  .hero-metrics { gap: 10px; }
  .hero-metrics strong { font-size: 1.1rem; }
  .hero-stage { padding: 0 16px 16px; }
  .hero-frame { min-height: 200px; }

  .section-head { flex-direction: column; align-items: stretch; gap: 10px; }
  .search { width: 100%; }
  .category-bar { flex-wrap: nowrap; overflow-x: auto; padding: 8px; scrollbar-width: thin; }
  .category-bar a { flex: 0 0 auto; white-space: nowrap; padding: 7px 11px; font-size: 0.84rem; }

  .featured-grid, .product-grid { grid-template-columns: 1fr; gap: 14px; }
  .product-detail, .detail-sections, .reader-layout, .account-links { grid-template-columns: minmax(0, 1fr); }
  .detail-image img { min-height: 0; max-height: 240px; }
  .course-facts { gap: 8px; }
  .reader-toc { position: static; }
  .steps span { font-size: 0.78rem; padding: 7px 6px; gap: 5px; }
  .auth-box { margin: 14px auto 36px; }
  .auth-form, .auth-banner { padding-inline: 20px; }
  .auth-switch, .auth-note { margin-inline: 20px; }
  .account-head, .order-row { flex-direction: column; align-items: flex-start; }
  .order-row-action { align-items: flex-start; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
