@font-face {
  font-family: 'Archivo';
  src: url('/fonts/archivo-latin-wdth-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

:root {
  --blue: #1d38c9;
  --primary: #1d38c9;
  --primary-deep: #142797;
  --band: #1d38c9;
  --band-deep: #142797;
  --ink: #10183f;
  --paper: #f1f3fa;
  --white: #ffffff;
  --surface: #ffffff;
  --on-yellow: #10183f;
  --bar: #10183f;
  --target: #fff6cf;
  --line: #d3d9ec;
  --muted: #525c85;
  --yellow: #ffd233;
  --green: #0b7a55;
  --red: #b8213a;
  --gutter: clamp(16px, 4vw, 48px);
  --tabbar-h: 0px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: 'Archivo', system-ui, 'Segoe UI', 'Noto Sans Arabic', 'Noto Nastaliq Urdu', sans-serif;
}

:root[data-theme='dark'] {
  color-scheme: dark;
  --blue: #9db0ff;
  --primary: #3a56e8;
  --primary-deep: #2c44c4;
  --band: #172269;
  --band-deep: #101a55;
  --ink: #e7ebfb;
  --paper: #0d1231;
  --surface: #181f4a;
  --line: #2e3766;
  --muted: #a4aed6;
  --green: #4fd3a3;
  --red: #ff8496;
  --bar: #060a22;
  --target: #3a3413;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 16px/1.5 var(--font);
}

#app { flex: 1; display: flex; flex-direction: column; }
#app > main { flex: 1; }

.credit { padding: 16px var(--gutter); color: var(--muted); font-size: 14px; }

h1, h2, h3, p { margin: 0; }

a { color: var(--blue); }

img { display: block; max-width: 100%; }

[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
.band :focus-visible, .auth-brand :focus-visible, .topbar :focus-visible, .queue :focus-visible { outline-color: var(--yellow); }

.icon { width: 20px; height: 20px; flex: none; }

@keyframes spin { to { transform: rotate(360deg); } }
.is-busy .icon, .state-active.is-running .icon { animation: spin 1s linear infinite; }

.wide {
  font-stretch: 125%;
  font-weight: 800;
  letter-spacing: -0.01em;
  line-height: 1.08;
}

.label-short { display: none; }

/* Buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 2px solid var(--primary);
  border-radius: 3px;
  background: var(--primary);
  color: var(--white);
  font: 600 15px/1 var(--font);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.btn .icon { width: 18px; height: 18px; }
.btn:disabled { opacity: 0.55; cursor: default; }

.btn-plain { background: transparent; border-color: var(--blue); color: var(--blue); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: 14px; }
.btn-small .icon { width: 16px; height: 16px; }

.band .btn { background: var(--yellow); border-color: var(--yellow); color: var(--on-yellow); }
.band .btn-plain { background: transparent; border-color: rgba(255, 255, 255, 0.55); color: var(--white); }

.notice .btn { background: var(--on-yellow); border-color: var(--on-yellow); color: var(--white); }

.queue .btn { background: var(--yellow); border-color: var(--yellow); color: var(--on-yellow); }
.queue .btn-plain { background: transparent; border-color: rgba(255, 255, 255, 0.5); color: var(--white); }

@media (hover: hover) {
  .btn:hover { background: var(--primary-deep); border-color: var(--primary-deep); }
  .btn-plain:hover { background: var(--surface); border-color: var(--blue); }
  .band .btn:hover { background: #ffe07a; border-color: #ffe07a; }
  .band .btn-plain:hover { background: var(--band-deep); border-color: var(--white); }
  .notice .btn:hover { background: var(--primary-deep); border-color: var(--primary-deep); }
  .queue .btn:hover { background: #ffe07a; border-color: #ffe07a; }
  .queue .btn-plain:hover { background: var(--primary-deep); }
  .spine-title a:hover { text-decoration: underline; }
}

.link-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue);
  font: inherit;
  font-size: 15px;
  text-decoration: underline;
  cursor: pointer;
}
.action .icon { width: 16px; height: 16px; }
.action.only-phone { display: none; }

/* Sign-in */

.auth {
  flex: 1;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 1fr);
  background: var(--band);
  color: var(--white);
}
.auth-brand {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 28px;
  padding: var(--gutter);
}
.auth-brand h1 { font-size: clamp(44px, 7.4vw, 104px); }
.auth-brand p { max-width: 34ch; font-size: 20px; line-height: 1.4; }
.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--gutter);
  background: var(--paper);
  color: var(--ink);
}
.auth-form { display: grid; gap: 18px; width: min(100%, 360px); }
.auth-form h2 { font-size: 28px; }
.auth-switch { color: var(--muted); }

.field { display: grid; gap: 6px; font-weight: 600; font-size: 15px; }
.field input, .search input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  border: 2px solid var(--line);
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  font: 400 16px var(--font);
}
.field input:focus, .search input:focus { border-color: var(--blue); outline: none; }
.form-error { color: var(--red); font-weight: 500; }

/* Top bar and the blue band under it */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 64px;
  padding: 0 var(--gutter);
  background: var(--band);
  color: var(--white);
}
.topbar a { color: var(--white); }
.topbar-end { display: flex; align-items: center; gap: 18px; min-width: 0; }
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: var(--white);
  cursor: pointer;
}
.auth-brand .theme-toggle { position: absolute; top: calc(14px + var(--safe-top)); right: 14px; }
.brand { font-size: 18px; text-decoration: none; }
.topbar-back, .topbar-title { display: none; }
.account { display: flex; align-items: center; gap: 18px; font-size: 15px; min-width: 0; }
.account-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--white);
  font: inherit;
  text-decoration: underline;
  white-space: nowrap;
  cursor: pointer;
}
.account-link .icon { width: 16px; height: 16px; }

.band { background: var(--band); color: var(--white); padding: 0 var(--gutter) 28px; }
.band a { color: var(--white); }

.add-form { display: grid; gap: 10px; padding-top: 12px; }
.add-form label { font-size: clamp(30px, 5vw, 56px); }
.add-row { display: flex; gap: 10px; margin-top: 14px; }
.add-row input {
  flex: 1;
  min-width: 0;
  min-height: 52px;
  padding: 0 14px;
  border: 2px solid transparent;
  border-radius: 3px;
  background: var(--surface);
  color: var(--ink);
  font: 400 17px var(--font);
}
.add-row .btn { min-height: 52px; }
.add-error { color: var(--yellow); font-weight: 500; }

/* The tape: one segment per video */

.tape { display: block; width: 100%; height: 22px; background: #0c1236; border-radius: 2px; }
.tape-tall { height: 40px; }

/* Library */

.shelf { padding: 28px var(--gutter) 64px; display: grid; gap: 28px; }
.empty { padding: 56px var(--gutter); max-width: 56ch; }
.empty h2 { font-size: 24px; margin-bottom: 6px; }

.spine {
  display: grid;
  grid-template-columns: 144px minmax(0, 1fr);
  gap: 8px 20px;
  align-items: start;
}
.spine img, .spine-blank {
  width: 144px;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--line);
}
.spine-body { display: grid; gap: 8px; min-width: 0; }
.spine-title { font-size: 22px; font-stretch: 112%; font-weight: 700; line-height: 1.2; }
.spine-title a { color: var(--ink); text-decoration: none; }
.spine-meta { display: flex; flex-wrap: wrap; gap: 4px 18px; color: var(--muted); font-size: 15px; }
.spine-chevron { display: none; }

.sticker {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 2px;
  background: var(--yellow);
  color: var(--on-yellow);
  font-size: 14px;
  font-weight: 700;
}

/* Playlist header */

.back { display: inline-flex; align-items: center; gap: 4px; padding-top: 12px; font-size: 15px; }
.back .icon { width: 16px; height: 16px; }
.detail-title { font-size: clamp(28px, 4.6vw, 52px); margin-top: 10px; overflow-wrap: anywhere; }
.detail-sub { margin-top: 8px; font-size: 16px; color: #dfe5ff; }
.detail-tape { margin-top: 22px; }
.detail-count { margin-top: 10px; font-size: 18px; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.quick { display: contents; }

.notice {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 14px var(--gutter);
  background: var(--yellow);
  color: var(--on-yellow);
  font-weight: 600;
}
.notice-text { flex: 1 1 260px; }

/* Filters */

.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px var(--gutter) 6px;
}
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tab {
  min-height: 40px;
  padding: 0 12px;
  border: 0;
  border-bottom: 3px solid transparent;
  background: none;
  color: var(--muted);
  font: 600 15px var(--font);
  cursor: pointer;
}
.tab[aria-pressed='true'] { color: var(--ink); border-bottom-color: var(--blue); }
.search { position: relative; width: min(100%, 300px); }
.search .icon { position: absolute; left: 11px; top: 11px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search input { min-height: 40px; padding-left: 36px; }

/* Videos */

.videos { padding: 0 var(--gutter); }
.video {
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr) 230px;
  grid-template-rows: auto auto 1fr;
  grid-template-areas:
    'thumb main  side'
    'thumb about side'
    'thumb links side';
  gap: 8px 22px;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
}
.video.is-target { background: var(--target); box-shadow: -12px 0 0 var(--target), 12px 0 0 var(--target); }
.video.is-gone { opacity: 0.62; }
.thumb { grid-area: thumb; position: relative; display: block; align-self: start; aspect-ratio: 16 / 9; background: var(--line); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb-time {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 0 5px;
  background: rgba(12, 18, 54, 0.88);
  color: var(--white);
  font-size: 13px;
  font-weight: 600;
}
.video-main { grid-area: main; min-width: 0; }
.video-about { grid-area: about; min-width: 0; }
.video-title { font-size: 18px; font-weight: 650; line-height: 1.3; overflow-wrap: anywhere; }
.video-date { margin-top: 2px; color: var(--muted); font-size: 15px; }
.video-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.tag-quiet { padding: 1px 8px; border-radius: 2px; background: var(--line); font-size: 14px; font-weight: 600; }
.video-desc {
  max-width: 72ch;
  font-size: 15px;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.video-desc.is-clamped {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
}
.video-more { margin-top: 4px; font-size: 14px; }
.video-links { grid-area: links; display: flex; flex-wrap: wrap; align-self: start; gap: 4px 16px; }

.video-side { grid-area: side; display: grid; gap: 8px; align-content: start; min-width: 0; }
.video-side .btn { width: 100%; }

.state { display: flex; align-items: flex-start; gap: 6px; font-size: 14px; line-height: 1.35; overflow-wrap: anywhere; }
.state > span { min-width: 0; }
.state .icon { width: 16px; height: 16px; margin-top: 1px; }
.state-done { color: var(--green); font-weight: 650; font-size: 15px; }
.state-fail { color: var(--red); }
.state-note { color: var(--muted); }
.state-active { font-size: 15px; font-weight: 600; }

.bar { height: 8px; background: var(--line); overflow: hidden; }
.bar-fill { height: 100%; width: 0; background: var(--blue); transition: width 0.4s linear; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 22px var(--gutter) 40px; color: var(--muted); }
.list-empty { padding: 40px 0; color: var(--muted); }

/* Admin and helper pages */

.admin { display: grid; gap: 40px; align-content: start; padding: 32px var(--gutter) 56px; }
.admin h2 { font-size: 24px; font-stretch: 112%; font-weight: 700; line-height: 1.2; }
.admin-note { max-width: 60ch; margin: 6px 0 14px; color: var(--muted); }
.admin-note.is-bad { color: var(--red); }
.status-card { display: flex; align-items: flex-start; gap: 12px; }
.status-icon { color: var(--muted); padding-top: 2px; }
.status-icon.is-good { color: var(--green); }
.status-icon .icon { width: 26px; height: 26px; }
.accounts { width: 100%; max-width: 760px; margin-top: 12px; border-collapse: collapse; }
.accounts th, .accounts td { padding: 10px 16px 10px 0; border-bottom: 1px solid var(--line); text-align: left; overflow-wrap: anywhere; }
.accounts th { color: var(--muted); font-size: 14px; font-weight: 600; }
.steps { max-width: 60ch; margin: 0 0 18px; padding-left: 22px; }
.steps li { margin-bottom: 8px; }

/* Queue bar */

.queue {
  position: sticky;
  bottom: var(--tabbar-h);
  z-index: 4;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding: 12px var(--gutter);
  background: var(--bar);
  color: var(--white);
}
.queue-text { flex: 1 1 220px; font-weight: 500; }

/* Phone tabs: only shown on small screens */

.tabbar { display: none; }

/* Dialog */

.dialog {
  width: min(calc(100vw - 32px), 460px);
  max-height: calc(100vh - 32px);
  padding: 24px;
  border: 0;
  border-radius: 3px;
  color: var(--ink);
  background: var(--surface);
}
.dialog::backdrop { background: rgba(16, 24, 63, 0.62); }
.dialog h2 { font-size: 22px; font-stretch: 112%; font-weight: 700; line-height: 1.2; }
.dialog-sub { margin-top: 6px; color: var(--muted); overflow-wrap: anywhere; }
.dialog-group { display: grid; gap: 2px; margin: 18px 0 0; padding: 0; border: 0; }
.dialog-group legend { padding: 0; margin-bottom: 6px; font-weight: 650; }
.choice { display: flex; align-items: center; gap: 10px; min-height: 36px; cursor: pointer; }
.choice input { width: 18px; height: 18px; margin: 0; accent-color: var(--blue); }
.choice small { margin-left: auto; color: var(--muted); font-size: 14px; }
.dialog-note { margin-top: 12px; color: var(--muted); font-size: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + 76px);
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  border-radius: 3px;
  background: var(--bar);
  color: var(--white);
  font-weight: 500;
  z-index: 10;
}
.toast.is-error { background: var(--red); }

@media (max-width: 900px) {
  .video {
    grid-template-columns: 150px minmax(0, 1fr);
    grid-template-rows: auto auto auto auto;
    grid-template-areas:
      'thumb main'
      'thumb about'
      'thumb links'
      'side  side';
  }
  .video-side .btn { width: auto; justify-self: start; }
}

/* ---- Phones: the site becomes an app ------------------------------------------ */

@media (max-width: 720px) {
  :root { --gutter: 14px; }
  body.has-tabs { --tabbar-h: calc(60px + var(--safe-bottom)); padding-bottom: var(--tabbar-h); }

  html { -webkit-tap-highlight-color: transparent; }
  body { overscroll-behavior-y: none; }
  a, button { touch-action: manipulation; }

  .credit { padding: 14px var(--gutter) 18px; text-align: center; font-size: 13px; }

  .btn { border-radius: 10px; min-height: 46px; }
  .btn:active, .action:active, .tab-item:active, .topbar-back:active { opacity: 0.65; }
  .label-long { display: none; }
  .label-short { display: inline; }

  /* App bar */
  .topbar {
    position: sticky;
    top: 0;
    z-index: 5;
    justify-content: flex-start;
    gap: 2px;
    min-height: calc(54px + var(--safe-top));
    padding: var(--safe-top) 6px 0 var(--gutter);
  }
  .topbar:has(.topbar-back) { padding-left: 4px; }
  .brand, .account { display: none; }
  .topbar-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
  }
  .topbar-back .icon { width: 26px; height: 26px; }
  .topbar-title { display: block; flex: 1; min-width: 0; font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar-end { flex: none; margin-left: auto; }

  /* Bottom tabs */
  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 6;
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    height: var(--tabbar-h);
    padding-bottom: var(--safe-bottom);
    background: var(--surface);
    border-top: 1px solid var(--line);
  }
  .tab-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font: 600 12px var(--font);
    text-decoration: none;
    cursor: pointer;
  }
  .tab-item .icon { width: 24px; height: 24px; }
  .tab-item[aria-current='page'] { color: var(--blue); }

  /* Sign-in */
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-brand { gap: 12px; padding: calc(36px + var(--safe-top)) var(--gutter) 24px; }
  .auth-brand h1 { font-size: 40px; }
  .auth-brand p { font-size: 17px; }
  .auth-panel { align-items: flex-start; padding: 24px var(--gutter); }
  .auth-form { width: 100%; }
  .auth-form h2 { font-size: 24px; }
  .field input { border-radius: 10px; }

  /* Band and page titles */
  .band { padding-bottom: 18px; }
  .band-title { display: none; }
  .back { display: none; }
  .add-form { padding-top: 2px; }
  .add-form label { font-size: 15px; font-stretch: 100%; font-weight: 500; letter-spacing: 0; }
  .add-row { margin-top: 2px; gap: 8px; }
  .add-row input { min-height: 48px; border-radius: 10px; font-size: 16px; }
  .btn-add { width: 48px; min-height: 48px; padding: 0; flex: none; }
  .add-row .btn-add { min-height: 48px; }
  .btn-add .icon { width: 24px; height: 24px; }

  /* Playlists */
  .shelf { padding: 12px var(--gutter) 20px; gap: 10px; }
  .empty { padding: 36px var(--gutter); }
  .spine {
    position: relative;
    grid-template-columns: 96px minmax(0, 1fr) 18px;
    gap: 12px;
    padding: 10px;
    border-radius: 12px;
    background: var(--surface);
    align-items: center;
  }
  .spine img, .spine-blank { width: 96px; border-radius: 6px; }
  .spine-body { gap: 6px; }
  .spine-title { font-size: 16px; font-stretch: 100%; line-height: 1.25; }
  .spine-title a::after { content: ''; position: absolute; inset: 0; }
  .spine-meta { gap: 2px 10px; font-size: 13px; }
  .spine .tape { height: 12px; }
  .spine-chevron { display: block; color: var(--muted); }
  .spine-chevron .icon { width: 18px; height: 18px; }

  /* Playlist header */
  .detail-title { margin-top: 2px; font-size: 22px; line-height: 1.2; }
  .detail-sub { margin-top: 4px; font-size: 14px; }
  .detail-tape { margin-top: 14px; }
  .tape-tall { height: 28px; }
  .detail-count { margin-top: 8px; font-size: 15px; }
  .actions { display: grid; gap: 10px; margin-top: 12px; }
  .btn-primary-action { width: 100%; min-height: 50px; font-size: 16px; }
  .quick { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 8px; }
  .quick .btn {
    flex-direction: column;
    gap: 4px;
    min-height: 62px;
    padding: 8px 2px;
    border-color: transparent;
    background: rgba(255, 255, 255, 0.16);
    color: var(--white);
    font-size: 12.5px;
    white-space: normal;
  }
  .quick .btn .icon { width: 22px; height: 22px; }

  .notice { padding: 12px var(--gutter); gap: 8px; }
  .notice-text { flex: 1 1 100%; font-size: 15px; }
  .notice .btn { flex: 1 1 0; min-height: 42px; padding: 0 8px; font-size: 13.5px; white-space: normal; }

  /* Filters */
  .controls { flex-direction: column; align-items: stretch; flex-wrap: nowrap; gap: 8px; padding: 12px 0 8px; }
  .tabs {
    flex-wrap: nowrap;
    gap: 8px;
    padding: 0 var(--gutter);
    overflow-x: auto;
    scrollbar-width: none;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab {
    flex: none;
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    font-size: 14px;
    white-space: nowrap;
  }
  .tab[aria-pressed='true'] { border-color: var(--primary); background: var(--primary); color: var(--white); }
  .search { width: auto; margin: 0 var(--gutter); }
  .search input { min-height: 44px; border-radius: 10px; }
  .search .icon { top: 13px; }

  /* Videos: one card each */
  .videos { display: grid; gap: 10px; padding: 0 var(--gutter); }
  .video {
    grid-template-columns: 124px minmax(0, 1fr);
    grid-template-rows: none;
    grid-template-areas:
      'thumb main'
      'side  side'
      'about about'
      'links links';
    gap: 10px;
    padding: 10px;
    border: 0;
    border-radius: 12px;
    background: var(--surface);
  }
  .video.is-target { box-shadow: 0 0 0 2px var(--yellow); }
  .thumb { border-radius: 6px; }
  .thumb-time { right: 4px; bottom: 4px; border-radius: 3px; font-size: 12px; }
  .video-title {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    overflow: hidden;
    font-size: 15px;
  }
  .video-date { font-size: 13px; }
  .tag-quiet, .sticker { font-size: 12.5px; }

  .video-about { display: none; }
  .video.show-about .video-about { display: block; }
  .video.show-about .video-desc { font-size: 14px; }

  .video-side { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
  .video-side .state { flex: 1 1 100%; }
  .video-side .bar { flex: 1 1 100%; border-radius: 4px; }
  .video-side .btn { flex: 1 1 0; width: auto; min-height: 44px; font-size: 15px; }
  .video-side:empty { display: none; }

  .video-links {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(0, 1fr);
    gap: 0;
    margin: 0 -2px -4px;
    padding-top: 4px;
    border-top: 1px solid var(--line);
    align-self: stretch;
  }
  .action,
  .action.only-phone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 50px;
    color: var(--ink);
    font-size: 12.5px;
    font-weight: 600;
    text-decoration: none;
  }
  .action .icon { width: 21px; height: 21px; color: var(--blue); }

  .pager { padding: 14px var(--gutter) 10px; font-size: 14px; }

  /* Queue */
  .queue { padding: 10px var(--gutter); gap: 8px; }
  .queue-text { font-size: 14px; flex: 1 1 100%; }
  .queue .btn { flex: 1 1 0; min-height: 42px; }

  /* Admin and helper pages */
  .admin { gap: 26px; padding: 18px var(--gutter) 24px; }
  .admin h2 { font-size: 19px; font-stretch: 100%; }
  .admin .btn { width: 100%; }
  .accounts, .accounts tbody, .accounts tr, .accounts td { display: block; }
  .accounts thead { display: none; }
  .accounts tr { padding: 12px; margin-bottom: 8px; border-radius: 12px; background: var(--surface); }
  .accounts td { padding: 1px 0; border: 0; color: var(--muted); font-size: 14px; }
  .accounts .cell-main { color: var(--ink); font-size: 15px; font-weight: 600; }
  .accounts td .btn { margin-top: 8px; }

  /* Dialogs become bottom sheets */
  @keyframes sheet-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .dialog {
    width: 100%;
    max-width: 100%;
    max-height: 88dvh;
    margin: auto 0 0;
    padding: 22px 16px calc(16px + var(--safe-bottom));
    border-radius: 18px 18px 0 0;
    overflow-y: auto;
  }
  .dialog[open] { animation: sheet-up 0.22s ease-out; }
  .dialog::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    margin: -10px auto 12px;
    border-radius: 2px;
    background: var(--line);
  }
  .choice { min-height: 46px; }
  .choice input { width: 20px; height: 20px; }
  .dialog-group.is-grid { grid-template-columns: 1fr 1fr; column-gap: 12px; }
  .dialog-actions { position: sticky; bottom: calc(-16px - var(--safe-bottom)); margin: 18px -16px calc(-16px - var(--safe-bottom)); padding: 10px 16px calc(14px + var(--safe-bottom)); background: var(--surface); }
  .dialog-actions .btn { flex: 1 1 0; min-width: 0; padding: 0 8px; }

  .toast { border-radius: 10px; bottom: calc(var(--tabbar-h) + 14px); }
}

@media (prefers-reduced-motion: reduce) {
  .bar-fill { transition: none; }
  .is-busy .icon, .state-active.is-running .icon, .dialog[open] { animation: none; }
}
