/* Направление: тихая комната вечером, свет только от экрана. Бренд: серебряный WG на графите.
   Ярким остаётся само видео, всё вокруг — графитовый ramp из логотипа и серебро как акцент.
   Фирменная деталь — два пересекающихся кольца (двое) в статусе синхрона.
   Правила вёрстки по unslop by Damir Sokolovsky (@heydamir), CC BY 4.0 */

:root {
  --deep: #17181c;
  --bg: #1e1f24;
  --card: #24252b;
  --raised: #2c2d34;
  --raised-2: #35363e;
  --line: rgba(238, 238, 232, .08);
  --line-2: rgba(238, 238, 232, .14);
  --text: #eeeee8;
  --text-2: #a5a5ad;
  --muted: #84848e;
  --accent: #d9d9d3;
  --accent-ink: #1e1f24;
  --ok: #4cc38a;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --font: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 400 15px/22px var(--font); -webkit-font-smoothing: antialiased; }
body { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
input { font: inherit; color: inherit; }
h1, h2, p { margin: 0; }
svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); font-size: 12px; line-height: 16px; font-variant-numeric: tabular-nums; }
::selection { background: rgba(238, 238, 232, .22); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- кнопки */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px;
  border-radius: 10px; font-weight: 500; font-size: 14px; white-space: nowrap;
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease), transform .12s var(--ease); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--text); color: var(--deep); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .5); }
.btn.primary:hover { background: #ffffff; }
.btn.secondary { background: var(--raised); border: 1px solid var(--line); }
.btn.secondary:hover { background: var(--raised-2); }
.btn.ghost { color: var(--text-2); }
.btn.ghost:hover { background: var(--raised); color: var(--text); }
.btn.icon { width: 40px; padding: 0; }
.btn.sm { height: 32px; padding: 0 12px 0 8px; border-radius: 8px; font-size: 13px; }
.btn.sm svg { width: 16px; height: 16px; }
.btn.wide { width: 100%; height: 44px; }

/* ---------------------------------------------------------------- шапка */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex: none;
  height: 56px; padding: 0 24px; margin-top: var(--tg-content-safe-area-inset-top, env(safe-area-inset-top)); }
.brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.logo { width: 28px; height: 28px; border-radius: 7px; display: block; flex: none; }
.word { font-weight: 600; font-size: 16px; }
.sep { width: 1px; height: 16px; background: var(--line-2); margin: 0 4px; }
.src-label { color: var(--text-2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-right { display: flex; align-items: center; gap: 12px; flex: none; }
.conn { font-size: 12px; color: var(--muted); }
.viewers { display: flex; }
.viewer { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; margin-left: -6px;
  background: var(--raised-2); border: 2px solid var(--bg); font-size: 12px; font-weight: 500; color: var(--text); }
.viewer:first-child { margin-left: 0; }
.viewer.me { background: var(--raised); color: var(--text-2); }

/* ---------------------------------------------------------------- комната */
.room { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 344px; gap: 16px;
  padding: 0 24px 24px; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
.screen-col { display: flex; flex-direction: column; gap: 12px; min-width: 0; min-height: 0; }

.stage { position: relative; width: 100%; aspect-ratio: 16 / 9; max-height: calc(100dvh - 160px); flex: none;
  background: #000; border-radius: 14px; overflow: hidden; isolation: isolate; box-shadow: 0 0 0 1px var(--line); }
.player, .player > iframe, .player > video, .player > div { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #000; }

.cover { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 24px; text-align: center; background: var(--deep); }
.cover h1 { font-size: 24px; line-height: 30px; font-weight: 500; }
.cover p { max-width: 32rem; color: var(--text-2); font-size: 14px; line-height: 20px; margin-bottom: 8px; }
.cover-icon { width: 32px; height: 32px; color: var(--muted); margin-bottom: 4px; }
.cover-mark { width: 40px; height: 40px; color: var(--accent); stroke-width: 1.5; margin-bottom: 4px; }
.gate { background: rgba(23, 24, 28, .92); }
.name-row { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 280px; margin-bottom: 4px;
  font-size: 13px; color: var(--text-2); text-align: left; }
.name-row input { height: 40px; padding: 0 12px; border-radius: 10px; background: var(--raised); border: 1px solid var(--line);
  outline: none; transition: border-color .15s var(--ease); }
.name-row input:focus { border-color: rgba(238, 238, 232, .35); }

.countdown { position: absolute; inset: 0; z-index: 6; display: grid; place-items: center; pointer-events: none;
  background: rgba(0, 0, 0, .35); }
.countdown span { font-size: min(24vmin, 160px); line-height: 1; font-weight: 500; letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; color: var(--text); }
.countdown span.tick { animation: tick .9s var(--ease) both; }
@keyframes tick { from { opacity: 0; transform: translateY(12px); } 25%, 75% { opacity: 1; transform: none; } to { opacity: 0; } }

.floaters { position: absolute; inset: 0; z-index: 4; pointer-events: none; overflow: hidden; }
.floaters span { position: absolute; bottom: 12%; font-size: 36px; line-height: 1; animation: rise 2.4s var(--ease) forwards; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } 15% { opacity: 1; } 70% { opacity: 1; }
  to { opacity: 0; transform: translateY(-220px); } }

.under { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; }
.sync { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text-2); font-size: 14px; }
.sync span:not(.mono) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-mark { width: 20px; height: 20px; color: var(--muted); transition: color .3s var(--ease); }
.sync.live .sync-mark { color: var(--accent); }
.sync.live #syncText { color: var(--text); }
.sync .mono { color: var(--muted); }
.tools { display: flex; gap: 4px; flex: none; }

.note { display: flex; gap: 8px; align-items: flex-start; padding: 12px 16px; border-radius: 12px;
  background: var(--card); border: 1px solid var(--line); color: var(--text-2); font-size: 14px; line-height: 20px; }
.note svg { color: var(--accent); margin-top: 1px; }

/* ---------------------------------------------------------------- чат */
.chat { position: relative; display: flex; flex-direction: column; min-height: 0; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line); }
.chat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 48px; padding: 0 16px;
  border-bottom: 1px solid var(--line); flex: none; }
.chat-title { font-weight: 500; }
.typing { font-size: 12px; color: var(--muted); display: inline-flex; align-items: baseline; gap: 4px; }
.typing #typingName { color: var(--text-2); }
.dots { display: inline-flex; gap: 2px; margin-left: 2px; }
.dots i { width: 3px; height: 3px; border-radius: 50%; background: currentColor; animation: dot 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: .2s; } .dots i:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 0%, 100% { opacity: .3; } 40% { opacity: 1; } }

.chat-list { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 12px 8px; display: flex; flex-direction: column;
  overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--raised-2) transparent; }
.chat-empty { margin: auto; max-width: 220px; text-align: center; color: var(--muted); font-size: 13px; line-height: 20px; }

.msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 86%; margin-top: 2px; }
.msg.first { margin-top: 12px; }
.msg.mine { align-self: flex-end; align-items: flex-end; }
.msg .who { font-size: 12px; line-height: 16px; color: var(--muted); margin: 0 0 4px 12px; }
.msg.mine .who { display: none; }
.bubble { padding: 8px 12px; border-radius: 14px; background: var(--raised); white-space: pre-wrap;
  overflow-wrap: anywhere; line-height: 20px; font-size: 14.5px; }
.msg.mine .bubble { background: var(--raised-2); }
.msg:not(.first) .bubble { border-top-left-radius: 4px; }
.msg:not(.last) .bubble { border-bottom-left-radius: 4px; }
.msg.mine:not(.first) .bubble { border-top-left-radius: 14px; border-top-right-radius: 4px; }
.msg.mine:not(.last) .bubble { border-bottom-left-radius: 14px; border-bottom-right-radius: 4px; }
.bubble time { float: right; margin: 6px 0 -4px 8px; font-family: var(--mono); font-size: 10.5px; line-height: 12px;
  color: var(--muted); font-variant-numeric: tabular-nums; }
.bubble a { color: var(--text); text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.bubble a:hover { text-decoration-color: var(--text-2); }
.bubble .use-link { display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; height: 28px; padding: 0 10px;
  border-radius: 8px; background: var(--deep); border: 1px solid var(--line); font-size: 13px; font-weight: 500;
  transition: background-color .15s var(--ease); }
.bubble .use-link:hover { background: var(--bg); }
.bubble .use-link svg { width: 14px; height: 14px; fill: currentColor; stroke: none; }
.bubble.big { background: none !important; padding: 0 4px; font-size: 36px; line-height: 44px; }
.bubble.big time { display: none; }

.event { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 12px 0 0; font-size: 12px;
  line-height: 16px; color: var(--muted); text-align: center; }
.event svg { width: 14px; height: 14px; }
.event b { font-weight: 500; color: var(--text-2); }
.event .mono { font-size: 11.5px; }

.tray { position: absolute; left: 12px; bottom: 68px; z-index: 3; display: flex; gap: 4px; padding: 4px; border-radius: 12px;
  background: var(--raised); border: 1px solid var(--line-2); box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  animation: pop .18s var(--ease); }
.tray button { width: 40px; height: 40px; border-radius: 8px; font-size: 22px; line-height: 1;
  transition: background-color .12s var(--ease), transform .12s var(--ease); }
.tray button:hover { background: var(--raised-2); }
.tray button:active { transform: scale(.94); }
@keyframes pop { from { opacity: 0; transform: translateY(6px); } }

.composer { display: flex; align-items: center; gap: 4px; padding: 8px; border-top: 1px solid var(--line); flex: none; }
.composer input { flex: 1; min-width: 0; height: 40px; padding: 0 12px; background: none; border: 0; outline: none; }
.composer input::placeholder { color: var(--muted); }
.send { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex: none;
  background: var(--accent); color: var(--accent-ink); transition: opacity .15s var(--ease), transform .12s var(--ease); }
.send:active { transform: scale(.95); }
.send:disabled { opacity: .35; cursor: default; }

/* ---------------------------------------------------------------- окно выбора видео */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 24px; }
.sheet-scrim { position: absolute; inset: 0; background: rgba(12, 12, 15, .72); animation: fade .2s var(--ease); }
@keyframes fade { from { opacity: 0; } }
.sheet-card { position: relative; width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 16px;
  padding: 20px 24px 24px; border-radius: 16px; background: var(--card); border: 1px solid var(--line-2);
  box-shadow: 0 24px 64px rgba(0, 0, 0, .5); animation: enter .3s var(--ease); }
@keyframes enter { from { opacity: 0; transform: translateY(8px); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-right: -8px; }
.sheet-head h2 { font-size: 18px; line-height: 24px; font-weight: 500; }
.field { display: flex; align-items: center; gap: 4px; padding: 0 4px 0 12px; height: 44px; border-radius: 10px;
  background: var(--raised); border: 1px solid var(--line); transition: border-color .15s var(--ease); }
.field:focus-within { border-color: rgba(238, 238, 232, .35); }
.field input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: none; }
.field input::placeholder { color: var(--muted); }
.field .btn.icon { width: 36px; height: 36px; border-radius: 6px; }
.support { margin: 0; display: flex; flex-direction: column; }
.support div { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.support dt { color: var(--text-2); }
.support dd { margin: 0; color: var(--muted); }

/* ---------------------------------------------------------------- уведомления (видны, когда чата нет на экране) */
.toasts { position: fixed; left: 50%; top: calc(16px + var(--tg-content-safe-area-inset-top, 0px)); z-index: 50;
  transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast { max-width: min(420px, 90vw); padding: 8px 12px; border-radius: 10px; background: rgba(36, 37, 43, .95);
  border: 1px solid var(--line-2); font-size: 13px; line-height: 18px; animation: toast 4s var(--ease) forwards;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.toast b { font-weight: 500; color: var(--text-2); margin-right: 6px; }
@keyframes toast { 0% { opacity: 0; transform: translateY(-6px); } 6%, 88% { opacity: 1; transform: none; } 100% { opacity: 0; } }

/* ---------------------------------------------------------------- планшет и телефон */
@media (max-width: 960px) {
  .room { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); gap: 12px; }
  .stage { max-height: 56dvh; }
}
@media (max-width: 640px) {
  .bar { padding: 0 16px; height: 52px; }
  .btn.sm span, .sep, .src-label, .btn.ghost:not(.icon) span { display: none; }
  .btn.sm { width: 32px; padding: 0; }
  .btn.ghost:not(.icon) { width: 40px; padding: 0; }
  .room { padding: 0 0 max(8px, env(safe-area-inset-bottom)); gap: 8px; }
  .screen-col { gap: 4px; }
  .stage { border-radius: 0; box-shadow: none; }
  .under { padding: 0 8px 0 16px; }
  .note { margin: 0 16px 4px; }
  .chat { margin: 0 8px; border-radius: 14px; }
  .cover h1 { font-size: 20px; line-height: 26px; }
  .cover p { font-size: 13px; }
  .sheet { align-items: flex-end; padding: 0; }
  .sheet-card { max-width: none; border-radius: 16px 16px 0 0; padding-bottom: max(24px, env(safe-area-inset-bottom)); }
}

/* лёжа на телефоне и во весь экран — только видео */
@media (orientation: landscape) and (max-height: 520px) {
  .bar, .chat, .note, .under .sync { display: none; }
  .room { display: block; padding: 0; }
  .stage { height: 100dvh; max-height: none; aspect-ratio: auto; border-radius: 0; box-shadow: none; }
  .under { position: fixed; top: 8px; right: 8px; z-index: 10; padding: 0; opacity: .5; transition: opacity .15s var(--ease); }
  .under:hover, .under:active { opacity: 1; }
  .tools { background: rgba(23, 24, 28, .82); border-radius: 12px; padding: 2px; }
}
body.fs .bar, body.fs .chat, body.fs .note, body.fs .under .sync { display: none; }
body.fs .room { display: block; padding: 0; }
body.fs .stage { height: 100dvh; max-height: none; aspect-ratio: auto; border-radius: 0; box-shadow: none; }
body.fs .under { position: fixed; top: calc(8px + var(--tg-content-safe-area-inset-top, 0px)); right: 8px; z-index: 10; opacity: .5; }
body.fs .under:hover { opacity: 1; }
body.fs .tools { background: rgba(23, 24, 28, .82); border-radius: 12px; padding: 2px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

/* ================================================================ главный экран */
body.lobby { height: auto; min-height: 100dvh; overflow: auto; }
.home { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 24px 48px;
  padding-bottom: max(48px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 48px; }
.hero { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 64px; align-items: center;
  min-height: min(640px, calc(100dvh - 56px - 48px)); padding: 32px 0; }
.start { display: flex; flex-direction: column; gap: 16px; }

/* Пример комнаты, нарисованный в коде: единственное яркое место экрана */
.preview { margin: 0; display: flex; flex-direction: column; gap: 12px; }
.pv-room { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 8px; padding: 8px; border-radius: 16px;
  background: var(--card); border: 1px solid var(--line); box-shadow: 0 24px 64px rgba(0, 0, 0, .35); }
.pv-screen { position: relative; aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; background: #0d0a08; }
.pv-scene { position: absolute; inset: 0;
  background: linear-gradient(180deg, #1b1411 0%, #3a2418 38%, #8a4d2a 62%, #d9894a 74%, #2a1a12 74.2%, #120d0a 100%); }
.pv-sun { position: absolute; left: 58%; top: 52%; width: 22%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle at 50% 45%, #ffd9a3, #f0a35c 60%, #d9894a 100%); transform: translate(-50%, -50%); }
.pv-hills { position: absolute; left: -10%; right: -10%; bottom: 0; height: 34%;
  background: radial-gradient(60% 100% at 20% 100%, #0e0a08 98%, transparent 100%),
              radial-gradient(70% 90% at 85% 100%, #17100c 98%, transparent 100%); }
.pv-bar { position: absolute; left: 12px; right: 12px; bottom: 10px; height: 3px; border-radius: 2px; background: rgba(238, 238, 232, .25); }
.pv-fill { position: absolute; inset: 0 auto 0 0; width: 46%; border-radius: 2px; background: var(--text); }
.pv-chat { display: flex; flex-direction: column; justify-content: flex-end; gap: 4px; padding: 4px; min-width: 0; }
.pv-msg { align-self: flex-start; max-width: 100%; padding: 6px 10px; border-radius: 10px; background: var(--raised);
  font-size: 12px; line-height: 16px; }
.pv-msg.mine { align-self: flex-end; background: var(--raised-2); }
.pv-event { display: flex; align-items: center; justify-content: center; gap: 4px; margin: 6px 0; color: var(--muted);
  font-size: 11px; line-height: 16px; }
.pv-event svg { width: 12px; height: 12px; }
.pv-status { display: flex; align-items: center; gap: 8px; padding: 0 4px; color: var(--text); font-size: 14px; }
.pv-status .sync-mark { color: var(--accent); }
.pv-status .mono { color: var(--muted); }
.start h1 { font-size: 40px; line-height: 44px; font-weight: 500; letter-spacing: -.02em; }
.lead { color: var(--text-2); font-size: 17px; line-height: 26px; max-width: 34rem; margin-bottom: 8px; }
.create { display: flex; gap: 8px; }
.create .field { flex: 1; min-width: 0; }
.create .btn.primary { height: 44px; }
.create .btn.primary:disabled { opacity: .6; cursor: default; }
.form-error { color: #e5484d; font-size: 13px; line-height: 20px; }
.sources { color: var(--muted); font-size: 13px; line-height: 20px; }

.rooms { display: flex; flex-direction: column; gap: 8px; }
.rooms-head { display: flex; align-items: baseline; gap: 8px; padding: 0 4px; }
.rooms-head h2 { font-size: 15px; line-height: 22px; font-weight: 500; }
.rooms-head .mono { color: var(--muted); }
.room-list { list-style: none; margin: 0; padding: 4px; display: flex; flex-direction: column; gap: 2px;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; }
.room-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; color: inherit;
  text-decoration: none; transition: background-color .15s var(--ease); }
.room-row:hover { background: var(--raised); }
.room-row:active { background: var(--raised-2); }
.row-icon { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: var(--raised); color: var(--muted); }
.room-row.live .row-icon { color: var(--accent); }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.row-label { font-weight: 500; flex: none; }
.row-url { color: var(--text-2); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { display: flex; gap: 12px; color: var(--muted); font-size: 13px; line-height: 20px; }
.row-live { color: var(--text); }
.row-go { color: var(--muted); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; gap: 40px; min-height: 0; padding: 32px 0 0; }
  .preview { max-width: 560px; }
}
@media (max-width: 640px) {
  .home { padding: 0 16px 32px; gap: 40px; }
  .pv-room { grid-template-columns: 1fr; }
  .pv-chat { display: none; }
  .start h1 { font-size: 32px; line-height: 36px; }
  .lead { font-size: 15px; line-height: 22px; }
  .create { flex-direction: column; }
  .create .btn.primary { width: 100%; }
}

/* ---------------------------------------------------------------- комната: назад и позвать */
.back { width: 32px; height: 32px; margin-left: -8px; border-radius: 8px; display: grid; place-items: center; color: var(--text-2);
  text-decoration: none; transition: background-color .15s var(--ease), color .15s var(--ease); }
.back:hover { background: var(--raised); color: var(--text); }
.toast.force { animation-duration: 2.4s; }
body.has-rooms .hero { min-height: 0; padding: 48px 0 0; }
@media (max-width: 900px) { body.has-rooms .preview { display: none; } }

/* ================================================================ выбор видео: поиск и ссылка */
.sheet-card.picker { max-width: 640px; height: min(720px, 86dvh); gap: 12px; padding-bottom: 16px; }
.tabs { display: flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--deep); border: 1px solid var(--line); flex: none; }
.tab { flex: 1; height: 32px; border-radius: 8px; font-size: 14px; font-weight: 500; color: var(--text-2);
  transition: background-color .15s var(--ease), color .15s var(--ease); }
.tab:hover { color: var(--text); }
.tab.on { background: var(--raised-2); color: var(--text); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06); }
.pane { display: flex; flex-direction: column; gap: 12px; min-height: 0; }
#paneSearch { flex: 1; }
.field-icon { color: var(--muted); }
.field input[type="search"]::-webkit-search-cancel-button { filter: grayscale(1) opacity(.5); }

.results { display: flex; flex-direction: column; gap: 2px; overflow-y: auto; min-height: 0; margin: 0 -8px; padding: 0 4px;
  overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--raised-2) transparent; }
#paneSearch .results { flex: 1; }
.result { display: flex; gap: 12px; align-items: center; width: 100%; padding: 6px; border-radius: 10px; text-align: left;
  transition: background-color .15s var(--ease); }
.result:hover { background: var(--raised); }
.result:active { background: var(--raised-2); }
.result.current { background: var(--raised); box-shadow: inset 0 0 0 1px var(--line-2); }
.thumb { position: relative; width: 128px; aspect-ratio: 16 / 9; flex: none; border-radius: 6px; overflow: hidden; background: var(--raised); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .dur { position: absolute; right: 4px; bottom: 4px; padding: 0 4px; border-radius: 4px; background: rgba(0, 0, 0, .75);
  color: #fff; font-family: var(--mono); font-size: 11px; line-height: 16px; font-variant-numeric: tabular-nums; }
.thumb.blank { display: grid; place-items: center; color: var(--muted); }
.result-text { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.result-title { font-size: 14px; line-height: 20px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result-meta { font-size: 12px; line-height: 16px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result-now { color: var(--accent); }

.search-state { color: var(--muted); font-size: 13px; line-height: 20px; text-align: center; padding: 8px 16px; }
.search-state:empty { display: none; }
.search-state a { color: var(--text-2); }
.skel { display: flex; gap: 12px; padding: 6px; }
.skel i { width: 128px; aspect-ratio: 16 / 9; border-radius: 6px; background: var(--raised); flex: none; }
.skel b { flex: 1; height: 12px; margin-top: 8px; border-radius: 4px; background: var(--raised); max-width: 70%; }

.played { display: flex; flex-direction: column; gap: 8px; min-height: 0; flex: 1; }
.played h3 { margin: 4px 0 0; font-size: 13px; line-height: 20px; font-weight: 500; color: var(--text-2); }

@media (max-width: 640px) {
  .sheet-card.picker { height: 92dvh; padding: 16px 16px max(16px, env(safe-area-inset-bottom)); }
  .thumb { width: 112px; }
}
.picker.idle #paneSearch, .picker.idle #paneSearch .results { flex: none; }
