:root {
  --bg: #f5f6f3;
  --paper: #ffffff;
  --paper-soft: #fbfbf8;
  --line: #dedfd8;
  --line-strong: #c4c9bd;
  --text: #20231f;
  --muted: #687064;
  --soft: #edf2ea;
  --accent: #2f6f5e;
  --accent-soft: #e2eee8;
  --accent-strong: #235849;
  --mark: #f7e9a1;
  --shadow: 0 12px 36px rgba(32, 35, 31, 0.08);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

@media (max-width: 859px) {
  .marketing-page {
    min-height: 100dvh;
    padding-bottom: 82px;
    background:
      radial-gradient(circle at 20% 0%, rgba(224, 230, 202, 0.72), transparent 36%),
      linear-gradient(180deg, #fffdf5 0%, #f4f5ef 100%);
  }

  .marketing-page .site-nav {
    display: none;
  }

  .landing-shell,
  .profile-shell,
  .library-shell {
    width: min(100% - 24px, 520px);
  }

  .landing-shell {
    padding: 12px 0 16px;
  }

  .mobile-home-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 52px;
    padding: 2px 4px 10px;
  }

  .mobile-home-topbar strong {
    font-size: 17px;
  }

  .mobile-profile-shortcut {
    display: inline-grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 999px;
    color: var(--accent);
  }

  .mobile-profile-shortcut svg {
    width: 19px;
    height: 19px;
  }

  .landing-hero {
    display: block;
    min-height: 0;
    border-radius: 22px;
    padding: 20px 18px 14px;
  }

  .landing-hero-copy {
    max-width: none;
    padding: 0;
  }

  .landing-eyebrow {
    margin-bottom: 6px;
    font-size: 12px;
  }

  .landing-hero h1 {
    margin-bottom: 8px;
    font-size: clamp(29px, 8vw, 38px);
  }

  .landing-hero p {
    max-width: 25em;
    margin-bottom: 12px;
    font-size: 14px;
    line-height: 1.75;
  }

  .landing-cta {
    min-height: 42px;
    padding: 0 18px;
    font-size: 14px;
  }

  .landing-hero-art {
    display: block;
    min-height: 0;
    margin-top: -8px;
  }

  .landing-hero-art img {
    width: 100%;
    max-height: 145px;
    object-fit: contain;
    object-position: center;
  }

  .landing-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 12px;
  }

  .landing-feature-card {
    grid-template-columns: 40px minmax(0, 1fr);
    gap: 9px;
    min-height: 74px;
    border-radius: 16px;
    padding: 10px;
  }

  .landing-feature-card img {
    width: 40px;
    height: 40px;
  }

  .landing-feature-card h2 {
    margin-bottom: 2px;
    font-size: 14px;
  }

  .landing-feature-card p {
    font-size: 11px;
    line-height: 1.35;
  }

  .app-mobile-tabbar {
    position: fixed;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 12px;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
    width: min(420px, calc(100vw - 24px));
    margin: 0 auto;
    border: 1px solid rgba(47, 111, 94, 0.11);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.96);
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 16px 36px rgba(32, 35, 31, 0.13);
    backdrop-filter: blur(14px);
  }

  .app-mobile-tabbar a {
    display: grid;
    justify-items: center;
    gap: 3px;
    min-width: 0;
    border-radius: 14px;
    padding: 5px 4px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.15;
  }

  .app-mobile-tabbar a.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 800;
  }

  .app-mobile-tabbar svg {
    width: 19px;
    height: 19px;
  }

  .library-page .home-shell {
    padding-bottom: 18px;
  }

  .library-masthead {
    padding-top: 10px;
  }

  .library-masthead h1 {
    font-size: 27px;
  }

  .library-masthead .tagline {
    font-size: 13px;
  }

  .profile-shell {
    padding: 14px 0 18px;
  }

  .profile-topbar {
    min-height: 48px;
    margin-bottom: 10px;
  }

  .profile-topbar h1 {
    font-size: 22px;
  }

  .profile-user-card,
  .profile-membership-card {
    padding: 14px;
  }

  .profile-avatar {
    width: 50px;
    height: 50px;
    font-size: 19px;
  }

  .profile-menu-item {
    min-height: 52px;
    padding: 10px 14px;
  }
}

@media (max-width: 390px) {
  .landing-hero {
    padding: 17px 15px 12px;
  }

  .landing-hero p {
    font-size: 13px;
  }

  .landing-hero-art img {
    max-height: 125px;
  }

  .landing-feature-card {
    min-height: 68px;
  }
}

body[data-theme="comfort"] {
  --bg: #f3f4df;
  --paper: #fffdf2;
  --paper-soft: #faf7e8;
  --soft: #e8efd9;
  --line: #d8d7bd;
}

body[data-theme="warm"] {
  --bg: #f8f1df;
  --paper: #fffaf0;
  --paper-soft: #fff4dd;
  --soft: #f2e5c8;
  --line: #dfcfb1;
  --mark: #ead088;
}

body[data-theme="dark"] {
  --bg: #171b19;
  --paper: #202622;
  --paper-soft: #252d28;
  --line: #3a443e;
  --line-strong: #59645e;
  --text: #edf1ec;
  --muted: #a7b0a9;
  --soft: #2d3832;
  --accent-soft: #244237;
  --mark: #5f5224;
  --shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
}

body[data-highlight="yellow"] {
  --word-highlight: rgba(247, 233, 161, 0.7);
}

body[data-highlight="green"] {
  --word-highlight: rgba(194, 230, 203, 0.72);
}

body[data-highlight="pink"] {
  --word-highlight: rgba(247, 207, 222, 0.72);
}

body[data-highlight="orange"] {
  --word-highlight: rgba(250, 211, 166, 0.74);
}

body[data-highlight="purple"] {
  --word-highlight: rgba(220, 210, 246, 0.72);
}

body[data-highlight="red"] {
  --word-highlight: rgba(246, 194, 190, 0.68);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

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

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

h1,
h2,
p {
  margin-top: 0;
}

.shell {
  width: min(1440px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.home-shell {
  width: min(92vw, 1720px);
}

.lesson-shell {
  width: min(1440px, calc(100% - 28px));
}

.app-shell-wide {
  width: min(1680px, calc(100vw - 56px));
  margin-right: auto;
  margin-left: auto;
}

.marketing-page {
  min-height: 100dvh;
  background:
    radial-gradient(circle at 16% 10%, rgba(225, 232, 204, 0.62), transparent 30%),
    linear-gradient(180deg, #fbfaf2 0%, var(--bg) 100%);
  color: var(--text);
}

.site-nav {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(360px, auto) minmax(240px, 0.9fr);
  gap: 14px 24px;
  align-items: center;
  width: min(1680px, calc(100vw - 56px));
  min-height: 64px;
  margin: 0 auto;
  padding: 10px 0;
}

.site-brand,
.site-user-profile,
.site-user,
.site-user button,
.site-nav-links {
  display: inline-flex;
  align-items: center;
}

.site-brand {
  gap: 10px;
  font-size: 18px;
  font-weight: 800;
}

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

.site-nav-links {
  justify-content: center;
  gap: 28px;
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.site-nav-links a {
  position: relative;
  padding: 6px 0;
}

.site-nav-links a.active {
  color: var(--accent);
  font-weight: 700;
}

.site-nav-links a.active::after {
  position: absolute;
  right: 18%;
  bottom: -2px;
  left: 18%;
  height: 2px;
  border-radius: 999px;
  background: var(--accent);
  content: "";
}

.site-user {
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.site-user-profile {
  gap: 8px;
  min-width: 0;
}

.site-avatar,
.profile-avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, #315f4d, #e7d7a5);
  color: #fff;
  font-weight: 800;
  overflow: hidden;
}

.site-avatar img,
.profile-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.site-avatar {
  width: 30px;
  height: 30px;
  font-size: 13px;
}

.site-user button {
  gap: 5px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 6px 0;
  font-size: 13px;
}

.site-user button svg {
  width: 15px;
  height: 15px;
}

.landing-shell,
.profile-shell {
  width: min(1680px, calc(100vw - 56px));
  margin: 0 auto;
}

.landing-shell {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: clamp(18px, 2.2vh, 28px);
  min-height: calc(100svh - 72px);
  padding: 18px 0 32px;
}

.mobile-home-topbar {
  display: none;
}

.landing-hero {
  position: relative;
  display: block;
  align-self: stretch;
  min-height: clamp(460px, 58vh, 680px);
  overflow: hidden;
  border: 1px solid rgba(47, 111, 94, 0.12);
  border-radius: 26px;
  background: #f4efd9;
  box-shadow: 0 16px 45px rgba(49, 79, 57, 0.11);
}

.landing-hero-art {
  display: block;
  width: 100%;
  height: 100%;
}

.landing-hero-art img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.landing-feature-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.landing-feature-card {
  display: grid;
  place-items: center;
  min-height: clamp(112px, 16vh, 178px);
  overflow: hidden;
  border: 1px solid rgba(47, 111, 94, 0.11);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.76);
  padding: 10px;
  box-shadow: 0 8px 24px rgba(32, 35, 31, 0.06);
}

.landing-feature-card img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.library-page .home-shell {
  padding-bottom: 84px;
}

.library-shell {
  width: min(1680px, calc(100vw - 56px));
}

.library-masthead {
  padding-top: 24px;
}

.profile-shell {
  max-width: 520px;
  padding: 22px 0 96px;
}

.profile-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.profile-topbar h1 {
  margin: 0;
  font-size: 28px;
}

.profile-settings-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  color: var(--accent);
}

.profile-settings-icon svg {
  width: 18px;
  height: 18px;
}

.profile-user-card,
.profile-membership-card,
.profile-menu {
  border: 1px solid rgba(47, 111, 94, 0.12);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 10px 28px rgba(32, 35, 31, 0.06);
}

.profile-user-card {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 18px;
}

.profile-avatar {
  width: 58px;
  height: 58px;
  font-size: 22px;
}

.profile-user-card h2,
.profile-membership-card h2 {
  margin-bottom: 4px;
}

.profile-user-card p,
.profile-membership-card p,
.profile-membership-card span,
.profile-menu-item small {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.profile-membership-card {
  display: block;
  overflow: hidden;
  margin-top: 12px;
  padding: 0;
  background: transparent;
}

.profile-membership-card img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
}

.membership-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 54px;
  height: 28px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent) !important;
  font-weight: 800;
}

.profile-menu {
  display: grid;
  gap: 0;
  margin-top: 14px;
  overflow: hidden;
}

.profile-menu-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) 20px;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 12px 16px;
  color: var(--text);
  text-align: left;
}

.profile-menu-item:last-child {
  border-bottom: 0;
}

.profile-menu-icon {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
}

.profile-menu-icon svg,
.profile-menu-arrow svg {
  width: 17px;
  height: 17px;
}

.profile-menu-item strong {
  display: block;
  margin-bottom: 2px;
  font-size: 14px;
}

.profile-menu-arrow {
  color: var(--muted);
}

.profile-logout-button {
  width: 100%;
  min-height: 48px;
  margin-top: 14px;
  border: 1px solid rgba(191, 70, 58, 0.32);
  border-radius: 14px;
  background: rgba(255, 250, 247, 0.86);
  color: #bd4a3d;
  font-weight: 800;
}

.profile-settings-backdrop,
.profile-support-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(19, 26, 21, 0.26);
}

.profile-settings-modal,
.profile-support-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 81;
  width: min(320px, calc(100vw - 36px));
  transform: translate(-50%, -46%) scale(0.98);
  opacity: 0;
  pointer-events: none;
  border: 1px solid rgba(47, 111, 94, 0.14);
  border-radius: 20px;
  background: var(--paper);
  max-height: min(70dvh, 520px);
  overflow-y: auto;
  padding: 10px;
  box-shadow: 0 24px 70px rgba(20, 30, 24, 0.22);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.profile-support-modal {
  width: min(280px, calc(100vw - 40px));
  padding: 10px;
}

.profile-settings-modal.open,
.profile-support-modal.open {
  transform: translate(-50%, -50%) scale(1);
  opacity: 1;
  pointer-events: auto;
}

.profile-support-card {
  display: grid;
  justify-items: center;
  gap: 5px;
  border: 1px solid rgba(47, 111, 94, 0.12);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(244, 250, 246, 0.92), rgba(255, 255, 252, 0.98));
  padding: 10px;
  text-align: center;
}

.profile-support-card img {
  width: clamp(120px, 42vw, 140px);
  height: clamp(120px, 42vw, 140px);
  border-radius: 11px;
  background: #fff;
  object-fit: contain;
  padding: 5px;
  box-shadow: 0 12px 30px rgba(26, 64, 51, 0.12);
}

.profile-support-card strong {
  color: var(--accent);
  font-size: 14px;
}

.profile-support-card span,
.profile-support-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.profile-settings-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.profile-settings-head h2 {
  margin: 0;
  font-size: 16px;
}

.profile-settings-head button {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--muted);
  transform: rotate(180deg);
}

.profile-settings-head svg {
  width: 15px;
  height: 15px;
}

.settings-placeholder {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper-soft);
  padding: 0 14px;
  margin-top: 8px;
  color: var(--text);
  text-align: left;
}

.settings-placeholder span {
  color: var(--muted);
  font-size: 12px;
}

.profile-settings-form + .profile-settings-form {
  margin-top: 7px;
}

.profile-settings-section {
  display: grid;
  gap: 7px;
  border: 1px solid rgba(47, 111, 94, 0.1);
  border-radius: 13px;
  background: rgba(251, 251, 248, 0.82);
  padding: 8px;
}

.profile-settings-section h3 {
  margin: 0;
  color: var(--accent-strong);
  font-size: 13px;
}

.profile-avatar-editor {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-avatar-preview {
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  font-size: 22px;
}

.profile-avatar-editor p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.settings-secondary-button,
.settings-save-button {
  border: 0;
  border-radius: 999px;
  font-weight: 800;
}

.settings-secondary-button {
  min-height: 29px;
  background: var(--accent-soft);
  color: var(--accent);
  padding: 0 14px;
}

.settings-save-button {
  min-height: 34px;
  background: var(--accent);
  color: #fff;
  padding: 0 18px;
  box-shadow: 0 10px 22px rgba(47, 111, 94, 0.16);
}

.settings-field {
  display: grid;
  gap: 4px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.settings-field input,
.profile-settings-form .auth-password-control input {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 0 9px;
  font: inherit;
}

.settings-field input[readonly] {
  background: rgba(237, 242, 234, 0.72);
  color: var(--muted);
}

.settings-field small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.profile-settings-form .auth-field {
  display: grid;
  gap: 5px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.profile-settings-form .auth-password-control {
  width: 100%;
}

.profile-settings-form .auth-password-toggle {
  right: 6px;
}

.app-mobile-tabbar {
  display: none;
}

.masthead {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 560px);
  gap: 28px;
  align-items: center;
  padding: 8px 0 20px;
}

.eyebrow,
.time {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
}

.masthead h1 {
  margin-bottom: 10px;
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.05;
  letter-spacing: 0;
}

.tagline {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  white-space: nowrap;
}

.home-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}

.library-theme-toggle {
  display: none;
}

.search {
  display: flex;
  flex: 0 0 300px;
  gap: 8px;
  align-items: center;
}

.search input,
.practice-card input,
.drawer-field input,
.drawer-field select {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  background: var(--paper);
  min-height: 40px;
}

.search input {
  height: 36px;
  min-height: 36px;
  padding: 6px 10px;
}

.my-learning-link,
.filter-toggle,
.more-filter-button {
  min-height: 36px;
  height: 36px;
  padding-top: 6px;
  padding-bottom: 6px;
  white-space: nowrap;
}

.toolbar button,
.study-card button,
.plain-action,
.filter-toggle,
.drawer-actions button,
.desktop-tool-strip button,
.desktop-tool-strip label,
.segment-actions button,
.modal-primary {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 8px 11px;
  color: var(--text);
}

.icon-btn {
  --btn-size: clamp(24px, 2vw, 32px);
  --icon-size: clamp(13px, 1.15vw, 17px);
  width: var(--btn-size);
  height: var(--btn-size);
  min-width: var(--btn-size);
  min-height: var(--btn-size);
  border-radius: clamp(7px, 0.8vw, 10px);
  border: 1px solid rgba(33, 94, 75, 0.18);
  background: rgba(255, 255, 255, 0.95);
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  position: relative;
  flex: 0 0 auto;
}

.icon-btn svg,
.feature-icon svg,
.desktop-tool-strip button svg {
  width: var(--icon-size, 16px);
  height: var(--icon-size, 16px);
  display: block;
}

.icon-btn.is-active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

.icon-badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: clamp(12px, 1vw, 15px);
  height: clamp(12px, 1vw, 15px);
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: clamp(9px, 0.75vw, 11px);
  line-height: clamp(12px, 1vw, 15px);
  text-align: center;
  font-weight: 700;
  box-shadow: 0 0 0 2px var(--paper);
}

.my-learning-link,
.more-filter-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 7px 10px;
  color: var(--text);
  font-size: 13px;
  white-space: nowrap;
}

.my-learning-link {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.filter-toggle {
  display: none;
  flex: 0 0 auto;
  min-height: 36px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  width: max-content;
  max-width: 100%;
}

.filter-group {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding-right: 10px;
  border-right: 1px solid var(--line);
}

.filter-group:last-of-type {
  border-right: 0;
}

.filter-group > span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.filter-group div,
.tag-row,
.word-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip,
.tag-row span,
.word-row span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  height: 26px;
  min-height: 26px;
  padding: 3px 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.3;
  white-space: nowrap;
  writing-mode: horizontal-tb;
}

.chip.active,
.desktop-tool-strip .active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.course-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.course-card {
  overflow: hidden;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: 0 1px 0 rgba(32, 35, 31, 0.03);
}

.course-card img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--soft);
}

.course-body {
  display: grid;
  gap: 6px;
  padding: 10px;
}

.course-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.course-title-row span,
.course-title-row button.saved-state {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  border: 0;
  border-radius: 999px;
  background: var(--soft);
  padding: 3px 7px;
  color: var(--accent);
  font-size: 11px;
  font-family: inherit;
  white-space: nowrap;
}

.course-title-row .saved-state svg {
  width: 11px;
  height: 11px;
}

.course-body h2 {
  display: -webkit-box;
  min-height: 34px;
  margin-bottom: 0;
  overflow: hidden;
  font-size: 14px;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.course-body p {
  margin-bottom: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.course-cta {
  display: inline-flex;
  width: max-content;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--accent-soft);
  padding: 5px 9px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
}

.drawer-backdrop,
.lesson-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(30, 35, 31, 0.26);
}

.drawer-backdrop[hidden] {
  display: none !important;
  pointer-events: none !important;
}

.filter-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 41;
  width: min(400px, 88vw);
  transform: translateX(105%);
  border-left: 1px solid var(--line);
  background: var(--paper);
  transition: transform 180ms ease;
}

.filter-drawer.open {
  transform: translateX(0);
}

.filter-drawer form {
  display: grid;
  gap: 12px;
  height: 100%;
  padding: 16px 14px 84px;
  overflow: auto;
}

.drawer-head,
.drawer-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.drawer-head a {
  font-weight: 650;
}

.drawer-head {
  align-items: flex-start;
}

.drawer-title {
  display: grid;
  gap: 3px;
}

.drawer-title strong {
  font-size: 16px;
}

.drawer-title span {
  color: var(--muted);
  font-size: 12px;
}

.drawer-head button {
  border: 0;
  background: transparent;
  color: var(--muted);
}

.drawer-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.drawer-home-link {
  display: inline-flex;
  width: 100%;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--accent);
  font-size: 13px;
  font-weight: 650;
}

.drawer-actions {
  position: absolute;
  right: 14px;
  bottom: 14px;
  left: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  background: var(--paper);
}

.drawer-actions button {
  flex: 1;
}

.drawer-actions button:last-child {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.lesson-header,
.lesson-overview {
  padding-bottom: 10px;
}

.back {
  display: inline-flex;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.mobile-learn-topbar {
  display: none;
}

.lesson-title {
  display: grid;
  grid-template-columns: 98px 1fr;
  gap: 12px;
  align-items: center;
}

.lesson-title.compact {
  grid-template-columns: 70px 1fr;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.lesson-title img {
  width: 98px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
}

.lesson-title.compact img {
  width: 70px;
}

.detail-shell .lesson-header .lesson-title img {
  display: block;
  width: 98px;
  height: auto;
  max-height: none;
  aspect-ratio: auto;
  object-fit: contain;
  border: 0;
  border-radius: 6px;
  background: transparent;
  box-shadow: none;
}

.lesson-title h1 {
  margin-bottom: 5px;
  font-size: 24px;
  line-height: 1.18;
}

.lesson-title.compact h1 {
  margin: 0;
  font-size: 20px;
}

.title-line {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.lesson-title p {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 13px;
}

.goal-line {
  margin-bottom: 0 !important;
}

.plain-action {
  flex: 0 0 auto;
  padding: 6px 10px;
  font-size: 12px;
}

.button-icon {
  --icon-size: 14px;
  display: inline-flex;
  margin-right: 5px;
  color: currentColor;
  vertical-align: -2px;
}

.button-icon svg {
  width: var(--icon-size);
  height: var(--icon-size);
}

.learning-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, 0.46fr);
  grid-template-rows: auto 1fr;
  gap: 10px;
  align-items: start;
}

.player-column {
  min-width: 0;
  display: grid;
  gap: 0;
  align-content: start;
}

.player-column > .lesson-overview,
.player-column > video,
.player-column > .desktop-playback-controls,
.player-column > .info-chips,
.player-column > .desktop-tool-strip,
.player-column > .lesson-intro {
  width: 100%;
  max-width: 100%;
}

video {
  display: block;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111;
  box-shadow: var(--shadow);
}

.info-chips,
.desktop-tool-strip,
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: 6px 0;
}

.info-chips span,
.desktop-tool-strip button,
.desktop-tool-strip label,
.desktop-tool-strip .desktop-tool-link,
.desktop-tool-strip summary {
  flex: 0 0 auto;
  padding: 6px 9px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.info-chips span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
}

.desktop-tool-strip button,
.desktop-tool-strip label,
.desktop-tool-strip .desktop-tool-link,
.desktop-tool-strip summary {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.desktop-tool-strip .rate-mini {
  padding: 6px 8px;
  min-width: 44px;
  justify-content: center;
}

.desktop-tool-strip span {
  color: var(--accent);
  font-weight: 700;
}

.desktop-tool-strip select {
  width: auto;
  height: auto;
  border: 0;
  background: transparent;
  color: inherit;
  font-size: 12px;
  outline: 0;
}

.playback-controls {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  justify-content: center;
  gap: clamp(30px, 3vw, 36px);
  margin: 8px auto 0;
}

.playback-control-btn {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--accent-strong);
  cursor: pointer;
}

.playback-control-btn svg {
  display: block;
  width: 20px;
  height: 20px;
}

.playback-control-btn.is-primary {
  width: 44px;
  height: 44px;
  min-width: 44px;
  max-width: 44px;
  aspect-ratio: 1 / 1;
  padding: 0;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 8px 18px rgba(31, 122, 91, 0.18);
}

.playback-control-btn.is-primary svg {
  width: 23px;
  height: 23px;
}

.playback-control-btn.is-primary svg,
.playback-control-btn.is-primary svg * {
  color: #fff;
  fill: currentColor;
  stroke: currentColor;
}

.playback-control-btn.is-active {
  color: var(--accent);
}

.playback-control-btn:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.playback-control-hint {
  display: block;
  color: currentColor;
  font-size: 11px;
  font-weight: 760;
  line-height: 1;
  white-space: nowrap;
}

.desktop-playback-controls {
  display: grid;
  justify-items: center;
}

.desktop-playback-panel[hidden],
.desktop-playback-expand[hidden] {
  display: none;
}

.desktop-playback-expand {
  display: inline-grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(47, 111, 94, 0.08);
  color: var(--accent-strong);
}

.desktop-playback-expand svg {
  width: 16px;
  height: 16px;
}

.playback-control-btn[data-playback-action="continuous-play"] {
  display: inline-flex;
  width: auto;
  min-width: 72px;
  gap: 4px;
}

@media (max-width: 720px) {
  .desktop-playback-controls {
    display: none;
  }
}

.current-card,
.subtitle-panel,
.study-card,
.practice-card,
.exercise-layout {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 11px;
}

.lesson-shell .current-card {
  display: none;
}

.current-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.line-en {
  margin-bottom: 7px;
  font-size: 19px;
  line-height: 1.35;
}

.line-zh {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
}

.subtitle-hidden {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
}

.word-hit {
  border: 0;
  border-radius: 5px;
  background: var(--word-highlight, rgba(247, 233, 161, 0.68));
  display: inline;
  padding: 0 3px;
  color: inherit;
  font: inherit;
  text-decoration: underline;
  text-decoration-color: rgba(47, 111, 94, 0.3);
  text-underline-offset: 3px;
}

.core-term-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.core-term-chip {
  display: inline-flex;
  gap: 5px;
  align-items: baseline;
  max-width: 100%;
  border: 1px solid rgba(47, 111, 94, 0.2);
  border-radius: 999px;
  background: var(--word-highlight, rgba(247, 233, 161, 0.68));
  padding: 3px 8px;
  color: var(--text);
  font: inherit;
  font-size: 12px;
  line-height: 1.35;
  text-align: left;
}

.core-term-chip span {
  font-weight: 700;
}

.core-term-chip small {
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

.timed-word {
  display: inline;
  border-radius: 5px;
  padding: 0 1px;
  transition: background-color 0.12s ease, color 0.12s ease, box-shadow 0.12s ease;
}

.timed-word.current-word {
  background: rgba(255, 229, 117, 0.92);
  color: #174c3a;
  box-shadow: 0 0 0 1px rgba(33, 94, 75, 0.2);
  font-weight: 750;
}

.subtitle-panel {
  position: sticky;
  top: 12px;
  grid-column: 2;
  grid-row: 1 / span 2;
  min-height: 0;
  max-height: calc(100vh - 24px);
  overflow: hidden;
}

.panel-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 9px;
}

.panel-title h2,
.section-title {
  margin-bottom: 0;
  font-size: 16px;
}

.panel-title span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 7px;
  color: var(--muted);
  font-size: 11px;
}

.subtitle-list {
  display: grid;
  gap: 7px;
  max-height: calc(100vh - 88px);
  overflow: auto;
  padding-right: 3px;
}

.subtitle-item {
  display: grid;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
  padding: 8px;
}

.subtitle-item.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: inset 3px 0 0 var(--accent);
}

.subtitle-main {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
}

.subtitle-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
}

.subtitle-meta b {
  display: inline-grid;
  place-items: center;
  width: 19px;
  height: 19px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--accent);
  font-size: 11px;
}

.subtitle-lines .line-en {
  display: block;
  margin-bottom: 4px;
  font-size: 13px;
}

.subtitle-lines .line-zh {
  display: block;
  margin-bottom: 0;
  font-size: 12px;
}

.segment-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
}

.segment-actions .segment-action-btn {
  --icon-size: 15px;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
  font-size: 12px;
  line-height: 1;
  color: var(--accent);
}

.segment-action-icon {
  position: relative;
  display: inline-grid;
  place-items: center;
}

.segment-action-icon svg {
  width: var(--icon-size);
  height: var(--icon-size);
}

.segment-actions .loop-action.is-active,
.segment-actions .sentence-favorite-action.is-active {
  border: 0;
  background: var(--accent-soft);
  color: var(--accent-strong, var(--accent));
  box-shadow: none;
}

.segment-actions .sentence-favorite-action.is-active {
  color: #d69216;
  background: rgba(255, 244, 214, 0.55);
}

.segment-actions .segment-action-btn:hover {
  border: 0;
  background: rgba(33, 94, 75, 0.07);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
}

.feature-dock {
  grid-column: 1;
  grid-row: 2;
}

.feature-grid a {
  display: flex;
  min-width: 0;
  gap: 5px;
  justify-content: center;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 7px 8px;
  text-align: center;
  color: var(--text);
  font-size: 12px;
}

.feature-grid a > span:last-child {
  display: none;
}

.feature-icon {
  --icon-size: 14px;
  display: inline-grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 6px;
  background: var(--soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
}

.highlight-menu,
.export-menu {
  position: relative;
  flex: 0 0 auto;
}

.highlight-menu summary,
.export-menu summary {
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
}

.highlight-menu summary::-webkit-details-marker,
.export-menu summary::-webkit-details-marker {
  display: none;
}

.highlight-panel,
.export-panel {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 25;
  display: grid;
  gap: 8px;
  width: 184px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  padding: 10px;
  box-shadow: var(--shadow);
}

.export-panel {
  z-index: 95;
  gap: 6px;
  width: 160px;
  border-color: rgba(47, 111, 94, 0.16);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 253, 244, 0.98), rgba(241, 248, 238, 0.98));
  padding: 8px;
  box-shadow: 0 14px 34px rgba(31, 107, 83, 0.14);
  backdrop-filter: blur(12px);
}

.highlight-panel button,
.highlight-panel label,
.export-panel button {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.highlight-panel button,
.export-panel button {
  justify-content: center;
  color: var(--text);
}

.export-panel button {
  min-height: 34px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  box-shadow: none;
}

.export-panel button:hover,
.export-panel button:focus-visible {
  background: rgba(47, 111, 94, 0.08);
  color: var(--accent);
  outline: 0;
}

body[data-theme="dark"] .export-panel {
  border-color: rgba(126, 183, 159, 0.28);
  background: linear-gradient(180deg, rgba(34, 43, 38, 0.98), rgba(25, 32, 29, 0.98));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.42);
}

body[data-theme="dark"] .export-panel button {
  color: #edf1ec;
}

body[data-theme="dark"] .export-panel button:hover,
body[data-theme="dark"] .export-panel button:focus-visible {
  background: rgba(126, 183, 159, 0.16);
  color: #bfe3d4;
}

.highlight-panel select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
  padding: 6px 8px;
  color: var(--text);
}

.lesson-intro {
  margin-top: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 10px;
}

.lesson-intro h2 {
  margin-bottom: 6px;
  font-size: 16px;
}

.lesson-intro dl {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 6px 10px;
  margin: 0;
}

.lesson-intro dt {
  color: var(--muted);
  font-size: 12px;
}

.lesson-intro dd {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.45;
}

.detail-shell {
  width: min(1180px, calc(100% - 32px));
}

.detail-shell:has(.fill-practice-layout) {
  width: min(1440px, calc(100% - 20px));
}

.cards-shell {
  width: min(1280px, calc(100% - 32px));
}

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

.small-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  align-items: stretch;
}

.cards-shell .small-grid {
  grid-template-columns: repeat(auto-fill, minmax(220px, 240px));
  justify-content: start;
  align-items: start;
}

.cards-shell .small-grid > .study-card.learning-card {
  width: min(100%, 240px);
  max-width: 240px;
  min-height: auto;
  padding: 12px;
  flex: 0 0 240px;
  border-color: rgba(68, 104, 84, 0.18);
  background: linear-gradient(180deg, rgba(247, 251, 247, 0.98), rgba(255, 255, 252, 0.98));
  box-shadow: 0 8px 22px rgba(41, 67, 53, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}

.cards-shell .small-grid > .study-card.learning-card:hover {
  transform: translateY(-1px);
  border-color: rgba(33, 94, 75, 0.28);
  box-shadow: 0 12px 28px rgba(41, 67, 53, 0.09);
}

.cards-shell .study-card h2 {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 15px;
  font-weight: 750;
  line-height: 1.25;
}

.cards-shell .study-card small {
  color: rgba(72, 82, 74, 0.72);
  font-size: 11px;
}

.cards-shell .study-card p,
.cards-shell .study-card blockquote {
  margin-bottom: 5px;
  color: rgba(44, 50, 44, 0.78);
  font-size: 12px;
  line-height: 1.45;
}

.cards-shell .study-card .card-meaning {
  color: #24372d !important;
  font-size: 13px;
  font-weight: 700;
}

.learning-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-height: 100%;
}

.card-title-row {
  display: flex;
  gap: 8px;
  align-items: baseline;
  justify-content: space-between;
}

.card-meaning {
  color: var(--text) !important;
  font-weight: 650;
}

.study-card h2 {
  margin-bottom: 8px;
  font-size: 17px;
}

.study-card small {
  color: var(--muted);
  font-size: 13px;
}

.study-card p,
.study-card blockquote,
.practice-card p {
  margin-bottom: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.study-card blockquote,
.lookup-modal blockquote {
  margin: 8px 0;
  padding-left: 10px;
  border-left: 3px solid var(--accent-soft);
}

.exercise-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.75fr);
  gap: 14px;
  align-items: start;
}

.exercise-layout .section-title {
  grid-column: 1 / -1;
}

.exercise-layout video {
  box-shadow: none;
}

.fill-card {
  display: grid;
  gap: 8px;
}

.fill-paragraph {
  white-space: normal;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
  color: var(--text);
  font-size: 17px;
  line-height: 1.55;
}

.inline-fill-blank {
  display: inline-block;
  min-width: 72px;
  height: 1em;
  margin: 0 4px;
  border-bottom: 2px solid currentColor;
  line-height: 1;
  vertical-align: baseline;
}

.inline-blank-input {
  display: inline-block;
  width: clamp(96px, 12vw, 160px);
  height: 1.35em;
  max-width: 100%;
  margin: 0 3px;
  appearance: none;
  border: 0;
  border-radius: 0;
  border-bottom: 2px solid var(--accent);
  background: transparent;
  padding: 0 4px;
  color: var(--text);
  font-size: 0.92em;
  line-height: 1.2;
  outline: 0;
  text-align: center;
  vertical-align: -0.08em;
}

.inline-cloze-field {
  display: inline-flex;
  gap: 4px;
  align-items: baseline;
  margin: 0 4px;
  white-space: nowrap;
}

.blank-number {
  color: var(--accent);
  font-size: 0.72em;
  font-weight: 700;
}

.practice-card.fill-card .fill-paragraph input.inline-blank-input {
  display: inline-block !important;
  width: clamp(90px, 12vw, 150px) !important;
  min-width: 90px !important;
  max-width: 160px !important;
  height: 1.4em !important;
  min-height: 0 !important;
  margin: 0 4px !important;
  border: 0 !important;
  border-bottom: 1px solid currentColor !important;
  border-radius: 0 !important;
  background: transparent !important;
  padding: 0 4px !important;
  box-shadow: none !important;
  line-height: 1.4em !important;
  vertical-align: baseline !important;
}

.answer-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.answer-chip-row span {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-soft);
  padding: 4px 8px;
  color: var(--text);
  font-size: 12px;
}

@media (max-width: 640px) {
  .cards-shell .small-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .cards-shell .small-grid > .study-card.learning-card {
    width: 100%;
    max-width: none;
  }
}

.blank-slot {
  display: inline-block;
  min-width: 74px;
  border-bottom: 2px solid var(--accent);
  color: transparent;
  vertical-align: baseline;
}

.answer-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.practice-video-panel {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 11px;
}

.practice-video-panel button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 8px 10px;
}

.fill-practice-layout {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(600px, 1.05fr) minmax(520px, 0.95fr);
  gap: 10px;
  align-items: start;
}

.fill-video-pane,
.fill-question-pane {
  min-width: 0;
}

.fill-video-pane {
  align-self: start;
}

.fill-question-pane {
  display: grid;
  gap: 8px;
  align-content: start;
  height: min(560px, calc(100vh - 170px));
  min-height: 320px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 5px;
}

.fill-question-pane.is-full-passage-pane {
  height: min(720px, calc(100vh - 132px));
  min-height: 460px;
}

.practice-card.fill-card {
  gap: 6px;
  padding: 8px 10px;
  box-shadow: none;
}

.practice-card.fill-card h2 {
  margin-bottom: 0;
  font-size: 15px;
  line-height: 1.3;
}

.practice-card.fill-card .toolbar {
  margin-top: 2px;
  gap: 6px;
}

.practice-card.fill-card .toolbar button {
  padding: 6px 9px;
  font-size: 12px;
}

.practice-card.fill-card .answer p {
  margin-bottom: 4px;
}

.practice-card.fill-card.is-full-passage .fill-paragraph {
  max-height: none;
  overflow: visible;
  padding-right: 0;
  font-size: 18px;
  line-height: 1.75;
}

.practice-card.fill-card.is-full-passage {
  padding: 14px;
}

.answer-hint {
  color: var(--muted);
  font-size: 12px;
}

@media (min-width: 860px) and (max-width: 1100px) {
  .fill-practice-layout {
    grid-template-columns: minmax(390px, 1fr) minmax(310px, 420px);
  }

  .fill-question-pane {
    height: min(480px, calc(100vh - 170px));
  }
}

.favorites-page .learning-home-shell {
  width: min(92vw, 1720px);
}

.learning-home-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 16px 0 2px;
}

.learning-home-header h1 {
  margin-bottom: 6px;
  color: #123d31;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.08;
  letter-spacing: 0;
}

.learning-home-header p,
.source-line {
  color: var(--muted);
}

.learning-home-copy {
  max-width: 760px;
}

.collection-refresh-wrap {
  position: relative;
  display: inline-grid;
  place-items: center;
  align-self: center;
}

.collection-refresh-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  align-self: center;
  border: 1px solid transparent;
  border-radius: 999px;
  background: rgba(237, 246, 236, 0.72);
  color: var(--accent);
  line-height: 1;
  box-shadow: none;
}

.collection-refresh-button svg {
  width: 19px;
  height: 19px;
}

.collection-refresh-button:hover,
.collection-refresh-button:focus-visible {
  background: rgba(226, 241, 226, 0.92);
  border-color: rgba(47, 111, 94, 0.16);
}

.collection-refresh-button.is-loading {
  opacity: 0.72;
  transform: rotate(18deg);
}

.collection-refresh-hint {
  position: absolute;
  right: calc(100% + 8px);
  top: 50%;
  z-index: 4;
  width: max-content;
  transform: translateY(-50%);
  border: 1px solid rgba(47, 111, 94, 0.14);
  border-radius: 999px;
  background: rgba(255, 253, 244, 0.96);
  padding: 5px 9px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(31, 73, 56, 0.1);
  opacity: 1;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.collection-refresh-hint.is-hidden {
  opacity: 0;
  transform: translateY(-50%) translateX(4px);
  pointer-events: none;
}

body[data-theme="dark"] .collection-refresh-hint {
  border-color: rgba(132, 196, 165, 0.22);
  background: rgba(34, 43, 38, 0.96);
  color: #bfe6d2;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
}

.learning-home-copy .eyebrow {
  margin-bottom: 6px;
  color: var(--accent);
  font-weight: 800;
  letter-spacing: 0.06em;
}

.learning-section {
  display: grid;
  gap: 10px;
}

.collection-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid rgba(47, 111, 94, 0.13);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: 0 6px 18px rgba(31, 73, 56, 0.045);
}

.collection-tabs a {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: transparent;
  padding: 7px 10px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
}

.collection-tabs a.active {
  border-color: var(--accent);
  background: linear-gradient(135deg, #216f56, #2f7a5e);
  color: #fff;
  box-shadow: 0 8px 16px rgba(47, 111, 94, 0.18);
}

.collection-tabs a span {
  display: inline-grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
}

.collection-tabs a.active span {
  background: rgba(255, 255, 255, 0.82);
  color: var(--accent);
}

.collection-panel .learning-section {
  gap: 12px;
}

.collection-panel .small-grid {
  gap: 12px;
}

.collection-panel[data-active-collection="sentences"] .small-grid {
  grid-template-columns: 1fr;
}

.learning-course-card {
  min-height: 100%;
}

.learning-home-shell .small-grid {
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
}

.learning-course-card {
  display: grid;
  grid-template-columns: minmax(116px, 0.42fr) minmax(0, 1fr);
  min-height: 0;
  border-color: rgba(47, 111, 94, 0.12);
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(244, 249, 238, 0.72), rgba(255, 255, 255, 0) 38%),
    var(--paper);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.learning-course-card:hover {
  border-color: rgba(47, 111, 94, 0.22);
  box-shadow: 0 12px 26px rgba(31, 73, 56, 0.1);
  transform: translateY(-1px);
}

.learning-course-cover {
  position: relative;
  display: grid;
  align-self: center;
  place-items: center;
  overflow: hidden;
  min-height: 0;
  padding: 12px 0 12px 12px;
}

.learning-home-shell .learning-course-card img {
  position: relative;
  z-index: 1;
  aspect-ratio: 4 / 3;
  height: auto;
  min-height: 0;
  width: 100%;
  border-radius: 10px;
  object-fit: cover;
}

.learning-cover-placeholder {
  position: absolute;
  inset: 12px 0 12px 12px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(47, 111, 94, 0.12);
  border-radius: 10px;
  background:
    radial-gradient(circle at 70% 25%, rgba(239, 214, 139, 0.22), transparent 34%),
    linear-gradient(135deg, #f8f4df, #e8f3e4);
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.learning-course-cover.is-missing-cover .learning-cover-placeholder {
  z-index: 2;
}

.learning-home-shell .learning-course-card .course-body {
  align-content: center;
  gap: 6px;
  padding: 12px;
}

.learning-home-shell .learning-course-card .course-body h2 {
  display: -webkit-box;
  overflow: hidden;
  font-size: 15px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.learning-course-meta {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.learning-home-shell .learning-course-card .course-cta {
  font-size: 11px;
  justify-self: start;
  border-color: rgba(47, 111, 94, 0.18);
  background: #edf6ec;
  color: var(--accent);
  padding: 5px 10px;
}

.my-study-card {
  display: grid;
  gap: 6px;
  min-height: 0;
  padding: 10px;
}

.my-study-card h2 {
  margin-bottom: 0;
  line-height: 1.35;
}

.sentence-card h2 {
  font-size: 16px;
}

.collection-sentence-card {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(47, 111, 94, 0.13);
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(255, 246, 213, 0.48), rgba(255, 255, 255, 0) 30%),
    rgba(255, 255, 255, 0.9);
  padding: 8px 10px;
  box-shadow: 0 6px 18px rgba(31, 73, 56, 0.055);
}

.collection-sentence-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #77a878, #efd68b);
}

.collection-sentence-meta .time {
  margin: 0;
  color: var(--accent);
  font-size: 11px;
  font-weight: 750;
  line-height: 1.35;
}

.collection-sentence-body {
  min-width: 0;
}

.collection-sentence-body h2 {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 2px;
  color: var(--text);
  font-size: 13.5px;
  line-height: 1.32;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sentence-translation {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 0 2px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.32;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.collection-sentence-body .source-line {
  margin: 0;
  font-size: 11px;
}

.collection-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  align-items: center;
  justify-content: flex-end;
}

.collection-actions .plain-action {
  min-height: 26px;
  border-color: rgba(47, 111, 94, 0.14);
  background: rgba(255, 255, 255, 0.72);
  padding: 3px 8px;
  font-size: 11px;
  text-decoration: none;
}

.collection-actions .danger-action {
  border-color: rgba(168, 82, 65, 0.16);
  background: rgba(255, 248, 244, 0.72);
  color: #8a3d2f;
}

.collection-actions .disabled-action {
  color: var(--muted);
}

.compact-collection-card {
  gap: 4px;
  border-color: rgba(47, 111, 94, 0.12);
  border-radius: 12px;
  background:
    linear-gradient(135deg, rgba(233, 246, 235, 0.72), rgba(255, 250, 230, 0.42)),
    var(--paper);
  padding: 10px 12px;
  box-shadow: 0 6px 16px rgba(31, 73, 56, 0.045);
}

.compact-collection-card h2 {
  font-size: 15px;
}

.collection-compact-title-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.compact-collection-card .saved-state {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  border: 0;
  border-radius: 999px;
  background: rgba(237, 246, 236, 0.86);
  padding: 3px 7px;
  color: var(--accent);
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.compact-collection-card .saved-state svg {
  width: 11px;
  height: 11px;
}

.compact-collection-card p {
  margin: 0;
  font-size: 12px;
}

@media (max-width: 720px) {
  .favorites-page .learning-home-shell {
    width: min(100% - 20px, 720px);
    padding-bottom: calc(142px + env(safe-area-inset-bottom)) !important;
  }

  .learning-home-header {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 8px 0 0;
  }

  .collection-refresh-button {
    width: 40px;
    height: 40px;
  }

  .collection-refresh-button svg {
    width: 18px;
    height: 18px;
  }

  .collection-refresh-hint {
    right: 0;
    top: calc(100% + 6px);
    transform: none;
    font-size: 11px;
    padding: 5px 8px;
  }

  .collection-refresh-hint.is-hidden {
    transform: translateY(-3px);
  }

  .learning-home-header h1 {
    margin-bottom: 6px;
    font-size: 34px;
  }

  .learning-home-header p {
    margin-bottom: 0;
    font-size: 13px;
    line-height: 1.55;
  }

  .learning-home-copy .eyebrow {
    margin-bottom: 5px;
    font-size: 11px;
  }

  .collection-tabs {
    gap: 6px;
    padding: 6px;
    border-radius: 15px;
  }

  .collection-tabs a {
    flex: 1 1 calc(50% - 6px);
    justify-content: center;
    min-height: 34px;
    padding: 5px 8px;
    font-size: 12px;
    border-radius: 11px;
  }

  .collection-panel .small-grid,
  .learning-home-shell .small-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .learning-course-card {
    grid-template-columns: 104px minmax(0, 1fr);
    border-radius: 12px;
  }

  .learning-course-cover {
    padding: 9px 0 9px 9px;
  }

  .learning-cover-placeholder {
    inset: 9px 0 9px 9px;
    border-radius: 9px;
    font-size: 11px;
  }

  .learning-home-shell .learning-course-card img {
    min-height: 92px;
    border-radius: 9px;
  }

  .learning-home-shell .learning-course-card .course-body {
    gap: 4px;
    padding: 9px 10px;
  }

  .learning-home-shell .learning-course-card .course-body h2 {
    font-size: 13px;
    line-height: 1.28;
  }

  .learning-course-card .saved-state {
    font-size: 10px;
  }

  .learning-home-shell .learning-course-card .course-body p {
    margin-bottom: 0;
    font-size: 11px;
    line-height: 1.35;
  }

  .learning-home-shell .learning-course-card .course-cta {
    margin-top: 2px;
    padding: 4px 8px;
    font-size: 10.5px;
  }

  .collection-sentence-card {
    grid-template-columns: 1fr;
    gap: 5px;
    border-radius: 12px;
    padding: 8px 9px;
  }

  .collection-sentence-meta .time {
    font-size: 10.5px;
  }

  .collection-sentence-body h2 {
    font-size: 13px;
    line-height: 1.28;
  }

  .sentence-translation {
    font-size: 11px;
    line-height: 1.28;
    -webkit-line-clamp: 2;
  }

  .collection-actions {
    justify-content: flex-start;
    gap: 4px;
  }

  .collection-actions .plain-action {
    min-height: 26px;
    padding: 3px 7px;
  }

  .compact-collection-card {
    padding: 9px 10px;
  }
}

@media (min-width: 721px) and (max-width: 1100px) {
  .favorites-page .learning-home-shell {
    width: min(100% - 32px, 1040px);
  }

  .learning-home-shell .small-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }

  .learning-course-card {
    grid-template-columns: 112px minmax(0, 1fr);
  }
}

.word-card h2,
.phrase-card h2 {
  color: var(--accent);
}

.empty-card {
  border-style: dashed;
  background: var(--paper-soft);
}

.lookup-word-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.lookup-word-list button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper);
  padding: 7px 10px;
}

.toolbar button {
  padding: 7px 9px;
  font-size: 12px;
}

.toolbar .active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.answer {
  border-radius: 8px;
  background: var(--soft);
  padding: 10px;
}

.empty {
  color: var(--muted);
}

.lesson-overlay {
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
}

.lookup-modal {
  position: relative;
  width: min(460px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  padding: 18px;
  box-shadow: var(--shadow);
}

.practice-menu-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.practice-menu-list a,
.practice-menu-list button {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
  padding: 10px;
  color: var(--text);
  font-size: 14px;
  text-align: left;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
}

.lookup-title {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}

.lookup-title h2,
.lookup-modal h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

.lookup-title button {
  display: inline-grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
}

.phonetic,
.lookup-modal p {
  margin-bottom: 8px;
  color: var(--muted);
  line-height: 1.5;
}

.lookup-meaning {
  color: var(--text) !important;
  font-weight: 650;
}

.lookup-kind {
  margin-bottom: 0 !important;
  color: var(--accent) !important;
  font-size: 12px;
  font-weight: 650;
}

.term-detail-list {
  display: grid;
  gap: 8px;
  margin: 10px 0;
}

.term-detail-list div {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
  padding: 8px 9px;
}

.term-detail-list dt {
  color: var(--muted);
  font-size: 12px;
}

.term-detail-list dd {
  margin: 0;
  color: var(--text);
  line-height: 1.45;
}

.term-example {
  margin: 10px 0;
}

.term-example > span {
  color: var(--muted);
  font-size: 12px;
}

.term-example blockquote {
  margin-top: 5px;
}

.modal-primary {
  display: inline-flex;
  justify-content: center;
  margin-top: 6px;
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.intensive-list {
  display: grid;
  gap: 4px;
  margin: 12px 0 0;
}

.intensive-list dt {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
}

.intensive-list dd {
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.5;
}

.mobile-bottom-tools {
  display: none;
}

.admin-shell {
  width: min(1280px, calc(100% - 32px));
}

.admin-header {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.admin-header-links {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}

.admin-header-links a {
  color: var(--brand-deep);
  font-weight: 700;
  text-decoration: none;
}

.admin-header h1 {
  margin-bottom: 6px;
  font-size: clamp(28px, 3vw, 38px);
}

.admin-header p {
  margin-bottom: 0;
  color: var(--muted);
}

.admin-alert {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 10px 12px;
}

.admin-alert.success {
  border-color: rgba(47, 111, 94, 0.28);
  color: var(--accent);
}

.admin-alert.pending,
.admin-alert.warning {
  border-color: rgba(171, 122, 44, 0.32);
  color: #7a5619;
}

.admin-alert.error,
.admin-form-message[data-type="error"] {
  color: #b24636;
}

.admin-course-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-course-list,
.admin-editor,
.admin-form {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  box-shadow: 0 10px 28px rgba(32, 35, 31, 0.06);
}

.admin-course-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 190px);
  overflow: auto;
  padding: 12px;
}

.admin-section-head,
.admin-form-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.admin-section-head h2,
.admin-section-head h3,
.admin-form-title h2 {
  margin: 0;
  font-size: 18px;
}

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

.admin-section-head span {
  color: var(--muted);
  font-size: 13px;
}

.admin-course-filters {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper-soft);
  padding: 10px;
}

.admin-course-filters input,
.admin-course-filters select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  color: var(--text);
  font: inherit;
  padding: 8px 10px;
}

.admin-course-filters button,
.admin-empty-state button {
  border: 1px solid rgba(47, 111, 94, 0.28);
  border-radius: 999px;
  background: var(--paper);
  color: var(--accent);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
}

.admin-bulk-toolbar {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  padding: 10px;
}

.admin-bulk-toolbar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-bulk-toolbar button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--text);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
}

.admin-bulk-toolbar button[data-admin-bulk-action="publish"] {
  border-color: rgba(47, 111, 94, 0.32);
  background: var(--accent);
  color: #fff;
}

.admin-bulk-toolbar button[data-admin-bulk-action="unpublish"] {
  border-color: rgba(178, 70, 54, 0.26);
  color: #b24636;
}

.admin-bulk-toolbar button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.admin-course-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
  border: 1px solid transparent;
  border-radius: 10px;
}

.admin-course-row.active,
.admin-course-row.selected {
  border-color: rgba(47, 111, 94, 0.42);
  background: var(--accent-soft);
}

.admin-course-check {
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
}

.admin-course-check input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.admin-course-list [data-admin-course] {
  display: grid;
  gap: 4px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
  padding: 10px;
  text-align: left;
}

.admin-course-row.active [data-admin-course] {
  border-color: rgba(47, 111, 94, 0.42);
  background: var(--accent-soft);
}

.admin-course-list [data-admin-course] span,
.admin-course-list [data-admin-course] small {
  color: var(--muted);
}

.admin-form {
  display: grid;
  gap: 16px;
  padding: 16px;
}

.admin-form-title button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  font-weight: 800;
}

.admin-form-title button:disabled {
  cursor: progress;
  opacity: 0.62;
}

.admin-form-title button.danger {
  background: #b42318;
}

.admin-current-state {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

.admin-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.admin-form-grid .wide {
  grid-column: 1 / -1;
}

.admin-form-grid input,
.admin-form-grid textarea,
.admin-form-grid select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--text);
  padding: 9px 10px;
  font: inherit;
  font-weight: 500;
}

.admin-form-grid textarea {
  resize: vertical;
}

.admin-form-grid input:disabled,
.admin-form-grid select:disabled {
  color: var(--muted);
  cursor: not-allowed;
}

.admin-resource-panel {
  display: grid;
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.admin-key-grid {
  display: grid;
  gap: 8px;
}

.admin-key-grid p {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.admin-key-grid code {
  overflow-wrap: anywhere;
  color: var(--text);
}

.admin-operation-debug {
  display: grid;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.admin-operation-debug p {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.admin-operation-debug code,
.admin-operation-debug span {
  overflow-wrap: anywhere;
  color: var(--text);
}

.admin-debug-warning span {
  color: #b24636;
}

.admin-form-message {
  min-height: 20px;
  margin: 0;
  color: var(--accent);
  font-size: 13px;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.56), rgba(255, 255, 255, 0)),
    var(--bg);
  padding: clamp(24px, 7vh, 58px) 20px;
}

.auth-card {
  width: min(92vw, 448px);
  border: 1px solid rgba(47, 111, 94, 0.13);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  padding: clamp(26px, 4.4vw, 38px);
  box-shadow: 0 18px 48px rgba(32, 35, 31, 0.1);
  color: var(--text);
}

.auth-policy-card {
  width: min(92vw, 760px);
}

.auth-back {
  display: inline-flex;
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 14px;
}

.auth-card h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(24px, 4.2vw, 32px);
  line-height: 1.18;
  letter-spacing: 0;
  font-weight: 900;
  text-align: center;
  white-space: nowrap;
}

.auth-brand {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
  text-align: center;
}

.auth-brand-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
}

.auth-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.auth-mode-title {
  margin: 0 0 16px;
  color: var(--text);
  font-size: 18px;
  font-weight: 850;
  text-align: center;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 28px;
  border-radius: 999px;
  background: var(--soft);
  padding: 4px;
}

.auth-tabs button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 9px 10px;
  font-size: 15px;
  font-weight: 750;
}

.auth-tabs button.active {
  background: var(--paper);
  color: var(--text);
  box-shadow: 0 4px 12px rgba(32, 35, 31, 0.07);
  text-decoration: none;
}

.auth-form {
  display: grid;
  gap: 0;
}

.auth-field {
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-soft);
  padding: 9px 11px;
  margin-bottom: 10px;
}

.auth-field span {
  height: auto;
  overflow: visible;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.auth-field input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 15px;
  line-height: 1.35;
}

.auth-field input::placeholder {
  color: #9aa19b;
  opacity: 1;
}

.auth-password-control {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  gap: 8px;
  align-items: center;
}

.auth-password-toggle {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0;
}

.auth-password-toggle svg {
  width: 19px;
  height: 19px;
}

.auth-password-toggle:hover {
  color: var(--accent);
  background: rgba(47, 111, 94, 0.08);
}

.auth-code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 10px;
}

.auth-code-row .auth-field {
  margin-bottom: 0;
}

.auth-code-row button {
  min-height: 36px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: transparent;
  color: var(--accent);
  padding: 0 14px;
  font-size: 14px;
  font-weight: 750;
  white-space: nowrap;
}

.auth-terms {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  margin: 4px 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.auth-terms input {
  appearance: none;
  width: 22px;
  height: 22px;
  margin-top: 1px;
  border: 1.5px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
}

.auth-terms input:checked {
  border-color: var(--accent);
  background:
    radial-gradient(circle at center, var(--accent) 45%, transparent 48%),
    #fff;
}

.auth-terms a {
  color: var(--accent);
  font-weight: 750;
}

.auth-submit,
.auth-enter {
  min-height: 50px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 18px;
  font-weight: 850;
  box-shadow: 0 10px 20px rgba(47, 111, 94, 0.18);
  text-align: center;
}

.auth-submit {
  width: 100%;
}

.auth-enter {
  display: grid;
  place-items: center;
  margin-top: 14px;
}

.auth-message {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.auth-message[data-type="success"] {
  color: var(--accent);
}

.auth-message[data-type="error"] {
  color: #b24636;
}

.auth-register-note,
.auth-sms-pending {
  margin: 0 0 10px;
  border-radius: 14px;
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.55;
}

.auth-register-note {
  background: rgba(237, 242, 234, 0.72);
  color: var(--accent-strong);
}

.auth-login-note {
  margin: -4px 0 14px;
  background: transparent;
  color: var(--muted);
  padding: 0;
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
}

.auth-sms-pending {
  border: 1px solid rgba(47, 111, 94, 0.12);
  background: rgba(255, 253, 245, 0.86);
  color: var(--muted);
}

.auth-switch-line {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.auth-switch-line span {
  display: inline-block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.auth-switch-line a {
  color: var(--accent);
  font-weight: 800;
}

.auth-session {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
  color: var(--muted);
  font-size: 13px;
}

.auth-session button {
  border: 0;
  background: transparent;
  color: var(--accent);
  font-weight: 800;
}

.auth-policy {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper-soft);
  padding: 18px;
  line-height: 1.7;
}

.auth-policy h2 {
  margin: 0;
}

.auth-policy h3 {
  margin: 6px 0 -4px;
  color: var(--text);
  font-size: 15px;
}

.auth-policy p {
  margin: 0;
  color: var(--muted);
}

.policy-qr-placeholders {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 4px;
}

.policy-qr-placeholders span {
  display: grid;
  min-height: 88px;
  place-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: var(--paper);
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

@media (max-width: 520px) {
  .auth-page {
    place-items: center;
    padding-top: clamp(24px, 6vh, 48px);
    padding-bottom: clamp(24px, 6vh, 48px);
    padding-right: 0;
    padding-left: 0;
  }

  .auth-card {
    width: min(88vw, 360px);
    padding: 18px 14px;
    border-radius: 16px;
  }

  .auth-policy-card {
    width: min(92vw, 430px);
  }

  .auth-back {
    margin-bottom: 14px;
    font-size: 13px;
  }

  .auth-card h1 {
    font-size: clamp(20px, 5.4vw, 23px);
  }

  .auth-brand {
    gap: 6px;
    margin-bottom: 16px;
  }

  .auth-brand-kicker {
    font-size: 12px;
  }

  .auth-subtitle {
    font-size: 12px;
  }

  .auth-mode-title {
    margin-bottom: 12px;
    font-size: 16px;
  }

  .auth-tabs {
    margin-bottom: 16px;
  }

  .auth-tabs button {
    padding: 7px 8px;
    font-size: 14px;
  }

  .auth-field {
    gap: 4px;
    padding: 7px 9px;
    margin-bottom: 8px;
  }

  .auth-field input {
    font-size: 13px;
  }

  .auth-field input[name="activationCode"] {
    font-size: clamp(12px, 3.25vw, 13px);
  }

  .auth-code-row {
    grid-template-columns: minmax(0, 1fr) max-content;
    gap: 6px;
  }

  .auth-code-row button {
    min-height: 32px;
    padding: 0 10px;
    font-size: 12px;
  }

  .auth-terms {
    grid-template-columns: 20px minmax(0, 1fr);
    gap: 8px;
    margin-bottom: 16px;
    font-size: 11px;
  }

  .auth-terms input {
    width: 20px;
    height: 20px;
  }

  .auth-submit,
  .auth-enter {
    min-height: 44px;
    font-size: 16px;
  }

  .policy-qr-placeholders {
    grid-template-columns: 1fr;
  }

  .auth-message {
    margin-top: 10px;
    font-size: 12px;
  }
}

@media (min-width: 1220px) {
  .course-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }
}

@media (min-width: 1460px) {
  .course-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}

@media (min-width: 980px) and (max-width: 1219px) {
  .course-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (min-width: 860px) and (max-width: 979px) {
  .course-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .learning-layout {
    grid-template-columns: minmax(0, 1fr) minmax(310px, 0.5fr);
  }

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

@media (min-width: 860px) {
  .learning-layout {
    grid-template-rows: auto auto auto auto auto auto;
  }

  .player-column {
    display: contents;
  }

  .player-column > .lesson-overview {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .player-column > video {
    grid-column: 1;
    grid-row: 2;
  }

  .player-column > .info-chips {
    grid-column: 1;
    grid-row: 3;
  }

  .player-column > .desktop-tool-strip {
    grid-column: 1;
    grid-row: 4;
  }

  .player-column > .lesson-intro {
    grid-column: 1;
    grid-row: 5;
  }

  .subtitle-panel {
    grid-column: 2;
    grid-row: 2 / span 4;
  }

  .feature-dock {
    grid-column: 1;
    grid-row: 6;
  }
}

@media (max-width: 859px) {
  html,
  body {
    min-height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  body {
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  .shell,
  .lesson-shell,
  .detail-shell {
    width: min(100% - 20px, 760px);
    padding-top: 12px;
  }

  .lesson-shell {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: calc(100dvh - 96px);
    overflow: visible;
    padding-bottom: calc(106px + env(safe-area-inset-bottom));
  }

  .masthead,
  .learning-layout,
  .lesson-title,
  .exercise-layout {
    grid-template-columns: 1fr;
  }

  .masthead {
    gap: 10px;
    align-items: start;
  }

  .masthead h1 {
    font-size: 30px;
  }

  .tagline {
    white-space: normal;
  }

  .home-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .search {
    flex: 1 1 180px;
  }

  .filter-toggle {
    display: inline-flex;
  }

  .desktop-filters {
    display: none;
  }

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

  .course-grid {
    align-items: stretch;
  }

  .course-card img {
    aspect-ratio: 16 / 11;
  }

  .course-title-row {
    grid-template-columns: 1fr;
  }

  .course-title-row span {
    width: max-content;
  }

  .filter-drawer {
    left: 0;
    right: auto;
    width: min(86vw, 360px);
    transform: translateX(-105%);
    border-right: 1px solid var(--line);
    border-left: 0;
  }

  .filter-drawer.open {
    transform: translateX(0);
  }

  .course-body h2 {
    min-height: 32px;
    font-size: 13px;
  }

  .mobile-learn-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 32px minmax(0, 1fr) 32px 32px 32px;
    gap: 4px;
    align-items: center;
    margin: -12px -2px 8px;
    padding: 8px 0;
    background: var(--bg);
  }

  .mobile-learn-topbar a,
  .mobile-learn-topbar button {
    display: inline-grid;
    height: 32px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--paper);
  }

  .mobile-learn-topbar strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
  }

  .lesson-overview {
    display: none;
  }

  .learning-layout {
    gap: 9px;
    min-height: 0;
    overflow: visible;
    grid-template-rows: auto;
  }

  .lesson-shell .learning-layout {
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
  }

  .lesson-shell .player-column {
    min-height: 0;
  }

  video {
    box-shadow: none;
  }

  .lesson-shell video {
    max-height: min(34dvh, 260px);
    object-fit: contain;
  }

  .lesson-shell .player-column > .lesson-intro {
    display: none;
  }

  .info-chips,
  .desktop-tool-strip,
  .current-card {
    display: none;
  }

  .subtitle-panel {
    position: static;
    grid-column: auto;
    grid-row: auto;
    display: grid;
    grid-template-rows: auto minmax(0, 1fr);
    min-height: 0;
    max-height: none;
    overflow: hidden;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .panel-title {
    margin: 4px 0 8px;
  }

  .subtitle-list {
    min-height: 0;
    max-height: none;
    padding-right: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    scroll-padding: 12px;
    -webkit-overflow-scrolling: touch;
  }

  .subtitle-item {
    gap: 5px;
    padding: 7px 8px;
    background: var(--paper);
  }

  .subtitle-main {
    gap: 3px;
  }

  .subtitle-meta b {
    width: 20px;
    height: 20px;
  }

  .subtitle-lines .line-en {
    margin-bottom: 2px;
    font-size: 14px;
    line-height: 1.35;
  }

  .subtitle-lines .line-zh {
    font-size: 12.5px;
    line-height: 1.35;
  }

  .segment-actions .segment-action-btn {
    width: 36px;
    height: 34px;
    min-width: 36px;
    min-height: 34px;
    padding: 0;
  }

  .core-term-row {
    gap: 5px;
    margin-top: 2px;
  }

  .core-term-chip {
    padding: 4px 6px;
    gap: 2px;
  }

  .feature-dock {
    display: none;
  }

  .feature-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    margin-top: 2px;
  }

  .feature-grid a {
    padding: 8px 6px;
    font-size: 12px;
  }

  .lesson-overlay {
    z-index: 120;
    align-items: end;
    place-items: end stretch;
    padding: 12px 10px calc(92px + env(safe-area-inset-bottom));
  }

  .lookup-modal {
    align-self: end;
    width: 100%;
    max-height: min(78dvh, calc(100dvh - 126px - env(safe-area-inset-bottom)));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    border-radius: 16px 16px 0 0;
    padding: 14px 14px calc(18px + env(safe-area-inset-bottom));
  }

  .practice-menu-modal {
    align-self: end;
  }

  .admin-shell {
    width: min(100% - 18px, 760px);
  }

  .admin-course-layout {
    grid-template-columns: 1fr;
  }

  .admin-course-list {
    max-height: 280px;
  }

  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .admin-form-title {
    align-items: start;
    flex-direction: column;
  }

  .admin-form-title button {
    width: 100%;
  }

  .admin-form-actions {
    width: 100%;
  }

  .admin-key-grid p {
    grid-template-columns: 1fr;
  }

  .fill-practice-layout {
    display: flex;
    flex-direction: column;
    gap: 6px;
  }

  .detail-shell:has(.fill-practice-layout) {
    padding-top: 6px;
  }

  .detail-shell:has(.fill-practice-layout) .lesson-header {
    padding-bottom: 4px;
  }

  .detail-shell:has(.fill-practice-layout) .back {
    margin-bottom: 4px;
    font-size: 12px;
  }

  .detail-shell:has(.fill-practice-layout) .lesson-title.compact {
    grid-template-columns: 52px 1fr;
    gap: 8px;
    padding: 6px;
  }

  .detail-shell:has(.fill-practice-layout) .lesson-title.compact img {
    width: 52px;
  }

  .detail-shell:has(.fill-practice-layout) .lesson-title.compact h1 {
    font-size: 17px;
    line-height: 1.15;
  }

  .detail-shell:has(.fill-practice-layout) .lesson-title.compact p {
    margin-bottom: 2px;
    font-size: 11px;
    line-height: 1.3;
  }

  .detail-shell:has(.fill-practice-layout) .lesson-title.compact .plain-action {
    min-height: 28px;
    padding: 5px 8px;
    font-size: 12px;
  }

  .fill-video-pane {
    order: 1;
  }

  .fill-question-pane {
    order: 2;
    max-height: none;
    overflow: visible;
    padding-right: 0;
    padding-bottom: calc(92px + env(safe-area-inset-bottom));
    -webkit-overflow-scrolling: touch;
  }

  .fill-video-pane video {
    max-height: 176px;
    object-fit: contain;
  }

  .fill-video-pane .practice-video-panel {
    gap: 5px;
    padding: 6px;
  }

  .fill-video-pane .practice-video-panel button {
    padding: 5px 8px;
    font-size: 12px;
  }

  .fill-question-pane .fill-card {
    gap: 6px;
    padding: 8px;
  }

  .fill-card .time,
  .fill-card > p {
    margin-bottom: 4px;
    font-size: 12px;
  }

  .fill-paragraph {
    padding: 8px;
    font-size: 14px;
    line-height: 1.4;
  }

  .inline-fill-blank {
    min-width: 54px;
    margin: 0 2px;
  }

  .practice-card.fill-card .fill-paragraph input.inline-blank-input {
    width: 58px !important;
    min-width: 50px !important;
    max-width: 82px !important;
    color: var(--accent);
    caret-color: var(--accent);
  }
}

@media (max-width: 430px) {
  .shell,
  .lesson-shell,
  .detail-shell {
    width: min(100% - 16px, 430px);
  }

  .search {
    display: flex;
    grid-template-columns: none;
  }

  .feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .course-body {
    padding: 8px;
  }

  .tag-row span {
    font-size: 11px;
    padding: 4px 7px;
  }
}



/* ===== mobile learning final polish: video fixed, subtitle internal scroll, balanced toolbar ===== */
@media (max-width: 720px) {
  html,
  body {
    height: auto !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .lesson-shell {
    min-height: 100dvh !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    padding-bottom: calc(112px + env(safe-area-inset-bottom)) !important;
  }

  .lesson-shell .learning-layout {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
  }

  .lesson-shell .player-column {
    min-height: 0 !important;
    overflow: visible !important;
  }

  .lesson-shell video,
  .lesson-shell #lessonVideo {
    width: 100% !important;
    max-height: min(34dvh, 260px) !important;
    object-fit: contain !important;
  }

  .lesson-shell .subtitle-panel {
    min-height: 0 !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .lesson-shell .subtitle-list {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-padding-top: 16px !important;
    padding-bottom: 92px !important;
  }

  #mobileThemeToggle {
    color: var(--ink) !important;
  }

  #mobileThemeToggle .moon-glyph {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 1em !important;
    height: 1em !important;
    font-size: 19px !important;
    line-height: 1 !important;
    font-weight: 800 !important;
    color: currentColor !important;
  }

}


/* ===== mobile learning hard override v2 start ===== */
@media (max-width: 720px) {
  html,
  body {
    height: auto !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .lesson-shell {
    min-height: 100dvh !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
    padding-bottom: calc(112px + env(safe-area-inset-bottom)) !important;
  }

  .lesson-shell .learning-layout {
    height: auto !important;
    min-height: 0 !important;
    overflow: visible !important;
    display: grid !important;
    grid-template-rows: auto minmax(0, 1fr) !important;
  }

  .lesson-shell .player-column {
    min-height: 0 !important;
    overflow: visible !important;
    position: relative !important;
    z-index: 3 !important;
  }

  .lesson-shell video,
  .lesson-shell #lessonVideo {
    width: 100% !important;
    max-height: min(32dvh, 250px) !important;
    object-fit: contain !important;
    display: block !important;
  }

  .lesson-shell .subtitle-panel {
    min-height: 0 !important;
    height: auto !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: column !important;
  }

  .lesson-shell .subtitle-list {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: calc(100dvh - 320px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
    scroll-padding-top: 10px !important;
    padding-bottom: 98px !important;
  }

  #mobileThemeToggle {
    color: var(--ink) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }

  #mobileThemeToggle .moon-icon {
    display: block !important;
    width: 18px !important;
    height: 18px !important;
    color: currentColor !important;
    stroke: currentColor !important;
  }

}
/* ===== mobile learning hard override v2 end ===== */

/* ===== mobile bottom toolbar final fixed tabbar ===== */
@media (max-width: 720px) {
  .lesson-shell .subtitle-list {
    padding-bottom: 118px !important;
  }

  .mobile-bottom-tools {
    position: fixed !important;
    left: 50% !important;
    right: auto !important;
    bottom: max(10px, env(safe-area-inset-bottom)) !important;
    transform: translateX(-50%) !important;
    width: min(392px, calc(100vw - 24px)) !important;
    height: 64px !important;
    padding: 6px 10px !important;
    display: grid !important;
    grid-template-columns: 1fr !important;
    align-items: center !important;
    justify-items: center !important;
    gap: 0 !important;
    background: rgba(255, 255, 255, 0.97) !important;
    border: 1px solid rgba(26, 73, 61, 0.12) !important;
    border-radius: 18px !important;
    box-shadow: 0 8px 24px rgba(20, 40, 30, 0.08) !important;
    backdrop-filter: none !important;
    z-index: 100 !important;
  }

  .mobile-bottom-tools button {
    box-sizing: border-box !important;
    margin: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    background: transparent !important;
    font-family: inherit !important;
  }

  .mobile-bottom-tools button:not(#mobilePlayToggle):not(#mobilePlaybackPlayToggle):not(.is-primary) {
    width: auto !important;
    min-width: 0 !important;
    height: 52px !important;
    padding: 2px 0 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;

    color: var(--muted) !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    line-height: 1.1 !important;
    text-align: center !important;
    white-space: nowrap !important;
  }

  .mobile-bottom-tools button:not(#mobilePlayToggle):not(#mobilePlaybackPlayToggle):not(.is-primary) span {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    min-height: 20px !important;
    line-height: 1 !important;
  }

  .mobile-bottom-tools button:not(#mobilePlayToggle):not(#mobilePlaybackPlayToggle):not(.is-primary) svg,
  .mobile-bottom-tools button:not(#mobilePlayToggle):not(#mobilePlaybackPlayToggle):not(.is-primary) span svg {
    width: 19px !important;
    height: 19px !important;
    display: block !important;
  }

  .mobile-bottom-tools .mobile-learning-tools[hidden],
  .mobile-bottom-tools .mobile-playback-tools[hidden] {
    display: none !important;
    pointer-events: none !important;
  }

  .mobile-bottom-tools .mobile-learning-tools,
  .mobile-bottom-tools .mobile-playback-tools {
    position: relative;
    display: grid;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-items: center;
  }

  .mobile-bottom-tools .mobile-learning-tools {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 56px minmax(0, 1fr) minmax(0, 1fr) 26px;
    column-gap: clamp(8px, 2.6vw, 14px);
  }

  .mobile-bottom-tools .mobile-playback-tools {
    grid-template-columns: minmax(58px, 1fr) minmax(52px, 1fr) 48px minmax(52px, 1fr) minmax(58px, 1fr);
    column-gap: clamp(14px, 4vw, 20px);
  }

  #mobilePlayToggle,
  .mobile-bottom-tools .mobile-primary-play {
    grid-column: 3 !important;
    width: 56px !important;
    height: 56px !important;
    min-width: 56px !important;
    max-width: 56px !important;
    transform: none !important;
    padding: 0 !important;
    display: inline-grid !important;
    place-items: center !important;
    border-radius: 0 !important;
    background: transparent !important;
    color: #fff !important;
    line-height: 1 !important;
  }

  #mobilePlayToggle > span:first-child,
  .mobile-primary-play-circle {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    max-width: 48px !important;
    aspect-ratio: 1 / 1 !important;
    border-radius: 999px !important;
    display: grid !important;
    grid-template-rows: 17px 11px !important;
    align-content: center !important;
    justify-items: center !important;
    gap: 2px !important;
    background: var(--accent) !important;
    color: #fff !important;
    box-shadow: 0 8px 18px rgba(31, 122, 91, 0.18) !important;
  }

  #mobilePlayToggle .mobile-primary-play-icon {
    display: inline-grid !important;
    place-items: center !important;
    width: 18px !important;
    height: 17px !important;
    min-height: 0 !important;
    color: #fff !important;
    line-height: 1 !important;
  }

  #mobilePlayToggle .mobile-primary-play-label {
    color: #fff !important;
    font-size: 10.5px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
  }

  #mobilePlaybackPlayToggle,
  .mobile-bottom-tools .mobile-playback-tools .playback-control-btn.is-primary {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    aspect-ratio: 1 / 1 !important;
    transform: none !important;
    padding: 0 !important;
    display: inline-grid !important;
    place-items: center !important;
    border-radius: 999px !important;
    background: var(--accent) !important;
    color: #fff !important;
  }

  #mobilePlayToggle > span:first-child svg,
  .mobile-primary-play-circle svg {
    width: 16px !important;
    height: 16px !important;
  }

  #mobilePlaybackPlayToggle svg,
  .mobile-bottom-tools .mobile-playback-tools .playback-control-btn.is-primary svg {
    width: 20px !important;
    height: 20px !important;
  }

  #mobilePlayToggle > span:first-child svg,
  #mobilePlayToggle > span:first-child svg *,
  .mobile-primary-play-circle svg,
  .mobile-primary-play-circle svg *,
  #mobilePlaybackPlayToggle svg,
  #mobilePlaybackPlayToggle svg *,
  .mobile-bottom-tools .mobile-playback-tools .playback-control-btn.is-primary svg,
  .mobile-bottom-tools .mobile-playback-tools .playback-control-btn.is-primary svg * {
    color: #fff !important;
    fill: currentColor !important;
    stroke: currentColor !important;
  }

  #mobileBilingual { grid-column: 1 !important; }
  #mobileRateToggle { grid-column: 2 !important; }
  #mobilePlayToggle { grid-column: 3 !important; }
  #mobilePracticeMenu {
    display: flex !important;
    grid-column: 4 !important;
  }
  #mobileIntensive { grid-column: 5 !important; }
  #mobilePlaybackExpand { grid-column: 6 !important; }

  .mobile-playback-expand {
    position: static;
    z-index: 2;
    display: inline-grid;
    width: 26px;
    height: 32px;
    min-width: 26px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: rgba(235, 247, 237, 0.98);
    color: var(--accent-strong);
  }

  .mobile-playback-expand svg {
    width: 15px;
    height: 15px;
  }

  .mobile-bottom-tools .mobile-playback-tools .playback-control-btn {
    width: auto !important;
    min-width: 0 !important;
    max-width: 58px !important;
    height: 50px !important;
    padding: 0 !important;
    display: inline-flex !important;
    flex-direction: column !important;
    gap: 2px !important;
    background: transparent !important;
    box-shadow: none !important;
    color: #64776d !important;
  }

  .mobile-bottom-tools .mobile-playback-tools .playback-control-btn.is-active {
    color: var(--accent-strong) !important;
  }

  .mobile-bottom-tools .mobile-playback-tools .playback-control-btn[data-playback-action="continuous-play"] {
    max-width: 58px !important;
  }

  .mobile-bottom-tools .mobile-playback-tools .playback-control-btn[data-playback-action="continuous-play"].is-active {
    background: rgba(47, 111, 94, 0.12) !important;
    box-shadow: inset 0 0 0 1px rgba(47, 111, 94, 0.18) !important;
    color: var(--accent-strong) !important;
  }

  .mobile-bottom-tools .mobile-playback-tools .playback-control-btn[data-playback-action="collapse-controls"] {
    width: 48px !important;
    max-width: 48px !important;
    height: 48px !important;
    border-radius: 999px !important;
    background: rgba(235, 247, 237, 0.78) !important;
    color: var(--accent-strong) !important;
  }

  .mobile-bottom-tools .mobile-playback-tools .playback-control-btn[data-playback-action="collapse-controls"] svg {
    width: 15px !important;
    height: 15px !important;
  }

  .mobile-bottom-tools .mobile-playback-tools .playback-control-btn.is-primary {
    background: var(--accent) !important;
    box-shadow: 0 8px 16px rgba(31, 122, 91, 0.18) !important;
  }

  .mobile-bottom-tools .mobile-playback-tools .playback-control-hint {
    font-size: 9px;
  }
}

/* ===== marketing home/library/profile mobile shell ===== */
@media (max-width: 859px) {
  .marketing-page .landing-shell,
  .marketing-page .profile-shell,
  .marketing-page .library-shell {
    width: min(100% - 24px, 520px);
    margin-right: auto;
    margin-left: auto;
  }

  .marketing-page .library-shell {
    padding-top: 8px;
    padding-bottom: 96px;
  }

}

@media (max-width: 390px) {
  .marketing-page .landing-shell,
  .marketing-page .profile-shell,
  .marketing-page .library-shell {
    width: min(100% - 20px, 500px);
  }
}

/* ===== home v2 targeted repair ===== */
@media (min-width: 860px) {
  .home-page .landing-shell {
    min-height: calc(100svh - 72px);
    grid-template-rows: minmax(420px, 1fr) auto;
    gap: clamp(18px, 2.4vh, 28px);
    padding-bottom: 32px;
  }

  .home-page .landing-hero {
    min-height: clamp(420px, 54vh, 620px);
  }

  .home-page .landing-feature-grid {
    gap: 16px;
    margin-top: 0;
  }

  .home-page .landing-feature-card {
    min-height: clamp(140px, 18vh, 190px);
    padding: 8px;
  }

  .home-page .landing-feature-card img {
    width: 96%;
    height: 92%;
    object-fit: contain;
  }
}

@media (max-width: 859px) {
  .marketing-page {
    padding-bottom: 88px;
  }

  .home-page .landing-shell {
    display: grid;
    grid-template-rows: auto auto auto;
    gap: 9px;
    min-height: calc(100svh - 88px);
    padding: 10px 0 10px;
  }

  .home-page .landing-hero {
    min-height: 0;
    border-radius: 22px;
    padding: 0;
    background: #f4efd9;
  }

  .home-page .landing-hero-art {
    display: block;
    width: 100%;
    height: clamp(300px, 40svh, 390px);
    margin: 0;
  }

  .home-page .landing-hero-art img {
    width: 100%;
    height: 100%;
    max-height: none;
    object-fit: contain;
    object-position: center;
  }

  .home-page .landing-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin-top: 0;
  }

  .home-page .landing-feature-card {
    min-height: clamp(108px, 14.5svh, 138px);
    border-radius: 16px;
    padding: 5px;
  }

  .home-page .landing-feature-card img {
    width: 96%;
    height: 94%;
    object-fit: contain;
  }

  .app-mobile-tabbar {
    position: fixed;
    right: 12px;
    bottom: max(10px, env(safe-area-inset-bottom));
    left: 12px;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    width: min(430px, calc(100vw - 24px));
    margin: 0 auto;
    border: 1px solid rgba(47, 111, 94, 0.11);
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.96);
    padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
    box-shadow: 0 16px 36px rgba(32, 35, 31, 0.13);
    backdrop-filter: blur(14px);
  }

  .app-mobile-tabbar a {
    display: grid;
    justify-items: center;
    gap: 3px;
    min-width: 0;
    border-radius: 14px;
    padding: 5px 2px;
    color: var(--muted);
    font-size: 11px;
    line-height: 1.15;
    white-space: nowrap;
  }

  .app-mobile-tabbar a.active {
    background: var(--accent-soft);
    color: var(--accent);
    font-weight: 800;
  }

  .app-mobile-tabbar svg {
    width: 19px;
    height: 19px;
  }
}

@media (max-width: 390px) {
  .home-page .landing-feature-grid {
    gap: 8px;
  }

  .home-page .landing-feature-card {
    min-height: clamp(96px, 13.5svh, 122px);
  }
}

/* ===== home product layout final pass ===== */
.profile-page .profile-membership-card {
  border: 0;
  background: transparent;
  box-shadow: none;
}

.profile-page .profile-membership-card img {
  border-radius: 18px;
}

@media (min-width: 860px) {
  .home-page .landing-shell {
    display: grid;
    grid-template-rows: minmax(300px, 1fr) auto;
    gap: clamp(16px, 2vh, 24px);
    min-height: calc(100svh - 72px);
    padding-top: 18px;
    padding-bottom: 32px;
  }

  .home-page .landing-hero {
    display: grid;
    grid-template-columns: minmax(330px, 0.42fr) minmax(420px, 0.58fr);
    align-items: center;
    gap: clamp(20px, 3vw, 48px);
    min-height: clamp(340px, 44vh, 520px);
    padding: clamp(28px, 4vw, 56px);
    background: linear-gradient(135deg, #fffdf0 0%, #eef3dd 100%);
  }

  .home-page .landing-hero-copy {
    max-width: 520px;
    padding: 0;
  }

  .home-page .landing-eyebrow {
    display: block;
    margin: 0 0 10px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 800;
  }

  .home-page .landing-hero h1 {
    margin-bottom: 14px;
    font-size: clamp(42px, 4vw, 64px);
    line-height: 1.04;
    letter-spacing: 0;
  }

  .home-page .landing-hero p {
    max-width: 34em;
    margin-bottom: 22px;
    color: #465248;
    font-size: 16px;
    line-height: 1.85;
  }

  .home-page .landing-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 46px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    padding: 0 24px;
    font-weight: 900;
    box-shadow: 0 12px 26px rgba(47, 111, 94, 0.2);
  }

  .home-page .landing-hero-art {
    width: 100%;
    height: 100%;
    min-height: 260px;
  }

  .home-page .landing-hero-art img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center right;
  }

  .home-page .landing-feature-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }

  .home-page .landing-feature-card {
    min-height: clamp(130px, 16vh, 170px);
    padding: 8px;
  }

  .home-page .landing-feature-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
}

@media (max-width: 859px) {
  .home-page .landing-shell {
    grid-template-rows: auto auto auto;
    gap: 10px;
    min-height: auto;
    padding-top: 10px;
    padding-bottom: 88px;
  }

  .home-page .landing-hero {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
    max-height: none;
    overflow: hidden;
    padding: 14px 14px 16px;
    border-radius: 22px;
    background: linear-gradient(135deg, #fffdf0 0%, #eef3dd 100%);
  }

  .home-page .landing-hero-art {
    order: -1;
    width: 100%;
    height: clamp(118px, 18svh, 172px);
  }

  .home-page .landing-hero-art img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
  }

  .home-page .landing-hero-copy {
    padding: 0;
    text-align: left;
  }

  .home-page .landing-eyebrow {
    display: none;
  }

  .home-page .landing-hero h1 {
    margin-bottom: 6px;
    font-size: clamp(27px, 7vw, 34px);
    line-height: 1.08;
  }

  .home-page .landing-hero p {
    margin-bottom: 10px;
    color: #465248;
    font-size: clamp(12px, 3.35vw, 14px);
    line-height: 1.65;
  }

  .home-page .landing-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    padding: 0 18px;
    font-size: 14px;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(47, 111, 94, 0.18);
  }

  .home-page .landing-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .home-page .landing-feature-card {
    min-height: clamp(100px, 13.2svh, 124px);
    padding: 5px;
  }

  .home-page .landing-feature-card img {
    width: 100%;
    height: 100%;
    object-fit: contain;
  }
}

/* ===== final home + profile product polish ===== */
.home-page.marketing-page,
.profile-page.marketing-page {
  overflow-x: hidden;
}

.home-page .landing-shell {
  width: min(1180px, calc(100vw - 48px));
  margin: 0 auto;
}

.home-page .landing-hero {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(47, 111, 94, 0.12);
  box-shadow: 0 20px 54px rgba(32, 35, 31, 0.09);
}

.home-page .landing-hero::before {
  content: "";
  position: absolute;
  inset: auto -8% -32% 42%;
  height: 58%;
  border-radius: 999px 999px 0 0;
  background:
    radial-gradient(circle at 68% 42%, rgba(247, 218, 134, 0.32), transparent 24%),
    linear-gradient(100deg, rgba(126, 159, 116, 0.1), rgba(47, 111, 94, 0.18));
  pointer-events: none;
}

.landing-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.landing-tag-row span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid rgba(47, 111, 94, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: #425044;
  padding: 0 13px;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(32, 35, 31, 0.04);
}

.landing-hero-note {
  color: #5a665b !important;
}

.landing-study-panel {
  position: relative;
  z-index: 1;
  display: grid;
  align-content: start;
  gap: 18px;
  min-height: 310px;
  border-radius: 32px;
  background:
    radial-gradient(circle at 16% 16%, rgba(248, 222, 151, 0.22), transparent 28%),
    linear-gradient(145deg, #221d16 0%, #0f201f 45%, #162b25 100%);
  padding: 30px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12), 0 24px 48px rgba(32, 35, 31, 0.18);
}

.study-panel-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.86);
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.study-panel-badge span {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #f1c767;
  box-shadow: 0 0 0 5px rgba(241, 199, 103, 0.16);
}

.study-video-card {
  display: grid;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  background: rgba(9, 23, 25, 0.72);
  padding: 16px;
}

.study-video-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  color: rgba(255, 255, 255, 0.76);
  font-size: 13px;
  font-weight: 800;
}

.study-video-head div {
  display: inline-flex;
  gap: 6px;
}

.study-video-head b {
  display: inline-grid;
  place-items: center;
  min-width: 36px;
  height: 28px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.82);
  font-size: 12px;
}

.study-subtitle-line {
  display: grid;
  gap: 5px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  padding: 14px 16px;
}

.study-subtitle-line.active {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 4px 0 0 #f1d68b;
}

.study-subtitle-line strong {
  font-size: 17px;
  letter-spacing: 0;
}

.study-subtitle-line small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.study-play-button {
  position: absolute;
  right: 26px;
  bottom: 24px;
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  background: linear-gradient(145deg, #f6f1ce, #d8c37d);
  color: #2f4c3e;
  box-shadow: 0 16px 32px rgba(0, 0, 0, 0.22);
}

.study-play-button svg {
  width: 24px;
  height: 24px;
}

.home-page .landing-feature-card {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  grid-template-rows: auto auto;
  align-items: center;
  gap: 4px 12px;
  overflow: hidden;
  border: 1px solid rgba(47, 111, 94, 0.11);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 12px 30px rgba(32, 35, 31, 0.06);
}

.home-page .landing-feature-card::after {
  content: "";
  position: absolute;
  right: -18px;
  bottom: -24px;
  width: 84px;
  height: 84px;
  border-radius: 999px;
  background: rgba(47, 111, 94, 0.06);
}

.landing-feature-icon {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: var(--accent-soft);
  color: var(--accent);
}

.landing-feature-icon svg {
  width: 25px;
  height: 25px;
}

.home-page .landing-feature-card strong {
  position: relative;
  z-index: 1;
  color: var(--text);
  font-size: 16px;
  line-height: 1.2;
}

.home-page .landing-feature-card small {
  position: relative;
  z-index: 1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.landing-feature-arrow {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 999px;
  background: rgba(47, 111, 94, 0.08);
  color: var(--accent);
  font-size: 14px;
  font-weight: 900;
}

.profile-page .profile-shell {
  gap: 12px;
}

.profile-page .profile-user-card,
.profile-page .profile-menu {
  box-shadow: 0 10px 26px rgba(32, 35, 31, 0.055);
}

.profile-page .profile-membership-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  overflow: hidden;
  margin-top: 0;
  border: 1px solid rgba(47, 111, 94, 0.13);
  border-radius: 22px;
  background:
    radial-gradient(circle at 88% 36%, rgba(239, 200, 112, 0.28), transparent 24%),
    linear-gradient(135deg, #fff8df 0%, #edf5e7 100%);
  padding: 18px;
  box-shadow: 0 14px 34px rgba(32, 35, 31, 0.07);
}

.profile-page .profile-membership-card p {
  margin: 0 0 8px;
  color: #5d674f;
  font-size: 13px;
  font-weight: 800;
}

.profile-page .profile-membership-card h2 {
  margin: 0 0 8px;
  color: #20231f;
  font-size: 24px;
  line-height: 1.1;
}

.profile-page .profile-membership-card span {
  color: #63705d;
  font-size: 13px;
}

.profile-page .membership-badge {
  position: relative;
  z-index: 1;
  min-width: 72px;
  height: 32px;
  background: rgba(47, 111, 94, 0.12);
  color: var(--accent) !important;
}

.membership-crown {
  position: absolute;
  right: 18px;
  bottom: 9px;
  width: 86px;
  height: 62px;
  opacity: 0.2;
}

.membership-crown::before {
  content: "";
  position: absolute;
  inset: 8px 8px 10px;
  background: #d7a64f;
  clip-path: polygon(0 100%, 0 42%, 22% 62%, 38% 18%, 55% 62%, 78% 34%, 100% 62%, 100% 100%);
}

.membership-crown::after {
  content: "";
  position: absolute;
  right: 16px;
  bottom: 5px;
  left: 16px;
  height: 8px;
  border-radius: 999px;
  background: #d7a64f;
}

@media (min-width: 860px) {
  .home-page .landing-shell {
    display: grid;
    grid-template-rows: minmax(340px, 48vh) auto;
    gap: 18px;
    min-height: calc(100svh - 72px);
    padding-top: 18px;
    padding-bottom: 28px;
  }

  .home-page .landing-hero {
    display: grid;
    grid-template-columns: minmax(360px, 0.46fr) minmax(420px, 0.54fr);
    align-items: center;
    gap: clamp(24px, 4vw, 54px);
    min-height: 0;
    padding: clamp(28px, 4vw, 52px);
    background: linear-gradient(135deg, #fffdf0 0%, #eef3dd 100%);
  }

  .home-page .landing-hero-copy {
    position: relative;
    z-index: 1;
    max-width: 540px;
    padding: 0;
  }

  .home-page .landing-hero h1 {
    margin-bottom: 14px;
    font-size: clamp(44px, 4.3vw, 66px);
    line-height: 1.04;
    letter-spacing: 0;
  }

  .home-page .landing-hero p {
    max-width: 35em;
    margin-bottom: 16px;
    color: #465248;
    font-size: 16px;
    line-height: 1.85;
  }

  .home-page .landing-hero .landing-hero-note {
    margin-bottom: 22px;
  }

  .home-page .landing-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    padding: 0 26px;
    font-weight: 900;
    box-shadow: 0 12px 26px rgba(47, 111, 94, 0.2);
  }

  .home-page .landing-feature-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
  }

  .home-page .landing-feature-card {
    min-height: clamp(118px, 15vh, 148px);
    padding: 18px;
  }
}

@media (max-width: 859px) {
  .home-page .landing-shell {
    width: min(100% - 24px, 520px);
    display: grid;
    grid-template-rows: auto auto auto;
    gap: 10px;
    min-height: auto;
    padding-top: 8px;
    padding-bottom: 92px;
  }

  .home-page .landing-hero {
    display: grid;
    gap: 12px;
    max-height: none;
    padding: 12px;
    border-radius: 24px;
    background: linear-gradient(180deg, #fffdf2 0%, #f0f5e7 100%);
  }

  .home-page .landing-hero-copy {
    display: grid;
    gap: 8px;
    text-align: left;
  }

  .home-page .landing-eyebrow {
    display: none;
  }

  .home-page .landing-hero h1 {
    margin: 0;
    font-size: clamp(31px, 8.2vw, 40px);
    line-height: 1.08;
  }

  .home-page .landing-hero p {
    margin: 0;
    color: #4f5b51;
    font-size: clamp(13px, 3.35vw, 15px);
    line-height: 1.58;
  }

  .landing-tag-row {
    gap: 7px;
    margin: 2px 0;
  }

  .landing-tag-row span {
    min-height: 28px;
    padding: 0 11px;
    font-size: 12px;
  }

  .home-page .landing-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    margin-top: 2px;
    border-radius: 999px;
    background: var(--accent);
    color: #fff;
    padding: 0 18px;
    font-size: 15px;
    font-weight: 900;
    box-shadow: 0 10px 22px rgba(47, 111, 94, 0.18);
  }

  .landing-study-panel {
    order: -1;
    min-height: 168px;
    gap: 10px;
    border-radius: 22px;
    padding: 14px;
  }

  .study-panel-badge {
    padding: 7px 11px;
    font-size: 10px;
    letter-spacing: 0.08em;
  }

  .study-video-card {
    gap: 8px;
    border-radius: 18px;
    padding: 10px;
  }

  .study-video-head {
    font-size: 11px;
  }

  .study-video-head b {
    min-width: 30px;
    height: 23px;
    font-size: 10px;
  }

  .study-subtitle-line {
    gap: 3px;
    border-radius: 14px;
    padding: 9px 11px;
  }

  .study-subtitle-line strong {
    font-size: 14px;
  }

  .study-subtitle-line small {
    font-size: 11px;
  }

  .study-subtitle-line + .study-subtitle-line {
    display: none;
  }

  .study-play-button {
    right: 14px;
    bottom: 14px;
    width: 44px;
    height: 44px;
  }

  .study-play-button svg {
    width: 18px;
    height: 18px;
  }

  .home-page .landing-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .home-page .landing-feature-card {
    min-height: 104px;
    grid-template-columns: auto minmax(0, 1fr);
    padding: 12px;
    border-radius: 18px;
  }

  .landing-feature-icon {
    width: 40px;
    height: 40px;
    border-radius: 13px;
  }

  .landing-feature-icon svg {
    width: 22px;
    height: 22px;
  }

  .home-page .landing-feature-card strong {
    font-size: 14px;
  }

  .home-page .landing-feature-card small {
    font-size: 11px;
  }

  .landing-feature-arrow {
    top: 10px;
    right: 10px;
    width: 21px;
    height: 21px;
    font-size: 12px;
  }

  .profile-page .profile-shell {
    width: min(100% - 24px, 520px);
    gap: 10px;
    padding-top: 12px;
    padding-bottom: 92px;
  }

  .profile-topbar {
    margin-bottom: 2px;
  }

  .profile-topbar h1 {
    font-size: 24px;
  }

  .profile-user-card {
    padding: 14px;
  }

  .profile-avatar {
    width: 52px;
    height: 52px;
  }

  .profile-page .profile-membership-card {
    padding: 15px;
    border-radius: 20px;
  }

  .profile-page .profile-membership-card h2 {
    font-size: 21px;
  }

  .profile-menu {
    margin-top: 0;
  }

  .profile-menu-item {
    min-height: 50px;
    padding: 11px 12px;
  }

  .profile-logout-button {
    margin-top: 2px;
  }
}

@media (max-width: 390px) {
  .home-page .landing-shell {
    width: min(100% - 20px, 520px);
  }

  .home-page .landing-hero {
    padding: 10px;
  }

  .landing-study-panel {
    min-height: 154px;
  }

  .home-page .landing-feature-card {
    min-height: 96px;
    padding: 10px;
  }
}

/* ===== final product polish pass ===== */
.home-page .landing-feature-card {
  grid-template-rows: auto auto auto;
  align-content: center;
}

.landing-feature-tags {
  position: relative;
  z-index: 1;
  grid-column: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.landing-feature-tags b {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border-radius: 999px;
  background: rgba(47, 111, 94, 0.08);
  color: var(--accent);
  padding: 0 9px;
  font-size: 11px;
  font-weight: 800;
}

.profile-sync-note {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(47, 111, 94, 0.1);
  border-radius: 18px;
  background: rgba(237, 242, 234, 0.68);
  padding: 14px 16px;
  color: var(--accent-strong);
  box-shadow: 0 10px 24px rgba(32, 35, 31, 0.04);
}

.profile-sync-note strong {
  font-size: 14px;
}

.profile-sync-note span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

@media (min-width: 860px) {
  .home-page .landing-shell {
    grid-template-rows: minmax(330px, 46vh) auto;
    gap: 14px;
    padding-bottom: 22px;
  }

  .home-page .landing-hero {
    padding: clamp(26px, 3.7vw, 48px);
  }

  .home-page .landing-feature-card {
    min-height: clamp(150px, 17vh, 178px);
    grid-template-columns: 54px minmax(0, 1fr);
    gap: 6px 14px;
    padding: 20px 18px;
  }

  .landing-feature-icon {
    width: 54px;
    height: 54px;
  }

  .home-page .landing-feature-card strong {
    font-size: 17px;
  }

  .home-page .landing-feature-card small {
    max-width: 18em;
    font-size: 13px;
    line-height: 1.5;
  }

  .profile-page .profile-shell {
    width: min(520px, calc(100vw - 48px));
    gap: 12px;
    padding-top: 22px;
    padding-bottom: 28px;
  }
}

@media (max-width: 859px) {
  .home-page .landing-hero {
    align-content: start;
    gap: 10px;
  }

  .home-page .landing-hero-copy {
    gap: 7px;
  }

  .home-page .landing-hero .landing-hero-note {
    margin-bottom: 4px;
  }

  .home-page .landing-cta {
    margin-top: 6px;
  }

  .home-page .landing-feature-card {
    min-height: 126px;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 5px 10px;
    align-content: center;
  }

  .landing-feature-tags {
    gap: 5px;
    margin-top: 2px;
  }

  .landing-feature-tags b {
    min-height: 20px;
    padding: 0 7px;
    font-size: 10px;
  }

  .profile-page .profile-shell {
    display: flex;
    flex-direction: column;
    min-height: calc(100svh - 84px);
    gap: 11px;
  }

  .profile-page .profile-user-card,
  .profile-page .profile-membership-card,
  .profile-page .profile-menu,
  .profile-page .profile-logout-button,
  .profile-page .profile-sync-note {
    width: 100%;
  }

  .profile-page .profile-membership-card {
    min-height: 112px;
    padding: 16px;
  }

  .profile-page .profile-membership-card p {
    margin-bottom: 6px;
  }

  .profile-page .profile-membership-card h2 {
    margin-bottom: 6px;
  }

  .profile-menu-item {
    min-height: 52px;
  }

  .profile-logout-button {
    min-height: 44px;
  }

  .profile-sync-note {
    margin-top: auto;
    min-height: 66px;
  }
}

@media (max-width: 430px) {
  .home-page .landing-shell {
    gap: 9px;
  }

  .landing-study-panel {
    min-height: 160px;
  }

  .home-page .landing-feature-card {
    min-height: 118px;
  }

  .home-page .landing-feature-card small {
    line-height: 1.34;
  }
}

/* ===== final detail polish: feature modules and vertical balance ===== */
.marketing-toast {
  position: fixed;
  left: 50%;
  bottom: max(96px, calc(24px + env(safe-area-inset-bottom)));
  z-index: 1000;
  max-width: min(420px, calc(100vw - 32px));
  transform: translate(-50%, 14px);
  border: 1px solid rgba(47, 111, 94, 0.12);
  border-radius: 999px;
  background: rgba(32, 35, 31, 0.9);
  color: #fff;
  padding: 11px 18px;
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  box-shadow: 0 16px 34px rgba(32, 35, 31, 0.18);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.marketing-toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.home-page .landing-feature-card {
  appearance: none;
  cursor: pointer;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto auto;
  align-content: stretch;
  text-align: left;
  font: inherit;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.home-page .landing-feature-card:hover {
  transform: translateY(-2px);
  border-color: rgba(47, 111, 94, 0.2);
  box-shadow: 0 18px 34px rgba(32, 35, 31, 0.09);
}

.home-page .landing-feature-card:focus-visible {
  outline: 3px solid rgba(47, 111, 94, 0.24);
  outline-offset: 3px;
}

.home-page .landing-feature-card .landing-feature-icon {
  grid-row: 1 / span 2;
}

.home-page .landing-feature-card strong {
  grid-column: 2;
  align-self: end;
  letter-spacing: 0;
}

.home-page .landing-feature-card small {
  grid-column: 2 / 4;
  min-height: 2.8em;
}

.home-page .landing-feature-tags {
  grid-column: 1 / 4;
  align-self: center;
}

.feature-preview {
  position: relative;
  z-index: 1;
  grid-column: 1 / 4;
  display: grid;
  overflow: hidden;
  min-height: 58px;
  border: 1px solid rgba(47, 111, 94, 0.09);
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(237, 242, 234, 0.9), rgba(255, 253, 245, 0.94));
  padding: 10px 12px;
}

.feature-preview-subtitle,
.feature-preview-card {
  gap: 3px;
}

.feature-preview b {
  color: #25302a;
  font-size: 12px;
  line-height: 1.25;
  letter-spacing: 0;
}

.feature-preview small {
  min-height: 0 !important;
  color: #667264 !important;
  font-size: 11px !important;
  line-height: 1.35 !important;
}

.feature-preview-card::before {
  content: "";
  width: 36px;
  height: 5px;
  border-radius: 999px;
  background: rgba(47, 111, 94, 0.22);
}

.feature-preview-loop {
  grid-template-columns: repeat(4, 1fr) 34px;
  align-items: end;
  gap: 6px;
}

.feature-preview-loop i {
  display: block;
  border-radius: 999px;
  background: rgba(47, 111, 94, 0.22);
}

.feature-preview-loop i:nth-child(1) { height: 20px; }
.feature-preview-loop i:nth-child(2) { height: 34px; }
.feature-preview-loop i:nth-child(3) { height: 26px; }
.feature-preview-loop i:nth-child(4) { height: 42px; }

.feature-preview-loop em {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-style: normal;
}

.feature-preview-loop svg {
  width: 18px;
  height: 18px;
}

.feature-preview-materials {
  min-height: 58px;
}

.feature-preview-materials i {
  position: absolute;
  top: 14px;
  display: block;
  width: 52px;
  height: 34px;
  border: 1px solid rgba(47, 111, 94, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 8px 18px rgba(32, 35, 31, 0.05);
}

.feature-preview-materials i:nth-child(1) {
  left: 12px;
  transform: rotate(-5deg);
}

.feature-preview-materials i:nth-child(2) {
  left: 50%;
  transform: translateX(-50%);
}

.feature-preview-materials i:nth-child(3) {
  right: 12px;
  transform: rotate(5deg);
}

@media (min-width: 860px) {
  .home-page .landing-shell {
    gap: 12px;
  }

  .home-page .landing-feature-card {
    min-height: clamp(198px, 22vh, 232px);
    padding: 18px;
  }
}

@media (max-width: 859px) {
  .home-page .landing-shell {
    padding-top: 18px;
    padding-bottom: 78px;
    gap: 8px;
  }

  .home-page .landing-hero {
    gap: 9px;
  }

  .landing-study-panel {
    min-height: 176px;
  }

  .home-page .landing-feature-grid {
    gap: 9px;
  }

  .home-page .landing-feature-card {
    min-height: 148px;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 4px 9px;
    padding: 10px;
  }

  .home-page .landing-feature-card .landing-feature-icon {
    width: 38px;
    height: 38px;
  }

  .home-page .landing-feature-card strong {
    font-size: 13px;
  }

  .home-page .landing-feature-card small {
    min-height: 3.4em;
    font-size: 10.5px;
  }

  .feature-preview {
    min-height: 44px;
    border-radius: 12px;
    padding: 7px 9px;
  }

  .feature-preview b {
    font-size: 10.5px;
  }

  .feature-preview small {
    font-size: 9.5px !important;
  }

  .feature-preview-loop {
    grid-template-columns: repeat(4, 1fr) 28px;
    gap: 5px;
  }

  .feature-preview-loop em {
    width: 28px;
    height: 28px;
  }

  .feature-preview-loop i:nth-child(1) { height: 14px; }
  .feature-preview-loop i:nth-child(2) { height: 26px; }
  .feature-preview-loop i:nth-child(3) { height: 19px; }
  .feature-preview-loop i:nth-child(4) { height: 31px; }

  .feature-preview-materials i {
    top: 10px;
    width: 42px;
    height: 28px;
  }

  .profile-page .profile-shell {
    padding-top: 20px;
    gap: 10px;
  }

  .profile-page .profile-sync-note {
    padding: 13px 15px;
  }
}

@media (max-width: 390px) {
  .home-page .landing-feature-card {
    min-height: 140px;
  }

  .home-page .landing-feature-card small {
    font-size: 10px;
  }
}

/* ===== mobile interaction hotfix: keep pages scrollable and fixed bars non-blocking ===== */
@media (max-width: 859px) {
  html,
  body {
    height: auto !important;
    min-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  #app,
  .marketing-page,
  .shell,
  .detail-shell,
  .learning-home-shell,
  .library-shell,
  .profile-shell,
  .favorites-page {
    min-height: 100dvh;
    overflow: visible !important;
    -webkit-overflow-scrolling: touch;
  }

  .marketing-page,
  .detail-shell,
  .learning-home-shell,
  .library-shell,
  .profile-shell {
    padding-bottom: calc(104px + env(safe-area-inset-bottom)) !important;
  }

  .lesson-shell {
    height: auto !important;
    min-height: 100dvh !important;
    max-height: none !important;
    overflow: visible !important;
    padding-bottom: calc(116px + env(safe-area-inset-bottom)) !important;
  }

  .lesson-shell .learning-layout,
  .lesson-shell .player-column,
  .lesson-shell .subtitle-panel {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    overflow: visible !important;
  }

  .lesson-shell .subtitle-list {
    min-height: 220px !important;
    max-height: min(560px, calc(100dvh - 430px)) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
    padding-bottom: calc(126px + env(safe-area-inset-bottom)) !important;
  }

  .exercise-layout,
  .content-stack,
  .fill-practice-layout,
  .fill-question-pane,
  .dictation-question-pane {
    overflow: visible !important;
    -webkit-overflow-scrolling: touch;
  }

  .fill-question-pane,
  .dictation-question-pane {
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;
    padding-bottom: calc(116px + env(safe-area-inset-bottom)) !important;
  }

  .app-mobile-tabbar {
    pointer-events: auto;
  }

  .drawer-backdrop[hidden],
  .profile-settings-backdrop[hidden],
  .lesson-overlay[hidden] {
    display: none !important;
    pointer-events: none !important;
  }

  .lesson-overlay {
    touch-action: manipulation;
  }
}

/* ===== mobile library UX + compact lesson layout ===== */
.course-card {
  position: relative;
  display: grid;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}

.course-card-main-link {
  display: grid;
  color: inherit;
  text-decoration: none;
}

.course-cover-wrap {
  position: relative;
  overflow: hidden;
  display: block;
  aspect-ratio: 16 / 10;
  background:
    linear-gradient(135deg, rgba(47, 111, 94, 0.08), rgba(247, 233, 161, 0.22)),
    var(--soft);
}

.course-cover-wrap::after {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  place-items: center;
  color: rgba(47, 111, 94, 0.55);
  content: "英语影读社";
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
}

.course-cover-wrap img {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.course-cover-wrap.cover-failed img,
.course-cover-wrap img.cover-failed {
  opacity: 0;
  visibility: hidden;
}

.course-duration-badge {
  position: absolute;
  right: 8px;
  bottom: 8px;
  border-radius: 999px;
  background: rgba(20, 24, 22, 0.76);
  padding: 3px 7px;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.course-favorite-toggle {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 3;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.68);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  color: #2b342f;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.14);
}

.course-favorite-toggle svg {
  width: 21px;
  height: 21px;
}

.course-favorite-toggle.active {
  color: #d99a00;
}

.course-card .course-cta {
  text-decoration: none;
}

.course-description {
  display: -webkit-box;
  white-space: normal !important;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.mode-button svg {
  width: 19px;
  height: 19px;
}

@media (max-width: 768px) {
  .library-page .course-grid,
  .favorites-page .course-grid {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  .library-page .course-card,
  .favorites-page .learning-course-card {
    border-radius: 8px;
  }

  .library-page .course-card img,
  .favorites-page .learning-course-card img {
    aspect-ratio: 16 / 9 !important;
  }

  .library-page .course-body {
    gap: 6px;
    padding: 12px 13px 13px;
  }

  .library-page .course-title-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
  }

  .library-page .course-body h2 {
    min-height: 0;
    font-size: 15px;
    line-height: 1.25;
  }

  .library-page .course-body p {
    font-size: 12px;
  }

  .library-page .tag-row {
    gap: 5px;
  }

  .library-page .tag-row span {
    padding: 3px 7px;
    font-size: 11px;
  }

  .library-page .course-cta {
    margin-top: 2px;
    padding: 6px 10px;
    font-size: 12px;
  }

}

/* AI voice score polished modal and mobile sheet */
.segment-actions .segment-action-btn.ai-score-action,
.lesson-shell .segment-actions .ai-score-action {
  width: auto !important;
  min-width: 112px !important;
  height: 32px !important;
  margin-left: 6px !important;
  padding: 0 11px !important;
  border: 1px solid rgba(47, 111, 94, 0.14) !important;
  border-radius: 999px !important;
  background: rgba(47, 111, 94, 0.10) !important;
  color: var(--accent-strong) !important;
  box-shadow: none !important;
  font-size: 12px !important;
  font-weight: 780 !important;
  white-space: nowrap !important;
}

.segment-actions .segment-action-btn.ai-score-action,
.lesson-shell .segment-actions .ai-score-action,
.current-score-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.segment-actions .segment-action-btn.ai-score-action .speech-score-action-svg,
.lesson-shell .segment-actions .ai-score-action .speech-score-action-svg,
.current-score-actions .speech-score-action-svg {
  width: 14px;
  height: 14px;
  color: currentColor;
}

.current-score-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 12px;
}

.current-score-actions button {
  min-height: 38px;
  border: 1px solid rgba(47, 111, 94, 0.16);
  border-radius: 999px;
  background: var(--accent);
  padding: 8px 14px;
  color: #fff;
  font-weight: 850;
  box-shadow: 0 8px 18px rgba(47, 111, 94, 0.16);
}

.speech-score-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 12px;
  background: rgba(32, 35, 31, 0.28);
  backdrop-filter: blur(4px);
  pointer-events: auto;
}

.speech-score-dialog {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  width: min(760px, calc(100vw - 56px));
  max-height: min(600px, calc(100vh - 84px));
  border: 1px solid rgba(47, 111, 94, 0.12);
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 251, 0.98), rgba(250, 251, 246, 0.98));
  padding: 0;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(32, 35, 31, 0.18);
  pointer-events: auto;
}

.speech-score-scroll {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.speech-score-sheet-handle {
  display: none;
}

.speech-score-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 20px 8px;
}

.speech-score-topbar > span {
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--accent-soft);
  padding: 5px 12px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 850;
}

.speech-score-close {
  position: relative;
  z-index: 3;
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: rgba(47, 111, 94, 0.08);
  color: #21332d;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  pointer-events: auto;
}

.speech-score-close:hover {
  background: rgba(47, 111, 94, 0.14);
}

.speech-score-main {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) 252px;
  grid-template-areas:
    "heading score"
    "wave score"
    "controls score"
    "status score"
    "live score";
  gap: 12px 20px;
  min-height: 0;
  padding: 8px 20px 14px;
}

.speech-score-heading {
  grid-area: heading;
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 0;
}

.speech-score-heading h2 {
  margin: 0;
  color: #18231f;
  font-size: 21px;
  line-height: 1.3;
  letter-spacing: 0;
}

.speech-score-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.42;
}

.speech-score-wave {
  grid-area: wave;
  display: flex;
  align-items: center;
  width: min(100%, 500px);
  min-width: 360px;
  gap: 4px;
  height: 48px;
  padding: 0 2px;
}

.speech-score-wave span {
  display: block;
  width: 4px;
  height: var(--wave-height);
  border-radius: 999px;
  background: rgba(47, 111, 94, 0.3);
  transform-origin: center;
}

.speech-score-dialog[data-score-state="recording"] .speech-score-wave span {
  animation: speechWavePulse 0.92s ease-in-out infinite;
}

.speech-score-dialog[data-score-state="recording"] .speech-score-wave span:nth-child(2n) {
  animation-delay: 0.12s;
}

.speech-score-dialog[data-score-state="recording"] .speech-score-wave span:nth-child(3n) {
  animation-delay: 0.24s;
}

@keyframes speechWavePulse {
  0%, 100% { transform: scaleY(0.62); opacity: 0.58; }
  50% { transform: scaleY(1.12); opacity: 1; }
}

.speech-score-controls {
  grid-area: controls;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  padding: 0;
}

.speech-score-action,
.speech-score-footer button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 850;
  line-height: 1;
  cursor: pointer;
}

.speech-score-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 16px;
  font-size: 15px;
  line-height: 1;
}

.speech-score-action-svg {
  display: block;
  width: 14px;
  height: 14px;
  color: currentColor;
}

.speech-score-action-secondary,
.speech-score-footer button:first-child {
  border: 1px solid rgba(47, 111, 94, 0.34);
  background: rgba(255, 255, 255, 0.82);
  color: var(--accent-strong);
}

.speech-score-action-secondary.is-active {
  background: rgba(47, 111, 94, 0.1);
  box-shadow: inset 0 0 0 1px rgba(47, 111, 94, 0.14);
}

.speech-score-action-primary,
.speech-score-footer button:last-child {
  border: 1px solid rgba(17, 97, 66, 0.1);
  background: linear-gradient(180deg, #1d7b5c, #106446);
  color: #fff;
  box-shadow: 0 12px 24px rgba(16, 100, 70, 0.18);
}

.speech-score-action:disabled {
  cursor: not-allowed;
  opacity: 0.54;
}

.speech-score-status {
  grid-area: status;
  margin: 0;
  border: 0;
  border-radius: 12px;
  background: rgba(226, 238, 232, 0.56);
  padding: 8px 11px;
  color: var(--accent-strong);
  font-size: 13px;
  line-height: 1.35;
}

.speech-score-live {
  grid-area: live;
  min-height: 40px;
  margin: 0;
  border: 1px dashed rgba(47, 111, 94, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.58);
  padding: 8px 11px;
  color: var(--muted);
  font-size: 13px;
}

.speech-score-score-panel {
  grid-area: score;
  min-width: 0;
}

.speech-score-ring-card,
.speech-score-empty {
  display: grid;
  align-content: center;
  justify-items: center;
  min-height: 196px;
  height: 100%;
  border: 1px solid rgba(47, 111, 94, 0.12);
  border-radius: 15px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(244, 249, 246, 0.92));
  padding: 15px;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.speech-score-ring {
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  margin-bottom: 10px;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, var(--paper) 0 56%, transparent 57%),
    conic-gradient(var(--accent) var(--score-deg, 0deg), rgba(47, 111, 94, 0.16) 0);
}

.speech-score-ring span {
  color: #17231f;
  font-size: 37px;
  font-weight: 900;
  line-height: 1;
}

.speech-score-ring em {
  margin-top: -20px;
  color: var(--muted);
  font-size: 13px;
  font-style: normal;
  font-weight: 750;
}

.speech-score-ring-card strong,
.speech-score-empty strong {
  color: #17231f;
  font-size: 21px;
  font-weight: 900;
}

.speech-score-ring-card p,
.speech-score-empty span {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.speech-score-dimensions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  margin-top: 10px;
}

.speech-score-dimensions span {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  border-radius: 999px;
  background: rgba(47, 111, 94, 0.08);
  padding: 3px 7px;
  color: #40534c;
  font-size: 11px;
  font-weight: 760;
  line-height: 1.2;
}

.speech-score-dimensions strong {
  color: var(--accent-strong);
  font-weight: 900;
}

.speech-score-ring-card small {
  display: block;
  margin-top: 12px;
  border-top: 1px solid rgba(47, 111, 94, 0.1);
  padding-top: 11px;
  color: #40534c;
  font-size: 13px;
  line-height: 1.5;
}

.speech-score-empty-warning {
  border-color: rgba(188, 118, 35, 0.2);
  background: rgba(255, 246, 222, 0.78);
}

.speech-score-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  min-height: 112px;
  margin: 0 20px 12px;
  overflow: hidden;
  border: 1px solid rgba(47, 111, 94, 0.12);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.72);
}

.speech-score-highlight {
  min-width: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  padding: 13px;
}

.speech-score-highlight + .speech-score-highlight {
  border-left: 1px solid rgba(47, 111, 94, 0.1);
}

.speech-score-highlight h3 {
  margin: 0 0 8px;
  color: #17231f;
  font-size: 14px;
}

.speech-score-highlight p {
  margin: 0;
  font-size: 13px;
  line-height: 1.75;
}

.speech-score-highlight .matched {
  display: inline-block;
  margin: 2px;
  border-radius: 7px;
  background: rgba(47, 111, 94, 0.12);
  padding: 2px 7px;
  color: var(--accent-strong);
  font-weight: 800;
}

.speech-score-highlight .missed {
  display: inline-block;
  margin: 2px;
  border-radius: 7px;
  background: rgba(220, 67, 75, 0.09);
  padding: 2px 7px;
  color: #c83d48;
  font-weight: 800;
  text-decoration: none;
}

.speech-score-highlight .unmatched,
.speech-score-muted-text {
  color: #899189;
}

.speech-score-footer {
  position: static;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  gap: 12px;
  margin: 0;
  border-top: 0;
  background: transparent;
  padding: 0 96px 18px;
  box-shadow: none;
}

.speech-score-footer [data-speech-clear] {
  min-width: 98px;
  border: 0;
  background: transparent;
  color: #6d7771;
  box-shadow: none;
  font-size: 13px;
}

.speech-score-footer [data-speech-clear]:hover {
  color: var(--accent-strong);
  background: rgba(47, 111, 94, 0.07);
}

@media (min-width: 769px) {
  .speech-score-dialog {
    width: min(720px, calc(100vw - 56px));
    max-height: min(560px, calc(100vh - 72px));
  }

  .speech-score-topbar {
    padding: 13px 18px 6px;
  }

  .speech-score-main {
    grid-template-columns: minmax(0, 1.32fr) 224px;
    gap: 8px 16px;
    padding: 6px 18px 10px;
  }

  .speech-score-heading {
    gap: 4px;
  }

  .speech-score-heading h2 {
    font-size: 19px;
    line-height: 1.24;
  }

  .speech-score-heading p {
    font-size: 12.5px;
    line-height: 1.32;
  }

  .speech-score-wave {
    width: min(100%, 430px);
    min-width: 320px;
    height: 42px;
  }

  .speech-score-controls {
    gap: 10px;
  }

  .speech-score-action,
  .speech-score-footer button {
    min-height: 38px;
    padding-inline: 12px;
    font-size: 13px;
  }

  .speech-score-status {
    padding: 6px 10px;
    font-size: 12.5px;
    line-height: 1.28;
  }

  .speech-score-live {
    min-height: 34px;
    max-height: 48px;
    overflow-y: auto;
    padding: 7px 10px;
    font-size: 12.5px;
    line-height: 1.4;
  }

  .speech-score-score-panel {
    align-self: stretch;
  }

  .speech-score-ring-card,
  .speech-score-empty {
    min-height: 168px;
    height: 100%;
    padding: 12px;
  }

  .speech-score-ring {
    width: 88px;
    height: 88px;
    margin-bottom: 7px;
    background:
      radial-gradient(circle at center, var(--paper) 0 52%, transparent 53%),
      conic-gradient(var(--accent) var(--score-deg, 0deg), rgba(47, 111, 94, 0.16) 0);
  }

  .speech-score-ring span {
    font-size: 32px;
  }

  .speech-score-ring em {
    margin-top: -17px;
    font-size: 11px;
  }

  .speech-score-ring-card strong,
  .speech-score-empty strong {
    font-size: 18px;
    line-height: 1.14;
  }

  .speech-score-ring-card p,
  .speech-score-empty span {
    margin-top: 5px;
    font-size: 12px;
    line-height: 1.25;
  }

  .speech-score-dimensions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
    gap: 4px 5px;
    margin-top: 7px;
  }

  .speech-score-dimensions span {
    justify-content: center;
    min-width: 0;
    padding: 3px 5px;
    font-size: 11px;
    line-height: 1.15;
    white-space: nowrap;
  }

  .speech-score-dimensions strong {
    flex: 0 0 auto;
    font-size: 11.5px;
  }

  .speech-score-ring-card small {
    display: -webkit-box;
    overflow: hidden;
    margin-top: 8px;
    padding-top: 8px;
    font-size: 12px;
    line-height: 1.35;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .speech-score-details {
    min-height: 98px;
    max-height: 118px;
    margin: 0 18px 10px;
  }

  .speech-score-highlight {
    max-height: 118px;
    overflow-y: auto;
    padding: 10px 11px;
  }

  .speech-score-highlight h3 {
    margin-bottom: 5px;
    font-size: 13px;
  }

  .speech-score-highlight p {
    font-size: 12.5px;
    line-height: 1.52;
  }

  .speech-score-highlight .matched,
  .speech-score-highlight .missed {
    margin: 1px;
    border-radius: 6px;
    padding: 1px 5px;
  }

  .speech-score-footer {
    gap: 10px;
    padding: 0 88px 14px;
  }
}

@media (max-width: 768px) {
  .segment-actions .segment-action-btn.ai-score-action,
  .lesson-shell .segment-actions .ai-score-action {
    width: auto !important;
    min-width: 112px !important;
    height: 32px !important;
    padding: 0 10px !important;
    font-size: 12px !important;
  }

  .speech-score-overlay {
    align-items: flex-end;
    justify-content: center;
    padding: 12px 12px max(12px, env(safe-area-inset-bottom));
    background: rgba(32, 35, 31, 0.18);
  }

  .speech-score-dialog {
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    width: min(430px, calc(100vw - 24px));
    height: auto;
    max-height: min(56vh, 510px);
    border-radius: 22px;
    padding-bottom: 0 !important;
  }

  .speech-score-sheet-handle {
    display: block;
    width: 66px;
    height: 4px;
    margin: 6px auto 0;
    border-radius: 999px;
    background: rgba(32, 35, 31, 0.22);
  }

  .speech-score-topbar {
    min-height: 36px;
    padding: 5px 14px 3px;
  }

  .speech-score-topbar > span {
    padding: 4px 10px;
    font-size: 12px;
  }

  .speech-score-close {
    width: 34px;
    height: 34px;
    margin: -4px -4px -4px 0;
    background: rgba(255, 255, 255, 0.74);
    box-shadow: 0 6px 16px rgba(32, 35, 31, 0.08);
    z-index: 5;
    pointer-events: auto;
  }

  .speech-score-scroll {
    overflow-y: auto;
    padding-bottom: 4px;
  }

  .speech-score-main {
    grid-template-columns: minmax(0, 1.12fr) minmax(132px, 0.94fr);
    grid-template-areas:
      "heading heading"
      "wave score"
      "controls controls"
      "status status"
      "live live";
    gap: 3px 7px;
    overflow: visible;
    padding: 2px 13px 5px 14px;
  }

  .speech-score-heading h2 {
    display: -webkit-box;
    overflow: hidden;
    font-size: 16.5px;
    line-height: 1.18;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .speech-score-heading {
    gap: 3px;
  }

  .speech-score-heading p {
    display: -webkit-box;
    overflow: hidden;
    font-size: 12.5px;
    line-height: 1.18;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 1;
  }

  .speech-score-wave {
    width: 100%;
    min-width: 0;
    height: 44px;
    gap: 3px;
    margin: 4px 0 0;
    align-self: center;
    justify-content: space-between;
    padding: 3px 0 1px;
  }

  .speech-score-wave span {
    width: 3px;
    min-height: 8px;
    opacity: 0.78;
  }

  .speech-score-controls {
    gap: 7px;
  }

  .speech-score-action,
  .speech-score-footer button {
    min-height: 36px;
    border-radius: 13px;
    padding: 0 10px;
    font-size: 12.5px;
  }

  .speech-score-status {
    overflow: hidden;
    padding: 4px 9px;
    font-size: 12px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .speech-score-live {
    min-height: 42px;
    max-height: 58px;
    overflow-y: auto;
    padding: 7px 10px;
    font-size: 12px;
    line-height: 1.45;
    white-space: normal;
  }

  .speech-score-live:empty {
    display: none;
  }

  .speech-score-score-panel {
    align-self: center;
    justify-self: stretch;
    padding-right: 1px;
  }

  .speech-score-ring-card,
  .speech-score-empty {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: center;
    align-items: center;
    align-content: center;
    min-height: 76px;
    height: auto;
    gap: 0;
    border-color: rgba(47, 111, 94, 0.18);
    padding: 5px 6px;
    border-radius: 13px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(239, 248, 243, 0.96));
    text-align: center;
  }

  .speech-score-ring {
    width: 43px;
    height: 43px;
    margin: 0 0 2px;
    background:
      radial-gradient(circle at center, var(--paper) 0 51%, transparent 52%),
      conic-gradient(var(--accent) var(--score-deg, 0deg), rgba(47, 111, 94, 0.18) 0);
  }

  .speech-score-ring span {
    font-size: 18px;
  }

  .speech-score-ring em {
    margin-top: -11px;
    font-size: 8px;
  }

  .speech-score-ring-card strong,
  .speech-score-empty strong {
    display: block;
    overflow: hidden;
    max-width: 100%;
    font-size: 13px;
    line-height: 1.08;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .speech-score-ring-card p,
  .speech-score-empty span,
  .speech-score-ring-card small {
    display: block;
    overflow: hidden;
    max-width: 100%;
    margin-top: 1px;
    font-size: 9.5px;
    line-height: 1.16;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .speech-score-dimensions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    width: 100%;
    gap: 2px 4px;
    margin-top: 2px;
  }

  .speech-score-dimensions span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    overflow: visible;
    min-width: 0;
    padding: 2px 4px;
    font-size: 9.5px;
    line-height: 1.15;
    white-space: nowrap;
    text-overflow: clip;
  }

  .speech-score-dimensions strong {
    flex: 0 0 auto;
    font-size: 10px;
  }

  .speech-score-ring-card small {
    display: none;
  }

  .speech-score-details {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 3px;
    min-height: 0;
    margin: 0 14px 5px;
    overflow: visible;
    border: 0;
    background: transparent;
  }

  .speech-score-highlight {
    min-height: 58px;
    max-height: 70px;
    overflow-y: auto;
    border: 1px solid rgba(47, 111, 94, 0.12);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.78);
    padding: 6px 8px;
  }

  .speech-score-highlight + .speech-score-highlight {
    border-left: 1px solid rgba(47, 111, 94, 0.12);
  }

  .speech-score-highlight h3 {
    margin-bottom: 3px;
    font-size: 11px;
  }

  .speech-score-highlight p {
    font-size: 11px;
    line-height: 1.5;
  }

  .speech-score-highlight .matched,
  .speech-score-highlight .missed {
    display: inline;
    margin: 0;
    border-radius: 0;
    background: transparent;
    padding: 0 1px;
  }

  .speech-score-highlight .matched {
    color: var(--accent-strong);
    font-weight: 760;
  }

  .speech-score-highlight .missed {
    color: #c83d48;
    font-weight: 820;
  }

  .speech-score-footer {
    position: sticky;
    bottom: 0;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    gap: 7px;
    padding: 6px 14px calc(6px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 251, 0.96);
    box-shadow: 0 -12px 28px rgba(32, 35, 31, 0.08);
  }

  .speech-score-footer [data-speech-clear] {
    min-width: 70px;
    padding-inline: 8px;
    font-size: 12px;
  }
}

@media (max-width: 390px) {
  .speech-score-dialog {
    width: calc(100vw - 20px);
    max-height: min(56vh, 510px);
  }

  .speech-score-main {
    grid-template-columns: minmax(0, 1.02fr) minmax(132px, 0.98fr);
    padding-inline: 12px;
    gap: 4px 7px;
  }

  .speech-score-ring-card,
  .speech-score-empty {
    min-height: 76px;
    padding-inline: 5px;
  }

  .speech-score-dimensions {
    gap: 3px;
  }

  .speech-score-details {
    margin-inline: 12px;
  }

  .speech-score-footer [data-speech-clear] {
    min-width: 58px;
    min-height: 36px;
  }
}

/* ===== final mobile library single-column override ===== */
@media (max-width: 768px) {
  .library-page section.course-grid[aria-label="课程库"],
  .library-page .course-grid,
  .library-shell section.course-grid[aria-label="课程库"],
  .library-shell .course-grid,
  .library-page .course-list,
  .library-shell .course-list {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
    width: 100% !important;
    max-width: none !important;
  }

  .library-page section.course-grid[aria-label="课程库"] > .course-card,
  .library-page .course-grid > .course-card,
  .library-shell section.course-grid[aria-label="课程库"] > .course-card,
  .library-shell .course-grid > .course-card,
  .library-page .course-list > .course-card,
  .library-shell .course-list > .course-card {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
  }

  .library-page .course-card {
    display: grid !important;
    grid-template-columns: 1fr !important;
  }

  .library-page .course-cover-wrap {
    position: relative !important;
    display: block !important;
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    overflow: hidden !important;
  }

  .library-page .course-cover-wrap img,
  .library-page .course-card > img {
    display: block !important;
    width: 100% !important;
    aspect-ratio: 16 / 9 !important;
    object-fit: cover !important;
  }

  .library-page .course-favorite-toggle {
    position: absolute !important;
    top: 10px !important;
    right: 10px !important;
    z-index: 5 !important;
    display: grid !important;
    width: 40px !important;
    height: 40px !important;
    place-items: center !important;
    color: #2b342f !important;
  }

  .library-page .course-favorite-toggle.active {
    color: #d99a00 !important;
  }

  .library-page .course-duration-badge {
    position: absolute !important;
    right: 10px !important;
    bottom: 10px !important;
    z-index: 4 !important;
    background: rgba(20, 24, 22, 0.78) !important;
    color: #fff !important;
  }

  .library-page .course-body {
    gap: 4px !important;
    padding: 10px 11px 11px !important;
  }

  .library-page .course-title-row {
    gap: 6px !important;
  }

  .library-page .course-body h2 {
    line-height: 1.2 !important;
  }

  .library-page .course-body p {
    line-height: 1.28 !important;
  }

  .library-page .tag-row {
    gap: 4px !important;
    margin-top: 0 !important;
  }

  .library-page .tag-row span {
    padding: 2px 6px !important;
  }

  .library-page .course-cta {
    margin-top: 0 !important;
    padding: 5px 9px !important;
  }
}

/* ===== final mobile library top spacing trim ===== */
@media (max-width: 768px) {
  body.filter-drawer-open {
    overflow: hidden !important;
  }

  body.filter-drawer-open .app-mobile-tabbar {
    display: none !important;
  }

  .library-page .library-shell,
  .library-page .home-shell.library-shell,
  .marketing-page .library-shell {
    padding-top: 16px !important;
    gap: 12px !important;
  }

  .library-page .library-masthead,
  .library-page .masthead.library-masthead {
    gap: 8px !important;
    margin-bottom: 0 !important;
  }

  .library-page .library-masthead h1 {
    margin-bottom: 4px !important;
    line-height: 1.08 !important;
  }

  .library-page .library-masthead .tagline {
    margin-bottom: 0 !important;
    line-height: 1.35 !important;
  }

  .library-page .home-actions {
    gap: 8px !important;
    margin-top: 0 !important;
  }

  .library-page .search {
    min-height: 0 !important;
  }

  .library-page .search input {
    min-height: 40px !important;
    padding-top: 9px !important;
    padding-bottom: 9px !important;
  }

  .library-page section.course-grid[aria-label="课程库"],
  .library-page .course-grid {
    margin-top: 12px !important;
  }
}

/* ===== final mobile library hard top compression ===== */
@media (max-width: 768px) {
  .library-page .library-shell,
  .library-page .home-shell.library-shell,
  .marketing-page .library-shell {
    padding-top: calc(72px + env(safe-area-inset-top, 0px)) !important;
    gap: 8px !important;
  }

  .library-page .library-masthead,
  .library-page .masthead.library-masthead {
    gap: 4px !important;
    margin-bottom: 0 !important;
  }

  .library-page .library-masthead h1 {
    margin-bottom: 2px !important;
    line-height: 1.02 !important;
  }

  .library-page .library-masthead .tagline {
    margin-bottom: 4px !important;
    line-height: 1.25 !important;
  }

  .library-page .home-actions {
    gap: 8px !important;
    margin-top: 0 !important;
    margin-bottom: 6px !important;
  }

  .library-page section.course-grid[aria-label="课程库"],
  .library-page .course-grid,
  .library-shell section.course-grid[aria-label="课程库"],
  .library-shell .course-grid {
    grid-template-columns: 1fr !important;
    margin-top: 0 !important;
    gap: 10px !important;
  }

  .library-page .library-count {
    margin: 0 !important;
    color: var(--muted) !important;
    font-size: 12px !important;
    line-height: 1.25 !important;
  }

  .library-page .library-refresh-status {
    margin: 0 !important;
    color: var(--accent) !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
  }

  .library-page .filter-drawer {
    top: 0 !important;
    bottom: auto !important;
    z-index: 120 !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    overflow: hidden !important;
    overscroll-behavior: contain !important;
  }

  .library-page .drawer-backdrop {
    z-index: 119 !important;
  }

  .library-page .filter-drawer form {
    display: flex !important;
    height: 100% !important;
    max-height: 100dvh !important;
    flex-direction: column !important;
    gap: 10px !important;
    overflow-y: auto !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 14px 14px calc(96px + env(safe-area-inset-bottom)) !important;
  }

  .library-page .drawer-actions {
    position: fixed !important;
    right: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    z-index: 121 !important;
    width: min(86vw, 360px) !important;
    margin: 0 !important;
    padding: 10px 14px calc(12px + env(safe-area-inset-bottom)) !important;
    border-top: 1px solid var(--line) !important;
    background: var(--paper) !important;
    box-shadow: 0 -10px 24px rgba(30, 35, 31, 0.12) !important;
  }

  .library-page .library-empty-state {
    display: grid !important;
    gap: 10px !important;
    justify-items: center !important;
    padding: 22px 12px !important;
  }

  .library-page .library-empty-state button {
    min-height: 38px !important;
    border-color: var(--accent) !important;
    background: var(--accent) !important;
    color: #fff !important;
  }
}

/* ===== mobile library sticky tool strip ===== */
@media (max-width: 768px) {
  .library-page .library-masthead,
  .library-page .masthead.library-masthead {
    display: contents !important;
  }

  .library-page .library-shell,
  .library-page .home-shell.library-shell,
  .marketing-page .library-shell {
    padding-top: calc(52px + env(safe-area-inset-top, 0px)) !important;
  }

  .library-page .library-masthead > div,
  .library-page .masthead.library-masthead > div {
    display: grid !important;
    gap: 4px !important;
  }

  .library-page .home-actions {
    position: fixed !important;
    top: env(safe-area-inset-top, 0px) !important;
    right: 0 !important;
    left: 0 !important;
    z-index: 58 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto auto !important;
    align-items: center !important;
    gap: 6px !important;
    margin: 0 !important;
    padding: 6px 14px 7px !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(47, 111, 94, 0.1) !important;
    border-radius: 0 !important;
    background: rgba(245, 246, 243, 0.98) !important;
    box-shadow: 0 4px 12px rgba(47, 111, 94, 0.06) !important;
    backdrop-filter: blur(12px);
  }

  .library-page .search {
    width: 100% !important;
    min-width: 0 !important;
    flex: none !important;
  }

  .library-page .search input {
    height: 34px !important;
    min-height: 34px !important;
    border-radius: 999px !important;
    padding: 6px 11px !important;
    font-size: 13px !important;
    background: rgba(255, 255, 252, 0.96) !important;
  }

  .library-page .my-learning-link {
    display: none !important;
  }

  .library-page .filter-toggle,
  .library-page .library-theme-toggle {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    height: 34px !important;
    min-height: 34px !important;
    border-radius: 999px !important;
    font-size: 12px !important;
    font-weight: 800 !important;
    box-shadow: none !important;
  }

  .library-page .filter-toggle,
  .library-page .library-theme-toggle {
    width: 34px !important;
    padding: 0 !important;
    color: var(--accent) !important;
    background: rgba(237, 242, 234, 0.86) !important;
    border: 1px solid rgba(47, 111, 94, 0.12) !important;
  }

  .library-page .filter-toggle svg,
  .library-page .library-theme-toggle svg {
    width: 17px !important;
    height: 17px !important;
  }

  .library-page .filter-toggle span {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    clip: rect(0 0 0 0) !important;
    white-space: nowrap !important;
  }
}

/* ===== final mobile lesson controls polish ===== */
@media (max-width: 768px) {
  #mobileThemeToggle,
  .mobile-learn-topbar #mobileThemeToggle {
    color: var(--accent) !important;
    display: inline-grid !important;
    place-items: center !important;
  }

  #mobileThemeToggle svg,
  .mobile-learn-topbar #mobileThemeToggle svg,
  .mode-button svg {
    display: block !important;
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    color: currentColor !important;
    fill: currentColor;
    stroke: currentColor;
  }

}

/* ===== final theme icon + desktop lesson alignment ===== */
.mode-button svg,
#themeToggle svg,
#mobileThemeToggle svg {
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  color: currentColor !important;
}

.mode-button svg circle,
.mode-button svg path,
#themeToggle svg circle,
#themeToggle svg path,
#mobileThemeToggle svg circle,
#mobileThemeToggle svg path {
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 1.9 !important;
  stroke-linecap: round !important;
}

.mode-button svg.sun-icon,
#themeToggle svg.sun-icon,
#mobileThemeToggle svg.sun-icon {
  width: 20px !important;
  height: 20px !important;
}

.mode-button svg.sun-icon .sun-core,
#themeToggle svg.sun-icon .sun-core,
#mobileThemeToggle svg.sun-icon .sun-core {
  fill: currentColor !important;
  stroke: currentColor !important;
  stroke-width: 2.1 !important;
}

.mode-button svg.sun-icon .sun-rays,
#themeToggle svg.sun-icon .sun-rays,
#mobileThemeToggle svg.sun-icon .sun-rays {
  fill: none !important;
  stroke: currentColor !important;
  stroke-width: 2.4 !important;
  stroke-linecap: round !important;
}

/* final desktop lesson stable layout */
@media (min-width: 860px) {
  .lesson-shell .learning-layout {
    grid-template-columns: minmax(0, 1.45fr) minmax(420px, 0.95fr) !important;
    grid-template-rows: auto auto auto auto auto auto auto !important;
    position: relative !important;
    gap: 8px 16px !important;
    align-items: start !important;
    align-content: start !important;
  }

  .lesson-shell .player-column,
  .lesson-shell .video-column,
  .lesson-shell .lesson-main-column {
    align-self: start !important;
    align-content: start !important;
    justify-content: flex-start !important;
  }

  .lesson-shell .player-column > video {
    grid-column: 1 !important;
    grid-row: 2 !important;
  }

  .lesson-shell .player-column > .desktop-playback-controls {
    grid-column: 1 !important;
    grid-row: 3 !important;
    justify-self: center !important;
    margin-top: 8px !important;
    margin-bottom: 0 !important;
  }

  .lesson-shell .player-column > .info-chips {
    grid-column: 1 !important;
    grid-row: 4 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  .lesson-shell .player-column > .desktop-tool-strip {
    grid-column: 1 !important;
    grid-row: 5 !important;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
  }

  .lesson-shell .player-column > .lesson-intro {
    grid-column: 1 !important;
    grid-row: 7 !important;
    margin-top: 4px !important;
    margin-bottom: 0 !important;
  }

  .lesson-shell .feature-dock {
    grid-column: 1 !important;
    grid-row: 6 !important;
    margin-top: 4px !important;
    padding-top: 0 !important;
    align-self: start !important;
    justify-self: stretch !important;
    transform: none !important;
  }

  .lesson-shell .feature-grid {
    align-content: start !important;
    align-self: start !important;
    gap: 7px !important;
  }

  .lesson-shell .subtitle-panel {
    grid-column: 2 !important;
    grid-row: 2 / 8 !important;
    position: absolute !important;
    inset: 0 0 auto 0 !important;
    align-self: start !important;
    justify-self: stretch !important;
    width: 100% !important;
    min-width: 420px !important;
    max-width: 540px !important;
    height: clamp(580px, 74vh, 740px) !important;
    max-height: clamp(580px, 74vh, 740px) !important;
    margin-top: 0 !important;
    padding-top: 8px !important;
    overflow: hidden !important;
  }

  .lesson-shell .subtitle-list {
    max-height: calc(100% - 42px) !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
    gap: 6px !important;
  }

  .lesson-shell .subtitle-item {
    padding: 7px 8px !important;
  }
}

/* final mobile compact subtitles */
@media (max-width: 768px) {
  .lesson-shell .subtitle-list {
    gap: 4px !important;
    padding-bottom: 82px !important;
    scroll-padding-top: 8px !important;
  }

  .lesson-shell .subtitle-item {
    gap: 4px !important;
    padding: 6px 7px !important;
    border-radius: 7px !important;
  }

  .lesson-shell .subtitle-main {
    gap: 3px !important;
  }

  .lesson-shell .subtitle-meta {
    gap: 4px !important;
    font-size: 10px !important;
  }

  .lesson-shell .subtitle-meta b {
    width: 18px !important;
    height: 18px !important;
    font-size: 10px !important;
  }

  .lesson-shell .subtitle-lines .line-en {
    margin-bottom: 2px !important;
    font-size: 13px !important;
    line-height: 1.34 !important;
  }

  .lesson-shell .subtitle-lines .line-zh {
    font-size: 11.5px !important;
    line-height: 1.32 !important;
  }

  .lesson-shell .core-term-tags {
    gap: 3px !important;
    margin-top: 2px !important;
  }

  .lesson-shell .core-term-chip {
    gap: 2px !important;
    padding: 1px 4px !important;
    border-radius: 999px !important;
    font-size: 10px !important;
    line-height: 1.25 !important;
  }

  .lesson-shell .core-term-chip small {
    font-size: 9px !important;
  }

  .lesson-shell .segment-actions {
    gap: 4px !important;
    margin-top: 2px !important;
  }

  .lesson-shell .segment-actions button {
    --btn-size: 28px !important;
    --icon-size: 14px !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
  }
}

/* subtitle visual system polish */
.subtitle-item {
  border-color: rgba(47, 111, 94, 0.12);
  border-radius: 12px;
  background: color-mix(in srgb, var(--paper) 84%, var(--soft));
  box-shadow: 0 8px 22px rgba(32, 35, 31, 0.045);
}

.subtitle-item.active {
  border-color: rgba(47, 111, 94, 0.48);
  background:
    linear-gradient(180deg, rgba(255, 252, 236, 0.98), rgba(239, 249, 235, 0.97)),
    radial-gradient(circle at 100% 0%, rgba(255, 224, 158, 0.26), transparent 34%);
  box-shadow:
    inset 3px 0 0 var(--accent),
    0 10px 26px rgba(47, 111, 94, 0.11);
}

.subtitle-meta {
  opacity: 0.78;
}

.subtitle-lines .line-en {
  color: var(--text);
  font-weight: 680;
  letter-spacing: 0;
}

.subtitle-lines .line-zh {
  color: color-mix(in srgb, var(--muted) 86%, var(--text));
  font-weight: 500;
}

.word-hit {
  border-radius: 7px;
  padding: 0 4px 1px;
  background:
    linear-gradient(180deg, rgba(255, 251, 219, 0.5), rgba(255, 233, 158, 0.72)),
    linear-gradient(90deg, rgba(190, 230, 194, 0.48), rgba(255, 219, 157, 0.4));
  box-shadow: 0 0 0 1px rgba(188, 143, 42, 0.14);
  text-decoration-line: underline;
  text-decoration-thickness: 1.75px;
  text-decoration-color: rgba(216, 128, 43, 0.66);
  text-underline-offset: 4px;
  text-decoration-skip-ink: auto;
}

.subtitle-item.active .word-hit {
  background:
    linear-gradient(180deg, rgba(255, 251, 218, 0.64), rgba(255, 222, 145, 0.78)),
    linear-gradient(90deg, rgba(177, 226, 188, 0.58), rgba(255, 211, 146, 0.5));
  box-shadow: 0 0 0 1px rgba(47, 111, 94, 0.16);
  text-decoration-color: rgba(47, 111, 94, 0.7);
}

.core-term-chip {
  border-color: rgba(47, 111, 94, 0.14);
  background: linear-gradient(180deg, rgba(255, 246, 203, 0.94), rgba(239, 247, 225, 0.92));
  box-shadow: 0 3px 10px rgba(47, 111, 94, 0.055);
  text-decoration: none;
}

.core-term-chip span,
.core-term-chip small {
  text-decoration: none;
}

.segment-actions .segment-action-btn {
  border-radius: 999px;
}

body[data-theme="dark"] .subtitle-item {
  border-color: rgba(177, 209, 192, 0.14);
  background: linear-gradient(180deg, rgba(39, 48, 43, 0.94), rgba(30, 38, 34, 0.94));
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.18);
}

body[data-theme="dark"] .subtitle-item.active {
  border-color: rgba(132, 196, 165, 0.56);
  background:
    linear-gradient(180deg, rgba(48, 74, 61, 0.94), rgba(30, 50, 42, 0.94)),
    radial-gradient(circle at 100% 0%, rgba(179, 125, 54, 0.18), transparent 36%);
  box-shadow:
    inset 3px 0 0 #82c9a7,
    0 12px 28px rgba(0, 0, 0, 0.28);
}

body[data-theme="dark"] .subtitle-lines .line-en {
  color: #f4f7f1;
}

body[data-theme="dark"] .subtitle-lines .line-zh,
body[data-theme="dark"] .subtitle-meta {
  color: #b7c2ba;
}

body[data-theme="dark"] .word-hit {
  background:
    linear-gradient(180deg, rgba(142, 109, 43, 0.58), rgba(94, 80, 35, 0.62)),
    linear-gradient(90deg, rgba(71, 120, 92, 0.46), rgba(134, 87, 43, 0.36));
  color: #fff5bd;
  box-shadow: 0 0 0 1px rgba(238, 211, 115, 0.24);
  text-decoration-color: rgba(238, 172, 92, 0.82);
}

body[data-theme="dark"] .subtitle-item.active .word-hit {
  background:
    linear-gradient(180deg, rgba(158, 119, 44, 0.72), rgba(105, 89, 38, 0.72)),
    linear-gradient(90deg, rgba(83, 143, 109, 0.56), rgba(151, 96, 45, 0.45));
  color: #fff6c8;
  text-decoration-color: rgba(151, 224, 181, 0.82);
}

body[data-theme="dark"] .core-term-chip {
  border-color: rgba(229, 201, 105, 0.2);
  background: linear-gradient(180deg, rgba(92, 80, 36, 0.76), rgba(48, 66, 52, 0.72));
  color: #f7f0c8;
  box-shadow: none;
}

body[data-theme="dark"] .core-term-chip small {
  color: #c1c8bf;
}

body[data-theme="dark"] .segment-actions .segment-action-btn:hover {
  background: rgba(132, 196, 165, 0.14);
}

body[data-theme="dark"] .segment-actions .loop-action.is-active {
  background: rgba(132, 196, 165, 0.18);
  color: #bfe6d2;
}

body[data-theme="dark"] .segment-actions .sentence-favorite-action.is-active {
  background: rgba(232, 184, 74, 0.16);
  color: #ffd986;
}

@media (max-width: 768px) {
  .lesson-shell .subtitle-list {
    gap: 7px !important;
  }

  .lesson-shell .subtitle-item {
    gap: 7px !important;
    padding: 9px 10px !important;
    border-radius: 12px !important;
  }

  .lesson-shell .subtitle-main {
    gap: 5px !important;
  }

  .lesson-shell .subtitle-meta {
    gap: 5px !important;
    font-size: 10px !important;
  }

  .lesson-shell .subtitle-meta b {
    width: 18px !important;
    height: 18px !important;
    font-size: 10px !important;
    opacity: 0.86 !important;
  }

  .lesson-shell .subtitle-lines .line-en {
    margin-bottom: 5px !important;
    font-size: 16px !important;
    line-height: 1.48 !important;
    font-weight: 710 !important;
  }

  .lesson-shell .subtitle-lines .line-zh {
    font-size: 13px !important;
    line-height: 1.48 !important;
  }

  .lesson-shell .core-term-row,
  .lesson-shell .core-term-tags {
    gap: 5px !important;
    margin-top: 4px !important;
  }

  .lesson-shell .core-term-chip {
    gap: 3px !important;
    padding: 3px 7px !important;
    font-size: 11px !important;
    line-height: 1.34 !important;
  }

  .lesson-shell .core-term-chip small {
    font-size: 10px !important;
  }

  .lesson-shell .segment-actions {
    gap: 6px !important;
    margin-top: 3px !important;
  }

  .lesson-shell .segment-actions .segment-action-btn,
  .lesson-shell .segment-actions button {
    --icon-size: 15px !important;
    width: 34px !important;
    height: 34px !important;
    min-width: 34px !important;
    min-height: 34px !important;
  }

  .lesson-shell .segment-actions .segment-action-btn.ai-score-action,
  .lesson-shell .segment-actions button.ai-score-action {
    width: auto !important;
    min-width: 116px !important;
    margin-left: 6px !important;
    padding: 0 10px !important;
    gap: 6px !important;
  }
}

/* word lookup card visual polish */
.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) {
  width: min(480px, 100%);
  border-color: rgba(47, 111, 94, 0.16);
  border-radius: 22px;
  background:
    radial-gradient(circle at 92% 6%, rgba(255, 228, 164, 0.26), transparent 32%),
    linear-gradient(180deg, rgba(255, 253, 244, 0.98), rgba(242, 248, 237, 0.98));
  padding: 22px;
  box-shadow: 0 22px 60px rgba(31, 73, 56, 0.16);
}

.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .modal-close {
  top: 14px;
  right: 14px;
  min-width: 38px;
  min-height: 38px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
}

.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .eyebrow {
  margin-bottom: 8px;
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .lookup-title {
  align-items: flex-start;
  gap: 14px;
  padding-right: 38px;
}

.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .lookup-title h2,
.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) > h2 {
  margin-bottom: 7px;
  color: var(--text);
  font-size: clamp(27px, 6vw, 36px);
  line-height: 1.08;
  letter-spacing: 0;
}

.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .lookup-kind {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  align-items: center;
  border: 1px solid rgba(47, 111, 94, 0.14);
  border-radius: 999px;
  background: rgba(237, 246, 236, 0.86);
  padding: 4px 9px;
  color: var(--accent) !important;
  font-size: 12px;
  line-height: 1;
}

.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .lookup-title button[data-speak] {
  width: 42px;
  height: 42px;
  border-color: rgba(47, 111, 94, 0.16);
  background: linear-gradient(180deg, #f8fff4, #e7f3e7);
  color: var(--accent);
  box-shadow: 0 8px 18px rgba(31, 107, 83, 0.1);
}

.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .phonetic {
  display: inline-flex;
  width: max-content;
  max-width: 100%;
  margin: 12px 0 10px;
  border: 1px solid rgba(47, 111, 94, 0.12);
  border-radius: 12px;
  background: rgba(255, 250, 230, 0.74);
  padding: 6px 10px;
  color: color-mix(in srgb, var(--muted) 82%, var(--text));
  font-size: 14px;
}

.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .lookup-meaning {
  border: 1px solid rgba(47, 111, 94, 0.12);
  border-radius: 14px;
  background: rgba(255, 250, 230, 0.72);
  padding: 12px;
  line-height: 1.72;
}

.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-detail-list {
  gap: 9px;
  margin: 12px 0;
}

.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-detail-list div {
  gap: 5px;
  border-color: rgba(47, 111, 94, 0.12);
  border-radius: 14px;
  background: rgba(255, 255, 250, 0.76);
  padding: 10px 12px;
  box-shadow: 0 5px 14px rgba(31, 73, 56, 0.04);
}

.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-detail-list dt {
  color: var(--accent);
  font-weight: 700;
}

.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-detail-list dd {
  line-height: 1.62;
}

.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-example {
  margin: 12px 0;
  border-left: 3px solid rgba(47, 111, 94, 0.34);
  border-radius: 14px;
  background: rgba(243, 248, 235, 0.86);
  padding: 11px 12px;
}

.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-example > span {
  display: inline-flex;
  margin-bottom: 6px;
  color: var(--accent);
  font-weight: 700;
}

.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-example blockquote {
  margin: 0 0 7px;
  color: var(--text);
  font-size: 15px;
  font-weight: 680;
  line-height: 1.58;
}

.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-example p {
  margin-bottom: 0;
  color: var(--muted);
}

.lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .modal-primary {
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  color: #fff;
  font-weight: 760;
  box-shadow: 0 12px 24px rgba(47, 111, 94, 0.2);
}

body[data-theme="dark"] .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) {
  border-color: rgba(132, 196, 165, 0.24);
  background:
    radial-gradient(circle at 92% 6%, rgba(166, 119, 53, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(36, 48, 42, 0.98), rgba(24, 33, 29, 0.98));
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.42);
}

body[data-theme="dark"] .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .modal-close,
body[data-theme="dark"] .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .lookup-title button[data-speak] {
  border-color: rgba(132, 196, 165, 0.24);
  background: rgba(132, 196, 165, 0.12);
  color: #dcebe2;
}

body[data-theme="dark"] .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .lookup-kind {
  border-color: rgba(132, 196, 165, 0.22);
  background: rgba(132, 196, 165, 0.12);
  color: #bfe6d2 !important;
}

body[data-theme="dark"] .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .phonetic,
body[data-theme="dark"] .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .lookup-meaning,
body[data-theme="dark"] .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-detail-list div {
  border-color: rgba(177, 209, 192, 0.14);
  background: rgba(255, 255, 255, 0.045);
  color: #edf1ec;
}

body[data-theme="dark"] .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .phonetic,
body[data-theme="dark"] .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-example p {
  color: #b7c2ba;
}

body[data-theme="dark"] .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-detail-list dt,
body[data-theme="dark"] .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-example > span {
  color: #bfe6d2;
}

body[data-theme="dark"] .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-example {
  border-left-color: rgba(132, 196, 165, 0.42);
  background: rgba(132, 196, 165, 0.08);
}

body[data-theme="dark"] .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-example blockquote {
  color: #f4f7f1;
}

@media (max-width: 859px) {
  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) {
    max-height: min(78dvh, calc(100dvh - 132px - env(safe-area-inset-bottom)));
    border-radius: 22px 22px 0 0;
    padding: 18px 16px calc(28px + env(safe-area-inset-bottom));
  }

  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .lookup-title h2,
  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) > h2 {
    font-size: 30px;
  }

  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .modal-primary {
    min-height: 46px;
  }
}

@media (max-width: 859px) {
  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) {
    max-height: min(72dvh, calc(100dvh - 152px - env(safe-area-inset-bottom)));
    padding: 14px 14px calc(22px + env(safe-area-inset-bottom));
  }

  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .modal-close {
    top: 10px;
    right: 10px;
    min-width: 34px;
    min-height: 34px;
  }

  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .eyebrow {
    margin-bottom: 5px;
  }

  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .lookup-title {
    gap: 10px;
    padding-right: 34px;
  }

  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .lookup-title h2,
  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) > h2 {
    margin-bottom: 5px;
    font-size: 26px;
  }

  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .lookup-title button[data-speak] {
    width: 38px;
    height: 38px;
  }

  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .lookup-kind {
    padding: 3px 8px;
    font-size: 11px;
  }

  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .phonetic {
    margin: 8px 0 7px;
    padding: 5px 9px;
    font-size: 13px;
  }

  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .lookup-meaning,
  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-detail-list div,
  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-example {
    padding: 8px 10px;
  }

  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-detail-list {
    gap: 7px;
    margin: 8px 0;
  }

  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-example {
    margin: 8px 0;
  }

  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .term-example blockquote {
    margin-bottom: 5px;
    font-size: 14px;
    line-height: 1.48;
  }

  .lookup-modal:not(.practice-menu-modal):not(.intensive-modal) .modal-primary {
    min-height: 42px;
    margin-top: 4px;
  }
}


/* continue learning polish */
.continue-learning-card {
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid rgba(47, 111, 94, 0.14);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(255, 253, 244, 0.96), rgba(239, 249, 234, 0.94)),
    var(--paper);
  box-shadow: 0 14px 34px rgba(31, 73, 56, 0.08);
}

.continue-learning-cover {
  width: 82px;
  height: 56px;
  overflow: hidden;
  border-radius: 14px;
  background: rgba(47, 111, 94, 0.08);
}

.continue-learning-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.continue-learning-cover span {
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.continue-learning-card .eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

.continue-learning-card h2 {
  margin: 0 0 5px;
  font-size: 19px;
  line-height: 1.22;
}

.continue-learning-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.continue-learning-card small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.continue-learning-action {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--accent);
  padding: 0 16px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.resume-learning-prompt {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin: 10px 0 0;
  padding: 10px 12px;
  border: 1px solid rgba(47, 111, 94, 0.14);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(255, 253, 244, 0.96), rgba(237, 248, 236, 0.96));
  box-shadow: 0 10px 24px rgba(31, 73, 56, 0.08);
}

.resume-learning-prompt strong {
  display: block;
  color: var(--text);
  font-size: 14px;
}

.resume-learning-prompt span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.resume-learning-prompt button {
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  padding: 7px 12px;
  color: #fff;
  font-weight: 800;
}

.resume-learning-prompt .resume-dismiss {
  background: rgba(47, 111, 94, 0.08);
  color: var(--accent);
  min-width: 30px;
  padding: 7px 9px;
}

.learning-progress-line {
  margin: 4px 0 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}

body[data-theme="dark"] .continue-learning-card,
body[data-theme="dark"] .resume-learning-prompt {
  border-color: rgba(126, 183, 159, 0.22);
  background: linear-gradient(135deg, rgba(31, 42, 36, 0.96), rgba(24, 35, 30, 0.96));
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.28);
}

body[data-theme="dark"] .continue-learning-card h2,
body[data-theme="dark"] .resume-learning-prompt strong {
  color: #f4f7f1;
}

body[data-theme="dark"] .continue-learning-card p,
body[data-theme="dark"] .continue-learning-card small,
body[data-theme="dark"] .resume-learning-prompt span {
  color: #b7c2ba;
}

body[data-theme="dark"] .continue-learning-action,
body[data-theme="dark"] .resume-learning-prompt button {
  background: #2f7f64;
}

body[data-theme="dark"] .resume-learning-prompt .resume-dismiss {
  background: rgba(126, 183, 159, 0.14);
  color: #bfe3d4;
}

@media (max-width: 768px) {
  .continue-learning-card {
    grid-template-columns: 70px minmax(0, 1fr);
    gap: 10px;
    margin: 12px 0;
    padding: 12px;
  }

  .continue-learning-cover {
    width: 70px;
    height: 52px;
  }

  .continue-learning-card h2 {
    font-size: 16px;
  }

  .continue-learning-card p,
  .continue-learning-card small {
    font-size: 11.5px;
  }

  .continue-learning-action {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 36px;
  }

  .resume-learning-prompt {
    margin-top: 8px;
    padding: 9px 10px;
  }

  .resume-learning-prompt strong {
    font-size: 13px;
  }

  .resume-learning-prompt span,
  .learning-progress-line {
    font-size: 11.5px;
  }
}

/* ===== responsive learning layout minimal overlap guard 20260802 v3 ===== */
/*
  只做防覆盖兜底，不重做页面设计：
  - 不改 lesson-shell 宽度
  - 不改 video 宽高 / aspect-ratio
  - 不重排桌面布局
  - 不重排功能按钮
  - 仅防止 subtitle-panel absolute/inset 覆盖视频
*/

@media (max-width: 859px) {
  .lesson-shell .subtitle-panel {
    position: static !important;
    inset: auto !important;
    top: auto !important;
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .lesson-shell .subtitle-list {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .mobile-bottom-tools {
    max-width: calc(100vw - 20px) !important;
  }
}

@media (min-width: 860px) and (max-width: 1024px) {
  .lesson-shell .player-column,
  .lesson-shell .subtitle-panel {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .lesson-shell .subtitle-panel {
    position: sticky !important;
    top: 12px !important;
    inset: auto !important;
    overflow: hidden !important;
    z-index: auto !important;
  }

  .lesson-shell .subtitle-list {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
  }
}

/* ===== responsive learning layout desktop absolute guard 20260802 v4 ===== */
/*
  只处理桌面/横屏平板 subtitle-panel 仍为 absolute 的风险。
  不改页面宽度、视频尺寸、按钮布局、课程结构。
*/
@media (min-width: 1025px) {
  .lesson-shell .subtitle-panel {
    position: sticky !important;
    top: 12px !important;
    inset: auto !important;
    align-self: start !important;
    justify-self: stretch !important;
    overflow: hidden !important;
    z-index: auto !important;
  }

  .lesson-shell .subtitle-list {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
  }
}
