/* Controls belong to the video surface; no extra black toolbar below it. */
.player-screen.native-mode .player-toolbar, .player-screen.native-mode .player-resume { display: none; }
/* The native player has its own ⏭, the settings list every episode and the
   grid sits right below: the "‹ 7 серия ›" stepper only repeated them. It stays
   for the Kodik fallback, whose embedded player cannot switch episodes. */
.player-screen.native-mode .player-stepper { display: none; }
.player-screen.native-mode .player-frame { border-radius: 18px; }
.native-player { isolation: isolate; color: #fff; font-family: inherit; container-type: inline-size; }
/* One look for every button over the picture (owner, 2026-10-03): dark glass
   that lets the frame show through, a thin ring, and the project's accent for
   what matters. The bar's own icons stay white. */
.native-player {
  --glass: rgba(7, 12, 18, .56);
  --glass-strong: rgba(7, 12, 18, .72);
  --glass-ring: inset 0 0 0 1px rgba(255, 255, 255, .16);
  --accent-ring: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 78%, transparent);
  --glass-shadow: 0 6px 22px rgba(0, 0, 0, .35);
}
/* A long press must not select the time or a label, and a tap must not flash
   a grey box: both stuck on screen over the video on a phone (2026-10-03). */
.native-player { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.native-player button, .native-player select, .native-player input, .native-player label, .native-player video { -webkit-tap-highlight-color: transparent; }
.native-video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; touch-action: manipulation; }
/* Enhanced picture (upscale.js) drawn over the <video>, under every control. */
.native-upscale { position: absolute; inset: 0; width: 100%; height: 100%; display: block; background: #000; pointer-events: none; }
.native-shade { position: absolute; inset: 0; background: linear-gradient(#0008, transparent 32%, transparent 45%, #000b); pointer-events: none; transition: opacity .2s; }
.native-player button, .native-player select, .native-player summary { font: inherit; color: #fff; min-height: 44px; border: 0; cursor: pointer; }
.native-player button { min-width: 44px; border-radius: 10px; background: transparent; }
/* Hover only where a pointer hovers: a phone keeps :hover stuck on the last
   tapped button, which turned the big Play grey after a pause (2026-10-03). */
@media (hover: hover) {
  /* :where keeps the old weight, so coloured buttons (Next now) win as before. */
  .native-player button:where(:not([data-native-play])):hover { background: #ffffff20; }
  .native-center [data-native-play]:hover { background: var(--glass-strong); }
}
/* A row, so the reserve button can sit at the far end instead of trailing
   the dub name as if it were part of it. */
.native-top { position: absolute; top: 4px; left: 8px; right: 52px; display: flex; align-items: center; gap: 8px; }
.native-translation { max-width: 100%; min-width: 0; padding: 0 12px; font-size: 12px !important; border-radius: 999px; background: var(--glass); box-shadow: var(--glass-ring); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.native-player option { background: #17212a; color: white; }
.native-top .player-fullscreen-exit { position: fixed; }
/* The button row and the status line used to be positioned independently at
   overlapping coordinates (the row at 50%-36px, the status at 42%), so whether
   they collided depended on which state happened to be showing. One flow makes
   that impossible. The bottom inset keeps them clear of the controls bar. */
.native-middle { position: absolute; inset: 52px 8px 88px; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 10px; pointer-events: none; }
.native-middle > * { pointer-events: auto; }
/* The big Play/Pause sits in the true centre of the picture wherever the
   frame has room for it (owner, 2026-10-03: it sat 23 px high in landscape).
   The narrow portrait frame (about 193 px tall) keeps it lifted: centred
   there it would cover the seek bar whenever the bar is up. */
@container (min-width: 480px) {
  .native-middle { inset: 8px; }
}
.native-middle.has-status .native-center { display: none; }
.native-center { display: flex; justify-content: center; gap: 8px; align-items: center; max-width: 100%; }
.native-center [data-native-play] { min-width: clamp(56px, 13cqi, 104px); min-height: clamp(56px, 13cqi, 104px); padding: 0;
  background: var(--glass); color: var(--accent); border-radius: 999px; font-size: 24px;
  box-shadow: var(--accent-ring), var(--glass-shadow); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.native-center [data-native-play] svg { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--accent) 45%, transparent)); }
.native-center [data-native-play].has-resume { font-size: 12px; font-weight: 700; padding: 8px 18px 8px 14px; color: #fff; }
.native-center [data-native-play].has-resume svg { color: var(--accent); }
.native-center [data-native-play].has-resume span { line-height: 1; }
.native-center [data-native-restart] { background: var(--glass); box-shadow: var(--glass-ring); padding: 8px 14px; font-size: 12px; border-radius: 999px; -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.native-center [data-native-resume] { display: none; }
.native-center [disabled] { visibility: hidden; }
.native-player.is-playing .native-center { display: none; }
/* On a phone, as in YouTube: a tap brings the bars and a big Pause in the
   middle; paused, the bars hide and the big Play stays (the rule above). */
@media (hover: none) and (pointer: coarse) {
  .native-player.is-playing:not(.controls-hidden) .native-middle:not(.has-status) .native-center { display: flex; }
}
.native-player.has-up-next .native-center, .native-player.has-up-next .native-skip { display: none; }
/* Skip only while the episode plays (owner 2026-09-29): resuming inside an
   opening used to show "Пропустить опенинг" on top of the centre "Продолжить
   с …" / "Сначала" buttons, and a paused frame has the centre play button. */
.native-player:not(.is-playing) .native-skip { display: none; }
.native-up-next { position: absolute; z-index: 3; left: 12px; right: 12px; top: 48%; transform: translateY(-50%); margin: auto; max-width: 340px; padding: 12px; border-radius: 18px; background: var(--glass-strong); border: 0; box-shadow: var(--glass-ring), var(--glass-shadow); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); text-align: center; }
.native-up-next [data-native-next-label] { display: block; font-size: 12px; margin-bottom: 6px; }
.native-up-next > div { display: flex; justify-content: center; gap: 8px; }
.native-up-next button { padding: 0 12px; font-size: 12px; background: #ffffff12; }
.native-player .native-up-next [data-native-next-now] { background: var(--accent); color: #07121c; font-weight: 700; }
/* The same countdown over Kodik's frame once its episode has ended. The frame
   is no longer .native-player there, so the glass is spelled out here. */
.player-frame .reserve-up-next { z-index: 5; color: #fff; background: rgba(7, 12, 18, .78); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), 0 6px 22px rgba(0, 0, 0, .35); }
.player-frame .reserve-up-next > span { display: block; font-size: 12px; margin-bottom: 6px; }
.player-frame .reserve-up-next button { min-height: 40px; border: 0; border-radius: 10px; color: #fff; font: inherit; font-size: 12px; cursor: pointer; }
.player-frame .reserve-up-next [data-reserve-next-now] { background: var(--accent); color: #07121c; font-weight: 700; }
.native-player.has-up-next .native-seek { visibility: hidden; }
.native-auto-next input { appearance: none; flex: 0 0 40px; width: 40px; height: 24px; margin: 0; border: 0; border-radius: 999px; cursor: pointer; background: radial-gradient(circle at 12px 12px, #fff 0 8px, transparent 9px), #526070; }
.native-auto-next input:checked { background: radial-gradient(circle at 28px 12px, #071713 0 8px, transparent 9px), var(--accent); }
.native-auto-next input:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }
.native-settings .native-auto-next { min-height: 44px; }
.native-status { text-align: center; font-size: 12px; pointer-events: none; }
/* An empty status still took the column's gap and lifted the button 5 px. */
.native-status:empty { display: none; }
.native-controls { position: absolute; bottom: 0; left: 8px; right: 8px; }
.native-seek { appearance: none; -webkit-appearance: none; display: block; width: 100%; height: 44px; margin: 0; accent-color: var(--accent); cursor: pointer; background: transparent; }
.native-seek::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--played, 0%), #ffffffa0 var(--played, 0%) var(--buffered, 0%), #ffffff60 var(--buffered, 0%)); }
.native-seek::-webkit-slider-thumb { -webkit-appearance: none; margin-top: -5px; width: 13px; height: 13px; border: 0; border-radius: 50%; background: var(--accent); }
.native-seek::-moz-range-track { height: 3px; border-radius: 4px; background: #ffffff60; }
.native-seek::-moz-range-progress { height: 3px; background: var(--accent); }
.native-seek::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: var(--accent); }
.native-actions { display: flex; align-items: center; gap: 0; margin-top: -7px; padding-bottom: 2px; }
.native-actions button { flex: 0 0 44px; width: 44px; padding: 0; display: grid; place-items: center; }
.native-actions svg { display: block; width: 24px; height: 24px; pointer-events: none; }
.native-time { flex: 1; white-space: nowrap; padding-left: 3px; font-size: 11px; font-variant-numeric: tabular-nums; }
.native-actions [data-native-next] { font-size: 15px; }
.native-volume { appearance: none; -webkit-appearance: none; flex: 0 0 64px; width: 64px; height: 44px; margin: 0 2px; accent-color: var(--accent); cursor: pointer; background: transparent; }
.native-volume::-webkit-slider-runnable-track { height: 3px; border-radius: 4px; background: linear-gradient(to right, var(--accent) var(--vol, 100%), #ffffff60 var(--vol, 100%)); }
.native-volume::-webkit-slider-thumb { -webkit-appearance: none; margin-top: -5px; width: 11px; height: 11px; border: 0; border-radius: 50%; background: var(--accent); }
.native-volume::-moz-range-track { height: 3px; border-radius: 4px; background: #ffffff60; }
.native-volume::-moz-range-progress { height: 3px; background: var(--accent); }
.native-volume::-moz-range-thumb { width: 11px; height: 11px; border: 0; border-radius: 50%; background: var(--accent); }
.native-settings .native-volume { flex-basis: 120px; width: 120px; }
.native-settings .native-volume-setting { display: none; }
/* The current quality as a chip on the bar; "+" (AI enhancement) in the accent. */
.native-quality { position: relative; flex: 0 0 auto; display: grid; place-items: center; min-width: 44px; height: 44px; padding: 0 3px; cursor: pointer; }
.native-quality[hidden] { display: none; }
.native-quality span { padding: 3px 7px; border: 1px solid #ffffff59; border-radius: 8px; font-size: 12px; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; letter-spacing: .02em; transition: color .2s, border-color .2s, background-color .2s, box-shadow .2s; }
.native-quality.is-enhanced span { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, transparent); box-shadow: 0 0 10px color-mix(in srgb, var(--accent) 35%, transparent); }
.native-quality select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 16px; }
.native-quality:has(select:focus-visible) span { outline: 2px solid var(--accent); outline-offset: 2px; }
/* A phone has volume buttons, and iOS does not let a page set the volume at
   all: on a touch screen there is no volume control or mute here (owner,
   2026-10-03), whatever the width - landscape fullscreen used to show it. */
@media (hover: none) and (pointer: coarse) {
  .native-actions .native-volume, .native-actions [data-native-mute], .native-settings .native-volume-setting { display: none !important; }
}
/* Budget against the video surface, not the browser or Telegram viewport. */
@container (max-width: 440px) {
  .native-actions .native-volume { display: none; }
  .native-settings .native-volume-setting { display: flex; }
}
@container (max-width: 400px) {
  /* Room for the quality chip; the volume stays in the settings. */
  .native-actions [data-native-mute] { display: none; }
}
@container (max-width: 360px) {
  .native-actions [data-native-back] { display: none; }
}
@container (max-width: 310px) {
  .native-actions [data-native-next] { display: none; }
}
.native-settings { position: fixed; inset: auto 0 calc(12px + var(--safe-bottom)); margin: 0 auto; width: calc(100% - 24px); max-width: 420px; max-height: calc(100dvh - 24px - var(--safe-top) - var(--safe-bottom)); padding: 16px; overflow: auto; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 24px; box-shadow: 0 12px 50px #0008; }
.native-settings::backdrop { background: #050c1499; }
.native-settings header { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-bottom: 12px; }
.native-settings header small { color: var(--accent); font-size: 11px; letter-spacing: .16em; font-weight: 700; }
.native-settings h3 { font-size: 19px; margin: 5px 0 0; }
.native-settings [data-native-settings-close] { background: #ffffff08; font-size: 26px; color: var(--muted); }
.native-settings-fields { display: grid; gap: 8px; }
.native-settings label { display: flex; min-width: 0; min-height: 44px; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 10px 6px 12px; background: #ffffff05; border-radius: 12px; font-size: 13px; }
.native-settings select { background: #ffffff09; color: var(--text); border-radius: 9px; padding: 0 10px; width: 120px; font-size: 13px; }
.native-settings .native-auto-next { min-height: 44px; }
/* Settings must not swallow the screen on a phone: a viewer needs to see the
   frame the setting applies to. The sheet keeps to the lower half and scrolls. */
.native-settings h3 { font-size: 16px; }
.native-settings header { padding-bottom: 8px; }
.native-settings-fields { gap: 6px; }
.native-settings footer { margin-top: 8px; }
.native-auto-next span small { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.native-settings footer { margin-top: 12px; padding-top: 8px; border-top: 1px solid var(--line); }
.native-settings [data-native-fallback] { width: 100%; color: var(--muted); font-size: 12px; text-align: left; padding-left: 12px; }
@media (orientation: landscape) and (min-width: 540px) {
  .native-settings { top: 50%; bottom: auto; transform: translateY(-50%); max-width: 560px; padding: 12px 16px; }
  .native-settings-fields { grid-template-columns: 1fr 1fr; }
  .native-settings label { gap: 8px; }
  .native-settings select { width: 100px; }
}
.native-skip { position: absolute; right: 12px; bottom: 86px; padding: 8px 14px; border-radius: 999px !important; background: var(--glass) !important; font-size: 11px !important; font-weight: 700; box-shadow: var(--accent-ring), var(--glass-shadow); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.native-player.controls-hidden .native-controls, .native-player.controls-hidden .native-top, .native-player.controls-hidden .native-shade { opacity: 0; pointer-events: none; }
.native-player:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
body.player-frame-expanded .native-player .native-controls, .native-player:fullscreen .native-controls { bottom: var(--safe-bottom); left: max(12px, var(--safe-left)); right: max(12px, var(--safe-right)); }
body.player-frame-expanded .native-player .native-top, .native-player:fullscreen .native-top { top: max(8px, var(--safe-top)); left: max(12px, var(--safe-left)); right: calc(52px + var(--safe-right)); }
body.player-frame-expanded .native-player .native-skip, .native-player:fullscreen .native-skip { bottom: calc(90px + var(--safe-bottom)); }
/* A narrow portrait frame is too low for «Пропустить опенинг» at the bottom
   right: it ran into the big Pause in the middle. Up there it has room. */
@container (max-width: 479px) {
  .native-player .native-skip { top: 8px; bottom: auto; right: 8px; }
}
/* The exit cross is a round glass button; the player's generic button
   radius made it a rounded square. */
.native-player .player-fullscreen-exit { border-radius: 50%; }
@media (prefers-reduced-motion: reduce) { .native-shade { transition: none; } }

/* The answer to a seek gesture: which way, and how much has accumulated. */
/* The play button holds an icon and sometimes a label; both centre properly
   because it is a flex box, which a bare "▶" character never did. Sizes follow
   the player's own width, so a landscape frame no longer shows a phone-sized
   button. (Restored 2026-10-03: 8a30019 dropped this block by mistake, and
   the icon sat on the text baseline, high and left of centre.) */
.native-center [data-native-play] { display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.native-center [data-native-play] svg { width: clamp(26px, 6cqi, 46px); height: clamp(26px, 6cqi, 46px); }
.native-center [data-native-play].has-resume { min-width: 0; min-height: clamp(46px, 9cqi, 72px); }
.native-center [data-native-play].has-resume svg { width: clamp(18px, 3.4cqi, 28px); height: clamp(18px, 3.4cqi, 28px); }
.native-center [data-native-play].has-resume span { font-size: clamp(12px, 2.6cqi, 19px); }
.native-center [data-native-restart] { font-size: clamp(12px, 2.4cqi, 17px); padding: clamp(8px, 1.8cqi, 14px) clamp(12px, 2.6cqi, 20px); }

/* The seek answer (owner, 2026-10-03: "something stylish in the project's
   colours"): a soft half-moon of accent light from the tapped edge, as in
   mobile players, with three chevrons running towards the seek direction and
   the total under them. It never takes a tap and never touches the bar. */
.native-seek-hint { position: absolute; top: 0; bottom: 0; width: 38%; z-index: 4; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: clamp(6px, 1.2cqi, 10px);
  color: #fff; animation: seek-hint-in .22s ease-out; }
.native-seek-hint[hidden] { display: none; }
.native-seek-hint.is-back { left: 0; border-radius: 0 50% 50% 0 / 0 50% 50% 0;
  background: radial-gradient(ellipse 100% 70% at 0% 50%, color-mix(in srgb, var(--accent) 34%, transparent), color-mix(in srgb, var(--accent) 10%, transparent) 62%, transparent 72%); }
.native-seek-hint.is-forward { right: 0; border-radius: 50% 0 0 50% / 50% 0 0 50%;
  background: radial-gradient(ellipse 100% 70% at 100% 50%, color-mix(in srgb, var(--accent) 34%, transparent), color-mix(in srgb, var(--accent) 10%, transparent) 62%, transparent 72%); }
.native-seek-chevrons { display: flex; gap: clamp(2px, .5cqi, 4px); }
.native-seek-hint.is-back .native-seek-chevrons { flex-direction: row-reverse; transform: scaleX(-1); }
.native-seek-chevrons i { display: block; width: clamp(10px, 2cqi, 16px); height: clamp(12px, 2.4cqi, 19px);
  background: var(--accent); clip-path: polygon(0 0, 100% 50%, 0 100%); opacity: .25;
  filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 70%, transparent));
  animation: seek-chevron 0.9s ease-in-out infinite; }
.native-seek-chevrons i:nth-child(2) { animation-delay: .15s; }
.native-seek-chevrons i:nth-child(3) { animation-delay: .3s; }
.native-seek-hint b { padding: clamp(3px, .6cqi, 5px) clamp(9px, 1.8cqi, 14px); border-radius: 999px;
  background: #050c14b8; border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent);
  font-size: clamp(13px, 2.6cqi, 20px); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .01em;
  box-shadow: 0 0 14px color-mix(in srgb, var(--accent) 30%, transparent); }
.native-seek-hint b.is-bumped { animation: seek-bump .22s ease-out; }
/* The same fade back out; it must not outlast SEEK_HINT_OUT_MS in native-player.js. */
.native-seek-hint.is-leaving { animation: seek-hint-out .26s ease-in forwards; }
@keyframes seek-hint-in { from { opacity: 0; } }
@keyframes seek-hint-out { to { opacity: 0; } }
@keyframes seek-chevron { 0%, 100% { opacity: .25; } 40% { opacity: 1; } }
@keyframes seek-bump { 40% { transform: scale(1.12); } }
@media (prefers-reduced-motion: reduce) {
  .native-seek-hint, .native-seek-chevrons i, .native-seek-hint b.is-bumped { animation: none; }
  .native-seek-chevrons i { opacity: .9; }
}

/* Where a drag on the seek bar will land; the jump happens on release. */
.native-controls { --seek-preview-bottom: 40px; }
.native-seek-preview { position: absolute; bottom: var(--seek-preview-bottom); transform: translateX(-50%); padding: 4px 8px; border-radius: 8px; background: #050c14e6; color: #fff; font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; pointer-events: none; white-space: nowrap; }
.native-seek-preview[hidden] { display: none; }

/* The dub opens the app's full picker (search, which studios lack this episode). */
.native-player button.native-translation { background: var(--glass); padding: 0 12px; }
button.native-translation { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; min-width: 0; }
button.native-translation span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.native-translation svg { flex: 0 0 auto; opacity: .8; }

/* Offered only once startup has been given up on: another round, or the Kodik
   player. Both sit in the frame under "Поток не отвечает" instead of a
   permanent button in the top bar, where it crowded the dub name. Specific
   enough to beat `.native-player button`, which strips borders and backgrounds
   and forces a 44px touch box on every control in the player. */
/* A phone frame leaves the middle zone about 51px tall between the dub and the
   controls; at 36px the pair pushed the status line into the dub button. The
   pair is drawn 32px tall, sits 4px under the status, and keeps a ~44px touch
   area through an invisible extension. */
.native-stalled { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: -6px; }
.native-stalled[hidden] { display: none; }
.native-player .native-stalled button { position: relative; min-width: 0; min-height: 32px; height: 32px;
  padding: 0 14px; border-radius: 999px; border: 1px solid rgba(255, 255, 255, .28); background: #101a24e6;
  color: #e6eef8; font-size: 12px; font-weight: 700; white-space: nowrap; }
.native-player .native-stalled button::after { content: ""; position: absolute; inset: -6px 0; }
.native-player .native-stalled button:hover { background: #16222fee; }
