:root {
  color-scheme: dark;
  --bg: #08111c;
  --bg-glow:
    radial-gradient(circle at top left, rgba(29, 102, 190, 0.18), transparent 32%),
    radial-gradient(circle at top right, rgba(241, 141, 62, 0.16), transparent 30%),
    linear-gradient(180deg, #0a1420 0%, #08111c 100%);
  --surface: rgba(13, 21, 34, 0.86);
  --surface-strong: rgba(11, 19, 30, 0.96);
  --surface-soft: rgba(18, 29, 45, 0.74);
  --surface-muted: rgba(17, 26, 40, 0.88);
  --text: #e7edf5;
  --text-soft: #98a8bc;
  --text-strong: #fbfdff;
  --line: rgba(171, 191, 217, 0.14);
  --line-strong: rgba(171, 191, 217, 0.22);
  --accent: #63c6de;
  --accent-strong: #ddfbff;
  --accent-soft: rgba(99, 198, 222, 0.14);
  --gold: #f0b75b;
  --gold-soft: rgba(240, 183, 91, 0.12);
  --warning: #ff8d5a;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --page-width: min(1180px, calc(100vw - 28px));
  --content-width: min(1040px, calc(100vw - 28px));
  --topbar: linear-gradient(135deg, #060b12 0%, #0f1826 46%, #0d4458 100%);
  --button-bg: rgba(255, 255, 255, 0.08);
  --button-bg-hover: rgba(255, 255, 255, 0.13);
  --button-line: rgba(255, 255, 255, 0.14);
  --play-bg: linear-gradient(135deg, #1590b8 0%, #31cfdc 100%);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg-glow);
  color: var(--text);
  font-family: "Avenir Next", "Segoe UI", "Helvetica Neue", sans-serif;
  line-height: 1.55;
}

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

button,
input,
audio {
  font: inherit;
}

img {
  max-width: 100%;
  display: block;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chrome {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(20px);
  background: linear-gradient(180deg, rgba(8, 14, 23, 0.92), rgba(8, 14, 23, 0.46));
}

.topbar {
  width: var(--page-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 18px 0 16px;
}

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

.brand img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.brand-title {
  font-family: "Avenir Next Condensed", "Franklin Gothic Medium", sans-serif;
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-strong);
}

.topbar-search {
  flex: 1 1 320px;
  min-width: 220px;
}

.topbar-search input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--button-line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-strong);
  padding: 0 16px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.14);
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.topbar-search input::placeholder {
  color: rgba(248, 251, 255, 0.56);
}

.topbar-search input:focus {
  outline: none;
  border-color: rgba(99, 198, 222, 0.28);
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.22);
}

.icon-button,
.button-link,
.copy-button,
.download-button,
.mode-card,
.back-button,
.topic-link,
.subnav-button {
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease, box-shadow 160ms ease, color 160ms ease;
}

.icon-button {
  appearance: none;
  border: 1px solid var(--button-line);
  background: var(--button-bg);
  color: var(--text-strong);
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.18);
}

.icon-button:hover,
.button-link:hover,
.copy-button:hover,
.download-button:hover,
.mode-card:hover,
.topic-link:hover,
.subnav-button:hover,
.back-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 30px rgba(0, 0, 0, 0.24);
}

.icon-button:hover,
.subnav-button:hover {
  background: var(--button-bg-hover);
}

.icon-slot,
.inline-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-slot svg,
.inline-icon svg {
  width: 20px;
  height: 20px;
  display: block;
}

.subnav {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(8, 18, 32, 0.94);
}

.subnav.is-hidden {
  display: none;
}

.subnav-track {
  width: var(--page-width);
  margin: 0 auto;
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 12px 0;
  scrollbar-width: none;
}

.subnav-track::-webkit-scrollbar {
  display: none;
}

.subnav-button {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(248, 251, 255, 0.88);
  border-radius: 999px;
  padding: 10px 14px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  font-weight: 600;
  cursor: pointer;
}

.subnav-button.is-active {
  background: rgba(99, 198, 222, 0.16);
  color: var(--accent-strong);
  border-color: rgba(99, 198, 222, 0.24);
}

.subnav-count {
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 7px;
  background: rgba(255, 255, 255, 0.12);
  font-size: 0.78rem;
  font-weight: 700;
}

.subnav-button.is-active .subnav-count {
  background: rgba(99, 198, 222, 0.18);
}

.main-shell {
  width: var(--page-width);
  margin: 0 auto;
  padding: 28px 0 44px;
}

.loading-state,
.empty-state,
.error-state {
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface-strong);
  padding: 32px 24px;
  text-align: center;
  box-shadow: var(--shadow);
}

.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 16px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.16);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

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

.page-stack {
  display: grid;
  gap: 26px;
}

.page-header,
.hero-card,
.resource-card,
.mode-card,
.topic-card,
.detail-card,
.audio-card,
.dialogue-block,
.carousel-card,
.carousel-text-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow);
}

.page-header,
.detail-card,
.audio-card,
.dialogue-block,
.carousel-card,
.carousel-text-card {
  padding: 24px;
}

.topic-list {
  display: grid;
  gap: 18px;
}

.topic-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  padding: 18px 20px;
}

.hero-thumb img,
.post-image img,
.carousel-slide img {
  width: 100%;
  height: auto;
}

.topic-body {
  display: grid;
  gap: 14px;
  align-content: start;
  min-width: 0;
}

.meta-row,
.mode-chip-row,
.header-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 600;
}

.chip--accent {
  color: var(--accent-strong);
  background: rgba(99, 198, 222, 0.12);
  border-color: rgba(99, 198, 222, 0.18);
}

.chip--gold {
  color: #ffe5b4;
  background: rgba(240, 183, 91, 0.12);
  border-color: rgba(240, 183, 91, 0.18);
}

.topic-title,
.detail-title,
.section-title,
.variant-title,
.post-title {
  margin: 0;
  color: var(--text-strong);
  line-height: 1.12;
}

.topic-title {
  font-size: clamp(1.52rem, 2vw, 2rem);
}

.topic-link {
  color: inherit;
}

.topic-link:hover {
  color: var(--accent-strong);
}

.topic-hook,
.detail-summary,
.mode-description,
.audio-meta,
.soft-text {
  margin: 0;
  color: var(--text-soft);
}

.page-footer {
  padding: 10px 0 0;
  text-align: center;
  color: rgba(152, 168, 188, 0.74);
  font-size: 0.88rem;
}

.separator {
  height: 1px;
  background: linear-gradient(90deg, transparent 0%, rgba(183, 199, 221, 0.12) 16%, rgba(183, 199, 221, 0.12) 84%, transparent 100%);
}

.hero-card {
  overflow: hidden;
}

.hero-thumb {
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.hero-copy {
  padding: 24px;
  display: grid;
  gap: 18px;
}

.breadcrumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--text-soft);
  font-size: 0.92rem;
}

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

.back-button,
.button-link,
.copy-button,
.download-button {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--button-bg);
  color: var(--text-strong);
  border-radius: 14px;
  min-height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.button-link--primary,
.download-button--primary {
  background: var(--play-bg);
  border-color: transparent;
  color: #04111d;
  font-weight: 700;
}

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

.mode-card {
  display: grid;
  gap: 12px;
  padding: 22px;
  color: var(--text-strong);
}

.mode-card.is-disabled {
  opacity: 0.5;
  cursor: default;
}

.mode-card.is-disabled:hover {
  transform: none;
  box-shadow: var(--shadow);
}

.mode-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mode-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(99, 198, 222, 0.12);
  color: var(--accent-strong);
  border: 1px solid rgba(99, 198, 222, 0.18);
}

.mode-icon svg {
  width: 24px;
  height: 24px;
}

.mode-count {
  font-size: 0.84rem;
  color: var(--text-soft);
  font-weight: 700;
}

.page-header {
  display: grid;
  gap: 16px;
}

.detail-title {
  font-size: clamp(1.9rem, 3vw, 2.7rem);
}

.detail-subtitle {
  margin: 0;
  font-size: 1rem;
  color: var(--text-soft);
}

.resource-stack {
  display: grid;
  gap: 22px;
}

.post-card,
.audio-card,
.dialogue-block,
.carousel-card,
.carousel-text-card {
  display: grid;
  gap: 18px;
}

.post-actions,
.audio-actions,
.resource-actions,
.carousel-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.prose {
  display: grid;
  gap: 14px;
  color: var(--text);
}

.prose p,
.prose ul,
.prose ol,
.prose h1,
.prose h2,
.prose h3,
.prose hr {
  margin: 0;
}

.prose ul,
.prose ol {
  padding-left: 1.25rem;
}

.prose li + li {
  margin-top: 8px;
}

.prose strong {
  color: var(--text-strong);
}

.post-image,
.media-frame {
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.post-index-line {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(99, 198, 222, 0.14);
  border: 1px solid rgba(99, 198, 222, 0.2);
  color: var(--accent-strong);
  font-size: 0.88rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.audio-card audio {
  width: 100%;
}

.dialogue-meta {
  display: grid;
  gap: 10px;
}

.dialogue-list {
  display: grid;
  gap: 16px;
}

.slide-text-stack {
  display: grid;
  gap: 18px;
}

.slide-text-block {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.slide-text-head {
  display: grid;
  gap: 10px;
}

.slide-text-title {
  margin: 0;
  color: var(--text-strong);
  line-height: 1.18;
}

.slide-text-lines {
  display: grid;
  gap: 10px;
}

.slide-text-lines p {
  margin: 0;
}

.speaker-turn {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  padding: 16px;
  display: grid;
  gap: 10px;
}

.speaker-label {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  width: fit-content;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.speaker-professor .speaker-label {
  background: rgba(99, 198, 222, 0.16);
  color: var(--accent-strong);
}

.speaker-student-a .speaker-label {
  background: rgba(240, 183, 91, 0.16);
  color: #ffe4ae;
}

.speaker-student-b .speaker-label {
  background: rgba(255, 141, 90, 0.16);
  color: #ffd4bf;
}

.carousel-viewer {
  display: grid;
  gap: 14px;
}

.carousel-frame {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
}

.carousel-nav {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-strong);
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.carousel-window {
  overflow: hidden;
  border-radius: 24px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
}

.carousel-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.carousel-track::-webkit-scrollbar {
  display: none;
}

.carousel-slide {
  min-width: 100%;
  scroll-snap-align: start;
  display: grid;
  gap: 8px;
  padding: 0;
}

.carousel-caption {
  padding: 0 8px 8px;
  color: var(--text-soft);
  font-size: 0.9rem;
}

.carousel-dots {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.carousel-dot {
  appearance: none;
  border: 0;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  cursor: pointer;
}

.carousel-dot.is-active {
  background: var(--accent);
}

.section-divider {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(181, 198, 220, 0.16), transparent);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: rgba(5, 11, 18, 0.92);
  color: var(--accent-strong);
  border: 1px solid rgba(99, 198, 222, 0.2);
  border-radius: 999px;
  padding: 12px 18px;
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.28);
  z-index: 60;
}

@media (max-width: 980px) {
  .topic-card {
    grid-template-columns: 1fr;
  }

  .mode-grid {
    grid-template-columns: 1fr;
  }

  .carousel-frame {
    grid-template-columns: 1fr;
  }

  .carousel-nav {
    width: 100%;
  }
}

@media (max-width: 720px) {
  .topbar {
    gap: 14px;
    padding: 14px 0;
  }

  .brand-title {
    font-size: 1.28rem;
  }

  .main-shell {
    padding-top: 20px;
  }

  .page-header,
  .detail-card,
  .audio-card,
  .dialogue-block,
  .carousel-card,
  .carousel-text-card,
  .hero-copy {
    padding: 18px;
  }

  .detail-title {
    font-size: 1.7rem;
  }
}
