:root {
  color-scheme: dark;
  --bg: #06111d;
  --bg-soft: #091828;
  --panel: #0d2032;
  --panel-raised: #112943;
  --panel-hover: #143451;
  --line: #1f425f;
  --line-soft: #173349;
  --text: #f7fbff;
  --muted: #8fa8bb;
  --muted-strong: #bed0dc;
  --cyan: #66d4ff;
  --cyan-strong: #25aeea;
  --gold: #ffd45a;
  --gold-strong: #f2b62b;
  --green: #7ee2a8;
  --red: #ff9b91;
  --shadow: 0 24px 60px rgba(0, 6, 16, 0.42);
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html,
body {
  min-width: 1024px;
  min-height: 100%;
  margin: 0;
  background:
    radial-gradient(circle at 14% 0%, rgba(49, 154, 219, 0.2), transparent 30%),
    radial-gradient(circle at 88% 8%, rgba(255, 202, 64, 0.09), transparent 24%),
    var(--bg);
  color: var(--text);
}

button,
input,
textarea,
select { font: inherit; }

button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: 0.48; }

a { color: inherit; }

.app-loading {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 34%, rgba(37, 174, 234, 0.2), transparent 28%),
    rgba(3, 12, 22, 0.82);
  backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.app-loading.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.app-loading-card,
.video-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  text-align: center;
}

.app-loading-card {
  min-width: 280px;
  padding: 26px 34px;
  border: 1px solid rgba(83, 177, 224, 0.34);
  border-radius: 22px;
  background: rgba(7, 25, 42, 0.9);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.46);
}

.app-loading-card img,
.video-loading img {
  width: 82px;
  height: 82px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}

.app-loading-card strong,
.video-loading strong {
  color: #f2fbff;
  font-size: 16px;
}

.app-loading-card > span,
.video-loading > span {
  color: #8faec2;
  font-size: 12px;
}

.video-loading {
  position: absolute;
  inset: 0;
  z-index: 5;
  justify-content: center;
  background: rgba(2, 8, 14, 0.58);
  backdrop-filter: blur(7px);
  transition: opacity 180ms ease;
}

.video-loading.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-dots {
  display: flex;
  gap: 7px;
  min-height: 8px;
}

.loading-dots i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  animation: loading-bounce 900ms infinite ease-in-out;
}

.loading-dots i:nth-child(2) { animation-delay: 140ms; }
.loading-dots i:nth-child(3) { animation-delay: 280ms; }

@keyframes loading-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.38; }
  30% { transform: translateY(-7px); opacity: 1; }
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 22px;
  z-index: 100;
  max-width: 460px;
  padding: 11px 15px;
  border: 1px solid #345d79;
  border-radius: 10px;
  color: var(--text);
  background: #10283d;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 160ms ease;
  font-size: 12px;
}

.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { border-color: #70423d; color: #ffd0cb; background: #321c1c; }

.primary-button,
.secondary-button,
.ghost-button,
.icon-button,
.tab-button {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel-raised);
  transition: 150ms ease;
}

.primary-button {
  border-color: #59cbff;
  border-radius: 10px;
  padding: 10px 16px;
  color: #042031;
  background: linear-gradient(135deg, #79dcff, #36baf2);
  font-weight: 800;
}

.primary-button:hover { transform: translateY(-1px); filter: brightness(1.06); }

.secondary-button,
.ghost-button {
  border-radius: 9px;
  padding: 9px 13px;
}

.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover { border-color: #3f7597; background: var(--panel-hover); }

.ghost-button { background: transparent; }

.icon-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  padding: 0;
}

.icon-button.active {
  border-color: #4ebde9;
  color: var(--gold);
  background: #12334a;
}

/* Login */
.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(540px, 1.1fr) 470px;
  align-items: center;
  gap: 70px;
  padding: 64px clamp(54px, 7vw, 130px);
  overflow: hidden;
}

.login-visual {
  position: relative;
  display: grid;
  place-items: center;
}

.login-visual::before,
.login-visual::after {
  content: "";
  position: absolute;
  border-radius: 40px;
  filter: blur(2px);
}

.login-visual::before {
  width: 76%;
  height: 76%;
  background: rgba(34, 139, 206, 0.2);
  transform: rotate(-5deg);
}

.login-visual::after {
  width: 55%;
  height: 55%;
  border: 1px solid rgba(255, 212, 90, 0.25);
  transform: rotate(8deg);
}

.login-visual img {
  position: relative;
  z-index: 1;
  width: min(620px, 100%);
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  box-shadow: 0 28px 80px rgba(0, 5, 15, 0.52);
}

.login-card {
  width: min(470px, 100%);
  padding: 34px;
  border: 1px solid #245171;
  border-radius: 24px;
  background:
    linear-gradient(145deg, rgba(26, 61, 91, 0.4), transparent 55%),
    rgba(9, 25, 42, 0.94);
  box-shadow: var(--shadow);
}

.login-card .login-logo {
  width: 260px;
  max-width: 100%;
  aspect-ratio: 1;
  display: block;
  margin-bottom: 24px;
  object-fit: cover;
  border-radius: 50%;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 30px;
  letter-spacing: -0.03em;
}

.login-card > p {
  margin: 0 0 24px;
  color: var(--muted);
  line-height: 1.7;
  font-size: 13px;
}

.field {
  display: grid;
  gap: 7px;
  margin-bottom: 15px;
}

.field label {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 650;
}

.field input,
.field textarea,
.field select,
.search-input {
  width: 100%;
  border: 1px solid #2a526f;
  border-radius: 10px;
  padding: 11px 13px;
  outline: 0;
  color: var(--text);
  background: #071521;
  font-size: 14px;
}

.field textarea { min-height: 92px; resize: vertical; line-height: 1.6; }
.field input:focus,
.field textarea:focus,
.search-input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(102, 212, 255, 0.08); }

.login-card .primary-button { width: 100%; margin-top: 4px; }
.login-note { margin-top: 18px; color: var(--muted); font-size: 11px; line-height: 1.7; }
.form-error { min-height: 18px; margin: 3px 0 9px; color: var(--red); font-size: 11px; }

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 5px;
  margin: 18px 0 16px;
  border: 1px solid #23465e;
  border-radius: 12px;
  padding: 4px;
  background: #091d2e;
}

.auth-tabs button {
  border: 0;
  border-radius: 8px;
  padding: 9px 8px;
  color: #8eabbd;
  background: transparent;
  font-weight: 700;
}

.auth-tabs button.active {
  color: #061b2b;
  background: linear-gradient(135deg, #75dcff, #42b9ef);
}

.invite-panel {
  margin-bottom: 22px;
  border: 1px solid #214761;
  border-radius: 16px;
  padding: 16px;
  background: rgba(9, 27, 44, 0.88);
}

.invite-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.invite-panel-head h2 { margin: 0; font-size: 17px; }
.invite-panel-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.invite-list { display: grid; gap: 7px; }

.invite-row {
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  border-top: 1px solid #183a52;
  padding-top: 8px;
}

.invite-row code { color: #86e0ff; font-size: 12px; }
.invite-row span { font-size: 10px; }
.invite-row span.unused { color: var(--green); }
.invite-row span.used { color: #718da1; }
.invite-empty { color: var(--muted); font-size: 11px; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 74px;
  border-bottom: 1px solid rgba(45, 86, 117, 0.72);
  background: rgba(5, 16, 28, 0.91);
  backdrop-filter: blur(18px);
}

.header-inner {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 0 clamp(22px, 3.5vw, 54px);
}

.logo-button {
  flex: none;
  border: 0;
  padding: 0;
  overflow: hidden;
  border-radius: 50%;
  background: transparent;
}

.logo-button img {
  width: 64px;
  height: 64px;
  display: block;
  object-fit: cover;
  border-radius: 50%;
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 5px;
}

.nav-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 0;
  border-radius: 9px;
  padding: 9px 13px;
  color: var(--muted-strong);
  background: transparent;
  font-size: 13px;
}

.nav-button > span {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 7px;
  color: #7eb6d7;
  background: rgba(64, 139, 181, 0.12);
  font-size: 14px;
}

.nav-button:hover,
.nav-button.active { color: var(--text); background: #112940; }

.nav-button.active > span {
  color: #062238;
  background: var(--cyan);
}

.header-spacer { flex: 1; }

.header-actions { display: flex; align-items: center; gap: 10px; }

.admin-badge {
  border: 1px solid rgba(255, 212, 90, 0.4);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--gold);
  background: rgba(255, 212, 90, 0.07);
  font-size: 10px;
  font-weight: 800;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted-strong);
  font-size: 12px;
}

.user-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: #102433;
  background: linear-gradient(145deg, var(--gold), #ffb52f);
  font-weight: 900;
}

/* Home */
.home-shell {
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 28px;
  padding: 24px clamp(22px, 2.7vw, 44px) 56px;
}

.study-column {
  position: sticky;
  top: 96px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.side-card {
  border: 1px solid var(--line-soft);
  border-radius: 20px;
  padding: 18px;
  background:
    linear-gradient(150deg, rgba(34, 108, 157, 0.13), transparent 50%),
    rgba(12, 31, 50, 0.9);
  box-shadow: 0 12px 30px rgba(0, 5, 15, 0.18);
}

.side-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.side-heading h2,
.side-heading h3 { margin: 0; font-size: 15px; }
.side-heading h2,
.side-heading h3 { display: flex; align-items: center; gap: 8px; }
.side-heading i {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #082131;
  background: var(--cyan);
  font: 900 12px "SF Mono", monospace;
  font-style: normal;
}
.side-heading span { color: var(--muted); font-size: 10px; }

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

.stat-item {
  border: 0;
  border-radius: 10px;
  padding: 7px 2px;
  background: transparent;
  text-align: center;
}

.stat-item strong {
  display: block;
  color: var(--cyan);
  font: 900 21px/1 "SF Pro Display", sans-serif;
  letter-spacing: -0.04em;
}

.stat-item span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 9px;
}

.stat-item[data-tone="done"] strong { color: var(--green); }
.stat-item[data-tone="pending"] strong { color: var(--gold); }
.stat-item[data-tone="favorite"] strong { color: #ff9bb4; }

.today-time {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 9px;
  border-top: 1px solid #173650;
  padding: 12px 2px 0;
  color: var(--muted);
  font-size: 11px;
}

.today-time strong { color: var(--gold); font-size: 13px; }

.calendar { margin-top: 2px; }

.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 11px;
  color: var(--muted-strong);
  font-size: 11px;
}

.calendar-title { display: grid; gap: 2px; text-align: center; }
.calendar-title strong { font-size: 12px; }
.calendar-title span { color: #718da1; font-size: 9px; }

.calendar-nav {
  width: 27px;
  height: 27px;
  border: 1px solid #234961;
  border-radius: 8px;
  color: #b8d1e1;
  background: #0b2033;
}

.calendar-nav:disabled { opacity: 0.28; }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
}

.calendar-week,
.calendar-day {
  display: grid;
  place-items: center;
  min-height: 29px;
  border-radius: 8px;
  font-size: 10px;
}

.calendar-week { color: #6f8ca1; }

.calendar-day {
  border: 1px solid transparent;
  color: var(--muted-strong);
  background: rgba(13, 37, 57, 0.58);
}

.calendar-day.empty { background: transparent; }
.calendar-day.today { border-color: #4a7894; color: white; }
.calendar-day.studied {
  color: #eaffff;
  background: color-mix(in srgb, #31b7e8 calc(35% + var(--study) * 55%), #153751);
  font-weight: 800;
}

.message-card { border-left: 3px solid #3caee0; }

.message-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.8;
}

.library-column { min-width: 0; }

.collection-intro {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.collection-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
  padding-top: 26px;
}

.collection-folder {
  position: relative;
  min-width: 0;
  padding: 13px;
  border: 1px solid #2b617f;
  border-radius: 7px 18px 18px 18px;
  color: white;
  background:
    linear-gradient(155deg, rgba(35, 125, 169, 0.24), transparent 48%),
    #0b2235;
  box-shadow: 0 18px 42px rgba(0, 4, 14, 0.28);
  text-align: left;
  cursor: pointer;
  transition: transform 240ms ease, border-color 240ms ease, box-shadow 240ms ease;
}

.collection-folder::before {
  content: "";
  position: absolute;
  left: -1px;
  bottom: calc(100% - 1px);
  width: 40%;
  height: 23px;
  border: 1px solid #2b617f;
  border-bottom: 0;
  border-radius: 12px 12px 0 0;
  background: #0f2b42;
}

.collection-folder:hover {
  border-color: #50bde8;
  transform: translateY(-4px);
  box-shadow: 0 18px 38px rgba(0, 7, 20, 0.42);
}

.collection-folder-tab {
  position: absolute;
  top: -8px;
  right: 13px;
  width: 36px;
  height: 15px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 5px 16px rgba(255, 184, 48, 0.3);
}

.collection-collage {
  position: relative;
  display: block;
  aspect-ratio: 16 / 10.3;
  overflow: hidden;
  border: 1px solid rgba(118, 193, 225, 0.2);
  border-radius: 12px;
  background:
    radial-gradient(circle at 20% 20%, rgba(77, 184, 225, 0.22), transparent 34%),
    linear-gradient(145deg, #102d44, #071724);
}

.collection-shot {
  position: absolute;
  z-index: 1;
  width: 28%;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  border: 2px solid rgba(222, 242, 250, 0.82);
  border-radius: 6px;
  background: #102d44;
  box-shadow: 0 4px 10px rgba(0, 5, 14, 0.42);
  transform: rotate(var(--rotate));
  transition: transform 240ms ease;
}

.collection-shot img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.collection-shot:nth-child(1) { left: 1%; top: 8%; z-index: 3; --rotate: -7deg; }
.collection-shot:nth-child(2) { left: 29%; top: 3%; width: 29%; z-index: 2; --rotate: 4deg; }
.collection-shot:nth-child(3) { right: 1%; top: 10%; z-index: 4; --rotate: -3deg; }
.collection-shot:nth-child(4) { left: 7%; top: 34%; width: 29%; z-index: 5; --rotate: 5deg; }
.collection-shot:nth-child(5) { left: 36%; top: 29%; width: 28%; z-index: 6; --rotate: -5deg; }
.collection-shot:nth-child(6) { right: 4%; top: 37%; z-index: 4; --rotate: 7deg; }
.collection-shot:nth-child(7) { left: 3%; top: 64%; z-index: 4; --rotate: 4deg; }
.collection-shot:nth-child(8) { left: 33%; top: 61%; width: 29%; z-index: 5; --rotate: -6deg; }
.collection-shot:nth-child(9) { right: 2%; top: 65%; z-index: 3; --rotate: 5deg; }

.collection-folder:hover .collection-shot {
  transform: rotate(calc(var(--rotate) * 0.35)) translateY(-3px);
}

.collection-cover-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.72);
  font: 900 30px "SF Pro Display", sans-serif;
}

.collection-folder-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 3px 7px;
  padding: 12px 2px 2px;
}

.collection-folder-title {
  grid-column: 1 / -1;
  min-height: 32px;
  overflow: hidden;
  font: 800 clamp(13px, 1.05vw, 16px)/1.25 "SF Pro Display", sans-serif;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.collection-folder-meta {
  grid-column: 1;
  color: #85a4b8;
  font-size: 9px;
}

.collection-folder-enter {
  grid-column: 2;
  grid-row: 2;
  align-self: end;
  color: var(--cyan);
  font-size: 9px;
  font-weight: 800;
}

.collection-shell {
  width: min(1500px, calc(100% - 48px));
  margin: 0 auto;
  padding: 30px 0 70px;
}

.collection-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
  border-bottom: 1px solid #1c4058;
  padding: 8px 2px 22px;
}

.collection-header > div { text-align: right; }
.collection-header h1 { margin: 3px 0 5px; font-size: clamp(28px, 3.5vw, 46px); }
.collection-header p { margin: 0; color: var(--muted); font-size: 12px; }

.collection-kicker {
  color: var(--cyan);
  font: 800 9px "SF Pro Display", sans-serif;
  letter-spacing: 0.16em;
}

.collection-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #2a526e;
  border-radius: 999px;
  padding: 10px 15px;
  color: #c5dce9;
  background: #0c2234;
  font-size: 12px;
  font-weight: 800;
}

.collection-back:hover { border-color: var(--cyan); color: var(--cyan); }

.hero-banner {
  width: 100%;
  aspect-ratio: 2172 / 724;
  max-height: 620px;
  display: block;
  padding: 0;
  border: 1px solid #1d5276;
  border-radius: 21px;
  background: #061522;
  overflow: hidden;
  cursor: pointer;
  box-shadow: var(--shadow);
  opacity: 1;
  transform: translateY(0);
  transition:
    max-height 2700ms cubic-bezier(0.22, 0.72, 0.2, 1),
    opacity 1950ms ease,
    transform 2700ms cubic-bezier(0.22, 0.72, 0.2, 1),
    border-width 2700ms ease;
}

.hero-banner > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.hero-banner.banner-retracted {
  max-height: 0;
  border-width: 0;
  opacity: 0;
  transform: translateY(-36px);
  pointer-events: none;
}

.library-controls {
  margin-top: 18px;
  border: 1px solid #1b405a;
  border-radius: 17px;
  padding: 12px 14px;
  background: rgba(9, 27, 44, 0.88);
  box-shadow: 0 10px 26px rgba(0, 5, 15, 0.14);
  transition: margin-top 2700ms cubic-bezier(0.22, 0.72, 0.2, 1);
}

.hero-banner.banner-retracted + .library-controls {
  margin-top: 0;
}

.library-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.toolbar-title {
  margin-right: auto;
}

.toolbar-title span {
  color: var(--cyan);
  font: 800 9px "SF Pro Display", sans-serif;
  letter-spacing: 0.14em;
}

.toolbar-title h1 {
  margin: 4px 0 0;
  font-size: 24px;
}

.filter-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.sort-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-left: auto;
}

.filter-button {
  border: 1px solid var(--line-soft);
  border-radius: 9px;
  padding: 8px 12px;
  color: var(--muted);
  background: rgba(12, 31, 50, 0.7);
  font-size: 11px;
  font-weight: 700;
}

.filter-button.active {
  border-color: #3f8bb3;
  color: white;
  background: #164361;
}

.filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid #2a526e;
  border-radius: 9px;
  padding: 8px 12px;
  color: #b8d2e4;
  background: #102a42;
  font-size: 11px;
  font-weight: 800;
}

.filter-toggle.active { border-color: var(--cyan); color: var(--cyan); }

.advanced-filters {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  border-top: 1px solid #173750;
  padding-top: 12px;
}

.advanced-filter-group {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
}

.advanced-filter-group > span {
  padding-top: 7px;
  color: #809bad;
  font-size: 10px;
  font-weight: 800;
}

.advanced-filter-group > div { display: flex; flex-wrap: wrap; gap: 6px; }

.advanced-filter {
  border: 1px solid #274b65;
  border-radius: 999px;
  padding: 6px 10px;
  color: #a8bdcc;
  background: #0a1d2e;
  font-size: 10px;
}

.advanced-filter.active {
  border-color: #51bfe9;
  color: #e8f9ff;
  background: #16435e;
}

.clear-filters {
  justify-self: end;
  border: 0;
  padding: 5px 0;
  color: #ff9b91;
  background: transparent;
  font-size: 10px;
}

.active-filters {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.active-filters > span { color: #7b95a8; font-size: 10px; }

.active-filters > i {
  border: 1px solid #315e7b;
  border-radius: 999px;
  padding: 4px 8px;
  color: #c5e3f5;
  background: rgba(32, 99, 138, 0.2);
  font-size: 10px;
  font-style: normal;
}

.active-filters > button {
  border: 0;
  padding: 4px;
  color: #ff9b91;
  background: transparent;
  font-size: 10px;
}

.category-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 15px 2px 0;
}

.category-row > span {
  flex: none;
  color: #7f9bad;
  font-size: 10px;
  font-weight: 800;
}

.library-count {
  margin: 13px 2px 10px;
  color: #718c9e;
  font-size: 11px;
}

.library-count strong { color: var(--cyan); }

.lesson-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.lesson-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #1c405a;
  border-radius: 18px;
  background: #0a1c2e;
  box-shadow: 0 8px 22px rgba(0, 4, 13, 0.2);
  transition: 180ms ease;
  cursor: pointer;
}

.lesson-card:hover {
  border-color: #3c7596;
  transform: translateY(-4px);
  box-shadow: 0 18px 38px rgba(0, 8, 20, 0.4);
}

.lesson-cover {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background:
    linear-gradient(135deg, #124b73, #0b1d30);
}

.lesson-cover img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: transform 420ms ease;
}

.lesson-card:hover .lesson-cover img { transform: scale(1.045); }

.lesson-cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 52%, rgba(3, 13, 23, 0.72));
  pointer-events: none;
}

.play-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #062436;
  background: rgba(223, 247, 255, 0.93);
  box-shadow: 0 8px 24px rgba(0, 6, 16, 0.34);
  opacity: 0;
  transform: translate(-50%, -42%) scale(0.84);
  transition: 180ms ease;
}

.lesson-card:hover .play-overlay {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.cover-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(255, 255, 255, 0.84);
  font: 900 42px "SF Pro Display", sans-serif;
  letter-spacing: -0.04em;
}

.cover-status {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
}

.cover-meta {
  position: absolute;
  right: 10px;
  bottom: 10px;
  left: 10px;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.category-pill,
.duration-pill,
.progress-pill {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 10px;
  font-weight: 800;
  backdrop-filter: blur(10px);
}

.category-pill {
  color: #ffe7a1;
  background: rgba(10, 29, 44, 0.82);
}

.progress-pill {
  color: #fff3d3;
  background: rgba(191, 126, 20, 0.9);
}

.progress-pill.done { color: white; background: rgba(40, 160, 94, 0.92); }
.progress-pill.learning { color: #e3f8ff; background: rgba(28, 123, 178, 0.92); }

.duration-pill {
  color: white;
  background: rgba(2, 12, 21, 0.8);
}

.favorite-button {
  position: absolute;
  right: 10px;
  top: 10px;
  z-index: 4;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  color: #d6e5ed;
  background: rgba(4, 17, 29, 0.74);
  font-size: 18px;
}

.favorite-button.active { color: #ff829c; border-color: rgba(255, 130, 156, 0.72); }

.cover-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  z-index: 5;
  height: 4px;
  background: var(--green);
}

.lesson-card-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  padding: 16px;
}

.lesson-card-title {
  margin: 0;
  overflow: hidden;
  color: white;
  font-size: 16px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.lesson-card-description {
  min-height: 38px;
  margin: 8px 0 12px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.lesson-card-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.lesson-card-labels span {
  border: 1px solid #294f68;
  border-radius: 999px;
  padding: 4px 8px;
  color: #aec7d7;
  background: rgba(17, 48, 70, 0.72);
  font-size: 10px;
}

.lesson-card-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 7px;
  margin-top: auto;
  border-top: 1px solid #19384f;
  padding-top: 11px;
  color: #7995a8;
  font-size: 10px;
}

.empty-state {
  min-height: 280px;
  display: grid;
  place-content: center;
  gap: 8px;
  border: 1px dashed #28506a;
  border-radius: 16px;
  color: var(--muted);
  text-align: center;
}

/* Generic pages */
.page-shell {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  padding: 38px 0 70px;
}

.page-title {
  margin: 0 0 7px;
  font-size: 28px;
}

.page-subtitle {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.search-bar {
  display: flex;
  gap: 9px;
  margin-bottom: 24px;
}

.search-bar .search-input { flex: 1; font-size: 16px; }

.search-results,
.favorite-sections { display: grid; gap: 14px; }

.search-result {
  border: 1px solid var(--line-soft);
  border-radius: 15px;
  padding: 16px;
  background: rgba(10, 29, 47, 0.84);
}

.search-result-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.search-result-head h3 { margin: 0; font-size: 16px; }
.match-chip { color: var(--cyan); font-size: 9px; }

.search-match {
  display: grid;
  grid-template-columns: 66px 1fr;
  gap: 10px;
  border-top: 1px solid #17354c;
  padding: 10px 0;
  cursor: pointer;
}

.search-match:hover { color: var(--cyan); }
.search-match time { color: var(--cyan); font: 10px "SF Mono", monospace; }
.search-match strong { display: block; font-size: 12px; }
.search-match span { display: block; margin-top: 4px; color: var(--muted); font-size: 11px; }

.method-page { width: min(1120px, calc(100% - 48px)); }

.method-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
}

.method-heading > div > span {
  color: var(--cyan);
  font: 800 11px "SF Mono", monospace;
  letter-spacing: 0.12em;
}

.method-heading .page-title { margin-top: 8px; font-size: 34px; }
.method-heading .page-subtitle { margin-bottom: 20px; font-size: 14px; }

.method-heading > i {
  width: 66px;
  height: 66px;
  display: grid;
  place-items: center;
  flex: none;
  border: 1px solid #2e6688;
  border-radius: 20px;
  color: var(--gold);
  background: linear-gradient(145deg, #153c59, #0b2033);
  box-shadow: 0 12px 30px rgba(0, 7, 18, 0.3);
  font: 800 26px "PingFang SC", sans-serif;
  font-style: normal;
}

.method-intro {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  margin-bottom: 16px;
  border: 1px solid #28587a;
  border-radius: 18px;
  padding: 20px 22px;
  background:
    linear-gradient(120deg, rgba(36, 121, 178, 0.18), transparent 66%),
    rgba(10, 28, 46, 0.9);
}

.method-intro strong {
  color: var(--cyan);
  font-size: 15px;
  white-space: nowrap;
}

.method-intro p {
  margin: 0;
  color: #b6c9d7;
  font-size: 13px;
  line-height: 1.8;
}

.method-library {
  display: grid;
  gap: 12px;
}

.method-guide {
  overflow: hidden;
  border: 1px solid #1d405b;
  border-radius: 18px;
  background: rgba(8, 25, 42, 0.9);
  box-shadow: 0 10px 26px rgba(0, 6, 16, 0.16);
  transition: border-color 150ms ease, background 150ms ease;
}

.method-guide[open] {
  border-color: #3f88b7;
  background:
    linear-gradient(135deg, rgba(40, 111, 160, 0.15), transparent 52%),
    rgba(8, 25, 42, 0.95);
}

.method-guide summary {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto 48px;
  align-items: center;
  gap: 14px;
  padding: 18px 22px;
  cursor: pointer;
  list-style: none;
}

.method-guide summary::-webkit-details-marker { display: none; }
.method-guide summary:hover { background: rgba(21, 56, 82, 0.36); }

.method-guide summary > i {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: #082031;
  background: linear-gradient(145deg, #83e2ff, #3fb7ef);
  font: 900 14px "SF Mono", monospace;
  font-style: normal;
}

.method-summary-title { display: grid; gap: 4px; }
.method-summary-title strong { font-size: 18px; }
.method-summary-title small { color: #6f94b2; font-size: 10px; letter-spacing: 0.05em; }

.method-audience {
  border: 1px solid #315b79;
  border-radius: 999px;
  padding: 5px 10px;
  color: #b9d3e4;
  background: rgba(15, 48, 70, 0.7);
  font-size: 10px;
  white-space: nowrap;
}

.method-toggle {
  justify-self: end;
  color: #7fa4bd;
  font-size: 11px;
}

.method-toggle::before { content: "展开"; }
.method-guide[open] .method-toggle::before { content: "收起"; }

.method-detail {
  border-top: 1px solid #1a3b54;
  padding: 20px 24px 24px;
}

.method-detail > p {
  margin: 0 0 19px;
  color: #b5cad9;
  font-size: 13px;
  line-height: 1.8;
}

.method-detail h3 {
  margin: 0 0 12px;
  color: #f2f9ff;
  font-size: 14px;
}

.method-steps {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.method-steps li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 11px;
  color: #bbcedb;
  font-size: 13px;
  line-height: 1.7;
}

.method-steps li > span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #06202f;
  background: var(--cyan);
  font: 900 11px "SF Mono", monospace;
}

.method-steps p { margin: 2px 0 0; }

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

.drill-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  column-gap: 11px;
  border: 1px solid #1c405c;
  border-radius: 14px;
  padding: 16px;
  background: rgba(10, 31, 49, 0.78);
}

.drill-card > i {
  grid-row: 1 / span 2;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  color: var(--gold);
  background: rgba(255, 212, 90, 0.09);
  font-style: normal;
  font-weight: 800;
}

.drill-card h3 { margin: 1px 0 6px; font-size: 14px; }
.drill-card p { margin: 0 0 10px; color: #9fb8c8; font-size: 12px; line-height: 1.7; }
.drill-card > span {
  grid-column: 2;
  width: fit-content;
  border-radius: 8px;
  padding: 4px 8px;
  color: #ffe49b;
  background: rgba(255, 212, 90, 0.08);
  font-size: 10px;
}

.method-footer {
  margin: 23px 0 0;
  color: #7894a7;
  text-align: center;
  font-size: 12px;
}

/* Player */
.player-page {
  min-height: 100vh;
  padding: 12px 14px 18px;
}

.player-topline {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 15px;
  border-bottom: 1px solid #16344b;
  background:
    linear-gradient(180deg, rgba(26, 64, 92, 0.26), transparent),
    #091a2a;
}

.back-button {
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid #294a61;
  border-radius: 50%;
  padding: 0;
  color: var(--muted-strong);
  background: #0b2032;
  font-size: 18px;
}

.back-button:hover {
  border-color: #487b9b;
  color: white;
  background: #132e45;
}

.player-title-block {
  min-width: 0;
  flex: 1;
}

.player-title-block h1 {
  margin: 0;
  font-family: "Avenir Next", "PingFang SC", sans-serif;
  font-size: 18px;
  letter-spacing: -0.02em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player-title-block p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.player-top-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex: none;
}

.player-utility {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid #294b63;
  border-radius: 999px;
  padding: 6px 11px;
  color: #a8becc;
  background: #0c2032;
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
}

.player-utility:hover,
.player-utility.active {
  border-color: #4b8bb0;
  color: white;
  background: #14344c;
}

.player-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-items: stretch;
}

.learning-column,
.script-column {
  min-width: 0;
  border: 1px solid #153a56;
  border-radius: 16px;
  background: #0a0d12;
}

.learning-column {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow-y: auto;
  scrollbar-width: none;
}

.learning-column::-webkit-scrollbar { display: none; }

.video-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #02070c;
}

.video-stage video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  background: #000;
}

.video-stage.video-hidden {
  height: 82px;
  aspect-ratio: auto;
}

.video-stage.video-hidden video { display: none; }
.video-stage.video-hidden::after {
  content: "视频画面已隐藏";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #648396;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.video-toolbar {
  padding: 12px 18px 14px;
  border-top: 1px solid #16344b;
  background:
    linear-gradient(180deg, rgba(25, 62, 91, 0.28), transparent 52%),
    #071827;
}

.timeline-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.video-toolbar .time {
  min-width: 104px;
  color: #c3d9e7;
  font: 12px "SF Mono", monospace;
  text-align: right;
}

.timeline {
  flex: 1;
  height: 5px;
  border-radius: 99px;
  accent-color: var(--cyan);
}

.player-controls {
  display: grid;
  grid-template-columns: repeat(6, minmax(64px, 1fr));
  align-items: end;
  gap: 8px;
  margin-top: 10px;
}

.player-control {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 8px 4px;
  color: #d5e6f2;
  background: rgba(11, 34, 53, 0.42);
  transition: 150ms ease;
}

.player-control b {
  font-size: 20px;
  line-height: 1;
  font-weight: 800;
}

.player-control small {
  color: #9eb3c2;
  font-size: 12px;
}

.player-control:hover,
.player-control.active { border-color: #316f96; background: #102e48; }
.player-control:hover small,
.player-control.active small { color: #d7f5ff; }

.player-control:nth-child(1) b { color: var(--gold); }
.player-control:nth-child(2) b,
.player-control:nth-child(4) b { color: var(--cyan); }
.player-control:nth-child(5) b { color: var(--green); }
.player-control:nth-child(6) b { color: #d7a8ff; }

.play-control {
  width: 64px;
  height: 64px;
  justify-self: center;
  justify-content: center;
  border-radius: 50%;
  color: white;
  background: linear-gradient(145deg, #4ab8ff, #237ee8);
  box-shadow: 0 8px 24px rgba(31, 137, 231, 0.4);
}

.play-control b { color: white; font-size: 24px; }
.play-control small { color: white; font-size: 12px; }
.play-control:hover { color: white; background: linear-gradient(145deg, #69c9ff, #3695ff); }

.practice-area { padding: 16px; }

.practice-mode-line {
  margin-bottom: 10px;
  color: #7d98aa;
  font-size: 12px;
}

.practice-mode-line strong { color: var(--cyan); }

.practice-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  gap: 6px;
  margin-bottom: 12px;
  padding: 6px;
  border: 1px solid #173e58;
  border-radius: 17px;
  background: rgba(5, 20, 34, 0.78);
}

.practice-tab {
  border: 1px solid rgba(72, 111, 138, 0.25);
  border-radius: 12px;
  padding: 11px 12px;
  color: #c9dced;
  background: rgba(15, 42, 65, 0.55);
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.02em;
}

.practice-tab:hover { color: white; background: #123652; }
.practice-tab[data-practice="bilingual"] { color: #83ddff; }
.practice-tab[data-practice="shadowing"] { color: #ffc080; }
.practice-tab[data-practice="cloze"] { color: #d4b2ff; }
.practice-tab[data-practice="dictation"] { color: #93e8b5; }
.practice-tab[data-practice="bilingual"].active { border-color: #52c9fb; color: #e8faff; background: #135078; }
.practice-tab[data-practice="shadowing"].active { border-color: #ffac69; color: #fff3e7; background: #653c24; }
.practice-tab[data-practice="cloze"].active { border-color: #b389ef; color: #f4ebff; background: #472e70; }
.practice-tab[data-practice="dictation"].active { border-color: #75d69a; color: #eaffef; background: #214f38; }

.current-card {
  border: 1px solid #316b91;
  border-radius: 14px;
  min-height: 82px;
  padding: 13px 15px;
  background:
    linear-gradient(135deg, rgba(44, 93, 151, 0.2), transparent 64%),
    #111b2c;
  text-align: center;
}

.current-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.current-time {
  color: var(--cyan);
  font: 11px "SF Mono", monospace;
}

.practice-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 12px;
}

.practice-actions .primary-button,
.practice-actions .secondary-button,
.practice-actions .ghost-button { padding: 8px 13px; font-size: 12px; }

.current-en {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.55;
}

.current-zh {
  margin-top: 9px;
  color: var(--green);
  font-size: 14px;
  line-height: 1.65;
}

.current-en mark,
.cue-row mark {
  border: 1px solid rgba(255, 212, 90, 0.45);
  border-radius: 999px;
  padding: 1px 7px;
  color: var(--gold);
  background: rgba(255, 212, 90, 0.08);
}

.cue-row mark {
  border: 0;
  border-radius: 0;
  padding: 0;
  color: inherit;
  background: transparent;
}

.cue-row mark:nth-of-type(4n + 1) { color: #c4a7ff; }
.cue-row mark:nth-of-type(4n + 2) { color: #a6ebc2; }
.cue-row mark:nth-of-type(4n + 3) { color: #ffbd7d; }
.cue-row mark:nth-of-type(4n + 4) { color: #ff96b0; }

.word-token { display: inline; }
.sync-word.highlight-type-word {
  color: #35c878;
  font-style: italic;
  font-weight: 700;
}

.sync-word.highlight-type-phrase {
  color: #3f9fe8;
  font-style: italic;
  font-weight: 700;
}

.sync-word.highlight-type-expression {
  color: #9a6ee2;
  font-style: italic;
  font-weight: 700;
}
.cue-row .sync-word.active {
  color: #ff646a !important;
  text-decoration: none;
}

.current-en .sync-word.is-spoken {
  text-decoration-line: underline;
  text-decoration-color: #ff646a;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.cloze-input {
  width: 88px;
  min-width: 50px;
  margin: 0 4px;
  border: 0;
  border-bottom: 2px solid #5ac7f5;
  padding: 1px 3px;
  outline: 0;
  color: white;
  background: rgba(255, 255, 255, 0.08);
  text-align: center;
}

.cloze-input.before-punctuation { margin-right: 0; }

.cloze-text {
  display: inline;
  white-space: pre-wrap;
}

.cloze-input.correct { border-color: var(--green); color: var(--green); }
.cloze-input.wrong { border-color: var(--red); color: var(--red); }

.dictation-input {
  width: 100%;
  min-height: 72px;
  margin-top: 10px;
  resize: vertical;
  border: 1px solid #315b77;
  border-radius: 10px;
  padding: 10px;
  outline: 0;
  color: white;
  background: #071724;
  font-size: 15px;
  line-height: 1.6;
}

.dictation-input:focus { border-color: var(--cyan); }

.practice-result {
  margin-top: 10px;
  border-radius: 9px;
  padding: 9px 11px;
  font-size: 11px;
  line-height: 1.7;
}

.practice-result.ok { color: #caffdd; background: rgba(83, 192, 128, 0.12); }
.practice-result.bad { color: #ffd0cb; background: rgba(255, 112, 98, 0.11); }

.practice-hint {
  margin-top: 8px;
  color: var(--gold);
  font-size: 11px;
}

.lesson-description {
  margin-top: 13px;
  padding: 18px;
  border: 1px solid #173b55;
  border-radius: 15px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.8;
  background: rgba(7, 22, 36, 0.78);
}

.lesson-description strong {
  display: block;
  margin-bottom: 7px;
  color: var(--muted-strong);
  font-size: 13px;
}

.script-column {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.script-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 11px 13px;
  border-bottom: 1px solid #173851;
  background:
    linear-gradient(180deg, rgba(42, 91, 130, 0.21), transparent),
    #0b2032;
}

.script-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.script-title > i {
  width: 4px;
  height: 24px;
  border-radius: 999px;
  background: #4777ff;
  box-shadow: 0 0 14px rgba(71, 119, 255, 0.55);
}

.script-title h2 { margin: 0; font-size: 17px; letter-spacing: -0.02em; }
.script-title span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }

.script-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 5px;
  margin-left: auto;
}

.script-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid #263e53;
  border-radius: 10px;
  padding: 8px 9px;
  color: #d1deea;
  background: #111d2c;
  font-size: 12px;
  white-space: nowrap;
}

.script-action > span {
  color: #89b9e9;
  font-size: 15px;
}

.script-action > span .ui-icon-svg {
  width: 17px;
  height: 17px;
}

.script-action > b { font-size: 12px; }
.script-action > i { color: #7d91a2; font-style: normal; }
.script-action:hover,
.script-action.active { border-color: #3d6d91; color: white; background: #172f44; }

.script-menu-wrap { position: relative; }

.script-menu {
  position: absolute;
  top: calc(100% + 7px);
  right: 0;
  z-index: 30;
  width: 252px;
  display: none;
  border: 1px solid #31536b;
  border-radius: 14px;
  padding: 9px;
  background: rgba(7, 22, 37, 0.98);
  box-shadow: 0 18px 45px rgba(0, 4, 12, 0.52);
}

.script-menu.is-open { display: grid; gap: 5px; }
.script-menu > strong { padding: 5px 7px 7px; color: #7896aa; font-size: 10px; }

.script-menu > button {
  display: grid;
  gap: 3px;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 9px 10px;
  color: #c7d8e5;
  background: transparent;
  text-align: left;
}

.script-menu > button b { font-size: 12px; }
.script-menu > button small { color: #758fa1; font-size: 9px; }
.script-menu > button:hover,
.script-menu > button.active { border-color: #315d7a; background: #102a40; }

.settings-menu { width: 268px; }
.settings-label { padding: 8px 7px 2px; color: #7896aa; font-size: 10px; }

.settings-sizes {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}

.settings-sizes button {
  border: 1px solid #294a62;
  border-radius: 8px;
  padding: 7px 2px;
  color: #9eb5c5;
  background: #0b1e30;
  font-size: 10px;
}

.settings-sizes button.active { border-color: var(--cyan); color: #e7fbff; background: #15405c; }

.subtitle-mode {
  display: flex;
  align-items: center;
  gap: 4px;
}

.subtitle-mode button {
  border: 1px solid #2b506b;
  border-radius: 8px;
  padding: 7px 10px;
  color: var(--muted);
  background: #0a1b2b;
  font-size: 11px;
}

.subtitle-mode button.active { border-color: #4bbce8; color: var(--gold); background: #14344b; }

.dynamic-script {
  flex: 1;
  min-height: 0;
  padding: 0 0 18px;
  overflow-y: auto;
  scroll-behavior: smooth;
}

.script-column.hide-notes .cue-notes { display: none; }

.script-column.cue-size-small .cue-row-en { font-size: 14px; }
.script-column.cue-size-small .cue-row-zh { font-size: 12px; }
.script-column.cue-size-standard .cue-row-en { font-size: clamp(16px, 1.15vw, 18px); }
.script-column.cue-size-standard .cue-row-zh { font-size: 14px; }
.script-column.cue-size-medium .cue-row-en { font-size: clamp(18px, 1.35vw, 21px); }
.script-column.cue-size-medium .cue-row-zh { font-size: 16px; }
.script-column.cue-size-large .cue-row-en { font-size: clamp(21px, 1.55vw, 24px); }
.script-column.cue-size-large .cue-row-zh { font-size: clamp(17px, 1.15vw, 19px); }

.cue-row {
  position: relative;
  margin: 0;
  border: 0;
  border-bottom: 1px solid #1a202a;
  border-radius: 0;
  padding: 17px 22px 18px;
  cursor: pointer;
  background: transparent;
  box-shadow: none;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}

.cue-row:hover {
  background: #101622;
}

.cue-row.active {
  margin: 8px 9px;
  border: 1px solid #536bde;
  border-radius: 15px;
  background:
    linear-gradient(145deg, rgba(41, 57, 116, 0.42), transparent 72%),
    #0d1730;
  box-shadow:
    inset 0 0 0 1px rgba(101, 126, 226, 0.18),
    0 8px 24px rgba(2, 8, 28, 0.3);
}

.cue-row-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0 0 13px;
}

.cue-timing {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #6d7a98;
  font: 10px "SF Mono", monospace;
}

.cue-index {
  color: #586b9d;
  font-weight: 800;
}

.cue-time { color: #6d7a98; }
.cue-time::after { content: ""; }
.cue-row-actions { display: flex; gap: 4px; }
.cue-action {
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0;
  color: #6688a4;
  background: transparent;
  font-size: 12px;
}
.cue-action:hover { border-color: #2e627e; color: white; }
.cue-action.active { color: var(--gold); }
.cue-action.active svg { fill: currentColor; }
.cue-action .ui-icon-svg { width: 18px; height: 18px; }

.cue-wave {
  height: 18px;
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  margin-left: 2px;
}

.cue-wave i {
  width: 4px;
  height: 18px;
  display: block;
  border-radius: 999px;
  background: linear-gradient(180deg, #5f79ff, #2dbbff);
  opacity: 0.34;
  transform: scaleY(0.35);
  transform-origin: bottom;
}

.cue-wave i:nth-child(2) { transform: scaleY(0.62); }
.cue-wave i:nth-child(3) { transform: scaleY(0.92); }
.cue-row.active .cue-wave i { opacity: 0.95; }

.cue-row.is-speaking .cue-wave i {
  animation: cueWave 0.72s ease-in-out infinite alternate;
}

.cue-row.is-speaking .cue-wave i:nth-child(2) {
  animation-delay: -0.26s;
  animation-duration: 0.54s;
}

.cue-row.is-speaking .cue-wave i:nth-child(3) {
  animation-delay: -0.44s;
  animation-duration: 0.86s;
}

@keyframes cueWave {
  0% { transform: scaleY(0.25); }
  50% { transform: scaleY(0.68); }
  100% { transform: scaleY(1); }
}

.cue-row-en {
  color: #f4f8fb;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  font-size: clamp(16px, 1.15vw, 18px);
  font-weight: 600;
  line-height: 1.48;
  letter-spacing: -0.012em;
  overflow-wrap: anywhere;
}

.cue-row-zh {
  margin-top: 10px;
  color: var(--green);
  font-size: 14px;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.dynamic-script.hide-english .cue-row-en,
.dynamic-script.hide-all-copy .cue-row-en,
.dynamic-script.hide-all-copy .cue-row-zh { visibility: hidden; }
.dynamic-script.subtitles-off .cue-row-en,
.dynamic-script.subtitles-off .cue-row-zh { display: none; }
.dynamic-script.subtitle-en-only .cue-row-zh { display: none; }
.dynamic-script.subtitle-zh-only .cue-row-en { display: none; }

.cue-notes { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }

.cue-note {
  border: 1px solid rgba(255, 212, 90, 0.28);
  border-radius: 999px;
  padding: 4px 8px;
  color: #f8d77e;
  background: rgba(255, 212, 90, 0.05);
  font-size: 10px;
}

.vocabulary-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 9px 3px 12px;
  padding: 13px 15px;
  border: 1px solid #274b66;
  border-radius: 13px;
  background: rgba(14, 42, 64, 0.72);
}

.vocabulary-intro strong { font-size: 14px; }
.vocabulary-intro span { color: #7f9aad; font-size: 10px; }

.vocabulary-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 3px 12px;
}

.vocabulary-tabs button {
  border: 1px solid #294b64;
  border-radius: 999px;
  padding: 6px 10px;
  color: #97b0c1;
  background: #0b1e30;
  font-size: 10px;
}

.vocabulary-tabs button.active {
  border-color: #4bbbe8;
  color: #e8faff;
  background: #16435e;
}

.vocabulary-card {
  margin: 9px 3px;
  border: 1px solid #254863;
  border-left: 3px solid var(--note-color, var(--cyan));
  border-radius: 14px;
  padding: 17px 18px;
  background:
    linear-gradient(135deg, rgba(32, 91, 125, 0.14), transparent 64%),
    #091a2c;
}

.vocabulary-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.vocabulary-card-head h3 {
  margin: 0;
  color: #f5fbff;
  font-size: 20px;
}

.vocabulary-card-head span { color: var(--gold); font-size: 12px; }
.vocabulary-card p { margin: 12px 0 5px; color: #c4d4df; font-size: 13px; line-height: 1.65; }
.vocabulary-card small { display: block; color: #829baa; font-size: 11px; line-height: 1.6; }
.vocabulary-card .ghost-button { margin-top: 12px; font-size: 11px; }

.vocabulary-empty {
  margin: 20px;
  padding: 24px;
  border: 1px dashed #2b5069;
  border-radius: 14px;
  color: #7e98aa;
  text-align: center;
  font-size: 12px;
}

/* Admin */
.admin-table {
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  background: rgba(9, 27, 44, 0.85);
}

.admin-row {
  display: grid;
  grid-template-columns: minmax(280px, 1.5fr) 110px 100px 100px 160px;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid #17344a;
  padding: 11px 14px;
  font-size: 11px;
}

.admin-row:last-child { border-bottom: 0; }
.admin-row.header { color: var(--muted); background: #0c2234; font-size: 9px; font-weight: 800; }
.admin-row strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sentence-loop-picker {
  width: min(760px, calc(100vw - 32px));
  max-height: min(82vh, 760px);
  overflow: hidden;
  border: 1px solid #315d79;
  border-radius: 22px;
  padding: 0;
  color: #e8f4fb;
  background: #081c2d;
  box-shadow: 0 28px 80px rgba(0, 6, 15, 0.62);
}

.sentence-loop-picker::backdrop {
  background: rgba(2, 8, 15, 0.76);
  backdrop-filter: blur(5px);
}

.sentence-loop-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #193b53;
  padding: 20px 22px 16px;
}

.sentence-loop-head h2 {
  margin: 0;
  font-size: 20px;
}

.sentence-loop-head p {
  margin: 6px 0 0;
  color: #86a3b7;
  font-size: 12px;
  line-height: 1.6;
}

.sentence-loop-list {
  max-height: calc(82vh - 156px);
  overflow: auto;
  display: grid;
  gap: 8px;
  padding: 12px;
}

.sentence-loop-option {
  width: 100%;
  display: grid;
  gap: 5px;
  border: 1px solid #193d56;
  border-radius: 13px;
  padding: 12px 14px;
  color: #dcecf6;
  background: #0a2337;
  text-align: left;
}

.sentence-loop-option:hover,
.sentence-loop-option.active {
  border-color: #4bbbea;
  background: #0d314b;
}

.sentence-loop-option strong {
  font-size: 15px;
  line-height: 1.55;
}

.sentence-loop-option small {
  color: #94c66f;
  font-size: 12px;
  line-height: 1.5;
}

.sentence-loop-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #6f9ab3;
  font: 11px "SF Mono", monospace;
}

.sentence-loop-meta b {
  color: #72d5ff;
}

.sentence-loop-role {
  margin-left: auto;
  border-radius: 999px;
  padding: 2px 7px;
  color: #9de1ff;
  background: #124665;
  font: 700 10px "PingFang SC", sans-serif;
}

.sentence-loop-role:empty { display: none; }

.sentence-loop-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid #193b53;
  padding: 12px 18px;
  color: #7898ac;
  font-size: 11px;
}

.sentence-loop-foot button[hidden] { display: none; }

.sentence-loop-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sentence-loop-actions .primary-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.admin-editor {
  width: min(620px, calc(100vw - 44px));
  border: 1px solid #2c5a78;
  border-radius: 18px;
  padding: 0;
  color: var(--text);
  background: #0b1d2e;
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.55);
}

.admin-editor::backdrop { background: rgba(2, 7, 13, 0.72); backdrop-filter: blur(4px); }
.admin-editor form { padding: 22px; }
.admin-editor-head { display: flex; justify-content: space-between; margin-bottom: 16px; }
.admin-editor h2 { margin: 0; font-size: 20px; }
.admin-editor .form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.admin-editor .form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

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

@media (max-width: 1240px) {
  .home-shell { grid-template-columns: 255px minmax(0, 1fr); gap: 18px; }
  .player-layout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1050px) {
  .collection-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 760px) {
  .collection-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
