/* Library screens (index.html). Loaded after style.css; uses its theme variables. */
body.lib { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
body.lib.has-player { padding-bottom: calc(200px + env(safe-area-inset-bottom)); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}
.lib-banner { margin: 8px 10px 0; }
.screen[hidden], .mini[hidden], .lib-banner[hidden], .p-error[hidden] { display: none; }

.add-box { display: flex; gap: 8px; padding: 10px; }
.add-input {
  flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 8px 12px;
  border: 1px solid var(--sep); border-radius: 10px;
  background: var(--bg); color: var(--text); font: inherit;
}
.add-input::placeholder { color: var(--hint); }
.add-box .btn { flex: 0 0 auto; }

.list { display: flex; flex-direction: column; gap: 8px; padding: 0 10px; }
.list-foot { padding: 10px; }
.list-foot .btn { width: 100%; }
.state-box {
  background: var(--bg); border-radius: 12px; padding: 16px; color: var(--hint);
  display: flex; flex-direction: column; gap: 10px; align-items: flex-start;
}
.state-box div { color: var(--text); }

/* video item */
.v-item { display: flex; gap: 10px; background: var(--bg); border-radius: 12px; padding: 10px; }
.v-item.active { outline: 2px solid var(--btn); }
.v-item.linked { box-shadow: inset 4px 0 0 var(--link); background: rgba(36, 129, 204, .08); }
.v-thumb {
  flex: 0 0 96px; width: 96px; height: 54px; border-radius: 8px; overflow: hidden;
  background: var(--bg2);
}
.v-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.v-body { flex: 1 1 auto; min-width: 0; }
.v-title { font-weight: 600; word-break: break-word; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.v-meta { font-size: 13px; color: var(--hint); margin-top: 2px; }
.v-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.v-progress { font-size: 12px; color: var(--hint); }
.v-error { font-size: 12px; color: var(--danger); margin-top: 4px; word-break: break-word; }
.v-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.btn.danger { color: var(--danger); }

.chip {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; white-space: nowrap;
  background: var(--bg2); color: var(--hint);
}
.chip.st-ready { background: rgba(52, 168, 83, .16); color: #2e8b47; }
.chip.st-waiting, .chip.st-downloading { background: rgba(36, 129, 204, .14); color: var(--link); }
.chip.st-failed, .chip.st-unavailable { background: rgba(217, 48, 37, .12); color: var(--danger); }

/* channel row */
.c-item { display: flex; align-items: center; gap: 6px; background: var(--bg); border-radius: 12px; padding: 6px 6px 6px 10px; }
.c-open {
  flex: 1 1 auto; min-width: 0; display: flex; align-items: center; gap: 10px;
  background: transparent; border: 0; padding: 4px 0; color: var(--text); text-align: left; cursor: pointer;
}
.c-avatar {
  flex: 0 0 44px; width: 44px; height: 44px; border-radius: 50%; overflow: hidden;
  background: var(--bg2); color: var(--hint); display: flex; align-items: center; justify-content: center; font-weight: 600;
}
.c-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.c-text { min-width: 0; }
.c-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-meta { font-size: 13px; color: var(--hint); }

.feed-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px; }
.feed-title { font-weight: 600; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* mini player above the tab bar */
.mini {
  position: fixed; left: 0; right: 0; bottom: calc(56px + env(safe-area-inset-bottom)); z-index: 10;
  background: var(--bg); border-top: 1px solid var(--sep);
  padding: 8px 12px 6px; box-shadow: 0 -4px 16px rgba(0,0,0,.08);
}
.mini-top { display: flex; align-items: center; gap: 8px; }
.mini-text { flex: 1 1 auto; min-width: 0; }
.mini-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-sub { font-size: 12px; color: var(--hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-rate { flex: 0 0 auto; min-width: 52px; }
.mini-seek { margin-top: 4px; }
.mini-row { display: flex; align-items: center; gap: 6px; }
.mini-row .ctl { flex: 1 1 0; min-width: 0; min-height: 40px; padding: 6px 4px; }
.mini-row .play { background: var(--btn); color: var(--btn-text); font-size: 18px; flex: 1.3 1 0; }
.mini-time { flex: 0 0 56px; font-size: 12px; color: var(--hint); font-variant-numeric: tabular-nums; }
.mini-time.right { text-align: right; }

/* bottom tab bar */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 11; display: flex;
  background: var(--bg); border-top: 1px solid var(--sep);
  padding-bottom: env(safe-area-inset-bottom);
}
.tab {
  flex: 1 1 0; height: 56px; border: 0; background: transparent; color: var(--hint);
  font: inherit; font-weight: 600; cursor: pointer; touch-action: manipulation;
}
.tab.on { color: var(--link); box-shadow: inset 0 2px 0 var(--link); }
