:root {
  --bg: #ffffff;
  --bg-raised: #f2f2f2;
  --bg-hover: #e5e5e5;
  --text: #0f0f0f;
  --muted: #606060;
  --border: #e0e0e0;
  --accent: #a855f7;
  --danger: #e5243b;
  --accent-text: #ffffff;
  --link: #065fd4;
  --input-bg: #ffffff;
  --overlay: rgba(0, 0, 0, 0.8);
  --topbar-h: 56px;
  --sidebar-w: 220px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f0f;
    --bg-raised: #272727;
    --bg-hover: #3a3a3a;
    --text: #f1f1f1;
    --muted: #aaaaaa;
    --border: #303030;
    --link: #3ea6ff;
    --input-bg: #121212;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Roboto, "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; color: inherit; }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hidden { display: none !important; }

/* ---------- 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: var(--bg);
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; flex: none; }
.brand { display: inline-flex; align-items: flex-start; gap: 4px; padding: 0 6px; }
.brand-main { display: flex; flex-direction: column; gap: 3px; }
.brand-row { display: flex; align-items: center; gap: 6px; font-weight: 700; font-size: 20px; letter-spacing: -0.5px; line-height: 1; }
.brand .cc { align-self: flex-start; margin: -2px 0 0 -4px; font-size: 10px; font-weight: 400; letter-spacing: 0; color: var(--muted); }
.brand-lines { display: flex; gap: 2px; height: 3px; }
.brand-lines i { flex: 1; border-radius: 2px; }
.brand-lines i:nth-child(1) { background: #e5243b; }
.brand-lines i:nth-child(2) { background: #f58220; }
.brand-lines i:nth-child(3) { background: #fbc02d; }
.brand-lines i:nth-child(4) { background: #7cb342; }
.brand-lines i:nth-child(5) { background: #1e8e3e; }
.brand-lines i:nth-child(6) { background: #00acc1; }
.brand-lines i:nth-child(7) { background: #1e88e5; }
.brand-lines i:nth-child(8) { background: #5e35b1; }
.brand-lines i:nth-child(9) { background: #d81b60; }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent;
  display: grid; place-items: center; cursor: pointer;
}
.icon-btn:hover { background: var(--bg-hover); }

.search { flex: 0 1 600px; display: flex; min-width: 0; }
.search input {
  flex: 1; min-width: 0; height: 40px; padding: 0 16px;
  border: 1px solid var(--border); border-right: 0; border-radius: 20px 0 0 20px;
  background: var(--input-bg); outline: none;
}
.search input:focus { border-color: var(--link); }
.search button {
  width: 64px; height: 40px; border: 1px solid var(--border); border-radius: 0 20px 20px 0;
  background: var(--bg-raised); cursor: pointer; display: grid; place-items: center;
}
.search button svg { width: 20px; height: 20px; }
.search { position: relative; }
.suggest {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 60; max-height: min(60vh, 420px); overflow-y: auto;
  padding: 8px 0; border: 1px solid var(--border); border-radius: 14px; background: var(--bg); box-shadow: 0 8px 28px rgba(0, 0, 0, .22);
}
.suggest-item { display: flex; align-items: center; gap: 12px; padding: 10px 16px; cursor: pointer; font-size: 15px; line-height: 1.3; }
.suggest-item.active { background: var(--bg-hover); }
.suggest-item svg { width: 18px; height: 18px; flex: none; color: var(--muted); fill: none; stroke: currentColor; stroke-width: 2; }
.suggest-item span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 800px) { .suggest { position: fixed; top: 56px; left: 8px; right: 8px; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 16px; border-radius: 18px; border: 1px solid transparent;
  background: var(--bg-raised); cursor: pointer; font-weight: 500; white-space: nowrap;
}
.btn:hover { background: var(--bg-hover); }
.btn svg { width: 20px; height: 20px; }
.btn.primary { background: var(--text); color: var(--bg); }
.btn.primary:hover { opacity: 0.85; }
.btn.outline { background: transparent; border-color: var(--border); color: var(--link); }
.btn.outline:hover { background: var(--bg-raised); }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--bg-hover); }
.btn.danger { color: var(--danger); }
.btn:disabled { opacity: 0.5; cursor: default; }

.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 600; color: #fff; text-transform: uppercase;
  font-size: 15px; user-select: none;
}
.avatar.sm { width: 24px; height: 24px; font-size: 11px; }
.avatar.lg { width: 80px; height: 80px; font-size: 34px; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: 44px; min-width: 220px; padding: 8px 0;
  background: var(--bg-raised); border-radius: 12px; box-shadow: 0 4px 24px rgba(0,0,0,.25);
}
.menu .who { padding: 8px 16px 12px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
.menu .who small { color: var(--muted); display: block; }
.menu a, .menu button {
  display: flex; width: 100%; align-items: center; gap: 12px; padding: 8px 16px;
  background: none; border: 0; cursor: pointer; text-align: left;
}
.menu a:hover, .menu button:hover { background: var(--bg-hover); }
.menu svg { width: 20px; height: 20px; }

/* ---------- sidebar ---------- */
.sidebar {
  position: fixed; top: var(--topbar-h); left: 0; bottom: 0; width: var(--sidebar-w);
  padding: 12px; overflow-y: auto; background: var(--bg); z-index: 20;
}
.sidebar a {
  display: flex; align-items: center; gap: 20px; height: 40px; padding: 0 12px;
  border-radius: 10px; margin-bottom: 2px;
}
.sidebar a:hover { background: var(--bg-raised); }
.sidebar a.active { background: var(--bg-raised); font-weight: 600; }
.scrim { display: none; }

main {
  padding: calc(var(--topbar-h) + 16px) 24px 48px calc(var(--sidebar-w) + 24px);
  outline: none; min-height: 100vh;
}
body.watch-page .sidebar { transform: translateX(-100%); transition: transform .2s; }
body.watch-page main { padding-left: 24px; }
body.watch-page.menu-open .sidebar { transform: none; box-shadow: 0 0 24px rgba(0,0,0,.3); }
body.watch-page.menu-open .scrim, body.menu-open .scrim { display: block; position: fixed; inset: 0; z-index: 15; background: rgba(0,0,0,.4); }
body.menu-collapsed:not(.watch-page) .sidebar { width: 72px; }
body.menu-collapsed:not(.watch-page) .sidebar span { display: none; }
body.menu-collapsed:not(.watch-page) main { padding-left: calc(72px + 24px); }
body:not(.menu-open) .scrim { display: none !important; }
body:not(.watch-page) .scrim { display: none !important; }

/* ---------- chips / headings ---------- */
.page-title { font-size: 20px; font-weight: 700; margin: 0 0 16px; }
.empty {
  text-align: center; padding: 64px 16px; color: var(--muted);
}
.empty svg { width: 64px; height: 64px; stroke-width: 1.2; margin-bottom: 8px; }
.empty h2 { color: var(--text); font-size: 18px; margin: 0 0 6px; }
.empty .btn { margin-top: 16px; }
.empty .btn svg { width: 20px; height: 20px; stroke-width: 1.8; margin: 0; }

/* ---------- video grid ---------- */
.grid {
  display: grid; gap: 40px 16px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.card { display: block; min-width: 0; }
.thumb {
  position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden;
  background: var(--bg-raised); display: block;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.card:hover .thumb img { transform: scale(1.03); }
.thumb .placeholder {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 16px;
  font-weight: 700; font-size: 18px; text-align: center; color: #fff;
}
.thumb .badge {
  position: absolute; right: 8px; bottom: 8px; padding: 1px 4px; border-radius: 4px;
  background: var(--overlay); color: #fff; font-size: 12px; font-weight: 500;
}
.card-meta { display: flex; gap: 12px; margin-top: 12px; }
.card-meta .text { min-width: 0; }
.card-title {
  margin: 0 0 4px; font-size: 16px; font-weight: 600; line-height: 22px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-sub { color: var(--muted); font-size: 14px; }
.card-sub a:hover { color: var(--text); }

/* row style (search results, up next) */
.list { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 16px; }
.row .thumb { width: 360px; flex: none; }
.row .card-title { font-size: 18px; line-height: 26px; }
.row .desc { color: var(--muted); font-size: 12px; margin-top: 8px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.row .channel-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; color: var(--muted); font-size: 12px; }

.upnext .row { gap: 8px; }
.upnext .row .thumb { width: 168px; border-radius: 8px; }
.upnext .row .card-title { font-size: 14px; line-height: 20px; }
.upnext .row .card-sub { font-size: 12px; }

/* ---------- watch page ---------- */
.watch { display: flex; gap: 24px; max-width: 1754px; margin: 0 auto; }
.watch-main { flex: 1; min-width: 0; }
.watch-side { width: 402px; flex: none; }
.player {
  width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; display: block;
}
.player video { width: 100%; height: 100%; display: block; background: #000; }
.watch h1 { font-size: 20px; line-height: 28px; margin: 12px 0 8px; font-weight: 700; word-wrap: break-word; }
.watch-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.owner { display: flex; align-items: center; gap: 12px; min-width: 0; }
.owner-name { font-weight: 600; font-size: 16px; }
.owner small { color: var(--muted); display: block; font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.like-btn.liked { background: var(--text); color: var(--bg); }
.like-btn.liked svg { fill: currentColor; }
.description {
  margin-top: 12px; padding: 12px; border-radius: 12px; background: var(--bg-raised);
  white-space: pre-wrap; word-wrap: break-word;
}
.description .stats { font-weight: 600; margin-bottom: 4px; }

.comments { margin-top: 24px; }
.comments h2 { font-size: 20px; margin: 0 0 24px; }
.comment-form { display: flex; gap: 16px; margin-bottom: 32px; }
.comment-form .field { flex: 1; }
.comment-form textarea {
  width: 100%; resize: none; border: 0; border-bottom: 1px solid var(--border); background: transparent;
  padding: 4px 0; outline: none; min-height: 28px; overflow: hidden;
}
.comment-form textarea:focus { border-bottom: 2px solid var(--text); }
.comment-form .buttons { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.signin-prompt {
  display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 12px;
  background: var(--bg-raised); margin-bottom: 32px; flex-wrap: wrap;
}
.comment { display: flex; gap: 16px; margin-bottom: 20px; }
.comment .head { font-size: 13px; margin-bottom: 2px; }
.comment .head b { font-weight: 600; margin-right: 6px; }
.comment .head span { color: var(--muted); }
.comment .body { white-space: pre-wrap; word-wrap: break-word; }
.comment .del { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 4px 0; font-size: 12px; }
.comment .del:hover { color: var(--danger); }

/* ---------- channel ---------- */
.channel-head { display: flex; align-items: center; gap: 24px; margin: 8px 0 32px; }
.channel-head h1 { margin: 0; font-size: 28px; }
.channel-head p { margin: 4px 0 0; color: var(--muted); }
.owner-tools { display: flex; gap: 6px; margin-top: 8px; }

/* ---------- forms (auth, upload) ---------- */
.panel {
  max-width: 420px; margin: 40px auto; padding: 32px; border: 1px solid var(--border); border-radius: 16px;
}
.panel.wide { max-width: 720px; }
.panel h1 { margin: 0 0 4px; font-size: 24px; }
.panel .lead { margin: 0 0 24px; color: var(--muted); }
.auth-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.auth-head .brand { flex: none; margin-top: 4px; }
.auth-head .brand .brand-name, .auth-head .brand .cc { display: inline !important; }
@media (max-width: 360px) { .auth-head { flex-direction: column-reverse; gap: 12px; } }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-weight: 500; margin-bottom: 6px; }
.form-row input, .form-row textarea {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--input-bg); outline: none;
}
.form-row textarea { min-height: 110px; resize: vertical; }
.form-row input:focus, .form-row textarea:focus { border-color: var(--link); }
.form-row .hint { color: var(--muted); font-size: 12px; margin-top: 4px; }
.error {
  color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent);
  padding: 10px 12px; border-radius: 8px; margin-bottom: 16px;
}
.panel .switch { margin-top: 20px; color: var(--muted); }
.panel .switch a { color: var(--link); }

.dropzone {
  border: 2px dashed var(--border); border-radius: 16px; padding: 40px 16px; text-align: center;
  cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over { border-color: var(--link); background: var(--bg-raised); }
.dropzone .big { width: 120px; height: 120px; border-radius: 50%; background: var(--bg-raised); display: grid; place-items: center; margin: 0 auto 16px; }
.dropzone .big svg { width: 56px; height: 56px; color: var(--muted); }
.dropzone p { margin: 4px 0; }
.dropzone small { color: var(--muted); }
.preview { display: flex; gap: 16px; margin-bottom: 20px; align-items: flex-start; }
.preview video { width: 260px; aspect-ratio: 16/9; background: #000; border-radius: 8px; flex: none; }
.preview .info { min-width: 0; font-size: 13px; color: var(--muted); }
.preview .info b { color: var(--text); display: block; word-break: break-all; }
.progress { height: 6px; background: var(--bg-raised); border-radius: 3px; overflow: hidden; margin: 12px 0 4px; }
.progress div { height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 120px);
  background: var(--text); color: var(--bg); padding: 12px 20px; border-radius: 8px;
  transition: transform .25s; z-index: 50; max-width: calc(100% - 32px);
}
.toast.show { transform: translate(-50%, 0); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .watch { flex-direction: column; }
  .watch-side { width: auto; }
}
@media (max-width: 800px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  body.menu-open .sidebar { transform: none; box-shadow: 0 0 24px rgba(0,0,0,.3); }
  body.menu-open .scrim { display: block !important; position: fixed; inset: 0; z-index: 15; background: rgba(0,0,0,.4); }
  main, body.menu-collapsed:not(.watch-page) main { padding-left: 16px; padding-right: 16px; }
  body.menu-collapsed .sidebar { width: var(--sidebar-w) !important; }
  body.menu-collapsed .sidebar span { display: inline !important; }
  .row { flex-direction: column; gap: 8px; }
  .row .thumb, .upnext .row .thumb { width: 100%; }
  .grid { grid-template-columns: 1fr; gap: 28px; }
  .preview { flex-direction: column; }
  .preview video { width: 100%; }
  .panel { padding: 24px 16px; margin: 16px auto; border: 0; }
}
@media (max-width: 560px) {
  .topbar { gap: 8px; padding: 0 8px; }
  .topbar .brand { padding: 0 2px; }
  .topbar .brand-row { font-size: 17px; gap: 4px; }
  .topbar .brand-row img { width: 24px; height: 17px; }
  .topbar .icon-btn { width: 36px; }
  .search button { width: 44px; }
  .topbar-right .upload-btn span { display: none; }
  .topbar-right .upload-btn { padding: 0 10px; }
  .channel-head { gap: 16px; }
  .channel-head .avatar.lg { width: 56px; height: 56px; font-size: 24px; }
}

/* ---------- admin panel ---------- */
.admin { max-width: 1280px; }
.admin .page-title { display: flex; align-items: center; gap: 10px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a {
  padding: 10px 14px; color: var(--muted); font-weight: 500; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; display: flex; align-items: center; gap: 6px;
}
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--text); }
.tabs .count { background: var(--accent); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 6px; line-height: 18px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.tile-label { color: var(--muted); font-size: 13px; }
.tile-value { font-size: 28px; font-weight: 700; margin: 2px 0; }
.tile-sub { color: var(--muted); font-size: 12px; }
.tile-sub a { color: var(--link); }

.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; margin-bottom: 24px; }
.chart-card { border: 1px solid var(--border); border-radius: 12px; padding: 16px; }
.chart-title { font-weight: 600; margin-bottom: 12px; }
.chart-title span { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: 4px; }
.bars { display: flex; align-items: flex-end; gap: 4px; height: 120px; }
.bar-col { flex: 1; height: 100%; display: flex; align-items: flex-end; }
.bar { width: 100%; min-height: 2px; background: var(--accent); border-radius: 4px 4px 0 0; }
.bar-axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 11px; margin-top: 6px; }
.section-title { font-size: 18px; margin: 8px 0 12px; }
.admin-top { max-width: 640px; }

.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-bottom: 16px; }
.admin-search {
  height: 36px; padding: 0 14px; border-radius: 18px; border: 1px solid var(--border);
  background: var(--input-bg); outline: none; width: 300px; max-width: 100%;
}
.admin-search:focus { border-color: var(--link); }
.seg { display: inline-flex; background: var(--bg-raised); border-radius: 18px; padding: 3px; flex-wrap: wrap; }
.seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 15px; cursor: pointer; font-size: 13px; }
.seg button.active { background: var(--text); color: var(--bg); }

.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: var(--bg-raised); }
.table .num { text-align: right; }
.table .nowrap { white-space: nowrap; }
.table .wrap { min-width: 200px; max-width: 420px; word-wrap: break-word; white-space: pre-wrap; }
.table .link { color: var(--link); }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn { margin-left: 4px; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.cell-user, .cell-video { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.cell-user span, .cell-video span { display: flex; flex-direction: column; min-width: 0; }
.cell-user small, .cell-video small { color: var(--muted); }
.cell-video .thumb { width: 120px; flex: none; border-radius: 8px; }
.cell-video .thumb .placeholder { font-size: 11px; padding: 4px; }
.cell-video b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.pill { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 10px; }
.pill.red { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); }
.pill.green { background: color-mix(in srgb, #1e8e3e 15%, transparent); color: #1e8e3e; }
.pill.blue { background: color-mix(in srgb, var(--link) 15%, transparent); color: var(--link); }
@media (max-width: 560px) {
  .admin-search { width: 100%; }
  .tile-value { font-size: 22px; }
}
.label-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.label-row label { margin-bottom: 0 !important; }
.label-row a, .error a { color: var(--link); font-size: 13px; }
.error a { font-weight: 600; }
.notice { background: var(--bg-raised); padding: 12px 14px; border-radius: 8px; line-height: 1.5; word-wrap: break-word; }

/* ---------- history ---------- */
.history { max-width: 1100px; }
.history-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px; }
.history-head .page-title { margin: 0; }
.history-day { font-size: 18px; margin: 16px 0 0; }
.history-item { display: flex; gap: 8px; align-items: flex-start; }
.history-item .row { flex: 1; min-width: 0; }
.history-item .row .thumb { width: 246px; }
@media (max-width: 800px) { .history-item .row .thumb { width: 100%; } }
.menu .who .brand { display: flex; width: fit-content; padding: 0; margin-bottom: 10px; }
.menu .who b { display: block; }

/* ---------- admin layout ---------- */
body.admin-page .sidebar { transform: translateX(-100%); transition: transform .2s; }
body.admin-page main { padding-left: 24px; }
body.admin-page.menu-open .sidebar { transform: none; box-shadow: 0 0 24px rgba(0,0,0,.3); }
body.admin-page.menu-open .scrim { display: block !important; position: fixed; inset: 0; z-index: 15; background: rgba(0,0,0,.4); }
.admin-layout { display: flex; gap: 28px; align-items: flex-start; }
.admin-nav {
  position: sticky; top: calc(var(--topbar-h) + 16px); width: 230px; flex: none;
  border: 1px solid var(--border); border-radius: 16px; padding: 16px 10px;
}
.admin-brand { padding: 0 8px 14px; border-bottom: 1px solid var(--border); margin-bottom: 10px; }
.admin-brand .brand { padding: 0; display: flex; width: fit-content; }
.admin-tag { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.admin-tag svg { width: 16px; height: 16px; }
.admin-nav nav a, .admin-exit {
  display: flex; align-items: center; gap: 14px; height: 40px; padding: 0 10px; border-radius: 10px; color: var(--text);
}
.admin-nav nav a svg, .admin-exit svg { width: 20px; height: 20px; }
.admin-nav nav a:hover, .admin-exit:hover { background: var(--bg-raised); }
.admin-nav nav a.active { background: var(--text); color: var(--bg); font-weight: 600; }
.admin-nav .count { margin-left: auto; background: var(--accent); color: #fff; border-radius: 10px; font-size: 11px; padding: 0 6px; line-height: 18px; }
.admin-exit { margin-top: 10px; border-top: 1px solid var(--border); border-radius: 0 0 10px 10px; padding-top: 4px; height: 46px; color: var(--muted); }
.admin-layout .admin { flex: 1; min-width: 0; max-width: none; }
.table code.id { font-family: ui-monospace, Consolas, monospace; font-size: 12px; background: var(--bg-raised); padding: 1px 6px; border-radius: 4px; }
.table small.sub { display: block; color: var(--muted); }
.otp-input { font-size: 24px !important; letter-spacing: 10px; text-align: center; }

.traffic-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.traffic-grid .wide { grid-column: 1 / -1; }
.chart-title a { color: var(--link); }
.barlist { display: flex; flex-direction: column; gap: 6px; }
.barlist-row { position: relative; display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; border-radius: 6px; overflow: hidden; font-size: 13px; }
.barlist-fill { position: absolute; inset: 0 auto 0 0; background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 6px; }
.barlist-name, .barlist-num { position: relative; }
.barlist-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barlist-num { font-weight: 600; font-variant-numeric: tabular-nums; }
.flag { margin-right: 8px; }

.settings-section { border-top: 1px solid var(--border); padding-top: 20px; margin-top: 20px; }
.settings-section h2 { font-size: 17px; margin: 0 0 14px; }
.settings-account { display: flex; gap: 16px; align-items: center; }
.form-row .hint a { color: var(--link); }

@media (max-width: 900px) {
  .admin-layout { flex-direction: column; gap: 16px; }
  .admin-nav { position: static; width: 100%; padding: 10px; }
  .admin-nav nav { display: flex; overflow-x: auto; gap: 4px; }
  .admin-nav nav a { flex: none; }
  .admin-exit { display: none; }
}

/* Small waving Indian flag beside the logo */
.in-flag { width: 27px; height: 18px; stroke: none; stroke-width: 0; flex: none; align-self: flex-start; margin: 1px 0 0 0; transform-origin: left center; filter: drop-shadow(0 1px 1px rgba(0,0,0,.15)); }
@keyframes flag-wave { 0%, 100% { transform: skewY(0deg) scaleX(1); } 50% { transform: skewY(-4deg) scaleX(.94); } }
@media (prefers-reduced-motion: no-preference) { .topbar .in-flag { animation: flag-wave 2.8s ease-in-out infinite; } }
@media (max-width: 560px) { .in-flag { width: 21px; height: 14px; } }

/* Search bar: bold purple border */
.search input { border: 2px solid var(--accent); border-right: 0; }
.search input:focus { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.search button { border: 2px solid var(--accent); }

/* Bot trap field: hidden from people, visible to form-filling bots */
.hp { position: absolute !important; left: -10000px !important; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.turnstile-box:not(:empty) { margin: 4px 0 16px; }

/* ---------- channels ---------- */
img.avatar { object-fit: cover; display: block; background: var(--bg-raised); }
.avatar.xl { width: 120px; height: 120px; font-size: 48px; }
.channel { max-width: 1284px; margin: 0 auto; }
.channel-banner { aspect-ratio: 6.2 / 1; min-height: 90px; border-radius: 16px; background-size: cover; background-position: center; margin-bottom: 20px; }
.channel .channel-head { margin: 0 0 12px; align-items: flex-start; }
.channel-info h1 { font-size: 32px; margin: 0 0 4px; }
.channel-info p { margin: 0 0 6px; color: var(--muted); }
.channel-desc a:hover { color: var(--text); }
.channel-info .owner-tools { margin-top: 12px; gap: 8px; flex-wrap: wrap; }
.channel-tabs { margin-top: 8px; }
.row.featured { margin-bottom: 28px; }
.row.featured .thumb { width: 424px; }
.about { max-width: 760px; }
.about h2 { font-size: 18px; margin: 20px 0 8px; }
.about p { margin: 0 0 8px; }
.about-desc { white-space: pre-wrap; word-wrap: break-word; }
.sub-btn { background: var(--text); color: var(--bg); }
.sub-btn:hover { background: var(--text); opacity: .85; }
.sub-btn.subscribed { background: var(--bg-raised); color: var(--text); }
.owner-wrap { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.ch-art { margin-bottom: 20px; }
.ch-banner-preview {
  aspect-ratio: 4 / 1; border-radius: 12px; background: var(--bg-raised) center / cover no-repeat;
  display: flex; align-items: flex-end; justify-content: flex-end; padding: 10px; margin-bottom: 14px;
}
.ch-avatar-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ch-avatar-row .avatar.xl { width: 88px; height: 88px; font-size: 36px; }
.handle-input { display: flex; align-items: center; border: 1px solid var(--border); border-radius: 8px; background: var(--input-bg); }
.handle-input span { padding-left: 12px; color: var(--muted); }
.handle-input input { border: 0 !important; background: transparent !important; padding-left: 4px !important; }
.handle-input:focus-within { border-color: var(--link); }
@media (max-width: 800px) {
  .row.featured .thumb { width: 100%; }
  .avatar.xl { width: 72px; height: 72px; font-size: 30px; }
  .channel-info h1 { font-size: 22px; }
  .channel-banner { border-radius: 10px; }
}
.tabs { overflow-y: hidden; }

/* ---------- categories, 18+, uploader agreement ---------- */
.chips { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 12px; margin-bottom: 12px; scrollbar-width: thin; }
.chip { flex: none; padding: 6px 12px; border-radius: 8px; background: var(--bg-raised); font-weight: 500; white-space: nowrap; }
.chip:hover { background: var(--bg-hover); }
.chip.active { background: var(--text); color: var(--bg); }
.thumb .badge.age { left: 8px; right: auto; top: 8px; bottom: auto; background: var(--danger); font-weight: 700; }
.cat-link:hover { text-decoration: underline; }
.form-row select {
  width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--input-bg); color: var(--text); font: inherit; outline: none;
}
.form-row select:focus { border-color: var(--link); }
fieldset.form-row { border: 0; padding: 0; margin-left: 0; margin-right: 0; }
fieldset.form-row legend { font-weight: 500; margin-bottom: 6px; padding: 0; }
.choice { display: flex !important; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 8px; cursor: pointer; font-weight: 400 !important; }
.choice:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.choice input { width: auto !important; margin-top: 3px; flex: none; accent-color: var(--accent); }
.choice span { display: flex; flex-direction: column; }
.choice small { color: var(--muted); }
.choice.agree { margin-top: 8px; }
.terms-box {
  max-height: 190px; overflow-y: auto; white-space: pre-wrap; word-wrap: break-word; font-size: 13px; line-height: 1.5;
  padding: 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-raised);
}
.age-gate .age-badge {
  width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 12px;
  background: var(--danger); color: #fff; font-weight: 800; font-size: 22px;
}
.pill:not(.red):not(.green):not(.blue) { background: var(--bg-raised); color: var(--muted); }
.record { border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
.record-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.record-head h2 { margin: 0; font-size: 18px; }
.record h3 { font-size: 14px; margin: 16px 0 8px; }
.record-table { border-collapse: collapse; margin-top: 12px; font-size: 13px; }
.record-table th { text-align: left; color: var(--muted); font-weight: 500; padding: 4px 16px 4px 0; vertical-align: top; white-space: nowrap; }
.record-table td { padding: 4px 0; word-break: break-word; }
.record .terms-box { max-height: none; }
@media print {
  body.print-record .topbar, body.print-record .sidebar, body.print-record .admin-nav, body.print-record .toolbar,
  body.print-record #video-list, body.print-record .page-title, body.print-record .record-head div { display: none !important; }
  body.print-record main { padding: 0 !important; }
  body.print-record .record { border: 0; }
}

/* "Truly Indian" tagline beside the flag */
.truly {
  align-self: flex-start; margin: 0 0 0 4px; white-space: nowrap; line-height: 21px;
  font-family: "Segoe Script", "Brush Script MT", "Lucida Handwriting", "Snell Roundhand", "Dancing Script", cursive;
  font-size: 16px; font-weight: 800; font-style: italic; letter-spacing: .2px;
  background: linear-gradient(90deg, #ff7a00 0%, #ff9933 30%, #1a3a8f 52%, #138808 74%, #0b6b05 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 1px 0 rgba(0,0,0,.08));
}
@media (prefers-color-scheme: dark) {
  .truly { background-image: linear-gradient(90deg, #ffb066 0%, #ff9933 30%, #9db8ff 52%, #5fd35a 74%, #3fbf3a 100%); }
}
@media (max-width: 800px) { .topbar .truly { font-size: 13px; margin-left: 2px; } }
@media (max-width: 560px) { .topbar .truly { display: none; } }
.auth-head .truly, .menu .truly, .admin-brand .truly { display: none; }

/* ---------- watch page: action pills, sheets, phone layout ---------- */
.pill-group { display: inline-flex; border-radius: 18px; background: var(--bg-raised); }
.pill-group .btn { background: transparent; border-radius: 18px; }
.pill-group .btn:first-child { border-radius: 18px 0 0 18px; padding-right: 12px; }
.pill-group .btn:last-child { border-radius: 0 18px 18px 0; padding-left: 12px; border-left: 1px solid var(--border); }
.pill-group .btn:hover { background: var(--bg-hover); }
.like-btn.dislike svg { transform: rotate(180deg); }
.pill-group .like-btn.liked { background: transparent; color: var(--accent); }
.pill-group .like-btn.liked svg { fill: currentColor; }
.btn.icon-only { padding: 0; width: 36px; }
.btn.saved { color: var(--accent); }
.btn.saved svg { fill: currentColor; }
.sub-btn { background: var(--accent); color: #fff; }
.sub-btn:hover { background: var(--accent); }
.meta-line { display: none; }
.comments-preview { display: none; }
.comments-head { display: flex; align-items: center; justify-content: space-between; }
.comments-head h2 { margin: 0 0 24px; }
.comments-close { display: none; }

.sheet-layer { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
.sheet {
  position: relative; width: min(480px, calc(100% - 32px)); max-height: 80vh; overflow-y: auto;
  background: var(--bg); border-radius: 16px; box-shadow: 0 8px 40px rgba(0,0,0,.35); animation: sheet-in .18s ease-out;
}
@keyframes sheet-in { from { transform: translateY(24px); } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 10px 6px 20px; font-size: 16px; }
.sheet-body { padding: 8px 20px 20px; }
.share-row { display: flex; gap: 14px; overflow-x: auto; padding: 4px 0 16px; }
.share-target {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 68px;
  font-size: 12px; background: none; border: 0; cursor: pointer; color: var(--text);
}
.share-target span { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 24px; font-weight: 700; }
.share-url { display: flex; gap: 8px; align-items: center; border: 1px solid var(--border); border-radius: 12px; padding: 6px 6px 6px 12px; }
.share-url input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 13px; }
.sheet-menu { display: flex; flex-direction: column; margin: 0 -12px; }
.sheet-menu button {
  display: flex; align-items: center; gap: 16px; padding: 12px; border: 0; background: none; border-radius: 10px;
  cursor: pointer; text-align: left; font-size: 15px;
}
.sheet-menu button:hover { background: var(--bg-raised); }
.sheet-menu button:disabled { opacity: .5; cursor: default; }
.sheet-menu button.danger { color: var(--danger); }

@media (max-width: 800px) {
  /* Player edge to edge under the top bar. It scrolls away together with the title and description (not pinned). */
  body.watch-page main { padding: var(--topbar-h) 0 32px; }
  body.watch-page .watch { gap: 0; }
  body.watch-page .player { border-radius: 0; position: relative; z-index: 1; }
  .watch-info { padding: 0 12px; }
  .watch-side { padding: 16px 12px 0; }
  .watch h1 { font-size: 18px; line-height: 24px; margin: 12px 0 4px; }
  .meta-line {
    display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; width: 100%; padding: 0 0 10px; border: 0; background: none;
    color: var(--muted); font-size: 12px; text-align: left; cursor: pointer;
  }
  .meta-line b { color: var(--text); font-weight: 600; }
  .watch-bar { flex-direction: column; align-items: stretch; gap: 12px; }
  .owner-wrap { justify-content: space-between; flex-wrap: nowrap; }
  .owner { gap: 10px; }
  .owner > div { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
  .owner-name { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .owner small { display: inline; white-space: nowrap; }
  .owner small::first-line { color: var(--muted); }
  .actions { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; margin: 0 -12px; padding-left: 12px; padding-right: 12px; }
  .actions::-webkit-scrollbar { display: none; }
  .actions .btn, .actions .pill-group { flex: none; }
  .actions .btn { height: 34px; font-size: 13px; }
  .description { display: none; margin-top: 12px; }
  .description.open { display: block; }
  .comments-preview {
    display: flex; flex-direction: column; gap: 8px; width: 100%; margin-top: 14px; padding: 12px; text-align: left;
    border: 0; border-radius: 12px; background: var(--bg-raised); cursor: pointer;
  }
  .cp-head { font-size: 14px; }
  .cp-head span { color: var(--muted); margin-left: 4px; }
  .cp-body { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); min-width: 0; }
  .cp-body span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
  /* Comments open as a sheet over the page, below the player */
  .comments { display: none; }
  body.comments-open .comments {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; top: calc(var(--topbar-h) + 56.25vw); z-index: 25;
    margin: 0; padding: 4px 12px 24px; background: var(--bg); overflow-y: auto; border-radius: 14px 14px 0 0;
    box-shadow: 0 -4px 24px rgba(0,0,0,.25); animation: sheet-in .18s ease-out;
  }
  .comments-head { position: sticky; top: 0; background: var(--bg); padding: 8px 0; z-index: 1; }
  .comments-head h2 { font-size: 16px; margin: 0; }
  .comments-close { display: grid; }
  .comment-form { margin-bottom: 20px; }
  .upnext .row { flex-direction: column; }
  .upnext .row .thumb { width: 100%; border-radius: 12px; }
  .upnext .row .card-title { font-size: 15px; }
  /* Sheets slide up from the bottom on phones */
  .sheet-layer { align-items: flex-end; }
  .sheet { width: 100%; border-radius: 16px 16px 0 0; max-height: 75vh; }
}
/* Plain-text version of the page for search engines and screen readers; never drawn on screen. */
.seo-fallback { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }

/* ---------- video visibility ---------- */
.thumb .badge.vis { right: 8px; top: 8px; bottom: auto; background: var(--overlay); }
.sheet-menu button > span { display: flex; flex-direction: column; gap: 2px; }
.sheet-menu button small { color: var(--muted); font-size: 12px; }
.sheet-menu button.current { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.owner-tools .btn svg { width: 16px; height: 16px; }

/* Big outline icons on empty pages (e.g. "No videos yet") in the site's violet */
.empty > svg { color: var(--accent); }

/* Sign in / sign up / reset cards: "Truly Indian" on its own line under the logo and flag */
.auth-head .brand { display: inline-grid; grid-template-columns: auto auto; column-gap: 4px; row-gap: 2px; align-items: start; }
.auth-head .truly { display: block; grid-column: 1 / -1; justify-self: end; margin: 0; font-size: 15px; line-height: 20px; }
.auth-head > div:first-child { flex: 1; min-width: 0; }

/* ---------- policy page & bottom-of-menu link ---------- */
.sidebar { display: flex; flex-direction: column; }
.sidebar a { flex: none; }
.sidebar .sidebar-bottom { margin-top: auto; border-top: 1px solid var(--border); border-radius: 0 0 10px 10px; padding-top: 6px; height: 46px; color: var(--muted); }
.sidebar .sidebar-bottom.active, .sidebar .sidebar-bottom:hover { color: var(--text); }
.policy { max-width: 760px; line-height: 1.6; font-size: 15px; }
.policy h1 { font-size: 26px; margin: 0 0 4px; }
.policy h2 { font-size: 18px; margin: 28px 0 8px; }
.policy p { margin: 0 0 10px; }
.policy ul { margin: 0 0 12px; padding-left: 22px; }
.policy li { margin-bottom: 6px; }
.policy-link { color: var(--link); font-weight: 400; font-size: 13px; margin-left: 6px; }

/* ---------- password eye ---------- */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 44px !important; }
.pw-eye {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 36px;
  display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 50%;
}
.pw-eye:hover { color: var(--text); background: var(--bg-raised); }
.pw-eye svg { width: 20px; height: 20px; }

/* ---------- Shorts shelf (home) ---------- */
.shelf { margin: 28px 0; padding: 4px 0 8px; border-top: 4px solid var(--bg-raised); border-bottom: 4px solid var(--bg-raised); }
.shelf-title { display: flex; align-items: center; gap: 8px; font-size: 20px; margin: 16px 0 12px; }
.shelf-title svg { color: var(--accent); width: 26px; height: 26px; }
.shelf-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 12px; scrollbar-width: thin; }
.short-card { flex: none; width: 180px; }
.short-thumb { position: relative; display: block; aspect-ratio: 9 / 16; border-radius: 12px; overflow: hidden; background: var(--bg-raised); }
.short-thumb img, .short-thumb .placeholder { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.short-text { position: absolute; left: 0; right: 0; bottom: 0; padding: 28px 10px 10px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.8)); display: flex; flex-direction: column; gap: 2px; }
.short-text b { font-size: 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.short-text small { font-size: 12px; opacity: .9; }

/* ---------- Shorts player (full-height swipe feed) ---------- */
body.shorts-page main { padding: var(--topbar-h) 0 0 var(--sidebar-w); height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }
.shorts { height: 100%; overflow-y: auto; scroll-snap-type: y mandatory; scrollbar-width: none; background: #000; }
.shorts::-webkit-scrollbar { display: none; }
.short { position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; display: grid; place-items: center; background: #000; }
.short video { max-width: 100%; height: 100%; aspect-ratio: 9 / 16; object-fit: contain; background: #000; cursor: pointer; }
.short-info { position: absolute; left: 0; right: 72px; bottom: 0; padding: 60px 16px 20px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.7)); pointer-events: none; }
.short-info a { pointer-events: auto; color: #fff; }
.short-channel { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.short-title { display: block; font-size: 15px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.short-actions { position: absolute; right: 8px; bottom: 24px; display: flex; flex-direction: column; gap: 18px; align-items: center; }
.short-actions button, .short-actions a { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: none; color: #fff; font-size: 12px; cursor: pointer; }
.short-actions svg { width: 28px; height: 28px; padding: 10px; box-sizing: content-box; border-radius: 50%; background: rgba(255,255,255,.16); }
.short-actions .liked svg { fill: #fff; background: var(--accent); }

/* ---------- "You" page ---------- */
.you { max-width: 560px; }
.you-head { display: flex; gap: 16px; align-items: center; padding: 8px 0 20px; }
.you-head b { font-size: 20px; display: block; }
.you-head small { color: var(--muted); display: block; }
.you-list { display: flex; flex-direction: column; border-top: 1px solid var(--border); padding-top: 8px; }
.you-list a, .you-list button { display: flex; align-items: center; gap: 20px; height: 48px; padding: 0 8px; border: 0; background: none; border-radius: 10px; font-size: 15px; cursor: pointer; text-align: left; }
.you-list a:hover, .you-list button:hover { background: var(--bg-raised); }

/* ---------- phone layout like the YouTube app ---------- */
.bottomnav, .search-toggle, .search-back { display: none; }
@media (max-width: 800px) {
  /* top bar: logo on the left, search icon and account on the right */
  #menu-btn { display: none; }
  .topbar { padding: 0 6px 0 10px; gap: 4px; }
  .topbar .truly { display: none; }
  .topbar .brand { padding: 0 2px; }
  .search { display: none; }
  .search-toggle { display: grid; margin-left: auto; }
  .topbar-right .upload-btn { display: none; }
  .topbar-right { gap: 2px; }
  .topbar-right .btn.outline span { display: none; }
  .topbar-right .btn.outline { padding: 0 10px; border: 0; }
  body.search-open .topbar-left, body.search-open .search-toggle, body.search-open .topbar-right { display: none; }
  body.search-open .search { display: flex; flex: 1; }
  body.search-open .search-back { display: grid; flex: none; }
  body.search-open .search button[type="submit"] { width: 48px; }

  /* bottom bar */
  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; height: calc(56px + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px); background: var(--bg); border-top: 1px solid var(--border);
  }
  .bottomnav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; color: var(--text); min-width: 0; }
  .bottomnav a svg { width: 24px; height: 24px; }
  .bottomnav a.active { color: var(--accent); font-weight: 700; }
  .bottomnav a.active svg { stroke-width: 2.4; }
  .bottomnav .bn-plus svg { width: 26px; height: 26px; padding: 7px; box-sizing: content-box; border-radius: 50%; background: var(--bg-raised); }
  .bottomnav .bn-plus.active svg { background: var(--accent); color: #fff; }
  main { padding-bottom: calc(56px + 24px + env(safe-area-inset-bottom, 0px)) !important; }
  .toast { bottom: calc(56px + 16px + env(safe-area-inset-bottom, 0px)); }
  body.comments-open .bottomnav { display: none; }

  /* home feed: category chips stick under the top bar, videos run edge to edge */
  .chips { position: sticky; top: var(--topbar-h); z-index: 12; background: var(--bg); margin: -16px -16px 8px; padding: 10px 12px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { padding: 6px 12px; font-size: 13px; }
  .grid { gap: 20px; }
  .grid .card .thumb { border-radius: 0; margin: 0 -16px; }
  .grid .card .thumb img { border-radius: 0; }
  .grid .card-meta { margin-top: 10px; }
  .grid .card-title { font-size: 15px; line-height: 20px; }
  .grid .card-sub { font-size: 12px; display: inline; }
  .grid .card-sub + .card-sub::before { content: " • "; }
  .shelf { margin: 20px -16px; padding: 0 0 4px 12px; }
  .shelf-row { padding-right: 12px; scrollbar-width: none; }
  .shelf-row::-webkit-scrollbar { display: none; }
  .short-card { width: 42vw; max-width: 200px; }

  /* Shorts fill the screen between the top bar and the bottom bar */
  body.shorts-page main { padding: var(--topbar-h) 0 0 !important; height: calc(100vh - 56px - env(safe-area-inset-bottom, 0px)); height: calc(100dvh - 56px - env(safe-area-inset-bottom, 0px)); }
  .short video { width: 100%; aspect-ratio: auto; object-fit: contain; }
}
.search .search-back { border: 0 !important; background: none; width: 40px; height: 40px; border-radius: 50%; }
.search .search-back { display: none; }
@media (max-width: 800px) { body.search-open .search .search-back { display: grid; flex: none; } }

.admin-warning { margin-bottom: 16px; }
.admin-warning a { text-decoration: underline; }

.panel-inline { max-width: 460px; }

/* ---------- admin: visitors ---------- */
.visitors { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.visitor { border: 1px solid var(--border); border-radius: 12px; }
.visitor[open] { background: color-mix(in srgb, var(--bg-raised) 50%, transparent); }
.visitor summary { display: grid; grid-template-columns: 1.1fr 1.6fr 1.3fr .9fr; gap: 12px; align-items: center; padding: 10px 14px; cursor: pointer; list-style: none; font-size: 13px; }
.visitor summary::-webkit-details-marker { display: none; }
.visitor summary:hover { background: var(--bg-raised); border-radius: 12px; }
.visitor summary small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.visitor summary > span { min-width: 0; }
.v-who { display: grid; grid-template-columns: auto 1fr; column-gap: 8px; align-items: center; }
.v-who small { grid-column: 2; }
.avatar.guest { background: var(--bg-hover); color: var(--muted); }
.v-timeline { list-style: none; margin: 0; padding: 4px 14px 12px; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.v-timeline li { display: grid; grid-template-columns: 76px 84px 1fr; gap: 8px; align-items: baseline; }
.v-timeline time { white-space: nowrap; }
.v-timeline time { color: var(--muted); font-variant-numeric: tabular-nums; }
.v-timeline .pill { text-align: center; }
.v-detail { word-break: break-word; }
@media (max-width: 800px) {
  .visitor summary { grid-template-columns: 1fr 1fr; }
  .v-timeline li { grid-template-columns: 48px 1fr; }
  .v-timeline .pill { display: none; }
}


/* ---------- player fits the video's real shape, so there are no black bars ---------- */
.player.sized { --maxh: calc(100vh - 220px); aspect-ratio: var(--ar); width: min(100%, calc(var(--maxh) * var(--ar))); margin: 0 auto; }
.player.sized video { object-fit: contain; }
/* Phones: no black box around or below the video; the page shows only the picture itself. */
@media (max-width: 800px) {
  body.watch-page .player.sized { --maxh: 62vh; }
  body.watch-page .player, body.watch-page .player video { background: transparent; }
}
/* Shorts on a computer: an upright card the exact shape of the video, on the normal page background */
@media (min-width: 801px) {
  .shorts { background: var(--bg); }
  .short { background: var(--bg); padding: 12px 0; }
  .short video { aspect-ratio: var(--ar, 0.5625); height: 100%; width: auto; max-width: calc(100% - 180px); object-fit: contain; border-radius: 14px; background: #000; }
  .short-info { left: 50%; right: auto; transform: translateX(-50%); width: min(420px, 60%); bottom: 12px; border-radius: 0 0 14px 14px; padding: 60px 16px 16px; }
  .short-actions { right: calc(50% - 300px); bottom: 32px; }
  .short-actions button, .short-actions a { color: var(--text); }
  .short-actions svg { background: var(--bg-raised); }
}
.hint.counter { text-align: right; }
.settings-account #photo-preview .avatar { width: 80px; height: 80px; }
.sheet select, .sheet textarea, .sheet input:not([type="radio"]):not([type="checkbox"]) { width: 100%; }

/* ---------- install the app (You page) ---------- */
.you-install { color: var(--accent); font-weight: 600; }
.you-install span { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.you-install small { color: var(--muted); font-size: 12px; font-weight: 400; }
.install-help { text-align: left; }
.install-help .brand, .install-help > a:first-child { margin-bottom: 8px; }
.install-help ol { margin: 12px 0 4px; padding-left: 22px; line-height: 1.9; }
.you-list .you-install { height: auto; min-height: 56px; padding: 8px; }

/* ---------- Your videos (manage uploads) ---------- */
.mv { max-width: 900px; }
.mv-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 4px; }
.mv-head .page-title { margin: 0; }
.mv-head .page-title small { font-size: 14px; font-weight: 400; color: var(--muted); margin-left: 6px; }
.mv-list { display: flex; flex-direction: column; }
.mv-row { display: flex; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border); }
.mv-thumb { flex: 0 0 200px; max-width: 40%; }
.mv-thumb .thumb { display: block; }
.mv-text { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 4px; }
.mv-title { font-weight: 600; font-size: 15px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mv-actions { display: flex; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.mv-actions .btn svg { width: 16px; height: 16px; }
.mv-actions .btn.danger { color: var(--danger); }
@media (max-width: 600px) { .mv-thumb { flex-basis: 130px; } .mv-row { gap: 10px; } }

/* ---------- You page: bordered install card + YouTube-style rows of videos ---------- */
.you { max-width: 900px; }
.install-card { display: flex; align-items: center; gap: 14px; margin: 12px 0; padding: 14px; border: 3px solid var(--accent); border-radius: 16px;
  background: color-mix(in srgb, var(--accent) 8%, transparent); }
.install-card img { border-radius: 12px; flex: none; }
.install-card .install-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.install-card b { font-size: 17px; font-weight: 800; }
.install-card small { color: var(--muted); font-size: 12.5px; }
.you-list .install-card .btn { height: 40px; padding: 0 18px; gap: 8px; font-weight: 700; border-radius: 20px; flex: none; background: var(--accent); color: #fff; }
.you-list .install-card .btn:hover { background: var(--accent); filter: brightness(1.08); }
.install-card .btn svg { width: 18px; height: 18px; }
@media (max-width: 380px) { .install-card { flex-wrap: wrap; } .you-list .install-card .btn { width: 100%; justify-content: center; } }
.you-shelf { margin: 0 0 22px; }
.you-shelf-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.you-shelf-head h2 { font-size: 18px; margin: 0; }
.you-shelf-row { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.mini { flex: 0 0 210px; min-width: 0; scroll-snap-align: start; display: flex; flex-direction: column; }
.mini .thumb { border-radius: 10px; }
.mini-title { margin-top: 8px; font-size: 14px; font-weight: 600; line-height: 19px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini-sub { color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 800px) {
  .you-shelf-row { margin: 0 -16px; padding: 0 16px 6px; scrollbar-width: none; }
  .you-shelf-row::-webkit-scrollbar { display: none; }
  .mini { flex-basis: 156px; }
}
/* video grid on computers: never more than 5 columns, like YouTube */
@media (min-width: 801px) { .grid { grid-template-columns: repeat(auto-fill, minmax(max(300px, 19%), 1fr)); } }

/* ---------- support contact below Policy ---------- */
.sidebar a.sidebar-support { height: auto; align-items: flex-start; padding: 8px 12px 10px; color: var(--muted); }
.sidebar a.sidebar-support svg { margin-top: 2px; }
.sidebar-support span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.sidebar-support b { color: var(--text); font-size: 14px; }
.sidebar-support small { font-size: 12px; line-height: 16px; overflow-wrap: anywhere; }
.sidebar-support small:first-of-type { color: var(--link); }
.you-list a.you-support { height: auto; min-height: 56px; padding: 8px; }
.you-support span { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.you-support b { font-weight: 600; overflow-wrap: anywhere; }
.you-support small { color: var(--muted); font-size: 12px; }

/* ---------- placeholders while a page loads (like YouTube) ---------- */
.sk { background: var(--bg-raised); border-radius: 8px; position: relative; overflow: hidden; }
.sk::after { content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--text) 7%, transparent), transparent); animation: sk-shine 1.3s infinite; }
@keyframes sk-shine { to { transform: translateX(100%); } }
@media (prefers-reduced-motion: reduce) { .sk::after { animation: none; } }
.sk-thumb { aspect-ratio: 16 / 9; border-radius: 12px; }
.sk-meta { display: flex; gap: 12px; margin-top: 12px; }
.sk-avatar { width: 36px; height: 36px; border-radius: 50%; flex: none; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; padding-top: 2px; }
.sk-line { height: 14px; width: 90%; }
.sk-line.short { width: 55%; }
.sk-line.wide { width: 70%; height: 20px; margin-top: 16px; }
.boot-watch { max-width: 1100px; }
.boot-watch .sk-player { aspect-ratio: 16 / 9; border-radius: 12px; max-height: 70vh; width: 100%; }
.boot-watch .sk-line.short { margin-top: 10px; }
.boot-spin { display: grid; place-items: center; min-height: 40vh; }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--bg-raised); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 800px) {
  .boot .grid .sk-thumb { border-radius: 0; margin: 0 -16px; }
  .boot-watch .sk-player { border-radius: 0; margin: 0 -16px; width: calc(100% + 32px); }
}

/* ---------- Shorts: same player controls as the watch page, and always fitted to the window ---------- */
.short { grid-template-rows: minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); justify-items: center; }
.short video { min-height: 0; max-height: 100%; cursor: auto; }
/* keep the title and the buttons clear of the seek bar */
.short-info { bottom: 0; padding-bottom: 84px; background: linear-gradient(transparent, rgba(0,0,0,.55) 45%, transparent); }
.short-actions { bottom: 96px; }
@media (min-width: 801px) {
  .short video { width: auto; height: 100%; max-width: calc(100% - 180px); }
  .short-info { bottom: 12px; padding-bottom: 76px; border-radius: 0; background: linear-gradient(transparent, rgba(0,0,0,.5) 45%, transparent); }
  .short-actions { bottom: 96px; }
}
@media (min-width: 801px) { .short-info { background: none; text-shadow: 0 1px 3px rgba(0,0,0,.9), 0 0 8px rgba(0,0,0,.6); width: min(340px, 50%); } }

/* ---------- admin: one user's view ---------- */
.uv-head { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.uv-head .avatar.xl { flex: none; }
.uv-id { min-width: 0; flex: 1; }
.uv-id h2 { margin: 0 0 8px; font-size: 22px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.uv-facts { border-collapse: collapse; font-size: 14px; }
.uv-facts th { text-align: left; font-weight: 500; color: var(--muted); padding: 3px 16px 3px 0; vertical-align: top; white-space: nowrap; }
.uv-facts td { padding: 3px 0; overflow-wrap: anywhere; }
.uv-actions { margin-top: 14px; gap: 8px; flex-wrap: wrap; }
.uv-actions .btn.danger { color: var(--danger); }
.cell-user small + small { display: block; }

/* ---------- live video ---------- */
.live-stage { position: relative; background: #000; border-radius: 14px; overflow: hidden; margin: 12px 0; max-height: 62vh; display: grid; place-items: center; }
.live-stage video { width: 100%; max-height: 62vh; object-fit: contain; display: block; background: #000; }
.live-badge { position: absolute; left: 12px; top: 12px; background: #e5243b; color: #fff; font-weight: 800; font-size: 12px; letter-spacing: .06em; padding: 3px 9px 3px 20px; border-radius: 6px; z-index: 2; }
.live-badge::before { content: ""; position: absolute; left: 8px; top: 50%; width: 7px; height: 7px; margin-top: -3.5px; border-radius: 50%; background: #fff; animation: live-dot 1.2s infinite; }
@keyframes live-dot { 50% { opacity: .25; } }
.live-clock, .live-viewers { position: absolute; top: 12px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 6px; z-index: 2; }
.live-clock { right: 12px; }
.live-viewers { left: 78px; }
.live-viewers:empty { display: none; }
.live-flip { position: absolute; right: 12px; bottom: 12px; background: rgba(0,0,0,.6); color: #fff; border: 0; }
.btn.live-end, .btn.primary.live-end { width: 100%; height: 44px; background: #e5243b; color: #fff; font-weight: 700; margin-top: 4px; }
.btn.live-end:hover, .btn.primary.live-end:hover { background: #e5243b; filter: brightness(1.08); }
.live-panel .btn svg { width: 18px; height: 18px; }
.live-note { position: absolute; left: 12px; right: 12px; bottom: 56px; background: rgba(0,0,0,.75); color: #fff; padding: 10px 12px; border-radius: 10px; font-size: 14px; z-index: 2; text-align: center; }
.player.is-live { position: relative; }
.thumb .badge.live { background: #e5243b; font-weight: 800; letter-spacing: .05em; }

/* ---------- channel banner: never wider than the screen ---------- */
/* (a minimum height combined with a fixed shape used to force a 558px width, wider than a phone) */
.channel-banner { aspect-ratio: auto; min-height: 0; height: clamp(84px, 16vw, 200px); width: auto; max-width: 100%; }

/* ---------- phones: nothing may be wider than the screen ---------- */
@media (max-width: 800px) {
  /* stacked rows must take the row's width, not the width of their longest content */
  .watch-bar { flex-wrap: nowrap; }
  .watch-bar > * { min-width: 0; max-width: calc(100% + 24px); }
  .owner-wrap { max-width: 100%; }
  .owner { min-width: 0; }
  .owner .owner-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
/* safety net: if any element is ever too wide, it is cut off instead of pushing the whole page sideways */
html, body { overflow-x: clip; }
main { max-width: 100vw; }

/* ---------- search: "showing the closest videos" line ---------- */
.search-note { display: flex; align-items: center; gap: 10px; max-width: 1100px; margin: 0 0 16px; padding: 10px 14px; border-radius: 12px; background: var(--bg-raised); color: var(--muted); font-size: 14px; }
.search-note svg { width: 18px; height: 18px; flex: none; }
.search-note span { min-width: 0; overflow-wrap: anywhere; }
.search-note b { color: var(--text); }

/* ---------- admin: selective export of agreement records ---------- */
.ag-export { flex-wrap: wrap; gap: 8px; align-items: center; margin-top: -4px; }
.ag-export .btn svg, .uv-actions .btn svg { width: 16px; height: 16px; }
.ag-links { display: block; font-size: 12px; color: var(--muted); margin-top: 4px; white-space: nowrap; }
.ag-links a { color: var(--link); }
.table input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }

/* ---------- player control bar on computers: play, volume, time ... speed, full screen ---------- */
.player.pc, .short-frame.pc { position: relative; outline: none; }
.pc video { cursor: pointer; }
.pc-bar { position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; padding: 26px 12px 6px; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.72)); transition: opacity .2s; }
.pc.pc-idle .pc-bar { opacity: 0; pointer-events: none; }
.pc.pc-idle video { cursor: none; }
.pc-row { display: flex; align-items: center; gap: 4px; height: 40px; }
.pc-btn { width: 38px; height: 38px; flex: none; display: grid; place-items: center; border: 0; background: none; color: #fff; border-radius: 50%; cursor: pointer; padding: 0; font: inherit; }
.pc-btn:hover { background: rgba(255,255,255,.16); }
.pc-btn svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.pc-speed { width: auto; min-width: 44px; padding: 0 8px; border-radius: 18px; font-size: 13px; font-weight: 700; }
.pc-time { font-size: 13px; font-weight: 500; margin-left: 8px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pc-gap { flex: 1; }
.pc-bar input[type="range"] { -webkit-appearance: none; appearance: none; background: transparent; cursor: pointer; margin: 0; height: 16px; --p: 0%; }
.pc-seek { display: block; width: 100%; }
.pc-vol { width: 76px; flex: none; }
.pc-bar input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--accent) var(--p), rgba(255,255,255,.35) var(--p)); }
.pc-bar input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--accent) var(--p), rgba(255,255,255,.35) var(--p)); }
.pc-vol::-webkit-slider-runnable-track { background: linear-gradient(to right, #fff var(--p), rgba(255,255,255,.35) var(--p)) !important; }
.pc-vol::-moz-range-track { background: linear-gradient(to right, #fff var(--p), rgba(255,255,255,.35) var(--p)) !important; }
.pc-bar input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 13px; height: 13px; border-radius: 50%; background: var(--accent); margin-top: -4.5px; border: 0; }
.pc-bar input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border-radius: 50%; background: var(--accent); border: 0; }
.pc-vol::-webkit-slider-thumb { background: #fff !important; }
.pc-vol::-moz-range-thumb { background: #fff !important; }
.pc-seek:hover::-webkit-slider-runnable-track { height: 6px; }
.pc-seek:hover::-webkit-slider-thumb { margin-top: -3.5px; }
.pc-big { position: absolute; left: 50%; top: 50%; width: 68px; height: 68px; margin: -34px 0 0 -34px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; display: grid; place-items: center; cursor: pointer; z-index: 2; }
.pc-big svg { width: 34px; height: 34px; }
.pc-big:hover { background: var(--accent); }
.pc-wait { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; z-index: 2; }
.pc-wait .spinner { border-color: rgba(255,255,255,.3); border-top-color: #fff; width: 44px; height: 44px; }
.pc.pc-full { width: 100vw; height: 100vh; max-height: none; background: #000; border-radius: 0; display: grid; place-items: center; }
.pc.pc-full video { width: 100%; height: 100%; max-width: none; max-height: none; object-fit: contain; border-radius: 0; aspect-ratio: auto; }
/* Shorts: the frame hugs the video so the bar lies exactly over it */
.short-frame { position: relative; display: flex; justify-content: center; align-items: center; width: 100%; height: 100%; min-height: 0; min-width: 0; }
.short-frame video { max-height: 100%; }
@media (min-width: 801px) {
  .short-frame { display: inline-flex; width: auto; max-width: calc(100% - 180px); border-radius: 14px; overflow: hidden; }
  .short .short-frame video { max-width: 100%; }
  .short-frame.pc .pc-bar { padding-left: 8px; padding-right: 8px; }
  .short-frame.pc .pc-vol { width: 54px; }
  /* with our own bar the title and buttons do not need to stay so far above the bottom edge */
}

/* ---------- searchable select (category) ---------- */
.combo { position: relative; }
.combo-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; margin: 0; padding: 0; border: 0; }
.combo-input { width: 100%; padding-right: 44px !important; text-overflow: ellipsis; }
.combo-toggle { position: absolute; right: 2px; top: 2px; bottom: 2px; width: 40px; border: 0; background: none; color: var(--muted); display: grid; place-items: center; cursor: pointer; border-radius: 8px; }
.combo-toggle:hover { color: var(--text); background: var(--bg-raised); }
.combo-toggle svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.combo-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 30; margin: 0; padding: 6px; list-style: none; max-height: 264px; overflow-y: auto; overscroll-behavior: contain;
  background: var(--bg); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 8px 28px rgba(0,0,0,.18); }
.combo-list li { padding: 11px 12px; border-radius: 8px; cursor: pointer; font-size: 15px; line-height: 1.3; }
.combo-list li.active, .combo-list li:hover { background: var(--bg-raised); }
.combo-list li.chosen { font-weight: 700; color: var(--accent); }
.combo-list li.combo-none { color: var(--muted); cursor: default; background: none; }

/* ---------- creator badges ---------- */
.user-badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px 2px 6px; border-radius: 12px; font-size: 12px; font-weight: 700; line-height: 18px; white-space: nowrap;
  background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.user-badge svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.user-badge.top_viewed { background: #fff4d6; color: #8a5a00; border-color: #f0c040; }
.user-badge.top_liked { background: #ffe3ec; color: #b0124a; border-color: #f48fb1; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .user-badge.top_viewed { background: #3a2c05; color: #ffd76a; border-color: #8a6a10; }
  :root:not([data-theme="light"]) .user-badge.top_liked { background: #3d0f20; color: #ff9dbd; border-color: #8a2a4c; }
}
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.badge-row.small { margin: 2px 0; }
.badge-row.small .user-badge { font-size: 11px; padding: 0 7px 0 5px; }
/* ---------- admin statistics ---------- */
.stats-range { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 8px; }
.stats-range label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--muted); }
.stats-range input[type="date"] { height: 34px; padding: 0 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); font: inherit; }
.stats-head { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 20px 0 8px; }
.stats-head .section-title { margin: 0 auto 0 0; }
.stats-head .btn svg { width: 16px; height: 16px; }
.table tr.leader td { background: color-mix(in srgb, #f0c040 14%, transparent); }

/* ---------- admin panel on phones: every page keeps to the screen width (wide tables scroll inside their own box) ---------- */
@media (max-width: 900px) {
  .admin-layout { align-items: stretch; }
  .admin-layout .admin, .admin-layout .admin-nav { min-width: 0; width: 100%; max-width: 100%; box-sizing: border-box; }
  .admin .table-wrap { max-width: 100%; }
  .admin .seg { max-width: 100%; }
  .stats-range label { flex: 1 1 140px; }
  .stats-range input[type="date"] { flex: 1; min-width: 0; }
}

/* Admin > Video details: short rows that fit the screen; the rest opens under a row with "Details" */
.vd-table .cell-video { min-width: 0; }
.vd-table .cell-video .thumb { width: 88px; }
.vd-table td, .vd-table th { padding-left: 8px; padding-right: 8px; }
.vd-table .vd-by { max-width: 170px; overflow-wrap: anywhere; }
.vd-table .vd-status .pill { margin: 1px 0; }
.vd-table tr.vd-more td { background: var(--bg-raised); padding: 14px 16px; }
.vd-table tr.vd-more:hover { background: none; }
.vd-facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 20px; margin: 0 0 14px; }
.vd-facts dt { font-size: 12px; color: var(--muted); }
.vd-facts dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.vd-actions { display: flex; flex-wrap: wrap; gap: 8px; }
@media (max-width: 1250px) { .vd-table .vd-sm { display: none; } }
@media (max-width: 800px) { .vd-table .vd-md { display: none; } .vd-table .cell-video .thumb { width: 64px; } .vd-facts { grid-template-columns: 1fr 1fr; } }
@media (max-width: 500px) { .vd-table .vd-xs { display: none; } .vd-table td, .vd-table th { padding-left: 6px; padding-right: 6px; } .vd-table .cell-video .thumb { width: 56px; } .vd-table .cell-video { gap: 8px; } .vd-table .row-actions .btn { margin-left: 0; padding-left: 8px; padding-right: 8px; } }

/* Your videos: find by name and choose the order */
.mv-tools { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 0 0 14px; }
.mv-tools input[type="search"] { flex: 1 1 220px; min-width: 0; height: 40px; padding: 0 14px; border: 1px solid var(--border); border-radius: 20px; background: var(--input-bg); color: inherit; font: inherit; outline: none; }
.mv-tools input[type="search"]:focus { border-color: var(--accent); }
.mv-sort { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--muted); white-space: nowrap; min-width: 0; max-width: 100%; }
.mv-sort select { min-width: 0; max-width: 100%; text-overflow: ellipsis; height: 40px; padding: 0 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--input-bg); color: var(--text); font: inherit; }

/* All videos (A to Z) */
.av { max-width: 900px; }
.av-filter { width: 100%; height: 40px; padding: 0 14px; margin: 0 0 10px; border: 1px solid var(--border); border-radius: 20px; background: var(--input-bg); color: inherit; font: inherit; outline: none; }
.av-filter:focus { border-color: var(--accent); }
.av-letters { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 14px; }
.av-letters a { min-width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: var(--bg-raised); font-weight: 600; font-size: 14px; }
.av-letters a:hover { background: var(--bg-hover); }
.av-group { scroll-margin-top: 70px; }
.av-group h2 { font-size: 18px; margin: 18px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border); }
.av-group ul { list-style: none; margin: 0; padding: 0; }
.av-group li { padding: 8px 0; border-bottom: 1px solid var(--border); }
.av-group li a { font-weight: 500; overflow-wrap: anywhere; }
.av-group li a:hover { color: var(--link); }
.av-group li small { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.av-pager { display: flex; align-items: center; gap: 12px; margin: 18px 0; }

/* Up next heading and the "Next Play" switch (on the player and above Up next) */
.upnext-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0 0 10px; font-size: 16px; }
.np-switch { display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 6px 0 12px; border: 1px solid var(--border); border-radius: 16px; background: var(--bg-raised); color: var(--text); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.np-knob { position: relative; width: 34px; height: 20px; border-radius: 10px; background: var(--border); transition: background .15s; }
.np-knob::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.3); transition: transform .15s; }
.np-switch.on .np-knob { background: var(--accent); }
.np-switch.on .np-knob::after { transform: translateX(14px); }
.player { position: relative; }
.np-onplayer { position: absolute; top: 10px; right: 10px; z-index: 4; height: 30px; background: rgba(0,0,0,.55); color: #fff; border-color: rgba(255,255,255,.25); backdrop-filter: blur(4px); }
.np-onplayer .np-knob { background: rgba(255,255,255,.35); }
.np-onplayer.on .np-knob { background: var(--accent); }
.np-count { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 16px; text-align: center; color: #fff; background: rgba(0,0,0,.72); }
.np-count small { font-size: 14px; opacity: .85; }
.np-count .np-title { font-size: 17px; max-width: 90%; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.np-actions { display: flex; gap: 10px; margin-top: 4px; }
@media (max-width: 800px) { .np-onplayer { top: 8px; right: 8px; height: 28px; font-size: 12px; } }
.pc.pc-idle .np-onplayer { opacity: 0; pointer-events: none; transition: opacity .2s; }
.np-count .btn { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.35); }
.np-count .btn.primary { background: #fff; color: #111; border-color: #fff; }
/* Next Play: never on the video. Phones: in the top bar beside the 9line logo and flag (watch page only).
   Laptops: only next to "Up next". */
.np-head { display: none; }
@media (max-width: 800px) {
  .np-head { display: inline-flex; flex: none; height: 28px; gap: 6px; padding: 0 4px 0 9px; margin-left: 8px; font-size: 12px; }
  .np-head .np-knob { width: 28px; height: 16px; }
  .np-head .np-knob::after { width: 12px; height: 12px; }
  .np-head.on .np-knob::after { transform: translateX(12px); }
}

/* Admin > Categories: existing categories like the one being typed */
#cat-add { flex-wrap: wrap; }
.cat-match { flex: 1 0 100%; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.cat-match .cat-dup { color: var(--danger, #c62828); font-weight: 600; }
.cat-match .cat-note, .cat-match .cat-ok { color: var(--muted); }
.cat-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-chips .chip { cursor: pointer; border: 1px solid var(--border); font: inherit; font-size: 13px; }
.cat-chips .chip small { color: var(--muted); margin-left: 4px; }
.cat-chips .chip.dup { border-color: var(--danger, #c62828); color: var(--danger, #c62828); }
#cat-list tr.flash td { animation: catflash 1.6s ease; }
@keyframes catflash { 0%, 40% { background: color-mix(in srgb, var(--accent) 22%, transparent); } 100% { background: transparent; } }

/* Admin > Categories: two views */
.cat-tabs { margin: 0 0 6px; }
.cat-grouped tr.cat-letter th { font-size: 15px; color: var(--text); background: var(--bg-raised); padding: 8px 12px; }
.cat-grouped tr.cat-word td { font-size: 12px; color: var(--muted); padding: 6px 12px 2px 24px; border-bottom: 0; }
.cat-grouped tr.in-group td:first-child { padding-left: 28px; border-left: 3px solid var(--accent); }
.upnext-sep { margin: 14px 0 8px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 13px; font-weight: 600; color: var(--muted); }

/* Admin: Types inside a category, and changing a video's category / type */
.types-row > td { background: var(--bg-raised); }
.types-box { display: flex; flex-direction: column; gap: 8px; padding: 6px 4px; }
.types-table { background: var(--bg); border-radius: 8px; }
.type-add { flex-wrap: wrap; margin: 0; }
.vd-settype { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.vd-settype label { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.vd-settype select { height: 32px; border: 1px solid var(--border); border-radius: 8px; background: var(--input-bg); color: var(--text); padding: 0 8px; }
@media (max-width: 800px) { .types-box { max-width: calc(100vw - 56px); overflow-x: auto; } .types-table td { padding: 6px; } }
/* Admin > Categories > Order on the site: types under their category */
.cat-order tr.type-line td { padding-top: 6px; padding-bottom: 6px; background: var(--bg-raised); }
.cat-order tr.type-line .btn { transform: scale(.9); }
.cat-order .type-name { display: inline-block; padding-left: 22px; position: relative; }
.cat-order .type-name::before { content: '↳'; position: absolute; left: 4px; color: var(--muted); }
.form-row select:disabled { opacity: .65; cursor: not-allowed; }
.channel-details { margin: 6px 0 0; max-width: 640px; color: var(--text); font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
/* Phones: the only Next Play switch is the one in the top bar beside the logo and flag */
@media (max-width: 800px) { .upnext-head .np-switch { display: none; } }
.sort-th { background: none; border: 0; padding: 0; font: inherit; color: inherit; cursor: pointer; white-space: nowrap; }
.sort-th.on { color: var(--text); }
.eg-table tfoot th { border-top: 2px solid var(--border); color: var(--text); }

/* Admin > User engagement: the list of subscribers under a user */
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--link); cursor: pointer; text-decoration: underline; }
.subs-row > td { background: var(--bg-raised); }
.subs-box { display: flex; flex-direction: column; gap: 8px; padding: 6px 4px; }
.subs-box .table { background: var(--bg); border-radius: 8px; }

/* Admin > Subscriptions */
.sb-row { cursor: pointer; }
.sb-detail { margin: 0 0 16px; }
.sb-detail h3 { margin: 14px 0 6px; }

/* The next set of videos is loading (shown at the end of a list) */
.more-mark { display: grid; place-items: center; min-height: 56px; grid-column: 1 / -1; }
.more-mark .spinner { width: 26px; height: 26px; }

/* Admin > Categories: related categories */
.rel-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 14px; padding: 6px 0; }
.rel-item { display: flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }
.rel-item input { width: 16px; height: 16px; }

/* 9Line logo (picture). Laptop 36px high, phone 30px. On a dark screen it sits on a small white card so the dark letters stay readable. */
.brand { align-items: center; }
.brand-logo { display: block; height: 40px; width: auto; }
@media (max-width: 800px) { .topbar .brand-logo { height: 30px; } }
@media (max-width: 360px) { .topbar .brand-logo { height: 26px; } }
.auth-head .brand-logo, .menu .brand-logo, .admin-brand .brand-logo, .install-help .brand-logo { height: 32px; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-logo { background: #fff; border-radius: 8px; padding: 2px 6px; } }
:root[data-theme="dark"] .brand-logo { background: #fff; border-radius: 8px; padding: 2px 6px; }

/* Admin > user: unlimited uploads */
.ul-set { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-left: 6px; }
.ul-set select, .ul-set input { height: 30px; border: 1px solid var(--border); border-radius: 8px; background: var(--input-bg); color: var(--text); padding: 0 8px; font: inherit; font-size: 13px; }

/* Admin > Categories: order numbers and the Edit form */
.order-no { display: inline-grid; place-items: center; min-width: 26px; height: 22px; padding: 0 6px; margin-right: 8px; border-radius: 11px; background: var(--bg-raised); border: 1px solid var(--border); font-size: 12px; font-weight: 700; color: var(--muted); vertical-align: 1px; }
.order-no.small { min-width: 20px; height: 18px; font-size: 11px; margin-right: 6px; }
.cat-edit-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.cat-edit-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.cat-edit-fields .ce-order { width: 90px; height: 36px; border: 1px solid var(--border); border-radius: 8px; padding: 0 8px; background: var(--input-bg); color: var(--text); font: inherit; }

/* Admin > Categories: the video number opens the list of those videos */
.link-btn.vcount { background: none; border: 0; padding: 2px 6px; border-radius: 6px; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.link-btn.vcount:hover { background: var(--bg-raised); }
.vlist-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 8px; }
.vlist-head .btn { margin-left: auto; }
.vlist-row .cell-video .thumb { width: 96px; flex: none; }

/* Admin > Categories: styles under a type */
.styles-box { margin: 4px 0 4px 24px; border-left: 3px solid var(--border); }
.style-line td:nth-child(2) { padding-left: 48px; }
.style-name { color: var(--muted); font-size: 13px; }

/* Shorts: loading circle over the video while it waits for data */
.short-frame { position: relative; }
.short-wait { position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none; }
.short-wait.hidden { display: none; }
.short-wait .spinner { width: 44px; height: 44px; border-width: 4px; }

/* Message box: fully hidden when not showing (a long message used to leave a dark strip at the bottom on phones) */
.toast { transform: translate(-50%, calc(100% + 140px)); opacity: 0; visibility: hidden; pointer-events: none; transition: transform .25s, opacity .25s, visibility 0s linear .25s; }
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; pointer-events: auto; transition: transform .25s, opacity .25s, visibility 0s; }
/* "Tap for sound": shown on the video when it had to start without sound */
.unmute-btn { position: absolute; top: 12px; left: 12px; z-index: 6; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px 8px 10px; border: 0; border-radius: 999px; background: rgba(0, 0, 0, .72); color: #fff; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.unmute-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; }

/* Phones: an upright (portrait) video uses the full width of the screen, like a Short, instead of a narrow column with
   empty space on both sides. Its height stops a little above the bottom so the title and buttons start on screen;
   a very tall video loses a thin strip at the top and bottom instead of getting side bars. Full screen shows it whole. */
@media (max-width: 800px) {
  body.watch-page .player.sized.tall { width: 100%; aspect-ratio: auto; height: min(calc(100vw / var(--ar)), calc(100vh - var(--topbar-h, 56px) - 110px)); }
  @supports (height: 100svh) { body.watch-page .player.sized.tall { height: min(calc(100vw / var(--ar)), calc(100svh - var(--topbar-h, 56px) - 110px)); } }
  body.watch-page .player.sized.tall video { object-fit: cover; }
  body.watch-page .player.sized.tall video:fullscreen, body.watch-page .player.sized.tall:fullscreen video { object-fit: contain; }
}

/* Like / Comment / Share on an upright video on the phone watch page (above the player's own control bar) */
.watch-actions { display: none; }
@media (max-width: 800px) {
  body.watch-page .player.tall .watch-actions { display: flex; right: 8px; bottom: 64px; gap: 14px; z-index: 5; }
  body.watch-page .player.tall .watch-actions svg { width: 24px; height: 24px; padding: 9px; background: rgba(0, 0, 0, .38); }
  body.watch-page .player.tall .watch-actions .liked svg { background: var(--accent); }
  body.watch-page .player.tall .watch-actions span { text-shadow: 0 1px 3px rgba(0, 0, 0, .8); }
}
/* Continuous in the Shorts feed: phones use the switch in the top bar; computers have it with the buttons */
.short-actions .np-short { flex-direction: row; font-size: 11px; height: 26px; padding: 0 4px 0 8px; gap: 5px; background: rgba(255, 255, 255, .16); border-radius: 999px; color: #fff; }
.short-actions .np-short .np-knob { width: 26px; height: 15px; }
@media (max-width: 800px) { .short-actions .np-short { display: none; } }
@media (min-width: 801px) { .short-actions .np-short { background: var(--bg-raised); color: var(--text); border: 1px solid var(--border); } }

/* "Next Play" beside "Continuous" for short videos: phones in the top bar (Shorts feed, and upright videos on the watch
   page); computers with the Shorts buttons */
.np-next-head { display: none; }
@media (max-width: 800px) {
  body.shorts-page .np-next-head, body.watch-page.watch-tall .np-next-head { display: inline-flex; align-items: center; gap: 3px; flex: none; height: 28px; margin-left: 6px; padding: 0 9px 0 6px; border: 1px solid var(--border); border-radius: 14px; background: var(--bg-raised); color: var(--text); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
  .np-next-head svg { width: 16px; height: 16px; }
}
.short-actions .np-short-next { flex-direction: row; font-size: 11px; height: 26px; padding: 0 9px 0 6px; gap: 3px; border-radius: 999px; }
.short-actions .np-short-next svg { width: 16px; height: 16px; padding: 0; background: none; }
@media (max-width: 800px) { .short-actions .np-short-next { display: none; } }
@media (min-width: 801px) { .short-actions .np-short-next { background: var(--bg-raised); color: var(--text); border: 1px solid var(--border); } }
/* Phones with both Continuous and Next in the top bar: a slightly smaller logo and a round Next button, so search and
   the account button still fit */
@media (max-width: 800px) {
  body.shorts-page .topbar:has(.np-next-head) .brand-logo, body.watch-page.watch-tall .topbar:has(.np-next-head) .brand-logo { height: 24px; }
  body.shorts-page .np-next-head span, body.watch-page.watch-tall .np-next-head span { display: none; }
  body.shorts-page .np-next-head, body.watch-page.watch-tall .np-next-head { width: 28px; padding: 0; justify-content: center; margin-left: 4px; }
  body.shorts-page .np-head, body.watch-page.watch-tall .np-head { margin-left: 6px; }
}
/* Shorts on a laptop / computer: Continuous and Next Play only beside the Like / Comment / Share buttons (bigger and
   easy to see); the top-bar pair is for phones only */
@media (min-width: 801px) {
  .short-actions .np-short, .short-actions .np-short-next { height: 32px; font-size: 13px; font-weight: 600; }
  .short-actions .np-short .np-knob { width: 30px; height: 18px; }
}


/* Loading: a small, quiet circle over the picture (no big overlay) */
.pc-wait .spinner, .short-wait .spinner { width: 30px; height: 30px; border-width: 3px; border-color: rgba(255, 255, 255, .25); border-top-color: rgba(255, 255, 255, .85); }
/* Going from one video to the next: the old details fade a little until the next video's page is drawn */
#app.switching .watch-info, #app.switching .watch-side { opacity: .45; transition: opacity .15s; pointer-events: none; }

/* Notice page: the admin's points in a bordered box */
.notice-box { max-width: 720px; margin: 24px auto; padding: 20px 24px; border: 2px solid var(--accent); border-radius: 12px; background: var(--bg); }
.notice-title { display: flex; align-items: center; line-height: 1.25; gap: 10px; margin: 0 0 14px; font-size: 22px; }
.notice-title svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.notice-points { margin: 0; padding-left: 22px; line-height: 1.7; }
.notice-points li { margin: 6px 0; overflow-wrap: anywhere; }

/* Left menu: the Notice entry sits in a bordered box */
.sidebar a.notice-nav { border: 2px solid var(--accent); margin: 6px 0; }
.notice-subject { margin: 0 0 12px; font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }
.notice-date { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 10px; background: var(--bg-raised); border: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--muted); white-space: nowrap; }

/* ---------- ad before the video ---------- */
.ad-layer { position: absolute; inset: 0; z-index: 20; background: #000; }
.ad-layer .ad-video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.ad-badge { position: absolute; left: 10px; top: 10px; background: rgba(0,0,0,.65); color: #fff; font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 4px; letter-spacing: .02em; }
.ad-badge b { font-weight: 500; }
.ad-skip, .ad-visit { position: absolute; bottom: 14px; border: 1px solid rgba(255,255,255,.55); background: rgba(0,0,0,.72); color: #fff; font: inherit; font-size: 14px; font-weight: 600; padding: 9px 16px; border-radius: 4px; cursor: pointer; }
.ad-skip { right: 0; border-right: 0; border-radius: 4px 0 0 4px; }
.ad-skip:disabled { cursor: default; opacity: .8; }
.ad-skip:not(:disabled):hover, .ad-visit:hover { background: rgba(255,255,255,.2); }
.ad-visit { left: 10px; }

/* Admin sidebar: stays in view and scrolls on its own (YouTube-style thin scrollbar) */
@media (min-width: 901px) {
  .admin-nav {
    display: flex; flex-direction: column; box-sizing: border-box;
    height: calc(100vh - var(--topbar-h) - 32px); height: calc(100dvh - var(--topbar-h) - 32px);
  }
  .admin-nav .admin-brand, .admin-nav .admin-exit { flex: none; }
  .admin-nav nav {
    flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: transparent transparent; margin-right: -6px; padding-right: 4px;
  }
  .admin-nav nav:hover { scrollbar-color: var(--border) transparent; }
  .admin-nav nav::-webkit-scrollbar { width: 8px; }
  .admin-nav nav::-webkit-scrollbar-thumb { background: transparent; border-radius: 4px; }
  .admin-nav nav:hover::-webkit-scrollbar-thumb { background: var(--muted); }
  .admin-nav nav a { flex: none; }
}
