:root {
  --dark-bg: #17181c;
  --dark-hover: #212329;
  --dark-border: #272932;
  --dark-text: #f3f4f6;
  --dark-muted: #9ca3af;

  --sheet-bg: #f6f7f9;
  --card-bg: #ffffff;
  --card-border: #ebedf2;
  --ink: #111827;
  --muted: #6b7280;

  --purple: #6347f9;
  --purple-hover: #5336eb;
  --purple-soft: #efecfe;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-style: normal;
  background: var(--dark-bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.app-frame {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--dark-bg);
}

/* Topbar */
.topbar {
  height: 58px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--dark-bg);
  color: #ffffff;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-wordmark {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

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

.top-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: #e5e7eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.top-icon-btn:hover {
  background: var(--dark-hover);
  color: #ffffff;
}

/* Workspace Split */
.workspace-row {
  display: flex;
  flex: 1;
  min-height: calc(100vh - 58px);
}

/* Left Dark Sidebar */
.sidebar {
  width: 266px;
  flex-shrink: 0;
  background: var(--dark-bg);
  color: var(--dark-text);
  padding: 16px 18px 28px;
  display: flex;
  flex-direction: column;
}

.sidebar.collapsed {
  display: none;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--dark-muted);
  font-size: 0.78rem;
  font-weight: 500;
  cursor: pointer;
  margin-bottom: 18px;
  padding: 0;
}

.back-btn:hover {
  color: #ffffff;
}

.course-title-block {
  margin-bottom: 18px;
}

.course-label {
  font-size: 0.72rem;
  color: var(--dark-muted);
  margin-bottom: 3px;
}

.course-title {
  font-size: 0.96rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.35;
}

.curriculum {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.section-group {
  padding: 2px 0;
}

.section-trigger {
  width: 100%;
  background: transparent;
  border: none;
  color: #e5e7eb;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 11px 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  text-align: left;
}

.section-trigger:hover {
  color: #ffffff;
}

.section-chev {
  color: var(--dark-muted);
  font-size: 0.75rem;
}

.section-items {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 8px;
}

.section-items.closed {
  display: none;
}

.lesson-item-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 7px 6px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--dark-muted);
  font-size: 0.79rem;
  cursor: pointer;
  text-align: left;
}

.lesson-item-btn:hover {
  color: #ffffff;
  background: var(--dark-hover);
}

.lesson-item-btn.active {
  color: #ffffff;
}

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

.lesson-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid #4b5563;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  flex-shrink: 0;
  color: var(--dark-muted);
}

.lesson-item-btn.active .lesson-circle {
  border-color: var(--purple);
  color: #ffffff;
  background: rgba(99, 71, 249, 0.2);
}

.lesson-text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-tag {
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: 6px;
  background: #272a34;
  color: #d1d5db;
  flex-shrink: 0;
}

/* Main Rounded Light Sheet */
.content-sheet {
  flex: 1;
  min-width: 0;
  background: var(--sheet-bg);
  border-top-left-radius: 22px;
  padding: 26px 28px 44px;
}

.lesson-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 24px;
  align-items: start;
  max-width: 1180px;
}

/* Center Column */
.center-column {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.hero-media-wrap {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  background: #14122b;
}

.hero-media-wrap img,
.hero-media-wrap canvas {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-media-wrap.photo-mode img {
  object-fit: contain;
  background: #0f172a;
  cursor: zoom-in;
}

.media-mode-switch {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(8px);
}

.mode-pill {
  border: none;
  background: transparent;
  color: #e2e8f0;
  font-size: 0.74rem;
  font-weight: 600;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
}

.mode-pill.active {
  background: #ffffff;
  color: #111827;
}

.photo-nav-overlay {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  z-index: 6;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}

.photo-arrow {
  pointer-events: auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(15, 23, 42, 0.68);
  color: #ffffff;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.photo-counter-pill {
  pointer-events: auto;
  padding: 5px 12px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.7);
  color: #ffffff;
  font-size: 0.74rem;
  font-weight: 600;
}

.video-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 7;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: linear-gradient(transparent, rgba(10, 12, 24, 0.88));
}

.vc-btn {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  font-size: 0.85rem;
  cursor: pointer;
}

.vc-range {
  flex: 1;
  accent-color: var(--purple);
  cursor: pointer;
}

.vc-time {
  color: #f8fafc;
  font-size: 0.74rem;
  font-weight: 600;
  min-width: 72px;
  text-align: right;
}

.hero-play-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease;
}

.hero-media-wrap:hover .hero-play-circle {
  transform: translate(-50%, -50%) scale(1.06);
  background: rgba(255, 255, 255, 0.34);
}

.media-meta-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: -8px;
}

.author-chip {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar-sm {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #1f2937;
  color: #ffffff;
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.author-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink);
}

.author-sub {
  font-size: 0.74rem;
  color: var(--muted);
}

.meta-actions {
  display: flex;
  align-items: center;
  gap: 16px;
}

.meta-link {
  background: none;
  border: none;
  color: #374151;
  font-size: 0.82rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.meta-link.liked {
  color: #ef4444;
}

/* Content Blocks */
.content-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.block-heading {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
}

.description-copy {
  font-size: 0.86rem;
  color: #4b5563;
  line-height: 1.65;
}

/* 4-Card Details Grid */
.details-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.detail-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 13px 14px;
}

.detail-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 5px;
}

.detail-value {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--ink);
}

/* FAQ Accordion */
.faq-stack {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.faq-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  overflow: hidden;
}

.faq-btn {
  width: 100%;
  background: transparent;
  border: none;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.faq-answer {
  padding: 0 16px 14px;
  font-size: 0.83rem;
  color: #4b5563;
  line-height: 1.55;
}

.faq-answer.closed {
  display: none;
}

/* Right Column Cards */
.right-column {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 18px;
}

.panel-top-label {
  font-size: 0.76rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}

.price-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.big-stat {
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--ink);
}

.strike-stat {
  font-size: 0.86rem;
  color: var(--muted);
}

.discount-pill {
  background: var(--purple-soft);
  color: var(--purple);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 7px;
}

.includes-heading {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 9px;
}

.includes-items {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.78rem;
  color: #4b5563;
  margin-bottom: 16px;
}

.includes-items li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-solid-purple {
  width: 100%;
  padding: 11px;
  border-radius: 10px;
  border: none;
  background: var(--purple);
  color: #ffffff;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
}

.btn-solid-purple:hover {
  background: var(--purple-hover);
}

.btn-outline-purple {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1.5px solid var(--purple);
  background: #ffffff;
  color: var(--purple);
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-outline-purple:hover {
  background: var(--purple-soft);
}

.guarantee-note {
  text-align: center;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 10px;
}

/* Rating Split Card */
.rating-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
}

.rating-half {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rating-half strong {
  display: block;
  font-size: 0.86rem;
}

.rating-half small {
  font-size: 0.72rem;
  color: var(--muted);
}

.rating-emoji {
  font-size: 1.5rem;
}

.rating-star {
  font-size: 1.4rem;
  color: #fbbf24;
}

/* Publisher Card */
.panel-title {
  font-size: 0.92rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.pub-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.avatar-md {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #1f2937;
  color: #ffffff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.pub-header strong {
  display: block;
  font-size: 0.86rem;
}

.pub-header small {
  font-size: 0.73rem;
  color: var(--muted);
}

.pub-bio {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 12px;
}

.pub-stats {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 7px;
  font-size: 0.78rem;
  color: #374151;
}

.pub-stats li {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Suggested Notes */
.suggested-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.suggested-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  width: 100%;
  padding: 4px;
  border-radius: 10px;
}

.suggested-row:hover {
  background: #f3f4f6;
}

.suggested-img {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
}

.suggested-meta strong {
  display: block;
  font-size: 0.82rem;
  color: var(--ink);
  margin-bottom: 2px;
}

.suggested-meta small {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
}

/* Mobile View (matching bottom-left mobile screen in screenshot) */
.mobile-curriculum-view {
  display: none;
}

.mobile-back-list-btn {
  display: none;
}

/* Lightbox */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.82);
  backdrop-filter: blur(4px);
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.lightbox-inner {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
}

.lightbox-inner img {
  max-width: 90vw;
  max-height: 86vh;
  border-radius: 14px;
  display: block;
}

.lightbox-x {
  position: absolute;
  top: -12px;
  right: -12px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: #ffffff;
  font-weight: 700;
  cursor: pointer;
}

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: #17181c;
  color: #ffffff;
  padding: 9px 18px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  z-index: 90;
}

/* Responsive Breakpoints */
@media (max-width: 1080px) {
  .lesson-page-grid {
    grid-template-columns: 1fr;
  }
  .details-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .content-sheet {
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    padding: 18px 16px 32px;
  }
  .mobile-curriculum-view {
    display: block;
  }
  .lesson-page-grid.mobile-hidden {
    display: none;
  }
  .mobile-curriculum-view.mobile-hidden {
    display: none;
  }
  .mobile-back-list-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #ffffff;
    border: 1px solid var(--card-border);
    padding: 9px 14px;
    border-radius: 10px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    align-self: flex-start;
  }
  .mobile-header-block {
    margin-bottom: 16px;
  }
  .mobile-header-block h2 {
    font-size: 1.15rem;
    font-weight: 800;
    margin-bottom: 3px;
  }
  .mobile-header-block p {
    font-size: 0.76rem;
    color: var(--muted);
  }
  .m-sec-block {
    margin-bottom: 14px;
  }
  .m-sec-btn {
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--ink);
    padding: 8px 0;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
  }
  .m-sec-btn.open {
    color: var(--purple);
  }
  .m-lesson-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    cursor: pointer;
  }
  .m-thumb-box {
    position: relative;
    width: 78px;
    height: 56px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
  }
  .m-thumb-box img {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .m-thumb-play {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.25);
    color: #ffffff;
    font-size: 0.75rem;
  }
  .m-row-info {
    flex: 1;
    min-width: 0;
  }
  .m-row-info strong {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--ink);
  }
  .m-row-info small {
    display: block;
    font-size: 0.73rem;
    color: var(--muted);
    margin-bottom: 5px;
  }
  .m-bar-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .m-bar-track {
    flex: 1;
    height: 4px;
    border-radius: 999px;
    background: #e5e7eb;
    overflow: hidden;
  }
  .m-bar-fill {
    height: 100%;
    background: var(--purple);
  }
  .m-bar-pct {
    font-size: 0.72rem;
    color: var(--muted);
    font-weight: 600;
  }
}
