/* ============================================================
   dinosour — a small, ad-free video site
   ============================================================ */

:root {
  --header-h: 56px;
  --sidebar-w: 240px;
  --mini-w: 72px;
  --red: #ff0033;
  --red-hover: #e6002e;
  --blue: #3ea6ff;

  --bg: #0f0f0f;
  --bg-elevated: #1c1c1c;
  --surface: #212121;
  --surface-2: #272727;
  --surface-3: #303030;
  --hover: rgba(255, 255, 255, .08);
  --hover-strong: rgba(255, 255, 255, .14);
  --text: #f1f1f1;
  --text-2: #aaaaaa;
  --text-3: #717171;
  --border: #303030;
  --border-soft: #222;
  --shadow: 0 4px 24px rgba(0, 0, 0, .45);
  --radius: 12px;
  --ring: 0 0 0 2px var(--bg), 0 0 0 4px var(--blue);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --surface: #f2f2f2;
  --surface-2: #ebebeb;
  --surface-3: #dddddd;
  --hover: rgba(0, 0, 0, .06);
  --hover-strong: rgba(0, 0, 0, .1);
  --text: #0f0f0f;
  --text-2: #606060;
  --text-3: #909090;
  --border: #e2e2e2;
  --border-soft: #ededed;
  --shadow: 0 6px 24px rgba(0, 0, 0, .12);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Roboto", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-y: scroll;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
svg { display: block; }

.icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}
.icon.fill { fill: currentColor; stroke: none; }

:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }

::selection { background: rgba(62, 166, 255, .35); }

* { scrollbar-width: thin; scrollbar-color: var(--text-3) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: transparent; border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
*:hover::-webkit-scrollbar-thumb { background: var(--text-3); background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------- layout */

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px 0 8px;
  background: var(--bg);
  z-index: 120;
}

.topbar-left { display: flex; align-items: center; gap: 4px; flex: none; }
.topbar-center { flex: 1; display: flex; justify-content: center; min-width: 0; padding: 0 24px; }
.topbar-right { display: flex; align-items: center; gap: 6px; flex: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 4px;
  border-radius: 10px;
  margin-right: 8px;
}
.brand:hover { background: var(--hover); }
.brand-mark {
  width: 32px; height: 23px;
  display: grid; place-items: center;
  background: var(--red);
  border-radius: 7px;
  box-shadow: 0 1px 0 rgba(0,0,0,.2);
}
.brand-mark svg { width: 18px; height: 18px; fill: #fff; }
.brand-name {
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -.7px;
  line-height: 1;
}

.icon-btn {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text);
  transition: background .15s ease;
}
.icon-btn:hover { background: var(--hover); }
.icon-btn:active { background: var(--hover-strong); }

.sidebar {
  position: fixed;
  top: var(--header-h);
  bottom: 0;
  left: 0;
  width: var(--sidebar-w);
  padding: 6px 12px 24px;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg);
  z-index: 90;
  transition: width .18s ease, transform .22s cubic-bezier(.4,0,.2,1);
}
.sidebar-inner { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 20px;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  font-size: 14px;
  white-space: nowrap;
  color: var(--text);
  transition: background .12s ease;
}
.nav-item:hover { background: var(--hover); }
.nav-item.active { background: var(--surface-2); font-weight: 500; }
.nav-item .icon { width: 22px; height: 22px; }
.nav-item .nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  padding: 2px 7px;
  border-radius: 99px;
}
.nav-divider { height: 1px; background: var(--border-soft); margin: 10px 4px; }
.nav-title {
  font-size: 15px;
  font-weight: 600;
  padding: 10px 12px 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-title .icon { width: 18px; height: 18px; color: var(--text-2); }
.nav-channel .avatar { width: 24px; height: 24px; font-size: 11px; }
.nav-channel { gap: 16px; }

.sidebar-foot {
  margin: 22px 12px 0;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.5;
}
.sidebar-foot p { margin: 0 0 10px; }
.sidebar-credit { opacity: .75; font-size: 11px; }

body.mini .sidebar { width: var(--mini-w); padding: 6px 4px 24px; }
body.mini .sidebar .nav-item {
  flex-direction: column;
  gap: 6px;
  height: auto;
  padding: 16px 0 14px;
  font-size: 10px;
  line-height: 1.2;
  border-radius: 10px;
  text-align: center;
}
body.mini .sidebar .nav-item .icon { width: 24px; height: 24px; }
body.mini .sidebar .nav-badge,
body.mini .sidebar .nav-divider,
body.mini .sidebar .nav-title,
body.mini .sidebar .sidebar-foot,
body.mini .sidebar .nav-channel { display: none; }

.view {
  margin-left: var(--sidebar-w);
  padding-top: var(--header-h);
  min-height: 100vh;
  transition: margin-left .18s ease;
  outline: none;
}
body.mini .view { margin-left: var(--mini-w); }

.scrim {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 110;
  backdrop-filter: blur(1px);
}

.mobile-nav { display: none; }
.library-tabs { display: none; }

/* ---------------------------------------------------------- search */

.search {
  position: relative;
  width: 100%;
  max-width: 640px;
  display: flex;
  align-items: center;
}
.search-box {
  display: flex;
  align-items: center;
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--bg);
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  overflow: hidden;
}
.search-box:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 1px var(--blue);
  background: var(--bg);
}
.search-lead { margin-left: 14px; width: 20px; height: 20px; color: var(--text-2); }
.search-box input {
  flex: 1;
  min-width: 0;
  height: 100%;
  padding: 0 8px 0 12px;
  border: 0;
  background: transparent;
  font-size: 16px;
  outline: none;
}
.search-box input::placeholder { color: var(--text-3); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-clear {
  width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text-2);
  margin-right: 2px;
}
.search-clear:hover { background: var(--hover); }
.search-clear .icon { width: 18px; height: 18px; }
.search-submit {
  width: 64px;
  height: 100%;
  display: grid;
  place-items: center;
  background: var(--surface);
  border-left: 1px solid var(--border);
  color: var(--text);
  transition: background .15s ease;
}
.search-submit:hover { background: var(--surface-2); }
.search-submit .icon { width: 22px; height: 22px; }

.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px 0;
  z-index: 200;
  max-height: min(70vh, 520px);
  overflow-y: auto;
}
.suggestion {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 8px 18px;
  text-align: left;
  font-size: 15px;
}
.suggestion:hover, .suggestion.active { background: var(--hover); }
.suggestion .icon { width: 20px; height: 20px; color: var(--text-2); }
.suggestion .sug-chan { margin-left: auto; font-size: 12px; color: var(--text-3); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 99px;
  background: var(--surface);
  color: var(--text-2);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .2px;
}
.local-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #2ecc71; box-shadow: 0 0 8px rgba(46,204,113,.7); }

/* ---------------------------------------------------------- chips */

.chips-wrap {
  position: sticky;
  top: var(--header-h);
  z-index: 60;
  background: var(--bg);
  padding: 12px 24px;
  margin: 0;
}
.chips {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  scrollbar-width: none;
  padding-bottom: 2px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: background .12s ease, color .12s ease;
}
.chip:hover { background: var(--surface-3); }
.chip.active { background: var(--text); color: var(--bg); }
.chip.active:hover { background: var(--text); opacity: .92; }

/* ---------------------------------------------------------- feed */

.section { padding: 0 24px 8px; }
.section-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0 14px;
}
.section-head h2 { font-size: 20px; font-weight: 700; margin: 0; letter-spacing: -.2px; }
.section-head .icon { width: 24px; height: 24px; }
.shorts-head .icon { color: var(--red); }
.section-head .spacer { flex: 1; }
.section-head .text-btn { color: var(--text-2); font-weight: 600; font-size: 14px; }
.section-head .text-btn:hover { color: var(--text); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 22px 16px;
  padding: 4px 24px 32px;
}

.card { position: relative; min-width: 0; }
.card-thumb-link { display: block; }
.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  isolation: isolate;
}
.thumb img,
.thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity .25s ease;
}
.thumb video {
  position: absolute;
  inset: 0;
  opacity: 0;
  z-index: 1;
}
.thumb.previewing video { opacity: 1; }
.thumb.previewing img { opacity: 0; }
.thumb .duration {
  position: absolute;
  right: 8px;
  bottom: 7px;
  z-index: 2;
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(0, 0, 0, .82);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: .2px;
}
.thumb .watched-bar {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: rgba(255,255,255,.28);
  z-index: 2;
}
.thumb .watched-bar > i {
  display: block;
  height: 100%;
  background: var(--red);
}
.thumb .live-badge {
  position: absolute; right: 8px; bottom: 7px; z-index: 2;
  background: var(--red); color: #fff; font-size: 11px; font-weight: 700;
  padding: 2px 6px; border-radius: 4px; letter-spacing: .6px;
}

.card-details {
  display: flex;
  gap: 12px;
  padding: 12px 0 0;
}
.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.3px;
  user-select: none;
  overflow: hidden;
}
.avatar.lg { width: 40px; height: 40px; font-size: 17px; }
.avatar.xl { width: 128px; height: 128px; font-size: 52px; border: 4px solid var(--bg); }
.card-text { flex: 1; min-width: 0; }
.card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
  line-height: 22px;
  letter-spacing: .05px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.card:hover .card-title { color: var(--text); }
.card-channel {
  display: flex;
  align-items: center;
  gap: 5px;
  margin: 5px 0 1px;
  color: var(--text-2);
  font-size: 14px;
  line-height: 20px;
  min-width: 0;
}
.card-channel .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-channel:hover .name { color: var(--text); }
.card-meta { color: var(--text-2); font-size: 14px; line-height: 20px; }
.verified { width: 14px; height: 14px; flex: none; color: var(--text-2); }

.card-menu {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: rgba(0,0,0,.72);
  color: #fff;
  display: grid;
  place-items: center;
  opacity: 0;
  transform: scale(.9);
  transition: opacity .15s ease, transform .15s ease, background .15s ease;
  backdrop-filter: blur(4px);
}
.card-menu .icon { width: 20px; height: 20px; }
.card:hover .card-menu, .card:focus-within .card-menu { opacity: 1; transform: scale(1); }
.card-menu:hover { background: rgba(0,0,0,.9); }
@media (hover: none) { .card-menu { opacity: 1; transform: none; background: rgba(0,0,0,.6); } }

/* ---------------------------------------------------------- shorts rail */

.shorts { padding: 8px 0 30px; }
.shorts .section-head { padding: 0 24px; }
.shorts-track {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 172px;
  gap: 12px;
  overflow-x: auto;
  padding: 0 24px 8px;
  scroll-snap-type: x proximity;
  scrollbar-width: none;
}
.shorts-track::-webkit-scrollbar { display: none; }
.short-card { scroll-snap-align: start; min-width: 0; }
.short-thumb {
  position: relative;
  aspect-ratio: 9 / 16;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  transition: transform .18s ease;
}
.short-card:hover .short-thumb { transform: scale(1.015); }
.short-thumb img { width: 100%; height: 100%; object-fit: cover; }
.short-thumb::after {
  content: "";
  position: absolute;
  inset: auto 0 0 0;
  height: 65%;
  background: linear-gradient(to top, rgba(0,0,0,.85), transparent);
  pointer-events: none;
}
.short-views {
  position: absolute;
  left: 10px; bottom: 9px; z-index: 2;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  text-shadow: 0 1px 3px rgba(0,0,0,.5);
}
.short-title {
  margin: 9px 2px 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 19px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.short-sub { color: var(--text-2); font-size: 12px; margin-top: 3px; padding: 0 2px; }

/* ---------------------------------------------------------- menus */

.menu {
  position: fixed;
  z-index: 300;
  min-width: 220px;
  padding: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  box-shadow: var(--shadow);
  animation: menu-in .12s ease;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
.menu button, .menu a {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 14px;
  text-align: left;
}
.menu button:hover, .menu a:hover { background: var(--hover); }
.menu .icon { width: 20px; height: 20px; color: var(--text-2); }
.menu .sep { height: 1px; background: var(--border-soft); margin: 6px 4px; }
.menu .checked { margin-left: auto; color: var(--blue); }
.menu .checked .icon { color: var(--blue); }

/* ---------------------------------------------------------- watch page */

.watch {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 402px;
  gap: 24px;
  padding: 24px;
  max-width: 1780px;
  margin: 0 auto;
  align-items: start;
}
.watch-main { min-width: 0; }

/* player */
.player {
  position: relative;
  aspect-ratio: 16 / 9;
  width: 100%;
  background: #000;
  border-radius: 12px;
  overflow: hidden;
  color: #fff;
  user-select: none;
  outline: none;
}
.player.theater { border-radius: 0; }
.player video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}
.player.vertical video { object-fit: contain; }
.player-spinner {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  pointer-events: none;
}
.player.buffering .player-spinner { display: grid; }
.spinner {
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,.22);
  border-top-color: #fff;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.big-play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: transparent;
  opacity: 0;
  transition: opacity .2s ease;
  z-index: 3;
}
.big-play .big-play-btn {
  width: 68px; height: 68px;
  border-radius: 50%;
  background: rgba(0,0,0,.6);
  display: grid;
  place-items: center;
  backdrop-filter: blur(4px);
  transition: transform .15s ease, background .15s ease;
}
.big-play:hover .big-play-btn { transform: scale(1.06); background: rgba(0,0,0,.78); }
.big-play .icon { width: 30px; height: 30px; fill: #fff; stroke: none; margin-left: 3px; }
.player.paused:not(.ended) .big-play { opacity: 1; }

.player-title-fs {
  position: absolute;
  top: 0; left: 0; right: 0;
  padding: 18px 20px 40px;
  background: linear-gradient(to bottom, rgba(0,0,0,.65), transparent);
  font-size: 16px;
  font-weight: 500;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .2s ease, transform .2s ease;
  pointer-events: none;
  z-index: 2;
}
.player:fullscreen .player-title-fs,
.player:-webkit-full-screen .player-title-fs { opacity: 1; transform: none; }
.player:fullscreen .player-title-fs { display: block; }

.controls {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  z-index: 4;
  padding: 40px 12px 8px;
  background: linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,.35) 55%, transparent);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.player.show-controls .controls,
.player.paused .controls,
.player:focus-within .controls,
.player:hover .controls { opacity: 1; transform: none; pointer-events: auto; }
.player.hide-cursor { cursor: none; }

.progress {
  position: relative;
  height: 16px;
  display: flex;
  align-items: center;
  cursor: pointer;
  margin: 0 2px 4px;
  touch-action: none;
}
.progress-track {
  position: relative;
  width: 100%;
  height: 4px;
  border-radius: 99px;
  background: rgba(255,255,255,.28);
  overflow: visible;
  transition: height .1s ease;
}
.progress:hover .progress-track, .progress.dragging .progress-track { height: 6px; }
.progress-buffer {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: rgba(255,255,255,.42);
  border-radius: 99px;
}
.progress-played {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--red);
  border-radius: 99px;
}
.progress-played::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 13px; height: 13px;
  border-radius: 50%;
  background: var(--red);
  transform: translateY(-50%) scale(0);
  transition: transform .1s ease;
}
.progress:hover .progress-played::after, .progress.dragging .progress-played::after { transform: translateY(-50%) scale(1); }
.progress-tip {
  position: absolute;
  bottom: 22px;
  transform: translateX(-50%);
  background: rgba(0,0,0,.85);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 6px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .12s ease;
  white-space: nowrap;
}
.progress:hover .progress-tip, .progress.dragging .progress-tip { opacity: 1; }

.controls-row {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 40px;
}
.pc-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  flex: none;
  transition: background .12s ease;
}
.pc-btn:hover { background: rgba(255,255,255,.14); }
.pc-btn .icon { width: 22px; height: 22px; }
.pc-time {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: rgba(255,255,255,.92);
  margin: 0 8px;
  white-space: nowrap;
}
.pc-spacer { flex: 1; }

.pc-volume { display: flex; align-items: center; }
.pc-vol-slider {
  width: 0;
  opacity: 0;
  transition: width .18s ease, opacity .18s ease;
  overflow: hidden;
}
.pc-volume:hover .pc-vol-slider, .pc-volume:focus-within .pc-vol-slider { width: 66px; opacity: 1; }
input[type="range"].vol {
  -webkit-appearance: none;
  appearance: none;
  width: 56px;
  height: 4px;
  margin: 0 8px 0 2px;
  border-radius: 99px;
  background: linear-gradient(to right, #fff var(--val, 100%), rgba(255,255,255,.3) var(--val, 100%));
  outline: none;
  cursor: pointer;
}
input[type="range"].vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px; height: 12px; border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,.5);
}
input[type="range"].vol::-moz-range-thumb { width: 12px; height: 12px; border: 0; border-radius: 50%; background: #fff; }

.pc-speed-badge { font-size: 11px; font-weight: 700; letter-spacing: .3px; color: #fff; }

.pc-menu {
  position: absolute;
  right: 12px;
  bottom: 62px;
  z-index: 8;
  min-width: 240px;
  padding: 8px;
  border-radius: 12px;
  background: rgba(28,28,28,.96);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  backdrop-filter: blur(12px);
  color: #f1f1f1;
}
.pc-menu[hidden] { display: none; }
.pc-menu-title { padding: 8px 12px 4px; font-size: 12px; font-weight: 700; color: #aaa; letter-spacing: .4px; text-transform: uppercase; }
.pc-menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 14px;
  text-align: left;
  color: #f1f1f1;
}
.pc-menu button:hover { background: rgba(255,255,255,.1); }
.pc-menu .icon { width: 18px; height: 18px; }
.pc-menu .pc-check { margin-left: auto; }
.pc-menu .pc-check .icon { width: 18px; height: 18px; color: #fff; }

.end-card {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 32px;
  background: rgba(0,0,0,.78);
  backdrop-filter: blur(3px);
}
.end-card.visible { display: flex; }
.end-card .end-label { font-size: 13px; color: rgba(255,255,255,.65); margin-bottom: 10px; font-weight: 600; letter-spacing: .5px; text-transform: uppercase; }
.end-card .end-body { display: flex; gap: 16px; align-items: center; max-width: 560px; }
.end-card .end-thumb { width: 168px; aspect-ratio: 16/9; border-radius: 8px; overflow: hidden; flex: none; background: #222; }
.end-card .end-thumb img { width: 100%; height: 100%; object-fit: cover; }
.end-card .end-title { font-size: 17px; font-weight: 600; line-height: 23px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.end-card .end-sub { font-size: 13px; color: rgba(255,255,255,.65); margin-top: 4px; }
.end-actions { display: flex; flex-direction: column; gap: 10px; align-items: center; flex: none; }
.end-count { font-size: 13px; color: rgba(255,255,255,.75); font-variant-numeric: tabular-nums; }
.btn-light {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: 18px;
  background: #fff;
  color: #0f0f0f;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.btn-light:hover { background: #e6e6e6; }
.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 36px;
  padding: 0 16px;
  border-radius: 18px;
  background: rgba(255,255,255,.14);
  color: #fff;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
}
.btn-ghost:hover { background: rgba(255,255,255,.22); }
.btn-ghost .icon, .btn-light .icon { width: 18px; height: 18px; }
.end-progress { width: 100%; height: 3px; background: rgba(255,255,255,.2); border-radius: 99px; overflow: hidden; margin-top: 14px; }
.end-progress > i { display: block; height: 100%; width: 0; background: var(--red); }

/* watch info */
.watch-title {
  margin: 14px 0 6px;
  font-size: 20px;
  line-height: 28px;
  font-weight: 700;
  letter-spacing: -.2px;
}
.watch-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.watch-views { color: var(--text-2); font-size: 14px; }
.watch-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.action-group { display: flex; align-items: center; background: var(--surface); border-radius: 18px; overflow: hidden; }
.action-group .action-btn:first-child { padding-right: 12px; }
.action-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 36px;
  padding: 0 16px;
  background: var(--surface);
  border-radius: 18px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  transition: background .12s ease;
}
.action-btn:hover { background: var(--surface-2); }
.action-btn .icon { width: 20px; height: 20px; }
.action-group .action-btn { background: transparent; border-radius: 0; }
.action-group .action-btn:hover { background: var(--surface-2); }
.action-group .divider { width: 1px; height: 24px; background: var(--border); }
.action-btn.active { color: var(--text); }
.action-btn.active .icon { fill: currentColor; stroke: currentColor; }
.action-btn.liked .icon { color: var(--red); fill: currentColor; }
.action-btn.disliked .icon { color: var(--red); fill: currentColor; }
.action-count { font-variant-numeric: tabular-nums; }

.channel-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  margin-top: 12px;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}
.channel-row .avatar { width: 40px; height: 40px; font-size: 16px; }
.channel-info { min-width: 0; }
.channel-name { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 5px; }
.channel-sub { color: var(--text-2); font-size: 12px; margin-top: 1px; }
.channel-row .action-btn { margin-left: auto; }
.channel-row .icon-btn { margin-left: 4px; }

.desc {
  margin-top: 12px;
  border-radius: 12px;
  background: var(--surface);
  padding: 12px 14px;
  font-size: 14px;
  line-height: 20px;
  cursor: pointer;
  transition: background .12s ease;
}
.desc:hover { background: var(--surface-2); }
.desc-meta { font-weight: 600; margin-bottom: 2px; }
.desc-meta span { font-weight: 400; color: var(--text-2); }
.desc-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.desc:not(.expanded) .desc-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.desc-tags { color: var(--blue); margin-top: 8px; }
.desc-toggle { font-weight: 600; margin-top: 6px; display: inline-block; }
.desc-tags a:hover, .desc-toggle:hover { text-decoration: underline; }

/* comments */
.comments { margin-top: 24px; }
.comments-head { display: flex; align-items: center; gap: 24px; margin-bottom: 18px; }
.comments-head h3 { font-size: 20px; font-weight: 700; margin: 0; }
.comments-head .sort-btn { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.comments-head .sort-btn .icon { width: 18px; height: 18px; }
.comment-form { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 26px; }
.comment-input-wrap { flex: 1; }
.comment-input {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--border);
  padding: 8px 0;
  font-size: 14px;
  outline: none;
  resize: none;
  min-height: 28px;
  max-height: 160px;
  color: var(--text);
}
.comment-input:focus { border-bottom-color: var(--text); }
.comment-form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.btn-text { padding: 8px 14px; border-radius: 18px; font-weight: 600; font-size: 14px; }
.btn-text:hover { background: var(--hover); }
.btn-text.primary { background: var(--blue); color: #0b1120; }
.btn-text.primary:hover { background: #63b8ff; }
.btn-text:disabled { opacity: .4; cursor: default; background: transparent; color: var(--text-2); }
.comment {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}
.comment .avatar { width: 40px; height: 40px; font-size: 16px; }
.comment-body { min-width: 0; flex: 1; }
.comment-line { display: flex; align-items: center; gap: 8px; }
.comment-author { font-weight: 600; font-size: 13px; }
.comment-when { color: var(--text-2); font-size: 12px; }
.comment-text { margin: 3px 0 7px; font-size: 14px; line-height: 20px; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-tools { display: flex; align-items: center; gap: 6px; }
.comment-tools button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-2);
}
.comment-tools button:hover { background: var(--hover); color: var(--text); }
.comment-tools .icon { width: 16px; height: 16px; }
.comment-more { font-weight: 600; font-size: 13px; color: var(--text-2); padding: 6px 0 6px 52px; border-radius: 18px; }
.comment-more:hover { color: var(--text); }

/* related */
.related { min-width: 0; }
.related-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.related-head h2 { font-size: 16px; font-weight: 600; margin: 0; }
.autoplay-toggle { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.switch {
  width: 34px; height: 18px; border-radius: 99px;
  background: var(--surface-3); position: relative; transition: background .15s ease; flex: none;
}
.switch::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%; background: #aaa;
  transition: left .15s ease, background .15s ease;
}
.switch.on { background: rgba(62,166,255,.35); }
.switch.on::after { left: 18px; background: var(--blue); }

.rel-item {
  display: grid;
  grid-template-columns: 168px minmax(0, 1fr);
  gap: 8px;
  margin-bottom: 8px;
  border-radius: 10px;
  padding: 4px;
  margin-left: -4px;
  margin-right: -4px;
}
.rel-item:hover { background: var(--hover); }
.rel-thumb {
  position: relative;
  aspect-ratio: 16/9;
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface);
}
.rel-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rel-thumb .duration {
  position: absolute; right: 5px; bottom: 5px;
  background: rgba(0,0,0,.82); color: #fff;
  font-size: 11px; font-weight: 600; padding: 1px 4px; border-radius: 4px;
}
.rel-thumb .watched-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: rgba(255,255,255,.3); }
.rel-thumb .watched-bar > i { display: block; height: 100%; background: var(--red); }
.rel-text { min-width: 0; padding-top: 2px; }
.rel-title {
  font-size: 14px; font-weight: 500; line-height: 20px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.rel-channel, .rel-meta { color: var(--text-2); font-size: 12px; line-height: 18px; margin-top: 2px; }
.rel-item .rel-more { align-self: start; }

.related-empty { color: var(--text-2); font-size: 14px; padding: 24px 0; }

/* ---------------------------------------------------------- results page */

.results { max-width: 1100px; padding: 24px; margin: 0 auto; }
.results h1 { font-size: 20px; margin: 0 0 20px; font-weight: 700; }
.results h1 span { color: var(--text-2); font-weight: 400; }
.results-head { margin-bottom: 22px; }
.results-head h1 { margin-bottom: 6px; }
.results-sub { color: var(--text-2); font-size: 13px; margin: 0; min-height: 18px; }
.local-hits { margin-bottom: 34px; }
.section-label {
  font-size: 11px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-2); margin: 0 0 12px;
}
.yt-block-head { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.yt-block-head h2 { font-size: 18px; margin: 0; font-weight: 700; }
.yt-status { color: var(--text-2); font-size: 13px; margin: 12px 0; }
.yt-skeleton .thumb { background: var(--surface); }
.yt-skeleton .skel-line { height: 12px; margin-bottom: 10px; }
.btn-more {
  display: block; margin: 6px auto 28px; padding: 10px 22px;
  border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; cursor: pointer;
}
.btn-more:hover { background: var(--hover); }
.btn-more:disabled { opacity: .55; cursor: default; }
.yt-poster {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; opacity: .92;
}
.yt-play {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(0, 0, 0, .18); border: 0; cursor: pointer; padding: 0;
}
.yt-play-btn {
  width: 76px; height: 54px; border-radius: 14px;
  background: rgba(255, 0, 51, .94); color: #fff;
  display: grid; place-items: center;
  transition: transform .15s ease, background .15s ease;
  box-shadow: 0 8px 28px rgba(0, 0, 0, .45);
}
.yt-play-btn .icon { width: 30px; height: 30px; fill: #fff; stroke: none; }
.yt-play:hover .yt-play-btn { transform: scale(1.06); background: var(--red); }
.yt-player .yt-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.yt-player.playing .yt-poster,
.yt-player.playing .yt-play { display: none; }
.result {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 16px;
  margin-bottom: 16px;
  padding: 4px;
  border-radius: 12px;
}
.result:hover { background: var(--hover); }
.result .thumb { border-radius: 10px; }
.result-info { min-width: 0; padding-top: 2px; }
.result-title { font-size: 18px; line-height: 24px; font-weight: 500; margin: 0 0 5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result-meta { color: var(--text-2); font-size: 12px; margin-bottom: 10px; }
.result-channel { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12px; margin-bottom: 10px; }
.result-channel .avatar { width: 24px; height: 24px; font-size: 10px; }
.result-desc { color: var(--text-2); font-size: 12px; line-height: 18px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.result-desc b { color: var(--text); font-weight: 500; }

/* ---------------------------------------------------------- library / list */

.page { max-width: 1280px; margin: 0 auto; padding: 24px; }
.page-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { font-size: 28px; margin: 0; font-weight: 800; letter-spacing: -.6px; display: flex; align-items: center; gap: 12px; }
.page-head h1 .icon { width: 30px; height: 30px; }
.page-head .spacer { flex: 1; }
.page-head .action-btn { }
.history-row {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 8px;
  border-radius: 12px;
}
.history-row:hover { background: var(--hover); }
.history-row .thumb { border-radius: 8px; }
.history-title { font-size: 15px; font-weight: 500; line-height: 21px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.history-sub { color: var(--text-2); font-size: 12px; margin-top: 3px; }
.history-row .icon-btn { color: var(--text-2); }
.history-row .icon-btn:hover { color: var(--text); background: var(--hover); }

/* ---------------------------------------------------------- channel page */

.channel-banner {
  height: 180px;
  border-radius: 16px;
  margin: 24px 24px 0;
  position: relative;
  overflow: hidden;
}
.channel-banner::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(120% 120% at 20% 0%, rgba(255,255,255,.05), transparent 60%);
}
.channel-head {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 40px 24px;
  margin: 0 24px;
}
.channel-head .avatar { margin-top: -56px; }
.channel-head-info { min-width: 0; padding-top: 16px; }
.channel-head h1 { font-size: 32px; margin: 0 0 4px; letter-spacing: -.8px; font-weight: 800; display: flex; align-items: center; gap: 8px; }
.channel-head h1 .verified { width: 20px; height: 20px; }
.channel-facts { color: var(--text-2); font-size: 14px; display: flex; gap: 10px; flex-wrap: wrap; }
.channel-desc { color: var(--text-2); font-size: 14px; margin-top: 8px; max-width: 760px; line-height: 20px; }
.channel-tabs { display: flex; gap: 4px; padding: 0 40px; margin: 16px 24px 0; border-bottom: 1px solid var(--border-soft); }
.channel-tab { padding: 10px 16px; font-weight: 600; font-size: 14px; color: var(--text-2); border-bottom: 2px solid transparent; }
.channel-tab.active { color: var(--text); border-bottom-color: var(--text); }

/* ---------------------------------------------------------- empty / skeleton */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 90px 24px;
  color: var(--text-2);
}
.empty-icon {
  width: 84px; height: 84px;
  border-radius: 50%;
  background: var(--surface);
  display: grid; place-items: center;
  margin-bottom: 20px;
}
.empty-icon .icon { width: 38px; height: 38px; color: var(--text-2); }
.empty h2 { color: var(--text); font-size: 20px; margin: 0 0 8px; }
.empty p { margin: 0 0 20px; max-width: 380px; line-height: 1.55; font-size: 14px; }
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 18px; border-radius: 19px;
  background: var(--text); color: var(--bg);
  font-weight: 600; font-size: 14px;
}
.btn-primary:hover { opacity: .88; }

.skeleton-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 22px 16px; padding: 4px 24px; }
.skel { background: var(--surface); border-radius: 12px; position: relative; overflow: hidden; }
.skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.045), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.4s infinite;
}
[data-theme="light"] .skel::after { background: linear-gradient(90deg, transparent, rgba(0,0,0,.04), transparent); }
@keyframes shimmer { to { transform: translateX(100%); } }
.skel-thumb { aspect-ratio: 16/9; }
.skel-line { height: 12px; border-radius: 6px; margin-top: 10px; }

/* ---------------------------------------------------------- toast */

.toast {
  position: fixed;
  left: 24px;
  bottom: 24px;
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 16px;
  background: #f1f1f1;
  color: #0f0f0f;
  padding: 13px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 6px 24px rgba(0,0,0,.4);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: transform .2s ease, opacity .2s ease;
  max-width: min(440px, calc(100vw - 32px));
}
.toast.show { transform: none; opacity: 1; pointer-events: auto; }
.toast button { font-weight: 700; color: #065fd4; padding: 4px 8px; border-radius: 6px; white-space: nowrap; }
.toast button:hover { background: rgba(0,0,0,.06); }

/* ---------------------------------------------------------- responsive */

@media (max-width: 1400px) {
  .watch { grid-template-columns: minmax(0, 1fr) 360px; }
}
@media (max-width: 1200px) {
  .watch { grid-template-columns: minmax(0, 1fr); }
  .related { margin-top: 8px; }
  .rel-item { grid-template-columns: 168px minmax(0, 1fr); }
}
@media (max-width: 1024px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w) !important; padding: 6px 12px 24px !important; box-shadow: none; }
  .sidebar .nav-item { flex-direction: row !important; gap: 20px !important; height: 40px !important; padding: 0 12px !important; font-size: 14px !important; text-align: left !important; }
  .sidebar .nav-item .icon { width: 22px !important; height: 22px !important; }
  .sidebar .nav-badge, .sidebar .nav-divider, .sidebar .nav-title, .sidebar .sidebar-foot, .sidebar .nav-channel { display: flex !important; }
  .sidebar .nav-divider { display: block !important; }
  .sidebar .nav-title { display: flex !important; }
  .view, body.mini .view { margin-left: 0; }
  body.drawer .sidebar { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .topbar-center { padding: 0 12px; }
}
@media (max-width: 820px) {
  .local-pill { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
  .result { grid-template-columns: 260px minmax(0, 1fr); }
  .watch { padding: 0; }
  .player { border-radius: 0; }
  .watch-title { margin: 14px 16px 6px; font-size: 18px; line-height: 25px; }
  .watch-meta-row { padding: 0 16px; }
  .channel-row { margin: 12px 16px 0; }
  .desc { margin: 12px 16px 0; }
  .comments { margin: 24px 16px 0; }
  .related { padding: 0 16px 24px; }
  .channel-head { padding: 0 24px 20px; margin: 0; }
  .channel-banner { margin: 0 12px; height: 120px; }
  .channel-tabs { padding: 0 12px; margin: 12px 12px 0; }
  .channel-head .avatar { width: 96px; height: 96px; font-size: 38px; }
  .channel-head h1 { font-size: 24px; }
  .page { padding: 16px; }
  .history-row { grid-template-columns: 160px minmax(0,1fr) auto; }
  .end-card { padding: 20px; }
  .end-card .end-body { gap: 12px; }
  .end-card .end-thumb { width: 120px; }
}
@media (max-width: 700px) {
  .topbar { padding: 0 8px; gap: 2px; }
  .brand-name { display: none; }
  .brand { margin-right: 0; padding: 4px; }
  .brand-mark { width: 30px; height: 22px; }
  .topbar-center { padding: 0 4px; }
  .search-box { height: 38px; }
  .search-submit { width: 48px; }
  .search-lead { display: none; }
  .search-box input { padding-left: 16px; font-size: 15px; }
  .search:focus-within .search-box { position: fixed; left: 8px; right: 8px; top: 9px; z-index: 210; }
  .search:focus-within .search-submit { width: 48px; }
  .suggestions { position: fixed; left: 8px; right: 8px; top: 54px; }
  .grid { grid-template-columns: 1fr; gap: 20px; padding: 4px 0 24px; }
  .card-details { padding: 10px 12px 0; }
  .thumb { border-radius: 0; }
  .card-menu { opacity: 1; transform: none; }
  .chips-wrap { padding: 10px 12px; }
  .section { padding: 0 12px 8px; }
  .shorts .section-head { padding: 0 12px; }
  .shorts-track { padding: 0 12px 8px; grid-auto-columns: 150px; }
  .results { padding: 16px 12px; }
  .result { grid-template-columns: 1fr; gap: 10px; }
  .result .thumb { border-radius: 10px; }
  .history-row { grid-template-columns: 140px minmax(0,1fr) auto; gap: 10px; }
  .page-head h1 { font-size: 24px; }
  .watch-actions { margin-left: 0; width: 100%; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
  .watch-actions::-webkit-scrollbar { display: none; }
  .mobile-nav {
    display: flex;
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 100;
    background: var(--bg);
    border-top: 1px solid var(--border-soft);
    padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .mobile-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    color: var(--text-2);
    padding: 5px 14px;
    border-radius: 10px;
    flex: 1;
  }
  .mobile-nav-item.active { color: var(--text); }
  .mobile-nav-item .icon { width: 22px; height: 22px; }
  .view { padding-bottom: 64px; }
  .watch ~ .mobile-nav { }
  .toast { left: 12px; right: 12px; bottom: 76px; max-width: none; }
  .end-card { flex-direction: column; align-items: flex-start; justify-content: center; gap: 18px; }
  .end-card .end-body { max-width: none; }
  .end-actions { flex-direction: row; align-items: center; }
  .pc-time { margin: 0 4px; font-size: 12px; }
  .controls-row .pc-btn { width: 36px; height: 36px; }
  .pc-volume:hover .pc-vol-slider { width: 0; opacity: 0; }
}

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

/* theater mode */
body.theater .watch { grid-template-columns: minmax(0, 1fr); max-width: none; padding: 0 0 24px; }
body.theater .watch-main { max-width: none; }
body.theater .player { border-radius: 0; aspect-ratio: auto; height: calc(100vh - var(--header-h)); }
body.theater .watch-title,
body.theater .watch-meta-row,
body.theater .channel-row,
body.theater .desc,
body.theater .comments { margin-left: auto; margin-right: auto; width: min(100% - 48px, 1280px); }
body.theater .related { width: min(100% - 48px, 1280px); margin: 24px auto 0; }

/* ---------------------------------------------------------- extra bits */

.dim { color: var(--text-3); }

.feed-note {
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  padding: 10px 24px 64px;
}

.short-hint { color: var(--text-3); font-size: 12px; font-weight: 500; }

.channel-strip {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 0 4px 20px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border-soft);
  scrollbar-width: none;
}
.channel-strip::-webkit-scrollbar { display: none; }
.channel-chip {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  flex: none;
  min-width: 230px;
  transition: background .12s ease;
}
.channel-chip:hover { background: var(--hover); }
.channel-chip .avatar { width: 44px; height: 44px; font-size: 17px; }
.cc-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 4px; }
.cc-sub { color: var(--text-2); font-size: 12px; margin-top: 2px; }

.result-count { font-size: 13px; color: var(--text-2); font-weight: 400; margin-left: 8px; }
.page-count { color: var(--text-2); font-size: 13px; }

.tab-count {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-2);
  background: var(--surface);
  padding: 1px 6px;
  border-radius: 99px;
}

.channel-banner-pattern {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.16) 1px, transparent 1px);
  background-size: 20px 20px;
  opacity: .5;
  -webkit-mask-image: linear-gradient(to bottom, #000, transparent 85%);
  mask-image: linear-gradient(to bottom, #000, transparent 85%);
}

.history-info { display: block; min-width: 0; }

.sug-label {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}
.sug-chan {
  flex: none;
  max-width: 40%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.end-main { flex: 1; min-width: 0; }
.end-card .end-title { max-width: 46ch; }

.player:fullscreen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  border-radius: 0;
  background: #000;
}
.player:fullscreen video { width: 100%; height: 100%; }
.player:fullscreen .controls { padding-left: 24px; padding-right: 24px; padding-bottom: 16px; }

.comment-tools button.liked { color: var(--red); }
.comment-tools button.liked .icon { fill: currentColor; stroke: currentColor; }
.comment-tools [data-delete] { margin-left: 2px; }
.comment-tools [data-delete]:hover { color: #ff6b81; }

.menu .icon { flex: none; }
.menu a, .menu button { line-height: 20px; }

.card .avatar-link { flex: none; }

@media (max-width: 700px) {
  .channel-strip { padding: 0 0 16px; }
  .channel-chip { min-width: 200px; padding: 8px 12px; }
  .channel-chip .avatar { width: 36px; height: 36px; font-size: 14px; }
  .feed-note { padding-bottom: 90px; }
  .history-info .history-sub:last-child { display: none; }
  .end-card .end-title { max-width: none; }
}

/* ---------------------------------------------------------- mobile app shell */
/* The phone layout is its own thing: full-bleed feed, compact result rows,
   a sticky player and a five-tab bottom bar. */

@media (max-width: 700px) {
  :root { --header-h: 52px; }
  body { overflow-y: auto; -webkit-tap-highlight-color: transparent; }
  .topbar { height: 52px; padding: 0 8px; gap: 4px; border-bottom: 1px solid var(--border-soft); }
  #menuBtn { display: none; }
  .brand { margin-right: 0; padding: 4px 2px; gap: 7px; }
  .brand-name { display: inline; font-size: 18px; letter-spacing: -.6px; }
  .brand-mark { width: 28px; height: 21px; border-radius: 6px; }
  .brand-mark svg { width: 16px; height: 16px; }
  .topbar-center { padding: 0 4px; }
  .topbar-right { gap: 0; }
  .topbar-right .icon-btn { width: 36px; height: 36px; }
  .search-box { height: 36px; border-color: transparent; background: var(--surface-2); }
  .search-box input { padding-left: 14px; font-size: 14px; }
  .search-lead { display: none; }
  .search-submit { width: 42px; }
  .search:focus-within .search-box {
    position: fixed; left: 8px; right: 8px; top: 8px;
    height: 42px; z-index: 220; background: var(--bg);
    border-color: var(--border); box-shadow: var(--shadow);
  }
  .suggestions { position: fixed; left: 8px; right: 8px; top: 56px; z-index: 219; border-radius: 14px; box-shadow: var(--shadow); }

  .view { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .chips-wrap { padding: 8px 10px; border-bottom: 1px solid var(--border-soft); }
  .chips { gap: 8px; }
  .chip { height: 34px; padding: 0 14px; border-radius: 99px; font-size: 13px; }

  .grid { gap: 22px; padding: 0 0 26px; }
  .card .thumb, .result .thumb { border-radius: 0; }
  .card-details { padding: 10px 12px 0; gap: 10px; }
  .card-details .avatar { width: 32px; height: 32px; font-size: 13px; }
  .card-title { font-size: 15px; line-height: 21px; font-weight: 600; }
  .card-channel, .card-meta { font-size: 12px; line-height: 17px; }
  .card-channel { margin-top: 4px; }
  .card-menu { opacity: 1; transform: none; width: 32px; height: 32px; background: rgba(0, 0, 0, .55); }

  .section { padding: 0 12px 8px; }
  .shorts { padding-top: 4px; }
  .shorts-track { grid-auto-columns: 150px; gap: 10px; padding: 0 12px 10px; scroll-snap-type: x mandatory; }

  .results { padding: 14px 12px 24px; }
  .results-head { margin-bottom: 12px; }
  .results h1 { font-size: 17px; line-height: 23px; margin-bottom: 2px; }
  .results-sub { font-size: 12px; }
  .local-hits { margin-bottom: 22px; }
  .section-label { font-size: 10px; margin-bottom: 8px; }
  .yt-block-head { margin-bottom: 8px; }
  .yt-block-head h2 { font-size: 16px; }
  .result { grid-template-columns: 146px minmax(0, 1fr); gap: 10px; padding: 6px 0; align-items: start; }
  .result .thumb { border-radius: 8px; }
  .result-title { font-size: 14px; line-height: 19px; margin-bottom: 3px; }
  .result-meta { font-size: 11px; margin-bottom: 4px; }
  .result-channel { margin-bottom: 0; gap: 6px; font-size: 11px; }
  .result-channel .avatar { width: 20px; height: 20px; font-size: 9px; }
  .result-desc { display: none; }
  .btn-more { margin-bottom: 16px; }

  .watch { padding: 0; }
  .player { position: sticky; top: var(--header-h); z-index: 50; border-radius: 0; }
  .watch-title { margin: 13px 12px 5px; font-size: 17px; line-height: 24px; }
  .watch-meta-row { padding: 0 12px; gap: 8px; }
  .watch-views { font-size: 12px; }
  .watch-actions {
    width: 100%; margin-left: 0; flex-wrap: nowrap; overflow-x: auto;
    padding: 8px 0 2px; scrollbar-width: none;
  }
  .watch-actions::-webkit-scrollbar { display: none; }
  .action-btn { height: 34px; padding: 0 13px; font-size: 12px; border-radius: 17px; }
  .action-btn .icon { width: 18px; height: 18px; }
  .action-group { border-radius: 17px; }
  .channel-row { margin: 4px 12px 0; padding: 11px 0; }
  .channel-row .avatar { width: 36px; height: 36px; }
  .channel-name { font-size: 14px; }
  .desc { margin: 10px 12px 0; border-radius: 14px; padding: 12px; }
  .comments { margin: 16px 12px 0; }
  .comments-head h3 { font-size: 17px; }
  .related { padding: 16px 12px 0; margin-top: 16px; border-top: 1px solid var(--border-soft); }
  .related-head h2 { font-size: 15px; }
  .rel-item { grid-template-columns: 148px minmax(0, 1fr); gap: 9px; margin-bottom: 10px; }
  .rel-title { font-size: 13px; line-height: 18px; }
  .rel-channel, .rel-meta { font-size: 11px; line-height: 16px; }

  .page { padding: 14px 12px; }
  .page-head { margin-bottom: 14px; }
  .page-head h1 { font-size: 22px; }
  .history-row { grid-template-columns: 138px minmax(0, 1fr) auto; gap: 10px; }
  .history-title { font-size: 14px; line-height: 19px; }

  .mobile-nav { background: var(--bg); padding: 5px 4px calc(5px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border-soft); }
  .mobile-nav-item { gap: 2px; padding: 4px 0 2px; font-size: 10px; font-weight: 500; border-radius: 12px; }
  .mobile-nav-item .icon { width: 23px; height: 23px; }
  .mobile-nav-item.active { color: var(--text); font-weight: 700; }
  .mobile-nav-item.active .icon { color: var(--red); stroke-width: 2; }
  .toast { bottom: calc(80px + env(safe-area-inset-bottom)); }

  .library-tabs {
    display: flex; gap: 8px; padding: 0 12px; margin: 12px 0 14px;
    overflow-x: auto; scrollbar-width: none;
  }
  .library-tabs::-webkit-scrollbar { display: none; }
  .library-tab {
    flex: none; height: 34px; padding: 0 14px; border-radius: 99px;
    background: var(--surface-2); color: var(--text-2);
    font-size: 13px; font-weight: 600; display: flex; align-items: center;
  }
  .library-tab.active { background: var(--text); color: var(--bg); }
}
