/* The player (docs/designs/lyra-web-screens.md, 3.12). */
body.playing { overflow: hidden; }
.player { position: fixed; inset: 0; z-index: 1500; background: #000; color: #fff; overflow: hidden; outline: none; user-select: none; -webkit-user-select: none; cursor: none; transition: opacity .25s ease-out; }
.player.controls, .player.launching, .player.scrubbing { cursor: default; }
.player.closing { opacity: 0; }
.p-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.p-video.fill { object-fit: cover; }
.spinner.big { width: 31px; height: 31px; border-width: 3px; }

/* opening: black, a spinner and the title */
.p-launch { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; pointer-events: none; }
.p-launch p { font-size: 15px; font-weight: 600; color: rgba(255,255,255,.7); max-width: 80%; text-align: center; }
.p-wait { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); pointer-events: none; }

/* the controls, over a darkening at the top and the bottom */
.p-controls { position: absolute; inset: 0; opacity: 0; transition: opacity .2s ease-in-out; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.6), transparent 26%, transparent 66%, rgba(0,0,0,.75)); }
.player.controls .p-controls, .player.scrubbing .p-controls { opacity: 1; pointer-events: auto; }
.player.launching .p-controls { opacity: 1; pointer-events: auto; background: none; }
.player.launching .p-centre, .player.launching .p-bottom, .player.launching .p-top-right, .player.launching .p-heading { visibility: hidden; }
.p-btn { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; color: #fff; transition: background .12s ease-out, transform .12s ease-out; }
.p-btn:hover { background: rgba(255,255,255,.12); }
.p-btn:active { transform: scale(.94); }
.p-top { position: absolute; left: 0; right: 0; top: 0; display: flex; align-items: center; gap: 14px; padding: 18px 24px; }
.p-heading { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.p-heading strong { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-heading span { font-size: 15px; color: rgba(255,255,255,.75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-heading span:empty { display: none; }
.p-top-right { display: flex; align-items: center; gap: 4px; }
.p-centre { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; align-items: center; gap: 56px; }
.p-centre .p-btn { width: 60px; height: 60px; }
.p-centre .p-play { width: 84px; height: 84px; }
.p-bottom { position: absolute; left: 32px; right: 32px; bottom: 16px; }

/* the scrubber */
.p-track { position: relative; height: 26px; display: flex; align-items: center; cursor: pointer; touch-action: none; outline: none; }
.p-track-line { position: relative; width: 100%; height: 6px; border-radius: 3px; background: rgba(255,255,255,.3); overflow: hidden; }
.p-track-fill { position: absolute; left: 0; top: 0; bottom: 0; background: #fff; }
.p-knob { position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); transition: width .1s, height .1s, margin .1s; }
.player.scrubbing .p-knob, .p-track:hover .p-knob { width: 24px; height: 24px; margin: -12px 0 0 -12px; }
.p-track:focus-visible .p-knob { outline: 2px solid var(--accent); outline-offset: 2px; }
.p-times { display: flex; justify-content: space-between; align-items: center; margin-top: 2px; font-size: 12px; color: rgba(255,255,255,.85); }
.p-times-right { display: flex; align-items: center; gap: 10px; }
.p-times-right .p-btn { width: 36px; height: 36px; margin-right: -8px; }
/* Fill crops the picture to the screen: only useful full screen. */
.player:not(.full) .p-fill { display: none; }
.p-word { height: 30px; padding: 0 12px; margin-right: 6px; border-radius: 999px; border: 1.5px solid rgba(255,255,255,.7); font-size: 13px; font-weight: 600; color: #fff; transition: background .12s ease-out; }
.p-word:hover { background: rgba(255,255,255,.14); }
.p-preview { position: absolute; bottom: 30px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; pointer-events: none; }
.p-preview-pic { border-radius: 6px; border: 1.5px solid #fff; background-color: #000; background-repeat: no-repeat; box-shadow: 0 6px 16px rgba(0,0,0,.5); }
.p-preview-time { font-size: 13px; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,.8); }

/* double-click skip badges */
.p-badge { position: absolute; top: 50%; width: 120px; height: 120px; margin: -60px 0 0 -60px; border-radius: 50%; background: rgba(0,0,0,.35); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 13px; font-weight: 600; opacity: 0; transition: opacity .25s ease-out; pointer-events: none; }
.p-badge.left { left: 20%; } .p-badge.right { left: 80%; }
.p-badge.in { opacity: 1; transition: none; }

/* subtitles, drawn by the player */
.p-subs { position: absolute; left: 6%; right: 6%; bottom: 40px; display: flex; justify-content: center; text-align: center; pointer-events: none; transition: bottom .2s ease-in-out; }
.player.controls .p-subs { bottom: 110px; }
.p-subs span { white-space: pre-line; font-size: clamp(18px, 2.4vw, 34px); font-weight: 600; line-height: 1.25; text-shadow: 0 0 2px #000, 0 1px 3px #000, 0 0 6px rgba(0,0,0,.6); }

/* Skip Intro, Next Episode */
.p-skip { position: absolute; right: 48px; bottom: 36px; transition: bottom .2s ease-in-out; }
.player.controls .p-skip { bottom: 96px; }
.p-capsule { display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 20px; border-radius: 999px; background: #fff; color: #000; font-size: 16px; font-weight: 600; transition: transform .12s ease-out, opacity .12s; }
.p-capsule:hover { transform: scale(1.03); }
.p-capsule:active { transform: scale(.97); opacity: .85; }
.p-capsule.dim { background: rgba(255,255,255,.18); color: #fff; }

/* Up Next, design A "Shrink" (docs/designs/lyra-up-next.md): the picture
   goes to the top-left corner and keeps playing; the next title fills the
   screen. Drawn as the TV mockups (1920 x 1080) scaled to the window: --u
   is one mockup pixel. A small window (a phone on its side) uses the
   phone mockups (932 x 430) instead. Numbers are mockup pixels. */
.player {
  --u: min(calc(100vw / 1920), calc(100vh / 1080));
  /* the corner, the words, the buttons, the row */
  --cx: 90; --cy: 70; --cw: 448; --ch: 252; --cr: 16;
  --ty: 430; --tw: 860; --lb: 24; --nm: 92; --nmt: 14; --mt: 28; --mmt: 16; --ov: 30; --omt: 20;
  --bmt: 44; --bh: 84; --bfs: 32; --bpad: 40; --bgap: 22; --ic: 30;
  --ry: 862; --rw: 300; --rh: 169; --rg: 28; --rfs: 22; --rsub: 17; --rr: 16; --rpx: 18; --rpy: 14;
  --lw: 780; --lh: 240;
}
.player.up-ep { --cy: 80; --cw: 560; --ch: 315; --cr: 18; --ty: 470; --nm: 96; }
.player.up-row { --ty: 360; }
@media (max-height: 560px), (max-width: 760px) {
  .player {
    --u: min(calc(100vw / 932), calc(100vh / 430));
    --cx: 48; --cy: 22; --cw: 176; --ch: 99; --cr: 8;
    --ty: 146; --tw: 440; --lb: 11; --nm: 36; --nmt: 5; --mt: 13; --mmt: 4; --ov: 14; --omt: 8;
    --bmt: 16; --bh: 40; --bfs: 15; --bpad: 18; --bgap: 10; --ic: 14;
    --ry: 322; --rw: 150; --rh: 84; --rg: 12; --rfs: 11; --rsub: 9; --rr: 10; --rpx: 10; --rpy: 8;
    --lw: 380; --lh: 110;
  }
  .player.up-ep { --cy: 26; --cw: 224; --ch: 126; --cr: 10; --ty: 176; --nm: 38; --nmt: 6; --mmt: 6; --bmt: 18; }
  .player.up-row { --ty: 136; --tw: 420; --bmt: 14; }
  .player.up-row .p-up-overview { display: none; }
}
/* a window taller than wide: the phone's sizes, by its width */
@media (max-aspect-ratio: 1/1) { .player { --u: calc(100vw / 540); } }

.p-video { transition: left .45s cubic-bezier(.2, .8, .2, 1), top .45s cubic-bezier(.2, .8, .2, 1), width .45s cubic-bezier(.2, .8, .2, 1), height .45s cubic-bezier(.2, .8, .2, 1), border-radius .45s ease-out, box-shadow .45s ease-out; }
.player.shrunk { cursor: default; }
.player.shrunk .p-video { z-index: 2; left: calc(var(--cx) * var(--u)); top: calc(var(--cy) * var(--u)); width: calc(var(--cw) * var(--u)); height: calc(var(--ch) * var(--u));
  border-radius: calc(var(--cr) * var(--u)); object-fit: contain; cursor: pointer; outline: 1px solid rgba(255,255,255,.14); box-shadow: 0 calc(30 * var(--u)) calc(70 * var(--u)) rgba(0,0,0,.65); }
.player.shrunk .p-video:hover { outline-color: rgba(255,255,255,.5); }
.player.shrunk .p-error { z-index: 3; }
.player.shrunk .p-controls, .player.shrunk .p-subs, .player.shrunk .p-skip, .player.shrunk .p-notice, .player.shrunk .p-badge, .player.shrunk .p-wait { display: none; }

.p-up { position: absolute; inset: 0; z-index: 1; overflow: hidden; background: #0e0a11; cursor: default; animation: p-fade .35s ease-out; }
/* the next title's picture: blurred across, sharp on the right, dark on the left for the words */
.p-up-art { position: absolute; inset: 0; }
.p-up-art .pic { position: absolute; object-fit: cover; object-position: 50% 25%; }
.p-up-art .p-up-blur { left: -10%; top: -10%; width: 120%; height: 120%; filter: blur(calc(60 * var(--u))) saturate(1.2); }
/* The sharp picture keeps its own 16:9 shape in the top right, fading left
   and down into the blur: drawn the screen's height tall, a 1080p still was
   enlarged 2× and cut at the sides on a laptop, and film grain looked like
   pixels (The Altruists, 2026-12-02). */
.p-up-art .p-up-sharp { left: auto; right: 0; top: 0; width: 62%; height: auto; aspect-ratio: 16 / 9;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 35%), linear-gradient(180deg, #000 55%, transparent); -webkit-mask-composite: source-in;
  mask-image: linear-gradient(90deg, transparent, #000 35%), linear-gradient(180deg, #000 55%, transparent); mask-composite: intersect; }
/* a window taller than wide: the picture across the top */
@media (max-aspect-ratio: 1/1) { .p-up-art .p-up-sharp { width: 100%; } }
.p-up-shade { position: absolute; inset: 0; background: linear-gradient(90deg, rgba(14,10,17,.95), rgba(14,10,17,.75) 38%, rgba(14,10,17,0) 72%), linear-gradient(180deg, rgba(14,10,17,0) 50%, rgba(14,10,17,.92)); }
.p-up-close { position: absolute; top: max(12px, calc(var(--cy) * var(--u) - 10px)); right: max(12px, calc(var(--cx) * var(--u) / 2)); z-index: 1; color: rgba(255,255,255,.85); background: rgba(0,0,0,.25); }
.p-up-text { position: absolute; left: calc(var(--cx) * var(--u)); top: calc(var(--ty) * var(--u)); width: min(calc(var(--tw) * var(--u)), calc(100% - var(--cx) * 2 * var(--u))); }
.p-up-label { font-size: calc(var(--lb) * var(--u)); font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: rgba(255,255,255,.55); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-up-name { margin-top: calc(var(--nmt) * var(--u)); font-size: calc(var(--nm) * var(--u)); font-weight: 700; letter-spacing: -.02em; line-height: 1.02; color: rgba(255,255,255,.96);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; padding-bottom: .06em; }
.p-up-name.long { font-size: calc(var(--nm) * .7 * var(--u)); }
.p-up-meta { margin-top: calc(var(--mmt) * var(--u)); font-size: calc(var(--mt) * var(--u)); color: rgba(255,255,255,.66); }
.p-up-overview { margin-top: calc(var(--omt) * var(--u)); font-size: calc(var(--ov) * var(--u)); line-height: 1.4; color: rgba(255,255,255,.82);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
/* the buttons: the first white, the countdown greying what is left of it */
.p-up-btns { display: flex; align-items: center; gap: calc(var(--bgap) * var(--u)); margin-top: calc(var(--bmt) * var(--u)); }
.p-up-btn { position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; gap: calc(var(--bh) * .17 * var(--u));
  height: calc(var(--bh) * var(--u)); padding: 0 calc(var(--bpad) * var(--u)) 0 calc((var(--bpad) - 6) * var(--u)); border-radius: 999px;
  background: rgba(255,255,255,.16); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); color: #fff; font-size: calc(var(--bfs) * var(--u)); font-weight: 600; white-space: nowrap;
  outline: none; transition: transform .15s ease-out, box-shadow .15s ease-out, background .15s ease-out; }
.p-up-btn.round { width: calc(var(--bh) * var(--u)); padding: 0; }
.p-up-btn.lead { background: #fff; color: #16101a; }
.p-up-btn:hover { background: rgba(255,255,255,.26); }
.p-up-btn.lead:hover { background: #fff; }
.p-up-btn:focus { transform: scale(1.07); box-shadow: 0 calc(16 * var(--u)) calc(34 * var(--u)) rgba(0,0,0,.55); }
.p-up-btn:not(.lead):focus-visible { background: rgba(255,255,255,.32); }
.p-up-btn:active { transform: scale(1.02); }
.p-up-btn.done { cursor: default; }
.p-up-btn > .icon, .p-up-btn > span { position: relative; }
.p-up-btn > .icon { width: calc(var(--ic) * var(--u)); height: calc(var(--ic) * var(--u)); flex: none; }
.p-up-rest { position: absolute; inset: 0; background: rgba(22,16,26,.13); transform-origin: right; transition: transform .25s linear; }
/* the row: 16:9 tiles, greyed when not in Lyra */
.p-up-row { position: absolute; left: calc(var(--cx) * var(--u) - 10px); right: 0; top: calc(var(--ry) * var(--u) - 10px); display: flex; gap: calc(var(--rg) * var(--u));
  padding: 10px calc(var(--cx) * var(--u)) 10px 10px; overflow-x: auto; scrollbar-width: none; }
.p-up-row::-webkit-scrollbar { display: none; }
.p-up-tile { position: relative; flex: none; width: calc(var(--rw) * var(--u)); height: calc(var(--rh) * var(--u)); border-radius: calc(var(--rr) * var(--u)); overflow: hidden;
  background: #1b1320; text-align: left; outline: none; transition: transform .15s ease-out, box-shadow .15s ease-out; }
.p-up-tile .pic { position: absolute; inset: 0; object-position: 50% 30%; }
.p-up-tile.out .pic { filter: saturate(.35) brightness(.7); }
.p-up-tile-shade { position: absolute; left: 0; right: 0; bottom: 0; height: 60%; background: linear-gradient(180deg, rgba(0,0,0,0), rgba(0,0,0,.85)); }
.p-up-tile b { position: absolute; left: calc(var(--rpx) * var(--u)); right: calc(var(--rpy) * var(--u)); bottom: calc(var(--rpy) * var(--u)); font-size: calc(var(--rfs) * var(--u)); font-weight: 600; line-height: 1.15; color: #fff;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-up-tile small { display: block; margin-top: calc(3 * var(--u)); font-size: calc(var(--rsub) * var(--u)); font-weight: 500; color: rgba(255,255,255,.6); }
.p-up-tile:hover { transform: scale(1.03); }
.p-up-tile:focus-visible { box-shadow: 0 0 0 max(3px, calc(6 * var(--u))) #fff, 0 calc(30 * var(--u)) calc(60 * var(--u)) rgba(0,0,0,.7); }
/* A new episode with no picture yet: the show's wide picture across the
   screen, and its logo in place of the label, the episode small under it. */
.p-up.wide { background: #0a080c; }
.p-up.wide .p-up-blur { display: none; }
.p-up.wide .p-up-art .p-up-sharp { width: 100%; height: 100%; aspect-ratio: auto; object-position: 75% 30%; -webkit-mask-image: none; mask-image: none; }
.p-up.wide .p-up-shade { background: linear-gradient(90deg, rgba(10,8,12,.96), rgba(10,8,12,.8) 34%, rgba(10,8,12,.15) 70%, rgba(10,8,12,0)), linear-gradient(180deg, rgba(10,8,12,0) 55%, rgba(10,8,12,.9)); }
.p-up-logo { display: block; width: calc(var(--lw) * var(--u)); max-width: 100%; max-height: calc(var(--lh) * var(--u)); object-fit: contain; object-position: left bottom;
  filter: drop-shadow(0 calc(8 * var(--u)) calc(30 * var(--u)) rgba(0,0,0,.6)); }
.p-up-name.small { margin-top: calc(var(--nmt) * 2.1 * var(--u)); font-size: calc(var(--nm) * .5 * var(--u)); line-height: 1.15; }
@media (prefers-reduced-motion: reduce) { .p-video, .p-up-rest { transition: none; } .p-up { animation: none; } }

/* the connection notice */
.p-notice { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 9px 16px; border-radius: 999px; background: rgba(0,0,0,.62); box-shadow: inset 0 0 0 .5px rgba(255,255,255,.12); font-size: 14px; font-weight: 500; white-space: nowrap; transition: top .2s ease-in-out; pointer-events: none; }
.player.controls .p-notice { top: 64px; }

/* errors */
.p-error { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 16px; max-width: min(460px, calc(100% - 48px)); padding: 24px 26px; border-radius: 12px; background: rgba(0,0,0,.7); text-align: center; font-size: 16px; }

/* panels: Audio and Subtitles, Playback Settings */
.p-panel { position: absolute; inset: 0; z-index: 5; background: rgba(0,0,0,.94); padding: 36px 72px 72px; overflow: auto; cursor: default; animation: p-fade .2s ease-out; }
@keyframes p-fade { from { opacity: 0; } }
.p-panel.again { animation: none; }
.p-panel-close { position: absolute; top: 18px; right: 22px; }
.p-debug { position: absolute; left: 72px; bottom: 26px; display: flex; align-items: center; gap: 9px; font-size: 13px; font-weight: 600; color: rgba(255,255,255,.6); }
.p-switch { position: relative; width: 34px; height: 20px; border-radius: 10px; background: rgba(255,255,255,.2); transition: background .15s ease-out; }
.p-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .15s ease-out; }
.p-debug.on .p-switch { background: var(--accent); }
.p-debug.on .p-switch::after { left: 16px; }
.p-cols { display: flex; gap: 48px; flex-wrap: wrap; margin-top: 8px; }
.p-col { min-width: 160px; display: flex; flex-direction: column; }
.p-col.wide { flex: 1 1 280px; max-width: 460px; }
.p-col.q { width: 132px; min-width: 132px; } .p-col.s { width: 116px; min-width: 100px; }
.p-col h3 { font-size: 20px; font-weight: 700; margin-bottom: 10px; white-space: nowrap; }
.p-rows { display: flex; flex-direction: column; }
.p-row { display: flex; align-items: flex-start; gap: 8px; padding: 10px 0; font-size: 17px; color: rgba(255,255,255,.62); text-align: left; }
.p-row:hover { color: #fff; }
.p-row.on { color: #fff; font-weight: 600; }
.p-check { width: 16px; flex: none; padding-top: 3px; }
.p-check .icon { stroke-width: 2.6; }
.p-none { font-size: 16px; color: rgba(255,255,255,.5); }
.p-table { display: grid; grid-template-columns: max-content 1fr; gap: 0 18px; align-items: center; }
.p-k { font-size: 13px; font-weight: 500; color: rgba(255,255,255,.5); line-height: 28px; }
.p-v { font-size: 15px; line-height: 28px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.p-sep { grid-column: 1 / 3; height: 1px; background: rgba(255,255,255,.14); margin: 9px 0; }

@media (max-width: 599px) {
  .p-top { padding: 12px 10px; gap: 6px; }
  .p-centre { gap: 30px; }
  .p-bottom { left: 16px; right: 16px; }
  .p-panel { padding: 70px 22px 72px; }
  .p-debug { left: 22px; }
  .p-cols { gap: 28px; }
  .p-skip { right: 16px; }
}

/* reloading while a film plays: black at once, until the player is there */
body.boot-play::after { content: ""; position: fixed; inset: 0; z-index: 1400; background: #000; }
body.boot-play::before { content: ""; position: fixed; left: 50%; top: 50%; z-index: 1401; width: 31px; height: 31px; margin: -16px 0 0 -16px; border-radius: 50%; border: 3px solid rgba(255,255,255,.18); border-top-color: #fff; animation: spin .8s linear infinite; }
/* the browser didn't start it: a large Play in the middle */
.player.press-play .p-play { transform: scale(1.25); }
