:root {
  --bg: #f8f7f3;
  --surface: #ffffff;
  --surface-2: #f1efe9;
  --ink: #12202e;
  --ink-2: #425466;
  --muted: #6c7d8e;
  --line: #e2dfd7;
  --math: #0e7490;
  --math-soft: #ecfeff;
  --math-line: #a5f3fc;
  --physics: #c2410c;
  --physics-soft: #fff7ed;
  --physics-line: #fed7aa;
  --biology: #047857;
  --biology-soft: #ecfdf5;
  --biology-line: #a7f3d0;
  --brand: #12202e;
  --shadow-sm: 0 2px 10px rgba(18, 32, 46, 0.05);
  --shadow-md: 0 14px 36px rgba(18, 32, 46, 0.09);
  --radius: 16px;
  --font-sans: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-serif: "Songti SC", "Noto Serif CJK SC", "Source Han Serif SC", Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button, input { font-family: inherit; }

/* Sticky Top Navigation */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 64px;
  background: rgba(248, 247, 243, 0.88);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.nav-inner {
  max-width: 1240px;
  height: 100%;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}

.brand-seal {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #12202e, #0e7490);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.5px;
  box-shadow: 0 4px 12px rgba(14, 116, 144, 0.24);
}

.brand-name {
  font-size: 16px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.2px;
}

.brand-en {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 6px;
}

.nav-link {
  padding: 7px 13px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  transition: all 0.16s ease;
}

.nav-link:hover {
  background: var(--surface);
  color: var(--ink);
}

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}

.btn:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn-primary:hover {
  background: #1d354c;
  border-color: #1d354c;
  color: #fff;
}

.btn-math { background: var(--math); border-color: var(--math); color: #fff; }
.btn-math:hover { background: #0c627a; border-color: #0c627a; color: #fff; }
.btn-physics { background: var(--physics); border-color: var(--physics); color: #fff; }
.btn-physics:hover { background: #9a3412; border-color: #9a3412; color: #fff; }
.btn-biology { background: var(--biology); border-color: var(--biology); color: #fff; }
.btn-biology:hover { background: #065f46; border-color: #065f46; color: #fff; }

/* Page Container */
.wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Hero Section */
.hero {
  padding: 52px 0 42px;
  display: grid;
  grid-template-columns: 1.08fr 1fr;
  gap: 44px;
  align-items: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--math);
  background: var(--math-soft);
  border: 1px solid var(--math-line);
  padding: 5px 12px;
  border-radius: 99px;
  margin-bottom: 16px;
}

.hero h1 {
  font-size: clamp(30px, 3.8vw, 44px);
  font-weight: 850;
  line-height: 1.22;
  letter-spacing: -0.6px;
  margin: 0 0 16px;
}

.hero h1 em {
  font-style: normal;
  background: linear-gradient(120deg, var(--math), var(--biology));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-lead {
  font-size: 15.5px;
  color: var(--ink-2);
  margin: 0 0 24px;
  max-width: 560px;
}

.hero-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 26px;
}

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

.stat-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
}

.stat-num {
  font-size: 20px;
  font-weight: 850;
  font-family: var(--font-mono);
  line-height: 1.15;
}

.stat-lbl {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 3px;
}

/* Hero Visual Mosaic */
.hero-mosaic {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  grid-template-rows: 195px 175px;
  gap: 12px;
}

.mosaic-card {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #0d1626;
  box-shadow: var(--shadow-md);
  display: block;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.mosaic-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 44px rgba(18, 32, 46, 0.16);
}

.mosaic-card.tall {
  grid-row: 1 / 3;
}

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

.mosaic-caption {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 8px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(12, 22, 36, 0.82);
  backdrop-filter: blur(8px);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mosaic-caption > div {
  min-width: 0;
  flex: 1;
}

.mosaic-caption strong {
  display: block;
  font-size: 12.5px;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mosaic-caption span {
  display: block;
  font-size: 10.5px;
  color: rgba(255, 255, 255, 0.78);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mosaic-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.16);
  white-space: nowrap;
}

/* Section Headers */
.section {
  padding: 34px 0 18px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.section-title {
  font-size: 24px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.3px;
}

.section-sub {
  font-size: 13.5px;
  color: var(--muted);
  margin: 4px 0 0;
}

/* Three Discipline Studios Grid */
.studios-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.studio-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.studio-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.studio-media {
  position: relative;
  height: 184px;
  background: #0e1726;
  overflow: hidden;
}

.studio-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.studio-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 4px 10px;
  border-radius: 99px;
  font-size: 11.5px;
  font-weight: 750;
  color: #fff;
}

.badge-math { background: var(--math); }
.badge-physics { background: var(--physics); }
.badge-biology { background: var(--biology); }

.studio-body {
  padding: 18px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.studio-body h3 {
  font-size: 18px;
  font-weight: 800;
  margin: 0 0 6px;
}

.studio-desc {
  font-size: 13px;
  color: var(--ink-2);
  margin: 0 0 14px;
  line-height: 1.6;
}

.studio-highlights {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 12.5px;
  color: var(--ink-2);
}

.studio-highlights li::before {
  content: "✓";
  font-weight: 800;
  margin-right: 7px;
  color: var(--math);
}
.studio-card[data-subj="physics"] .studio-highlights li::before { color: var(--physics); }
.studio-card[data-subj="biology"] .studio-highlights li::before { color: var(--biology); }

.studio-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
  margin-bottom: 14px;
}

.quick-chip {
  font-size: 11.5px;
  font-weight: 650;
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  transition: all 0.14s ease;
}

.quick-chip:hover {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.studio-footer-btn {
  width: 100%;
}

/* Search & Filter Directory */
.directory-bar {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.filter-pill {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  padding: 6px 12px;
  border-radius: 99px;
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.14s ease;
}

.filter-pill:hover { border-color: var(--ink); color: var(--ink); }
.filter-pill.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.filter-pill.active[data-subj="math"] { background: var(--math); border-color: var(--math); }
.filter-pill.active[data-subj="physics"] { background: var(--physics); border-color: var(--physics); }
.filter-pill.active[data-subj="biology"] { background: var(--biology); border-color: var(--biology); }

.search-input {
  min-width: 260px;
  flex: 1;
  max-width: 360px;
  padding: 8px 13px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  font-size: 13.5px;
  outline: none;
}

.search-input:focus {
  border-color: var(--math);
  background: var(--surface);
}

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

.unit-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: all 0.16s ease;
}

.unit-card:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.unit-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.unit-tags {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.utag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
}

.utag-math { background: var(--math-soft); color: var(--math); }
.utag-physics { background: var(--physics-soft); color: var(--physics); }
.utag-biology { background: var(--biology-soft); color: var(--biology); }
.utag-neutral { background: var(--surface-2); color: var(--ink-2); }

.unit-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}

.unit-main {
  display: flex;
  gap: 11px;
  align-items: flex-start;
}

.unit-thumb {
  width: 58px;
  height: 58px;
  border-radius: 9px;
  object-fit: cover;
  background: #0c1322;
  flex-shrink: 0;
}

.unit-title {
  font-size: 14.5px;
  font-weight: 750;
  line-height: 1.35;
  margin: 0 0 4px;
}

.unit-desc {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.unit-foot {
  margin-top: auto;
  padding-top: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.unit-open {
  font-weight: 700;
  color: var(--ink);
}

.load-more-wrap {
  text-align: center;
  margin: 22px 0 12px;
}

/* Footer */
.footer {
  margin-top: 44px;
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 26px 0;
  font-size: 12.5px;
  color: var(--muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

/* Workspace Shell Page */
body.workspace-body {
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #0f172a;
}

.ws-bar {
  height: 46px;
  padding: 0 14px;
  background: #12202e;
  color: #eef3f8;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}

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

.ws-back {
  padding: 5px 10px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.ws-back:hover { background: rgba(255, 255, 255, 0.2); }

.ws-title {
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: rgba(255, 255, 255, 0.9);
}

.ws-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow-x: auto;
}

.ws-tab {
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  padding: 5px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  white-space: nowrap;
}

.ws-tab:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.ws-tab.active { background: #0e7490; color: #fff; }
.ws-tab.active[data-subj="physics"] { background: #c2410c; }
.ws-tab.active[data-subj="biology"] { background: #047857; }

.ws-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ws-action {
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: rgba(255, 255, 255, 0.88);
  padding: 4px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.ws-action:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

.ws-frame-wrap {
  flex: 1;
  position: relative;
  background: #f8f7f3;
}

.ws-frame {
  width: 100%;
  height: 100%;
  border: none;
  display: block;
}

@media (max-width: 1024px) {
  .hero { grid-template-columns: 1fr; padding-top: 32px; }
  .studios-grid { grid-template-columns: 1fr; }
  .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .nav-links { display: none; }
  .stat-strip { grid-template-columns: repeat(2, 1fr); }
  .catalog-grid { grid-template-columns: 1fr; }
  .hero-mosaic { grid-template-columns: 1fr; grid-template-rows: 200px 160px 160px; }
  .mosaic-card.tall { grid-row: auto; }
  .ws-switcher { display: none; }
}
