/* One layout system. Media and controls share geometry from layout.mjs. */
@font-face { font-family: Inter; src: url('vendor/Inter-variable.ttf') format('truetype'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: Poppins; src: url('vendor/Poppins-Bold.ttf') format('truetype'); font-weight: 700; font-display: swap; }
@font-face { font-family: Poppins; src: url('vendor/Poppins-ExtraBold.ttf') format('truetype'); font-weight: 800; font-display: swap; }
:root {
  color-scheme: light;
  font-family: Inter, system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  /* Charte Canva v3, pages 12–13: navy structure, white space, warm accents. */
  --ink: #1a3062;
  --navy-deep: #0f234a;
  --paper: #f7f8fc;
  --accent: #f23c0a;
  --red: #ee0f35;
  --accent-gradient: linear-gradient(90deg, var(--accent), var(--red));
  --muted: #697a93;
  --line: rgb(26 48 98 / 10%);
  --glass: radial-gradient(ellipse at 15% 0%, rgb(255 255 255 / 95%), transparent 57%), linear-gradient(145deg, rgb(255 255 255 / 48%), rgb(255 255 255 / 14%) 48%, rgb(255 255 255 / 50%));
  --glass-shadow: inset 0 1px 1px #fff, inset 1px 0 1px rgb(255 255 255 / 75%), inset 0 -2px 2px rgb(26 48 98 / 17%), 0 7px 20px rgb(15 35 74 / 13%), 0 1px 3px rgb(15 35 74 / 8%);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; overscroll-behavior: none; }
body { font-size: 14px; line-height: 1.5; }
button, input, select { font: inherit; }
button, a, input, select, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; color: inherit; }
button { border: 0; }
button:disabled { cursor: default; opacity: .45; }
button, select, summary { touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
[hidden] { display: none !important; }
h1, h2, p { margin: 0; }
h2 { font-family: Poppins, Inter, sans-serif; font-weight: 700; font-size: 24px; line-height: 1.3; letter-spacing: -.6px; color: var(--ink); }
svg { display: block; width: 24px; height: 24px; flex: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip-link { position: fixed; left: 16px; top: -80px; z-index: 100; background: white; padding: 12px 16px; color: inherit; }
.skip-link:focus { top: 12px; }
.workspace { position: relative; width: 100%; height: 100vh; height: 100dvh; isolation: isolate; background: var(--paper); }
.player-column, .stage, .swiper { position: absolute; inset: 0; width: 100%; height: 100%; }
/* Clipping must not create a second, browser-scrollable surface: focus and
   viewport changes can otherwise offset the transformed slide independently. */
.swiper { z-index: 0; overflow: hidden; overflow: clip; overflow-anchor: none; }
.swiper-slide { width: 100%; height: 100%; overflow: hidden; overflow: clip; }
.swiper-slide video {
  position: absolute; left: var(--media-x, 0px); top: var(--media-y, 60px);
  width: var(--media-w, 100%); height: var(--media-h, calc(100% - 68px));
  display: block; object-fit: cover; object-position: center; background: #f5f9fc;
}
video::-webkit-media-controls { display: none !important; }
video::-webkit-media-controls-start-playback-button { display: none !important; }
.glass-surface, .glass-disc {
  color: var(--ink); background: var(--glass); border: 1px solid rgb(255 255 255 / 90%);
  box-shadow: var(--glass-shadow); -webkit-backdrop-filter: blur(12px) saturate(160%); backdrop-filter: blur(12px) saturate(160%);
}
.glass-disc { position: relative; }
.glass-surface::before, .glass-disc::before { content: ''; position: absolute; inset: 2px; border-radius: inherit; border: 1px solid rgb(255 255 255 / 56%); border-bottom-color: rgb(26 48 98 / 9%); pointer-events: none; }
.glass-surface::after, .glass-disc::after { content: ''; position: absolute; left: 18%; top: 5px; width: 40%; height: 8%; border-radius: 50%; background: rgb(255 255 255 / 72%); box-shadow: 0 0 3px rgb(255 255 255 / 60%); transform: rotate(-18deg); pointer-events: none; }
.glass-disc svg, .glass-surface svg { position: relative; z-index: 1; }
.topbar {
  position: absolute; z-index: 3; left: var(--header-x, 12px); top: var(--header-y, 8px);
  width: var(--header-w, calc(100% - 24px)); height: var(--header-h, 44px);
  display: flex; align-items: center; justify-content: space-between; pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.brand { display: flex; align-items: center; min-height: 44px; }
.brand img { display: block; width: 72px; height: auto; }
progress { appearance: none; display: block; width: 100%; height: 4px; border: none; border-radius: 4px; background: var(--line); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); border-radius: 4px; }
progress::-webkit-progress-value { background: var(--accent-gradient); border-radius: 4px; }
progress::-moz-progress-bar { background: var(--accent-gradient); border-radius: 4px; }
.course-shortcut { --course-bar-height: clamp(56px, calc(var(--media-h) * .16), 128px); position: absolute; z-index: 3; left: var(--rail-x); top: calc(var(--rail-y) - var(--course-bar-height) - 16px); width: 48px; height: var(--course-bar-height); padding: 0; border-radius: 10px; background: transparent; }
#feed-progress { position: absolute; left: 50%; top: 50%; width: var(--course-bar-height); height: 3px; transform: translate(-50%, -50%) rotate(90deg); pointer-events: none; }
.course-shortcut:focus-visible { outline-offset: -4px; }
.action-rail {
  position: absolute; z-index: 3; left: var(--rail-x, calc(100% - 52px)); top: var(--rail-y, 45%);
  width: var(--rail-w, 48px); height: var(--rail-h, 204px);
  display: grid; grid-template-columns: 1fr; gap: var(--rail-gap, 12px);
}
[data-rail="grid"] .action-rail { grid-template-columns: repeat(2, 1fr); }
.rail-action { width: 48px; height: var(--rail-button-height, 60px); padding: 0; background: none; display: flex; flex-direction: column; align-items: center; justify-content: start; gap: 3px; }
.glass-disc { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; transition: transform .16s, background .16s; }
.rail-action:active .glass-disc { transform: scale(.93); }
.rail-action:hover .glass-disc { background-color: rgb(255 255 255 / 35%); }
.rail-label { font-size: 9px; line-height: 12px; font-weight: 600; white-space: nowrap; text-shadow: 0 1px 4px white, 0 -1px 4px white; }
.explanation-label { font-size: 8.5px; letter-spacing: -.15px; }
.play-btn { position: absolute; z-index: 2; left: calc(var(--media-x, 0px) + var(--media-w, 100%) / 2); top: calc(var(--media-y, 0px) + var(--media-h, 100%) / 2); transform: translate(-50%, -50%); width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; transition: opacity .16s; }
.play-btn svg { width: 28px; height: 28px; }
.play-btn span { display: none; }
.feed-playing .play-btn:not(:focus-visible) { opacity: 0; pointer-events: none; }
.feed-welcome .play-btn, .feed-ended .play-btn, .feed-welcome .timeline { visibility: hidden; }
.timeline { position: absolute; z-index: 4; left: var(--seek-x, 0px); top: var(--seek-y, calc(100% - 44px)); width: var(--seek-w, 100%); height: var(--seek-h, 44px); pointer-events: none; }
#seek { --played: 0%; appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 44px; margin: 0; border: 0; padding: 0; cursor: pointer; background: none; pointer-events: auto; touch-action: none; }
#seek::-webkit-slider-runnable-track { height: 3px; background: var(--accent-gradient) left / var(--played) 100% no-repeat, rgb(26 48 98 / 18%); box-shadow: 0 0 1px rgb(255 255 255 / 70%); }
#seek::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; margin-top: -5.5px; border: 1px solid white; border-radius: 50%; background: var(--accent); }
#seek::-moz-range-track { height: 3px; background: rgb(39 46 59 / 20%); }
#seek::-moz-range-progress { height: 3px; background: var(--accent-gradient); }
#seek::-moz-range-thumb { width: 14px; height: 14px; border: 1px solid white; border-radius: 50%; background: var(--accent); }
#seek:focus-visible { outline-offset: -3px; }
#time { position: absolute; right: 8px; bottom: 42px; padding: 5px 9px; border-radius: 6px; background: rgb(255 255 255 / 80%); font-size: 10px; font-weight: 600; font-variant-numeric: tabular-nums; opacity: 0; }
.timeline:focus-within #time, .timeline:hover #time, .is-scrubbing #time { opacity: 1; }
.eyebrow { font-size: 10px; font-weight: 750; letter-spacing: 1.1px; color: var(--muted); }
.primary { min-height: 48px; padding: 12px 18px; border: 1px solid rgb(255 255 255 / 24%); border-radius: 999px; font-family: Poppins, Inter, sans-serif; font-weight: 700; font-size: 13px; color: white; background: var(--ink); box-shadow: inset 0 1px 0 rgb(255 255 255 / 18%), 0 5px 14px rgb(15 35 74 / 14%); }
.primary:hover { background: var(--navy-deep); }
.text-button { min-height: 44px; background: transparent; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.welcome { position: absolute; z-index: 5; inset: 0; display: grid; place-items: center; padding: 68px 18px 18px; background: rgb(247 248 252 / 80%); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.welcome-card { width: min(100%, 340px); display: grid; gap: 20px; }
.welcome-card h2 { font-size: clamp(28px, 7vw, 40px); font-weight: 800; }
.welcome-card > p:not(.eyebrow) { line-height: 1.7; color: var(--muted); }
.welcome-card .eyebrow::before { content: ''; display: inline-block; width: 22px; height: 3px; margin-right: 8px; border-radius: 4px; background: var(--accent-gradient); vertical-align: middle; }
.welcome-hint { text-align: center; color: var(--muted); font-size: 11px; }
.feed-welcome .action-rail, .feed-welcome .course-shortcut,
.player-column:has(.video-error:not([hidden])) .action-rail,
.player-column:has(.video-error:not([hidden])) .course-shortcut,
.player-column:has(.video-error:not([hidden])) .play-btn { visibility: hidden; }
.feed-welcome .topbar { z-index: 6; }
.end-card, .video-error { position: absolute; z-index: 5; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(calc(100% - 32px), 340px); max-height: calc(100% - 100px); overflow-y: auto; padding: 24px; border: 1px solid white; border-radius: 24px; background: rgb(255 255 255 / 94%); box-shadow: 0 12px 70px rgb(20 27 40 / 18%); display: grid; gap: 16px; text-align: center; }
.end-card h2, .video-error h2 { font-size: 21px; }
/* A brief, central instruction; it never intercepts a swipe. */
.swipe-coach { position: absolute; z-index: 4; left: calc(var(--media-x) + var(--media-w) / 2); top: calc(var(--seek-y) - 94px); transform: translateX(-50%); width: max-content; max-width: calc(100% - 100px); min-height: 58px; border-radius: 22px; padding: 10px 16px; display: flex; align-items: center; gap: 12px; pointer-events: none; background-color: rgb(255 255 255 / 65%); }
.swipe-coach svg { width: 28px; height: 36px; color: var(--accent); animation: swipe-hand 1.6s ease-in-out infinite; }
.swipe-coach > span { display: grid; gap: 1px; }
.swipe-coach strong { font-size: 12px; font-weight: 700; }
#swipe-destination { color: var(--muted); font-size: 10px; }
.swipe-backwards svg { rotate: 180deg; }
@keyframes swipe-hand { 0%, 100% { transform: translateY(4px); } 50% { transform: translateY(-5px); } }
.enable-sound { position: absolute; z-index: 4; right: max(12px, var(--safe-right)); top: calc(var(--header-y) + 2px); min-height: 40px; padding: 8px 14px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.expanded-player .workspace { position: fixed; inset: 0; }
.swiper, .swiper-slide video { touch-action: none; }
.end-card { pointer-events: none; }
.end-card button { pointer-events: auto; }
.is-scrubbing #seek::-webkit-slider-thumb { width: 18px; height: 18px; margin-top: -7.5px; }
.is-scrubbing #seek::-moz-range-thumb { width: 18px; height: 18px; }

/* Native dialogs share one stacking, scrolling and focus model. */
.panel { color: var(--ink); background: linear-gradient(155deg, rgb(255 255 255 / 94%), rgb(247 248 252 / 85%) 55%, rgb(255 255 255 / 91%)); border: 1px solid rgb(255 255 255 / 95%); border-radius: 28px; padding: 0; width: min(calc(100% - 16px), 480px); max-width: 100%; max-height: calc(100dvh - max(24px, var(--safe-top)) - var(--safe-bottom)); margin: auto auto max(8px, var(--safe-bottom)); box-shadow: inset 0 2px 1px #fff, inset 0 -1px 1px rgb(26 48 98 / 13%), 0 -10px 48px rgb(15 35 74 / 16%); -webkit-backdrop-filter: blur(24px) saturate(150%); backdrop-filter: blur(24px) saturate(150%); overflow: hidden; }
.panel::before { content: ''; position: absolute; inset: 2px; border-radius: inherit; border: 1px solid rgb(255 255 255 / 56%); pointer-events: none; }
.panel[open] { display: flex; flex-direction: column; animation: panel-in .2s ease-out; }
.panel::backdrop { background: rgb(15 35 74 / 18%); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dialog-header { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 20px 16px; }
.dialog-header .eyebrow + h2 { margin-top: 5px; }
.dialog-header h2 { font-size: 24px; }
.icon-btn { position: relative; flex: none; min-width: 44px; height: 44px; border-radius: 50%; background: var(--glass); border: 1px solid rgb(255 255 255 / 90%); box-shadow: var(--glass-shadow); font-size: 17px; }
.panel-scroll { overflow-y: auto; overscroll-behavior: contain; min-height: 0; padding: 4px 22px 22px; }
.panel-footer { flex: none; padding: 16px 20px calc(16px + var(--safe-bottom)); border-top: 1px solid var(--line); }
.panel-footer .primary { width: 100%; }
.chapters-panel { height: min(88dvh, 760px); }
.course-progress { flex: none; padding: 0 22px; }
.course-progress > div { display: flex; justify-content: space-between; align-items: center; margin-bottom: 9px; font-size: 12px; }
.course-progress progress { height: 5px; }
.sidebar-intro { flex: none; padding: 18px 22px 8px; color: var(--muted); font-size: 12px; }
#chapters { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 12px 12px; }
.chapter { border-bottom: 1px solid var(--line); }
.chapter summary { list-style: none; min-height: 62px; display: grid; grid-template-columns: 30px 1fr auto 12px; gap: 9px; align-items: center; padding: 10px; cursor: pointer; }
.chapter summary::-webkit-details-marker { display: none; }
.chapter summary::after { content: '⌄'; color: var(--muted); font-size: 16px; }
.chapter[open] summary::after { transform: rotate(180deg); }
.chapter-number { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; font-size: 11px; font-weight: 650; background: rgb(26 48 98 / 5%); }
.chapter-name { font-size: 13px; font-weight: 650; line-height: 1.4; }
.chapter-size { display: grid; gap: 6px; min-width: 48px; color: var(--muted); font-size: 10px; white-space: nowrap; text-align: right; }
.chapter-meter { height: 3px; }
.chapter[data-complete="true"] .chapter-size { color: var(--ink); font-weight: 650; }
.lesson-link { width: 100%; display: grid; grid-template-columns: 18px 1fr auto; gap: 10px; align-items: center; text-align: left; border-radius: 12px; padding: 12px; min-height: 58px; background: none; }
.lesson-link:hover { background: var(--paper); }
.lesson-link[aria-current="true"] { background: rgb(26 48 98 / 5%); box-shadow: inset 3px 0 var(--accent), inset 0 0 0 1px rgb(255 255 255 / 70%); }
.lesson-indicator { font-size: 11px; color: var(--muted); text-align: center; }
.lesson-link[aria-current="true"] .lesson-indicator { color: var(--accent); }
.lesson-copy { display: grid; gap: 4px; min-width: 0; }
.lesson-name { font-size: 12px; line-height: 1.5; }
.lesson-state { font-size: 9px; color: var(--muted); font-weight: 650; }
.duration { font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
.sidebar-bottom { flex: none; padding: 10px 20px calc(8px + var(--safe-bottom)); border-top: 1px solid var(--line); text-align: center; }
.sidebar-bottom p { font-size: 10px; color: var(--muted); }
.sidebar-bottom button { font-size: 10px; min-height: 34px; }
.chapter-context { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; color: var(--muted); font-size: 11px; font-weight: 600; }
.chapter-badge { min-width: 28px; height: 28px; display: grid; place-items: center; background: rgb(26 48 98 / 5%); border-radius: 8px; }
#transcript-title { font-size: 26px; }
.lesson-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 11px; }
.role { padding: 3px 8px; border-radius: 6px; background: rgb(26 48 98 / 5%); }
#transcript-context { font-weight: 550; line-height: 1.7; margin: 24px 0; padding-left: 12px; border-left: 3px solid; border-image: var(--accent-gradient) 1; }
#transcript-body { color: var(--ink); font-size: 14px; line-height: 1.8; }
#transcript-body p + p { margin-top: 16px; }
.notice { position: fixed; z-index: 30; left: 50%; top: calc(70px + var(--safe-top)); transform: translateX(-50%); width: max-content; max-width: calc(100% - 32px); border: 1px solid white; border-radius: 16px; padding: 12px 16px; background: white; box-shadow: 0 4px 24px rgb(25 32 47 / 14%); font-size: 12px; }
.fatal { position: fixed; inset: 0; padding: 30px; background: white; z-index: 100; }
@keyframes panel-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@media (min-width: 700px) { .panel { margin: auto; border-radius: 26px; max-height: calc(100dvh - 32px); } }
@media (max-height: 650px) { .rail-action { gap: 0; } }
@media (max-height: 420px) {
  .dialog-header { padding: 10px 16px; }
  .dialog-header h2 { font-size: 20px; }
  .panel-footer { padding: 8px 16px calc(8px + var(--safe-bottom)); }
  .sidebar-intro { padding-top: 8px; }
  .sidebar-bottom { padding-top: 6px; }
  .welcome { overflow-y: auto; padding-top: 60px; }
  .welcome-card { gap: 10px; }
  .welcome-card h2 { font-size: 26px; }
  .welcome-card > p:not(.eyebrow) { font-size: 12px; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) { .glass-surface, .glass-disc, .panel { background: rgb(255 255 255 / 96%); } }
@media (prefers-reduced-transparency: reduce) { .glass-surface, .glass-disc, .panel, .swipe-coach, .welcome { background: #fff; backdrop-filter: none; -webkit-backdrop-filter: none; } .glass-surface::after, .glass-disc::after { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
