/* ============================================================
   Homeplex — modern dark theme v2
   Accent: cyan (#22d3ee) + lime (#a3e635)
   Type: Inter (embedded) with system fallbacks
   ============================================================ */

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/static/fonts/inter-400.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/static/fonts/inter-500.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/static/fonts/inter-600.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("/static/fonts/inter-700.woff2") format("woff2");
}
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 800;
  font-display: swap;
  src: url("/static/fonts/inter-800.woff2") format("woff2");
}

:root {
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

  /* surfaces */
  --bg: #0b0e14;
  --bg-alt: #0f141d;
  --panel: #141a26;
  --panel-2: #1a2231;
  --panel-3: #212b3d;
  --border: #202938;
  --border-strong: #2d3a4f;

  /* text */
  --text: #eef2f8;
  --text-dim: #a7b1c3;
  --muted: #7d8899;
  --muted-2: #525d6e;

  /* accents */
  --cyan: #22d3ee;
  --lime: #a3e635;
  --grad: linear-gradient(135deg, #22d3ee, #a3e635);
  --grad-soft: linear-gradient(135deg, rgba(34, 211, 238, 0.14), rgba(163, 230, 53, 0.14));
  --danger: #f87171;
  --ring: rgba(34, 211, 238, 0.35);

  /* geometry */
  --radius: 14px;
  --radius-lg: 18px;
  --radius-pill: 999px;
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 16px 40px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 0 1px rgba(34, 211, 238, 0.14), 0 20px 48px rgba(0, 0, 0, 0.55);
  --blur: 18px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --t: 180ms var(--ease);

  /* ambient */
  --glow-cyan: rgba(34, 211, 238, 0.09);
  --glow-lime: rgba(163, 230, 53, 0.06);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  color-scheme: dark;
  scrollbar-color: var(--border-strong) var(--bg);
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--muted-2); }
::-webkit-scrollbar-track { background: transparent; }

::selection { background: rgba(34, 211, 238, 0.32); color: #fff; }

:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--bg);
  color: var(--text);
  font: 400 15px/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv11", "ss01";
}

/* ambient background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(1000px 560px at 85% -5%, var(--glow-cyan), transparent 62%),
    radial-gradient(900px 560px at -10% 105%, var(--glow-lime), transparent 62%);
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }

/* ============================================================
   Top bar
   ============================================================ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 10px clamp(16px, 3vw, 28px);
  background: rgba(8, 10, 15, 0.78);
  backdrop-filter: blur(var(--blur)) saturate(1.6);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(1.6);
  border-bottom: 1px solid rgba(45, 58, 79, 0.65);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.brand {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding-left: 32px;
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.02em;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  transition: filter var(--t);
}
.brand::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--grad);
  box-shadow: 0 4px 16px rgba(34, 211, 238, 0.4);
}
.brand::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 50%;
  width: 0;
  height: 0;
  margin-top: -5.5px;
  border-style: solid;
  border-width: 5.5px 0 5.5px 8px;
  border-color: transparent transparent transparent #0b0e14;
}
.brand:hover { filter: brightness(1.12); }

.crumbs {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 13.5px;
}
.crumbs a { color: var(--muted); transition: color var(--t); }
.crumbs a:hover { color: var(--text); }
.crumbs .sep { margin: 0 6px; color: var(--muted-2); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: auto;
}

/* search / filter inputs */
.filter {
  width: 210px;
  background-color: rgba(15, 20, 29, 0.7);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d8899' stroke-width='2' stroke-linecap='round'><circle cx='11' cy='11' r='7'/><path d='m21 21-4.3-4.3'/></svg>");
  background-position: 11px center;
  background-size: 15px;
  background-repeat: no-repeat;
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 11px;
  padding: 8.5px 12px 8.5px 35px;
  font: 500 13.5px var(--font-sans);
  transition: border-color var(--t), box-shadow var(--t), background-color var(--t), width var(--t);
}
.filter::placeholder { color: var(--muted-2); }
.filter:focus {
  outline: none;
  border-color: var(--cyan);
  background-color: var(--bg-alt);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15);
}

.search-form { position: relative; flex-shrink: 0; }
.search-form .filter { width: 220px; }

.logout {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  padding: 7.5px 13px;
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: color var(--t), border-color var(--t), background var(--t);
}
.logout:hover { color: var(--text); border-color: var(--border-strong); background: var(--panel); }

/* ============================================================
   Sub-navigation
   ============================================================ */
.subnav {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 4px;
  background: rgba(15, 20, 29, 0.7);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
}
.subnav a {
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  transition: color var(--t), background var(--t), box-shadow var(--t);
}
.subnav a:hover { color: var(--text); background: rgba(255, 255, 255, 0.05); }
.subnav a.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.22), rgba(163, 230, 53, 0.22));
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.45);
  font-weight: 600;
}

/* ============================================================
   Page headers
   ============================================================ */
.list-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}
.page-title {
  margin: 0;
  font-size: clamp(22px, 3vw, 28px);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}
.sort-pills { display: flex; gap: 6px; }
.pill {
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  transition: color var(--t), background var(--t), border-color var(--t);
}
.pill:hover { color: var(--text); border-color: var(--border-strong); background: var(--panel-2); }
.pill.active {
  color: #fff;
  border-color: rgba(34, 211, 238, 0.5);
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.2), rgba(163, 230, 53, 0.2));
  font-weight: 600;
}
.count { margin-left: auto; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* view toolbar (sort + grid/list toggle) */
.view-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 14px;
  margin-bottom: 20px;
  padding: 8px 12px;
  background: rgba(15, 20, 29, 0.5);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.sort-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.sort-wrap select {
  appearance: none;
  -webkit-appearance: none;
  background-color: var(--panel);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237d8899' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='m6 9 6 6 6-6'/></svg>");
  background-position: right 10px center;
  background-size: 14px;
  background-repeat: no-repeat;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 9px;
  padding: 7px 30px 7px 12px;
  font: 500 13px var(--font-sans);
  cursor: pointer;
  transition: border-color var(--t), box-shadow var(--t);
}
.sort-wrap select:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.15); }
.view-toggle {
  display: flex;
  gap: 3px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
}
.view-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 30px;
  color: var(--muted);
  border-radius: 7px;
  transition: color var(--t), background var(--t), box-shadow var(--t);
}
.view-btn svg { width: 17px; height: 17px; }
.view-btn:hover { color: var(--text); background: var(--panel); }
.view-btn.active {
  color: #fff;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.22), rgba(163, 230, 53, 0.22));
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.45);
}

/* ============================================================
   Layout
   ============================================================ */
.container {
  max-width: 1240px;
  margin: 26px auto 56px;
  padding: 0 clamp(16px, 3vw, 28px);
}

.section-title {
  margin: 0 0 14px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.4px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-title::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border-strong), transparent);
}

/* ============================================================
   Media grid & cards
   ============================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 24px 18px;
}

.card {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, var(--panel), var(--bg-alt));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform var(--t), border-color var(--t), box-shadow var(--t), background var(--t);
}
.card:hover {
  transform: translateY(-4px);
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: var(--shadow-glow);
  color: var(--text);
}
.card:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }

/* entrance */
.cell, .grid > .card {
  animation: card-in 420ms var(--ease) both;
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.thumb {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-alt);
}
.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 420ms var(--ease);
}
.card:hover .thumb img { transform: scale(1.06); }

/* thumbnails are clean now — the title/metadata live below in a card body */

/* play overlay */
.play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--grad);
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45), 0 0 0 6px rgba(255, 255, 255, 0.07);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity var(--t), transform 240ms var(--ease), box-shadow var(--t);
  pointer-events: none;
}
.play-btn::before {
  content: "";
  width: 0;
  height: 0;
  margin-left: 3px;
  border-style: solid;
  border-width: 8px 0 8px 12px;
  border-color: transparent transparent transparent rgba(11, 14, 20, 0.95);
}
.video-card:hover .play-btn,
.video-card:focus-visible .play-btn,
.video-card:focus-within .play-btn {
  opacity: 1;
  transform: scale(1);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.5), 0 0 0 6px rgba(255, 255, 255, 0.1);
}

/* icon thumbs (folders / audio / files) */
.thumb-icon {
  background: radial-gradient(120% 120% at 50% 18%, var(--panel-2), var(--bg-alt) 72%);
}
.thumb-icon svg {
  width: 44px;
  height: 44px;
  color: var(--muted-2);
  filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4));
  transition: transform var(--t), color var(--t);
}
.card:hover .thumb-icon svg { transform: scale(1.1); }
.folder-card .thumb-icon svg { color: var(--cyan); }
.audio-card .thumb-icon svg { color: var(--lime); }

.card-name {
  padding: 11px 12px 0;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color var(--t);
}
.card-sub {
  padding: 3px 12px 12px;
  font-size: 11.5px;
  color: var(--muted);
}

/* video cards: clean title + metadata in a body below the thumbnail */
.card.video-card:not(.continue-card) .card-name {
  padding: 12px 14px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.8em; /* reserve 2 lines so rows of cards align */
}
.card.video-card:not(.continue-card) .card-sub {
  padding: 3px 14px 13px;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* continue watching cards keep the classic layout + progress bar */
.continue-card .card-name { padding-bottom: 4px; }
.continue-card .progress {
  height: 5px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  margin: 8px 12px 12px;
  overflow: hidden;
}
.continue-card .progress-fill {
  height: 100%;
  background: var(--grad);
  border-radius: var(--radius-pill);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.55);
  transition: width 400ms var(--ease);
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--muted);
  padding: 72px 16px;
  font-size: 14px;
}

/* ============================================================
   Grid cells + card controls
   ============================================================ */
.cell {
  position: relative;
  min-width: 0;
}
.cell .card { height: 100%; }

.card-menu,
.card-star {
  position: absolute;
  top: 8px;
  z-index: 3;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(8, 10, 15, 0.66);
  color: var(--text-dim);
  cursor: pointer;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  transition: background var(--t), color var(--t), transform var(--t), opacity var(--t);
}
.card-menu { right: 8px; }
.card-star { left: 8px; }
.card-menu:hover,
.card-menu:focus-visible,
.card-star:hover,
.card-star:focus-visible {
  background: rgba(8, 10, 15, 0.92);
  color: var(--text);
}
.card-menu:active,
.card-star:active { transform: scale(0.9); }
.card-menu svg,
.card-star svg { width: 16px; height: 16px; }

.card-star:hover { color: #ffd54f; }
.card-star.on { background: #ffd54f; color: #0b0e14; }
.card-star.on:hover { background: #ffe066; color: #0b0e14; }

/* reveal controls on hover (desktop) */
@media (hover: hover) and (pointer: fine) {
  .card-star, .card-menu {
    opacity: 0;
    transform: translateY(-3px) scale(0.94);
  }
  .card-star.on { opacity: 1; transform: none; }
  .cell:hover .card-star,
  .cell:hover .card-menu,
  .cell:focus-within .card-star,
  .cell:focus-within .card-menu {
    opacity: 1;
    transform: none;
  }
}

/* ============================================================
   List view
   ============================================================ */
.list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
}
.list-row {
  display: grid;
  grid-template-columns: 26px 32px minmax(0, 1fr) 150px 80px 88px 28px 28px;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  transition: background var(--t);
}
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--panel-2); }
.list-icon { display: flex; align-items: center; justify-content: center; color: var(--muted-2); }
.list-icon svg { width: 18px; height: 18px; }
.list-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-weight: 500;
  font-size: 14px;
  transition: color var(--t);
}
.list-name:hover { color: var(--cyan); }
.list-sub { min-width: 0; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-size, .list-date { color: var(--muted-2); font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; }
/* the "up one level" row has no checkbox, so pin its icon to the icon
   column to stay aligned with regular rows on every breakpoint */
.list-row > .list-icon { grid-column: 2; }
.list-row .card-menu { position: static; width: 28px; height: 28px; background: transparent; box-shadow: none; }
.list-row .card-star { position: static; width: 28px; height: 28px; background: transparent; box-shadow: none; }
.list-row .card-star:hover { background: var(--panel-2); }
.list-row .card-star.on { background: #ffd54f; }

@media (hover: hover) and (pointer: fine) {
  .list-row .card-star, .list-row .card-menu { opacity: 0; transform: none; }
  .list-row:hover .card-star,
  .list-row:hover .card-menu { opacity: 1; }
  .list-row .card-star.on { opacity: 1; }
}

.card-folder { color: var(--muted); }

/* ============================================================
   Select mode & batch bar
   ============================================================ */
.cell-check {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 4;
  width: 20px;
  height: 20px;
  accent-color: var(--cyan);
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: scale(0.8);
  transition: opacity var(--t), transform var(--t);
}
.select-mode .cell-check {
  opacity: 1;
  pointer-events: auto;
  transform: scale(1);
}
.select-mode .cell .card-star,
.select-mode .list-row .card-star { opacity: 0; pointer-events: none; }
.select-mode #btn-select { background: var(--grad-soft); color: var(--text); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.45); }
.select-mode #btn-select svg { stroke: var(--text); }

.batch-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 16px;
  background: linear-gradient(135deg, rgba(34, 211, 238, 0.12), rgba(163, 230, 53, 0.12));
  border: 1px solid rgba(34, 211, 238, 0.45);
  border-radius: 12px;
  margin-bottom: 20px;
  animation: slide-down 180ms var(--ease);
}
.batch-bar[hidden] { display: none; }
@keyframes slide-down {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.batch-count { color: var(--text); font-weight: 600; font-size: 14px; }
.batch-actions { display: flex; gap: 8px; }
.batch-actions .btn { padding: 8px 16px; font-size: 13px; font-weight: 600; }
.batch-actions .btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.list-row .cell-check {
  position: static;
  width: 20px;
  height: 20px;
  margin-right: 8px;
  opacity: 0;
  pointer-events: none;
}
.select-mode .list-row .cell-check { opacity: 1; pointer-events: auto; }

/* ============================================================
   Settings
   ============================================================ */
.settings { max-width: 820px; }
.panel {
  background: linear-gradient(180deg, var(--panel), var(--bg-alt));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 22px 24px;
  margin-bottom: 24px;
}
.panel .section-title { margin-bottom: 18px; }

.kv { margin: 0; display: flex; flex-direction: column; }
.kv > div {
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px solid var(--border);
}
.kv > div:last-child { border-bottom: none; }
.kv dt { flex: 0 0 180px; color: var(--muted); font-size: 13px; font-weight: 600; }
.kv dd { margin: 0; color: var(--text); font-size: 13.5px; word-break: break-word; }

.settings-form { max-width: 420px; display: flex; flex-direction: column; gap: 16px; }
.settings-form .btn { align-self: flex-start; }

.panel-note { margin: 0 0 16px; color: var(--muted); font-size: 13.5px; line-height: 1.6; }
.hidden-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.hidden-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 11px;
  transition: border-color var(--t);
}
.hidden-list li:hover { border-color: var(--border-strong); }
.hidden-path {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.inline-form { margin: 0; }
.inline-form .btn { padding: 6px 14px; font-size: 13px; }

.notice {
  color: #b6f09a;
  background: rgba(163, 230, 53, 0.08);
  border: 1px solid rgba(163, 230, 53, 0.3);
  border-radius: 11px;
  padding: 11px 14px;
  font-size: 13.5px;
  margin-bottom: 20px;
}
.error {
  color: var(--danger);
  font-size: 13.5px;
  margin: 0 0 14px;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.28);
  border-radius: 9px;
  padding: 9px 12px;
}

/* ============================================================
   Login
   ============================================================ */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px;
}
.login-card {
  position: relative;
  width: 100%;
  max-width: 384px;
  background: linear-gradient(180deg, var(--panel), var(--bg-alt)) padding-box,
    var(--grad) border-box;
  border: 1.5px solid transparent;
  border-radius: 20px;
  padding: 42px 34px 34px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 40px rgba(34, 211, 238, 0.06);
  overflow: hidden;
}
.login-card::before {
  content: "";
  position: absolute;
  top: -90px;
  left: 50%;
  transform: translateX(-50%);
  width: 260px;
  height: 170px;
  background: var(--grad-soft);
  filter: blur(64px);
  border-radius: 50%;
  pointer-events: none;
}
.login-mark {
  position: relative;
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  border-radius: 15px;
  background: var(--grad);
  box-shadow: 0 12px 32px rgba(34, 211, 238, 0.38);
}
.login-mark::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 0;
  height: 0;
  margin: -8px 0 0 -5px;
  border-style: solid;
  border-width: 8px 0 8px 13px;
  border-color: transparent transparent transparent #0b0e14;
}
.login-card h1 {
  position: relative;
  margin: 0 0 6px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.03em;
  text-align: center;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.login-card .subtitle { position: relative; margin: 0 0 26px; color: var(--muted); font-size: 14px; text-align: center; }
.login-card form { position: relative; }
.login-card label { display: block; margin-bottom: 7px; color: var(--muted); font-size: 13px; font-weight: 600; }
.login-card input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 11px;
  padding: 12px 14px;
  margin-bottom: 16px;
  font: 500 14px var(--font-sans);
  transition: border-color var(--t), box-shadow var(--t);
}
.login-card input:focus {
  outline: none;
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.16);
}
.login-card button {
  width: 100%;
  background: var(--grad);
  border: none;
  color: #0a0d12;
  font-weight: 700;
  font-size: 14px;
  padding: 13px;
  border-radius: 11px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(34, 211, 238, 0.3);
  transition: filter var(--t), transform var(--t), box-shadow var(--t);
}
.login-card button:hover { filter: brightness(1.08); transform: translateY(-1px); box-shadow: 0 8px 24px rgba(34, 211, 238, 0.4); }
.login-card button:active { transform: translateY(0) scale(0.98); }

/* ============================================================
   Buttons & inputs
   ============================================================ */
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 20, 29, 0.5);
  color: var(--muted);
  cursor: pointer;
  transition: color var(--t), border-color var(--t), background var(--t), transform var(--t), box-shadow var(--t);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--panel); box-shadow: var(--shadow-sm); }
.icon-btn:active { transform: scale(0.93); }
.icon-btn svg { width: 18px; height: 18px; }

.btn {
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 16px;
  font: 600 13.5px var(--font-sans);
  cursor: pointer;
  transition: border-color var(--t), background var(--t), box-shadow var(--t), transform var(--t), filter var(--t);
}
.btn:hover { border-color: var(--cyan); background: var(--panel-3); }
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: var(--grad);
  border: none;
  color: #08100f;
  box-shadow: 0 6px 18px rgba(34, 211, 238, 0.28);
}
.btn.primary:hover { filter: brightness(1.07); box-shadow: 0 8px 24px rgba(34, 211, 238, 0.36); }
.btn.primary:disabled { opacity: 0.5; cursor: default; }
.btn.danger {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
  color: var(--danger);
}
.btn.danger:hover { border-color: var(--danger); background: rgba(248, 113, 113, 0.2); }

/* ============================================================
   Context menu
   ============================================================ */
.menu {
  position: fixed;
  z-index: 60;
  min-width: 190px;
  background: rgba(26, 34, 49, 0.97);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6);
  display: none;
}
.menu.open { display: block; animation: menu-in 140ms var(--ease); }
@keyframes menu-in {
  from { opacity: 0; transform: translateY(-5px) scale(0.98); }
}
.menu button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  background: none;
  border: none;
  color: var(--text);
  padding: 9px 12px;
  border-radius: 8px;
  font: 500 13.5px var(--font-sans);
  cursor: pointer;
  text-align: left;
  transition: background var(--t);
}
.menu button:hover { background: rgba(255, 255, 255, 0.06); }
.menu button svg { width: 16px; height: 16px; flex: none; color: var(--muted); }
.menu button.danger { color: var(--danger); }
.menu button.danger svg { color: var(--danger); }

/* ============================================================
   Modals
   ============================================================ */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 7, 11, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t);
}
#modal.open .modal-backdrop { opacity: 1; pointer-events: auto; }
.modal-card {
  width: 100%;
  max-width: 430px;
  background: linear-gradient(180deg, var(--panel), var(--bg-alt));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.6);
  overflow: hidden;
  transform: translateY(14px) scale(0.97);
  transition: transform var(--t);
}
#modal.open .modal-card { transform: none; }

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 { margin: 0; font-size: 15px; font-weight: 700; letter-spacing: -0.01em; }
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--t), background var(--t);
}
.modal-close:hover { color: var(--text); background: var(--bg-alt); }
.modal-close svg { width: 17px; height: 17px; }

.modal-body { padding: 20px; }
.modal-body > p { margin: 0 0 14px; color: var(--muted); }
.modal-body > p strong { color: var(--text); font-weight: 600; }

#move-filter { width: 100%; }
.folder-picker {
  margin-top: 12px;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 6px;
  background: var(--bg);
}
.folder-option {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  background: none;
  border: none;
  border-radius: 8px;
  color: var(--text);
  padding: 8px 10px;
  font: 500 13px var(--font-sans);
  text-align: left;
  cursor: pointer;
  transition: background var(--t);
}
.folder-option svg { width: 15px; height: 15px; flex: none; color: var(--muted); }
.folder-option span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-option:hover { background: var(--panel-2); }
.folder-option.selected { background: var(--grad-soft); box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.4); }
.folder-option.selected svg { color: var(--cyan); }
.folder-picker .empty { padding: 20px 10px; font-size: 12.5px; }

.field { display: block; color: var(--muted); font-size: 13px; font-weight: 600; }
.field input {
  display: block;
  width: 100%;
  margin-top: 6px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  color: var(--text);
  border-radius: 11px;
  padding: 11px 14px;
  font: 500 14px var(--font-sans);
  transition: border-color var(--t), box-shadow var(--t);
}
.field input:focus { outline: none; border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.16); }

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* ============================================================
   Upload modal
   ============================================================ */
.upload-target { font-size: 13px; }
.upload-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: 12px;
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color var(--t), background var(--t), color var(--t), transform var(--t);
}
.upload-zone svg { width: 36px; height: 36px; margin-bottom: 8px; }
.upload-zone p { margin: 0; font-size: 13.5px; }
.upload-zone:hover,
.upload-zone.dragover { border-color: var(--cyan); background: rgba(34, 211, 238, 0.06); color: var(--text); }
.upload-zone.dragover { transform: scale(1.01); }

.upload-rows {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
}
.upload-row { display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.upload-row .name {
  flex: 0 0 34%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dim);
}
.upload-row .bar { flex: 1; height: 6px; background: var(--bg-alt); border-radius: var(--radius-pill); overflow: hidden; }
.upload-row .bar-fill {
  display: block;
  height: 100%;
  width: 0;
  background: var(--grad);
  border-radius: var(--radius-pill);
  transition: width 0.15s ease;
}
.upload-row .pct {
  flex: none;
  width: 48px;
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.upload-row.error .name { color: var(--danger); }
.upload-row.error .pct { color: var(--danger); }
.upload-summary { flex: 1; color: var(--muted); font-size: 12.5px; }

/* ============================================================
   Toast
   ============================================================ */
#toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 14px);
  z-index: 70;
  background: rgba(26, 34, 49, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-pill);
  padding: 11px 18px;
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t), transform var(--t);
  max-width: calc(100vw - 32px);
  text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { border-color: rgba(248, 113, 113, 0.5); color: #f8b4b4; }

/* ============================================================
   Player
   ============================================================ */
.player-layout {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  max-width: 1240px;
  margin: 26px auto 56px;
  padding: 0 clamp(16px, 3vw, 28px);
}

.video-stage {
  position: relative;
  flex: 1;
  min-width: 0;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  overflow: hidden;
}
.video-stage video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.player-info { flex: none; width: 300px; }
.player-title {
  margin: 0 0 14px;
  font-size: clamp(18px, 2vw, 22px);
  font-weight: 700;
  letter-spacing: -0.02em;
  word-break: break-word;
}

.controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 48px 14px 12px;
  background: linear-gradient(180deg, transparent, rgba(4, 6, 10, 0.9));
  color: #fff;
  opacity: 1;
  transition: opacity 0.25s ease;
  z-index: 2;
}
.controls.hidden { opacity: 0; pointer-events: none; }
.cursor-hidden { cursor: none; }

.seek-row { display: flex; align-items: center; gap: 10px; }
.time {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: #d8dee8;
  min-width: 42px;
  text-align: center;
}

.seekbar {
  position: relative;
  flex: 1;
  height: 22px;
  display: flex;
  align-items: center;
  cursor: pointer;
  touch-action: none;
}
.seek-track {
  position: relative;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: var(--radius-pill);
  overflow: visible;
  transition: height 0.12s ease;
}
.seekbar:hover .seek-track,
.seekbar.dragging .seek-track { height: 6px; }
.seek-buffer {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: rgba(255, 255, 255, 0.35);
  border-radius: var(--radius-pill);
}
.seek-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--grad);
  border-radius: var(--radius-pill);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.7);
}
.seek-thumb {
  position: absolute;
  top: 50%;
  left: 0;
  width: 13px;
  height: 13px;
  transform: translate(-50%, -50%);
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}
.seekbar:hover .seek-thumb,
.seekbar.dragging .seek-thumb,
.seekbar:focus-visible .seek-thumb { opacity: 1; }
.seek-tip {
  position: absolute;
  bottom: 26px;
  transform: translateX(-50%);
  background: rgba(10, 13, 18, 0.94);
  border: 1px solid var(--border-strong);
  padding: 4px 9px;
  border-radius: 7px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  white-space: nowrap;
}

.ctrl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}
.ctrl-left, .ctrl-right { display: flex; align-items: center; gap: 2px; }
.ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: #fff;
  border-radius: 9px;
  cursor: pointer;
  transition: background var(--t), transform var(--t);
}
.ctrl-btn:hover { background: rgba(255, 255, 255, 0.12); }
.ctrl-btn:active { transform: scale(0.92); }
.ctrl-btn.on { color: #0b0e14; background: var(--grad); box-shadow: 0 0 12px rgba(34, 211, 238, 0.45); }
.ctrl-btn svg { width: 21px; height: 21px; }
.ctrl-btn.rate {
  width: auto;
  padding: 0 9px;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.subtitle-picker { position: relative; }
.subtitle-menu {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(360px, calc(100vw - 28px));
  max-height: min(380px, 60vh);
  overflow-y: auto;
  padding: 6px;
  background: rgba(20, 26, 38, 0.98);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(16px);
  z-index: 12;
}
.subtitle-option {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 5px 7px;
  width: 100%;
  padding: 9px 10px 9px 32px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 8px;
  font: 500 13px/1.3 var(--font-sans);
  text-align: left;
  cursor: pointer;
}
.subtitle-option:hover,
.subtitle-option:focus-visible { background: rgba(255, 255, 255, 0.08); }
.subtitle-option[aria-checked="true"]::before {
  content: "✓";
  position: absolute;
  left: 11px;
  color: var(--cyan);
  font-weight: 800;
}
.subtitle-option[aria-disabled="true"] { color: var(--muted); cursor: not-allowed; opacity: 0.72; }
.subtitle-option-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.subtitle-option-details { color: var(--muted); font-size: 10.5px; white-space: nowrap; }
.subtitle-badge {
  padding: 2px 6px;
  color: #bdf4fc;
  background: rgba(34, 211, 238, 0.12);
  border: 1px solid rgba(34, 211, 238, 0.3);
  border-radius: var(--radius-pill);
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
}
.subtitle-reason {
  grid-column: 1 / -1;
  color: #d7a2a2;
  font-size: 10.5px;
  line-height: 1.35;
}
.subtitle-toast {
  position: absolute;
  left: 50%;
  bottom: 92px;
  z-index: 5;
  max-width: min(520px, calc(100% - 32px));
  transform: translateX(-50%);
  padding: 10px 14px;
  color: #ffd1d1;
  background: rgba(40, 18, 23, 0.94);
  border: 1px solid rgba(248, 113, 113, 0.5);
  border-radius: 10px;
  box-shadow: var(--shadow-md);
  font-size: 12.5px;
  text-align: center;
  pointer-events: none;
}

.vol { display: flex; align-items: center; gap: 2px; }
.vol-slider {
  width: 70px;
  -webkit-appearance: none;
  appearance: none;
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-pill);
  outline: none;
  cursor: pointer;
}
.vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 5px rgba(0, 0, 0, 0.5);
}
.vol-slider::-moz-range-thumb {
  width: 13px;
  height: 13px;
  border: none;
  border-radius: 50%;
  background: #fff;
}
.vol-slider::-moz-range-track {
  height: 4px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-pill);
}

/* overlays */
.stage-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 12, 0.6);
  z-index: 6;
  padding: 20px;
}
.overlay-card {
  background: linear-gradient(180deg, var(--panel), var(--bg-alt));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 24px 26px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  max-width: 340px;
  width: 100%;
}
.overlay-sub { margin: 0 0 16px; color: var(--text-dim); font-size: 14px; }
.overlay-sub strong { color: var(--text); }
.overlay-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.overlay-actions button {
  border-radius: 10px;
  padding: 9px 18px;
  font: 600 13.5px var(--font-sans);
  cursor: pointer;
  border: 1px solid var(--border-strong);
  background: var(--panel-2);
  color: var(--text);
  transition: border-color var(--t), background var(--t), transform var(--t);
}
.overlay-actions button:hover { border-color: var(--cyan); background: var(--panel-3); }
.overlay-actions button:active { transform: scale(0.97); }
.overlay-actions button.primary {
  background: var(--grad);
  border: none;
  color: #08100f;
  box-shadow: 0 6px 18px rgba(34, 211, 238, 0.28);
}
.overlay-actions button.primary:hover { filter: brightness(1.07); }

.next-title { margin: 0 0 16px; font-size: 16px; color: var(--text); font-weight: 600; word-break: break-word; }

.center-play {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(11, 14, 20, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
  cursor: pointer;
  transition: transform var(--t), background var(--t), border-color var(--t), box-shadow var(--t);
  z-index: 4;
}
.center-play svg { width: 36px; height: 36px; color: #fff; }
.center-play:hover {
  transform: translate(-50%, -50%) scale(1.06);
  background: rgba(34, 211, 238, 0.18);
  border-color: var(--cyan);
  box-shadow: 0 0 40px rgba(34, 211, 238, 0.35);
}

.spinner {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 54px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  pointer-events: none;
}
.spinner-ring {
  width: 44px;
  height: 44px;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.stage-error {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 12, 0.7);
  color: #f8b4b4;
  font-size: 14px;
  text-align: center;
  padding: 24px;
  z-index: 7;
}
.stage-error p { margin: 0; }

.note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.25);
  color: #9be8f5;
  border-radius: 11px;
  padding: 11px 14px;
  font-size: 13px;
  margin: 0 0 16px;
}
.note::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--grad);
  flex: none;
  margin-top: 4px;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.meta {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
  margin: 14px 0 0;
}
.meta li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 4.5px 12px;
  font-size: 12px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

/* ============================================================
   Downloads
   ============================================================ */
.downloads-page { max-width: 900px; }
.dir-row { display: flex; gap: 8px; }
.dir-row input { flex: 1; }
.dir-row .btn { flex: none; }

.dl-list { display: flex; flex-direction: column; gap: 10px; }
.dl-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color var(--t), background var(--t);
}
.dl-row:hover { border-color: var(--border-strong); }
.dl-icon {
  flex: none;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: var(--panel-2);
  color: var(--cyan);
}
.dl-icon svg { width: 21px; height: 21px; }
.dl-main { flex: 1; min-width: 0; }
.dl-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 7px;
}
.dl-name {
  min-width: 0;
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dl-status {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  padding: 3px 9px;
}
.st-queued    { color: var(--text-dim); background: var(--panel); border: 1px solid var(--border-strong); }
.st-active    { color: #0b0e14; background: var(--grad); }
.st-paused    { color: var(--text-dim); background: var(--panel-2); border: 1px solid var(--border-strong); }
.st-complete  { color: #0b0e14; background: linear-gradient(135deg, #a3e635, #86c71d); }
.st-error     { color: #f8b4b4; background: rgba(248, 113, 113, 0.15); border: 1px solid rgba(248, 113, 113, 0.45); }
.st-removed   { color: var(--muted); background: var(--bg-alt); border: 1px solid var(--border); }

.dl-bar {
  height: 6px;
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  overflow: hidden;
  margin-bottom: 6px;
}
.dl-bar.indeterminate .dl-fill {
  width: 34%;
  animation: dl-slide 1.4s ease-in-out infinite;
}
.dl-fill {
  height: 100%;
  background: var(--grad);
  border-radius: var(--radius-pill);
  box-shadow: 0 0 10px rgba(34, 211, 238, 0.5);
  transition: width 500ms var(--ease);
}
@keyframes dl-slide {
  0%   { margin-left: -34%; }
  100% { margin-left: 100%; }
}

.dl-meta {
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.dl-error {
  margin-top: 5px;
  font-size: 12px;
  color: var(--danger);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dl-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
}
.dl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--panel-2);
  color: var(--text-dim);
  cursor: pointer;
  transition: color var(--t), border-color var(--t), background var(--t), transform var(--t);
}
.dl-btn svg { width: 17px; height: 17px; }
.dl-btn:hover { color: var(--text); border-color: var(--border-strong); background: var(--panel-3); }
.dl-btn:active { transform: scale(0.92); }
.dl-btn.danger:hover { color: var(--danger); border-color: rgba(248, 113, 113, 0.5); background: rgba(248, 113, 113, 0.1); }
.dl-btn.open { color: #0b0e14; background: var(--grad); border: none; }

/* choice rows (used by the compress modal) */
.choice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg-alt);
  cursor: pointer;
  transition: border-color var(--t), background var(--t);
}
.choice + .choice { margin-top: 8px; }
.choice:hover { border-color: var(--border-strong); background: var(--panel-2); }
.choice:has(input:checked) {
  border-color: var(--cyan);
  background: rgba(34, 211, 238, 0.07);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.35);
}
.choice input[type="radio"] {
  margin-top: 3px;
  accent-color: var(--cyan);
  flex: none;
  width: 16px;
  height: 16px;
}
.choice span { display: flex; flex-direction: column; gap: 2px; }
.choice strong { font-size: 13.5px; color: var(--text); }
.choice small { font-size: 12px; color: var(--muted); line-height: 1.45; }
.choice code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; }
.modal-body .choice { margin-top: 8px; }

/* audio page */
.player-wrap {
  max-width: 1000px;
  margin: 26px auto 56px;
  padding: 0 clamp(16px, 3vw, 28px);
}
.player-wrap audio {
  width: 100%;
  margin-top: 12px;
  border-radius: 12px;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1080px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}

@media (max-width: 900px) {
  .player-layout { flex-direction: column; }
  .player-info { width: 100%; }
}

@media (max-width: 680px) {
  .topbar { gap: 10px; padding: 10px 14px; }
  .topbar-actions { display: contents; }
  .brand { order: 1; }
  #btn-upload { order: 2; }
  #btn-folder { order: 3; }
  .search-form { order: 4; flex: 1 1 100%; }
  .search-form .filter { width: 100%; }
  .logout { order: 5; margin-left: auto; }
  .filter { order: 6; flex: 1 1 100%; width: auto; }
  .crumbs { order: 6; flex: 1 1 100%; }
  .subnav { order: 7; flex: 1 1 100%; overflow-x: auto; padding: 4px; scrollbar-width: none; }
  .subnav::-webkit-scrollbar { display: none; }

  .list-head { gap: 10px; }
  .count { width: 100%; margin-left: 0; }

  .list-row { grid-template-columns: 26px 30px minmax(0, 1fr) 28px 28px; gap: 8px; }
  .list-sub, .list-size, .list-date { display: none; }

  .grid { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 18px 12px; }
  .card-name { font-size: 12.5px; }
  .card-sub { font-size: 11px; }
  .thumb-icon svg { width: 36px; height: 36px; }
  .card.video-card:not(.continue-card) .card-name { padding-top: 10px; font-size: 13px; min-height: 2.8em; }
  .card.video-card:not(.continue-card) .card-sub { font-size: 11px; }

  .view-toolbar { padding: 8px 10px; }

  .controls { padding: 34px 8px 8px; }
  .ctrl-btn { width: 34px; height: 34px; }
  .ctrl-btn svg { width: 18px; height: 18px; }
  .vol-slider { width: 46px; }
  .subtitle-menu { position: fixed; right: 8px; bottom: 52px; width: calc(100vw - 16px); max-height: 48vh; }
  .subtitle-option { padding-top: 11px; padding-bottom: 11px; }
  .subtitle-toast { bottom: 72px; }
  .seek-row { gap: 6px; }
  .center-play { width: 64px; height: 64px; }
  .center-play svg { width: 28px; height: 28px; }
}

@media (max-width: 400px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 16px 10px; }
  .brand { font-size: 17px; padding-left: 30px; }
  .brand::before { width: 20px; height: 20px; }
  .container { margin-top: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .card:hover .thumb img,
  .cell, .grid > .card { transform: none; }
}
