:root {
  color-scheme: light;
  --paper: #f5f1e8;
  --paper-strong: #ece5d7;
  --ink: #2c2a25;
  --muted: #746f64;
  --line: rgba(68, 61, 49, 0.14);
  --accent: #765f42;
  --accent-strong: #59452f;
  --accent-soft: #e7ddcd;
  --card: rgba(255, 253, 248, 0.88);
  --shadow: 0 18px 50px rgba(74, 61, 43, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  font-family:
    "Noto Sans TC",
    "PingFang TC",
    "Microsoft JhengHei",
    system-ui,
    sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(197, 173, 135, 0.2), transparent 34rem),
    linear-gradient(180deg, #f8f5ee 0%, var(--paper) 42%, #f1ece2 100%);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(100%, 860px);
  margin: 0 auto;
  padding:
    max(20px, env(safe-area-inset-top))
    12px
    max(56px, env(safe-area-inset-bottom));
}

.course-list-shell {
  width: min(100%, 1180px);
}

.course-header,
.section-heading,
.timeline-row,
.secondary-controls,
.chapter-row {
  display: flex;
  align-items: center;
}

.course-header,
.section-heading {
  justify-content: space-between;
  gap: 16px;
}

.course-header h1,
.section-heading h2,
.course-header p,
.section-heading p {
  margin: 0;
}

.course-header h1 {
  margin-top: 5px;
  font-size: clamp(1.35rem, 5.5vw, 2rem);
  letter-spacing: 0.02em;
}

.course-meta,
.section-heading > span {
  margin-top: 6px !important;
  color: var(--muted);
  font-size: 0.86rem;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.ghost-button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.5);
}

.hidden {
  display: none !important;
}

.auth-shell {
  max-width: 620px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 28px 4px 22px;
}

.auth-brand h1,
.auth-brand p,
.member-heading h2,
.member-heading p,
.status-panel h3,
.status-panel p {
  margin: 0;
}

.auth-brand h1 {
  margin-top: 5px;
  font-size: clamp(1.7rem, 7vw, 2.35rem);
}

.brand-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 1.7rem;
}

.auth-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--card);
  box-shadow: var(--shadow);
}

.centered-card {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 14px;
  color: var(--muted);
}

.spinner {
  width: 34px;
  height: 34px;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 999px;
  animation: spin 800ms linear infinite;
}

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

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 22px;
  padding: 5px;
  border-radius: 18px;
  background: var(--paper-strong);
}

.auth-tab {
  border: 0;
  border-radius: 14px;
  padding: 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.auth-tab.active {
  color: var(--accent-strong);
  background: white;
  box-shadow: 0 3px 12px rgba(74, 61, 43, 0.08);
}

.auth-form {
  display: grid;
  gap: 15px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  color: var(--accent-strong);
  font-size: 0.92rem;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 13px 14px;
  color: var(--ink);
  outline: none;
  background: rgba(255, 255, 255, 0.78);
}

.auth-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(118, 95, 66, 0.12);
}

.primary-action,
.secondary-action {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 48px;
  border-radius: 15px;
  padding: 12px 16px;
  text-decoration: none;
  font-weight: 800;
}

.primary-action {
  border: 0;
  color: white;
  background: var(--accent-strong);
}

.secondary-action {
  margin-top: 18px;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.form-hint,
.auth-message {
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.6;
}

.auth-message {
  min-height: 1.4em;
  margin-top: 14px;
}

.member-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.member-heading h2 {
  margin-top: 4px;
  font-size: 1.4rem;
}

.status-panel {
  padding: 34px 8px 10px;
  text-align: center;
}

.status-panel h3 {
  margin-top: 13px;
  font-size: 1.45rem;
}

.status-panel p {
  margin: 9px auto 0;
  max-width: 32rem;
  color: var(--muted);
  line-height: 1.7;
}

.status-icon {
  display: grid;
  width: 64px;
  height: 64px;
  margin: 0 auto;
  place-items: center;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 1.7rem;
  font-weight: 800;
}

.status-badge {
  display: inline-flex;
  margin-top: 18px;
  border-radius: 999px;
  padding: 8px 13px;
  font-size: 0.85rem;
  font-weight: 800;
}

.status-badge.waiting {
  color: #765f42;
  background: #efe5d3;
}

.status-badge.approved {
  color: #365c42;
  background: #dfeade;
}

.bootstrap-admin-box {
  display: grid;
  gap: 12px;
  margin-top: 26px;
  padding: 18px;
  border: 1px dashed rgba(89, 69, 47, 0.28);
  border-radius: 18px;
  background: rgba(231, 221, 205, 0.42);
}

.bootstrap-admin-box p {
  margin: 0;
}

.bootstrap-admin-box .primary-action {
  width: 100%;
}

.admin-shell {
  max-width: 860px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 4px 22px;
}

.admin-header h1,
.admin-header p {
  margin: 0;
}

.admin-header h1 {
  margin-top: 5px;
  font-size: clamp(1.7rem, 6vw, 2.4rem);
}

.admin-home-link {
  text-decoration: none;
}

.admin-header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.admin-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.summary-card {
  display: grid;
  gap: 4px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  box-shadow: 0 8px 22px rgba(74, 61, 43, 0.05);
}

.summary-card span {
  color: var(--muted);
  font-size: 0.8rem;
}

.summary-card strong {
  font-size: 1.55rem;
}

.member-filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 -4px 12px;
  padding: 4px;
  scrollbar-width: none;
}

.member-filter-bar::-webkit-scrollbar {
  display: none;
}

.filter-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 9px 13px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.58);
}

.filter-chip.active {
  color: white;
  border-color: var(--accent-strong);
  background: var(--accent-strong);
}

.member-list {
  display: grid;
  gap: 12px;
}

.member-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 10px 30px rgba(74, 61, 43, 0.06);
}

.member-card-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.member-card h2,
.member-card p {
  margin: 0;
}

.member-card h2 {
  font-size: 1.2rem;
}

.member-status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.status-pending {
  color: #765f42;
  background: #efe5d3;
}

.status-approved {
  color: #365c42;
  background: #dfeade;
}

.status-suspended {
  color: #6f5327;
  background: #f3dfb6;
}

.status-rejected {
  color: #7a3f3f;
  background: #f2dada;
}

.status-draft {
  color: #746f64;
  background: #ece8df;
}

.status-ready {
  color: #5b5d2f;
  background: #ececcf;
}

.status-published {
  color: #365c42;
  background: #dfeade;
}

.status-hidden {
  color: #6b5864;
  background: #ece1e7;
}

.member-meta-grid {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 7px 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 0.84rem;
}

.member-meta-grid span {
  color: var(--muted);
}

.member-meta-grid strong {
  font-weight: 650;
}

.member-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.member-action {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 12px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.68);
  font-weight: 700;
}

.member-action:disabled {
  cursor: wait;
  opacity: 0.55;
}

.action-approve {
  color: white;
  border-color: #496b52;
  background: #496b52;
}

.action-danger {
  color: #7a3f3f;
  border-color: rgba(122, 63, 63, 0.25);
  background: #f7e8e8;
}

.protected-admin-label {
  color: var(--muted);
  font-size: 0.84rem;
}

.admin-empty {
  color: var(--muted);
  text-align: center;
}

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

.learning-course-card {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 12px 32px rgba(74, 61, 43, 0.06);
}

.learning-course-top,
.learning-course-footer {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.learning-course-top {
  align-items: flex-start;
}

.learning-course-card h2,
.learning-course-card p {
  margin: 0;
}

.learning-course-card h2 {
  margin-top: 4px;
  font-size: 1.35rem;
  line-height: 1.45;
}

.course-description {
  margin-top: 10px !important;
  color: var(--muted);
  line-height: 1.7;
}

.cache-state {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.cache-hot {
  color: #365c42;
  background: #dfeade;
}

.cache-warming {
  color: #765f42;
  background: #efe5d3;
}

.cache-cold,
.cache-error {
  color: var(--muted);
  background: #ece8df;
}

.learning-course-footer {
  align-items: center;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.84rem;
}

.course-play-link {
  min-height: auto;
  padding: 10px 14px;
}

.course-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.course-outline-link {
  min-height: auto;
  margin-top: 0;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
}

.course-waiting {
  border-radius: 999px;
  padding: 8px 11px;
  background: var(--paper-strong);
}

.course-admin-form {
  display: grid;
  gap: 14px;
}

.course-admin-form label {
  display: grid;
  gap: 7px;
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

.course-admin-form input,
.course-admin-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.75);
  resize: vertical;
}

.course-admin-list-heading {
  margin-top: 30px;
}

.admin-dashboard-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.storage-card {
  min-height: 190px;
}

.storage-card .section-heading {
  margin-bottom: 14px;
}

.storage-meter {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-strong);
}

.storage-meter span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-strong);
  transition: width 220ms ease;
}

.storage-numbers {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

.drive-status-body {
  color: var(--muted);
  line-height: 1.7;
}

.drive-status-body p {
  margin: 6px 0;
}

.outline-shell {
  max-width: 820px;
}

.outline-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 18px 4px 24px;
}

.outline-header h1,
.outline-header p {
  margin: 0;
}

.outline-header h1 {
  margin-top: 5px;
  font-size: clamp(1.7rem, 7vw, 2.55rem);
  line-height: 1.28;
}

.outline-intro-card {
  position: relative;
  overflow: hidden;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    radial-gradient(circle at 85% 12%, rgba(231, 221, 205, 0.65), transparent 34%),
    var(--card);
  box-shadow: var(--shadow);
}

.outline-intro-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
  content: "";
  opacity: 0.45;
}

.outline-summary {
  margin: 12px 0 0;
  font-size: clamp(1.05rem, 4.4vw, 1.3rem);
  line-height: 1.9;
  letter-spacing: 0.015em;
}

.outline-core-section,
.outline-map-section {
  padding-top: 34px;
}

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

.outline-core-card {
  min-height: 118px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.88);
}

.outline-core-card p {
  margin: 12px 0 0;
  font-size: clamp(1.16rem, 4.9vw, 1.34rem);
  line-height: 1.7;
  font-weight: 700;
}

.outline-core-number {
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.outline-sections {
  display: grid;
  gap: 14px;
}

.outline-section-card {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 10px 26px rgba(74, 61, 43, 0.05);
}

.outline-section-marker {
  display: grid;
  place-items: center;
  align-self: start;
  width: 38px;
  height: 38px;
  border-radius: 13px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 0.78rem;
  font-weight: 800;
}

.outline-section-body {
  min-width: 0;
}

.outline-section-top h3 {
  margin: 5px 0 0;
  font-size: 1.22rem;
  line-height: 1.5;
}

.outline-time {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.outline-takeaways {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding-left: 1.2em;
  color: var(--ink);
  line-height: 1.7;
}

.outline-takeaways li::marker {
  color: var(--accent);
}

.outline-quote {
  margin: 18px 0 0;
  padding: 14px 16px;
  border-left: 3px solid var(--accent);
  border-radius: 0 14px 14px 0;
  color: var(--accent-strong);
  background: rgba(231, 221, 205, 0.48);
  font-size: 0.96rem;
  line-height: 1.75;
}

.outline-listen-button {
  margin-top: 18px;
  border: 0;
}

.outline-editor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.outline-editor-toolbar .member-actions {
  margin-top: 0;
}

.outline-editor-form {
  display: grid;
  gap: 16px;
}

.outline-editor-section-heading {
  margin-top: 14px;
}

.outline-section-editor {
  display: grid;
  gap: 12px;
}

.outline-edit-card {
  display: grid;
  gap: 14px;
  border-radius: 22px;
}

.outline-edit-card label {
  display: grid;
  gap: 7px;
  color: var(--accent-strong);
  font-size: 0.9rem;
  font-weight: 700;
}

.outline-edit-card input,
.outline-edit-card textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.78);
  resize: vertical;
}

@media (max-width: 520px) {
  .admin-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .outline-header {
    align-items: flex-start;
  }

  .outline-core-grid {
    grid-template-columns: 1fr;
  }

  .outline-section-card {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 10px;
    padding: 17px 15px;
  }

  .outline-section-marker {
    width: 32px;
    height: 32px;
    border-radius: 11px;
  }

  .outline-editor-toolbar {
    display: grid;
  }

  .course-card-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .learning-course-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-summary {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .summary-card {
    padding: 12px 10px;
  }

  .summary-card strong {
    font-size: 1.35rem;
  }
}

.subtitle-stage {
  display: grid;
  place-items: center;
  min-height: min(52vh, 470px);
  margin: 24px -4px 16px;
  padding: 30px 12px;
  border: 1px solid var(--line);
  border-radius: 30px;
  text-align: center;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.8), rgba(234, 225, 209, 0.7));
  box-shadow: var(--shadow);
  overflow: hidden;
}

.cue {
  width: 100%;
  margin: 0;
  transition:
    opacity 180ms ease,
    transform 180ms ease;
}

.cue-current {
  align-self: center;
  font-size: clamp(2rem, 8.7vw, 4rem);
  font-weight: 760;
  line-height: 1.42;
  letter-spacing: 0.035em;
  text-wrap: balance;
}

.cue-context {
  max-width: 90%;
  color: var(--muted);
  font-size: clamp(0.96rem, 3.8vw, 1.25rem);
  line-height: 1.65;
  opacity: 0.62;
}

.player-card {
  position: sticky;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 4;
  padding: 18px 16px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.timeline-row {
  gap: 10px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 0.8rem;
}

#seekBar {
  width: 100%;
  accent-color: var(--accent);
}

.primary-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px;
  padding: 13px 0 12px;
}

.round-button {
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
}

.round-button.play {
  width: 64px;
  height: 64px;
  padding-left: 4px;
  color: white;
  background: var(--accent-strong);
  font-size: 1.45rem;
  box-shadow: 0 10px 25px rgba(89, 69, 47, 0.22);
}

.round-button.secondary {
  width: 48px;
  height: 48px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-weight: 700;
}

.secondary-controls {
  justify-content: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.86rem;
}

#speedSelect {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 30px 7px 11px;
  color: var(--ink);
  background: var(--paper);
}

.status-pill {
  margin-left: auto;
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--accent-strong);
  background: var(--accent-soft);
}

.chapters-section,
.full-subtitles-section {
  padding-top: 34px;
}

.section-heading {
  align-items: end;
  margin-bottom: 14px;
}

.section-heading h2 {
  margin-top: 3px;
  font-size: 1.25rem;
}

.chapter-list,
.transcript {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
}

.chapter-row {
  width: 100%;
  justify-content: space-between;
  gap: 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  padding: 16px;
  color: var(--ink);
  text-align: left;
  background: transparent;
}

.chapter-row:last-child {
  border-bottom: 0;
}

.chapter-row:hover,
.chapter-row:focus-visible,
.transcript-cue.active {
  background: var(--accent-soft);
}

.chapter-time {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.transcript-cue {
  display: grid;
  grid-template-columns: 54px 1fr;
  gap: 12px;
  width: 100%;
  padding: 13px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-align: left;
  background: transparent;
  transition: background 160ms ease;
}

.transcript-cue:last-child {
  border-bottom: 0;
}

.transcript-time {
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.transcript-text {
  line-height: 1.65;
}

@media (min-width: 720px) {
  .app-shell {
    padding-left: 28px;
    padding-right: 28px;
  }

  .subtitle-stage {
    padding: 42px 50px;
  }

  .player-card {
    padding-left: 24px;
    padding-right: 24px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}

.course-header-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.focus-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.62);
  font-weight: 750;
}

.empty-inline {
  margin: 0;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.learning-home-header {
  align-items: flex-start;
}

.learning-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-bottom: 24px;
  padding: 16px;
}

.course-search-field {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.8);
}

.course-search-field > span {
  flex: 0 0 auto;
  color: var(--accent);
  font-size: 1.4rem;
}

.course-search-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 13px 0;
  color: var(--ink);
  background: transparent;
}

.year-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.84rem;
}

.year-filter select {
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 12px 32px 12px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.8);
}

.toolbar-hint {
  grid-column: 1 / -1;
}

.continue-section,
.search-results-section {
  padding-top: 6px;
  margin-bottom: 26px;
}

.continue-course-card {
  border-color: rgba(118, 95, 66, 0.28);
  background: linear-gradient(145deg, rgba(255, 253, 248, 0.96), rgba(231, 221, 205, 0.58));
}

.course-catalog-heading {
  margin-top: 10px;
}

.course-progress-wrap {
  margin-top: 16px;
}

.course-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 0.8rem;
}

.course-progress-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--paper-strong);
}

.course-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.search-results {
  display: grid;
  gap: 10px;
}

.subtitle-search-result {
  display: block;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: inherit;
  text-decoration: none;
  background: var(--card);
  box-shadow: 0 8px 24px rgba(74, 61, 43, 0.05);
}

.subtitle-search-result:hover,
.subtitle-search-result:focus-visible {
  border-color: rgba(118, 95, 66, 0.35);
  background: var(--accent-soft);
}

.subtitle-search-meta {
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 750;
}

.subtitle-search-text {
  line-height: 1.65;
}

.listening-list {
  display: grid;
  gap: 10px;
}

.listening-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
}

.listening-card p,
.listening-card strong {
  margin: 0;
}

.listening-card .course-meta {
  margin-top: 5px !important;
}

.listening-progress {
  align-self: center;
  color: var(--accent-strong);
  text-align: right;
  font-size: 0.84rem;
  font-weight: 750;
}

.subtitle-focus-mode {
  overflow: hidden;
}

.subtitle-focus-mode .app-shell {
  width: 100%;
  max-width: none;
  min-height: 100dvh;
  padding: 0;
}

.subtitle-focus-mode .course-header,
.subtitle-focus-mode .chapters-section,
.subtitle-focus-mode .full-subtitles-section {
  display: none !important;
}

.subtitle-focus-mode .subtitle-stage {
  position: fixed;
  inset: 0;
  z-index: 20;
  min-height: 100dvh;
  margin: 0;
  padding: max(7vh, 40px) 18px max(27vh, 190px);
  border: 0;
  border-radius: 0;
  background:
    radial-gradient(circle at top right, rgba(197, 173, 135, 0.18), transparent 34rem),
    linear-gradient(180deg, #f8f5ee 0%, var(--paper) 56%, #efe8dc 100%);
  box-shadow: none;
}

.subtitle-focus-mode .cue-current {
  font-size: clamp(2.35rem, 10vw, 5.2rem);
  line-height: 1.38;
}

.subtitle-focus-mode .cue-context {
  max-width: 94%;
  font-size: clamp(1rem, 4.2vw, 1.5rem);
}

.subtitle-focus-mode .player-card {
  position: fixed;
  right: 10px;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 10px;
  z-index: 30;
  padding: 12px 14px;
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.88);
}

.subtitle-focus-mode .primary-controls {
  padding: 7px 0 6px;
}

.subtitle-focus-mode .round-button.play {
  width: 58px;
  height: 58px;
}

.subtitle-focus-mode .status-pill {
  display: none;
}

@media (max-width: 620px) {
  .course-header {
    align-items: flex-start;
  }

  .course-header-actions .ghost-button {
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .learning-toolbar {
    grid-template-columns: 1fr;
  }

  .year-filter {
    justify-content: space-between;
  }

  .year-filter select {
    flex: 1;
  }

  .learning-home-header {
    display: grid;
  }

  .learning-home-header .admin-header-actions {
    justify-content: flex-start;
  }

  .listening-card {
    grid-template-columns: 1fr;
  }

  .listening-progress {
    text-align: left;
  }

  .subtitle-focus-mode .secondary-controls {
    flex-wrap: wrap;
  }
}

.cue-extra-context,
.fullscreen-control-bar {
  display: none;
}

.subtitle-focus-mode .subtitle-stage {
  align-content: center;
  gap: clamp(7px, 1.2vh, 13px);
  padding: max(3vh, 24px) 14px max(25vh, 180px);
}

.subtitle-focus-mode .cue-context {
  display: -webkit-box;
  max-width: 96%;
  overflow: hidden;
  font-size: clamp(1.15rem, 4.8vw, 1.65rem);
  line-height: 1.42;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.subtitle-focus-mode .cue-extra-context {
  display: -webkit-box;
  opacity: 0.43;
  -webkit-line-clamp: 1;
}

.subtitle-focus-mode .cue-context-near {
  opacity: 0.7;
}

@media (orientation: landscape) {
  .subtitle-focus-mode .subtitle-stage {
    gap: clamp(5px, 1.6vh, 10px);
    padding:
      max(4vh, env(safe-area-inset-top))
      max(5vw, 44px)
      max(20vh, 88px);
  }

  .subtitle-focus-mode .cue-extra-context {
    display: none;
  }

  .subtitle-focus-mode .cue-current {
    font-size: clamp(2rem, 6.4vw, 4.6rem);
    line-height: 1.28;
  }

  .subtitle-focus-mode .cue-context {
    max-width: 92%;
    font-size: clamp(1rem, 2.5vw, 1.4rem);
    line-height: 1.35;
    -webkit-line-clamp: 1;
  }

  .subtitle-focus-mode .player-card {
    display: none;
  }

  .subtitle-focus-mode .fullscreen-control-bar {
    position: fixed;
    right: max(12px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    left: max(12px, env(safe-area-inset-left));
    z-index: 40;
    display: grid;
    grid-template-columns: minmax(108px, 1fr) auto minmax(108px, 1fr);
    align-items: center;
    gap: 14px;
    min-height: 62px;
    padding: 8px 12px;
    border: 1px solid rgba(118, 95, 66, 0.18);
    border-radius: 22px;
    background: rgba(255, 253, 248, 0.9);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    transition:
      opacity 180ms ease,
      transform 180ms ease;
  }

  .subtitle-focus-mode.focus-controls-hidden .fullscreen-control-bar {
    pointer-events: none;
    opacity: 0;
    transform: translateY(calc(100% + 24px));
  }

  .fullscreen-control-side {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }

  .fullscreen-speed-control {
    justify-self: start;
  }

  .fullscreen-speed-control label {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
  }

  #fullscreenSpeedSelect {
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 27px 8px 10px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.86);
    font-weight: 750;
  }

  .fullscreen-primary-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(6px, 1.4vw, 12px);
  }

  .focus-control-button {
    display: inline-grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    color: var(--accent-strong);
    background: var(--accent-soft);
    font-size: 0.82rem;
    font-weight: 800;
  }

  .focus-play-button {
    width: 50px;
    height: 50px;
    padding-left: 3px;
    color: white;
    background: var(--accent-strong);
    font-size: 1.18rem;
  }

  .fullscreen-exit-control {
    justify-self: end;
  }

  .focus-exit-button {
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 13px;
    color: var(--accent-strong);
    background: rgba(255, 255, 255, 0.86);
    font-weight: 800;
    white-space: nowrap;
  }
}

@media (orientation: landscape) and (max-width: 700px) {
  .subtitle-focus-mode .fullscreen-control-bar {
    grid-template-columns: 92px minmax(0, 1fr) 96px;
    gap: 7px;
    padding-right: 8px;
    padding-left: 8px;
  }

  .fullscreen-speed-control label {
    display: none;
  }

  #fullscreenSpeedSelect {
    max-width: 86px;
    padding-right: 22px;
    padding-left: 8px;
  }

  .fullscreen-primary-controls {
    gap: 5px;
  }

  .focus-control-button {
    width: 39px;
    height: 39px;
    font-size: 0.76rem;
  }

  .focus-play-button {
    width: 46px;
    height: 46px;
  }

  .focus-exit-button {
    min-height: 39px;
    padding-right: 9px;
    padding-left: 9px;
    font-size: 0.78rem;
  }
}

/* Stable karaoke-style fullscreen subtitle flow. */
.subtitle-focus-mode .subtitle-stage {
  grid-template-rows:
    1.1fr
    1.3fr
    1.8fr
    0.75fr
    0.5fr
    0.4fr
    0.4fr
    0.35fr;
  align-content: stretch;
  place-items: center;
  touch-action: manipulation;
}

.subtitle-focus-mode .cue {
  align-self: center;
  min-height: 0;
  transform: translateY(0);
}

.subtitle-focus-mode .cue-current {
  max-width: min(96%, 980px);
}

.subtitle-focus-mode .cue-context {
  align-self: center;
}

.subtitle-focus-mode .cue-context-far {
  opacity: 0.38;
}

.subtitle-focus-mode .cue-next-primary {
  opacity: 0.64;
}

.subtitle-focus-mode .cue-next-secondary {
  opacity: 0.48;
}

.subtitle-focus-mode .subtitle-stage.subtitle-flow-forward .cue {
  animation: subtitle-karaoke-flow-up 220ms cubic-bezier(0.22, 0.76, 0.28, 1);
}

.subtitle-focus-mode .subtitle-stage.subtitle-flow-forward .cue-current,
.subtitle-focus-mode .subtitle-stage.subtitle-flow-forward .cue-next-primary {
  animation-duration: 240ms;
}

@keyframes subtitle-karaoke-flow-up {
  from {
    transform: translateY(14px);
  }

  to {
    transform: translateY(0);
  }
}

@media (orientation: portrait) {
  .subtitle-focus-mode .player-card {
    display: none;
  }

  .subtitle-focus-mode .fullscreen-control-bar {
    position: fixed;
    right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
    left: max(10px, env(safe-area-inset-left));
    z-index: 40;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "speed exit"
      "primary primary";
    align-items: center;
    gap: 8px 10px;
    padding: 10px 12px 11px;
    border: 1px solid rgba(118, 95, 66, 0.18);
    border-radius: 22px;
    background: rgba(255, 253, 248, 0.92);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
    transition:
      opacity 180ms ease,
      transform 180ms ease;
  }

  .subtitle-focus-mode.focus-controls-hidden .fullscreen-control-bar {
    pointer-events: none;
    opacity: 0;
    transform: translateY(calc(100% + 24px));
  }

  .subtitle-focus-mode .fullscreen-control-side {
    display: flex;
    align-items: center;
    gap: 7px;
    min-width: 0;
  }

  .subtitle-focus-mode .fullscreen-speed-control {
    grid-area: speed;
    justify-self: start;
  }

  .subtitle-focus-mode .fullscreen-speed-control label {
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
  }

  .subtitle-focus-mode #fullscreenSpeedSelect {
    max-width: 92px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 8px 24px 8px 9px;
    color: var(--ink);
    background: rgba(255, 255, 255, 0.88);
    font-weight: 750;
  }

  .subtitle-focus-mode .fullscreen-exit-control {
    grid-area: exit;
    justify-self: end;
  }

  .subtitle-focus-mode .focus-exit-button {
    min-height: 38px;
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 7px 11px;
    color: var(--accent-strong);
    background: rgba(255, 255, 255, 0.88);
    font-size: 0.8rem;
    font-weight: 800;
    white-space: nowrap;
  }

  .subtitle-focus-mode .fullscreen-primary-controls {
    grid-area: primary;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: clamp(7px, 2.4vw, 12px);
  }

  .subtitle-focus-mode .focus-control-button {
    display: inline-grid;
    place-items: center;
    width: clamp(42px, 12vw, 48px);
    height: clamp(42px, 12vw, 48px);
    border: 0;
    border-radius: 999px;
    color: var(--accent-strong);
    background: var(--accent-soft);
    font-size: 0.8rem;
    font-weight: 800;
  }

  .subtitle-focus-mode .focus-play-button {
    width: clamp(50px, 14vw, 56px);
    height: clamp(50px, 14vw, 56px);
    padding-left: 3px;
    color: white;
    background: var(--accent-strong);
    font-size: 1.18rem;
  }

  .subtitle-focus-mode .subtitle-stage {
    grid-template-rows:
      0.7fr
      1fr
      minmax(180px, auto)
      0.95fr
      0.65fr
      0.45fr
      0.4fr
      0.35fr;
    gap: clamp(6px, 0.9vh, 10px);
    padding-top: max(2.5vh, 18px);
    padding-bottom: max(24vh, 190px);
  }

  .subtitle-focus-mode #previousCue2 {
    max-width: 90%;
    font-size: clamp(0.9rem, 3.5vw, 1.15rem);
    line-height: 1.35;
    opacity: 0.28;
    -webkit-line-clamp: 1;
  }

  .subtitle-focus-mode #previousCue {
    max-width: 94%;
    font-size: clamp(1rem, 4.2vw, 1.35rem);
    line-height: 1.4;
    opacity: 0.46;
    -webkit-line-clamp: 2;
  }

  .subtitle-focus-mode .cue-current {
    max-width: min(96%, 980px);
    font-size: clamp(2.35rem, 10vw, 5.2rem);
    line-height: 1.34;
    margin-block: clamp(10px, 1.5vh, 20px);
    opacity: 1;
  }

  .subtitle-focus-mode #nextCue.cue-next-primary {
    display: -webkit-box;
    max-width: min(94%, 920px);
    overflow: hidden;
    font-size: clamp(1.75rem, 7.5vw, 3.9rem);
    font-weight: 680;
    line-height: 1.34;
    opacity: 0.68;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .subtitle-focus-mode #nextCue2.cue-next-secondary {
    display: -webkit-box;
    max-width: 91%;
    overflow: hidden;
    font-size: clamp(1.05rem, 4.1vw, 1.4rem);
    line-height: 1.38;
    opacity: 0.44;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }

  .subtitle-focus-mode #nextCue3,
  .subtitle-focus-mode #nextCue4,
  .subtitle-focus-mode #nextCue5 {
    max-width: 88%;
    font-size: clamp(0.9rem, 3.4vw, 1.12rem);
    line-height: 1.3;
    opacity: 0.25;
    -webkit-line-clamp: 1;
  }
}

@media (orientation: landscape) {
  .subtitle-focus-mode .subtitle-stage {
    grid-template-rows: 0.55fr minmax(130px, auto) 1.05fr 0.55fr;
    align-content: stretch;
    gap: clamp(4px, 1vh, 8px);
  }

  .subtitle-focus-mode #previousCue2,
  .subtitle-focus-mode #nextCue3,
  .subtitle-focus-mode #nextCue4,
  .subtitle-focus-mode #nextCue5 {
    display: none;
  }

  .subtitle-focus-mode #previousCue {
    display: -webkit-box;
    max-width: 88%;
    font-size: clamp(0.98rem, 2.2vw, 1.3rem);
    line-height: 1.3;
    opacity: 0.46;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }

  .subtitle-focus-mode .cue-current {
    max-width: min(92%, 1100px);
    font-size: clamp(2.25rem, 6.2vw, 4.6rem);
    line-height: 1.24;
    margin-block: clamp(6px, 1.2vh, 14px);
  }

  .subtitle-focus-mode #nextCue.cue-next-primary {
    display: -webkit-box;
    max-width: min(90%, 1050px);
    overflow: hidden;
    font-size: clamp(1.7rem, 4.65vw, 3.45rem);
    font-weight: 680;
    line-height: 1.28;
    opacity: 0.66;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .subtitle-focus-mode #nextCue2.cue-next-secondary {
    display: -webkit-box;
    max-width: 86%;
    overflow: hidden;
    font-size: clamp(0.95rem, 2.15vw, 1.3rem);
    line-height: 1.3;
    opacity: 0.4;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .subtitle-focus-mode .subtitle-stage.subtitle-flow-forward .cue {
    animation: none;
  }
}

/* ==========================================================================
   慈聖佛堂｜典雅禪風 visual system
   Logo 方案二：圓相彌勒意象 × 暖棕 × 金色 × 宣紙米白
   ========================================================================== */
:root {
  --paper: #f6efe4;
  --paper-strong: #eadcc7;
  --ink: #2e1b11;
  --muted: #78685b;
  --line: rgba(83, 49, 25, 0.14);
  --accent: #a56d25;
  --accent-strong: #6b3f1d;
  --accent-deep: #351b0d;
  --accent-soft: #f0dfbd;
  --card: rgba(255, 251, 243, 0.93);
  --seal: #9d3026;
  --gold: #c89442;
  --shadow: 0 20px 55px rgba(64, 35, 17, 0.1);
  --display-font:
    "Noto Serif TC",
    "Songti TC",
    "PMingLiU",
    "Times New Roman",
    serif;
}

html {
  background: #f4eadb;
}

body {
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 4%, rgba(205, 164, 96, 0.17), transparent 28rem),
    radial-gradient(circle at 92% 18%, rgba(118, 73, 35, 0.08), transparent 26rem),
    linear-gradient(180deg, #fbf6ed 0%, #f6efe4 48%, #f0e4d3 100%);
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(85, 48, 23, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(85, 48, 23, 0.014) 1px, transparent 1px);
  background-size: 28px 28px;
  content: "";
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent 70%);
}

h1,
h2,
h3,
.brand-name,
.cue-current {
  font-family: var(--display-font);
}

.brand-lockup,
.auth-brand {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 10px;
}

.brand-emblem {
  display: block;
  flex: 0 0 auto;
  width: 68px;
  height: 68px;
  filter: drop-shadow(0 5px 12px rgba(24, 12, 6, 0.16));
}

.compact-brand .brand-emblem {
  width: 46px;
  height: 46px;
}

.brand-name {
  color: currentColor;
  font-size: clamp(1.22rem, 5vw, 1.75rem);
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1.15;
}

.brand-en {
  margin-top: 3px;
  color: currentColor;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.21em;
  opacity: 0.76;
}

.compact-brand .brand-name {
  font-size: 1rem;
}

.compact-brand .brand-en {
  font-size: 0.52rem;
}

.eyebrow {
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.17em;
}

.ghost-button,
.focus-button,
.secondary-action {
  border-color: rgba(119, 74, 31, 0.2);
}

.primary-action {
  background: linear-gradient(145deg, #815020, #573017);
  box-shadow: 0 10px 24px rgba(72, 38, 16, 0.18);
}

.primary-action:hover,
.primary-action:focus-visible {
  filter: brightness(1.06);
}

.secondary-action {
  color: #653918;
  background: linear-gradient(145deg, #f3e5ca, #e9d3aa);
}

.auth-card,
.learning-course-card,
.outline-intro-card,
.outline-core-card,
.outline-section-card,
.subtitle-search-result,
.listening-card {
  border-color: rgba(109, 67, 31, 0.13);
  background:
    linear-gradient(145deg, rgba(255, 253, 248, 0.97), rgba(250, 243, 232, 0.9));
  box-shadow: 0 16px 42px rgba(78, 43, 20, 0.075);
}

/* Login / access */
.auth-shell {
  padding-top: max(12px, env(safe-area-inset-top));
}

.auth-brand {
  position: relative;
  overflow: hidden;
  gap: 18px;
  margin-bottom: 16px;
  padding: 24px 22px 26px;
  border: 1px solid rgba(225, 193, 135, 0.18);
  border-radius: 30px;
  color: #fff7e8;
  background:
    radial-gradient(circle at 88% 22%, rgba(215, 172, 96, 0.22), transparent 34%),
    linear-gradient(135deg, #2b150a 0%, #4d2a13 56%, #6e431f 100%);
  box-shadow: 0 22px 55px rgba(45, 23, 10, 0.18);
}

.auth-brand::after {
  position: absolute;
  right: -34px;
  bottom: -52px;
  width: 180px;
  height: 120px;
  border: 18px solid rgba(230, 198, 139, 0.07);
  border-radius: 50%;
  content: "";
  transform: rotate(-12deg);
}

.auth-brand .brand-emblem {
  width: 82px;
  height: 82px;
  padding: 4px;
  border-radius: 50%;
  background: rgba(255, 249, 235, 0.93);
}

.auth-brand h1 {
  color: #fff9ee;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.auth-brand .course-meta,
.auth-brand .brand-en {
  color: rgba(255, 242, 216, 0.75);
}

.auth-tabs {
  background: #efe2ce;
}

.auth-tab.active {
  color: #5d3519;
  background: #fffaf1;
  box-shadow: 0 5px 14px rgba(80, 44, 20, 0.09);
}

.auth-form input,
.course-admin-form input,
.course-admin-form textarea,
.outline-edit-card input,
.outline-edit-card textarea,
.course-search-field,
.year-filter select {
  border-color: rgba(112, 69, 31, 0.16);
  background: rgba(255, 252, 246, 0.9);
}

/* My learning: one merged photo hero with brand, account actions and CTA. */
.learning-home-header {
  position: relative;
  display: flex;
  height: clamp(320px, 44vw, 420px);
  min-height: 0;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  margin: 0 -2px 18px;
  padding: 22px;
  border: 1px solid rgba(221, 184, 119, 0.15);
  border-radius: 30px;
  color: #fff5e4;
  background: #5a371f;
  box-shadow: 0 20px 50px rgba(52, 28, 14, 0.16);
  isolation: isolate;
}

.learning-home-header::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(38, 18, 7, 0.24) 0%, rgba(38, 18, 7, 0.04) 42%, rgba(38, 18, 7, 0.32) 100%),
    linear-gradient(90deg, rgba(38, 18, 7, 0.18) 0%, transparent 58%);
  content: "";
}

.learning-home-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 52%;
}

.learning-home-header > *:not(.learning-home-bg) {
  position: relative;
  z-index: 2;
}

.learning-home-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
}

.learning-home-cta {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  max-width: 26rem;
}

.learning-home-cta .eyebrow {
  margin: 0;
  color: #fff8e9;
  text-shadow: 0 2px 12px rgba(35, 18, 8, 0.5);
}

.learning-home-header .course-meta {
  color: rgba(255, 241, 214, 0.72);
}

.learning-home-header .brand-emblem {
  padding: 3px;
  border-radius: 50%;
  background: rgba(255, 250, 239, 0.94);
}

.learning-home-header .ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-color: rgba(255, 239, 211, 0.24);
  color: #fff4df;
  background: rgba(54, 27, 11, 0.28);
  backdrop-filter: blur(12px);
  box-shadow: 0 5px 18px rgba(31, 15, 7, 0.08);
}

/* Temple sunrise photo hero. Text and CTA stay as accessible HTML overlays. */
.learning-hero {
  position: relative;
  min-height: 300px;
  overflow: hidden;
  margin-bottom: 18px;
  border: 1px solid rgba(128, 79, 34, 0.13);
  border-radius: 30px;
  background: #5a371f;
  box-shadow: var(--shadow);
  isolation: isolate;
}

.learning-hero-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 52%;
}

.learning-hero::after {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(45, 22, 8, 0.24) 0%, rgba(45, 22, 8, 0.12) 38%, rgba(45, 22, 8, 0.02) 72%),
    linear-gradient(0deg, rgba(36, 17, 7, 0.18) 0%, transparent 52%);
  content: "";
}

.learning-hero-copy {
  position: relative;
  z-index: 2;
  display: flex;
  width: 100%;
  min-height: 300px;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 14px;
  padding: 28px;
}

.learning-hero-copy .eyebrow {
  margin: 0;
  color: #fff8e9;
  text-shadow: 0 2px 12px rgba(35, 18, 8, 0.42);
}

.hero-action {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin-top: 0;
  border: 1px solid rgba(255, 238, 205, 0.18);
  border-radius: 999px;
  padding: 11px 18px;
  color: #fff7e9;
  text-decoration: none;
  background: linear-gradient(135deg, #8c5925, #5c3217);
  box-shadow: 0 10px 24px rgba(83, 46, 21, 0.18);
  font-weight: 800;
}

.hero-action span {
  font-size: 1.45em;
  line-height: 0;
}

/* Search and catalogue */
.learning-toolbar {
  border-radius: 22px;
  background: rgba(255, 251, 243, 0.88);
  backdrop-filter: blur(14px);
}

.course-search-field:focus-within {
  border-color: rgba(165, 109, 37, 0.48);
  box-shadow: 0 0 0 3px rgba(174, 121, 48, 0.1);
}

.section-heading h2 {
  color: #3f2514;
  font-family: var(--display-font);
  font-weight: 750;
  letter-spacing: 0.035em;
}

.course-catalog-heading {
  scroll-margin-top: 16px;
}

.course-list {
  gap: 16px;
}

.learning-course-card {
  position: relative;
  overflow: hidden;
  padding: 21px;
  border-radius: 24px;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease;
}

.learning-course-card::after {
  position: absolute;
  top: -26px;
  right: -24px;
  width: 118px;
  height: 118px;
  background: url("/icons/cisheng-logo-cute.webp") center / contain no-repeat;
  content: "";
  opacity: 0.045;
  pointer-events: none;
}

.learning-course-card > * {
  position: relative;
  z-index: 1;
}

.learning-course-card:hover {
  border-color: rgba(160, 103, 35, 0.23);
  box-shadow: 0 20px 46px rgba(74, 39, 17, 0.11);
  transform: translateY(-1px);
}

.learning-course-card h2 {
  color: #342014;
  font-family: var(--display-font);
  font-weight: 750;
  letter-spacing: 0.025em;
}

.cache-state {
  border: 1px solid rgba(106, 66, 31, 0.08);
}

.cache-hot {
  color: #5c461e;
  background: #efe4c7;
}

.cache-warming {
  color: #774b1c;
  background: #f2dfbd;
}

.course-progress-track {
  background: #eadfce;
}

.course-progress-track span {
  background: linear-gradient(90deg, #8b5722, #c2903d);
}

.course-outline-link {
  color: #72471e;
  background: #fffaf1;
}

.continue-course-card {
  border-color: rgba(165, 109, 37, 0.24);
  background:
    radial-gradient(circle at 100% 0, rgba(205, 159, 82, 0.14), transparent 34%),
    linear-gradient(145deg, #fffaf1, #f5e7cf);
}

/* Course + outline headers */
.course-header,
.outline-header {
  position: relative;
  overflow: hidden;
  padding: 18px 18px 20px;
  border: 1px solid rgba(221, 184, 119, 0.14);
  border-radius: 26px;
  color: #fff5e4;
  background:
    radial-gradient(circle at 92% 4%, rgba(216, 168, 91, 0.18), transparent 33%),
    linear-gradient(140deg, #2b160b, #4b2914 62%, #60391c);
  box-shadow: 0 18px 44px rgba(48, 25, 11, 0.13);
}

.course-header h1,
.outline-header h1 {
  margin-top: 14px;
  color: #fffaf0;
  font-weight: 700;
}

.course-header .course-meta,
.outline-header .course-meta,
.course-header .brand-en,
.outline-header .brand-en {
  color: rgba(255, 240, 212, 0.72);
}

.course-header .brand-emblem,
.outline-header .brand-emblem {
  padding: 2px;
  border-radius: 50%;
  background: rgba(255, 250, 240, 0.94);
}

.course-header .ghost-button,
.outline-header .ghost-button {
  border-color: rgba(255, 240, 214, 0.24);
  color: #fff4df;
  background: rgba(255, 255, 255, 0.08);
}

/* Subtitle player */
.subtitle-stage {
  border-color: rgba(114, 70, 31, 0.15);
  background:
    radial-gradient(circle at 84% 14%, rgba(218, 174, 99, 0.18), transparent 28%),
    linear-gradient(145deg, rgba(255, 252, 245, 0.98), rgba(239, 223, 197, 0.88));
  box-shadow:
    0 24px 58px rgba(65, 35, 17, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.cue-current {
  color: #352014;
  font-weight: 780;
}

.player-card {
  border-color: rgba(111, 68, 31, 0.16);
  background: rgba(255, 250, 241, 0.95);
  box-shadow: 0 18px 46px rgba(61, 33, 15, 0.12);
}

#seekBar {
  accent-color: #986224;
}

.round-button.play,
.focus-play-button {
  color: #fff9ed;
  background: linear-gradient(145deg, #8f5a25, #593018);
  box-shadow: 0 11px 25px rgba(74, 39, 17, 0.24);
}

.round-button.secondary,
.focus-control-button {
  color: #69401e;
  background: #efdfc1;
}

.chapter-list,
.transcript {
  border-color: rgba(111, 67, 29, 0.13);
  background: rgba(255, 251, 244, 0.92);
  box-shadow: 0 13px 34px rgba(71, 39, 18, 0.055);
}

.chapter-row:hover,
.chapter-row:focus-visible,
.transcript-cue.active {
  background: linear-gradient(90deg, #f1dfbc, #f8edda);
}

.transcript-cue.active {
  box-shadow: inset 3px 0 0 #a56d25;
}

/* Fullscreen keeps the approved karaoke layout; only the skin changes. */
.subtitle-focus-mode .subtitle-stage {
  color: #fff7e7;
  background:
    radial-gradient(circle at 82% 12%, rgba(205, 151, 65, 0.2), transparent 34rem),
    radial-gradient(circle at 14% 88%, rgba(114, 67, 28, 0.28), transparent 30rem),
    linear-gradient(165deg, #241208 0%, #3b2010 52%, #26150b 100%);
}

.subtitle-focus-mode .cue-current {
  color: #fff9ed;
  text-shadow: 0 3px 18px rgba(0, 0, 0, 0.16);
}

.subtitle-focus-mode .cue-context {
  color: #ead9bc;
}

.subtitle-focus-mode .fullscreen-control-bar {
  border-color: rgba(119, 75, 34, 0.2);
  background: rgba(255, 249, 237, 0.93);
  box-shadow: 0 18px 44px rgba(22, 11, 5, 0.24);
}

.subtitle-focus-mode #fullscreenSpeedSelect,
.subtitle-focus-mode .focus-exit-button {
  color: #5f3819;
  border-color: rgba(116, 71, 30, 0.18);
  background: rgba(255, 252, 245, 0.94);
}

/* Outline / study map */
.outline-intro-card {
  background:
    radial-gradient(circle at 86% 10%, rgba(204, 155, 77, 0.18), transparent 31%),
    linear-gradient(145deg, #fffaf1, #f3e2c8);
}

.outline-intro-card::before {
  background: linear-gradient(#7a491f, #c18a36);
  opacity: 0.9;
}

.outline-core-number,
.outline-section-marker {
  color: #fff8e9;
  background: linear-gradient(145deg, #9a6427, #623819);
}

.outline-quote {
  border-left-color: #b27d31;
  color: #68401f;
  background: rgba(235, 213, 177, 0.46);
}

/* Admin surfaces inherit the same visual language without changing workflow. */
.admin-header:not(.learning-home-header) h1 {
  color: #3b2415;
  font-family: var(--display-font);
}

.summary-card,
.storage-card,
.outline-edit-card {
  border-color: rgba(109, 67, 31, 0.13);
  background: rgba(255, 251, 243, 0.94);
  box-shadow: 0 12px 30px rgba(73, 40, 18, 0.06);
}

.storage-meter {
  background: #eadfcd;
}

.storage-meter span {
  background: linear-gradient(90deg, #74451f, #bc8735);
}

@media (max-width: 620px) {
  .app-shell {
    padding-right: 10px;
    padding-left: 10px;
  }

  .learning-home-header {
    min-height: 285px;
    padding: 16px;
  }

  .learning-home-header .brand-emblem {
    width: 58px;
    height: 58px;
  }

  .learning-home-header .admin-header-actions {
    margin-top: 0;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 7px;
  }

  .learning-home-header .admin-header-actions .ghost-button {
    padding: 8px 10px;
    font-size: 0.82rem;
    white-space: nowrap;
  }

  .learning-home-bg {
    object-position: 58% center;
  }

  .learning-home-cta {
    gap: 10px;
  }

  .learning-hero {
    min-height: 230px;
    border-radius: 26px;
  }

  .learning-hero-copy {
    width: 100%;
    min-height: 230px;
    padding: 18px 16px;
  }

  .learning-hero-bg {
    object-position: 58% center;
  }

  .learning-course-card {
    padding: 18px;
  }

  .course-header,
  .outline-header {
    padding: 16px;
  }
}

@media (max-width: 440px) {
  .auth-brand {
    gap: 13px;
    padding: 20px 17px 22px;
  }

  .auth-brand .brand-emblem {
    width: 72px;
    height: 72px;
  }

  .auth-brand .brand-name {
    font-size: 1.28rem;
  }

  .brand-lockup .brand-emblem {
    width: 54px;
    height: 54px;
  }

  .compact-brand .brand-emblem {
    width: 42px;
    height: 42px;
  }

  .learning-home-header {
    min-height: 270px;
  }

  .learning-home-topbar {
    gap: 8px;
  }

  .learning-home-header .admin-header-actions {
    gap: 5px;
  }

  .learning-home-header .admin-header-actions .ghost-button {
    padding: 7px 9px;
    font-size: 0.78rem;
  }

  .learning-course-top {
    gap: 10px;
  }

  .cache-state {
    padding: 6px 8px;
    font-size: 0.72rem;
  }
}


/* Selected cute Maitreya logo: Chinese-only lockup. */
.brand-logo-image {
  display: block;
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  object-fit: contain;
  filter: drop-shadow(0 7px 16px rgba(28, 13, 5, 0.2));
}

.compact-brand .brand-logo-image {
  width: 64px;
  height: 64px;
}

.auth-brand .brand-logo-image {
  width: 104px;
  height: 104px;
}

.learning-home-header .brand-logo-image {
  width: 92px;
  height: 92px;
}

.course-header .brand-logo-image,
.outline-header .brand-logo-image {
  width: 68px;
  height: 68px;
}

@media (max-width: 620px) {
  .auth-brand .brand-logo-image {
    width: 88px;
    height: 88px;
  }

  .learning-home-header .brand-logo-image {
    width: 78px;
    height: 78px;
  }

  .compact-brand .brand-logo-image,
  .course-header .brand-logo-image,
  .outline-header .brand-logo-image {
    width: 58px;
    height: 58px;
  }
}

/* Responsive learning home: phone, tablet and desktop get distinct compositions. */
@media (min-width: 1024px) {
  .course-list-shell {
    padding-right: 32px;
    padding-left: 32px;
  }

  .learning-home-header {
    height: clamp(390px, 34vw, 460px);
    padding: 30px 32px;
    border-radius: 34px;
  }

  .learning-home-bg {
    object-position: center 54%;
  }

  .learning-home-header .brand-logo-image {
    width: 108px;
    height: 108px;
  }

  .learning-home-header .admin-header-actions {
    gap: 10px;
  }

  .learning-home-header .admin-header-actions .ghost-button {
    min-height: 44px;
    padding: 10px 16px;
  }

  .learning-home-cta {
    gap: 14px;
    max-width: 30rem;
  }

  .learning-home-cta .eyebrow {
    font-size: 0.84rem;
  }

  .hero-action {
    padding: 12px 20px;
    font-size: 1rem;
  }

  .learning-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(190px, 240px);
    gap: 14px 18px;
    padding: 18px;
  }

  .course-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 18px;
  }

  .search-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .learning-course-card {
    height: 100%;
    padding: 22px;
  }
}

@media (min-width: 621px) and (max-width: 1023px) {
  .course-list-shell {
    width: min(100%, 960px);
    padding-right: 24px;
    padding-left: 24px;
  }

  .learning-home-header {
    height: clamp(350px, 48vw, 420px);
    padding: 24px;
    border-radius: 30px;
  }

  .learning-home-bg {
    object-position: 57% 52%;
  }

  .learning-home-header .brand-logo-image {
    width: 92px;
    height: 92px;
  }

  .learning-home-header .admin-header-actions .ghost-button {
    min-height: 44px;
    padding: 9px 13px;
  }

  .learning-home-cta {
    max-width: 24rem;
  }

  .learning-toolbar {
    grid-template-columns: minmax(0, 1fr) minmax(170px, 220px);
    gap: 12px 16px;
    padding: 17px;
  }

  .course-list {
    grid-template-columns: 1fr;
    gap: 16px;
  }
}

@media (min-width: 820px) and (max-width: 1023px) {
  .course-list,
  .search-results {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .course-list-shell {
    width: 100%;
    padding-right: 10px;
    padding-left: 10px;
  }

  .learning-home-header {
    display: flex;
    width: 100%;
    height: clamp(300px, 88vw, 350px);
    min-height: 0;
    align-items: stretch;
    margin-bottom: 14px;
    padding: 14px;
    border-radius: 24px;
  }

  .learning-home-bg {
    object-position: 62% 50%;
  }

  .learning-home-header::after {
    background:
      linear-gradient(180deg, rgba(38, 18, 7, 0.2) 0%, rgba(38, 18, 7, 0.02) 40%, rgba(38, 18, 7, 0.38) 100%),
      linear-gradient(90deg, rgba(38, 18, 7, 0.12) 0%, transparent 62%);
  }

  .learning-home-topbar {
    align-items: flex-start;
    gap: 8px;
  }

  .learning-home-header .brand-logo-image {
    width: 68px;
    height: 68px;
  }

  .learning-home-header .admin-header-actions {
    flex: 1 1 auto;
    flex-wrap: nowrap;
    justify-content: flex-end;
    gap: 5px;
    min-width: 0;
  }

  .learning-home-header .admin-header-actions .ghost-button {
    min-height: 44px;
    padding: 7px 9px;
    font-size: 0.78rem;
    white-space: nowrap;
  }

  .learning-home-cta {
    gap: 9px;
    max-width: 19rem;
  }

  .learning-home-cta .eyebrow {
    font-size: 0.72rem;
    letter-spacing: 0.11em;
  }

  .hero-action {
    min-height: 46px;
    padding: 10px 16px;
    font-size: 0.94rem;
  }

  .learning-toolbar {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 18px;
    padding: 14px;
    border-radius: 20px;
  }

  .course-search-field {
    min-height: 48px;
  }

  .course-search-field input {
    min-height: 46px;
    padding: 10px 0;
    font-size: 1rem;
  }

  .year-filter {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
  }

  .year-filter select {
    width: 100%;
    min-height: 48px;
    font-size: 1rem;
  }

  .toolbar-hint {
    margin-top: 0;
    font-size: 0.78rem;
    line-height: 1.55;
  }

  .continue-section,
  .search-results-section {
    margin-bottom: 20px;
  }

  .course-catalog-heading {
    margin-top: 6px;
  }

  .course-list {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .learning-course-card {
    padding: 17px;
    border-radius: 22px;
  }

  .learning-course-card h2 {
    font-size: clamp(1.18rem, 5.5vw, 1.35rem);
  }
}

@media (max-width: 360px) {
  .learning-home-header {
    height: 292px;
    padding: 12px;
  }

  .learning-home-header .brand-logo-image {
    width: 62px;
    height: 62px;
  }

  .learning-home-topbar {
    gap: 6px;
  }

  .learning-home-header .admin-header-actions {
    gap: 4px;
  }

  .learning-home-header .admin-header-actions .ghost-button {
    padding: 6px 7px;
    font-size: 0.74rem;
  }

  .learning-toolbar {
    padding: 12px;
  }
}

/* Subtitle correction + reading-mode mini player */
.subtitle-stage {
  position: relative;
}

.subtitle-correction-trigger {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 6;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  border: 1px solid rgba(107, 63, 29, 0.16);
  border-radius: 999px;
  padding: 7px 11px;
  color: var(--accent-strong);
  background: rgba(255, 253, 248, 0.78);
  box-shadow: 0 6px 20px rgba(64, 35, 17, 0.07);
  backdrop-filter: blur(12px);
  font-size: 0.8rem;
  font-weight: 800;
  opacity: 0.72;
  transition: opacity 160ms ease, background 160ms ease;
}

.subtitle-correction-trigger:hover,
.subtitle-correction-trigger:focus-visible {
  background: rgba(255, 253, 248, 0.96);
  opacity: 1;
}

.subtitle-correction-hint {
  position: absolute;
  right: 50%;
  bottom: 12px;
  z-index: 7;
  max-width: calc(100% - 32px);
  border-radius: 999px;
  padding: 7px 11px;
  color: #fff8e9;
  background: rgba(53, 27, 13, 0.78);
  box-shadow: 0 8px 26px rgba(35, 18, 8, 0.16);
  font-size: 0.76rem;
  font-weight: 700;
  white-space: nowrap;
  transform: translateX(50%);
}

.transcript-cue {
  touch-action: pan-y;
}

.transcript-cue.corrected .transcript-text::after {
  margin-left: 0.45em;
  color: var(--accent);
  content: "✓";
  font-size: 0.72em;
  font-weight: 800;
  vertical-align: 0.08em;
}

.sticky-mini-player {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  left: max(8px, env(safe-area-inset-left));
  z-index: 55;
  width: min(calc(100% - 16px), 760px);
  margin: 0 auto;
  padding: 8px 10px 7px;
  border: 1px solid rgba(107, 63, 29, 0.16);
  border-radius: 18px;
  background: rgba(255, 251, 243, 0.94);
  box-shadow: 0 14px 38px rgba(48, 25, 11, 0.16);
  backdrop-filter: blur(18px);
}

.mini-player-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 0;
}

.mini-player-button {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  min-width: 42px;
  min-height: 42px;
  border: 0;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 0.78rem;
  font-weight: 850;
}

.mini-player-play {
  min-width: 46px;
  min-height: 46px;
  color: white;
  background: var(--accent-strong);
  font-size: 1rem;
}

.mini-speed-control {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
}

.mini-speed-control select {
  min-height: 38px;
  max-width: 80px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 22px 6px 8px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.88);
  font-weight: 750;
}

.return-current-cue {
  flex: 0 1 auto;
  min-height: 38px;
  overflow: hidden;
  border: 1px solid rgba(165, 109, 37, 0.25);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--accent-strong);
  background: #f4e5c9;
  font-size: 0.76rem;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mini-player-progress {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.68rem;
  font-variant-numeric: tabular-nums;
}

.mini-player-progress span:last-child {
  text-align: right;
}

.mini-player-progress input {
  width: 100%;
  height: 18px;
  margin: 0;
  accent-color: var(--accent-strong);
}

.subtitle-focus-mode .sticky-mini-player {
  display: none !important;
}

.subtitle-focus-mode .subtitle-correction-trigger {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  right: max(12px, env(safe-area-inset-right));
  z-index: 48;
  background: rgba(255, 253, 248, 0.72);
  opacity: 0.48;
}

.subtitle-focus-mode .subtitle-correction-trigger:hover,
.subtitle-focus-mode .subtitle-correction-trigger:focus-visible {
  opacity: 1;
}

.subtitle-focus-mode .subtitle-correction-hint {
  position: fixed;
  bottom: max(108px, calc(env(safe-area-inset-bottom) + 90px));
  z-index: 49;
}

.subtitle-correction-open {
  overflow: hidden;
}

.subtitle-correction-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: max(14px, env(safe-area-inset-top)) 12px max(12px, env(safe-area-inset-bottom));
  background: rgba(35, 20, 11, 0.42);
  backdrop-filter: blur(5px);
}

.subtitle-correction-sheet {
  width: min(100%, 680px);
  max-height: min(88dvh, 760px);
  overflow: auto;
  border: 1px solid rgba(107, 63, 29, 0.14);
  border-radius: 26px;
  padding: 20px;
  color: var(--ink);
  background: #fffaf1;
  box-shadow: 0 28px 75px rgba(39, 20, 9, 0.24);
}

.subtitle-correction-sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.subtitle-correction-sheet-header h2,
.subtitle-correction-sheet-header p,
.correction-original-card p,
.correction-course-meta {
  margin: 0;
}

.subtitle-correction-sheet-header h2 {
  margin-top: 3px;
  font-size: 1.5rem;
}

.correction-close-button {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.76);
  font-size: 1.4rem;
}

.correction-course-meta {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.86rem;
}

.correction-original-card {
  margin-top: 14px;
  border-left: 3px solid rgba(165, 109, 37, 0.5);
  border-radius: 14px;
  padding: 13px 14px;
  background: #f4ead9;
}

.correction-time {
  display: block;
  margin-bottom: 7px;
  color: var(--accent);
  font-size: 0.76rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.correction-original-card p {
  font-size: 1rem;
  line-height: 1.7;
}

.correction-field {
  display: grid;
  gap: 7px;
  margin-top: 15px;
  color: var(--accent-strong);
  font-size: 0.86rem;
  font-weight: 800;
}

.correction-field textarea,
.correction-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 13px;
  color: var(--ink);
  background: white;
  font: inherit;
  font-weight: 500;
}

.correction-field textarea {
  min-height: 112px;
  resize: vertical;
  line-height: 1.65;
}

.correction-auto-apply-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.55;
}

.correction-sheet-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 17px;
}

.correction-sheet-actions button {
  min-height: 44px;
}

.correction-sheet-actions .primary-action {
  min-width: 128px;
}

.correction-toast {
  position: fixed;
  right: 50%;
  bottom: max(22px, env(safe-area-inset-bottom));
  z-index: 110;
  max-width: min(calc(100% - 32px), 480px);
  border-radius: 999px;
  padding: 11px 16px;
  color: white;
  background: rgba(54, 31, 17, 0.92);
  box-shadow: 0 10px 30px rgba(35, 18, 8, 0.22);
  font-size: 0.84rem;
  font-weight: 750;
  text-align: center;
  transform: translateX(50%);
}

.subtitle-review-section {
  margin: 20px 0 26px;
}

.subtitle-review-list {
  display: grid;
  gap: 12px;
}

.subtitle-review-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 10px 30px rgba(74, 61, 43, 0.06);
}

.subtitle-review-card h3,
.subtitle-review-card p {
  margin: 0;
}

.subtitle-review-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin: 6px 0 14px;
  color: var(--muted);
  font-size: 0.8rem;
}

.subtitle-review-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.subtitle-review-text {
  padding: 12px;
  border-radius: 14px;
  background: #f4ead9;
}

.subtitle-review-text span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 750;
}

.subtitle-review-text textarea {
  width: 100%;
  min-height: 88px;
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 9px 10px;
  color: var(--ink);
  background: white;
  line-height: 1.55;
  resize: vertical;
}

.subtitle-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.subtitle-review-count {
  display: inline-grid;
  place-items: center;
  min-width: 34px;
  min-height: 34px;
  border-radius: 999px;
  color: white;
  background: var(--accent-strong);
  font-weight: 850;
}

.subtitle-contribution-report {
  margin: 14px 0 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255, 251, 243, 0.72);
}

.compact-heading {
  margin-bottom: 10px;
}

.compact-heading h3 {
  margin: 2px 0 0;
}

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

.subtitle-contribution-card {
  display: grid;
  grid-template-columns: auto minmax(130px, 0.8fr) minmax(0, 2fr);
  align-items: center;
  gap: 12px;
  padding: 11px 13px;
  border: 1px solid rgba(109, 67, 31, 0.12);
  border-radius: 16px;
  background: rgba(255, 253, 248, 0.9);
}

.subtitle-contribution-rank {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  min-height: 36px;
  border-radius: 999px;
  color: var(--accent-strong);
  background: var(--accent-soft);
  font-size: 0.78rem;
}

.subtitle-contribution-identity {
  display: grid;
  min-width: 0;
}

.subtitle-contribution-identity strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subtitle-contribution-identity span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subtitle-contribution-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(62px, 1fr));
  gap: 7px;
}

.subtitle-contribution-metrics span {
  display: grid;
  gap: 2px;
  padding: 7px 8px;
  border-radius: 12px;
  color: var(--muted);
  background: #f4ead9;
  font-size: 0.68rem;
  text-align: center;
}

.subtitle-contribution-metrics strong {
  color: var(--accent-strong);
  font-size: 0.9rem;
}

@media (max-width: 620px) {
  .subtitle-correction-trigger {
    top: 9px;
    right: 9px;
    min-width: 38px;
    padding: 7px 9px;
  }

  .subtitle-correction-trigger-label {
    display: none;
  }

  .sticky-mini-player {
    padding: 7px 8px 6px;
    border-radius: 16px;
  }

  .mini-player-controls {
    gap: 5px;
  }

  .mini-player-button {
    min-width: 40px;
    min-height: 40px;
  }

  .mini-player-play {
    min-width: 44px;
    min-height: 44px;
  }

  .mini-speed-control > span {
    display: none;
  }

  .mini-speed-control select {
    max-width: 66px;
    min-height: 38px;
    padding-right: 19px;
    padding-left: 6px;
    font-size: 0.75rem;
  }

  .return-current-cue {
    min-width: 0;
    padding-right: 8px;
    padding-left: 8px;
    font-size: 0.72rem;
  }

  .subtitle-correction-overlay {
    padding-right: 0;
    padding-bottom: 0;
    padding-left: 0;
  }

  .subtitle-correction-sheet {
    max-height: 90dvh;
    border-radius: 24px 24px 0 0;
    padding: 18px 16px max(18px, env(safe-area-inset-bottom));
  }

  .correction-sheet-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .correction-sheet-actions .primary-action {
    grid-column: 1 / -1;
    width: 100%;
  }

  .subtitle-review-compare {
    grid-template-columns: 1fr;
  }

  .subtitle-contribution-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .subtitle-contribution-metrics {
    grid-column: 1 / -1;
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .subtitle-contribution-metrics span {
    padding: 6px 4px;
    font-size: 0.62rem;
  }
}

@media (max-width: 360px) {
  .mini-player-controls {
    gap: 4px;
  }

  .mini-player-button {
    min-width: 38px;
    min-height: 38px;
  }

  .mini-player-play {
    min-width: 42px;
    min-height: 42px;
  }

  .mini-speed-control select {
    max-width: 62px;
    font-size: 0.7rem;
  }

  .return-current-cue {
    max-width: 82px;
    font-size: 0.68rem;
  }
}
