/* Shotgun: a calm, dark, Tesla-like look. Near-black surfaces, soft grey panels, frosted glass over video,
   one blue accent, rounded corners everywhere. */
:root {
  --bg: #0b0b0c;
  --bg-2: #161618;
  --bg-3: #232326;
  --bg-hover: #2e2e32;
  --text: #f5f5f7;
  --text-2: #9b9ba1;
  --line: #ffffff12;
  --accent: #3e6ae1;
  --accent-hi: #5b83f2;
  --link: #7f9ff5;
  --glass: rgba(30, 30, 34, .72);
  --glass-line: #ffffff1c;
  --topbar-h: 60px;
  --side-w: 240px;
  --mini-w: 76px;
  --radius: 16px;
  --radius-s: 12px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", "Inter", Roboto,
    "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px;
  -webkit-font-smoothing: antialiased; }
body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--text); }
svg { display: block; fill: currentColor; }
[hidden] { display: none !important; }
::selection { background: var(--accent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.search input:focus-visible, .field :focus-visible { outline: none; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar-h); z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 16px; background: rgba(11, 11, 12, .82); backdrop-filter: saturate(1.4) blur(18px);
  -webkit-backdrop-filter: saturate(1.4) blur(18px); border-bottom: 1px solid var(--line);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.logo { display: flex; align-items: center; gap: 10px; padding: 0 8px; font-weight: 600; font-size: 19px; letter-spacing: .2px; }
.logo img { width: 28px; height: 28px; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  transition: background .15s, transform .1s; }
.icon-btn:hover, .icon-btn:active { background: var(--bg-3); }
.icon-btn svg { width: 24px; height: 24px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 600;
  background: #5c6bc0; color: #fff; flex-shrink: 0; overflow: hidden; text-transform: uppercase; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.me { background: #7e57c2; margin-left: 8px; }

/* one rounded field, the search button sits inside it */
.search { flex: 0 1 620px; display: flex; align-items: center; height: 44px; position: relative; }
.search input {
  flex: 1; height: 44px; min-width: 0; padding: 0 92px 0 20px; background: var(--bg-3);
  border: 1px solid transparent; border-radius: 22px; outline: none; font-size: 16px; transition: border-color .15s, background .15s;
}
.search input::placeholder { color: var(--text-2); }
.search input:focus { border-color: var(--accent); background: var(--bg-2); }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear { position: absolute; right: 50px; width: 34px; height: 34px; display: none; place-items: center; border-radius: 50%;
  color: var(--text-2); }
.search-clear svg { width: 20px; height: 20px; }
.search.has-text .search-clear { display: grid; }
.search-btn { position: absolute; right: 4px; width: 44px; height: 36px; border-radius: 18px; display: grid; place-items: center;
  color: var(--text-2); }
.search-btn:hover { color: var(--text); background: var(--bg-hover); }
.search-btn svg { width: 22px; height: 22px; }
.search-back, .search-open { display: none; }

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed; top: var(--topbar-h); bottom: 0; left: 0; width: var(--side-w); z-index: 20;
  padding: 12px; overflow-y: auto; background: var(--bg); scrollbar-width: thin;
}
.sidebar a, .sidebar .sub-link {
  display: flex; align-items: center; gap: 18px; height: 46px; padding: 0 14px; border-radius: var(--radius-s); font-size: 15px;
  color: #d6d6da; transition: background .15s, color .15s;
}
.sidebar a:hover { background: var(--bg-2); }
.sidebar a.active { background: var(--bg-3); color: var(--text); font-weight: 600; }
.sidebar a.active i { color: var(--accent-hi); }
.sidebar i svg { width: 24px; height: 24px; }
.sidebar hr { border: 0; border-top: 1px solid var(--line); margin: 12px 4px; }
.sidebar-title { font-size: 12px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; color: var(--text-2); padding: 8px 14px 6px; }
.sidebar .avatar { width: 26px; height: 26px; font-size: 12px; }
.sidebar .sub-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.scrim { position: fixed; inset: 0; background: #0009; z-index: 25; display: none; backdrop-filter: blur(2px); }

main { padding: calc(var(--topbar-h) + 0px) 24px 48px calc(var(--side-w) + 24px); min-height: 100vh; }

/* mini sidebar */
body.mini .sidebar { width: var(--mini-w); padding: 6px; }
body.mini .sidebar a { flex-direction: column; justify-content: center; gap: 6px; height: 72px; padding: 0; font-size: 10.5px; }
body.mini .sidebar hr, body.mini .sidebar-title, body.mini #sidebar-subs, body.mini .sidebar a[data-nav="settings"] { display: none; }
body.mini main { padding-left: calc(var(--mini-w) + 24px); }

/* drawer mode (watch page and small screens) */
body.drawer .sidebar { transform: translateX(-100%); width: var(--side-w); padding: 12px; z-index: 40; top: 0;
  padding-top: calc(var(--topbar-h) + 12px); background: var(--bg-2); border-right: 1px solid var(--line); }
body.drawer .sidebar a { flex-direction: row; height: 46px; font-size: 15px; gap: 18px; padding: 0 14px; }
body.drawer .sidebar hr, body.drawer .sidebar-title, body.drawer #sidebar-subs { display: block; }
body.drawer.drawer-open .sidebar { transform: none; }
body.drawer.anim .sidebar { transition: transform .26s var(--ease); }
body.drawer.drawer-open .scrim { display: block; }
body.drawer main { padding-left: 24px; }
body.drawer .topbar { z-index: 45; }

/* ---------- chips ---------- */
.chips { position: sticky; top: var(--topbar-h); z-index: 10; background: rgba(11, 11, 12, .9); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px); display: flex; gap: 10px;
  overflow-x: auto; padding: 12px 24px; margin: 0 -24px 14px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chips { transition: transform .22s var(--ease); }
body.chips-hidden .chips:not([style*="static"]) { transform: translateY(-100%); }
.chip { flex-shrink: 0; height: 36px; padding: 0 16px; border-radius: 18px; background: var(--bg-3); color: #d6d6da;
  font-weight: 500; white-space: nowrap; transition: background .15s, color .15s; }
.chip:hover { background: var(--bg-hover); }
.chip.active { background: var(--text); color: var(--bg); }

/* ---------- video grid ---------- */
.grid { display: grid; gap: 36px 18px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.card { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.thumb { position: relative; aspect-ratio: 16 / 9; border-radius: var(--radius); overflow: hidden; background: var(--bg-3); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s var(--ease), opacity .3s; opacity: 0; }
.thumb img.in { opacity: 1; }
.card:hover .thumb img { transform: scale(1.025); }
.badge { position: absolute; right: 8px; bottom: 8px; background: rgba(0, 0, 0, .66); color: #fff; font-size: 12px; font-weight: 600;
  padding: 2px 7px; border-radius: 7px; letter-spacing: .3px; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  font-variant-numeric: tabular-nums; }
.badge.live { background: #e0323c; }
.watched { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #ffffff40; }
.watched > span { display: block; height: 100%; background: var(--accent-hi); }
.card-meta { display: flex; gap: 12px; }
.card-meta .card-text { flex: 1; min-width: 0; }
.card-meta .avatar { width: 36px; height: 36px; margin-top: 2px; }
.card-text { min-width: 0; }
.title { font-size: 16px; line-height: 22px; font-weight: 600; margin: 0 0 4px; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; letter-spacing: -.1px; }
.sub { color: var(--text-2); font-size: 14px; line-height: 20px; }
.sub a:hover { color: var(--text); }

/* list layout (search, history) */
.list { display: flex; flex-direction: column; gap: 18px; max-width: 1280px; }
.row { display: flex; gap: 16px; }
.row-thumb { width: 360px; flex-shrink: 0; }
.row .title { font-size: 18px; line-height: 25px; font-weight: 500; }
.row .channel-line { display: flex; align-items: center; gap: 8px; margin: 12px 0; color: var(--text-2); }
.row .channel-line .avatar { width: 24px; height: 24px; font-size: 11px; }
.row .snippet { color: var(--text-2); font-size: 12px; }
.row .row-text { flex: 1; min-width: 0; position: relative; }
.row-x { position: absolute; top: 0; right: 0; }

.page-title { font-size: 26px; font-weight: 600; letter-spacing: -.3px; margin: 24px 0 20px; }
.empty { text-align: center; color: var(--text-2); padding: 80px 20px; font-size: 16px; line-height: 1.6; }
.empty h2 { color: var(--text); font-size: 22px; font-weight: 600; }
.banner-note { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px;
  margin-bottom: 24px; display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }

/* ---------- buttons ---------- */
.btn { height: 40px; padding: 0 18px; border-radius: var(--radius-s); background: var(--bg-3); font-weight: 600; display: inline-flex;
  align-items: center; justify-content: center; gap: 8px; white-space: nowrap; }
.btn:hover { background: var(--bg-hover); }
.btn svg { width: 22px; height: 22px; }
.btn.white, .btn.blue { background: var(--accent); color: #fff; }
.btn.white:hover, .btn.blue:hover { background: var(--accent-hi); }

/* ---------- watch page ---------- */
.watch { display: grid; grid-template-columns: minmax(0, 1fr) 402px; grid-template-areas: "player side" "info side";
  grid-template-rows: auto 1fr; column-gap: 24px; max-width: 1760px; margin: 0 auto; padding-top: 20px; }
.player-col { grid-area: player; min-width: 0; }
.below-main { grid-area: info; min-width: 0; }
.secondary { grid-area: side; min-width: 0; }
.watch.theater { grid-template-areas: "player player" "info side"; padding-top: 12px; }
.watch.theater .player-shell { max-height: calc(100vh - var(--topbar-h) - 72px); }
.watch.theater .secondary { margin-top: 12px; }
.watch-title { font-size: 21px; line-height: 28px; font-weight: 600; letter-spacing: -.2px; margin: 14px 0 10px; word-break: break-word; }
.owner-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.owner { display: flex; align-items: center; gap: 12px; min-width: 0; }
.owner .avatar { width: 40px; height: 40px; }
.owner-name { font-size: 16px; font-weight: 600; }
.owner-subs { color: var(--text-2); font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.desc { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-top: 14px;
  line-height: 20px; cursor: pointer; }
.desc:hover { background: var(--bg-3); }
.desc-stats { font-weight: 600; }
.desc-body { white-space: pre-wrap; word-break: break-word; max-height: 60px; overflow: hidden; color: #d6d6da; }
.desc.open { cursor: auto; }
.desc.open .desc-body { max-height: none; }
.desc a { color: var(--link); }
.desc-more { font-weight: 600; margin-top: 6px; }
.chapters { display: flex; gap: 8px; overflow-x: auto; margin-top: 12px; padding-bottom: 4px; scrollbar-width: none; }
.chapter { flex-shrink: 0; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 9px 14px; text-align: left; }
.chapter { transition: background .2s, border-color .2s; }
.chapter.on { background: var(--bg-3); border-color: var(--accent); }
.chapter b { display: block; color: var(--link); font-weight: 600; font-size: 12px; font-variant-numeric: tabular-nums; }

.compact { display: flex; gap: 10px; margin-bottom: 10px; border-radius: var(--radius-s); }
.compact .thumb { width: 168px; flex-shrink: 0; border-radius: var(--radius-s); }
.compact .title { font-size: 14px; line-height: 20px; }
.compact .sub { font-size: 12px; line-height: 18px; }
.upnext-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; font-size: 16px; font-weight: 600; }
.toggle { display: inline-flex; align-items: center; gap: 10px; color: var(--text-2); font-size: 13px; font-weight: 400; cursor: pointer; }
.toggle input { display: none; }
.toggle span, .switch { width: 42px; height: 24px; border-radius: 12px; background: #4a4a50; position: relative; transition: background .2s; flex-shrink: 0; }
.toggle span::after, .switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px #0006; transition: transform .2s var(--ease); }
.toggle input:checked + span, .switch.on { background: var(--accent); }
.toggle input:checked + span::after, .switch.on::after { transform: translateX(18px); }

/* ---------- player ---------- */
.player-shell { position: relative; aspect-ratio: 16 / 9; width: 100%; background: #000; border-radius: 20px;
  overflow: hidden; max-height: calc(100vh - var(--topbar-h) - 140px); margin: 0 auto; user-select: none; -webkit-user-select: none;
  touch-action: manipulation; container-type: inline-size; }
.player-shell .surface { position: absolute !important; inset: 0; width: 100%; height: 100%; }
.player-shell .surface > div { width: 100% !important; height: 100% !important; }
.player-shell canvas { width: 100% !important; height: 100% !important; object-fit: contain; display: block; }
.player-shell .tesla-control-bar { display: none !important; }
.player-shell.fs { position: fixed; inset: 0; z-index: 100; max-height: none; border-radius: 0; aspect-ratio: auto; }
.poster { position: absolute; inset: 0; background: center / cover no-repeat; transition: opacity .35s; }
.poster.gone { opacity: 0; pointer-events: none; }
.spinner { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px; border-radius: 50%;
  border: 4px solid #ffffff2a; border-top-color: #fff; animation: spin .9s linear infinite; pointer-events: none; z-index: 2; }
@keyframes spin { to { transform: rotate(360deg); } }
.player-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; z-index: 6;
  background: rgba(0, 0, 0, .78); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); font-size: 16px; line-height: 1.5; }
.player-msg .btn { margin-top: 14px; }
.tap-zone { position: absolute; inset: 0; }
.flash { position: absolute; left: 50%; top: 50%; width: 76px; height: 76px; margin: -38px; border-radius: 50%;
  background: var(--glass); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  display: grid; place-items: center; opacity: 0; pointer-events: none; }
.flash svg { width: 38px; height: 38px; }
.flash.show { animation: flash .6s ease-out; }
.player-shell:not(.idle) .flash { display: none; } /* the centre button already shows it */
@keyframes flash { 0% { opacity: 1; transform: scale(.85); } 100% { opacity: 0; transform: scale(1.35); } }
.seek-hint { position: absolute; top: 50%; transform: translateY(-50%); background: var(--glass); backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px); border-radius: 24px; padding: 12px 18px; font-weight: 600; opacity: 0; pointer-events: none;
  transition: opacity .2s; z-index: 3; }
.seek-hint.left { left: 6%; } .seek-hint.right { right: 6%; }
.seek-hint.show { opacity: 1; }
.player-shell:not(.idle):not(.busy) .seek-hint { opacity: 0; } /* the ±10 buttons are on screen */

/* centre: back 10 / play-pause / forward 10, big enough to hit from the passenger seat */
.center-ctl { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -58%); display: flex; align-items: center;
  gap: clamp(20px, 7cqw, 72px); z-index: 3; transition: opacity .25s, transform .25s var(--ease); }
.center-ctl .round { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; position: relative;
  background: var(--glass); border: 1px solid var(--glass-line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  transition: transform .12s, background .15s; }
.center-ctl .round:active { transform: scale(.92); background: rgba(60, 60, 66, .8); }
.center-ctl .round svg { width: 30px; height: 30px; }
.center-ctl .round span { position: absolute; font-size: 10px; font-weight: 700; top: 50%; left: 50%; transform: translate(-50%, -32%); }
.center-ctl .round.fwd svg { transform: scaleX(-1); }
.center-ctl .round.big { width: 84px; height: 84px; background: rgba(255, 255, 255, .92); color: #111; border: 0; }
.center-ctl .round.big:active { background: #fff; }
.center-ctl .round.big svg { width: 42px; height: 42px; }
.player-shell.busy .center-ctl .round.big { opacity: 0; pointer-events: none; }

/* floating glass control bar */
.controls { position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 4px 12px 2px; z-index: 4;
  background: var(--glass); border: 1px solid var(--glass-line); border-radius: 18px;
  backdrop-filter: saturate(1.3) blur(18px); -webkit-backdrop-filter: saturate(1.3) blur(18px);
  transition: opacity .25s, transform .25s var(--ease); }
.player-shell.idle .controls { opacity: 0; transform: translateY(8px); pointer-events: none; }
.player-shell.idle .center-ctl { opacity: 0; transform: translate(-50%, -54%) scale(.96); pointer-events: none; }
/* once faded, take the glass panels out entirely: blurring moving video costs the car's GPU even at opacity 0 */
.player-shell.idle .controls, .player-shell.idle .center-ctl {
  visibility: hidden; transition: opacity .25s, transform .25s var(--ease), visibility 0s .25s; }
.player-shell.idle .top-shade { opacity: 0; }
.player-shell.idle { cursor: none; }
.top-shade { position: absolute; inset: 0 0 auto 0; padding: 16px 20px 36px; background: linear-gradient(#000a, transparent);
  font-size: 18px; font-weight: 600; transition: opacity .25s; pointer-events: none; display: none; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; z-index: 3; }
.player-shell.fs .top-shade { display: block; }
.progress { position: relative; height: 22px; display: flex; align-items: center; cursor: pointer; touch-action: none; }
.progress .rail { position: absolute; left: 0; right: 0; height: 4px; border-radius: 2px; overflow: hidden; background: #ffffff2e;
  transition: height .12s; }
.progress:hover .rail, .progress.drag .rail { height: 6px; }
.progress .ready { position: absolute; left: 0; height: 100%; background: #ffffff52; }
.progress .played { position: absolute; left: 0; height: 100%; background: #fff; }
.progress .knob { position: absolute; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 4px #0008; transform: scale(0); transition: transform .12s; }
.progress:hover .knob, .progress.drag .knob, body.touch .progress .knob { transform: scale(1); }
.progress .hover-time { position: absolute; bottom: 26px; transform: translateX(-50%); background: var(--glass); padding: 4px 9px;
  border-radius: 8px; font-size: 13px; font-weight: 600; display: none; font-variant-numeric: tabular-nums; }
.progress:hover .hover-time, .progress.drag .hover-time { display: block; }
.bar { display: flex; align-items: center; height: 48px; gap: 2px; }
.bar .icon-btn { width: 44px; height: 44px; border-radius: 12px; }
.bar .icon-btn svg { width: 26px; height: 26px; }
.bar .icon-btn:hover { background: #ffffff14; }
.time { font-size: 14px; font-weight: 500; margin-left: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; color: #e6e6ea; }
.time .dur { color: var(--text-2); }
.chap-name { min-width: 0; margin-left: 12px; color: #d6d6da; font-size: 14px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.chap-name:not(:empty)::before { content: "·"; margin-right: 10px; color: var(--text-2); }
.progress .chaps { position: absolute; inset: 0; pointer-events: none; }
.progress .chaps i { position: absolute; top: 0; bottom: 0; width: 3px; margin-left: -1px; background: rgba(20, 20, 24, .9); }
.spacer { flex: 1; }
.vol { display: flex; align-items: center; }
.vol input { width: 0; opacity: 0; transition: width .2s, opacity .2s; accent-color: #fff; }
.vol:hover input, .vol.open input { width: 84px; opacity: 1; margin-right: 6px; }
.live-pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; margin-left: 8px; }
.live-pill::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #e0323c; }
.bar .icon-btn.on { color: #fff; background: var(--accent); }

/* settings sheet: quality as one segmented row, then switches. Never taller than the player. */
.menu { position: absolute; right: 12px; bottom: 82px; width: 300px; max-width: calc(100% - 24px); max-height: calc(100% - 94px);
  overflow-y: auto; overscroll-behavior: contain; padding: 14px; z-index: 5;
  background: rgba(24, 24, 27, .86); border: 1px solid var(--glass-line); border-radius: 18px;
  backdrop-filter: saturate(1.3) blur(20px); -webkit-backdrop-filter: saturate(1.3) blur(20px); box-shadow: 0 12px 40px #0009; }
.menu .menu-head { display: flex; align-items: center; justify-content: space-between; color: var(--text-2); font-size: 12px;
  font-weight: 600; letter-spacing: .8px; text-transform: uppercase; margin: -4px -4px 6px 2px; }
.menu .menu-head button { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); }
.menu .menu-head button:active { background: #ffffff14; }
.menu .menu-head svg { width: 20px; height: 20px; }
.menu .seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 2px; padding: 3px; border-radius: 12px; background: #ffffff10;
  margin-bottom: 8px; }
.menu .seg button { height: 38px; border-radius: 9px; font-weight: 600; font-variant-numeric: tabular-nums; color: #d6d6da;
  transition: background .15s, color .15s; }
.menu .seg button.on { background: #fff; color: #111; }
.menu .menu-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; height: 46px;
  padding: 0 4px; font-size: 15px; text-align: left; border-top: 1px solid var(--line); }
.menu .menu-row:first-of-type { border-top: 0; }
/* a small player (phone, side-by-side): the sheet covers the player and the rows get tighter */
@container (max-width: 560px) {
  .menu { inset: 8px; width: auto; max-width: none; max-height: none; padding: 10px 12px; border-radius: 14px; }
  .menu .menu-head { margin-bottom: 6px; }
  .menu .seg button { height: 34px; }
  .menu .menu-row { height: 38px; font-size: 14px; }
  .controls { left: 8px; right: 8px; bottom: 8px; padding: 2px 6px 0; border-radius: 14px; }
  .bar { height: 40px; gap: 0; }
  .bar .icon-btn { width: 38px; height: 38px; }
  .bar .icon-btn svg { width: 22px; height: 22px; }
  .progress { height: 16px; }
  .center-ctl .round { width: 48px; height: 48px; }
  .center-ctl .round svg { width: 24px; height: 24px; }
  .center-ctl .round.big { width: 62px; height: 62px; }
  .center-ctl .round.big svg { width: 32px; height: 32px; }
  .center-ctl .round span { font-size: 8px; }
  .time { font-size: 12px; margin-left: 4px; }
}
@container (max-width: 640px) { .chap-name { display: none; } }
@container (max-width: 420px) {
  .bar [data-act="theater"] { display: none; }
  .center-ctl { transform: translate(-50%, -72%); gap: 36px; }
  .player-shell.idle .center-ctl { transform: translate(-50%, -68%) scale(.96); }
  .center-ctl .round { width: 42px; height: 42px; }
  .center-ctl .round svg { width: 22px; height: 22px; }
  .center-ctl .round.big { width: 54px; height: 54px; }
  .center-ctl .round.big svg { width: 28px; height: 28px; }
  .menu { padding: 8px 12px; }
  .menu .menu-head { margin-top: -4px; margin-bottom: 2px; }
  .menu .seg { margin-bottom: 4px; }
  .menu .menu-row { height: 36px; }
}

.stats { position: absolute; left: 10px; top: 10px; z-index: 4; margin: 0; padding: 8px 11px; border-radius: 10px;
  background: rgba(0, 0, 0, .7); color: #fff; font: 12px/1.5 ui-monospace, Consolas, monospace; pointer-events: none; }
.endcard { position: absolute; inset: 0; background: rgba(0, 0, 0, .82); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  display: grid; place-items: center; text-align: center; z-index: 6; }
.endcard-inner { width: min(420px, 90%); }
.endcard .thumb { margin: 12px 0; }
.endcard .count { color: var(--text-2); }
.endcard .btns { display: flex; gap: 12px; justify-content: center; margin-top: 14px; }

/* ---------- channel ---------- */
.ch-banner { height: 0; padding-bottom: 16%; border-radius: var(--radius); background: center / cover no-repeat var(--bg-3); margin-top: 16px; }
.ch-head { display: flex; align-items: center; gap: 24px; margin: 24px 0; }
.ch-head .avatar { width: 120px; height: 120px; font-size: 48px; }
.ch-head h1 { margin: 0 0 6px; font-size: 32px; font-weight: 600; letter-spacing: -.4px; }
.tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.tabs span { padding: 12px 0; border-bottom: 2px solid var(--accent); font-weight: 600; }

/* ---------- forms ---------- */
.panel { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; margin-bottom: 18px; max-width: 760px; }
.panel h3 { margin: 0 0 6px; font-size: 18px; font-weight: 600; }
.panel p { color: var(--text-2); margin: 0 0 14px; line-height: 1.5; }
.field { display: flex; gap: 8px; flex-wrap: wrap; }
.field input[type=text], .field input[type=password], .field select, .field textarea {
  flex: 1; min-width: 200px; height: 42px; padding: 0 14px; background: var(--bg-3); border: 1px solid transparent; border-radius: var(--radius-s);
  outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); }
.field textarea { height: 90px; padding: 10px 14px; resize: vertical; }
.subs-manage { display: flex; flex-direction: column; gap: 4px; margin-top: 14px; max-height: 420px; overflow: auto; }
.subs-manage .item { display: flex; align-items: center; gap: 12px; padding: 6px 8px; border-radius: var(--radius-s); }
.subs-manage .item:hover { background: var(--bg-3); }
.subs-manage .item a { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.login { max-width: 360px; margin: 18vh auto 0; text-align: center; }
.login img { width: 72px; height: 72px; }
.login h1 { font-size: 28px; font-weight: 600; margin: 12px 0 24px; }
.login input { width: 100%; height: 50px; text-align: center; font-size: 22px; letter-spacing: 6px; border-radius: var(--radius-s);
  background: var(--bg-3); border: 1px solid transparent; margin-bottom: 14px; outline: none; }
.login .btn { width: 100%; justify-content: center; height: 46px; }
.err { color: #ff7b7b; min-height: 20px; margin-top: 10px; }

/* toast: a dark glass pill at the bottom centre */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 120;
  background: rgba(36, 36, 40, .9); color: var(--text); border: 1px solid var(--glass-line); border-radius: 16px;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  padding: 12px 14px 12px 18px; display: flex; align-items: center; gap: 14px; box-shadow: 0 10px 36px #000a;
  width: max-content; max-width: min(560px, calc(100vw - 48px)); animation: toast-in .25s var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translateX(-50%); } }
.toast .btn { height: 36px; background: #ffffff14; color: var(--text); }
.toast .btn.go { background: var(--accent); color: #fff; }
.toast-text { flex: 1; min-width: 0; }
.toast-text b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.skeleton .thumb, .skeleton .line { background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2)); background-size: 200% 100%;
  animation: shimmer 1.3s infinite; }
.skeleton .line { height: 14px; border-radius: 7px; margin: 6px 0; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1300px) { .watch { grid-template-columns: minmax(0, 1fr) 360px; } }
@media (max-width: 1100px) {
  .watch, .watch.theater { grid-template-columns: minmax(0, 1fr); grid-template-areas: "player" "info" "side"; }
  .secondary { margin-top: 24px; }
}
@media (max-width: 860px) {
  main { padding-left: 12px !important; padding-right: 12px; }
  .row-thumb { width: 46%; }
  .row .title { font-size: 15px; line-height: 21px; }
  .row .snippet, .row .channel-line { display: none; }
  .watch, .watch.theater { padding-top: 0; }
  .player-col { margin: 0 -12px; }
  .player-shell { border-radius: 0; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 24px 14px; }
  .grid .thumb { border-radius: var(--radius-s); }
  .grid .title { font-size: 15px; line-height: 20px; }
  .chips { padding: 10px 12px; margin: 0 -12px 12px; }
}
/* one video per row only on a real phone; a half-width car browser or a tablet gets two or more */
@media (max-width: 600px) {
  .grid { grid-template-columns: 1fr; gap: 24px; }
  .grid .title { font-size: 16px; line-height: 22px; }
}
@media (max-width: 640px) {
  :root { --topbar-h: 56px; }
  .topbar { padding: 0 8px; gap: 4px; }
  .search { display: none; }
  .search-open { display: grid; }
  body.searching .search { display: flex; position: absolute; inset: 6px 8px; height: 44px; background: transparent; }
  body.searching .search-back { display: grid; margin-right: 6px; }
  body.searching .topbar-left, body.searching .topbar-right { visibility: hidden; }
  .avatar.me { display: none; }
  .ch-head .avatar { width: 72px; height: 72px; font-size: 30px; }
  .ch-head h1 { font-size: 22px; }
  .toast { bottom: 12px; max-width: calc(100vw - 24px); }
}

/* ---------- account, playlists, suggestions (added with the YouTube account option) ---------- */
.acct-only { display: none !important; }
body.acct .acct-only { display: flex !important; }
body.mini:not(.drawer) .acct-only { display: none !important; }
.avatar.me { position: relative; overflow: visible; background: var(--bg-3); color: var(--text); }
.avatar.me svg { width: 22px; height: 22px; }
.avatar.me .dot { position: absolute; right: -1px; bottom: -1px; width: 11px; height: 11px; border-radius: 50%;
  background: #30c46c; border: 2px solid var(--bg); }
body.locked .search, body.locked .topbar-right, body.locked #menu-btn, body.locked .sidebar { display: none !important; }

.suggest { position: absolute; top: 50px; left: 0; right: 0; background: rgba(30, 30, 34, .96); border: 1px solid var(--glass-line);
  border-radius: var(--radius); padding: 6px; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 12px 36px #000a; z-index: 60; animation: pop-in .14s ease-out; transform-origin: top center; }
.suggest button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 11px 14px; font-size: 16px; text-align: left;
  border-radius: 10px; }
.suggest button:hover, .suggest button:active { background: #ffffff14; }
.suggest svg { width: 20px; height: 20px; flex-shrink: 0; color: var(--text-2); }
.suggest span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest .suggest-clear { justify-content: center; color: var(--text-2); font-size: 14px; border-top: 1px solid var(--line);
  border-radius: 0 0 10px 10px; margin-top: 4px; }

.page-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.section-title { font-size: 18px; font-weight: 600; margin: 0 0 16px; }
.more { display: flex; justify-content: center; padding: 24px 0; max-width: 1280px; }
.link, .panel a.link { color: var(--link); }
.panel b { color: var(--text); }
.field input[readonly] { color: var(--text-2); }
.thumb.pl::after { content: ""; position: absolute; inset: 0; background: linear-gradient(transparent 55%, #000a); pointer-events: none; }
.thumb.pl .badge { z-index: 1; }
.pl-blank { width: 100%; height: 100%; display: grid; place-items: center; background: linear-gradient(135deg, #1d2a4d, #3e6ae1); }
.pl-blank svg { width: 56px; height: 56px; opacity: .85; }
.grid a.card .card-text { padding: 0 4px; }

.queue { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); margin-bottom: 20px; overflow: hidden; }
.queue-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 14px 16px;
  border-bottom: 1px solid var(--line); font-size: 16px; }
.queue-head b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-list { max-height: 420px; overflow-y: auto; padding: 8px; }
.queue-list .compact { padding: 4px; margin-bottom: 4px; }
.queue-list .compact .thumb { width: 120px; border-radius: 10px; }
.compact.active { background: var(--bg-3); }
.queue-head .btn.small { height: 30px; padding: 0 12px; font-size: 13px; margin-left: auto; border-radius: 10px; }

/* ---------- smoother: page fade, menus, dimmed refresh ---------- */
#view.enter { animation: page-in .22s var(--ease); }
@keyframes page-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.grid { transition: opacity .2s; }
.grid.dim { opacity: .4; pointer-events: none; }
.menu:not([hidden]) { animation: sheet-in .2s var(--ease); transform-origin: bottom right; }
.menu.out, .popmenu.out { animation: pop-out .12s ease-in forwards; }
@keyframes sheet-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes pop-in { from { opacity: 0; transform: scale(.95); } to { opacity: 1; transform: none; } }
@keyframes pop-out { to { opacity: 0; transform: scale(.95); } }
.desc { transition: background .15s; }
.btn { transition: background .15s, transform .1s; }
.btn:active, .chip:active, .icon-btn:active { transform: scale(.95); }
.btn.on { background: var(--text); color: var(--bg); }

/* ---------- ⋮ menu on videos ---------- */
.more-btn { flex-shrink: 0; width: 36px; height: 36px; margin: -4px -8px 0 0; color: var(--text-2); }
.more-btn svg { width: 22px; height: 22px; }
.row .more-btn { position: absolute; top: -4px; right: 0; }
.popmenu { position: fixed; z-index: 130; min-width: 230px; padding: 6px; background: rgba(36, 36, 40, .96);
  border: 1px solid var(--glass-line); border-radius: var(--radius); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 12px 36px #000a; animation: pop-in .14s ease-out; transform-origin: top right; }
.popmenu button { display: flex; align-items: center; gap: 14px; width: 100%; padding: 12px 14px; font-size: 15px; text-align: left; border-radius: 10px; }
.popmenu button:hover, .popmenu button:active { background: #ffffff14; }
.popmenu svg { width: 22px; height: 22px; }

/* ---------- Continue watching ---------- */
/* one row of three: small thumbnail with the title beside it (under it on a phone) */
.shelf { margin-bottom: 26px; }
.shelf h2 { font-size: 12px; font-weight: 600; letter-spacing: .8px; text-transform: uppercase; color: var(--text-2); margin: 4px 0 10px; }
.shelf-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.resume-card { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 8px; border-radius: var(--radius);
  background: var(--bg-2); border: 1px solid var(--line); transition: background .15s, transform .1s; }
.resume-card:hover { background: var(--bg-3); }
.resume-card:active { transform: scale(.98); }
.resume-card .thumb { width: 168px; flex-shrink: 0; border-radius: 10px; }
.resume-card .badge { font-size: 11px; right: 4px; bottom: 7px; }
.resume-card .watched { height: 4px; }
.resume-text { min-width: 0; }
.resume-card .title { font-size: 14px; line-height: 19px; margin: 0 0 3px; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; }
.resume-card .sub { font-size: 12px; }
@media (max-width: 1100px) {
  .resume-card { gap: 10px; padding: 6px; }
  .resume-card .thumb { width: 112px; border-radius: 8px; }
  .resume-card .title { font-size: 13px; line-height: 17px; }
  .resume-card .sub { font-size: 11.5px; }
}
@media (max-width: 760px) {
  .shelf-row { gap: 8px; }
  .resume-card { flex-direction: column; align-items: stretch; gap: 6px; padding: 0; background: none; border: 0; }
  .resume-card .thumb { width: 100%; }
  .resume-card .title { font-size: 12px; line-height: 16px; }
  .resume-card .sub { font-size: 11px; }
}

/* ---------- player extras: captions, notices, sponsor skip, segment marks ---------- */
.captions { position: absolute; left: 0; right: 0; bottom: 86px; text-align: center; pointer-events: none; padding: 0 8%;
  transition: bottom .25s var(--ease); z-index: 3; }
.player-shell.idle .captions { bottom: 22px; }
.captions span { display: inline-block; background: rgba(0, 0, 0, .72); color: #fff; font-size: clamp(15px, 3.4cqw, 30px);
  line-height: 1.35; font-weight: 500; padding: 4px 12px; border-radius: 10px; }
@container (max-width: 560px) { .captions { bottom: 64px; } }
.notice { position: absolute; left: 50%; top: 16px; transform: translateX(-50%); z-index: 6; pointer-events: none;
  padding: 8px 16px; border-radius: 18px; background: var(--glass); border: 1px solid var(--glass-line); white-space: nowrap;
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); font-weight: 600; font-size: 14px;
  animation: notice-in .2s var(--ease); transition: opacity .2s; }
.notice.out { opacity: 0; }
@keyframes notice-in { from { opacity: 0; transform: translate(-50%, -6px); } to { opacity: 1; transform: translateX(-50%); } }
.skip-seg { position: absolute; right: 16px; bottom: 92px; z-index: 5; display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border-radius: 14px; background: rgba(255, 255, 255, .94); color: #111; font-size: 16px; font-weight: 600;
  box-shadow: 0 6px 20px #0008; animation: pop-in .2s ease-out; transition: bottom .25s var(--ease); }
.skip-seg svg { width: 22px; height: 22px; }
.skip-seg:active { transform: scale(.96); }
.player-shell.idle .skip-seg { bottom: 20px; }
@container (max-width: 560px) { .skip-seg { bottom: 68px; right: 10px; padding: 9px 14px; font-size: 14px; } }
.segs { position: absolute; inset: 0; pointer-events: none; }
.segs i { position: absolute; top: 0; bottom: 0; background: #ffd60a; opacity: .9; }

/* ---------- in the car ---------- */
body.car .watch.theater .player-shell { max-height: calc(100vh - var(--topbar-h) - 28px); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 640px) {
  body.searching .suggest { top: 48px; left: 46px; right: 0; }
}
