body:has(.vopi-public[data-page="media"]) #main {
  display: block;
  max-width: 880px;
}

#media-mascot-zone {
  position: relative;
  height: 74px;
  overflow: clip;
}
.media-mascot {
  position: absolute;
  left: var(--mascot-x, 24px);
  top: var(--mascot-y, 6px);
  display: grid;
  place-items: center;
  width: 72px;
  height: 62px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}
.media-mascot:focus-visible { outline: 1px solid var(--brand-gold); outline-offset: -3px; border-radius: 50%; }
.media-mascot :is(img, video) {
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
}
.media-mascot[data-dancing] img { visibility: hidden; }
html[data-site-theme="night"] .media-mascot :is(img, video) {
  filter: drop-shadow(0 0 1px #f2d39b);
}
.media-mascot-hit {
  grid-area: 1 / 1;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--brand-gold);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand-gold), transparent 75%);
  opacity: 0;
  pointer-events: none;
}
@media (prefers-reduced-motion: no-preference) {
  .media-mascot { transition: left 205ms cubic-bezier(.2,.8,.24,1), top 175ms ease-out; }
  .media-mascot[data-frozen] { transition: none; }
}

.media-content { padding-block: clamp(14px, 2.1vw, 32px) clamp(24px, 4vw, 50px); }
.media-feature { position: relative; width: min(100%, 330px); margin-inline: auto; }
.film-heading {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.film-heading-actions { display: flex; flex: 0 0 auto; align-items: center; gap: 3px; }
#film-share-link {
  position: absolute;
  z-index: 7;
  top: calc(100% + 3px);
  inset-inline: 0;
  width: 100%;
  min-height: 36px;
  padding: 4px 8px;
  border: 1px solid var(--gold);
  border-radius: 4px;
  background: var(--paper);
  color: var(--ink);
  font: 400 .77rem var(--brand-body, system-ui);
}
.media-content .film-heading > #film-title {
  min-width: 0;
  margin: 0;
  color: var(--brand-gold);
  font: 600 clamp(1.35rem, 2.6vw, 1.65rem)/1.18 var(--latin);
  letter-spacing: -.023em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
html[lang="zh"] .media-content .film-heading > #film-title {
  font-family: var(--display);
  letter-spacing: 0;
}
.film-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-height: 46px;
  margin-bottom: 6px;
  border-block: 1px solid var(--line);
  cursor: grab;
  user-select: none;
  touch-action: pan-y;
  perspective: 600px;
}
.film-strip:active { cursor: grabbing; }
.film-step {
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  min-height: 44px;
  padding: 2px 5px;
  border: 0;
  border-radius: 4px;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}
#previous-film { grid-column: 1; }
#previous-film img { order: 1; }
#next-film { grid-column: 3; justify-content: end; }
.film-step:is(:hover, :focus-visible) { background: var(--pale); }
.film-step[aria-disabled="true"] { opacity: .42; background: transparent; cursor: grab; }
.film-step img {
  display: block;
  flex: 0 0 24px;
  width: 24px;
  height: 32px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 3px;
  opacity: .9;
  transition: opacity 150ms ease-out, border-color 150ms ease-out;
  -webkit-user-drag: none;
}
.film-step:is(:hover, :focus-visible) img { opacity: 1; border-color: var(--gold); }
.film-step-text { display: flex; align-items: center; gap: 5px; min-width: 0; font-size: .73rem; }
.film-step-arrow { color: var(--gold); font: 400 1.25rem/1 var(--latin); }
.film-overview {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 7px;
  border: 0;
  border-radius: 4px;
  color: var(--brand-gold);
  background: transparent;
  font: 600 .78rem/1.14 var(--brand-body, system-ui);
}
.film-overview:is(:hover, :focus-visible, [aria-expanded="true"]) { background: var(--pale); }
.film-position {
  grid-column: 2;
  grid-row: 1;
  color: var(--muted);
  font-size: .65rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.film-cover img { -webkit-user-drag: none; user-select: none; }
.media-content :is(h2, h3) { margin: 0; font: 400 clamp(22px, 2.2vw, 30px)/1.15 var(--latin); letter-spacing: -.022em; }
html[lang="zh"] .media-content :is(h2, h3) { font-family: var(--display); letter-spacing: 0; }

.media-player {
  --player-paper: #1b1916;
  --player-ink: #f5f0e6;
  --player-muted: #c3bbad;
  --player-gold: #f0cf84;
  --player-line: #ded5c341;
  --controls-clearance: 66px;
  position: relative;
  color: var(--player-ink);
  background: var(--player-paper);
  border: 1px solid #1c1815;
  border-radius: 5px;
  color-scheme: dark;
}

.media-theater {
  position: relative;
  isolation: isolate;
  width: 100%;
  aspect-ratio: 9 / 16;
  background: #171615;
  border-radius: 4px 4px 0 0;
}

.film-reel {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
}

.film-cover, .media-theater video { display: block; width: 100%; height: 100%; border-radius: inherit; }
.film-cover { position: relative; overflow: hidden; padding: 0; border: 0; background: transparent; backface-visibility: hidden; }
.film-cover img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform 200ms ease-out; }
.film-cover:hover img { transform: scale(1.018); }
.media-theater video { object-fit: contain; }
.film-play-icon {
  display: grid;
  position: absolute;
  inset: 0;
  place-content: center;
  margin: auto;
  width: 42px;
  height: 42px;
  border: 1px solid #f1d391;
  border-radius: 50%;
  background: #171410ce;
  color: #fff8e6;
  transition: background 180ms ease;
}
.film-cover:hover .film-play-icon { background: #171410ed; }
.film-play-icon::before {
  content: "";
  margin-inline-start: 3px;
  border-block: 7px solid transparent;
  border-inline-start: 11px solid currentColor;
}

@media (prefers-reduced-motion: no-preference) {
  .media-theater video:not([hidden]) { animation: film-reveal 180ms ease-out both; }
  @keyframes film-reveal { from { opacity: .25; } to { opacity: 1; } }
}

.player-dock {
  position: relative;
  padding: 0 7px 2px;
  border-top: 1px solid var(--player-line);
  background: var(--player-paper);
  border-radius: 0 0 4px 4px;
}

.player-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}
.player-caption { flex: 1; min-width: 0; }
.player-caption #film-caption {
  display: block;
  font: 500 .79rem/1.25 var(--brand-body, system-ui);
  letter-spacing: 0;
  color: var(--player-ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.film-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  min-height: 44px;
  gap: 4px;
  padding: 0 5px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--player-ink);
  font-size: .76rem;
  white-space: nowrap;
  cursor: pointer;
}
.film-action:hover, .film-action[aria-pressed="true"], details[open] > .film-action { color: var(--player-gold); }
.film-action:disabled { opacity: .6; }
.heart { font-size: 1.12rem; line-height: 1; }
.danmaku-symbol, .discussion-symbol { font-size: .98rem; line-height: 1; }
#like-count, #thread-count { font-variant-numeric: tabular-nums; }
#views { display: block; margin-top: 2px; font-size: .69rem; line-height: 1.2; color: var(--player-muted); }
#views:empty, #collection-status:empty, #player-status:empty, #feedback:empty, #search-status:empty, #comments:empty, #thread-replies:empty { display: none; }

.media-player summary { -webkit-tap-highlight-color: transparent; }
.media-player summary:active { background: #f0cf8424; }
.media-player :is(summary, input, select, textarea):focus-visible { outline: 2px solid var(--player-gold); outline-offset: 2px; }
.player-settings > summary, .discussion > summary { list-style: none; }
.player-settings > summary::-webkit-details-marker, .discussion > summary::-webkit-details-marker { display: none; }
.settings-panel, .discussion-panel, .player-compose-panel {
  border: 1px solid var(--player-line);
  background: #1b1916fa;
  border-radius: 4px;
  color: var(--player-ink);
  box-shadow: 0 8px 16px #0004;
}
.settings-panel, .discussion-panel {
  position: absolute;
  z-index: 4;
  inset: auto 6px calc(100% + var(--controls-clearance));
}
.settings-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 5px 10px;
  padding: 10px 13px;
  font-size: .8rem;
}
.settings-panel input { grid-column: 1 / -1; margin: 0 0 4px; min-height: 24px; accent-color: var(--player-gold); }
.settings-panel output { color: var(--player-gold); }
.settings-panel select { border: 1px solid var(--player-line); background: var(--player-paper); color: var(--player-ink); padding: 2px 6px; font: inherit; }
.discussion-panel { max-height: min(340px, 52vh); overflow: auto; overscroll-behavior: contain; padding: 8px 12px; }
.discussion-panel :is(#comment-empty, p) { margin: 5px 0; font-size: .78rem; overflow-wrap: anywhere; }
.thread-list { list-style: none; margin: 0; padding: 0; }
.thread-list li { border-bottom: 1px solid var(--player-line); overflow-wrap: anywhere; white-space: pre-wrap; padding: 4px 0; }
.thread-link {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 3px 0;
  background: transparent;
  border: 0;
  text-align: start;
  font-size: .79rem;
}
.thread-link:hover, .media-player .text-action:hover { color: var(--player-gold); }
.thread-link time { color: var(--player-gold); font-size: .72rem; font-variant-numeric: tabular-nums; }
.media-thread { padding: 6px 8px; margin-top: 8px; background: #ffffff0b; }
.thread-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.media-thread h3 { font-size: .9rem; }
.media-player .text-action { min-height: 36px; padding: 3px 0; border: 0; background: transparent; color: var(--player-gold); font-size: .75rem; }

.player-composer { border-bottom: 1px solid var(--player-line); }
.player-composer > summary {
  display: table;
  margin-inline: auto;
  min-height: 31px;
  padding: 5px 13px;
  border-radius: 4px;
  color: var(--player-muted);
  font-size: .75rem;
  cursor: pointer;
  list-style: none;
  transition: opacity 150ms ease-out, color 150ms ease-out;
}
.player-composer > summary:hover, .player-composer[open] > summary { color: var(--player-gold); }
.player-composer > summary::-webkit-details-marker { display: none; }
.player-compose-panel {
  position: absolute;
  z-index: 5;
  inset: auto 6px calc(100% + var(--controls-clearance));
  display: grid;
  gap: 5px;
  padding: 8px 9px;
}
.player-compose-panel textarea {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 46px;
  max-height: 105px;
  resize: vertical;
  padding: 5px 8px;
  border: 1px solid var(--player-line);
  border-radius: 2px;
  background: #100f0d;
  color: var(--player-ink);
  font: inherit;
  font-size: .84rem;
}
#compose-mode, .player-compose-panel .comment-hint { margin: 0; font-size: .7rem; color: var(--player-muted); }
.sticker-picker { justify-self: start; max-width: 100%; }
.sticker-picker > summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding-inline: 7px;
  border: 1px solid var(--player-line);
  border-radius: 3px;
  color: var(--player-gold);
  font-size: .75rem;
  cursor: pointer;
  list-style: none;
}
.sticker-picker > summary::-webkit-details-marker { display: none; }
.sticker-options { display: flex; flex-wrap: wrap; gap: 4px; padding-top: 4px; }
.sticker-options button {
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 2px;
  border: 1px solid var(--player-line);
  border-radius: 4px;
  background: transparent;
}
.sticker-options button:is(:hover, :focus-visible, [aria-pressed="true"]) {
  border-color: var(--player-gold);
  background: #ffffff12;
}
.xiaov-sticker {
  display: inline-grid;
  position: relative;
  width: 2rem;
  height: 1.65rem;
  margin-inline-end: .18em;
  vertical-align: middle;
}
.xiaov-sticker img { width: 100%; height: 100%; object-fit: contain; }
.xiaov-sticker > span {
  position: absolute;
  inset: 0 0 auto auto;
  color: #ffe29b;
  font: 700 .69rem/1 system-ui, sans-serif;
  text-shadow: 0 1px 2px #000;
}
.sticker-options .xiaov-sticker { width: 2.1rem; height: 1.75rem; margin: 0; }
#sticker-selected .xiaov-sticker { width: 1.6rem; height: 1.28rem; margin: 0; }
.compose-actions { display: flex; align-items: center; gap: 10px; }
.compose-actions button[type="submit"] {
  min-height: 36px;
  padding-inline: 10px;
  border: 0;
  border-radius: 3px;
  background: var(--player-gold);
  color: #201809;
  font-size: .78rem;
}
.compose-actions button:disabled { opacity: .6; }
#player-status, #feedback {
  position: absolute;
  z-index: 6;
  inset: 0 0 auto;
  margin: 0;
  padding: 5px 8px;
  background: #15110ff0;
  color: var(--player-ink);
  text-align: center;
  font-size: .73rem;
  pointer-events: none;
}
#feedback { top: 33px; }

.danmaku-layer { position: absolute; inset: 0; pointer-events: none; overflow: hidden; --danmaku-ink: #fff; }
.danmaku-layer[data-tone="gold"] { --danmaku-ink: #ffe29b; }
.danmaku-float {
  position: absolute;
  z-index: 1;
  width: max-content;
  max-width: 92%;
  padding: 2px 6px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  border: 0;
  border-radius: 3px;
  background: #11100de0;
  color: var(--danmaku-ink);
  text-shadow: 0 1px 2px #000;
  font-size: .78rem;
  font-weight: 600;
  pointer-events: auto;
}
body .vopi-public[data-page="media"] .media-theater .danmaku-float { color: var(--danmaku-ink); }
@media (prefers-reduced-motion: no-preference) {
  .danmaku-float { left: 0; animation: media-drift 5s linear both; }
  @keyframes media-drift { from { left: 100%; } to { transform: translateX(-100%); } }
}

#video-search { display: block; width: 100%; margin-bottom: 8px; padding: 7px 9px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font: inherit; }
.media-visually-hidden { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; white-space: nowrap; }

#library { min-width: 0; padding: 6px 0 12px; }
#library h2 { margin-bottom: 9px; font-size: 1.15rem; }
#program-list { max-height: min(55dvh, 540px); overflow-y: auto; overscroll-behavior: contain; }
.program-tile {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 5px 6px;
  border-top: 1px solid var(--line);
}
.program-tile:is(:hover, :focus-visible, [aria-current="true"]) { background: var(--pale); }
.program-tile img { display: block; width: 32px; height: 42px; object-fit: cover; border-radius: 3px; }
.program-tile h3 { font-size: .93rem; overflow-wrap: anywhere; }
.program-tile:hover h3 { color: var(--gold); }
.program-meta { margin: 2px 0 0; color: var(--muted); font-size: .67rem; }
.program-published { display: block; margin-top: 2px; color: var(--muted); font-size: .67rem; }
.program-current { color: var(--brand-gold); font-size: .67rem; }

.media-clocks { display: none; }
.media-side-tools { min-width: 0; margin-block: 8px; }
.media-calculator { width: min(100%, 180px); }
.media-calculator > summary {
  position: relative;
  width: 100%;
  min-height: 44px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  padding-block: 6px;
  color: var(--brand-gold);
  cursor: pointer;
  font: 500 .77rem var(--body, system-ui);
  border-top: 1px solid var(--line);
  list-style: none;
}
.media-calculator > summary::-webkit-details-marker { display: none; }
.media-calculator > summary::after { content: "+"; font: 400 1.08rem/1 var(--latin); }
.media-calculator[open] > summary::after { content: "−"; }
.calculator-body { padding-bottom: 4px; }
.calculator-screen {
  display: block;
  overflow-wrap: anywhere;
  min-height: 34px;
  padding: 5px 4px 8px;
  margin-bottom: 5px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-align: right;
  font: 500 1.1rem/1.25 var(--latin);
  font-variant-numeric: lining-nums tabular-nums;
}
.calculator-keys { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 3px; }
.calculator-keys button {
  cursor: pointer;
  min-height: 28px;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--ink);
  font: 500 .78rem var(--body, system-ui);
}
.calculator-keys button:is(:hover, :focus-visible) { border-color: var(--brand-gold); }
.calculator-keys button:nth-child(4n), .calculator-keys button[data-key="sign"] { color: var(--brand-gold); }
.calculator-keys button[data-key="="] { background: var(--brand-gold); color: var(--paper); }
@media (prefers-reduced-motion: no-preference) {
  .calculator-keys button { transition: transform 120ms ease-out; }
  .calculator-keys button:active { transform: translateY(2px) scale(.94); }
}
@media (pointer: coarse) {
  .calculator-keys button { min-height: 38px; }
}
.media-clock { display: grid; justify-items: start; gap: 2px; }
.media-clock-name { color: var(--muted); font-size: .72rem; }
.media-clock time {
  color: var(--ink);
  font: 500 clamp(1.4rem, 2.1vw, 1.9rem)/1 var(--latin);
  font-variant-numeric: lining-nums tabular-nums;
}
.media-clock-offset { margin-top: 3px; color: var(--brand-gold); font-size: .63rem; }

@media (min-width: 860px) {
  .media-feature.with-library {
    display: grid;
    grid-template-columns: minmax(0, 348px) minmax(0, 1fr);
    align-items: start;
    column-gap: clamp(22px, 3vw, 38px);
    width: min(100%, 748px);
  }
  .with-library .film-heading { grid-area: 1 / 1; margin-bottom: 8px; }
  .with-library #film-layout { grid-area: 2 / 1; }
  .with-library #library { grid-area: 1 / 2 / 3; padding: 3px 0 0 16px; border-left: 1px solid var(--line); }
  .with-library .media-side-tools { grid-column: 1; }
  .with-library .program-tile { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 10px; padding: 7px 8px; }
  .with-library .program-tile img { width: 42px; height: 54px; }
}

@media (min-width: 1080px) {
  body:has(.vopi-public[data-page="media"]) #main { max-width: 1040px; }
  .media-feature, .media-feature.with-library {
    display: grid;
    grid-template-columns: minmax(114px, .47fr) minmax(0, 366px) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    align-items: start;
    column-gap: clamp(24px, 3vw, 42px);
    width: min(100%, 940px);
  }
  .media-feature .film-heading { grid-area: 1 / 2; margin-bottom: 8px; }
  .media-feature #film-layout { grid-area: 2 / 2; }
  .media-feature #library { grid-area: 2 / 3; padding: 52px 0 0; border-left: 0; }
  .media-feature .media-side-tools {
    grid-area: 1 / 1 / 3;
    margin: 0;
    padding: 4px 14px 0 0;
    border-right: 1px solid var(--line);
  }
  .media-clocks {
    display: grid;
    gap: 20px;
    padding-bottom: 16px;
  }
}

@media (hover: hover) and (pointer: fine) {
  .media-player:not(:hover):not(:focus-within) .player-composer:not([open]) > summary { opacity: 0; }
  .danmaku-float:hover { animation-play-state: paused !important; }
}
@media (max-width: 640px) {
  .media-feature { width: min(100%, 304px); }
  .media-content { padding-top: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .film-cover img, .film-step img, .film-play-icon, .player-composer > summary { transition: none; }
  .danmaku-float { right: 8px; }
}
