/* ==========================================================================
   StudySpace — app screens
   Home rail · batch details · class player · downloads · community ·
   profile · splash · poster
   ========================================================================== */

/* ============================== WELCOME ================================ */
.welcome {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-block: var(--sp-5) var(--sp-3);
}
.welcome h1 {
  font-size: clamp(1.35rem, 1.1rem + 1vw, var(--text-xl));
  letter-spacing: -0.02em;
}
.welcome p { font-size: var(--text-sm); color: var(--text-muted); margin-top: 4px; }
.welcome-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 800;
  color: var(--text-invert);
  background: var(--grad-brand);
  flex: 0 0 auto;
}

/* Quick chips under the welcome line */
.quick-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--sp-3);
  margin-block: var(--sp-4) var(--sp-2);
}
.quick-tile {
  display: grid;
  gap: 8px;
  justify-items: start;
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  color: var(--text);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.quick-tile:hover { border-color: var(--violet-600); background: var(--surface-raised); transform: translateY(-2px); }
.quick-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: var(--r-md);
  background: rgba(91, 91, 246, 0.16);
  color: var(--violet-400);
}
.quick-icon svg { width: 19px; height: 19px; }
.quick-tile strong { font-size: var(--text-xs); font-weight: 700; color: var(--text-strong); }

/* ============================== SPLASH ================================= */
.splash {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  text-align: center;
  background: var(--grad-splash);
  padding: var(--sp-6);
  position: relative;
  overflow: hidden;
}
.splash::before,
.splash::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(139, 133, 255, 0.16);
  pointer-events: none;
}
.splash::before { width: 560px; height: 560px; }
.splash::after { width: 840px; height: 840px; }
.splash-inner { position: relative; z-index: 1; display: grid; justify-items: center; gap: var(--sp-4); }
.splash-mark {
  width: 84px;
  height: 84px;
  border-radius: 26px;
  display: grid;
  place-items: center;
  background: var(--grad-brand);
  box-shadow: var(--shadow-brand);
  margin-bottom: var(--sp-3);
}
.splash-mark svg { width: 38px; height: 38px; color: var(--text-invert); }
.splash h1 { font-size: var(--text-2xl); letter-spacing: 0.16em; text-transform: uppercase; }
.splash p { color: var(--text-muted); font-size: var(--text-sm); letter-spacing: 0.03em; }
.splash-actions { margin-top: var(--sp-6); display: grid; gap: 10px; width: min(280px, 80vw); }
.splash-skip { font-size: var(--text-xs); color: var(--text-subtle); }

/* ============================== TIMETABLE ============================== */
.day-schedule { display: grid; gap: var(--sp-2); }
.schedule-day {
  margin: var(--sp-3) 0 2px;
  font-size: var(--text-2xs);
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-subtle);
}
.schedule-day:first-child { margin-top: 0; }
.schedule-day.is-today { color: var(--violet-600); }
.schedule-quiet { margin: 0; font-size: var(--text-sm); color: var(--text-muted); }

/* One class, time first: a timetable is read down the left edge. */
.class-row {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-3);
  padding: 10px 14px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease);
}
.class-row:hover { border-color: var(--border-strong); }
.class-time {
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  font-size: var(--text-sm);
  color: var(--text-strong);
}
.class-time time { white-space: nowrap; }
.class-row[data-status="ended"] .class-time { color: var(--text-subtle); font-weight: 600; }
.class-main { display: grid; gap: 2px; min-width: 0; }
.class-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.class-title h3 {
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.class-main p { margin: 0; font-size: var(--text-2xs); color: var(--text-subtle); }
.class-action { display: flex; align-items: center; gap: 8px; }
.class-action .btn { white-space: nowrap; }

/* The batch page's schedule strip sits above its curriculum. */
.batch-schedule { margin-bottom: var(--sp-4); }
.batch-schedule-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--sp-3);
  margin-bottom: var(--sp-3);
}

/* The subject grid a batch opens on. One card per subject, carrying the two
   counts a learner decides with — how many chapters, and how much is inside
   them — so the click is informed before it is made. */
.subject-total {
  margin: 0 0 var(--sp-3);
  font-size: var(--text-2xs);
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}
.subject-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: var(--sp-3);
}
.subject-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 18px;
  align-items: center;
  gap: var(--sp-3);
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--paper);
  color: inherit;
  text-decoration: none;
  transition: border-color var(--dur) var(--ease);
}
.subject-card:hover { border-color: var(--violet-500); }
.subject-card:focus-visible { outline: 2px solid var(--violet-600); outline-offset: 2px; }
.subject-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: var(--r-sm);
  color: var(--band-ink);
}
.subject-icon svg { width: 22px; height: 22px; }
.subject-body { display: grid; gap: 3px; min-width: 0; }
.subject-name {
  font-weight: 800;
  font-size: var(--text-base);
  color: var(--text-strong);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.subject-meta {
  font-size: var(--text-2xs);
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
}
.subject-card > svg { width: 16px; height: 16px; color: var(--text-subtle); }
.subject-card:hover > svg { color: var(--violet-500); }

/* ============================ MY BATCH ================================ */
/* A batch on the learner's account, opened as a classroom rather than a shop
   window: the cover, the name and the facts, then today, then the syllabus.
   Deliberately shorter than the public hero — this page is used every day, so
   the syllabus has to be on the first screen. */
.learn-hero { padding-block: var(--sp-4) var(--sp-5); border-bottom: 1px solid var(--border); }
.learn-head {
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--sp-4);
  margin-top: var(--sp-3);
}
.learn-cover {
  display: grid;
  place-items: center;
  min-height: 108px;
  padding: var(--sp-3);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  color: var(--band-ink);
  font-size: var(--text-lg);
  font-weight: 800;
  letter-spacing: 0.04em;
  overflow: hidden;
  position: relative;
}
.learn-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.learn-info { min-width: 0; }
.learn-title {
  margin: 0;
  font-size: clamp(1.25rem, 1.05rem + 1vw, var(--text-xl));
  line-height: 1.25;
  letter-spacing: -0.02em;
}
.learn-sub { margin: 6px 0 0; color: var(--text-muted); font-size: var(--text-sm); }
.learn-info .badges { margin-top: 10px; }
.learn-faculty {
  margin: 8px 0 0;
  font-size: var(--text-2xs);
  color: var(--text-subtle);
}
.learn-faculty[hidden] { display: none; }
.learn-overview { align-self: start; }
.learn-hero .skeleton { border-radius: var(--r-xs); }

/* One subject, opened: the heading carries the batch's context back. */
.subject-hero { display: flex; align-items: center; gap: var(--sp-4); }
.subject-hero .subject-icon { width: 62px; height: 62px; border-radius: var(--r-md); }
.subject-hero .subject-icon svg { width: 28px; height: 28px; }
.subject-title { font-size: var(--text-2xl); letter-spacing: var(--tracking-tight); }
.subject-lead { margin: 6px 0 0; color: var(--text-muted); font-size: var(--text-sm); }

/* A subject's chapters: native <details>, so a chapter opens with the
   keyboard, survives find-in-page, and still works if the module never runs. */
.content-tree { display: grid; gap: 10px; margin-top: var(--sp-4); }
.tree-toolbar {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}
.tree-toolbar input {
  flex: 1 1 240px;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  background: var(--paper);
  color: var(--text-strong);
  font: inherit;
  font-size: var(--text-sm);
}
.tree-toolbar input:focus-visible { outline: 2px solid var(--violet-600); outline-offset: 1px; }
.tree-total {
  margin: 0;
  font-size: var(--text-2xs);
  color: var(--text-subtle);
  white-space: nowrap;
}
.tree-actions { display: flex; gap: var(--sp-2); }
.tree-actions .chip { min-height: 34px; }
.tree-no-match {
  margin: var(--sp-3) 0 0;
  padding: 10px 14px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.tree-chapter {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--paper);
  overflow: hidden;
}
.tree-chapter-head {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}
.tree-chapter-head::-webkit-details-marker { display: none; }
.tree-chapter-head:hover { background: var(--surface-soft); }
.tree-chapter-head:focus-visible {
  outline: 2px solid var(--violet-600);
  outline-offset: -2px;
}
.tree-chapter-name { font-weight: 700; font-size: var(--text-sm); color: var(--text-strong); }
.tree-meta {
  font-size: var(--text-2xs);
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
/* The caret is decoration; the summary already reports open/closed to a
   screen reader, so it carries no text. */
.tree-caret {
  width: 7px;
  height: 7px;
  justify-self: center;
  border-right: 2px solid var(--text-subtle);
  border-bottom: 2px solid var(--text-subtle);
  transform: rotate(-45deg);
  transition: transform var(--dur) var(--ease);
}
details[open] > .tree-chapter-head > .tree-caret { transform: rotate(45deg); }

.tree-chapter-note {
  margin: 0;
  padding: 0 14px 10px 36px;
  font-size: var(--text-2xs);
  color: var(--text-muted);
}
.tree-files { display: grid; padding: 0 8px 8px; }
.tree-file {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  color: inherit;
  text-decoration: none;
}
.tree-file + .tree-file { box-shadow: 0 -1px 0 var(--border); }
a.tree-file:hover { background: var(--surface-soft); }
a.tree-file:focus-visible { outline: 2px solid var(--violet-600); outline-offset: -2px; }
.tree-file-icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--violet-600);
}
.tree-file-icon svg { width: 16px; height: 16px; }
.tree-file[data-kind="note"] .tree-file-icon { color: var(--text-muted); }
.tree-file-name {
  display: grid;
  gap: 1px;
  min-width: 0;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--text-strong);
}
.tree-file-name small {
  font-size: var(--text-2xs);
  font-weight: 500;
  color: var(--text-subtle);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tree-file-meta {
  font-size: var(--text-2xs);
  color: var(--text-subtle);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.tree-file-action {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--text-2xs);
  font-weight: 700;
  color: var(--violet-600);
  white-space: nowrap;
}
.tree-file.is-locked { opacity: 0.65; }
.tree-empty {
  margin: 0;
  padding: 6px 14px 14px;
  font-size: var(--text-2xs);
  color: var(--text-subtle);
}

/* A chapter's classes, laid out as cards: a cover band in the subject's hue,
   the length of the recording, the title and the hour it airs. */
.lecture-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(236px, 1fr));
  gap: var(--sp-3);
  padding: 0 12px 12px;
}
.lecture-card {
  display: grid;
  grid-template-rows: 92px auto;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-soft);
  color: inherit;
  text-decoration: none;
  overflow: hidden;
  transition: border-color var(--dur) var(--ease);
}
a.lecture-card:hover { border-color: var(--violet-500); }
a.lecture-card:focus-visible { outline: 2px solid var(--violet-600); outline-offset: 2px; }
.lecture-cover {
  position: relative;
  display: grid;
  place-items: center;
  color: var(--band-ink);
}
.lecture-cover-initials { font-size: var(--text-lg); font-weight: 800; letter-spacing: 0.02em; }
.lecture-duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: var(--r-pill);
  background: rgba(12, 12, 24, 0.82);
  color: var(--text-invert);
  font-size: 10px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.lecture-duration svg { width: 11px; height: 11px; }
.lecture-flag { position: absolute; left: 8px; top: 8px; }
.lecture-body { display: grid; gap: 4px; padding: 10px 12px 12px; align-content: start; }
.lecture-title {
  font-size: var(--text-sm);
  font-weight: 700;
  line-height: 1.4;
  color: var(--text-strong);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.lecture-meta { font-size: var(--text-2xs); color: var(--text-subtle); }
.lecture-card.is-locked { opacity: 0.72; }
.lecture-card.is-locked .lecture-body { opacity: 1; }

/* The timetable strip on a batch page: title on the left, the way to the full
   week on the right. */
.batch-schedule-title { display: flex; align-items: baseline; gap: var(--sp-2); flex-wrap: wrap; }
.batch-schedule-head .btn { flex: none; }

@media (max-width: 640px) {
  .lecture-grid { grid-template-columns: minmax(0, 1fr); padding: 0 10px 10px; }
  .subject-grid { grid-template-columns: minmax(0, 1fr); }
  .tree-file { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .tree-file-meta { display: none; }
  .tree-file-action { font-size: 0; }
  .tree-file-action svg { width: 16px; height: 16px; }
  .tree-total { display: none; }
}

@media (max-width: 640px) {
  .class-row { grid-template-columns: 64px minmax(0, 1fr); row-gap: 6px; }
  .class-action { grid-column: 2; justify-self: start; }
  .class-time { font-size: var(--text-xs); }
}

/* ============================== BATCH DETAIL =========================== */
.batch-hero { padding-block: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--border); }
.batch-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: var(--sp-6);
  align-items: start;
}
.batch-cover-lg {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--sp-6);
  min-height: 220px;
  padding: var(--sp-5);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  color: var(--band-ink);
  overflow: hidden;
}
.batch-cover-lg .cover-faces { gap: 8px; margin-top: 0; }
.batch-cover-lg .cover-face { width: 52px; height: 52px; font-size: 14px; }
.batch-cover-lg .cover-pill { position: static; background: rgba(12, 12, 24, 0.85); }
.batch-info h1 {
  font-size: clamp(1.5rem, 1.2rem + 1.4vw, var(--text-2xl));
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.batch-info .with-books {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--r-xs);
  background: var(--band-chemistry);
  color: var(--band-ink);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  margin-left: 6px;
  vertical-align: 3px;
}
.batch-info h1 .badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.batch-info h1 .course-title { display: block; }
.batch-info > p { color: var(--text-muted); font-size: var(--text-sm); line-height: 1.7; margin-top: 10px; }
.batch-facts-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: var(--sp-4);
  font-size: var(--text-xs);
  color: var(--text-subtle);
}
.batch-facts-inline span { display: inline-flex; align-items: center; gap: 6px; }
.batch-facts-inline svg { width: 14px; height: 14px; }
.batch-actions { display: flex; gap: 10px; margin-top: var(--sp-5); flex-wrap: wrap; }
.batch-actions .btn { min-width: 150px; }


.check-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: var(--sp-4);
}
.check-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--text-xs);
  color: var(--text-muted);
}
.check-item svg { width: 16px; height: 16px; color: var(--violet-400); flex: 0 0 auto; }

.facts-card {
  position: sticky;
  top: calc(var(--topbar-h) + var(--sp-4));
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-5);
  display: grid;
  gap: var(--sp-4);
}
.facts-row { display: grid; gap: 2px; }
.facts-row dt {
  font-size: var(--text-2xs);
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-subtle);
}
.facts-row dd { margin: 0; font-size: var(--text-sm); font-weight: 600; color: var(--text-strong); }

/* ============================== PLAYER ================================= */
.player-shell { padding-block: var(--sp-5) var(--sp-8); max-width: 980px; margin-inline: auto; }
.player-top {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  margin-bottom: var(--sp-4);
}
.player-top h1 { flex: 1 1 auto; font-size: var(--text-md); text-align: center; }
.player-top .icon-btn { border: 1px solid var(--border); }
.player-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--r-lg);
  overflow: hidden;
  background:
    radial-gradient(70% 80% at 50% 40%, rgba(120, 110, 255, 0.28), transparent 70%),
    var(--grad-player);
  border: 1px solid var(--border);
  display: grid;
  place-items: center;
}
.player-stage .stage-face {
  margin-bottom: 64px;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 28px;
  font-weight: 800;
  color: var(--band-ink);
  background: var(--grad-avatar-soft);
  border: 3px solid rgba(255, 255, 255, 0.55);
}
.player-play {
  position: absolute;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.92);
  color: var(--band-ink);
  box-shadow: var(--shadow-lg);
  transition: transform var(--dur) var(--ease);
}
.player-play:hover { transform: scale(1.06); }
.player-play svg { width: 24px; height: 24px; margin-left: 3px; }
.player-progress {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 14px 12px;
  background: linear-gradient(180deg, transparent, rgba(6, 6, 14, 0.86));
  display: grid;
  gap: 8px;
}
.player-track { height: 4px; border-radius: var(--r-pill); background: rgba(255, 255, 255, 0.24); overflow: hidden; }
.player-track i { display: block; height: 100%; width: 21%; background: var(--violet-500); border-radius: inherit; }
.player-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.82);
  font-variant-numeric: tabular-nums;
}
.player-controls .pc-right { display: flex; align-items: center; gap: 12px; }
.player-controls svg { width: 16px; height: 16px; }
.player-rate {
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  font-weight: 700;
}

.player-meta {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-4);
  padding-block: var(--sp-4);
}
.player-meta h2 { font-size: var(--text-lg); margin-bottom: 3px; }
.player-meta p { font-size: var(--text-xs); color: var(--text-subtle); }
.player-meta .icon-btn { border: 1px solid var(--border); flex: 0 0 auto; }

.lesson-list { display: grid; gap: 8px; margin-top: var(--sp-3); }
.lesson-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.lesson-item:hover { border-color: var(--border-strong); }
.lesson-item.is-current { border-color: var(--violet-600); background: rgba(91, 91, 246, 0.1); }
.lesson-num {
  width: 26px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.lesson-item.is-done .lesson-num { background: rgba(52, 211, 153, 0.16); border-color: transparent; color: var(--success-600); }
.lesson-main { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.lesson-main strong { font-size: var(--text-sm); font-weight: 600; color: var(--text-strong); }
.lesson-main small { font-size: var(--text-2xs); color: var(--text-subtle); }
.lesson-state { color: var(--text-subtle); }
.lesson-state svg { width: 17px; height: 17px; }
.lesson-item.is-locked { opacity: 0.6; }

.player-nav {
  display: flex;
  gap: 10px;
  margin-top: var(--sp-5);
  padding-top: var(--sp-4);
  border-top: 1px solid var(--border);
}
.player-nav .btn { flex: 1 1 0; }

.note-row,
.doubt-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--text-sm);
}
.note-row + .note-row,
.doubt-row + .doubt-row { margin-top: 8px; }
.note-row .row-icon,
.doubt-row .row-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: var(--surface-raised);
  color: var(--violet-400);
}
.note-row .row-icon svg,
.doubt-row .row-icon svg { width: 17px; height: 17px; }
.note-row .row-main,
.doubt-row .row-main { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.note-row strong,
.doubt-row strong { font-size: var(--text-sm); font-weight: 600; color: var(--text-strong); }
.note-row small,
.doubt-row small { font-size: var(--text-2xs); color: var(--text-subtle); }

/* ============================== PDF ROWS ============================== */
/* One column of note rows inside a section card. */
.pdf-list { display: grid; gap: 8px; }
.pdf-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.pdf-row + .pdf-row { margin-top: 8px; }
.pdf-thumb {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  background: rgba(91, 91, 246, 0.16);
  color: var(--violet-400);
}
.pdf-thumb svg { width: 20px; height: 20px; }
.pdf-main { flex: 1 1 auto; min-width: 0; display: grid; gap: 2px; }
.pdf-main strong { font-size: var(--text-sm); font-weight: 600; color: var(--text-strong); }
.pdf-main small { font-size: var(--text-2xs); color: var(--text-subtle); }
.pdf-action {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--violet-600);
  color: var(--text-invert);
}
.pdf-action:hover { background: var(--violet-700); }
.pdf-action svg { width: 17px; height: 17px; }

/* ============================== PROFILE ================================ */
.profile-head {
  display: flex;
  align-items: center;
  gap: var(--sp-4);
  padding-block: var(--sp-5);
}
.profile-avatar {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 20px;
  font-weight: 800;
  color: var(--text-invert);
  background: var(--grad-brand);
  flex: 0 0 auto;
}
.profile-head h2 { font-size: var(--text-xl); margin-bottom: 2px; text-align: start; }
.profile-head p { font-size: var(--text-xs); color: var(--text-subtle); }
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: var(--sp-5);
}
.profile-stat {
  padding: 14px;
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-align: center;
}
.profile-stat strong { display: block; font-size: var(--text-lg); font-weight: 800; color: var(--text-strong); }
.profile-stat span { font-size: var(--text-2xs); color: var(--text-subtle); }

.menu-list { display: grid; gap: 2px; background: var(--paper); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.menu-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 0 16px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
  transition: background var(--dur-fast) var(--ease);
}
.menu-row:last-child { border-bottom: 0; }
.menu-row:hover { background: var(--surface-raised); }
.menu-row .menu-icon { color: var(--text-muted); display: grid; place-items: center; }
.menu-row .menu-icon svg { width: 19px; height: 19px; }
.menu-row > span:not(.menu-icon):not(.menu-chevron) { flex: 1 1 auto; text-align: start; font-size: var(--text-sm); font-weight: 600; }
.menu-row .menu-icon { flex: 0 0 auto; }
.menu-row .menu-chevron { flex: 0 0 auto; margin-left: auto; color: var(--text-subtle); }
.menu-row .menu-chevron { color: var(--text-subtle); }
.menu-row .menu-chevron svg { width: 16px; height: 16px; }

/* ============================== COMMUNITY ============================== */
.post-list { display: grid; gap: 12px; }
.post-card {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: var(--sp-4);
  display: grid;
  gap: 10px;
}
.post-head { display: flex; align-items: center; gap: 10px; }
.post-avatar {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: var(--band-ink);
  background: var(--grad-avatar);
}
.post-who { display: grid; gap: 1px; }
.post-who strong { font-size: var(--text-sm); font-weight: 700; color: var(--text-strong); }
.post-who small { font-size: var(--text-2xs); color: var(--text-subtle); }
.post-card h3 { font-size: var(--text-md); font-weight: 700; }
.post-card p { font-size: var(--text-sm); line-height: 1.65; color: var(--text-muted); }
.post-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-5);
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: var(--text-xs);
  color: var(--text-subtle);
}
.post-actions button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-subtle);
  font-size: var(--text-xs);
  font-weight: 600;
  min-height: 24px;
}
.post-actions button:hover { color: var(--violet-400); }
.post-actions svg { width: 16px; height: 16px; }
.post-actions button.is-on { color: var(--violet-400); }

.compose-fab {
  position: fixed;
  right: var(--sp-5);
  bottom: calc(var(--tabbar-h) + var(--sp-4));
  z-index: var(--z-sticky);
  width: 56px;
  height: 56px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--violet-600);
  color: var(--text-invert);
  box-shadow: var(--shadow-brand);
  transition: transform var(--dur) var(--ease), background var(--dur) var(--ease);
}
.compose-fab:hover { background: var(--violet-700); transform: scale(1.05); }
.compose-fab svg { width: 24px; height: 24px; }
@media (min-width: 1024px) {
  .compose-fab { bottom: var(--sp-6); }
}

/* ============================== POSTER ================================= */
.poster-card {
  position: relative;
  border-radius: var(--r-xl);
  overflow: hidden;
  border: 1px solid var(--border);
  min-height: 340px;
  display: flex;
  align-items: flex-end;
  padding: var(--sp-6);
  background: var(--poster-ink);
  isolation: isolate;
}
.poster-card img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -2;
}
.poster-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(180deg, rgba(8, 8, 18, 0.15) 0%, rgba(8, 8, 18, 0.55) 55%, rgba(8, 8, 18, 0.92) 100%);
}
.poster-body { max-width: 30ch; display: grid; gap: var(--sp-3); }
.poster-body h2 {
  font-size: clamp(1.5rem, 1.2rem + 1.6vw, var(--text-2xl));
  line-height: 1.15;
  letter-spacing: 0.01em;
  text-transform: uppercase;
  color: var(--text-invert);
}
.poster-body p { font-size: var(--text-sm); color: var(--text-muted); }
.poster-body .btn { justify-self: start; }

/* ============================== RESPONSIVE ============================= */

@media (max-width: 1023px) {
  .batch-hero-grid { grid-template-columns: minmax(0, 1fr); }
  .learn-head { grid-template-columns: 64px minmax(0, 1fr); }
  .learn-cover { min-height: 64px; font-size: var(--text-sm); }
  .learn-overview { grid-column: 1 / -1; justify-self: start; }
  .facts-card { position: static; }
}
@media (max-width: 760px) {
  .topbar-brand .brand-text { font-size: var(--text-sm); }
  .quick-row { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .quick-tile { padding: 10px 8px; justify-items: center; text-align: center; }
  .quick-tile strong { font-size: 10px; }
  .quick-icon { width: 34px; height: 34px; }
  .check-list { grid-template-columns: minmax(0, 1fr); }
  .player-shell { padding-inline: 0; }
  .poster-card { min-height: 280px; padding: var(--sp-5); }
}
/*
 * Four equal columns only fit a label as long as "Batches". "Announcements" is
 * 99px wide in a 84px tile at 390px, so it ran out of the card and off the
 * screen. Two columns give the label the room, and the tile goes back to
 * icon-then-text so it stays one short row.
 */
@media (max-width: 520px) {
  .quick-row { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .quick-tile {
    grid-template-columns: auto minmax(0, 1fr);
    grid-auto-flow: column;
    align-items: center;
    justify-items: start;
    text-align: left;
    padding: 12px;
  }
  .quick-tile strong { font-size: var(--text-xs); overflow-wrap: anywhere; }
  .quick-icon { width: 34px; height: 34px; }
}

@media (max-width: 460px) {
  .topbar-brand .brand-text { display: none; }
}

/* Splash value list */
.splash-points { width: min(340px, 88vw); }
.feature-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--text-sm);
  color: var(--text-muted);
}
.feature-item svg { width: 18px; height: 18px; color: var(--violet-400); flex: 0 0 auto; }

/* Sticky purchase bar (phones only) */
.mobile-buy { display: none; }
@media (max-width: 760px) {
  body.has-mobile-buy { padding-bottom: calc(var(--tabbar-h) + 72px); }
  .mobile-buy {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    position: fixed;
    left: 0; right: 0;
    bottom: var(--tabbar-h);
    z-index: var(--z-sticky);
    padding: 10px var(--sp-4) calc(10px + env(safe-area-inset-bottom));
    background: rgba(12, 12, 22, 0.95);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-top: 1px solid var(--border);
  }
  .mobile-buy-price { font-size: var(--text-sm); font-weight: 800; color: var(--text-strong); display: grid; }
  .mobile-buy-price small { font-size: 10px; font-weight: 700; color: var(--success-600); }
  .mobile-buy .btn { min-width: 150px; min-height: 42px; }
}

/* ===================== API-DRIVEN DETAIL SCREENS ====================== */
/* The class player and batch detail render live rows, so they need a few
   small pieces that the fixture-era markup did not use. */

.player-video { width: 100%; height: 100%; object-fit: contain; background: #05070f; }

.player-stage.is-empty .stage-face { margin-bottom: 96px; opacity: 0.55; }

.stage-empty {
  position: absolute;
  inset: auto 0 0 0;
  padding: 18px 20px 22px;
  text-align: center;
  background: linear-gradient(180deg, transparent, rgba(6, 6, 14, 0.94) 42%);
}
.stage-empty[hidden] { display: none; }
.stage-empty strong { display: block; font-size: var(--text-sm); color: var(--text-strong); }
.stage-empty p { margin: 4px auto 0; max-width: 44ch; font-size: var(--text-xs); color: var(--text-subtle); }

.player-shell .tabs .tab { font-size: var(--text-xs); }

/* On a phone the strip splits into equal columns, so the label has to fit a
   third of the viewport. 11px does that without breaking mid-word; the base
   rule above would otherwise win on specificity. */
@media (max-width: 640px) {
  .player-shell .tabs .tab { font-size: var(--text-2xs); padding-inline: 4px; }
}

.player-brief {
  margin: var(--sp-4) 0 0;
  font-size: var(--text-sm);
  line-height: 1.65;
  color: var(--text-muted);
  max-width: 72ch;
}
.player-brief[hidden] { display: none; }

.course-title { display: block; font-family: var(--font-display); font-size: clamp(26px, 3.4vw, 38px); font-weight: 800; line-height: 1.12; letter-spacing: -0.02em; color: var(--text-strong); margin: 10px 0 12px; }
.course-hero-lead { margin: 0 0 14px; max-width: 62ch; font-size: var(--text-sm); line-height: 1.6; color: var(--text-muted); }
.batch-facts-inline { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: var(--text-xs); color: var(--text-subtle); }
.batch-facts-inline > span { display: inline-flex; align-items: center; gap: 6px; }
.batch-facts-inline svg { width: 15px; height: 15px; }
.batch-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.batch-actions .btn { flex: 1 1 auto; min-width: 0; }
@media (max-width: 560px) {
  .batch-actions { display: grid; grid-template-columns: minmax(0, 1fr); }
  .batch-actions .btn { width: 100%; }
}

.notice-row { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-1); }
.notice-row + .notice-row { margin-top: 10px; }
.notice-row strong { font-size: var(--text-sm); color: var(--text-strong); }

.acc-item { padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--surface-1); }
.acc-item + .acc-item { margin-top: 10px; }
.acc-head-static { display: flex; align-items: center; }
.acc-title { font-size: var(--text-sm); font-weight: 700; color: var(--text-strong); }
.acc-text { margin: 6px 0 0; font-size: var(--text-xs); line-height: 1.65; color: var(--text-muted); }

.lesson-list { display: grid; gap: 8px; }
.test-grid { display: grid; gap: var(--sp-4); grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }

/* Two-column block used by the batch overview; single column on narrow
   screens, and the error variant of `.empty-state` gets a warning accent. */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
@media (max-width: 720px) { .grid-2 { grid-template-columns: 1fr; } }
.empty-state.is-error svg { color: var(--danger-600, #f87171); }
.empty-state.is-error h3 { color: var(--text-strong); }

/* ------------------------------------------------------------------ */
/* Class player: progress control and lesson notes                     */
/* ------------------------------------------------------------------ */

#mark-complete { white-space: nowrap; }

#mark-complete.is-done {
  background: rgba(52, 211, 153, 0.16);
  border-color: transparent;
  color: var(--success-600);
}

#mark-complete.is-done:hover { background: rgba(52, 211, 153, 0.24); }

.note-composer { display: grid; gap: var(--sp-2); }

.note-composer .note-preview { background: var(--surface-raised); }

.note-preview [data-delete-note] { color: var(--text-subtle); }
.note-preview [data-delete-note]:hover { color: var(--danger-600); }

@media (max-width: 560px) {
  #mark-complete { width: 100%; }
  .player-meta > .row { width: 100%; }
}

/* ------------------------------------------------------------------ */
/* Dashboard study plan                                                */
/* ------------------------------------------------------------------ */

.task-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  font-size: 12px;
}

.task-row .task-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.task-row.is-done .task-title {
  font-weight: 500;
  color: var(--text-subtle);
  text-decoration: line-through;
  text-decoration-color: var(--slate-600);
}

.task-check {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-subtle);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.task-check svg { width: 14px; height: 14px; }

.task-check:hover { border-color: var(--violet-500); color: var(--violet-600); }

.task-row.is-done .task-check {
  background: rgba(52, 211, 153, 0.16);
  border-color: transparent;
  color: var(--success-600);
}

.task-check:disabled { opacity: 0.5; cursor: progress; }

/* ------------------------------------------------------------------ */
/* Batch page: faculty                                                 */
/* ------------------------------------------------------------------ */

.faculty-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: var(--sp-3);
}

.faculty-card {
  display: flex;
  gap: var(--sp-3);
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  border: 1px solid var(--border);
  background: var(--surface);
}

.faculty-avatar {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: 50%;
  overflow: hidden;
  background: var(--surface-sunken);
  color: var(--violet-600);
  font-weight: 700;
  font-size: var(--text-sm);
}

.faculty-avatar img { width: 100%; height: 100%; object-fit: cover; }

.faculty-body { display: grid; gap: 4px; min-width: 0; align-content: start; }
.faculty-body strong { font-size: var(--text-sm); }
.faculty-body .badge { justify-self: start; }

/* An embed player owns its own chrome; the stage just sizes it. */
.player-embed { position: absolute; inset: 0; background: #000; }
.player-embed[hidden] { display: none; }
.player-embed iframe { display: block; width: 100%; height: 100%; border: 0; }

/*
 * The stage's own full-screen control.
 *
 * A hosted embed arrives with its host's chrome and no way out of it, so the
 * page supplies the one control a phone needs: enlarge the stage (and, while
 * it is enlarged, turn landscape). Top-right keeps it clear of the native
 * `<video>` controls that a direct file brings along the bottom.
 */
.stage-full {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: var(--r-md);
  background: rgba(6, 8, 18, 0.62);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.stage-full[hidden] { display: none; }
.stage-full:hover { background: rgba(6, 8, 18, 0.86); }
.stage-full:focus-visible { outline: 2px solid var(--violet-400); outline-offset: 2px; }
.stage-full svg { width: 17px; height: 17px; }

/* Full screen applies to the stage, so an embed and a direct file behave the
   same and the button can leave it again. */
.player-stage:fullscreen,
.player-stage:-webkit-full-screen {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border: 0;
  border-radius: 0;
  background: #000;
}
.player-stage:fullscreen .player-video,
.player-stage:-webkit-full-screen .player-video { width: 100%; height: 100%; object-fit: contain; }

/* A tab label that overflows its own box is a clipped word, not a style. */
.tabs .tab { overflow-wrap: anywhere; }

/* ============================== LANDSCAPE PHONE ======================= */
/*
 * A phone turned sideways has ~390px of height and the top bar, page title and
 * tab bar were eating 122 of it. While a class is open the two bars step aside
 * and the stage takes the height — but the back button stays, because a video
 * screen with no way out is a dead end.
 */
@media (orientation: landscape) and (max-height: 520px) {
  body.player-page.has-recording .topbar,
  body.player-page.has-recording .tabbar { display: none; }
  body.player-page.has-recording { padding-bottom: 0; }
  body.player-page.has-recording .player-shell { padding-block: 8px var(--sp-6); padding-inline: 12px; }
  body.player-page.has-recording .player-top { margin-bottom: 8px; }
  body.player-page.has-recording .player-top h1 { font-size: var(--text-sm); }
  body.player-page.has-recording .player-stage {
    aspect-ratio: auto;
    height: calc(100vh - 76px);
    height: calc(100dvh - 76px);
    border-radius: var(--r-md);
  }
}
