/* The published player: the film fills the window at 16:9, controls float over it. */
:root {
  --bg: #000; --text: #c9d2e6; --dim: #7d89a6; --accent: #7ef0ff; --warn: #ff6b5e;
  --panel: rgba(8, 12, 22, .78); --line: rgba(201, 210, 230, .14);
  --mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --sans: system-ui, -apple-system, 'PingFang SC', 'Noto Sans SC', 'Microsoft YaHei', sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 15px/1.6 var(--sans); overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
svg { width: 22px; height: 22px; fill: currentColor; display: block; }

#app { position: fixed; inset: 0; display: grid; place-items: center; }
#app.idle { cursor: none; }
#stage { width: min(100vw, calc(100vh * 16 / 9)); aspect-ratio: 16 / 9; position: relative; }
#view { width: 100%; height: 100%; display: block; background: #000; }
.subs { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* ---------------------------------------------------------------- cover and start screen */
/* The cover (index.html) fills the window from the first paint: the film's cover on landscape screens (it carries the
   title and credits; 21:9 and near-square windows see it whole), the galaxy and title alone on portrait ones. */
.cover { position: absolute; inset: 0; z-index: 1; background: #000; transition: opacity .25s; }
.cover.gone { opacity: 0; pointer-events: none; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
@media (min-aspect-ratio: 5/6) and (max-aspect-ratio: 7/5), (min-aspect-ratio: 2/1) { .cover img { object-fit: contain; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
/* landscape: the play button in the cover's empty corner, bottom left, under the title's left edge */
.start { position: absolute; inset: 0; z-index: 2; display: flex; align-items: flex-end; justify-content: flex-start; padding: 0 0 max(8vh, 24px) max(7.5vw, 20px);
  background: linear-gradient(20deg, rgba(0, 0, 0, .55), transparent 45%); transition: opacity .25s; overflow-y: auto; }
.start.gone { opacity: 0; pointer-events: none; }
.card { width: min(380px, 100%); text-align: left; }
.credits { display: none; }
/* portrait: the title in the cover's upper third, the button and the credits in the dark below */
@media (max-aspect-ratio: 5/6) {
  .start { justify-content: center; padding: 0 20px max(9vh, calc(24px + env(safe-area-inset-bottom))); background: linear-gradient(to top, rgba(0, 0, 0, .7), transparent 40%); }
  .card { text-align: center; }
  .credits { display: flex; flex-direction: column; gap: .2em; font: 12px var(--mono); color: var(--dim); margin: 1.6em 0 0; }
}
.progress { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin: 0 0 .5em; transition: opacity .25s; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress.done { opacity: 0; }
.status { font: 12.5px var(--mono); color: var(--text); opacity: .75; margin: 0 0 1em; min-height: 1.6em; text-shadow: 0 1px 4px #000; }
.status.bad { color: var(--warn); opacity: 1; font-family: var(--sans); font-size: 14px; }
.go { display: inline-flex; align-items: center; gap: 10px; padding: 12px 28px; border-radius: 999px; background: var(--accent); color: #041018; font-weight: 600; font-size: 16px; min-height: 48px;
  box-shadow: 0 0 28px rgba(126, 240, 255, .35); transition: transform .15s, opacity .25s; }
.go:hover:not(:disabled) { transform: scale(1.04); }
.go:disabled { opacity: .3; cursor: default; box-shadow: none; }
.go svg { width: 18px; height: 18px; }
.bili { display: inline-block; margin-top: .8em; color: var(--accent); font-size: 13.5px; text-decoration: none; }
/* the photosensitivity warning before the first play */
.modal { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.modal[hidden] { display: none; }
.modal .box { width: min(440px, 100%); text-align: left; background: rgba(12, 16, 26, .96); border: 1px solid rgba(255, 107, 94, .4); border-radius: 12px; padding: 18px 20px 16px; font-size: 14px; box-shadow: 0 12px 48px rgba(0, 0, 0, .6); }
.modal b { color: var(--warn); font-weight: 600; font-size: 15px; }
.modal p { margin: .5em 0 0; }
.modal p[lang=en] { color: var(--dim); font-size: 12.5px; }
.modal .hint { color: var(--dim); font-size: 12.5px; margin-top: 1em; padding-top: .8em; border-top: 1px solid var(--line); }
.again { display: flex; align-items: center; gap: 8px; margin: 1em 0 0; font-size: 13.5px; cursor: pointer; user-select: none; }
.again input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.acts { display: flex; justify-content: flex-end; gap: 10px; margin-top: 1em; }
.acts button { padding: 9px 18px; border-radius: 999px; min-height: 40px; font-size: 14px; }
.acts .no { color: var(--dim); }
.acts .yes { background: var(--accent); color: #041018; font-weight: 600; }

/* ---------------------------------------------------------------- control bar */
.bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 8px 14px calc(8px + env(safe-area-inset-bottom)); min-height: 56px; background: linear-gradient(transparent, rgba(0, 0, 0, .78)); transition: opacity .25s; }
.bar.off, #app.idle .bar { opacity: 0; pointer-events: none; }
.bar > button, .vol .mute { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 8px; flex: none; }
.bar > button:hover, .vol .mute:hover, .qbtn:hover { background: rgba(255, 255, 255, .08); }
.time { font: 12.5px var(--mono); color: var(--text); white-space: nowrap; flex: none; }
.seek { position: relative; flex: 1; height: 44px; cursor: pointer; touch-action: none; min-width: 60px; }
.seek::before { content: ''; position: absolute; left: 0; right: 0; top: 19px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, .1); }
.secs i { position: absolute; top: 19px; height: 6px; }
.fill { position: absolute; left: 0; top: 19px; height: 6px; border-radius: 3px 0 0 3px; background: var(--accent); opacity: .85; }
.head { position: absolute; top: 15px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 3px rgba(126, 240, 255, .3); }
.tip { position: absolute; bottom: 40px; transform: translateX(-50%); padding: 3px 8px; border-radius: 6px; background: var(--panel); font: 12px var(--mono); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s; }
.seek:hover .tip { opacity: 1; }
.vol { display: flex; align-items: center; flex: none; }
.vol input { width: 80px; accent-color: var(--accent); }
.qwrap { position: relative; flex: none; }
.qbtn { position: relative; height: 44px; padding: 0 12px; border-radius: 8px; font: 12.5px var(--mono); white-space: nowrap; }
.dot { position: absolute; top: 9px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); display: none; }
.dot.on { display: block; }
.menu { position: absolute; right: 0; bottom: 52px; width: 230px; padding: 8px; border-radius: 10px; background: var(--panel); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border: 1px solid var(--line); }
.menu .mh { margin: 4px 8px; font-size: 12px; color: var(--dim); }
.menu button { display: block; width: 100%; text-align: left; padding: 9px 10px; border-radius: 6px; font-size: 14px; min-height: 40px; }
.menu button:hover { background: rgba(255, 255, 255, .07); }
.menu button.on { color: var(--accent); }
.menu button.on::after { content: '✓'; float: right; }
.menu .row { display: flex; gap: 4px; }
.menu .row button { text-align: center; }
.menu .row button.on::after { content: none; }
.menu .stat { margin: 8px 8px 2px; font: 11.5px/1.5 var(--mono); color: var(--dim); }

.toast { position: absolute; top: 16px; right: 16px; z-index: 4; max-width: calc(100% - 32px); padding: 9px 14px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); font-size: 13.5px; opacity: 0; transform: translateY(-6px); transition: opacity .25s, transform .25s; pointer-events: none; }
.toast.on { opacity: 1; transform: none; }

/* ---------------------------------------------------------------- phones */
@media (max-width: 600px) {
  .bar { gap: 4px; padding-left: 6px; padding-right: 6px; }
  .vol input { display: none; }
  .time { font-size: 11.5px; }
  .menu { position: fixed; left: 8px; right: 8px; bottom: calc(64px + env(safe-area-inset-bottom)); width: auto; }
}
