:root {
  --video-ink: #17231d;
  --video-muted: #637067;
  --video-line: rgba(26, 55, 42, .16);
  --video-surface: #fffdf8;
  --video-accent: #1f6b4f;
  --video-gold: #c89b43;
}

[data-theme="dark"] {
  --video-ink: #f4efe4;
  --video-muted: #b2baaf;
  --video-line: rgba(238, 227, 202, .17);
  --video-surface: #18201c;
  --video-accent: #78c69f;
  --video-gold: #e0b967;
}

.video-library-page {
  min-height: 100vh;
  margin: 0;
  color: var(--video-ink);
  background: radial-gradient(circle at 10% 0, rgba(200, 155, 67, .12), transparent 38%), var(--bg, #f6f2e8);
}

.video-page-shell {
  width: min(1180px, calc(100vw - 32px));
  min-width: 0;
  margin: 0 auto;
  padding: 32px 0 72px;
}
.video-page-shell.is-theater-layout { width: min(1500px, calc(100vw - 24px)); }
.video-back {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(1120px, 100%);
  min-width: 0;
  margin: 0 auto 22px;
  color: var(--video-accent);
  font-weight: 750;
  text-decoration: none;
}
.video-back:hover { text-decoration: underline; text-underline-offset: 4px; }
.video-detail { display: grid; width: 100%; min-width: 0; justify-items: center; gap: 30px; }
.video-detail.is-theater-layout { width: 100%; max-width: 1500px; margin-inline: auto; }

.video-player {
  position: relative;
  overflow: hidden;
  width: 100%;
  max-width: 1120px;
  min-width: 0;
  justify-self: center;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 22px;
  background: #090c0a;
  box-shadow: 0 24px 70px rgba(11, 25, 18, .22);
}

.video-stage { position: relative; isolation: isolate; aspect-ratio: 16 / 9; overflow: hidden; cursor: pointer; background: #050706; }
.video-stage::after { position: absolute; inset: auto 0 0; z-index: 1; height: 28%; pointer-events: none; content: ""; background: linear-gradient(transparent, rgba(3, 8, 5, .6)); opacity: .45; }
.video-player[data-video-provider="youtube"] .video-stage { cursor: default; }
.video-player[data-video-provider="youtube"] .video-stage::after { display: none; }
.video-poster { position: absolute; inset: 0; z-index: 0; display: block; width: 100%; height: 100%; object-fit: cover; background: #050706; }
.video-poster[hidden] { display: none; }
.video-stage video { display: block; width: 100%; height: 100%; border: 0; object-fit: contain; background: #050706; }
.video-youtube-frame { position: absolute; inset: 0; z-index: 1; display: block; width: 100%; height: 100%; border: 0; background: #050706; }
.video-youtube-frame iframe { display: block; width: 100%; height: 100%; border: 0; }
.video-seek-feedback {
  position: absolute;
  top: 50%;
  z-index: 4;
  display: grid;
  width: 104px;
  height: 104px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .28);
  border-radius: 50%;
  color: #f5f0e6;
  background: rgba(10, 18, 13, .78);
  box-shadow: 0 12px 30px rgba(0, 0, 0, .28);
  font-size: 1rem;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-50%) scale(.84);
  transition: opacity .16s ease, transform .16s ease;
  backdrop-filter: blur(10px);
}
.video-seek-feedback.is-left { left: 12%; }
.video-seek-feedback.is-right { right: 12%; }
.video-seek-feedback.is-visible { opacity: 1; transform: translateY(-50%) scale(1); }
.video-seek-feedback[hidden] { display: none; }
.video-stage-play {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  display: grid;
  width: 76px;
  height: 76px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 50%;
  color: #102218;
  background: var(--video-accent);
  box-shadow: 0 12px 32px rgba(0, 0, 0, .32);
  font-size: 1.6rem;
  cursor: pointer;
  transform: translate(-50%, -50%);
  transition: transform .18s ease, filter .18s ease;
}
.video-stage-play:hover { filter: brightness(1.08); transform: translate(-50%, -50%) scale(1.05); }
.video-stage-play:focus-visible { outline: 3px solid var(--video-gold); outline-offset: 4px; }
.video-stage-play[hidden], .video-stage-loading[hidden] { display: none; }
.video-stage-loading {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  max-width: calc(100% - 36px);
  padding: 9px 13px;
  border: 1px solid rgba(255, 255, 255, .17);
  border-radius: 999px;
  color: #f5f0e6;
  background: rgba(10, 18, 13, .78);
  box-shadow: 0 8px 22px rgba(0, 0, 0, .2);
  font-size: .82rem;
  backdrop-filter: blur(10px);
}
.video-spinner { width: 12px; height: 12px; border: 2px solid rgba(255, 255, 255, .35); border-top-color: var(--video-gold); border-radius: 50%; animation: video-spin .8s linear infinite; }
@keyframes video-spin { to { transform: rotate(360deg); } }

.video-control-row--study { flex-wrap: wrap; justify-content: flex-start; color: #bfcac1; font-size: .78rem; }
.video-control-row--study button { min-height: 32px; padding-inline: 9px; }
.video-study-label { color: var(--video-gold); font-weight: 800; }
[data-video-loop-status] { min-width: 125px; font-variant-numeric: tabular-nums; }
.video-study-notes { display: grid; gap: 18px; padding: 22px; color: var(--video-ink); background: var(--video-surface); border-top: 1px solid var(--video-line); }
.video-study-notes h2 { margin: 2px 0 5px; font-size: 1.35rem; }
.video-study-notes p { margin: 0; color: var(--video-muted); }
.video-note-compose { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: end; }
.video-note-compose label { display: grid; gap: 6px; color: var(--video-muted); font-size: .8rem; font-weight: 750; }
.video-note-compose textarea, .video-note-compose input { width: 100%; min-width: 0; border: 1px solid var(--video-line); border-radius: 10px; padding: 10px; color: inherit; background: transparent; font: inherit; }
.video-note-compose button, .video-collection-save { min-height: 40px; border: 1px solid var(--video-accent); border-radius: 10px; padding: 0 14px; color: #fff; background: var(--video-accent); font: inherit; font-weight: 800; cursor: pointer; }
.video-notes-list { display: grid; gap: 9px; }
.video-note { display: grid; grid-template-columns: auto 1fr auto auto; gap: 9px; align-items: center; padding: 10px; border: 1px solid var(--video-line); border-radius: 10px; }
.video-note p { color: var(--video-ink); }
.video-note button { border: 0; color: var(--video-accent); background: transparent; font: inherit; font-size: .82rem; font-weight: 750; cursor: pointer; }
.video-note .video-note-time { color: var(--video-gold); font-variant-numeric: tabular-nums; }
.video-notes-empty { font-size: .9rem; }
.video-collection-head { display: grid; grid-template-columns: minmax(0, 280px) minmax(0, 1fr); gap: 26px; align-items: center; margin: 0 auto 30px; padding: 24px; border: 1px solid var(--video-line); border-radius: 20px; background: var(--video-surface); }
.video-collection-head h1 { margin: 3px 0 10px; }
.video-collection-head p { color: var(--video-muted); }
.video-collection-cover { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 14px; }
.video-collection-save { margin-top: 8px; }
.video-collection-head--plain { display: block; width: min(100%, 920px); max-width: none; margin: 0 auto 34px; padding: clamp(26px, 4vw, 46px); }
.video-collection-head--plain .video-collection-summary { max-width: 760px; }
.video-collection-head--plain .video-kicker { margin: 0 0 12px; }
.video-collection-head--plain h1 { max-width: 760px; margin: 0 0 16px; font-size: clamp(2.35rem, 5.2vw, 4.6rem); line-height: 1.02; text-wrap: balance; }
.video-collection-head--plain p:not(.video-kicker) { max-width: 680px; margin: 0; line-height: 1.65; }
.video-collection-head--plain .video-collection-count { display: inline-flex; margin-top: 20px !important; padding: 7px 11px; border: 1px solid var(--video-line); border-radius: 999px; color: var(--video-accent); font-size: .84rem; font-weight: 800; }
.video-collection-head--plain a { display: inline-flex; margin-top: 18px; color: var(--video-accent); font-weight: 750; text-underline-offset: 4px; }

@media (max-width: 680px) {
  .video-note-compose, .video-collection-head { grid-template-columns: 1fr; }
  .video-note { grid-template-columns: auto 1fr; }
  .video-note button:not(.video-note-time) { justify-self: start; }
}

.video-controls {
  display: grid;
  gap: 11px;
  padding: 13px 14px 14px;
  color: #f5f0e6;
  background: linear-gradient(180deg, #15221b, #0f1712);
}
.video-control-row { display: flex; align-items: center; gap: 10px; min-width: 0; }
.video-control-row--timeline { gap: 14px; }
.video-control-group { display: inline-flex; flex: 0 0 auto; gap: 7px; }
.video-control-group button + button { margin-left: -7px; border-left-color: rgba(255, 255, 255, .08); border-radius: 0; }
.video-control-group button:first-child { border-radius: 9px 0 0 9px; }
.video-control-group button:last-child { border-radius: 0 9px 9px 0; }
.video-controls button, .video-controls select, .video-controls input { font: inherit; }
.video-controls button, .video-controls select {
  min-height: 38px;
  border: 1px solid rgba(255, 255, 255, .16);
  border-radius: 9px;
  color: inherit;
  background: #1c2822;
  padding: 0 12px;
  cursor: pointer;
}
.video-controls button:hover, .video-controls select:hover { border-color: rgba(120, 198, 159, .7); background: #24352b; }
.video-controls button:disabled, .video-controls select:disabled { cursor: not-allowed; opacity: .58; }
.video-controls button[aria-pressed="true"] { border-color: rgba(120, 198, 159, .78); background: #24352b; }
.video-controls button.is-recommended { border-color: var(--video-gold); box-shadow: 0 0 0 3px rgba(224, 185, 103, .18); }
.video-controls button:focus-visible, .video-controls select:focus-visible, .video-controls input:focus-visible { outline: 2px solid var(--video-gold); outline-offset: 2px; }
.video-timeline { display: grid; flex: 1 1 auto; grid-template-columns: auto minmax(120px, 1fr) auto; align-items: center; gap: 10px; min-width: 0; color: #bfcac1; font-size: .78rem; font-variant-numeric: tabular-nums; }
.video-control-field { display: inline-flex; align-items: center; gap: 8px; color: #bfcac1; font-size: .78rem; white-space: nowrap; }
.video-control-field select[data-video-quality] { min-width: 122px; }
.video-control-row--settings { justify-content: flex-end; flex-wrap: wrap; }
.video-control-row--settings input[type="range"] { width: 110px; }
.video-controls input[type="range"] { height: 5px; accent-color: var(--video-accent); cursor: pointer; }
.video-controls input[type="range"]::-webkit-slider-runnable-track { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .2); }
.video-controls input[type="range"]::-webkit-slider-thumb { width: 14px; height: 14px; margin-top: -4.5px; border: 2px solid #f5f0e6; border-radius: 50%; background: var(--video-accent); -webkit-appearance: none; }
.video-settings {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 8;
  width: min(360px, calc(100% - 28px));
  max-height: calc(100% - 28px);
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 16px;
  color: #f5f0e6;
  background: rgba(15, 25, 19, .97);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .38);
  backdrop-filter: blur(16px);
}
.video-settings[hidden] { display: none; }
.video-settings-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.video-settings-kicker { margin: 0 0 3px; color: #78c69f; font-size: .68rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.video-settings h2 { margin: 0; color: #f5f0e6; font-size: 1.15rem; }
.video-settings-close { display: grid; width: 30px; height: 30px; padding: 0; place-items: center; border: 1px solid rgba(255, 255, 255, .16); border-radius: 50%; color: inherit; background: #1c2822; font-size: 1.2rem; line-height: 1; cursor: pointer; }
.video-settings-close:hover { border-color: rgba(120, 198, 159, .7); background: #24352b; }
.video-settings fieldset { display: grid; gap: 10px; margin: 0 0 16px; padding: 0; border: 0; }
.video-settings legend { margin-bottom: 8px; color: #bfcac1; font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.video-settings label { display: flex; align-items: flex-start; gap: 9px; color: #e2e8e2; font-size: .82rem; line-height: 1.4; cursor: pointer; }
.video-settings input[type="checkbox"] { flex: 0 0 auto; width: 16px; height: 16px; margin: 1px 0 0; accent-color: var(--video-accent); }
.video-settings-select { align-items: center !important; justify-content: space-between; }
.video-settings-select select { min-height: 32px; padding: 0 8px; border: 1px solid rgba(255, 255, 255, .16); border-radius: 8px; color: inherit; background: #1c2822; font: inherit; cursor: pointer; }
.video-settings select:focus-visible, .video-settings button:focus-visible, .video-settings input:focus-visible { outline: 2px solid var(--video-gold); outline-offset: 2px; }
.video-settings-note { margin: 0; color: #9eaaa1; font-size: .74rem; line-height: 1.5; }
.video-status { margin: 0; padding: 10px 14px; color: #ccd5cf; background: #101713; font-size: .82rem; }
.video-status.is-error { color: #f6d7ca; background: #2a1915; }
.video-status[hidden] { display: none; }
.video-player.is-theater {
  z-index: 10;
  width: 100%;
  max-width: none;
  justify-self: stretch;
  left: auto;
  margin-inline: 0;
  transform: none;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .35);
}

.video-intro { width: min(850px, 100%); min-width: 0; max-width: none; justify-self: center; margin: 0 auto; text-align: center; }
.video-kicker { color: var(--video-accent); font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.video-intro h1, .video-collection-head h1 { font-size: clamp(2rem, 5vw, 4.4rem); line-height: 1.02; margin: .25em 0; }
.video-intro > p, .video-collection-head > p { color: var(--video-muted); font-size: 1.05rem; line-height: 1.75; }
.video-speakers a, .video-series a, .video-subjects a { color: var(--video-accent); font-weight: 750; }
.video-subjects { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 20px 0; }
.video-subjects a { padding: 8px 12px; border: 1px solid var(--video-line); border-radius: 999px; text-decoration: none; }
.video-actions { display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; margin-top: 22px; }
.video-intro [data-video-save] { border: 1px solid var(--video-line); border-radius: 11px; color: var(--video-ink); background: var(--video-surface); padding: 12px 18px; font-weight: 750; cursor: pointer; }
.video-intro [data-video-save]:hover { border-color: var(--video-accent); }
.video-intro [data-video-save][aria-pressed="true"] { color: #fff; background: var(--video-accent); }
.video-source-link { display: inline-flex; color: var(--video-accent); font-weight: 750; text-underline-offset: 4px; }
.video-list-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.video-list-card { min-width: 0; overflow: hidden; border: 1px solid var(--video-line); border-radius: 18px; background: var(--video-surface); }
.video-list-card a { display: block; height: 100%; color: inherit; text-decoration: none; }
.video-list-card picture { display: block; width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: #18201c; }
.video-list-card img { display: block; width: 100%; height: 100%; object-fit: cover; background: #18201c; transition: transform .2s ease; }
.video-list-card a:hover img, .video-list-card a:focus-visible img { transform: scale(1.02); }
.video-list-card span { display: block; padding: 18px; }
.video-list-card small { color: var(--video-accent); font-weight: 750; }
.video-list-card strong { display: block; margin: 7px 0; font-size: 1.1rem; line-height: 1.3; overflow-wrap: anywhere; }
.video-list-card p { display: -webkit-box; margin: 0; overflow: hidden; color: var(--video-muted); line-height: 1.55; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.video-speaker-group { margin: 42px 0; }
.video-speaker-group h2 a { color: inherit; }
.video-empty { padding: 28px; border: 1px dashed var(--video-line); border-radius: 16px; color: var(--video-muted); }

@media (max-width: 900px) {
  .video-page-shell { width: min(calc(100% - 20px), 720px); padding-top: 18px; }
  .video-page-shell.is-theater-layout { width: min(calc(100% - 20px), 720px); }
  .video-list-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .video-player { border-radius: 14px; }
  .video-controls { gap: 12px; padding: 11px; }
  .video-control-row--timeline { flex-wrap: wrap; }
  .video-control-group { width: 100%; }
  .video-control-group button { flex: 1; }
  .video-timeline { flex-basis: 100%; }
  .video-control-row--settings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
  .video-control-field { justify-content: space-between; min-width: 0; }
  .video-control-row--settings input[type="range"] { width: 90px; }
  .video-control-row--settings button { width: 100%; }
  .video-player.is-theater { width: 100%; max-width: none; justify-self: stretch; left: auto; margin-inline: 0; transform: none; }
  .video-intro h1, .video-collection-head h1 { font-size: 2.2rem; }
}

@media (max-width: 680px) {
  .video-list-grid { grid-template-columns: 1fr; }
  .video-collection-head--plain { padding: 24px 20px; }
}

@media (prefers-reduced-motion: reduce) {
  .video-player.is-theater, .video-stage-play, .video-seek-feedback { transition: none; }
  .video-spinner { animation: none; }
}

.subject-format { margin: 34px 0; }
.subject-format > h2 { font-size: 1.4rem; }
.subject-format-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.subject-content-card { border: 1px solid var(--video-line); border-radius: 16px; background: var(--video-surface); }
.subject-content-card a { display: block; padding: 18px; color: inherit; text-decoration: none; }
.subject-content-card small { color: var(--video-accent); font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.subject-content-card strong { display: block; margin: 6px 0; font-size: 1.05rem; }
.subject-content-card p { margin: 0; color: var(--video-muted); }
@media (max-width: 800px) { .subject-format-grid { grid-template-columns: 1fr; } }
@media (max-width:760px){.video-library-page{overflow-x:hidden}.video-page-shell,.video-page-shell.is-theater-layout{width:min(calc(100% - 24px),680px);padding:14px 0 calc(32px + env(safe-area-inset-bottom))}.video-back{min-height:44px;margin:0 0 12px;padding:0 4px}.video-detail{gap:18px}.video-player{border-radius:15px}.video-stage-play{width:64px;height:64px}.video-stage-loading{right:10px;bottom:10px;left:10px;max-width:calc(100% - 20px);font-size:.75rem}.video-controls{gap:9px;padding:10px}.video-controls button,.video-controls select{min-height:44px}.video-control-row{gap:8px}.video-control-row--timeline{gap:8px}.video-control-group button{min-width:0;padding:0 8px;font-size:.78rem}.video-timeline{gap:7px;font-size:.72rem}.video-control-row--settings{grid-template-columns:1fr}.video-control-field{min-height:44px;padding:0 4px}.video-control-row--settings input[type="range"]{width:min(42vw,150px)}.video-control-row--study button{min-height:40px}.video-settings{position:fixed;right:12px;bottom:calc(12px + env(safe-area-inset-bottom));left:12px;width:auto;max-height:min(76dvh,620px);padding:15px;border-radius:16px}.video-settings-close{width:44px;height:44px}.video-intro{width:100%;text-align:left}.video-intro h1{font-size:clamp(1.8rem,9vw,2.65rem);line-height:1.08}.video-intro>p{font-size:.96rem;line-height:1.62}.video-subjects{justify-content:flex-start;margin:14px 0}.video-subjects a,.video-intro [data-video-save]{min-height:44px;display:inline-flex;align-items:center}.video-actions{justify-content:flex-start;margin-top:16px}.video-study-notes{gap:14px;padding:15px}.video-note-compose{grid-template-columns:1fr}.video-note-compose button,.video-collection-save{min-height:44px}.video-note{grid-template-columns:auto 1fr;gap:7px}.video-collection-head,.video-collection-head--plain{margin-bottom:20px;padding:16px;border-radius:15px}.video-collection-head--plain h1{font-size:clamp(1.85rem,9vw,2.7rem);margin-bottom:10px}.video-collection-head--plain p:not(.video-kicker){font-size:.95rem;line-height:1.6}.video-collection-head--plain a{min-height:44px;align-items:center;margin-top:10px}.video-list-grid{gap:12px}.video-list-card{border-radius:14px}.video-list-card span{padding:14px}.video-list-card strong{font-size:1rem}.subject-format{margin:24px 0}.subject-format>h2{font-size:1.25rem}.subject-content-card{border-radius:14px}.subject-content-card a{min-height:44px;padding:14px}.video-empty{padding:20px}}
