:root {
  --bg: #0c0e12;
  --panel: #14171e;
  --panel-2: #1a1e27;
  --line: #262b36;
  --text: #e8eaee;
  --muted: #8a91a0;
  --accent: #e5a00d;   /* Plex amber */
  --accent-2: #5865f2; /* Discord blurple */
  --ok: #3ecf7a;
  --bad: #ff6b6b;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 70% -10%, #171b24 0%, var(--bg) 60%);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Header */
header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(20, 23, 30, 0.6);
  backdrop-filter: blur(8px);
  position: relative;
  z-index: 100; /* lift the header (and the health popover) above the library panel below */
}
.brand { font-size: 15px; font-weight: 700; letter-spacing: .2px; }
.logo { color: var(--accent); margin-right: 4px; }
#status { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.pill {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
#conn.ok { color: var(--ok); border-color: #1e4030; }
#conn.bad { color: var(--bad); border-color: #4a2626; }
#role.host { color: #14171e; background: var(--accent); border-color: var(--accent); font-weight: 700; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }

/* Layout */
main {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 18px;
  padding: 18px;
  flex: 1;
  min-height: 0;
}
#stage { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

/* Participants */
.participants { display: flex; flex-wrap: nowrap; gap: 6px; align-items: center; flex: 1 1 auto; min-width: 0; max-width: 52vw; overflow-x: auto; overflow-y: hidden; padding: 2px 0; scrollbar-width: none; --fl: 0px; --fr: 0px;
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%);
  mask-image: linear-gradient(to right, transparent 0, #000 var(--fl), #000 calc(100% - var(--fr)), transparent 100%); }
.participants::-webkit-scrollbar { display: none; }
.participants:empty { display: none; }
.person { flex-shrink: 0; }
.person.speaking { border-color: #3ba55d; }
.person.speaking .av { box-shadow: 0 0 0 2px #3ba55d, 0 0 7px rgba(59, 165, 93, .85); }
.person {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 999px;
  padding: 3px 11px 3px 3px; font-size: 12px; color: var(--text); max-width: 200px;
}
.person .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person .av {
  position: relative; width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; background: var(--accent-2); overflow: hidden;
}
.person .av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.person.host { border-color: var(--accent); }
.person.host .name::after { content: " 👑"; }
.person { position: relative; }
.sync-badge { font-size: 10px; margin-left: 3px; white-space: nowrap; }
/* Per-viewer stream-health popover (connection / buffer / lag / stalls) on participant hover */
.pnet { position: fixed; z-index: 2300; width: min(270px, calc(100vw - 16px)); padding: 10px 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 34px rgba(0, 0, 0, .58); opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .15s ease, transform .15s ease, visibility .15s; pointer-events: none; }
.pnet.show { opacity: 1; visibility: visible; transform: translateY(0); }
.pnet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; color: var(--text); font-size: 13px; }
.pnet-head > b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pnet-online { display: inline-flex; align-items: center; gap: 5px; flex-shrink: 0; color: var(--muted); font-size: 11px; font-weight: 500; }
.pnet-online i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 7px var(--ok); }
.pnet-row { display: flex; align-items: center; gap: 7px; padding: 3px 0; font-size: 12px; color: var(--muted); }
.pnet-row .pnet-val { margin-left: auto; color: var(--text); font-weight: 600; white-space: nowrap; }
.pnet-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
.pnet-dot.good { background: var(--ok); box-shadow: 0 0 7px var(--ok); }
.pnet-dot.tight { background: var(--accent); box-shadow: 0 0 7px var(--accent); }
.pnet-dot.low { background: var(--bad); box-shadow: 0 0 7px var(--bad); }
.pnet-dot.unknown { background: var(--muted); opacity: .5; }
.pnet-foot { margin-top: 7px; padding-top: 7px; border-top: 1px solid var(--line); font-size: 12px; color: var(--text); }
.pnet-host-hint { margin: 8px -3px -1px; padding: 7px 8px; border-radius: 8px; background: rgba(240, 170, 55, .1); color: var(--accent); font-size: 11.5px; font-weight: 600; }

/* Custom control bar (overlay at the bottom of the video) */
.controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; gap: 12px;
  padding: 22px 16px 12px;
  background: linear-gradient(180deg, transparent, rgba(6, 8, 11, 0.85));
  opacity: 0; transition: opacity .2s;
}
.controls.hidden { display: none; }
.video-wrap:hover .controls, .controls.show { opacity: 1; }
.c-btn {
  background: transparent; border: none; color: #fff;
  cursor: pointer; padding: 4px 6px; border-radius: 6px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
}
.c-btn:hover { color: var(--accent); }
.c-btn svg { width: 21px; height: 21px; display: block; }

/* Inline SVG icon defaults (replaces the old per-platform emoji) */
button svg, .ico svg, .search-ico svg { display: block; }
.ico { display: inline-flex; align-items: center; color: var(--muted); }
.c-time { font-variant-numeric: tabular-nums; font-size: 12px; color: #cfd3db; min-width: 46px; }
#c-dur { text-align: right; }
.c-track { position: relative; flex: 1; height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.2); cursor: pointer; }
.c-buffered { position: absolute; inset: 0 auto 0 0; width: 0; background: rgba(255, 255, 255, 0.3); border-radius: 999px; }
.c-fill { position: absolute; inset: 0 auto 0 0; width: 0; background: linear-gradient(90deg, var(--accent), #ffca4b); border-radius: 999px; }
.c-handle {
  position: absolute; top: 50%; left: 0; transform: translate(-50%, -50%);
  width: 14px; height: 14px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.6); opacity: 0; transition: opacity .12s;
}
.c-track:hover .c-handle, .c-track.dragging .c-handle { opacity: 1; }
.controls.guest .c-track { cursor: default; }
.controls.guest .c-play { opacity: .45; cursor: default; }

/* "Sync to everyone" — guest-only (the host IS the reference). Pulses when the viewer has
   drifted into the band the auto-corrector ignores, so catching up is one obvious click. */
#c-sync { display: none; }
.controls.guest #c-sync { display: inline-flex; }
#c-sync.needs { color: var(--accent); animation: syncpulse 1.3s ease-in-out infinite; }
@keyframes syncpulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }

/* Scrubber hover preview (thumbnail + timestamp above the cursor) */
.c-preview {
  position: absolute; bottom: 58px; transform: translateX(-50%);
  background: #0b0d12; border: 1px solid var(--line); border-radius: 9px;
  padding: 4px; box-shadow: 0 8px 24px rgba(0, 0, 0, .55);
  pointer-events: none; z-index: 8;
}
.c-preview.hidden { display: none; }
.c-preview img { display: block; width: 164px; height: 92px; object-fit: cover; border-radius: 6px; background: #000; }
.c-preview span { display: block; text-align: center; font-variant-numeric: tabular-nums; font-size: 11px; font-weight: 600; color: #cfd3db; margin-top: 3px; }
.c-vol {
  -webkit-appearance: none; appearance: none;
  width: 76px; height: 4px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.25); cursor: pointer; outline: none; flex-shrink: 0;
}
.c-vol::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 12px; height: 12px; border-radius: 50%; background: #fff; cursor: pointer; }
.c-vol::-moz-range-thumb { width: 12px; height: 12px; border: none; border-radius: 50%; background: #fff; cursor: pointer; }
@media (max-width: 560px) { .c-vol { display: none; } }

/* Chapter ticks on the scrubber (non-interactive overlay so seeking still works) */
.c-chapters { position: absolute; inset: 0; pointer-events: none; border-radius: 999px; overflow: hidden; }
.c-tick { position: absolute; top: 0; bottom: 0; width: 2px; transform: translateX(-1px); background: rgba(10, 12, 17, 0.9); }

/* Chapters button + jump-to popover */
.c-btn.hidden { display: none; }
.chapter-menu {
  position: absolute; right: 12px; bottom: 64px; z-index: 9;
  width: 288px; max-height: 48%; overflow-y: auto;
  background: #0b0d12; border: 1px solid var(--line); border-radius: 12px;
  padding: 6px; box-shadow: 0 12px 34px rgba(0, 0, 0, .6);
}
.chapter-menu.hidden { display: none; }
.chp-head { font-size: 12px; font-weight: 700; color: var(--muted); padding: 6px 8px 8px; letter-spacing: .3px; }
.chp-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: transparent; border: none; color: var(--text); cursor: pointer;
  padding: 7px 8px; border-radius: 8px; text-align: left; font-size: 13px;
}
.chp-item:hover { background: var(--panel-2); }
.chp-item.active { background: rgba(229, 160, 13, .14); }
.chp-item.active .chp-n { color: var(--accent); }
.chp-n { flex: 0 0 22px; text-align: center; font-variant-numeric: tabular-nums; font-size: 11px; color: var(--muted); }
.chp-t { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chp-time { flex: 0 0 auto; font-variant-numeric: tabular-nums; font-size: 11px; color: var(--muted); }

/* Skip intro / skip credits ("Next") button — bottom-right, above the controls */
.skip-btn {
  position: absolute; right: 16px; bottom: 72px; z-index: 7;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 10px; cursor: pointer; overflow: hidden;
  background: rgba(11, 13, 18, 0.82); color: #fff; font-weight: 600; font-size: 14px;
  border: 1px solid rgba(255, 255, 255, 0.45); backdrop-filter: blur(4px);
  /* resting (pre-entrance / exited) state: faded and nudged down, click-through */
  opacity: 0; transform: translateY(12px); pointer-events: none;
  transition: opacity .3s ease, transform .3s cubic-bezier(.22, .61, .36, 1), background .15s, border-color .15s, color .15s;
}
.skip-btn.skip-in { opacity: 1; transform: translateY(0); pointer-events: auto; }
.skip-btn.skip-out { opacity: 0; transform: translateY(12px); pointer-events: none; }
.skip-btn.skip-in:hover { background: var(--accent); color: #10141b; border-color: var(--accent); }
.skip-btn.hidden { display: none; }
/* Countdown "fuel gauge": a subtle lighter fill spanning the button that drains over
   the auto-hide window (--skip-dur, set from JS), so the background gets progressively
   darker as the time-left runs out — then the button dismisses. */
.skip-btn .skip-label, .skip-btn .skip-ico { position: relative; z-index: 1; }
.skip-btn::before {
  content: ""; position: absolute; inset: 0; z-index: 0; pointer-events: none;
  background: rgba(255, 255, 255, 0.16);
  transform-origin: left center; transform: scaleX(1);
}
.skip-btn.skip-in::before { animation: skip-timeleft var(--skip-dur, 5000ms) linear forwards; }
@keyframes skip-timeleft { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) { .skip-btn.skip-in::before { animation: none; } }
.skip-btn .skip-ico svg { width: 16px; height: 16px; display: block; }
body.maximized .skip-btn { bottom: 92px; }
body.maximized .chapter-menu { bottom: 84px; }

.video-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 12px 40px rgba(0,0,0,.45);
}
video { width: 100%; height: 100%; display: block; background: #000; }

/* Maximized ("fullscreen") — CSS-based so it works inside the Discord iframe */
body.maximized { overflow: hidden; }
body.maximized .video-wrap {
  position: fixed; z-index: 1000; aspect-ratio: auto;
  /* fill the iframe but stay inside the device / Discord safe area so the film isn't hidden under the notch/UI */
  top: env(safe-area-inset-top, 0px); right: env(safe-area-inset-right, 0px);
  bottom: env(safe-area-inset-bottom, 0px); left: env(safe-area-inset-left, 0px);
  width: auto; height: auto;
  border: none; border-radius: 0; background: #000;
}
body.maximized video { width: 100%; height: 100%; object-fit: contain; }
/* Discord Activity iframe isn't 16:9 — fill it (crop the overflow) so fullscreen has NO letterbox bars */
body.in-discord.maximized video { object-fit: cover; }

/* Idle: hide all player chrome when the mouse hasn't moved for a few seconds (any input reveals it) */
body.ui-idle .controls,
body.ui-idle #reactions,
body.ui-idle #castPanel,
body.ui-idle #like-btn,
body.ui-idle #track-controls,
body.ui-idle .skip-btn,
body.ui-idle .chapter-menu { opacity: 0 !important; pointer-events: none !important; transition: opacity .35s ease; }
body.ui-idle .video-wrap { cursor: none; }

/* Loading / buffering spinner */
.spinner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background: rgba(6, 8, 11, 0.5);
  transition: opacity .2s;
}
.spinner.hidden { opacity: 0; pointer-events: none; }
.spinner .ring {
  width: 46px; height: 46px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.14);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
#spinner-label { font-size: 13px; color: var(--muted); letter-spacing: .3px; text-align: center; max-width: 82vw; }
/* Head-segment warm-up progress bar (shown under the spinner while the encoder builds its lead). */
.warm-bar { width: min(240px, 62vw); height: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.14); overflow: hidden; }
.warm-bar.hidden { display: none; }
.warm-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 999px; transition: width .35s ease; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Subtitles: custom overlay rendered from cues (per-user, local). Pinned at a FIXED offset above the
   controls bar so the vertical position never jumps (the old native <track> rendering bounced). */
.subs-overlay {
  position: absolute; left: 0; right: 0; bottom: max(56px, 8%);
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 0 6%; text-align: center; pointer-events: none; z-index: 6;
}
.subs-overlay.hidden { display: none; }
.subs-overlay .sub-line {
  background: rgba(0, 0, 0, 0.55); color: #fff;
  font-size: clamp(15px, 2.9vw, 30px); line-height: 1.32; font-weight: 500;
  padding: 1px 10px; border-radius: 5px; white-space: pre-wrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

/* Idle overlay */
.idle {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #10131a, #0a0c10);
  color: var(--muted);
  transition: opacity .3s;
}
.idle.hidden { opacity: 0; pointer-events: none; }
.idle-inner { text-align: center; }
.idle-icon { font-size: 44px; margin-bottom: 8px; opacity: .8; }

/* Now-playing bar */
.nowbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line);
  border-radius: 12px;
}
.nowbar.hidden { display: none; }
#np-poster {
  width: 46px; height: 68px;
  object-fit: cover; border-radius: 6px;
  background: #000; flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0,0,0,.4);
}
.np-meta { flex: 1; min-width: 0; }
.np-title { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.np-sub { color: var(--muted); font-size: 12px; margin-top: 1px; }
.np-progress { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.np-time { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); min-width: 42px; }
.np-time:last-child { text-align: right; }
.track {
  flex: 1; height: 6px; border-radius: 999px;
  background: #2a2f3a; overflow: hidden;
}
.fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), #ffca4b); border-radius: 999px; transition: width .25s linear; }

/* Track / quality controls */
.track-controls {
  display: flex; flex-wrap: wrap; gap: 12px;
  padding: 10px 14px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); border-radius: 12px;
}
.track-controls.hidden { display: none; }
.track-controls label {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--muted); flex: 1; min-width: 150px;
}
.track-controls .ico svg { width: 16px; height: 16px; }
.track-controls select {
  flex: 1; min-width: 0; height: 34px; padding: 0 28px 0 10px;
  background-color: #0d0f13; color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font: inherit; font-size: 13px; cursor: pointer;
}
.track-controls select:hover { border-color: var(--accent); }

/* Subtitle sync offset control (matches track-controls) */
.sub-sync { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.sub-sync button {
  width: 26px; height: 26px; border-radius: 7px; padding: 0;
  background-color: #0d0f13; color: var(--text); border: 1px solid var(--line);
  font: inherit; font-size: 16px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: border-color .12s ease, color .12s ease;
}
.sub-sync button:hover { border-color: var(--accent); color: var(--accent); }
.sub-sync #sub-delay-val { min-width: 46px; text-align: center; color: var(--text); font-variant-numeric: tabular-nums; }

.host-btn {
  background: var(--panel); color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap;
}
.host-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Library */
#library {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  display: flex; flex-direction: column; min-height: 0;
  overflow: hidden;
}
.lib-head { padding: 12px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }

/* Search row: input grows, the dice + reload buttons sit inline on the right. */
.search-wrap { position: relative; display: flex; align-items: center; gap: 8px; }
.search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); display: inline-flex; color: var(--muted); pointer-events: none; z-index: 1; }
.search-ico svg { width: 16px; height: 16px; }
#search {
  flex: 1; min-width: 0; height: 38px; box-sizing: border-box;
  padding: 0 12px 0 34px;
  background: #0d0f13; color: var(--text);
  border: 1px solid var(--line); border-radius: 9px; font: inherit;
  outline: none;
}
#search:focus { border-color: var(--accent); }

/* Two equal columns per row so both select rows line up exactly. */
.lib-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
/* Custom icon dropdowns (replace native <select> for sort/filter/genre/sections) */
.dd { position: relative; min-width: 0; }
.dd-btn { display: flex; align-items: center; gap: 7px; width: 100%; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.dd-btn:hover { border-color: var(--accent); }
.dd-btn .dd-cur { flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dd-btn .dd-caret { margin-left: auto; opacity: .55; display: inline-flex; }
.dd-btn .dd-caret svg { width: 14px; height: 14px; }
.dd-ico { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; flex-shrink: 0; opacity: .9; }
.dd-ico svg { width: 16px; height: 16px; }
.dd-menu { position: absolute; top: calc(100% + 5px); left: 0; right: 0; z-index: 200; background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 16px 38px rgba(0, 0, 0, .5); padding: 5px; max-height: 340px; overflow-y: auto; overflow-x: hidden; }
.dd-menu.hidden { display: none; }
.dd-opt { display: flex; align-items: center; gap: 9px; width: 100%; padding: 8px 9px; background: none; border: 0; border-radius: 8px; color: var(--text); font: inherit; font-size: 13px; text-align: left; line-height: 1.25; cursor: pointer; }
.dd-opt > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.dd-opt:hover { background: var(--panel); }
.dd-opt.sel { background: var(--accent-2); color: #fff; }
body.tv-mode .dd { display: none; }
/* Custom themed scrollbars (global) */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); background-clip: content-box; }
::-webkit-scrollbar:horizontal { display: none; height: 0; } /* no visible horizontal bars — those areas still scroll via wheel/trackpad/drag */
.lib-count-row { display: block; }

/* Unified control look. Selects get a custom chevron so every dropdown matches
   across platforms (no OS-default arrow). */
select {
  width: 100%; height: 38px; box-sizing: border-box;
  padding: 0 30px 0 11px;
  background-color: #0d0f13; color: var(--text);
  border: 1px solid var(--line); border-radius: 9px; font: inherit; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a91a0' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center;
  text-overflow: ellipsis;
}
select:hover, select:focus { border-color: var(--accent); outline: none; }
#surprise, #reload {
  flex: 0 0 auto; width: 38px; height: 38px; box-sizing: border-box;
  display: inline-flex; align-items: center; justify-content: center;
  background: #0d0f13; color: var(--text);
  border: 1px solid var(--line); border-radius: 9px; cursor: pointer;
}
#reload:hover, #surprise:hover { border-color: var(--accent); color: var(--accent); }
#surprise svg, #reload svg { width: 17px; height: 17px; }

/* Shelves + full list share ONE vertical scroll region, so the "Тебе зайдёт" /
   "Уже смотрели вместе" rows scroll away as you browse instead of being pinned
   above the list and squeezing it off-screen (worst on the mobile 42vh library). */
.lib-scroll { flex: 1; min-height: 0; overflow-x: hidden; overflow-y: auto; padding: 8px 12px 4px; }
#items { list-style: none; margin: 0; padding: 0; }
#items li {
  display: flex; gap: 11px; align-items: center;
  padding: 7px; border-radius: 9px; cursor: pointer;
  transition: background .12s;
}
#items li:hover { background: var(--panel-2); }
#items li.active { background: rgba(229,160,13,.14); outline: 1px solid rgba(229,160,13,.4); }
#items li.active .t::after {
  content: "▶ идёт"; margin-left: 8px; font-size: 10px; font-weight: 700;
  color: var(--accent); letter-spacing: .4px; vertical-align: middle;
}
.lib-count { font-size: 11px; color: var(--muted); padding-left: 2px; }

/* TV browse: shows → seasons → episodes */
.tv-nav { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.tv-nav.hidden { display: none; }
.tv-back { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 5px 11px; font: inherit; font-size: 12px; cursor: pointer; flex-shrink: 0; }
.tv-back:hover { border-color: var(--accent); color: var(--accent); }
.tv-crumb { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#items li.tv-container .tv-chevron { margin-left: auto; color: var(--muted); font-size: 20px; padding: 0 6px; }
/* In a TV library, hide the movie-only controls */
body.tv-mode #filter, body.tv-mode #genre, body.tv-mode #sort, body.tv-mode #surprise { display: none; }
body.tv-mode #sections { grid-column: 1 / -1; }
#items img { width: 42px; height: 63px; object-fit: cover; border-radius: 5px; background: #000; flex-shrink: 0; }
#items .meta { min-width: 0; }
#items .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#items .y { color: var(--muted); font-size: 12px; }
#items .rating { display: flex; gap: 6px; margin-top: 3px; min-height: 13px; }
.rt { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 4px; line-height: 1.4; white-space: nowrap; }
.rt.kp { background: rgba(255, 106, 0, 0.18); color: #ff8c3a; }
.rt.imdb { background: rgba(245, 197, 24, 0.16); color: #f5c518; }
#items li { position: relative; }
.li-personal-status { margin-top: 3px; color: var(--accent); font-size: 11px; font-weight: 700; }
.li-personal-status.watched { color: var(--ok); }
.li-progress { height: 3px; border-radius: 999px; background: #2a2f3a; margin-top: 4px; overflow: hidden; max-width: 160px; }
.li-progress > div { height: 100%; background: var(--accent); }
.info-btn {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  opacity: 0; width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.5); border: 1px solid var(--line); color: var(--text);
  cursor: pointer; transition: opacity .12s, border-color .12s, color .12s;
  display: inline-flex; align-items: center; justify-content: center;
}
.info-btn svg { width: 15px; height: 15px; }
#items li:hover .info-btn { opacity: 1; }
.info-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Details modal */
.details-modal { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); padding: 20px; }
.details-modal.hidden { display: none; }
.details-card { display: flex; gap: 22px; max-width: 760px; width: 100%; max-height: 84vh; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 18px; padding: 22px; position: relative; overflow: auto; box-shadow: 0 24px 70px rgba(0,0,0,.55); }
.details-close { position: absolute; right: 14px; top: 14px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 50%; color: var(--muted); font-size: 15px; cursor: pointer; z-index: 1; }
.details-close:hover { color: var(--text); border-color: var(--accent); }
.details-poster { width: 210px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 12px; background: #000; flex-shrink: 0; box-shadow: 0 8px 26px rgba(0,0,0,.5); }
.details-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.details-body h2 { margin: 0 0 12px; font-size: 22px; line-height: 1.2; padding-right: 34px; }
.details-meta { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.d-rt { display: flex; gap: 8px; }
.rt.lg { font-size: 13px; padding: 4px 11px; border-radius: 8px; }
.d-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.d-chip { font-size: 12px; background: rgba(255,255,255,.05); border: 1px solid var(--line); border-radius: 999px; padding: 3px 11px; color: #c3c9d4; }
.details-genres { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.genre { font-size: 11px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; color: var(--muted); }
.details-desc { font-size: 14px; line-height: 1.6; color: #d3d7de; margin: 0 0 18px; }
.details-actions { margin-top: auto; display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.details-play { display: inline-flex; align-items: center; gap: 8px; background: var(--accent); color: #14171e; border: none; border-radius: 11px; padding: 11px 22px; font: inherit; font-weight: 700; cursor: pointer; }
.details-play:hover { filter: brightness(1.08); }
.details-play svg { width: 16px; height: 16px; }
.details-shuffle { display: inline-flex; align-items: center; gap: 7px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 11px; padding: 11px 16px; font: inherit; font-weight: 600; cursor: pointer; }
.details-shuffle:hover { border-color: var(--accent); color: var(--accent); }
.details-shuffle.hidden { display: none; }
.details-shuffle svg { width: 16px; height: 16px; }
.details-like { display: inline-flex; align-items: center; gap: 7px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 11px; padding: 11px 15px; font: inherit; font-weight: 600; cursor: pointer; }
.details-like:hover { border-color: #ff6b6b; color: #ff6b6b; }
.details-like svg { width: 17px; height: 17px; }
.details-like.liked { background: rgba(255, 107, 107, .14); border-color: #ff6b6b; color: #ff6b6b; }
.details-likers { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 12px; }
.details-likers:empty { display: none; }
.details-likers img, .details-likers .lk-init { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); }
.details-likers .lk-init { display: inline-flex; align-items: center; justify-content: center; background: var(--accent-2); color: #fff; font-size: 11px; font-weight: 700; }

/* Like count badge on library rows */
.li-like { display: inline-flex; align-items: center; gap: 3px; margin-top: 4px; font-size: 11px; font-weight: 700; color: #ff6b6b; }
.li-like svg { width: 12px; height: 12px; }

.details-queue { display: inline-flex; align-items: center; gap: 7px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 11px; padding: 11px 15px; font: inherit; font-weight: 600; cursor: pointer; }
.details-queue:hover { border-color: var(--accent); color: var(--accent); }
.details-queue svg { width: 16px; height: 16px; }

/* Watch-later ("посмотреть позже") button in the details card */
.details-later { display: inline-flex; align-items: center; gap: 7px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 11px; padding: 11px 15px; font: inherit; font-weight: 600; cursor: pointer; }
.details-later:hover { border-color: var(--accent); color: var(--accent); }
.details-later svg { width: 16px; height: 16px; }
.details-later.saved { background: rgba(229, 160, 13, .14); border-color: var(--accent); color: var(--accent); }

/* Add-to-queue button on library rows (left of the info button) */
.queue-btn { position: absolute; right: 38px; top: 50%; transform: translateY(-50%); opacity: 0; width: 26px; height: 26px; border-radius: 50%; background: rgba(0, 0, 0, 0.5); border: 1px solid var(--line); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: opacity .12s, border-color .12s, color .12s; }
.queue-btn svg { width: 15px; height: 15px; }
#items li:hover .queue-btn { opacity: 1; }
.queue-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Watch-later button on library rows (left of the queue button) */
.later-btn { position: absolute; right: 68px; top: 50%; transform: translateY(-50%); opacity: 0; width: 26px; height: 26px; border-radius: 50%; background: rgba(0, 0, 0, 0.5); border: 1px solid var(--line); color: var(--text); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; transition: opacity .12s, border-color .12s, color .12s; }
.later-btn svg { width: 14px; height: 14px; }
#items li:hover .later-btn { opacity: 1; }
.later-btn:hover { border-color: var(--accent); color: var(--accent); }
#items li.saved .later-btn { color: var(--accent); }
/* Saved rows get a subtle accent bar on the left (visible without hovering) */
#items li.saved { box-shadow: inset 3px 0 0 var(--accent); }

/* Queue ("up next") panel */
.queue-panel { border-bottom: 1px solid var(--line); padding: 10px 12px; background: rgba(229, 160, 13, 0.05); }
.queue-panel.hidden { display: none; }
.queue-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.queue-title { display: inline-flex; align-items: center; gap: 6px; margin-right: auto; font-size: 12px; font-weight: 700; letter-spacing: .3px; }
.queue-title .ico { color: var(--accent); }
.queue-title .ico svg { width: 15px; height: 15px; }
#queue-count { color: var(--muted); font-weight: 600; }
.queue-vote { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 24px; background: transparent; border: 1px solid var(--line); border-radius: 7px; color: var(--text); cursor: pointer; }
.queue-vote.hidden { display: none; }
.queue-vote svg { width: 14px; height: 14px; }
.queue-vote:hover { border-color: var(--accent); color: var(--accent); }
.queue-next { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 24px; background: transparent; border: 1px solid var(--line); border-radius: 7px; color: var(--text); cursor: pointer; }
.queue-next.hidden { display: none; }
.queue-next svg { width: 13px; height: 13px; }
.queue-next:hover { border-color: var(--accent); color: var(--accent); }
.queue-clear { background: transparent; border: none; color: var(--muted); font-size: 13px; cursor: pointer; padding: 2px 4px; }
.queue-clear:hover { color: var(--bad); }
#queue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; max-height: 190px; overflow-y: auto; }
#queue-list li { display: flex; align-items: center; gap: 9px; padding: 4px; border-radius: 8px; }
#queue-list li:hover { background: var(--panel-2); }
#queue-list img { width: 30px; height: 45px; object-fit: cover; border-radius: 4px; background: #000; flex-shrink: 0; }
.q-meta { min-width: 0; flex: 1; }
.q-t { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.q-y { color: var(--muted); font-weight: 400; }
.q-by { font-size: 11px; color: var(--muted); }
.q-del { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 6px; opacity: 0; }
#queue-list li:hover .q-del { opacity: 1; }
.q-del:hover { color: var(--bad); }

/* Trailer button in the details card */
.details-trailer { display: inline-flex; align-items: center; gap: 7px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 11px; padding: 11px 15px; font: inherit; font-weight: 600; cursor: pointer; }
.details-trailer.hidden { display: none; }
.details-trailer:hover { border-color: var(--accent); color: var(--accent); }
.details-trailer svg { width: 16px; height: 16px; }

/* Voting modal */
.vote-modal { position: fixed; inset: 0; z-index: 2500; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.72); backdrop-filter: blur(4px); padding: 20px; }
.vote-modal.hidden { display: none; }
.vote-card { width: 100%; max-width: 640px; max-height: 84vh; overflow: auto; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: 0 24px 70px rgba(0, 0, 0, .55); }
.vote-head { display: flex; align-items: center; margin-bottom: 16px; }
.vote-title { display: inline-flex; align-items: center; gap: 8px; font-size: 18px; font-weight: 700; }
.vote-title .ico { color: var(--accent); }
.vote-title .ico svg { width: 20px; height: 20px; }
.vote-x { margin-left: auto; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); border-radius: 50%; width: 30px; height: 30px; color: var(--muted); cursor: pointer; font-size: 14px; }
.vote-x.hidden { display: none; }
.vote-x:hover { color: var(--text); border-color: var(--accent); }
.vote-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.vote-cand { display: flex; gap: 10px; align-items: center; text-align: left; padding: 8px; background: #0d0f13; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; color: var(--text); transition: border-color .12s, background .12s; }
.vote-cand:hover { border-color: var(--accent); }
.vote-cand.mine { border-color: var(--accent); background: rgba(229, 160, 13, .12); }
.vote-cand img { width: 40px; height: 60px; object-fit: cover; border-radius: 6px; background: #000; flex-shrink: 0; }
.vc-body { flex: 1; min-width: 0; }
.vc-t { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vc-y { color: var(--muted); font-weight: 400; }
.vc-bar { height: 5px; border-radius: 999px; background: #2a2f3a; margin-top: 6px; overflow: hidden; }
.vc-bar > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), #ffca4b); transition: width .3s; }
.vc-n { font-size: 16px; font-weight: 800; color: var(--accent); min-width: 20px; text-align: center; }
.vote-foot { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.vote-info { color: var(--muted); font-size: 13px; }
.vote-end { margin-left: auto; background: var(--accent); color: #14171e; border: none; border-radius: 10px; padding: 9px 18px; font: inherit; font-weight: 700; cursor: pointer; }
.vote-end.hidden { display: none; }
.vote-end:hover { filter: brightness(1.08); }

/* Trailer modal */
.trailer-modal { position: fixed; inset: 0; z-index: 2600; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.85); padding: 20px; }
.trailer-modal.hidden { display: none; }
.trailer-card { width: 100%; max-width: 900px; position: relative; }
.trailer-close { position: absolute; right: -4px; top: -38px; background: rgba(0, 0, 0, .5); border: 1px solid var(--line); border-radius: 50%; width: 32px; height: 32px; color: #fff; cursor: pointer; font-size: 15px; }
.trailer-close:hover { border-color: var(--accent); color: var(--accent); }
.trailer-frame { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.trailer-frame iframe, .trailer-frame video { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; object-fit: contain; }
.trailer-ext { display: inline-block; margin-top: 10px; color: var(--muted); font-size: 13px; text-decoration: none; }
.trailer-ext:hover { color: var(--accent); }

/* Keyboard shortcuts help */
.sc-btn { width: 26px; height: 26px; border-radius: 50%; background: var(--panel); color: var(--muted); border: 1px solid var(--line); font-weight: 700; cursor: pointer; flex-shrink: 0; }
.sc-btn:hover { border-color: var(--accent); color: var(--accent); }
.sc-modal { position: fixed; inset: 0; z-index: 2700; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); padding: 20px; }
.sc-modal.hidden { display: none; }
.sc-card { position: relative; width: 100%; max-width: 400px; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: 0 24px 70px rgba(0, 0, 0, .55); }
.sc-card h3 { margin: 0 0 14px; font-size: 17px; }
.sc-close { position: absolute; right: 12px; top: 12px; width: 28px; height: 28px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 50%; color: var(--muted); cursor: pointer; }
.sc-close:hover { color: var(--text); border-color: var(--accent); }
.sc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.sc-list li { display: flex; align-items: center; gap: 12px; font-size: 13px; color: #d3d7de; }
.sc-keys { flex: 0 0 92px; display: flex; gap: 5px; }
.sc-list em { color: var(--muted); font-style: normal; font-size: 11px; }
kbd { display: inline-block; min-width: 16px; text-align: center; padding: 2px 6px; background: #0d0f13; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; font: 600 11px/1.4 ui-monospace, "SF Mono", monospace; color: var(--text); }
.sc-hint { margin: 14px 0 0; font-size: 12px; color: var(--muted); }

/* Party stats */
.stats-btn { width: 26px; height: 26px; border-radius: 50%; background: var(--panel); color: var(--muted); border: 1px solid var(--line); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stats-btn:hover { border-color: var(--accent); color: var(--accent); }
.stats-btn:hover .ico { color: var(--accent); }
.stats-btn .ico svg { width: 15px; height: 15px; }
.stats-modal { position: fixed; inset: 0; z-index: 2700; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, 0.7); backdrop-filter: blur(4px); padding: 20px; }
.stats-modal.hidden { display: none; }
.stats-card { position: relative; width: 100%; max-width: 460px; max-height: 84vh; overflow: auto; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 16px; padding: 22px; box-shadow: 0 24px 70px rgba(0, 0, 0, .55); }
.stats-card h3 { margin: 0 0 16px; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.stats-card h3 .ico { color: var(--accent); }
.stats-card h3 .ico svg { width: 18px; height: 18px; }
.stats-close { position: absolute; right: 12px; top: 12px; width: 28px; height: 28px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 50%; color: var(--muted); cursor: pointer; }
.stats-close:hover { color: var(--text); border-color: var(--accent); }
.stats-body { display: flex; flex-direction: column; gap: 18px; }
.stats-loading { color: var(--muted); font-size: 13px; text-align: center; padding: 12px; }
.stat-totals { display: flex; gap: 10px; }
.stat-tile { flex: 1; background: #0d0f13; border: 1px solid var(--line); border-radius: 12px; padding: 12px 8px; text-align: center; }
.stat-num { font-size: 24px; font-weight: 800; color: var(--accent); line-height: 1; }
.stat-lbl { font-size: 11px; color: var(--muted); margin-top: 5px; }
.stat-sec h4 { margin: 0 0 9px; font-size: 13px; color: #c3c9d4; font-weight: 700; }
.stat-liked { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; counter-reset: rank; }
.stat-liked li { display: flex; align-items: center; gap: 9px; counter-increment: rank; }
.stat-liked li::before { content: counter(rank); flex: 0 0 16px; text-align: center; font-size: 12px; font-weight: 800; color: var(--muted); }
.stat-liked img { width: 26px; height: 39px; object-fit: cover; border-radius: 4px; background: #000; flex-shrink: 0; }
.sl-t { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sl-n { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: #ff6b6b; }
.sl-n svg { width: 12px; height: 12px; }
.stat-likers { display: flex; flex-direction: column; gap: 7px; }
.stat-liker { display: flex; align-items: center; gap: 9px; }
.stat-liker img, .stat-liker .sl-init { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; border: 1px solid var(--line); flex-shrink: 0; }
.stat-liker .sl-init { display: inline-flex; align-items: center; justify-content: center; background: var(--accent-2); color: #fff; font-size: 11px; font-weight: 700; }
.skr-n { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.skr-c { font-size: 13px; font-weight: 800; color: var(--accent); }
.stat-genres { display: flex; flex-direction: column; gap: 7px; }
.stat-genre { display: flex; align-items: center; gap: 9px; }
.sg-n { flex: 0 0 96px; font-size: 12px; color: #c3c9d4; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sg-bar { flex: 1; height: 7px; border-radius: 999px; background: #2a2f3a; overflow: hidden; }
.sg-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), #ffca4b); }
.sg-c { font-size: 12px; font-weight: 700; color: var(--muted); min-width: 16px; text-align: right; }

/* Text chat */
.chat-btn { width: 26px; height: 26px; border-radius: 50%; background: var(--panel); color: var(--muted); border: 1px solid var(--line); cursor: pointer; position: relative; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.chat-btn:hover { border-color: var(--accent); color: var(--accent); }
.chat-btn .ico svg { width: 15px; height: 15px; }

/* --- Header system-health dot + hover popover --- */
.health-wrap { position: relative; display: inline-flex; align-items: center; }
.health-btn { width: 26px; height: 26px; border-radius: 50%; background: var(--panel); color: var(--muted); border: 1px solid var(--line); cursor: default; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; transition: color .25s, border-color .25s; }
.health-btn .ico svg { width: 15px; height: 15px; }
.health-btn.ok   { color: var(--ok); }
.health-btn.warn { color: var(--accent); }
.health-btn.down { color: var(--bad); border-color: var(--bad); animation: healthPulse 1.5s ease-in-out infinite; }
@keyframes healthPulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(255, 107, 107, .5); } 70% { box-shadow: 0 0 0 6px rgba(255, 107, 107, 0); } }

.health-pop { position: absolute; top: 34px; left: 0; z-index: 60; min-width: 232px; padding: 10px 10px 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 36px rgba(0, 0, 0, .5); opacity: 0; visibility: hidden; transform: translateY(-4px); transition: opacity .16s ease, transform .16s ease, visibility .16s; pointer-events: none; }
.health-wrap:hover .health-pop, .health-btn:focus-visible + .health-pop { opacity: 1; visibility: visible; transform: translateY(0); }
.hp-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin: 0 2px 8px; }
.hp-row { display: flex; align-items: center; gap: 8px; padding: 4px 2px; font-size: 13px; line-height: 1.2; }
.hp-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; background: var(--muted); }
.hp-dot.ok { background: var(--ok); box-shadow: 0 0 7px var(--ok); }
.hp-dot.warn { background: var(--accent); box-shadow: 0 0 7px var(--accent); }
.hp-dot.down { background: var(--bad); box-shadow: 0 0 7px var(--bad); }
.hp-dot.off { background: var(--muted); opacity: .45; }
.hp-label { color: var(--text); }
.hp-detail { color: var(--muted); margin-left: auto; font-size: 11.5px; text-align: right; }
.hp-foot { margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 10px; }
.chat-unread { position: absolute; top: -5px; right: -5px; min-width: 15px; height: 15px; padding: 0 3px; border-radius: 999px; background: var(--bad); color: #fff; font-size: 9px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; line-height: 1; }
.chat-unread.hidden { display: none; }
.chat-panel { position: fixed; right: 16px; bottom: 16px; width: 320px; max-width: calc(100vw - 32px); height: min(58vh, 460px); z-index: 2400; display: flex; flex-direction: column; background: rgba(16, 19, 26, 0.97); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .55); backdrop-filter: blur(8px); overflow: hidden; }
.chat-panel.hidden { display: none; }
.chat-head { display: flex; align-items: center; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.chat-title { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; }
.chat-title .ico { color: var(--accent); }
.chat-title .ico svg { width: 15px; height: 15px; }
.chat-close { margin-left: auto; background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 13px; }
.chat-close:hover { color: var(--text); }
.chat-msgs { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 7px; }
.chat-msgs:empty::before { content: "Сообщений пока нет — напишите первым"; color: var(--muted); font-size: 12px; margin: auto; text-align: center; }
.chat-msg { max-width: 88%; align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 5px 9px; font-size: 13px; line-height: 1.35; word-break: break-word; }
.chat-msg.mine { align-self: flex-end; background: rgba(229, 160, 13, .14); border-color: rgba(229, 160, 13, .4); }
.cm-name { display: block; font-size: 10px; font-weight: 700; color: var(--accent); margin-bottom: 1px; }
.chat-msg.mine .cm-name { color: #ffca4b; }
.cm-text { color: var(--text); }
.chat-form { display: flex; gap: 6px; padding: 10px; border-top: 1px solid var(--line); }
.chat-form input { flex: 1; min-width: 0; padding: 8px 11px; background: #0d0f13; color: var(--text); border: 1px solid var(--line); border-radius: 9px; font: inherit; font-size: 13px; outline: none; }
.chat-form input:focus { border-color: var(--accent); }
.chat-send { display: inline-flex; align-items: center; justify-content: center; width: 36px; background: var(--accent); border: none; border-radius: 9px; color: #14171e; cursor: pointer; flex-shrink: 0; }
.chat-send:hover { filter: brightness(1.08); }
.chat-send svg { width: 16px; height: 16px; }
@media (max-width: 560px) { .chat-panel { width: calc(100vw - 24px); right: 12px; bottom: 12px; } }
@media (max-width: 560px) { .details-card { flex-direction: column; } .details-poster { width: 150px; margin: 0 auto; } }

.lib-empty { padding: 24px; text-align: center; color: var(--muted); }
.lib-empty.hidden { display: none; }

/* Reactions */
.react-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 5; }
.react-float { position: absolute; bottom: 58px; display: flex; flex-direction: column; align-items: center; gap: 3px; will-change: transform, opacity; animation: floatUp 2.4s ease-out forwards; }
.react-emoji { font-size: 34px; }
.react-emoji-img { width: 42px; height: 42px; object-fit: contain; display: block; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5)); }
.react-who { display: inline-flex; align-items: center; gap: 4px; background: rgba(6, 8, 11, 0.7); border-radius: 999px; padding: 1px 8px 1px 2px; font-size: 11px; color: #fff; white-space: nowrap; }
.react-who img { width: 16px; height: 16px; border-radius: 50%; object-fit: cover; }
@keyframes floatUp {
  0% { opacity: 0; transform: translateY(0) scale(.6); }
  14% { opacity: 1; transform: translateY(-12px) scale(1.15); }
  100% { opacity: 0; transform: translateY(-230px) scale(1); }
}
.reactions { position: absolute; right: 34px; bottom: 66px; z-index: 6; display: flex; align-items: flex-end; gap: 12px; }
.reactions.hidden { display: none; }
.react-trigger {
  width: 36px; height: 36px; border-radius: 50%; padding: 0;
  background: rgba(6, 8, 11, 0.6); border: 1px solid var(--line);
  font-size: 18px; line-height: 1; cursor: pointer;
  opacity: .5; transition: opacity .2s, transform .1s;
}
.video-wrap:hover .react-trigger { opacity: .85; }
.reactions:hover .react-trigger, .reactions.open .react-trigger { opacity: 1; }
.react-trigger:hover { transform: scale(1.1); }
.react-panel {
  order: -1; display: flex; flex-direction: column; gap: 8px; padding: 11px 14px 12px; width: 276px;
  background: rgba(10, 13, 18, .9); border: 1px solid rgba(255, 255, 255, .11); border-radius: 17px;
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px); box-shadow: 0 18px 52px rgba(0, 0, 0, .46);
  opacity: 0; transform: translateX(10px) scale(.96); pointer-events: none;
  transition: opacity .18s, transform .18s;
}
.react-panel-head { display: flex; align-items: baseline; justify-content: space-between; padding: 0 2px; }
.react-panel-head strong { color: #eef1f5; font-size: 11px; font-weight: 800; letter-spacing: .035em; text-transform: uppercase; }
.react-panel-head span { color: #717b89; font-size: 9.5px; font-weight: 650; }
.react-row {
  display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px 5px;
  justify-items: center; align-items: center;
  padding: 1px 0; box-sizing: border-box;
}
.react-row, .react-row * { user-select: none; -webkit-user-select: none; }
/* The emoji list opens only when the 😊 trigger is hovered (JS toggles .open),
   and stays open while the pointer is anywhere in the reactions cluster. */
.reactions.open .react-panel { opacity: 1; transform: none; pointer-events: auto; }
.react-row > button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; box-sizing: border-box;
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .07); font-size: 27px; cursor: pointer; padding: 1px;
  border-radius: 11px; line-height: 1; transition: transform .12s ease, background .12s ease, border-color .12s ease;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.react-row > button:hover { z-index: 2; background: rgba(229, 160, 13, .13); border-color: rgba(229, 160, 13, .32); transform: translateY(-2px) scale(1.08); }

/* Custom (hand-drawn) emoji inside the reaction row */
/* display:contents so each custom emoji becomes a direct grid cell of .react-row */
.custom-emoji-row { display: contents; }
.ce-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; box-sizing: border-box;
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .07); padding: 1px; cursor: pointer;
  border-radius: 11px; line-height: 1; transition: transform .12s ease, background .12s ease, border-color .12s ease;
}
.ce-btn img { width: 31px; height: 31px; object-fit: contain; display: block; }
.ce-btn:hover { z-index: 2; background: rgba(229, 160, 13, .13); border-color: rgba(229, 160, 13, .32); transform: translateY(-2px) scale(1.08); }
.ce-anim-mark { position: absolute; right: -3px; bottom: -3px; display: inline-flex; align-items: center; justify-content: center; width: 13px; height: 13px;
  color: #211805; background: var(--accent); border: 1px solid #11161d; border-radius: 50%; font-size: 6px; line-height: 1; pointer-events: none; }
.ce-del { position: absolute; top: 0; right: 0; width: 16px; height: 16px; border-radius: 50%; border: 1px solid #12161d; background: #e23b3b; color: #fff; font-size: 10px; line-height: 14px; padding: 0; cursor: pointer; display: none; z-index: 3; }
.draw-emoji-btn { background: transparent; border: none; color: #fff; font-size: 15px; cursor: pointer; padding: 2px 4px; border-radius: 8px; line-height: 1; opacity: .75; transition: transform .1s, opacity .1s; }
.draw-emoji-btn:hover { transform: scale(1.2); opacity: 1; }
.react-row .add-emoji-btn, .react-row .edit-emoji-btn { background: transparent; border: none; color: #fff; font-size: 16px; cursor: pointer; padding: 2px 5px; border-radius: 8px; line-height: 1; opacity: .7; transition: transform .1s, opacity .1s, background .1s; }
.react-row .add-emoji-btn { font-weight: 700; font-size: 18px; }
.add-emoji-btn:hover, .edit-emoji-btn:hover { transform: scale(1.2); opacity: 1; }
.add-emoji-btn.active, .edit-emoji-btn.active { opacity: 1; background: rgba(255, 255, 255, .14); }
.ce-emoji {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 27px; line-height: 1;
  font-family: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}
.ce-char { padding: 0 1px; }
/* System buttons live in their own toolbar under the emoji grid */
.react-tools { display: flex; justify-content: center; gap: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.react-tool { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: #e6e9ee; border-radius: 9px; cursor: pointer; transition: background .12s, transform .1s; }
.react-tool svg { width: 18px; height: 18px; }
.react-tool:hover { background: rgba(255, 255, 255, .14); transform: translateY(-1px); }
.react-tool.active { background: var(--accent); color: #10141b; border-color: var(--accent); }
.react-hint { display: none; margin-top: 6px; font-size: 11px; color: var(--muted); text-align: center; }
.reactions.editing .react-hint, .reactions.deleting .react-hint { display: block; }
/* delete mode: tap any of your reactions (or its ✕) to remove it */
.reactions.deleting .ce-del, .reactions.editing .ce-del { display: block; }
.reactions.deleting .ce-btn { cursor: pointer; }
.reactions.deleting .ce-btn::after { content: ""; position: absolute; inset: -1px; border-radius: 8px; box-shadow: 0 0 0 2px rgba(226, 59, 59, .65) inset; pointer-events: none; }
.reactions.deleting .ce-btn:hover { transform: none; }
/* edit mode: drag your reactions to reorder them */
.reactions.editing .ce-btn { cursor: grab; touch-action: none; outline: 1px dashed rgba(255, 255, 255, .35); outline-offset: 1px; border-radius: 6px; }
.reactions.editing .ce-btn:hover { transform: none; }
.ce-btn.dragging { opacity: .55; pointer-events: none; transform: scale(1.12); z-index: 4; }

/* Emoji picker popover */
.emoji-picker { position: absolute; bottom: calc(100% + 8px); right: 0; width: 300px; max-width: 86vw; max-height: 300px; display: flex; flex-direction: column;
  background: rgba(10, 13, 18, 0.97); border: 1px solid var(--line); border-radius: 14px; padding: 8px; box-shadow: 0 16px 46px rgba(0, 0, 0, .55); z-index: 7; }
.emoji-picker.hidden { display: none; }
.emoji-search { width: 100%; box-sizing: border-box; margin-bottom: 6px; padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255, 255, 255, .05); color: var(--text); font-size: 13px; outline: none; }
.emoji-search:focus { border-color: var(--accent); }
.emoji-grid { overflow-y: auto; overscroll-behavior: contain; padding-right: 2px; }
.ep-cat { font-size: 11px; color: var(--muted); margin: 6px 2px 3px; text-transform: uppercase; letter-spacing: .4px; }
.ep-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 1px; }
.ep-emoji { background: transparent; border: none; cursor: pointer; font-size: 22px; line-height: 1; padding: 4px 0; border-radius: 8px; transition: transform .08s, background .1s; }
.ep-emoji:hover { background: rgba(255, 255, 255, .12); transform: scale(1.15); }
.ep-emoji.ep-hit { animation: keyHit .25s ease; }
.ep-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 14px 0; }

@media (max-width: 480px) {
  .reactions { right: 10px; gap: 7px; }
  .react-panel { width: min(276px, calc(100vw - 63px)); padding: 10px; }
  .reactions.open .react-panel { transform: translateY(clamp(0px, calc(291.25px - 75vw), 36px)); }
  .react-row { gap: 5px; }
  .react-row > button, .ce-btn { width: clamp(32px, 9vw, 36px); height: clamp(32px, 9vw, 36px); }
  .react-row > button, .ce-emoji { font-size: clamp(24px, 7vw, 27px); }
  .ce-btn img { width: clamp(28px, 8vw, 31px); height: clamp(28px, 8vw, 31px); }
}
@media (max-width: 340px) {
  .react-panel { width: min(276px, calc(100vw - 89px)); }
  .react-row { gap: 5px 3px; }
  .reactions.open .react-panel { transform: translateY(52px); }
}

/* Draw-your-own-emoji modal */
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important;
  overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
body.draw-editor-open { overflow: hidden; user-select: none; -webkit-user-select: none; }
.draw-modal { position: fixed; inset: 0; z-index: 2800; display: flex; align-items: center; justify-content: center; padding: 18px; box-sizing: border-box;
  background: rgba(4, 6, 9, .78); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); -webkit-touch-callout: none; }
.draw-modal.hidden { display: none; }
.draw-card { width: min(680px, calc(100vw - 36px)); max-height: calc(100dvh - 36px); overflow: auto; box-sizing: border-box; scroll-padding-block: 16px;
  background: linear-gradient(155deg, #171c25 0%, #10141b 72%); border: 1px solid rgba(255, 255, 255, .11); border-radius: 22px; padding: 22px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, .64), inset 0 1px 0 rgba(255, 255, 255, .035); color-scheme: dark; overscroll-behavior: contain; }
.draw-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 18px; }
.draw-heading { min-width: 0; }
.draw-eyebrow { display: block; margin-bottom: 6px; color: var(--accent); font-size: 10px; line-height: 1; font-weight: 800; letter-spacing: .13em; }
.draw-title-row { display: flex; align-items: center; gap: 9px; }
.draw-title-row h2 { margin: 0; font-size: 21px; line-height: 1.15; letter-spacing: -.02em; }
.draw-title-icon { display: inline-flex; width: 21px; height: 21px; color: var(--accent); }
.draw-title-icon svg { width: 100%; height: 100%; }
.draw-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.draw-close { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 36px; height: 36px; padding: 9px;
  background: rgba(255, 255, 255, .055); border: 1px solid rgba(255, 255, 255, .08); border-radius: 11px; color: #aeb8c5; cursor: pointer; transition: color .15s, background .15s, transform .15s; }
.draw-close svg { width: 100%; height: 100%; }
.draw-close:hover { color: #fff; background: rgba(255, 255, 255, .1); }
.draw-close:active { transform: scale(.95); }
.draw-close:disabled { opacity: .4; cursor: wait; }
.draw-workspace { display: grid; grid-template-columns: minmax(288px, 1.12fr) minmax(238px, .88fr); align-items: start; gap: 18px; }
.draw-canvas-column { min-width: 0; }
.draw-stage { position: relative; width: 100%; max-width: 340px; aspect-ratio: 1; margin: 0 auto; padding: 8px; box-sizing: border-box;
  background: rgba(255, 255, 255, .035); border: 1px solid rgba(255, 255, 255, .1); border-radius: 18px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .24); transition: border-color .15s, box-shadow .15s; }
.draw-stage::before { content: ''; position: absolute; z-index: 0; inset: 8px; border-radius: 12px; pointer-events: none;
  background: repeating-conic-gradient(#29303a 0% 25%, #222831 0% 50%) 50% / 24px 24px; box-shadow: 0 8px 24px rgba(0, 0, 0, .24); }
#draw-canvas { position: relative; z-index: 2; display: block; width: 100%; height: 100%; border-radius: 12px; touch-action: none; cursor: crosshair; outline: none; background: transparent;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
#draw-onion-layer { position: absolute; z-index: 1; inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); border-radius: 12px;
  pointer-events: none; opacity: 0; transition: opacity .14s ease; }
#draw-onion-layer.visible { opacity: 1; }
.draw-pen-cursor { position: absolute; z-index: 4; left: 0; top: 0; display: block; width: var(--pen-w, 16px); height: var(--pen-h, 16px); box-sizing: border-box;
  border: 1.5px solid rgba(255, 255, 255, .94); border-radius: 50%; background: color-mix(in srgb, var(--pen-color, #ffcc33) 34%, transparent);
  box-shadow: 0 0 0 1px rgba(8, 11, 16, .72), 0 2px 8px rgba(0, 0, 0, .35); pointer-events: none;
  transform: translate(-50%, -50%) rotate(var(--pen-angle, 0rad)); transform-origin: center; transition: opacity .06s ease; }
.draw-pen-cursor.hidden { display: none; }
.draw-pen-cursor.erasing { border-style: dashed; background: rgba(255, 255, 255, .08); }
.draw-pen-cursor.utility { width: 18px; height: 18px; border-color: var(--accent); background: rgba(229, 160, 13, .1); }
.draw-pen-tool-toggle { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 44px; height: 44px; padding: 11px;
  color: #eef2f7; background: rgba(12, 16, 22, .76); border: 1px solid rgba(255, 255, 255, .2); border-radius: 50%; box-shadow: 0 4px 15px rgba(0, 0, 0, .34); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); cursor: pointer;
  transition: color .14s, background .14s, border-color .14s, transform .12s; }
.draw-pen-tool-toggle:hover:not(:disabled) { color: var(--accent); background: rgba(20, 25, 33, .9); border-color: rgba(229, 160, 13, .48); }
.draw-pen-tool-toggle:active:not(:disabled) { transform: scale(.92); }
.draw-pen-tool-toggle.eraser-active { color: #101820; background: #dce6ef; border-color: rgba(255, 255, 255, .78); }
.draw-pen-tool-toggle:disabled { opacity: .38; cursor: default; }
.draw-pen-tool-toggle svg { width: 100%; height: 100%; }
.draw-stage.pen-active #draw-canvas { cursor: none; }
#draw-canvas.erasing { cursor: cell; }
#draw-canvas.filling { cursor: copy; }
.draw-stage.sampling { border-color: rgba(229, 160, 13, .82); box-shadow: 0 0 0 3px rgba(229, 160, 13, .12), inset 0 0 0 1px rgba(0, 0, 0, .24); }
.draw-stage.filling { border-color: rgba(90, 169, 255, .68); box-shadow: 0 0 0 3px rgba(90, 169, 255, .1), inset 0 0 0 1px rgba(0, 0, 0, .24); }
.draw-stage.sampling .draw-transparency { color: #211805; background: var(--accent); }
.draw-stage.filling .draw-transparency { color: #081522; background: #73b9ff; }
#draw-canvas:focus-visible { box-shadow: 0 0 0 2px var(--accent), 0 8px 24px rgba(0, 0, 0, .24); }
.draw-transparency { position: absolute; z-index: 3; left: 17px; bottom: 17px; padding: 4px 8px; border-radius: 999px; pointer-events: none;
  color: rgba(255, 255, 255, .78); background: rgba(9, 12, 17, .78); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); font-size: 10px; font-weight: 700; letter-spacing: .02em;
  opacity: 1; transform: translateY(0); transition: opacity .14s ease, transform .14s ease, color .15s, background .15s; }
.draw-stage.hint-away .draw-transparency { opacity: 0; transform: translateY(4px); }
.draw-preview-row { display: flex; align-items: center; gap: 11px; margin: 12px 2px 0; }
.draw-preview-box { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 52px; height: 52px; border-radius: 14px;
  background: repeating-conic-gradient(#29303a 0% 25%, #222831 0% 50%) 50% / 12px 12px; border: 1px solid rgba(255, 255, 255, .1); }
#draw-preview { display: block; width: 38px; height: 38px; }
.draw-preview-copy { display: flex; min-width: 0; flex-direction: column; gap: 3px; }
.draw-preview-copy strong { color: #e9edf3; font-size: 12px; }
.draw-preview-copy span { color: var(--muted); font-size: 10.5px; }
.draw-preview-actions { display: flex; align-items: center; flex: 0 0 auto; gap: 6px; margin-left: auto; }
.draw-preview-toggle { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 38px; height: 38px; padding: 10px;
  color: #d7dde5; background: rgba(255, 255, 255, .055); border: 1px solid rgba(255, 255, 255, .09); border-radius: 11px; cursor: pointer; }
.draw-preview-toggle.hidden { display: none; }
.draw-preview-toggle:hover:not(:disabled) { color: var(--accent); background: rgba(229, 160, 13, .08); border-color: rgba(229, 160, 13, .3); }
.draw-preview-toggle:disabled { opacity: .38; cursor: default; }
.draw-preview-toggle svg { width: 100%; height: 100%; }
.draw-controls { display: flex; flex-direction: column; gap: 10px; }
.draw-section { padding: 11px 12px; background: rgba(255, 255, 255, .035); border: 1px solid rgba(255, 255, 255, .075); border-radius: 13px; }
.draw-label, .draw-label-row { color: #b8c1cd; font-size: 10.5px; font-weight: 750; letter-spacing: .035em; text-transform: uppercase; }
.draw-label-row { display: flex; align-items: center; justify-content: space-between; }
#draw-size-value { color: var(--accent); font-size: 11px; font-weight: 800; letter-spacing: 0; text-transform: none; }
.draw-mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.draw-mode-btn { display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 6px; min-height: 38px; padding: 7px 8px;
  color: #c4ccd6; background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .08); border-radius: 9px; cursor: pointer; font: inherit; font-size: 12px; font-weight: 700; text-align: left; transition: .15s ease; }
.draw-mode-btn i { display: inline-flex; width: 17px; height: 17px; }
.draw-mode-btn svg { width: 100%; height: 100%; }
.draw-mode-btn kbd, .draw-key-hint kbd { min-width: 15px; padding: 1px 3px; box-sizing: border-box; border: 1px solid rgba(255, 255, 255, .16); border-radius: 4px;
  color: #aeb8c4; background: rgba(0, 0, 0, .2); box-shadow: none; font-family: inherit; font-size: 10px; font-weight: 650; line-height: 1.35; text-align: center; }
.draw-mode-btn:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.draw-mode-btn.active { color: #1c1607; background: var(--accent); border-color: var(--accent); box-shadow: 0 4px 14px rgba(229, 160, 13, .18); }
.draw-mode-btn.active kbd { color: rgba(28, 22, 7, .65); border-color: rgba(28, 22, 7, .25); background: rgba(255, 255, 255, .18); }
.draw-mode-btn:disabled { opacity: .34; cursor: default; }
.draw-color-row { display: flex; align-items: center; gap: 8px; margin-top: 9px; }
.draw-swatches { display: grid; grid-template-columns: repeat(6, 27px); gap: 6px; }
.draw-sw { position: relative; width: 27px; height: 27px; border: 0; border-radius: 50%; cursor: pointer; padding: 0; background: transparent; }
.draw-sw::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: var(--draw-swatch); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .22); transition: transform .12s, box-shadow .12s; }
.draw-sw:hover::before { transform: scale(1.12); }
.draw-sw.active::before { box-shadow: 0 0 0 2px #11161d, 0 0 0 4px #fff; }
.draw-sw.custom::after { content: ''; position: absolute; right: -1px; bottom: -1px; width: 6px; height: 6px; border: 1px solid #11161d; border-radius: 50%; background: #fff; }
.draw-custom-color { position: relative; display: flex; align-items: center; justify-content: center; gap: 4px; flex: 0 0 auto; width: 54px; height: 36px; border-radius: 10px; overflow: hidden;
  color: #e9edf3; background: rgba(255, 255, 255, .055); border: 1px solid rgba(255, 255, 255, .12); box-shadow: inset 0 -3px 0 var(--draw-custom-color, #ffcc33); cursor: pointer; transition: background .12s, border-color .12s, transform .12s; }
.draw-custom-color:hover, .draw-custom-color:focus-within { background: rgba(255, 255, 255, .095); border-color: rgba(229, 160, 13, .45); transform: translateY(-1px); }
.draw-custom-color i, .draw-custom-color span { position: relative; z-index: 1; pointer-events: none; }
.draw-custom-color i { color: var(--accent); font-size: 17px; font-style: normal; font-weight: 800; line-height: 1; }
.draw-custom-color span { font-size: 10px; font-weight: 750; line-height: 1; }
#draw-color { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; opacity: 0; cursor: pointer; }
.draw-color-help { display: block; margin: 7px 1px 0; color: #a1acb9; font-size: 10.5px; line-height: 1.4; }
.draw-size-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.draw-size-dot { display: block; flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: var(--draw-dot-color, #ffcc33); box-shadow: 0 0 0 1px rgba(255, 255, 255, .3); transition: width .1s, height .1s, background .1s; }
#draw-size { -webkit-appearance: none; appearance: none; flex: 1; min-width: 0; height: 20px; margin: 0; background: transparent; cursor: pointer; --fill: 29%; }
#draw-size::-webkit-slider-runnable-track { height: 5px; border-radius: 999px; background: linear-gradient(to right, var(--accent) var(--fill), rgba(255, 255, 255, .13) var(--fill)); }
#draw-size::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 17px; height: 17px; margin-top: -6px; border: 3px solid #151a22; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px rgba(255, 255, 255, .16); }
#draw-size::-moz-range-track { height: 5px; border-radius: 999px; background: rgba(255, 255, 255, .13); }
#draw-size::-moz-range-progress { height: 5px; border-radius: 999px; background: var(--accent); }
#draw-size::-moz-range-thumb { width: 13px; height: 13px; border: 2px solid #151a22; border-radius: 50%; background: var(--accent); }
.draw-size-section { transition: opacity .15s; }
.draw-size-section.inactive { opacity: .42; }
#draw-size:disabled { cursor: default; }
.draw-size-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 7px 0 0; }
.draw-key-hint { display: flex; align-items: center; gap: 4px; color: #a1acb9; font-size: 10.5px; }
.draw-input-hint { min-width: 0; max-width: 132px; color: #a1acb9; font-size: 10.5px; line-height: 1.25; text-align: right; }
.draw-stroke-settings { margin-top: 9px; overflow: hidden; background: rgba(0, 0, 0, .12); border: 1px solid rgba(255, 255, 255, .07); border-radius: 10px; }
.draw-stroke-settings summary { display: grid; grid-template-columns: minmax(0, 1fr) 14px; align-items: center; gap: 3px 7px; min-height: 42px; padding: 6px 8px;
  color: #adb6c2; cursor: pointer; list-style: none; transition: color .12s, background .12s; }
.draw-stroke-settings summary::-webkit-details-marker { display: none; }
.draw-stroke-settings summary:hover { color: #eef1f5; background: rgba(255, 255, 255, .04); }
.draw-stroke-settings-title { display: flex; min-width: 0; grid-column: 1; grid-row: 1; align-items: center; gap: 6px; font-size: 11px; font-weight: 750; }
.draw-stroke-settings-title i { display: inline-flex; flex: 0 0 auto; width: 14px; height: 14px; color: var(--accent); }
.draw-stroke-settings-title svg, .draw-stroke-settings-chevron svg { width: 100%; height: 100%; }
.draw-stroke-settings-summary { min-width: 0; grid-column: 1 / -1; grid-row: 2; color: #a8b2bf; font-size: 10px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.draw-stroke-settings-chevron { display: inline-flex; grid-column: 2; grid-row: 1; width: 14px; height: 14px; color: #929dab; transition: transform .16s ease; }
.draw-stroke-settings[open] .draw-stroke-settings-chevron { transform: rotate(180deg); }
.draw-stroke-settings-body { display: grid; gap: 12px; padding: 10px 9px 9px; border-top: 1px solid rgba(255, 255, 255, .065); }
.draw-stroke-setting { min-width: 0; }
.draw-stroke-setting-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.draw-stroke-setting-head label { display: flex; min-width: 0; flex-direction: column; gap: 1px; cursor: pointer; }
.draw-stroke-setting-head strong { color: #d5dbe3; font-size: 11px; font-weight: 750; }
.draw-stroke-setting-head small { color: #9aa5b3; font-size: 10px; line-height: 1.3; }
.draw-stroke-setting-head output { flex: 0 0 auto; color: var(--accent); font-size: 11px; font-weight: 800; }
#draw-smoothing, #draw-pressure, #draw-tilt { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 22px; margin: 0; background: transparent; cursor: pointer; --fill: 100%; }
#draw-smoothing::-webkit-slider-runnable-track, #draw-pressure::-webkit-slider-runnable-track, #draw-tilt::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: linear-gradient(to right, var(--accent) var(--fill), rgba(255, 255, 255, .13) var(--fill)); }
#draw-smoothing::-webkit-slider-thumb, #draw-pressure::-webkit-slider-thumb, #draw-tilt::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 15px; height: 15px; margin-top: -5.5px; border: 3px solid #151a22; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1px rgba(255, 255, 255, .16); }
#draw-smoothing::-moz-range-track, #draw-pressure::-moz-range-track, #draw-tilt::-moz-range-track { height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .13); }
#draw-smoothing::-moz-range-progress, #draw-pressure::-moz-range-progress, #draw-tilt::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--accent); }
#draw-smoothing::-moz-range-thumb, #draw-pressure::-moz-range-thumb, #draw-tilt::-moz-range-thumb { width: 11px; height: 11px; border: 2px solid #151a22; border-radius: 50%; background: var(--accent); }
#draw-smoothing:disabled, #draw-pressure:disabled, #draw-tilt:disabled { cursor: default; opacity: .45; }
.draw-stroke-scale { display: flex; justify-content: space-between; margin-top: -1px; color: #9ba6b4; font-size: 10px; }
.draw-stroke-reset { justify-self: end; min-height: 28px; padding: 5px 8px; color: #8f9aa8; background: transparent; border: 1px solid rgba(255, 255, 255, .08); border-radius: 7px;
  cursor: pointer; font: inherit; font-size: 10.5px; font-weight: 700; transition: color .12s, background .12s, border-color .12s; }
.draw-stroke-reset:hover:not(:disabled) { color: #fff; background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .15); }
.draw-stroke-reset:disabled { opacity: .38; cursor: default; }
.draw-history-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 36px; gap: 6px; margin-top: 8px; }
.draw-tool { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 0; min-height: 36px; padding: 7px 6px; color: #d1d7df;
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .08); border-radius: 9px; cursor: pointer; font: inherit; font-size: 11px; font-weight: 700; transition: .15s ease; }
.draw-tool i { display: inline-flex; width: 15px; height: 15px; }
.draw-tool svg { width: 100%; height: 100%; }
.draw-tool > span { min-width: 0; white-space: nowrap; }
.draw-tool-key { flex: 0 0 auto; min-width: 20px; padding: 1px 3px; border: 1px solid rgba(255, 255, 255, .13); border-radius: 4px;
  color: #aeb8c4; background: rgba(0, 0, 0, .2); font-family: inherit; font-size: 9.5px; font-weight: 650; line-height: 1.35; text-align: center; white-space: nowrap; }
.draw-history-row .draw-tool:not(.danger) { display: grid; grid-template-columns: 15px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: 4px; row-gap: 2px; min-height: 44px; padding-top: 5px; padding-bottom: 5px; }
.draw-history-row .draw-tool:not(.danger) > i { grid-column: 1; grid-row: 1; }
.draw-history-row .draw-tool:not(.danger) > span { grid-column: 2; grid-row: 1; }
.draw-history-row .draw-tool:not(.danger) > .draw-tool-key { grid-column: 1 / -1; grid-row: 2; justify-self: center; }
.draw-tool:hover:not(:disabled) { color: #fff; background: rgba(255, 255, 255, .09); border-color: rgba(255, 255, 255, .15); }
.draw-tool.danger:hover:not(:disabled) { color: #ff8080; background: rgba(255, 90, 90, .1); border-color: rgba(255, 90, 90, .28); }
.draw-tool:disabled { opacity: .34; cursor: default; }
.draw-animation-panel { margin-top: 14px; overflow: hidden; background: rgba(255, 255, 255, .032); border: 1px solid rgba(255, 255, 255, .08); border-radius: 13px; }
.draw-animation-panel.active { border-color: rgba(229, 160, 13, .26); background: rgba(229, 160, 13, .035); }
.draw-animation-head { display: flex; align-items: center; gap: 10px; min-height: 48px; padding: 8px 11px; box-sizing: border-box; }
.draw-animation-icon { display: inline-flex; flex: 0 0 auto; width: 19px; height: 19px; color: var(--accent); }
.draw-animation-icon svg { width: 100%; height: 100%; }
.draw-animation-copy { display: flex; min-width: 0; flex: 1; flex-direction: column; gap: 2px; }
.draw-animation-copy strong { color: #e7ebf1; font-size: 12px; }
.draw-animation-copy span { color: var(--muted); font-size: 10px; }
.draw-animation-toggle { display: grid; grid-template-columns: 1fr 19px; align-items: center; gap: 6px; width: 70px; min-height: 30px; padding: 4px 5px 4px 8px;
  color: #9ba6b4; background: rgba(255, 255, 255, .055); border: 1px solid rgba(255, 255, 255, .09); border-radius: 999px; cursor: pointer; font: inherit; font-size: 9.5px; font-weight: 750; transition: .15s ease; }
.draw-animation-toggle i { display: block; width: 17px; height: 17px; border-radius: 50%; background: #7d8794; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: .16s ease; }
.draw-animation-toggle.active { color: #201704; background: var(--accent); border-color: var(--accent); }
.draw-animation-toggle.active i { background: #fff; }
.draw-animation-body { padding: 11px; border-top: 1px solid rgba(255, 255, 255, .07); }
.draw-animation-body.hidden { display: none; }
.draw-frame-strip { display: flex; align-items: stretch; gap: 8px; overflow-x: auto; overscroll-behavior-x: contain; padding: 2px 2px 7px; scrollbar-width: thin; }
.draw-frame-list { display: flex; gap: 7px; }
.draw-frame-btn { position: relative; display: flex; align-items: center; justify-content: center; flex: 0 0 auto; width: 52px; height: 52px; padding: 4px;
  background: repeating-conic-gradient(#29303a 0% 25%, #222831 0% 50%) 50% / 12px 12px; border: 1px solid rgba(255, 255, 255, .11); border-radius: 10px; cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s; }
.draw-frame-btn:hover { transform: translateY(-1px); border-color: rgba(255, 255, 255, .24); }
.draw-frame-btn.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(229, 160, 13, .2); }
.draw-frame-btn canvas { display: block; width: 42px; height: 42px; }
.draw-frame-btn span { position: absolute; right: -4px; bottom: -5px; min-width: 15px; height: 15px; padding: 0 3px; box-sizing: border-box;
  color: #d6dde6; background: #11161d; border: 1px solid rgba(255, 255, 255, .15); border-radius: 8px; font-size: 8px; font-weight: 800; line-height: 13px; text-align: center; }
.draw-frame-btn.active span { color: #211805; background: var(--accent); border-color: #f2bd4a; }
.draw-frame-add { display: flex; align-items: center; justify-content: center; flex: 0 0 auto; flex-direction: column; gap: 2px; width: 72px; height: 52px; padding: 4px;
  color: #aeb8c4; background: rgba(255, 255, 255, .04); border: 1px dashed rgba(255, 255, 255, .18); border-radius: 10px; cursor: pointer; font: inherit; font-size: 10px; font-weight: 700; }
.draw-frame-add i { display: inline-flex; width: 16px; height: 16px; }
.draw-frame-add svg { width: 100%; height: 100%; }
.draw-frame-add:hover:not(:disabled) { color: var(--accent); border-color: rgba(229, 160, 13, .5); background: rgba(229, 160, 13, .07); }
.draw-frame-add:disabled { opacity: .28; cursor: default; }
.draw-animation-controls { display: grid; grid-template-columns: auto minmax(72px, 1fr) 42px; align-items: center; gap: 9px; margin-top: 5px; }
.draw-animation-controls label { color: #9da8b5; font-size: 10px; font-weight: 700; }
#draw-frame-speed { -webkit-appearance: none; appearance: none; min-width: 72px; height: 18px; margin: 0; background: transparent; cursor: pointer; --fill: 24%; }
#draw-frame-speed::-webkit-slider-runnable-track { height: 4px; border-radius: 999px; background: linear-gradient(to right, var(--accent) var(--fill), rgba(255, 255, 255, .13) var(--fill)); }
#draw-frame-speed::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 14px; height: 14px; margin-top: -5px; border: 3px solid #151a22; border-radius: 50%; background: var(--accent); }
#draw-frame-speed::-moz-range-track { height: 4px; border-radius: 999px; background: rgba(255, 255, 255, .13); }
#draw-frame-speed::-moz-range-progress { height: 4px; border-radius: 999px; background: var(--accent); }
#draw-frame-speed::-moz-range-thumb { width: 11px; height: 11px; border: 2px solid #151a22; border-radius: 50%; background: var(--accent); }
#draw-frame-speed-value { color: var(--accent); font-size: 10.5px; font-weight: 800; text-align: right; }
.draw-onion-row { display: flex; align-items: center; justify-content: space-between; gap: 9px; margin-top: 7px; }
.draw-onion-toggle { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 34px; padding: 6px 9px;
  color: #bac3ce; background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .09); border-radius: 8px; cursor: pointer; font: inherit; font-size: 10.5px; font-weight: 700; }
.draw-onion-toggle:hover:not(:disabled) { color: #fff; background: rgba(255, 255, 255, .09); }
.draw-onion-toggle.active { color: #201704; background: var(--accent); border-color: var(--accent); }
.draw-onion-toggle:disabled { opacity: .3; cursor: default; }
.draw-onion-symbol { position: relative; display: inline-block; width: 19px; height: 14px; }
.draw-onion-symbol i { position: absolute; top: 1px; width: 12px; height: 12px; border: 1px solid currentColor; border-radius: 4px; }
.draw-onion-symbol i:first-child { left: 0; color: #67b7ff; }
.draw-onion-symbol i:last-child { right: 0; color: #ff73b3; }
.draw-onion-toggle.active .draw-onion-symbol i { color: #201704; }
.draw-onion-legend { display: inline-flex; align-items: center; gap: 4px; color: #a1acb9; font-size: 10px; white-space: nowrap; }
.draw-onion-legend i { width: 6px; height: 6px; border-radius: 50%; background: #67b7ff; }
.draw-onion-legend i:last-of-type { margin-left: 3px; background: #ff73b3; }
.draw-frame-actions { display: flex; align-items: center; justify-content: flex-end; gap: 6px; margin-top: 8px; }
.draw-frame-action { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 34px; padding: 6px 9px; color: #bac3ce;
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .09); border-radius: 8px; cursor: pointer; font: inherit; font-size: 10.5px; font-weight: 700; }
.draw-frame-action:hover:not(:disabled) { color: #fff; background: rgba(255, 255, 255, .09); }
.draw-frame-action:disabled { opacity: .3; cursor: default; }
.draw-frame-delete { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 34px; padding: 8px; color: #b3bdc9;
  background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .09); border-radius: 8px; cursor: pointer; }
.draw-frame-delete svg { width: 100%; height: 100%; }
.draw-frame-delete:hover:not(:disabled) { color: #ff8080; background: rgba(255, 90, 90, .1); border-color: rgba(255, 90, 90, .25); }
.draw-frame-delete:disabled { opacity: .3; cursor: default; }
.draw-discard { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; padding: 10px 11px 10px 13px;
  color: #ffd4d4; background: rgba(255, 90, 90, .09); border: 1px solid rgba(255, 90, 90, .22); border-radius: 11px; font-size: 12px; font-weight: 650; animation: drawPromptIn .18s ease-out; }
.draw-discard.hidden { display: none; }
.draw-discard > div { display: flex; gap: 6px; }
.draw-discard-btn { padding: 6px 9px; color: #e8edf4; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .11); border-radius: 7px; cursor: pointer; font: inherit; font-size: 10.5px; font-weight: 700; }
.draw-discard-btn.danger { color: #fff; background: #bc414b; border-color: #d4545e; }
@keyframes drawPromptIn { from { opacity: 0; transform: translateY(-4px); } }
.draw-actions { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-top: 16px; padding-top: 15px; border-top: 1px solid rgba(255, 255, 255, .075); }
.draw-status { min-width: 0; color: var(--muted); font-size: 11px; line-height: 1.35; }
.draw-status.ready { color: #75d99a; }
.draw-status.sampling { color: var(--accent); }
.draw-status.saving { color: #f1c45d; }
.draw-status.error { color: #ff8f96; }
.draw-action-buttons { display: flex; flex: 0 0 auto; gap: 8px; }
.draw-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 39px; padding: 8px 15px; border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .055); color: #e6e9ee; cursor: pointer; font: inherit; font-size: 12px; font-weight: 750; transition: .15s ease; }
.draw-btn i { display: inline-flex; width: 15px; height: 15px; }
.draw-btn svg { width: 100%; height: 100%; }
.draw-btn:hover:not(:disabled) { background: rgba(255, 255, 255, .1); }
.draw-btn.primary { min-width: 116px; background: var(--accent); color: #1a1405; border-color: var(--accent); box-shadow: 0 7px 20px rgba(229, 160, 13, .15); }
.draw-btn.primary:hover:not(:disabled) { filter: brightness(1.07); background: var(--accent); }
.draw-btn:disabled { opacity: .38; cursor: default; box-shadow: none; }
.draw-btn.primary:disabled { opacity: 1; color: #747f8c; background: rgba(255, 255, 255, .035); border-color: rgba(255, 255, 255, .075); box-shadow: none; }
.draw-close:focus-visible, .draw-mode-btn:focus-visible, .draw-pen-tool-toggle:focus-visible, .draw-sw:focus-visible, .draw-tool:focus-visible, .draw-btn:focus-visible, .draw-discard-btn:focus-visible,
.draw-animation-toggle:focus-visible, .draw-frame-btn:focus-visible, .draw-frame-add:focus-visible, .draw-frame-action:focus-visible, .draw-frame-delete:focus-visible, .draw-preview-toggle:focus-visible,
.draw-onion-toggle:focus-visible, .draw-stroke-settings summary:focus-visible, .draw-stroke-reset:focus-visible,
#draw-size:focus-visible, #draw-smoothing:focus-visible, #draw-pressure:focus-visible, #draw-tilt:focus-visible, #draw-frame-speed:focus-visible, #draw-color:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (max-width: 620px) {
  .draw-modal { align-items: flex-end; padding: 0; }
  .draw-card { width: 100%; max-height: 96dvh; border-radius: 21px 21px 0 0; padding: 18px 16px max(16px, env(safe-area-inset-bottom)); scroll-padding-block-end: calc(118px + env(safe-area-inset-bottom)); }
  .draw-head { margin-bottom: 14px; }
  .draw-title-row h2 { font-size: 19px; }
  .draw-heading p { font-size: 11.5px; }
  .draw-workspace { grid-template-columns: 1fr; gap: 14px; }
  .draw-stage { width: min(100%, 310px); }
  .draw-preview-row { width: min(100%, 310px); margin-left: auto; margin-right: auto; }
  .draw-controls { width: min(100%, 360px); margin: 0 auto; }
  .draw-close { width: 44px; height: 44px; }
  .draw-mode-btn { min-height: 44px; }
  .draw-color-row { display: grid; grid-template-columns: minmax(0, 1fr); }
  .draw-swatches { width: 100%; grid-template-columns: repeat(6, 44px); justify-content: space-between; gap: 1px; }
  .draw-sw { width: 44px; height: 44px; }
  .draw-sw::before { inset: 7px; }
  .draw-sw.custom::after { right: 6px; bottom: 6px; }
  .draw-custom-color { width: 100%; height: 44px; box-sizing: border-box; }
  .draw-history-row { grid-template-columns: 1fr 1fr 44px; }
  .draw-tool { min-height: 44px; }
  .draw-animation-toggle { min-height: 44px; }
  .draw-frame-action, .draw-frame-delete, .draw-onion-toggle { min-height: 44px; }
  .draw-frame-delete { width: 44px; height: 44px; }
  .draw-preview-toggle { width: 44px; height: 44px; }
  .draw-discard-btn { min-height: 44px; }
  #draw-size, #draw-smoothing, #draw-pressure, #draw-tilt, #draw-frame-speed { height: 44px; }
  .draw-stroke-settings summary { min-height: 44px; }
  .draw-stroke-reset { min-height: 44px; }
  .draw-btn { min-height: 44px; }
  .draw-actions { position: sticky; bottom: calc(-1 * max(16px, env(safe-area-inset-bottom))); z-index: 2; margin: 14px -16px 0; padding: 13px 16px max(16px, env(safe-area-inset-bottom));
    background: linear-gradient(to bottom, rgba(16, 20, 27, .9), #10141b 24%); box-shadow: 0 -10px 24px rgba(7, 9, 13, .28); }
  .draw-status { max-width: 135px; }
}

@media (max-width: 380px) {
  .draw-card { padding-left: 13px; padding-right: 13px; }
  .draw-heading p { display: none; }
  .draw-stage { width: min(100%, 282px); }
  .draw-preview-row { width: min(100%, 282px); }
  .draw-swatches { gap: 1px; }
  .draw-tool { gap: 3px; padding-left: 5px; padding-right: 5px; }
  .draw-tool-key { padding-left: 2px; padding-right: 2px; font-size: 9px; }
  .draw-size-meta { align-items: flex-start; flex-direction: column; gap: 5px; }
  .draw-input-hint { max-width: none; text-align: left; }
  .draw-onion-row { align-items: stretch; flex-direction: column; gap: 5px; }
  .draw-onion-toggle { width: 100%; }
  .draw-onion-legend { justify-content: center; }
  .draw-discard { align-items: flex-start; flex-direction: column; }
  .draw-actions { margin-left: -13px; margin-right: -13px; padding-left: 13px; padding-right: 13px; }
  .draw-actions { align-items: stretch; flex-direction: column; gap: 9px; }
  .draw-status { display: block; max-width: none; text-align: center; }
  .draw-action-buttons { width: 100%; }
  .draw-btn { flex: 1; }
}

@media (max-width: 300px) {
  .draw-card { padding-left: 10px; padding-right: 10px; }
  .draw-head { gap: 8px; }
  .draw-title-row { gap: 6px; }
  .draw-title-row h2 { font-size: 18px; }
  .draw-section { padding-left: 10px; padding-right: 10px; }
  .draw-swatches { grid-template-columns: repeat(5, 44px); }
  .draw-animation-controls { grid-template-columns: minmax(0, 1fr) 46px; gap: 5px; }
  .draw-animation-controls label { grid-column: 1 / -1; }
  .draw-frame-actions { justify-content: stretch; }
  .draw-frame-action { flex: 1; padding-left: 4px; padding-right: 4px; }
  .draw-actions { margin-left: -10px; margin-right: -10px; padding-left: 10px; padding-right: 10px; }
}

/* Keep every assigned keyboard shortcut visible while the reaction panel is open. */
.reactions.open .react-row [data-key] { position: relative; }
.reactions.open .react-row [data-key]::before {
  content: attr(data-key); position: absolute; top: -5px; right: -4px;
  min-width: 14px; height: 14px; padding: 0 2px; box-sizing: border-box;
  background: #0b0d12; color: #fff; border: 1px solid var(--line); border-radius: 7px;
  font-size: 9px; font-weight: 700; line-height: 12px; text-align: center; pointer-events: none;
  opacity: 1; transform: scale(1);
}
.react-row .key-hit { animation: keyHit .25s ease; }
@keyframes keyHit { 0% { transform: scale(1); } 45% { transform: scale(1.5); } 100% { transform: scale(1); } }

.muted { color: var(--muted); }

/* Toast (resume notice, etc.) */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%) translateY(12px);
  background: rgba(11, 13, 18, .95); border: 1px solid var(--line); color: var(--text);
  padding: 9px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .5); z-index: 3000;
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Scrollbar */
.lib-scroll::-webkit-scrollbar { width: 9px; }
.lib-scroll::-webkit-scrollbar-thumb { background: #2a2f3a; border-radius: 9px; }
.lib-scroll::-webkit-scrollbar-thumb:hover { background: #363c49; }

@media (max-width: 760px) {
  main { grid-template-columns: 1fr; }
  #library { max-height: 42vh; }
}

/* Sound settings popover — personal per-viewer audio (boost / night mode / voice clarity). */
.c-btn.active { color: var(--accent); }
.sound-menu { position: absolute; right: 10px; bottom: 62px; z-index: 40; width: 230px; padding: 12px 14px; background: rgba(18,20,26,.97); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 12px 38px rgba(0,0,0,.55); font-size: 13px; color: #e8e8ea; backdrop-filter: blur(6px); }
.sound-menu.hidden { display: none; }
.sound-menu .ico { display: inline-flex; }
.sound-menu .ico svg { width: 100%; height: 100%; display: block; }
.sound-menu .sm-title { display: flex; align-items: center; gap: 6px; font-weight: 700; margin-bottom: 10px; }
.sound-menu .sm-title .ico { width: 16px; height: 16px; color: var(--accent); }
.sound-menu .sm-hint { margin-left: auto; font-weight: 400; opacity: .45; font-size: 11px; }
.sound-menu .sm-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 11px 0; }
.sound-menu .sm-label { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.sound-menu .sm-label .ico { width: 15px; height: 15px; opacity: .8; }
label.sm-tog { cursor: pointer; }
.sound-menu .sm-boost-row { margin: 11px 0 13px; }
.sound-menu .sm-boost-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.sound-menu .sm-boost-val { font-weight: 700; color: var(--accent); font-size: 12px; }
.sound-menu .sm-range { -webkit-appearance: none; appearance: none; width: 100%; height: 16px; margin: 0; background: transparent; outline: none; cursor: pointer; --fill: 0%; }
/* WebKit: explicit 5px track + thumb margin-top (5-15)/2 = -5px → thumb centred on the track */
.sound-menu .sm-range::-webkit-slider-runnable-track { height: 5px; border-radius: 999px; background: linear-gradient(to right, var(--accent) var(--fill), rgba(255,255,255,.18) var(--fill)); }
.sound-menu .sm-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; margin-top: -5px; width: 15px; height: 15px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); cursor: pointer; }
/* Firefox: native track + progress fill */
.sound-menu .sm-range::-moz-range-track { height: 5px; border-radius: 999px; background: rgba(255,255,255,.18); }
.sound-menu .sm-range::-moz-range-progress { height: 5px; border-radius: 999px; background: var(--accent); }
.sound-menu .sm-range::-moz-range-thumb { width: 15px; height: 15px; border: 0; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.5); cursor: pointer; }

/* Danmaku — chat comments fly across the video (personal toggle). */
.chat-head .danmaku-btn { margin-left: auto; display: inline-flex; align-items: center; }
.chat-head .danmaku-btn .ico svg { width: 16px; height: 16px; }
.chat-head .danmaku-btn.active { color: var(--accent); }
.chat-head #chat-close { margin-left: 8px; }
.danmaku-layer { position: absolute; inset: 0; overflow: hidden; pointer-events: none; z-index: 6; }
.danmaku-item { position: absolute; left: 100%; white-space: nowrap; font-weight: 600; font-size: 15px; line-height: 1; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 0 3px rgba(0,0,0,.9); will-change: transform; }
.danmaku-item .dm-name { color: var(--accent); margin-right: 5px; }

/* Post-movie LIKE prompt — reuses the skip-credits pill (.skip-btn) for identical look/motion. */
.like-btn:not(.liked) .skip-ico { color: #ff5c72; }                 /* red heart while un-liked */
.like-btn.liked, .like-btn.liked:hover { background: var(--accent); color: #10141b; border-color: var(--accent); }

/* "Because you liked X" reason line on recommended library rows. */
.li-reason { font-size: 11px; color: var(--accent); opacity: .92; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Franchise section headers in the Collections view. */
#items li.col-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 12px 5px; margin: 0; background: transparent; border: 0; cursor: default; }
#items li.col-head:hover { background: transparent; }
.col-head .col-name { font-weight: 700; font-size: 12px; letter-spacing: .02em; text-transform: uppercase; color: var(--accent); }
.col-head .col-n { font-weight: 600; font-size: 11px; color: var(--muted); background: rgba(255,255,255,.08); border-radius: 999px; padding: 1px 8px; }
/* iOS-style toggle switch */
.sm-sw { position: relative; display: inline-block; width: 36px; height: 21px; flex-shrink: 0; }
.sm-sw input { position: absolute; opacity: 0; width: 0; height: 0; }
.sm-sw i { position: absolute; inset: 0; background: rgba(255,255,255,.18); border-radius: 999px; transition: background .15s; }
.sm-sw i::before { content: ""; position: absolute; width: 17px; height: 17px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.4); }
.sm-sw input:checked + i { background: var(--accent); }
.sm-sw input:checked + i::before { transform: translateX(15px); }

/* "Who's this actor?" — cast strip revealed while paused */
.cast-panel {
  position: absolute; left: 0; right: 0; bottom: 58px; z-index: 7;
  padding: 12px 16px 14px;
  background: linear-gradient(to top, rgba(9, 11, 16, .92), rgba(9, 11, 16, .55) 62%, transparent);
  opacity: 0; transform: translateY(14px); pointer-events: none;
  transition: opacity .28s ease, transform .28s ease;
}
.cast-panel.show { opacity: 1; transform: none; pointer-events: auto; }
.cast-head { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 0 2px 9px; }
.cast-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; scroll-snap-type: x proximity; }
.cast-row::-webkit-scrollbar { height: 6px; }
.cast-row::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .18); border-radius: 3px; }
.cast-card { flex: 0 0 auto; width: 82px; scroll-snap-align: start; text-align: center; }
.cast-card img,
.cast-card.noimg::before {
  width: 82px; height: 82px; border-radius: 11px; display: block;
  box-shadow: 0 3px 10px rgba(0, 0, 0, .4);
}
.cast-card img { object-fit: cover; background: #1b2333; }
.cast-card.noimg::before {
  content: attr(data-i); display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #2a3346, #1a2130); color: #8ea3c2; font-size: 30px; font-weight: 700;
}
.cast-name { margin-top: 6px; font-size: 12px; font-weight: 600; color: var(--text); line-height: 1.2;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cast-role { font-size: 11px; color: var(--muted); line-height: 1.2; margin-top: 1px;
  overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.cast-skel { flex: 0 0 auto; width: 82px; height: 82px; border-radius: 11px;
  background: linear-gradient(90deg, #1b2333, #263149, #1b2333); background-size: 200% 100%;
  animation: castShimmer 1.1s linear infinite; }
@keyframes castShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* "Who's on screen now" — face boxes + actor chips over the paused frame */
.face-layer { position: absolute; inset: 0; z-index: 6; pointer-events: none; }
.face-box {
  position: absolute; border: 2px solid rgba(120, 200, 255, .92); border-radius: 10px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .35), 0 0 18px rgba(80, 170, 255, .35);
  animation: faceIn .3s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes faceIn { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.face-chip {
  position: absolute; left: -2px; top: calc(100% + 8px); display: flex; align-items: center; gap: 8px;
  max-width: 240px; padding: 5px 12px 5px 5px; border-radius: 999px;
  background: rgba(12, 15, 22, .84); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 6px 20px rgba(0, 0, 0, .45);
  white-space: nowrap; animation: chipIn .32s .04s cubic-bezier(.2, .8, .2, 1) both;
}
.face-chip.above { top: auto; bottom: calc(100% + 8px); }
@keyframes chipIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.fc-av { flex: 0 0 auto; width: 30px; height: 30px; border-radius: 50%; overflow: hidden; background: #223; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .15); }
.fc-av img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fc-tx { display: flex; flex-direction: column; line-height: 1.15; overflow: hidden; }
.fc-tx b { font-size: 13px; font-weight: 700; color: #eaf2ff; overflow: hidden; text-overflow: ellipsis; }
.fc-tx i { font-size: 11px; font-style: normal; color: #9fb3cc; overflow: hidden; text-overflow: ellipsis; }
/* in-frame highlight on the "В ролях" strip */
.cast-card.in-frame img, .cast-card.in-frame.noimg::before { box-shadow: 0 0 0 2px var(--accent), 0 3px 12px rgba(0, 0, 0, .5); }
.cast-live { display: block; margin-top: 3px; font-size: 10px; font-weight: 700; letter-spacing: .03em; color: #7fd1ff; }

/* Full cast inside the movie card (details modal) */
.details-cast { margin-top: 15px; }
.dc-head { font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin: 0 0 10px; }
.dc-row { display: flex; gap: 14px; overflow-x: auto; padding: 2px 2px 4px; scrollbar-width: none; -ms-overflow-style: none;
  -webkit-mask-image: linear-gradient(90deg, #000 0, #000 95%, transparent 100%); mask-image: linear-gradient(90deg, #000 0, #000 95%, transparent 100%); }
.dc-row::-webkit-scrollbar { display: none; }
.dc-card { flex: 0 0 auto; width: 88px; text-align: center; }
.dc-pic { width: 88px; height: 88px; border-radius: 14px; box-shadow: 0 5px 14px rgba(0, 0, 0, .5); }
.dc-pic > img { object-position: center 22%; }
.dc-pic.noimg { display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #2a3346, #1a2130); }
.dc-pic.noimg::before { content: attr(data-i); color: #8ea3c2; font-size: 30px; font-weight: 700; position: relative; z-index: 1; }
.dc-name { margin-top: 9px; font-size: 12.5px; font-weight: 600; color: var(--text); line-height: 1.25; min-height: 2.5em;
  overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.dc-role { font-size: 11px; color: var(--muted); line-height: 1.25; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dc-skel { flex: 0 0 auto; width: 88px; height: 88px; border-radius: 14px;
  background: linear-gradient(90deg, #1b2333, #263149, #1b2333); background-size: 200% 100%; animation: castShimmer 1.1s linear infinite; }

/* "Заказать фильм" — request button + modal */
.request-btn { width: 100%; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .05); color: var(--text); cursor: pointer; font-weight: 600; font-size: 13px; }
.request-btn:hover { background: var(--accent); color: #10141b; border-color: var(--accent); }
.req-qcount { display: none; }
.req-qcount:not(:empty) { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 7px; border-radius: 9px; background: var(--accent); color: #10141b; font-size: 11px; font-weight: 700; line-height: 1; vertical-align: middle; }
.request-btn:hover .req-qcount:not(:empty) { background: #10141b; color: var(--accent); }
.lib-actions .request-btn { grid-column: auto; min-width: 0; }
.playlist-btn { border-color: rgba(229, 160, 13, .28); }
.playlist-btn .ico { color: var(--accent); }
.playlist-btn:hover .ico { color: #10141b; }
.request-card { max-width: 560px; width: 92%; display: block; }
.req-title { margin: 0 0 4px; }
.req-sub { color: var(--muted); font-size: 13px; margin: 0 0 12px; line-height: 1.4; }
.req-searchbar input { width: 100%; box-sizing: border-box; padding: 11px 14px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .05); color: var(--text); font-size: 15px; }
.req-searchbar input:focus { outline: none; border-color: var(--accent); }

/* Keyboard focus visibility (a11y) — a clear ring only on keyboard nav (:focus-visible), never on mouse.
   Placed last so it wins over earlier `select:focus{outline:none}` for keyboard focus. */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible, [tabindex]:focus-visible,
.c-btn:focus-visible, .sub-sync button:focus-visible, .react-trigger:focus-visible, .draw-tool:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 8px;
}
.req-suggest { margin-top: 8px; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.req-s-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 7px 10px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255, 255, 255, .04); color: var(--text); cursor: pointer; font-size: 14px; }
.req-s-item:hover:not(:disabled) { background: rgba(255, 255, 255, .09); }
.req-s-item:disabled { opacity: .5; cursor: default; }
.req-s-item img { width: 34px; height: 50px; object-fit: cover; border-radius: 5px; background: #1b2333; flex-shrink: 0; }
.req-s-noimg, .req-i-noimg { display: inline-flex; align-items: center; justify-content: center; background: #1b2333; border-radius: 5px; flex-shrink: 0; }
.req-s-noimg { width: 34px; height: 50px; font-size: 18px; }
.req-s-tx { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-s-y, .req-i-y { color: var(--muted); font-weight: 400; }
.req-s-have { font-size: 11px; color: #7fd1ff; white-space: nowrap; }
.req-s-free { justify-content: center; color: var(--accent); font-weight: 600; }
.req-s-load, .req-l-load, .req-empty { color: var(--muted); font-size: 13px; padding: 8px 4px; }
.req-listhead { margin: 16px 0 8px; font-size: 11px; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.req-list { display: flex; flex-direction: column; gap: 8px; max-height: 300px; overflow-y: auto; }
.req-item { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; background: rgba(255, 255, 255, .04); border: 1px solid var(--line); }
.req-item.done { opacity: .58; }
.req-i-poster img { width: 38px; height: 56px; border-radius: 6px; object-fit: cover; background: #1b2333; display: block; flex-shrink: 0; }
.req-i-noimg { width: 38px; height: 56px; font-size: 18px; }
.req-i-tx { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.req-i-tx b { font-weight: 600; }
.req-i-by { font-size: 12px; color: var(--muted); }
.req-i-status { align-self: flex-start; margin-top: 4px; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 8px; white-space: nowrap; }
.req-s-pending { background: rgba(229, 160, 13, .16); color: var(--accent); }
.req-s-searching { background: rgba(139, 92, 246, .18); color: #c4b5fd; }
.req-s-queued { background: rgba(148, 163, 184, .18); color: #cbd5e1; }
.req-s-downloading { background: rgba(96, 165, 250, .18); color: #7fb0ff; }
.req-s-importing { background: rgba(167, 139, 250, .2); color: #c4b5fd; }
.req-s-converting { background: rgba(45, 212, 191, .18); color: #5eead4; }
.req-s-error { background: rgba(239, 68, 68, .18); color: #fca5a5; white-space: normal; line-height: 1.35; }
.req-s-ready { background: rgba(52, 199, 89, .16); color: #4ade80; }
.req-prog { align-self: stretch; margin-top: 5px; height: 4px; max-width: 200px; border-radius: 3px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.req-prog-bar { height: 100%; background: var(--accent); border-radius: 3px; transition: width .6s ease; }
.req-item.req-ready { cursor: pointer; }
.req-item.req-ready:hover { border-color: rgba(52, 199, 89, .5); background: rgba(52, 199, 89, .08); }
.req-i-actions { display: flex; align-items: center; gap: 6px; }
.req-i-add, .req-i-del { border: 1px solid var(--line); background: rgba(255, 255, 255, .06); color: var(--text); border-radius: 8px; padding: 5px 9px; cursor: pointer; font-size: 13px; }
.req-i-add:hover { background: rgba(90, 200, 120, .25); }
.req-i-del:hover { background: rgba(230, 80, 80, .25); }
.req-i-badge { font-size: 12px; color: #6ad07a; font-weight: 600; white-space: nowrap; }

/* ===== visual polish: swapped-in icons + shared animations ===== */
.details-close { display: inline-flex; align-items: center; justify-content: center; }
.details-close svg, .queue-clear svg,
.vote-x svg, .chat-close svg, .sc-close svg, .stats-close svg, .trailer-close svg, .draw-close svg { width: 16px; height: 16px; }
.request-btn { display: flex; grid-column: 1 / -1; align-items: center; justify-content: center; gap: 7px; }
.request-btn .ico svg { width: 16px; height: 16px; }
.req-title { display: flex; align-items: center; gap: 8px; }
.req-title .ico svg { width: 20px; height: 20px; color: var(--accent); }
.req-s-noimg svg { width: 18px; height: 18px; opacity: .55; }
.req-i-noimg svg { width: 20px; height: 20px; opacity: .5; }
.req-i-del { display: inline-flex; align-items: center; justify-content: center; }
.req-i-del svg { width: 15px; height: 15px; }

/* modal enter */
.details-modal:not(.hidden) { animation: dpwFade .18s ease both; }
.details-modal:not(.hidden) > .details-card { animation: dpwPop .3s cubic-bezier(.2, .85, .25, 1) both; }
@keyframes dpwFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dpwPop { from { opacity: 0; transform: translateY(16px) scale(.975); } to { opacity: 1; transform: none; } }

/* list items rise in */
.dc-card, .req-item, .req-s-item { animation: dpwRise .3s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes dpwRise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* --- Extended entrance animations + micro-interactions (batch 3) --- */
/* All the other modals get the same fade + pop as .details-modal */
.vote-modal:not(.hidden), .trailer-modal:not(.hidden), .sc-modal:not(.hidden),
.stats-modal:not(.hidden), .draw-modal:not(.hidden) { animation: dpwFade .18s ease both; }
.vote-modal:not(.hidden) > .vote-card,
.trailer-modal:not(.hidden) > .trailer-card,
.sc-modal:not(.hidden) > .sc-card,
.stats-modal:not(.hidden) > .stats-card,
.draw-modal:not(.hidden) > .draw-card { animation: dpwPop .28s cubic-bezier(.2, .85, .25, 1) both; }
/* Chat + queue panels slide/appear */
.chat-panel:not(.hidden) { animation: dpwSlideR .22s cubic-bezier(.2, .85, .25, 1) both; }
@keyframes dpwSlideR { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.queue-panel:not(.hidden) { animation: dpwRise .2s ease both; }
/* Library rows: subtle hover lift (keeps the existing background hover) */
#items li { transition: background .12s ease, transform .14s ease; }
/* row hover-lift removed — no upward position shift on hover */
/* Now-playing badge: gentle pulse */
#items li.active .t::after { animation: dpwBadge 2.4s ease-in-out infinite; }
@keyframes dpwBadge { 0%, 100% { opacity: 1; } 50% { opacity: .5; } }
/* Micro-interactions for the buttons the earlier block missed */
.host-btn, .chat-btn, .stats-btn, .sc-btn, .queue-vote, .queue-next,
.sub-sync button, .draw-tool, .react-trigger, .danmaku-btn {
  transition: transform .12s ease, background .16s ease, color .16s ease, border-color .16s ease;
}
.host-btn:active, .chat-btn:active, .stats-btn:active, .sc-btn:active, .queue-vote:active,
.queue-next:active, .sub-sync button:active, .draw-tool:active, .react-trigger:active { transform: scale(.94); }
/* header/sub-sync hover-lift removed — no upward position shift */
/* Draw-tool glyphs are now SVG icons */
.draw-tool { display: inline-flex; align-items: center; justify-content: center; }
.draw-tool svg { width: 16px; height: 16px; display: block; }
/* Honour reduced-motion for every entrance/hover motion added above */
@media (prefers-reduced-motion: reduce) {
  .details-modal:not(.hidden), .details-modal:not(.hidden) > .details-card,
  .vote-modal:not(.hidden), .trailer-modal:not(.hidden), .sc-modal:not(.hidden),
  .stats-modal:not(.hidden), .draw-modal:not(.hidden),
  .vote-modal:not(.hidden) > .vote-card, .trailer-modal:not(.hidden) > .trailer-card,
  .sc-modal:not(.hidden) > .sc-card, .stats-modal:not(.hidden) > .stats-card, .draw-modal:not(.hidden) > .draw-card,
  .chat-panel:not(.hidden), .queue-panel:not(.hidden), .dc-card, .req-item, .req-s-item,
  .idle-icon, #items li.active .t::after { animation: none !important; }
  #items li:hover, .c-btn:hover, .chat-btn:hover, .stats-btn:hover, .sc-btn:hover,
  .sub-sync button:hover, .request-btn:hover, #surprise:hover, #reload:hover { transform: none !important; }
}

/* === Track panel moved INTO the player as a top overlay (reveals on hover, like the bottom bar) === */
.track-controls {
  position: absolute; top: 0; left: 0; right: 0; z-index: 30;
  background: linear-gradient(180deg, rgba(6, 8, 11, .92), rgba(6, 8, 11, 0));
  border: none; border-radius: 0; padding: 12px 16px 30px;
  align-items: center; gap: 10px; flex-wrap: nowrap;
  opacity: 0; transition: opacity .2s ease; pointer-events: none;
}
.video-wrap:hover .track-controls:not(.hidden), .track-controls.show { opacity: 1; pointer-events: auto; }
.track-controls label { flex: 1 1 auto; min-width: 0; color: #e2e6ec; white-space: nowrap; }
.track-controls select { flex: 1 1 84px; min-width: 64px; background-color: rgba(13, 15, 19, .92); }
.track-controls .sub-sync { flex: 0 0 auto; }

/* Generated icons for the previously text/emoji-only controls */
.host-btn { display: inline-flex; align-items: center; gap: 6px; }
.host-btn svg { width: 14px; height: 14px; }
.sc-btn { display: inline-flex; align-items: center; justify-content: center; }
.sc-btn svg { width: 16px; height: 16px; }
.draw-emoji-btn { display: inline-flex; align-items: center; justify-content: center; }
.draw-emoji-btn svg { width: 16px; height: 16px; }

/* button micro-interactions */
.request-btn, .req-s-item, .req-i-del, .details-play, .details-queue, .details-later, .details-trailer,
.details-like, .details-shuffle, .c-btn, .details-close, .queue-clear, #surprise, #reload {
  transition: transform .12s ease, background .16s ease, color .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.request-btn:active, .req-s-item:active, .details-play:active, .c-btn:active, .req-i-del:active,
.details-close:active, .queue-clear:active, #surprise:active, #reload:active { transform: scale(.96); }
.details-close:hover, .queue-clear:hover { color: var(--text); background: rgba(255, 255, 255, .09); }
.request-btn:hover { box-shadow: 0 6px 18px rgba(0, 0, 0, .3); }
.req-s-item:hover:not(:disabled) { transform: translateX(2px); }
.idle-icon svg { width: 58px; height: 58px; opacity: .5; }
.idle-icon { animation: dpwFloat 4s ease-in-out infinite; }
@keyframes dpwFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

/* poster loading: shimmer skeleton until the image paints, then a soft reveal */
/* poster skeleton: shimmer + spinner "loading" fallback; image fades in only once fully painted */
.poster-skel { position: relative; overflow: hidden;
  background-image: linear-gradient(100deg, #161c29 25%, #232f4a 50%, #161c29 75%); background-size: 200% 100%;
  animation: posterShimmer 1.4s ease-in-out infinite; }
.poster-skel::after { content: ''; position: absolute; top: 50%; left: 50%; width: 20px; height: 20px; margin: -10px;
  border-radius: 50%; border: 2.4px solid rgba(255, 255, 255, .13); border-top-color: rgba(255, 255, 255, .6);
  animation: posterSpin .75s linear infinite; }
.poster-skel > img { position: relative; z-index: 1; width: 100%; height: 100%; display: block; object-fit: cover; opacity: 0; transition: opacity .4s ease; }
.poster-skel > img.img-loaded { opacity: 1; }
.poster-skel.loaded, .poster-skel.failed, .poster-skel.noimg { animation: none; }
.poster-skel.loaded::after, .poster-skel.failed::after, .poster-skel.noimg::after { display: none; }
@keyframes posterShimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes posterSpin { to { transform: rotate(360deg); } }
/* poster slots */
.details-poster-wrap { width: 210px; flex-shrink: 0; align-self: flex-start; aspect-ratio: 2 / 3; border-radius: 12px; box-shadow: 0 8px 26px rgba(0, 0, 0, .5); }
.details-poster { border-radius: 12px; }
.li-poster { width: 42px; height: 63px; border-radius: 5px; flex-shrink: 0; }
.li-poster::after { width: 12px; height: 12px; margin: -6px; border-width: 2px; }
.req-i-poster img, .req-s-item img { background: #12161f; }

/* --- Clickable participant avatars → mini-profile --- */
.person { cursor: pointer; }
.person .av { transition: transform .12s ease, box-shadow .15s ease; }
.person:hover .av { transform: scale(1.06); }
.person:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- Mini-profile popup (avatar click) --- */
.profile-pop { position: fixed; inset: 0; z-index: 2400; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .7); backdrop-filter: blur(4px); padding: 20px; }
.profile-pop.hidden { display: none; }
.pp-card { position: relative; width: 100%; max-width: 460px; max-height: 82vh; overflow-y: auto; overflow-x: hidden; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: 0 24px 70px rgba(0, 0, 0, .55); }
.pp-close { position: absolute; right: 12px; top: 12px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .35); border: 1px solid var(--line); border-radius: 50%; color: var(--muted); cursor: pointer; }
.pp-close:hover { color: var(--text); }
.pp-close svg { width: 15px; height: 15px; }
.pp-head { display: flex; align-items: center; gap: 13px; margin-bottom: 4px; padding-right: 34px; }
.pp-av { position: relative; width: 56px; height: 56px; flex-shrink: 0; border-radius: 50%; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; background: var(--accent-2); color: #fff; font-weight: 700; font-size: 20px; }
.pp-av img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.pp-name { font-size: 18px; font-weight: 700; }
.pp-sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.pp-likes { display: inline-flex; align-items: center; gap: 5px; }
.pp-hi { display: inline-flex; }
.pp-hi svg { width: 14px; height: 14px; fill: #e0555f; stroke: #e0555f; }
.pp-transfer-host { display: inline-flex; align-items: center; justify-content: center; width: 100%; margin: 13px 0 3px; padding: 9px 12px; border: 1px solid rgba(240, 170, 55, .45); border-radius: 10px; background: rgba(240, 170, 55, .1); color: var(--accent); font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: background .15s ease, border-color .15s ease, transform .12s ease; }
.pp-transfer-host:hover { background: rgba(240, 170, 55, .17); border-color: var(--accent); }
.pp-transfer-host:active { transform: scale(.985); }
.pp-transfer-host:disabled { opacity: .55; cursor: wait; }
.pp-sec-t { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 15px 0 8px; }
.pp-genres { display: flex; flex-wrap: wrap; gap: 6px; }
.pp-genre { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; }
.pp-gi { display: inline-flex; color: var(--accent); }
.pp-gi svg { width: 13px; height: 13px; }
.pp-films { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 9px; }
.pp-film { position: relative; aspect-ratio: 2 / 3; border-radius: 9px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); }
.pp-film img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pp-film .pp-ft { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 6px; font-size: 11px; color: var(--muted); opacity: 0; }
.pp-film.noimg .pp-ft { opacity: 1; }
.pp-empty { color: var(--muted); padding: 8px 0 4px; }
.pp-playlists { display: flex; flex-wrap: wrap; gap: 7px; }
.pp-playlist { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 6px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--text); font: inherit; font-size: 12.5px; cursor: pointer; }
.pp-playlist:hover { border-color: var(--accent); color: var(--accent); }
.pp-playlist > span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pp-playlist-ico { display: inline-flex; flex-shrink: 0; color: var(--accent); }
.pp-playlist-ico svg { width: 14px; height: 14px; }
.pp-playlist i { color: var(--muted); font-style: normal; font-size: 11px; }

/* --- User playlists ------------------------------------------------------ */
.details-playlist { display: inline-flex; align-items: center; gap: 7px; background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-radius: 11px; padding: 11px 15px; font: inherit; font-weight: 600; cursor: pointer; }
.details-playlist:hover { border-color: var(--accent); color: var(--accent); }
.details-playlist svg { width: 16px; height: 16px; }
.playlist-card { display: block; width: min(760px, 94vw); max-width: 760px; max-height: 88vh; padding: 22px; }
.playlist-root { width: 100%; min-width: 0; }
.playlist-heading { margin: 0; padding-right: 38px; font-size: 22px; line-height: 1.25; }
.playlist-loading { padding: 38px 4px; text-align: center; color: var(--muted); }
.pl-head { display: flex; align-items: end; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.pl-limit { color: var(--muted); font-size: 12.5px; text-align: right; }
.pl-create { display: flex; gap: 8px; }
.pl-create input, .pl-edit input, .pl-edit textarea, .pl-add input { width: 100%; box-sizing: border-box; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.045); color: var(--text); font: inherit; }
.pl-create input, .pl-edit input, .pl-add input { min-height: 40px; padding: 9px 12px; }
.pl-edit textarea { resize: vertical; min-height: 62px; padding: 10px 12px; line-height: 1.45; }
.pl-create input:focus, .pl-edit input:focus, .pl-edit textarea:focus, .pl-add input:focus { outline: none; border-color: var(--accent); }
.pl-create input:disabled { opacity: .55; }
.pl-create button { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 15px; border: 0; border-radius: 10px; background: var(--accent); color: #171208; font: inherit; font-weight: 700; cursor: pointer; }
.pl-create button:disabled { opacity: .45; cursor: not-allowed; }
.pl-create button svg { width: 15px; height: 15px; }
.pl-msg { min-height: 18px; margin-top: 6px; font-size: 12.5px; color: var(--muted); }
.pl-msg.err { color: #ff7777; }
.pl-section-title { margin: 14px 0 8px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.pl-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.pl-card { min-width: 0; display: flex; align-items: center; gap: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.035); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .14s, background .14s, transform .12s; }
.pl-card:hover { border-color: rgba(229,160,13,.65); background: rgba(229,160,13,.07); transform: translateY(-1px); }
.pl-card.contains { border-color: rgba(60,190,105,.6); background: rgba(60,190,105,.07); }
.pl-card:disabled { opacity: .6; cursor: wait; }
.pl-cover { flex: 0 0 auto; width: 56px; height: 70px; display: grid; overflow: hidden; border-radius: 8px; background: #12161f; border: 1px solid rgba(255,255,255,.06); }
.pl-cover img { width: 100%; height: 100%; min-width: 0; min-height: 0; object-fit: cover; display: block; }
.pl-cover-2, .pl-cover-3, .pl-cover-4 { grid-template-columns: 1fr 1fr; }
.pl-cover-3, .pl-cover-4 { grid-template-rows: 1fr 1fr; }
.pl-cover-2 img { height: 100%; }
.pl-cover-3 img:first-child { grid-row: 1 / 3; }
.pl-cover-empty { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.pl-cover-empty svg { width: 25px; height: 25px; }
.pl-card-body { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 3px; }
.pl-card-body b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; }
.pl-card-body span, .pl-card-body small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 11.5px; }
.pl-card-body small { color: #aeb5c2; }
.pl-card-open { flex: 0 0 auto; color: var(--muted); font-size: 24px; line-height: 1; }
.pl-pick-state { flex: 0 0 auto; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 50%; color: var(--accent); }
.pl-pick-state.on { background: #35a760; border-color: #35a760; color: #fff; }
.pl-pick-state svg { width: 15px; height: 15px; }
.pl-empty { grid-column: 1 / -1; padding: 18px 8px; border: 1px dashed var(--line); border-radius: 10px; text-align: center; color: var(--muted); font-size: 13px; }
.pl-empty.compact { padding: 10px 6px; border: 0; }
.pl-detail-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-right: 38px; margin-bottom: 13px; }
.pl-back { display: inline-flex; align-items: center; gap: 5px; border: 0; background: transparent; color: var(--accent); padding: 3px 0; font: inherit; font-size: 13px; cursor: pointer; }
.pl-back:hover { color: #ffd277; }
.pl-owner { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-edit { display: flex; flex-direction: column; gap: 8px; }
.pl-edit input { font-size: 20px; font-weight: 800; }
.pl-edit-actions { display: flex; gap: 8px; }
.pl-save, .pl-delete, .pl-toolbar button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 13px; border-radius: 9px; font: inherit; font-weight: 700; cursor: pointer; }
.pl-save { border: 0; background: var(--accent); color: #171208; }
.pl-delete { border: 1px solid rgba(255,100,100,.32); background: rgba(255,90,90,.07); color: #ff8585; }
.pl-delete:hover { background: rgba(255,90,90,.15); }
.pl-delete svg, .pl-toolbar button svg { width: 15px; height: 15px; }
.pl-readonly-title h2 { margin: 0 0 7px; padding-right: 38px; font-size: 22px; }
.pl-readonly-title p { margin: 0 0 12px; color: var(--muted); font-size: 13.5px; line-height: 1.45; white-space: pre-wrap; }
.pl-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 10px; padding: 9px 0; border-top: 1px solid rgba(255,255,255,.055); border-bottom: 1px solid rgba(255,255,255,.055); color: var(--muted); font-size: 12.5px; }
.pl-toolbar button { border: 1px solid var(--line); background: rgba(255,255,255,.045); color: var(--text); font-size: 12.5px; }
.pl-toolbar button:hover { border-color: var(--accent); color: var(--accent); }
.pl-add { margin-top: 8px; }
.pl-film-results { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; max-height: 205px; overflow-y: auto; }
.pl-film-result { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.035); color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; }
.pl-film-result:hover { border-color: var(--accent); background: rgba(229,160,13,.07); }
.pl-film-result:disabled { opacity: .5; }
.pl-film-result span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-film-result i { color: var(--muted); font-style: normal; }
.pl-film-result svg { width: 14px; height: 14px; flex-shrink: 0; }
.pl-films { display: flex; flex-direction: column; gap: 6px; }
.pl-film { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 6px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.025); }
.pl-film-main { min-width: 0; flex: 1; display: flex; align-items: center; gap: 10px; border: 0; background: transparent; color: var(--text); padding: 0; font: inherit; text-align: left; cursor: pointer; }
.pl-film-main:hover .pl-film-meta b { color: var(--accent); }
.pl-film-poster { flex: 0 0 auto; width: 34px; height: 50px; border-radius: 5px; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; background: #12161f; color: var(--muted); }
.pl-film-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pl-film-poster svg { width: 18px; height: 18px; }
.pl-film-meta { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.pl-film-meta b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; transition: color .12s; }
.pl-film-meta span { color: var(--muted); font-size: 12px; }
.pl-film-meta .pl-film-status { color: var(--accent); font-size: 11px; font-weight: 700; }
.pl-film-meta .pl-film-status.watched { color: var(--ok); }
.pl-film-progress { display: block; width: min(170px, 42vw); height: 3px; overflow: hidden; border-radius: 999px; background: #2a2f3a; }
.pl-film-progress > i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.pl-film-tools { flex: 0 0 auto; display: flex; align-items: center; gap: 4px; }
.pl-film-tools button { width: 29px; height: 29px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.04); color: var(--text); cursor: pointer; }
.pl-film-tools button:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.pl-film-tools button:disabled { opacity: .25; cursor: default; }
.pl-film-tools button[data-remove-film] { color: #ff8585; }
.pl-film-tools svg { width: 14px; height: 14px; }
.admin-number { width: 82px; min-height: 36px; box-sizing: border-box; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--panel); color: var(--text); font: inherit; font-size: 13.5px; text-align: center; color-scheme: dark; }
.admin-number:focus { border-color: var(--accent); outline: none; }

@media (max-width: 620px) {
  .lib-actions { grid-template-columns: 1fr 1fr; }
  .playlist-card { width: 96vw; max-height: 91vh; padding: 18px 14px; }
  .pl-head { align-items: start; flex-direction: column; gap: 4px; }
  .pl-limit { text-align: left; }
  .pl-grid { grid-template-columns: 1fr; }
  .pl-create button span { display: none; }
  .pl-detail-head { align-items: start; flex-direction: column; gap: 4px; }
  .pl-film-tools button { width: 27px; height: 27px; }
  .details-playlist span { display: none; }
}

/* --- Confirm dialog (host film-change etc.) --- */
.confirm-pop { position: fixed; inset: 0; z-index: 3000; display: flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .62); backdrop-filter: blur(3px); padding: 20px; }
.confirm-pop.hidden { display: none; }
.cf-card { width: 100%; max-width: 380px; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: 0 24px 70px rgba(0, 0, 0, .6); text-align: center; }
.cf-title { font-size: 16px; font-weight: 700; line-height: 1.3; }
.cf-sub { color: var(--muted); font-size: 13.5px; margin-top: 8px; line-height: 1.35; }
.cf-btns { display: flex; gap: 10px; margin-top: 18px; }
.cf-btns button { flex: 1; padding: 10px 14px; border-radius: 10px; font-size: 14px; font-weight: 600; cursor: pointer; border: 1px solid var(--line); }
.cf-cancel { background: var(--panel); color: var(--text); }
.cf-cancel:hover { background: var(--line); }
.cf-ok { background: var(--accent); color: #1a1205; border-color: var(--accent); }
.cf-ok:hover { filter: brightness(1.08); }
.cf-ok:focus-visible, .cf-cancel:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

/* --- "Сейчас в кино" splash (masks the warm-up) --- */
.nowshowing { position: absolute; inset: 0; z-index: 30; display: flex; align-items: center; justify-content: center; opacity: 0; visibility: hidden; transition: opacity .55s ease, visibility .55s; pointer-events: none; overflow: hidden; }
.nowshowing.in { opacity: 1; visibility: visible; }
.ns-backdrop { position: absolute; inset: -8%; background-size: cover; background-position: center; filter: blur(26px) brightness(.3) saturate(1.15); transform: scale(1.12); }
.ns-vignette { position: absolute; inset: 0; background: radial-gradient(ellipse at center, rgba(0,0,0,.12) 32%, rgba(0,0,0,.72) 100%), linear-gradient(180deg, rgba(8,10,14,.4), rgba(8,10,14,.62)); }
.ns-inner { position: relative; z-index: 1; text-align: center; padding: 20px; display: flex; flex-direction: column; align-items: center; animation: nsRise .7s cubic-bezier(.2,.7,.2,1) both; }
.ns-poster { width: min(30vh, 190px); aspect-ratio: 2 / 3; border-radius: 14px; overflow: hidden; box-shadow: 0 24px 60px rgba(0,0,0,.65), 0 0 0 1px rgba(255,255,255,.06); background: #12161f; margin-bottom: 20px; }
.ns-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ns-label { font-size: 12px; letter-spacing: .32em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.ns-title { font-size: clamp(20px, 3.4vw, 30px); font-weight: 800; margin-top: 8px; max-width: 80vw; line-height: 1.15; text-shadow: 0 2px 18px rgba(0,0,0,.6); }
.ns-year { color: var(--muted); font-size: 14px; margin-top: 4px; }
.ns-dots { display: flex; gap: 7px; margin-top: 20px; }
.ns-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: .35; animation: nsDot 1.1s ease-in-out infinite; }
.ns-dots span:nth-child(2) { animation-delay: .18s; }
.ns-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes nsRise { from { opacity: 0; transform: translateY(14px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes nsDot { 0%, 100% { opacity: .3; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-4px); } }

/* --- Combo reactions (≥3 people, same emoji) --- */
.combo-flash { position: absolute; inset: 0; pointer-events: none; background: radial-gradient(circle at 50% 58%, rgba(255,255,255,.5), rgba(255,255,255,0) 55%); animation: comboFlash .9s ease-out forwards; }
@keyframes comboFlash { 0% { opacity: 0; } 14% { opacity: 1; } 100% { opacity: 0; } }
.combo-banner { position: absolute; left: 50%; top: 42%; transform: translate(-50%,-50%); display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; text-shadow: 0 3px 20px rgba(0,0,0,.7); animation: comboPop 1.7s cubic-bezier(.2,.8,.2,1) forwards; }
.combo-be { font-size: 68px; line-height: 1; filter: drop-shadow(0 6px 14px rgba(0,0,0,.5)); }
.combo-bx { font-size: 26px; font-weight: 900; color: #ffd54a; letter-spacing: .04em; }
@keyframes comboPop { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.4) rotate(-6deg); } 18% { opacity: 1; transform: translate(-50%,-50%) scale(1.12) rotate(2deg); } 32% { transform: translate(-50%,-50%) scale(1) rotate(0); } 78% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%,-58%) scale(1); } }
.combo-burst { position: absolute; bottom: 8%; pointer-events: none; will-change: transform, opacity; animation: comboBurst 2.1s ease-out forwards; }
@keyframes comboBurst { 0% { opacity: 0; transform: translateY(0) translateX(0) scale(.5); } 12% { opacity: 1; } 100% { opacity: 0; transform: translateY(-78vh) translateX(var(--dx,0)) scale(1.15) rotate(20deg); } }

/* --- Кино-бинго --- */
.bingo-modal { position: fixed; inset: 0; z-index: 2450; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); padding: 18px; }
.bingo-modal.hidden { display: none; }
.bingo-card { width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto; overflow-x: hidden; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: 0 24px 70px rgba(0,0,0,.6); }
.bingo-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.bingo-title { font-size: 18px; font-weight: 800; }
.bingo-acts { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.bingo-new { padding: 6px 12px; border-radius: 9px; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.bingo-new:hover { background: var(--line); }
.bingo-x { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 50%; color: var(--muted); cursor: pointer; }
.bingo-x:hover { color: var(--text); }
.bingo-x svg { width: 15px; height: 15px; }
.bingo-hint { color: var(--muted); font-size: 12.5px; margin-bottom: 14px; line-height: 1.4; }
.bingo-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.bingo-cell { position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; text-align: center; padding: 6px; border-radius: 11px; background: var(--panel); border: 1px solid var(--line); color: var(--text); font-size: 10.5px; line-height: 1.2; cursor: pointer; transition: transform .1s ease, background .15s ease, border-color .15s ease; }
.bingo-cell span { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.bingo-cell:hover { border-color: var(--accent); transform: translateY(-1px); }
.bingo-cell.on { background: linear-gradient(160deg, var(--accent), #c8860a); border-color: var(--accent); color: #1a1205; font-weight: 700; }
.bingo-cell.on::after { content: '✓'; position: absolute; top: 3px; right: 6px; font-size: 11px; font-weight: 900; opacity: .85; }
.bingo-card.bingo-won { animation: bingoWon .5s ease 3; }
@keyframes bingoWon { 0%, 100% { box-shadow: 0 24px 70px rgba(0,0,0,.6); } 50% { box-shadow: 0 0 0 3px var(--accent), 0 24px 80px rgba(229,160,13,.5); } }

/* --- Profile achievement badges --- */
.pp-badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 14px 0 2px; }
.pp-badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px 4px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; color: #f0d9a8; background: linear-gradient(160deg, rgba(229,160,13,.22), rgba(229,160,13,.08)); border: 1px solid rgba(229,160,13,.42); }
.pp-badge-i { font-size: 14px; line-height: 1; }

/* --- Schedule (movie nights) --- */
.sched-modal { position: fixed; inset: 0; z-index: 2450; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); padding: 18px; }
.sched-modal.hidden { display: none; }
.sched-card { width: 100%; max-width: 460px; max-height: 86vh; display: flex; flex-direction: column; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 18px; padding: 18px; box-shadow: 0 24px 70px rgba(0,0,0,.6); }
.sched-head { display: flex; align-items: center; margin-bottom: 12px; }
.sched-title { font-size: 18px; font-weight: 800; }
.sched-head .bingo-x { margin-left: auto; }
.sched-list { overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; min-height: 40px; }
.sched-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 0; }
.sched-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.sched-i-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.sched-i-main b { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-i-when { font-size: 12px; color: var(--muted); }
.sched-left { color: var(--accent); font-weight: 600; }
.sched-i-by { font-size: 11px; color: var(--muted); }
.sched-del { flex-shrink: 0; width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center; background: rgba(0,0,0,.3); border: 1px solid var(--line); border-radius: 50%; color: var(--muted); cursor: pointer; }
.sched-del:hover { color: #ff6b6b; border-color: #ff6b6b; }
.sched-del svg { width: 13px; height: 13px; }
.sched-form { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.sched-inp { width: 100%; padding: 9px 11px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; color: var(--text); font-size: 13.5px; font-family: inherit; }
.sched-inp:focus { outline: none; border-color: var(--accent); }
.sched-row { display: flex; gap: 8px; }
.sched-when { flex: 1; color-scheme: dark; }
.sched-add { flex-shrink: 0; padding: 9px 16px; border-radius: 10px; background: var(--accent); color: #1a1205; border: 1px solid var(--accent); font-size: 13.5px; font-weight: 700; cursor: pointer; }
.sched-add:hover { filter: brightness(1.08); }
/* library film picker */
.sched-pick-wrap { position: relative; }
.sched-results { position: absolute; left: 0; right: 0; bottom: calc(100% + 4px); z-index: 5; background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; box-shadow: 0 -12px 34px rgba(0, 0, 0, .5); padding: 5px; max-height: 262px; overflow-y: auto; overflow-x: hidden; }
.sched-results.hidden { display: none; }
.sched-res { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px; border-radius: 8px; background: none; border: none; color: var(--text); cursor: pointer; text-align: left; }
.sched-res:hover { background: var(--panel); }
.sched-res-p { flex-shrink: 0; width: 34px; height: 50px; border-radius: 4px; overflow: hidden; background: #12161f; }
.sched-res-p img { width: 100%; height: 100%; object-fit: cover; }
.sched-res-t { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-res-y { color: var(--muted); font-size: 12px; }
.sched-picked { display: flex; align-items: center; gap: 10px; padding: 8px 10px; background: rgba(229, 160, 13, .1); border: 1px solid rgba(229, 160, 13, .4); border-radius: 11px; }
.sched-picked.hidden { display: none; }
.sched-pk-p { flex-shrink: 0; width: 36px; height: 54px; border-radius: 5px; overflow: hidden; background: #12161f; }
.sched-pk-p img { width: 100%; height: 100%; object-fit: cover; }
.sched-pk-t { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sched-pk-x { flex-shrink: 0; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); border-radius: 50%; color: var(--muted); cursor: pointer; }
.sched-pk-x:hover { color: var(--text); }
.sched-pk-x svg { width: 12px; height: 12px; }
.sched-i-poster { flex-shrink: 0; width: 34px; height: 50px; border-radius: 5px; overflow: hidden; background: #12161f; }
.sched-i-poster img { width: 100%; height: 100%; object-fit: cover; }
.sched-loadable { cursor: pointer; transition: border-color .15s ease; }
.sched-loadable:hover { border-color: var(--accent); }

/* --- Home shelves: "Тебе зайдёт" + "Уже смотрели вместе" --- */
.lib-shelves { display: flex; flex-direction: column; gap: 15px; padding: 2px 0 14px; border-bottom: 1px solid var(--line); margin-bottom: 10px; }
.lib-shelves.hidden { display: none; }
.shelf.hidden { display: none; }
.shelf-h { font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: .2px; margin: 0 0 9px 0; }
/* Scrollbar hidden for a clean carousel; snap gives a tidy scroll stop. */
.shelf-row { display: flex; gap: 10px; overflow-x: auto; overflow-y: hidden; padding-bottom: 2px; scrollbar-width: none; scroll-snap-type: x proximity; }
.shelf-row::-webkit-scrollbar { display: none; }
.shelf-card { flex: 0 0 auto; width: 86px; cursor: pointer; scroll-snap-align: start; }
.shelf-poster { width: 86px; height: 129px; border-radius: 10px; overflow: hidden; background: #12161f; border: 1px solid var(--line); box-shadow: 0 4px 12px rgba(0, 0, 0, .35); transition: border-color .14s ease, box-shadow .14s ease; }
.shelf-card:hover .shelf-poster { border-color: var(--accent); box-shadow: 0 8px 22px rgba(0, 0, 0, .55); }
.shelf-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shelf-t { font-size: 11px; color: #9aa2b1; font-weight: 500; margin-top: 6px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.shelf-card:hover .shelf-t { color: var(--text); }

/* --- Итоги вечера (recap) --- */
.recap-pop { position: fixed; inset: 0; z-index: 2600; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.72); backdrop-filter: blur(5px); padding: 20px; }
.recap-pop.hidden { display: none; }
.recap-card { position: relative; width: 100%; max-width: 480px; max-height: 86vh; overflow-y: auto; overflow-x: hidden; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 20px; padding: 24px; box-shadow: 0 30px 80px rgba(0,0,0,.6); text-align: center; }
.recap-x { position: absolute; right: 14px; top: 14px; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 50%; color: var(--muted); cursor: pointer; }
.recap-x:hover { color: var(--text); }
.recap-x svg { width: 15px; height: 15px; }
.recap-title { font-size: 24px; font-weight: 800; }
.recap-sub { color: var(--muted); font-size: 13.5px; margin-top: 6px; }
.recap-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 20px 0 9px; text-align: left; }
.recap-films { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.recap-film { position: relative; width: 78px; aspect-ratio: 2 / 3; border-radius: 9px; overflow: hidden; background: var(--panel); border: 1px solid var(--line); }
.recap-film img { width: 100%; height: 100%; object-fit: cover; display: block; }
.recap-film .recap-ft { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 5px; font-size: 10px; color: var(--muted); opacity: 0; }
.recap-film.noimg .recap-ft { opacity: 1; }
.recap-reacts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.recap-react { display: inline-flex; align-items: center; gap: 4px; padding: 6px 11px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; font-size: 17px; }
.recap-react b { font-size: 13px; color: var(--accent); font-weight: 700; }
.recap-people { display: flex; flex-wrap: wrap; gap: 7px; justify-content: center; }
.recap-av { width: 38px; height: 38px; border-radius: 50%; overflow: hidden; background: var(--accent-2); color: #fff; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; }
.recap-av img { width: 100%; height: 100%; object-fit: cover; }
.recap-dim { color: var(--muted); font-size: 13px; }
.recap-open-btn { width: 100%; padding: 11px; border-radius: 11px; background: linear-gradient(160deg, var(--accent), #c8860a); color: #1a1205; border: none; font-size: 14px; font-weight: 700; cursor: pointer; margin-bottom: 4px; }
.recap-open-btn:hover { filter: brightness(1.06); }

/* --- Admin settings panel (per-server, admin-only) --- */
.admin-modal { position: fixed; inset: 0; z-index: 2500; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.72); backdrop-filter: blur(5px); padding: 20px; }
.admin-modal.hidden { display: none; }
.admin-card { width: 100%; max-width: 420px; max-height: 88vh; overflow-y: auto; overflow-x: hidden; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 18px; padding: 20px; box-shadow: 0 24px 70px rgba(0,0,0,.6); }
.admin-head { display: flex; align-items: center; margin-bottom: 6px; }
.admin-title { font-size: 18px; font-weight: 800; }
.admin-head .bingo-x { margin-left: auto; }
.admin-hint { color: var(--muted); font-size: 12.5px; margin-bottom: 12px; line-height: 1.4; }
.admin-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 16px 0 6px; }
.admin-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 14px; padding: 6px 0; }
.admin-select { padding: 7px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 9px; color: var(--text); font-size: 13.5px; color-scheme: dark; }
.admin-tog { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 14px; border-top: 1px solid rgba(255,255,255,.05); cursor: pointer; }
.admin-tog span { min-width: 0; }
.admin-tog input[type=checkbox] { width: 40px; height: 22px; -webkit-appearance: none; appearance: none; background: var(--line); border-radius: 999px; position: relative; cursor: pointer; flex-shrink: 0; transition: background .15s ease; }
.admin-tog input[type=checkbox]::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s ease; }
.admin-tog input[type=checkbox]:checked { background: var(--accent); }
.admin-tog input[type=checkbox]:checked::after { transform: translateX(18px); }
.admin-save { width: 100%; margin-top: 18px; padding: 11px; border-radius: 11px; background: var(--accent); color: #1a1205; border: none; font-size: 14px; font-weight: 700; cursor: pointer; }
.admin-save:hover { filter: brightness(1.07); }
.admin-msg { text-align: center; font-size: 13px; margin-top: 10px; min-height: 16px; }
.admin-msg.ok { color: #3ba55d; }
.admin-msg.err { color: #ff6b6b; }
.reactions.feat-off { display: none !important; }

/* --- Киновечер (movie-night poll) modal --- */
.mn-modal { position: fixed; inset: 0; z-index: 2100; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,.7); backdrop-filter: blur(4px); padding: 20px; }
.mn-modal.hidden { display: none; }
.mn-card { position: relative; width: 100%; max-width: 480px; max-height: 86vh; overflow-y: auto; background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 16px; padding: 20px; box-shadow: 0 24px 70px rgba(0,0,0,.55); }
.mn-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mn-title { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; color: var(--text); }
.mn-hint { font-size: 12.5px; color: var(--muted); line-height: 1.4; margin-bottom: 14px; }
.mn-sec { font-size: 13px; font-weight: 700; color: var(--text); margin: 14px 0 8px; }
.mn-note { font-weight: 500; color: var(--muted); font-size: 12px; }
.mn-searchbar input, .mn-slot-add input { width: 100%; box-sizing: border-box; padding: 10px 13px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.05); color: var(--text); font-size: 14px; }
.mn-searchbar input:focus, .mn-slot-add input:focus { outline: none; border-color: var(--accent); }
.mn-suggest { display: flex; flex-direction: column; gap: 5px; margin-top: 6px; max-height: 190px; overflow-y: auto; }
.mn-s-item { padding: 8px 11px; border-radius: 9px; border: 1px solid var(--line); background: rgba(255,255,255,.04); color: var(--text); cursor: pointer; font-size: 13.5px; }
.mn-s-item i { color: var(--muted); font-style: normal; }
.mn-s-item:hover { background: rgba(229,160,13,.14); border-color: rgba(229,160,13,.4); }
.mn-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.mn-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 8px 6px 11px; border-radius: 999px; background: rgba(229,160,13,.15); border: 1px solid rgba(229,160,13,.45); color: var(--text); font-size: 13px; }
.mn-chip i { color: var(--muted); font-style: normal; }
.mn-chip button { border: none; background: rgba(0,0,0,.25); color: #ffce6a; width: 18px; height: 18px; border-radius: 50%; cursor: pointer; font-size: 11px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.mn-chip button:hover { background: rgba(0,0,0,.45); color: #fff; }
.mn-slots { display: flex; flex-wrap: wrap; gap: 8px; }
.mn-slot { display: inline-flex; align-items: center; gap: 7px; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.04); cursor: pointer; font-size: 13.5px; color: var(--text); user-select: none; }
.mn-slot:hover { border-color: var(--accent); }
.mn-slot input { accent-color: var(--accent); }
.mn-slot-add { display: flex; gap: 8px; margin-top: 9px; }
.mn-slot-btn { flex: 0 0 auto; width: 42px; border-radius: 10px; border: 1px solid var(--line); background: rgba(255,255,255,.06); color: var(--text); font-size: 20px; cursor: pointer; }
.mn-slot-btn:hover { border-color: var(--accent); color: var(--accent); }
.mn-go { width: 100%; margin-top: 18px; padding: 11px; border-radius: 11px; border: none; background: linear-gradient(180deg, var(--accent), #d18f0b); color: #1c1400; font-weight: 800; font-size: 14.5px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.mn-go:hover { filter: brightness(1.07); }
.mn-msg { text-align: center; font-size: 13px; margin-top: 10px; min-height: 16px; }
.mn-msg.ok { color: #3ba55d; }
.mn-msg.err { color: #ff6b6b; }


/* ================= Правки UX-аудита 2026-09-06 ================= */

/* Скелетоны библиотеки: пока список грузится, показываем его форму,
   а не пустую панель с английским "loading…". */
.skel-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; list-style: none; }
.skel { display: block; border-radius: 6px;
        background: linear-gradient(90deg, rgba(255,255,255,.05) 25%, rgba(255,255,255,.10) 37%, rgba(255,255,255,.05) 63%);
        background-size: 400% 100%; animation: dpwSkel 1.3s ease-in-out infinite; }
.skel-poster { width: 38px; height: 56px; flex: 0 0 38px; border-radius: 5px; }
.skel-lines { display: flex; flex-direction: column; gap: 7px; flex: 1; }
.skel-line { height: 11px; width: 72%; }
.skel-line.short { width: 38%; height: 9px; }
@keyframes dpwSkel { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }

/* Технический код ошибки — мелко и приглушённо: он нужен только чтобы переслать,
   а не чтобы пугать зрителя посреди экрана. */
.err-detail { display: inline-block; margin-top: 6px; font-size: 11px; opacity: .5;
              font-family: ui-monospace, Menlo, monospace; }

/* Пустой экран больше не просто строка текста — даёт два очевидных следующих шага. */
.idle-actions { display: flex; gap: 10px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.idle-btn { display: inline-flex; align-items: center; gap: 7px; padding: 9px 16px; border-radius: 10px;
            background: var(--panel-2); border: 1px solid var(--line); color: var(--text);
            font: inherit; font-size: 13px; cursor: pointer; transition: border-color .15s, background .15s; }
.idle-btn:hover { border-color: var(--accent); background: rgba(229,160,13,.08); }
.idle-btn.primary { border-color: rgba(229,160,13,.5); }
.idle-btn .ico { width: 15px; height: 15px; display: inline-flex; color: var(--accent); }
.idle-btn .ico svg { width: 100%; height: 100%; }

/* Кнопки «Плейлисты» и «Заказать фильм» были разной высоты: вторая переносилась в две строки. */
.lib-actions .request-btn { min-height: 38px; justify-content: center; text-align: center; line-height: 1.15; }

/* У полок был скрыт скролл-бар, и обрезанная карточка справа читалась как брак вёрстки,
   а не как «здесь есть продолжение». Добавляем затухание к краю — видимую подсказку. */
.shelf { position: relative; }
.shelf::after { content: ''; position: absolute; right: 0; bottom: 0; width: 44px; height: calc(100% - 22px);
                pointer-events: none; opacity: .9;
                background: linear-gradient(to right, rgba(20,23,30,0), var(--panel) 85%); }

/* Raised-hand card: the host's answer to a pause request. Sits in the bottom-left corner
   clear of the controls, never covers the picture, and can be ignored — unlike the modal it
   replaced, which let any guest blank the host's player on demand. */
.pause-ask { position: fixed; left: 20px; bottom: 92px; z-index: 2450; width: min(320px, calc(100vw - 40px));
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; box-shadow: 0 18px 50px rgba(0, 0, 0, .55); animation: paLift .22s ease-out; }
.pause-ask.hidden { display: none; }
.pa-text { font-size: 13.5px; line-height: 1.35; }
.pa-text b { font-weight: 700; }
.pa-n { font-style: normal; font-size: 11.5px; color: var(--muted); background: var(--line); border-radius: 999px; padding: 1px 6px; margin-left: 4px; }
.pa-btns { display: flex; gap: 8px; margin-top: 10px; }
.pa-btns button { padding: 7px 12px; border-radius: 9px; font-size: 13px; font-weight: 600; cursor: pointer; border: 1px solid var(--line); }
.pa-ok { flex: 1; background: var(--accent); color: #1a1205; border-color: var(--accent); }
.pa-ok:hover { filter: brightness(1.08); }
.pa-no { background: var(--panel); color: var(--text); }
.pa-no:hover { background: var(--line); }
.pa-mute { background: var(--panel); color: var(--muted); line-height: 1; }
.pa-mute:hover { background: var(--line); color: var(--text); }
.pa-btns button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
@keyframes paLift { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@media (prefers-reduced-motion: reduce) { .pause-ask { animation: none; } }
.pill-btn { cursor: pointer; font: inherit; }
.pill-btn:hover { filter: brightness(1.12); }
.pill-btn.hidden { display: none; }
.pill-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
