:root {
  color-scheme: dark;
  --bg: #0d0d0d;
  --panel: rgba(8, 12, 18, 0.34);
  --panel-dark: rgba(0, 0, 0, 0.36);
  --line: rgba(255, 255, 255, 0.14);
  --line-strong: rgba(255, 255, 255, 0.3);
  --text: rgba(255, 255, 255, 0.9);
  --muted: rgba(255, 255, 255, 0.6);
  --faint: rgba(255, 255, 255, 0.42);
  --blue: #38bdf8;
  --green: #34d399;
  --purple: #a78bfa;
  --deep-blue: #0f172a;
  --shadow-glow: 0 18px 46px rgba(0, 0, 0, 0.3);
  --button-glow: 0 0 24px rgba(255, 255, 255, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    "Microsoft YaHei",
    sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

body.modal-open {
  overflow: hidden;
}

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

.background,
.texture,
.code-rain,
.top-beam {
  pointer-events: none;
  position: fixed;
  inset: 0;
}

.background {
  z-index: -10;
  background:
    radial-gradient(
      circle at 18% 12%,
      rgba(56, 189, 248, 0.1),
      transparent 30rem
    ),
    radial-gradient(
      circle at 88% 16%,
      rgba(167, 139, 250, 0.08),
      transparent 28rem
    ),
    radial-gradient(
      circle at 48% 82%,
      rgba(52, 211, 153, 0.06),
      transparent 28rem
    ),
    #0d0d0d;
}

.texture {
  opacity: 0.12;
  background-image:
    linear-gradient(
      180deg,
      rgba(56, 189, 248, 0.06) 0 1px,
      transparent 1px 36px
    ),
    linear-gradient(
      90deg,
      rgba(167, 139, 250, 0.05) 0 1px,
      transparent 1px 44px
    );
}

.code-rain {
  display: grid;
  grid-template-columns: repeat(26, minmax(24px, 1fr));
  gap: 10px;
  padding: 6rem 2rem 2rem;
  overflow: hidden;
  opacity: 0.055;
  color: #7dd3fc;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.8;
  mask-image: linear-gradient(
    to bottom,
    transparent,
    black 14%,
    black 80%,
    transparent
  );
}

.code-column {
  writing-mode: vertical-rl;
  white-space: nowrap;
  animation: drift 18s linear infinite;
  animation-delay: var(--delay);
}

.top-beam {
  bottom: auto;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(125, 211, 252, 0.24),
    rgba(167, 139, 250, 0.16),
    transparent
  );
}

@keyframes drift {
  from {
    transform: translateY(-20%);
  }
  to {
    transform: translateY(20%);
  }
}

.glass-pill,
.glass-card,
.glass-panel {
  border: 1px solid var(--line);
  background: rgba(8, 12, 18, 0.34);
  box-shadow: var(--shadow-glow);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  position: relative;
  overflow: hidden;
}

.glass-card,
.glass-panel {
  border-radius: 28px;
  transition:
    transform 300ms ease,
    border-color 300ms ease,
    background 300ms ease,
    box-shadow 300ms ease;
}

.glass-card:hover,
.module-card:hover {
  transform: translateY(-4px);
  border-color: var(--line-strong);
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.34);
}

.topbar {
  position: sticky;
  top: 16px;
  z-index: 50;
  display: grid;
  width: calc(100% - 32px);
  grid-template-columns: auto minmax(280px, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 16px auto 0;
  border-radius: 28px;
  background: rgba(8, 12, 18, 0.38);
  padding: 12px 14px;
}

.brand,
.brand-mark,
.search-box,
.top-actions,
.chip,
.side-title,
.module-meta,
.module-header,
.task-row,
.task-check,
.stat-card,
.phase-pill {
  display: flex;
  align-items: center;
}

.topbar > *,
.sidebar > *,
.hero-panel > *,
.stats-grid > *,
.module-card > *,
.glass-card > *,
.glass-panel > * {
  position: relative;
  z-index: 1;
}

.brand {
  gap: 10px;
  white-space: nowrap;
  font-size: 14px;
  font-weight: 700;
}

.brand-mark {
  width: 32px;
  height: 32px;
  justify-content: center;
  border-radius: 999px;
  background: #fff;
  color: #000;
}

.brand-mark img {
  width: 20px;
  height: 20px;
  display: block;
  object-fit: contain;
}

.search-box {
  min-width: 0;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  padding: 0 14px;
  color: rgba(255, 255, 255, 0.55);
}

.search-box i {
  flex: 0 0 auto;
  width: 17px;
  text-align: center;
  font-size: 15px;
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  padding: 10px 0;
  color: #fff;
}

.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.38);
}

.top-actions {
  gap: 8px;
}

.chip {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.68);
  transition:
    border-color 220ms ease,
    color 220ms ease,
    background 220ms ease,
    transform 220ms ease;
}

.chip {
  height: 34px;
  justify-content: center;
  border-radius: 999px;
  padding: 0 14px;
  font-size: 13px;
}

.chip.active,
.chip:hover {
  border-color: var(--line-strong);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.local-badge {
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid rgba(125, 211, 252, 0.22);
  background: rgba(125, 211, 252, 0.08);
  padding: 0 13px;
  color: rgba(224, 242, 254, 0.82);
  font-size: 13px;
}

.local-badge[data-mode="remote"] {
  border-color: rgba(52, 211, 153, 0.24);
  background: rgba(52, 211, 153, 0.08);
  color: rgba(209, 250, 229, 0.86);
}

.local-badge[data-mode="syncing"] {
  border-color: rgba(125, 211, 252, 0.24);
  background: rgba(125, 211, 252, 0.08);
  color: rgba(224, 242, 254, 0.86);
}

.app-shell {
  display: grid;
  width: calc(100% - 32px);
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 22px;
  margin: 24px auto 80px;
}

.sidebar {
  position: sticky;
  top: 96px;
  align-self: start;
  padding: 18px;
}

.side-title {
  justify-content: space-between;
  gap: 12px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
}

.side-title strong {
  color: #fff;
  font-size: 20px;
}

.side-progress,
.mini-bar,
.module-progress {
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.side-progress {
  height: 8px;
  margin: 14px 0 18px;
}

.side-progress span,
.mini-bar i,
.module-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--purple));
  transition: width 280ms ease;
}

.side-nav {
  display: grid;
  gap: 8px;
}

.side-nav a {
  display: grid;
  gap: 4px;
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 11px 12px;
  color: rgba(255, 255, 255, 0.62);
  transition:
    background 220ms ease,
    border-color 220ms ease,
    color 220ms ease;
}

.side-nav a:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.side-nav strong {
  color: inherit;
  font-size: 14px;
}

.side-nav span {
  color: rgba(255, 255, 255, 0.42);
  font-size: 12px;
}

.content {
  min-width: 0;
}

.dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 420px);
  gap: 24px;
  overflow: hidden;
  padding: 28px;
  background: rgba(8, 12, 18, 0.34);
}

.eyebrow {
  margin: 0 0 10px;
  color: rgba(125, 211, 252, 0.88);
  font-size: 13px;
}

.hero-panel h1 {
  max-width: 760px;
  margin: 0;
  color: #fff;
  font-size: clamp(2.2rem, 5vw, 4.7rem);
  font-weight: 760;
  line-height: 1.06;
  letter-spacing: 0;
}

.hero-panel p {
  max-width: 720px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.62);
  font-size: 16px;
  line-height: 1.8;
}

.focus-card {
  align-self: center;
  min-height: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.06),
      rgba(255, 255, 255, 0.02)
    ),
    rgba(8, 12, 18, 0.22);
  padding: 16px 18px;
}

.focus-card span,
.focus-card small {
  display: block;
  color: rgba(255, 255, 255, 0.54);
  font-size: 13px;
}

.focus-card strong {
  display: block;
  margin: 8px 0;
  color: #fff;
  font-size: 23px;
  line-height: 1.22;
}

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

.stat-card {
  min-height: 116px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  padding: 20px;
}

.stat-card span,
.stat-card small {
  color: rgba(255, 255, 255, 0.52);
  font-size: 13px;
}

.stat-card strong {
  margin: 8px 0;
  color: #fff;
  font-size: 34px;
  line-height: 1;
}

.mini-bar {
  width: 100%;
  height: 8px;
  margin-top: 8px;
}

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

.module-card {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(8, 12, 18, 0.34);
  box-shadow: var(--shadow-glow);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  padding: 22px;
  position: relative;
  overflow: hidden;
  scroll-margin-top: 96px;
  transition:
    transform 300ms ease,
    border-color 300ms ease,
    box-shadow 300ms ease;
}

.module-card.hidden {
  display: none;
}

.module-header {
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 16px;
}

.module-title {
  min-width: 0;
}

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

.phase-pill {
  width: fit-content;
  gap: 8px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  padding: 6px 11px;
  color: #e0f2fe;
  font-size: 12px;
  font-weight: 650;
  transition:
    border-color 220ms ease,
    background 220ms ease,
    color 220ms ease,
    transform 220ms ease;
}

.course-pill {
  color: rgba(209, 250, 229, 0.86);
}

.phase-pill:hover {
  border-color: rgba(125, 211, 252, 0.42);
  background: rgba(125, 211, 252, 0.12);
  color: #fff;
  transform: translateY(-1px);
}

.module-title h2 {
  margin: 12px 0 8px;
  color: #fff;
  font-size: 24px;
  line-height: 1.25;
}

.module-title p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.module-meta {
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 10px;
}

.module-percent {
  min-width: 72px;
  color: #fff;
  font-size: 24px;
  font-weight: 750;
  text-align: right;
}

.module-progress {
  height: 8px;
  margin-bottom: 18px;
}

.stage-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 16px;
}

.stage-summary span {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.055);
  padding: 6px 10px;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
}

.task-list {
  display: grid;
  gap: 8px;
}

.task-row {
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.035),
      rgba(255, 255, 255, 0.01)
    ),
    rgba(8, 12, 18, 0.18);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.76);
  transition:
    border-color 220ms ease,
    background 220ms ease,
    color 220ms ease;
}

.task-row:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.task-row.done {
  color: rgba(255, 255, 255, 0.42);
}

.task-row.done .task-text {
  text-decoration: line-through;
}

.task-check {
  position: relative;
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  justify-content: center;
}

.task-check input {
  position: absolute;
  inset: 0;
  margin: 0;
  cursor: pointer;
  opacity: 0;
}

.task-check input:disabled {
  cursor: not-allowed;
}

.fake-check {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  color: transparent;
  transition:
    border-color 200ms ease,
    background 200ms ease,
    color 200ms ease,
    box-shadow 200ms ease;
}

.task-check input:checked + .fake-check {
  border-color: rgba(125, 211, 252, 0.78);
  background: linear-gradient(
    135deg,
    rgba(56, 189, 248, 0.94),
    rgba(52, 211, 153, 0.86),
    rgba(167, 139, 250, 0.82)
  );
  color: #fff;
  box-shadow: none;
}

.fake-check i {
  font-size: 12px;
}

.task-text {
  min-width: 0;
  font-size: 14px;
  line-height: 1.55;
}

.empty-state {
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: 28px;
  padding: 34px;
  color: rgba(255, 255, 255, 0.55);
  text-align: center;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(
      circle at 50% 20%,
      rgba(56, 189, 248, 0.08),
      transparent 32rem
    ),
    rgba(0, 0, 0, 0.62);
  padding: 24px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-backdrop.open {
  display: flex;
}

.detail-modal {
  position: relative;
  width: min(960px, 100%);
  max-height: min(82vh, 820px);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  padding: 24px;
}

.modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 3;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: rgba(255, 255, 255, 0.72);
  transition:
    border-color 220ms ease,
    background 220ms ease,
    color 220ms ease,
    transform 220ms ease;
}

.modal-close:hover {
  border-color: rgba(255, 255, 255, 0.24);
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  transform: translateY(-1px);
}

.modal-close i {
  font-size: 18px;
}

.modal-head {
  position: relative;
  z-index: 1;
  padding-right: 52px;
}

.modal-head span {
  display: inline-flex;
  border: 1px solid rgba(125, 211, 252, 0.22);
  border-radius: 999px;
  background: rgba(125, 211, 252, 0.08);
  padding: 6px 11px;
  color: rgba(224, 242, 254, 0.86);
  font-size: 12px;
  font-weight: 650;
}

.modal-head h2 {
  margin: 14px 0 8px;
  color: #fff;
  font-size: clamp(1.6rem, 4vw, 2.8rem);
  line-height: 1.15;
}

.modal-head p {
  max-width: 700px;
  margin: 0;
  color: rgba(255, 255, 255, 0.58);
  font-size: 14px;
  line-height: 1.7;
}

.modal-progress {
  overflow: hidden;
  height: 8px;
  margin-top: 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.modal-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--green), var(--purple));
  transition: width 280ms ease;
}

.modal-head small {
  display: block;
  margin-top: 8px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
}

.detail-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 8px;
  margin-top: 20px;
  overflow: auto;
  padding-right: 6px;
}

.detail-list::-webkit-scrollbar {
  width: 8px;
}

.detail-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.detail-row {
  padding: 11px 12px;
}

.course-group {
  display: grid;
  gap: 10px;
}

.course-group + .course-group {
  margin-top: 14px;
}

.course-group h3 {
  margin: 0;
  color: #fff;
  font-size: 18px;
  line-height: 1.35;
}

.course-link-list {
  display: grid;
  gap: 8px;
}

.course-link {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  background:
    linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.035),
      rgba(255, 255, 255, 0.01)
    ),
    rgba(8, 12, 18, 0.18);
  padding: 12px 14px;
  color: rgba(255, 255, 255, 0.82);
  transition:
    border-color 220ms ease,
    background 220ms ease,
    color 220ms ease,
    transform 220ms ease;
}

.course-link:hover {
  border-color: rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  transform: translateY(-1px);
}

.course-link span {
  font-size: 14px;
  line-height: 1.45;
}

.course-link small {
  color: rgba(255, 255, 255, 0.42);
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
}

.course-link.disabled {
  color: rgba(255, 255, 255, 0.5);
  pointer-events: none;
}

@media (max-width: 1080px) {
  .topbar {
    grid-template-columns: 1fr;
    border-radius: 28px;
  }

  .top-actions {
    justify-content: space-between;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

  .side-nav {
    grid-template-columns: repeat(2, 1fr);
  }

  .dashboard,
  .hero-panel {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 720px) {
  .topbar,
  .app-shell {
    width: calc(100% - 20px);
  }

  .brand span:last-child {
    display: none;
  }

  .top-actions {
    flex-wrap: wrap;
  }

  .chip {
    flex: 1;
  }

  .side-nav,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .hero-panel,
  .module-card {
    padding: 18px;
  }

  .module-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .module-meta {
    width: 100%;
    justify-content: space-between;
  }

  .detail-modal {
    max-height: 88vh;
    padding: 18px;
  }
}
