* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f3f4f8;
  --surface: #ffffff;
  --surface-2: #eef0f6;
  --surface-3: #f7f8fc;
  --border: #d8dbe6;
  --text: #1e2230;
  --muted: #656d82;
  --accent: #6254d6;
  --accent-hover: #5548c5;
  --accent-soft: rgba(98, 84, 214, 0.15);
  --ok: #1d8f4c;
  --error: #c93030;
  --warn: #b56b00;
  --favorite: #e25555;
  --radius: 11px;
  --radius-lg: 14px;
  --shadow: 0 8px 24px rgba(25, 28, 36, 0.06);
}

[data-theme="dark"] {
  --bg: #111318;
  --surface: #1b1f2a;
  --surface-2: #242938;
  --surface-3: #161a24;
  --border: #30374b;
  --text: #e4e8f2;
  --muted: #9ca4bd;
  --accent: #7f73f2;
  --accent-hover: #9187f5;
  --accent-soft: rgba(127, 115, 242, 0.2);
  --ok: #55cd87;
  --error: #ff7d7d;
  --warn: #ffbb55;
  --favorite: #ff7d7d;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

html,
body {
  min-height: 100%;
}

body {
  font-family: "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 28px;
}

.notice {
  margin-top: 12px;
  border-radius: var(--radius);
  padding: 10px 12px;
  border: 1px solid var(--border);
  font-size: 0.93rem;
}

.notice.ok {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok), var(--border) 70%);
  background: color-mix(in srgb, var(--ok), transparent 92%);
}

.notice.error {
  color: var(--error);
  border-color: color-mix(in srgb, var(--error), var(--border) 70%);
  background: color-mix(in srgb, var(--error), transparent 92%);
}

.auth-shell {
  max-width: 680px;
  margin: 44px auto;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.auth-shell h2 {
  margin-bottom: 6px;
}

.auth-shell .muted {
  margin-bottom: 14px;
}

.app-shell {
  margin-top: 10px;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 68px;
  border: 1px solid color-mix(in srgb, var(--border), transparent 15%);
  background: color-mix(in srgb, var(--surface), var(--surface-3) 18%);
  border-radius: 16px;
  padding: 10px 12px;
  margin-bottom: 14px;
  box-shadow: 0 10px 28px rgba(12, 17, 32, 0.06);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  flex: 0 0 auto;
}

.brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent) 0%, #3a8bff 100%);
  box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent), transparent 86%);
}

.brand-text {
  font-size: 1.58rem;
  line-height: 1;
  font-weight: 720;
  color: var(--accent);
  letter-spacing: -0.025em;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: 1;
  overflow-x: auto;
  padding: 5px;
  border: 1px solid color-mix(in srgb, var(--border), transparent 20%);
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface-3), transparent 20%);
}

.tab {
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  min-height: 38px;
  font-size: 0.97rem;
  font-weight: 560;
  cursor: pointer;
  white-space: nowrap;
  transition: color 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.tab:hover {
  color: var(--text);
  background: var(--surface);
  border-color: color-mix(in srgb, var(--border), transparent 12%);
}

.tab.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 88%);
  border-color: color-mix(in srgb, var(--accent), transparent 62%);
}

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

.scope-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: color-mix(in srgb, var(--muted), var(--text) 25%);
  font-size: 0.82rem;
  border: 1px solid color-mix(in srgb, var(--border), transparent 10%);
  border-radius: 11px;
  min-height: 40px;
  padding: 0 10px;
  background: var(--surface);
}

.scope-select,
.scope-inline select {
  width: auto;
  min-width: 110px;
  border: 0;
  background: transparent;
  min-height: 34px;
  padding: 6px 8px;
}

.user-menu {
  position: relative;
}

.user-kebab-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--border), transparent 8%);
  background: var(--surface);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: border-color 140ms ease, color 140ms ease, background-color 140ms ease;
}

.user-kebab-btn:hover,
.user-kebab-btn[aria-expanded="true"] {
  border-color: color-mix(in srgb, var(--accent), transparent 55%);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 93%);
}

.menu-avatar-icon,
.menu-kebab-icon,
.menu-item-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.menu-avatar-icon {
  width: 18px;
  height: 18px;
  margin-right: -2px;
}

.menu-kebab-icon {
  width: 14px;
  height: 14px;
}

.menu-kebab-icon circle {
  fill: currentColor;
  stroke: none;
}

.user-menu-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 170px;
  border: 1px solid color-mix(in srgb, var(--border), transparent 12%);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 22px 38px rgba(12, 17, 32, 0.16);
  padding: 6px;
  display: grid;
  gap: 3px;
  z-index: 25;
}

.user-menu-item {
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  min-height: 35px;
  padding: 0 9px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  text-align: left;
}

.user-menu-item:hover {
  background: var(--surface-3);
  border-color: color-mix(in srgb, var(--border), transparent 15%);
}

.user-menu-item.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 92%);
  border-color: color-mix(in srgb, var(--accent), transparent 68%);
}

.user-menu-item.danger {
  color: var(--error);
}

.user-menu-item.danger:hover {
  border-color: color-mix(in srgb, var(--error), transparent 65%);
  background: color-mix(in srgb, var(--error), transparent 93%);
}

.user-menu-item .menu-item-icon {
  width: 15px;
  height: 15px;
}

.user-menu-sep {
  height: 1px;
  background: color-mix(in srgb, var(--border), transparent 20%);
  margin: 3px 1px;
}

.card,
.card-sub {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card-sub {
  border-radius: var(--radius);
  padding: 14px;
}

.card h2,
.card h3,
.card h4 {
  margin-bottom: 10px;
}

.home-shell {
  margin-top: 10px;
}

.download-form {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.download-form > input[type="url"] {
  flex: 1 1 340px;
}

.segmented {
  display: inline-flex;
  align-items: stretch;
  gap: 4px;
  border: 1px solid var(--border);
  background: var(--surface-3);
  border-radius: var(--radius);
  padding: 4px;
  flex-wrap: wrap;
}

.segmented.mode {
  min-width: 220px;
}

.seg-btn {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 9px 12px;
  min-height: 38px;
  font-size: 0.92rem;
  cursor: pointer;
}

.seg-btn:hover {
  color: var(--text);
  background: var(--surface-2);
}

.seg-btn.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 89%);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent), transparent 65%);
}

.active-downloads h2 {
  font-size: 1.85rem;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.active-jobs-list {
  display: grid;
  gap: 9px;
}

.active-job-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 11px;
  background: var(--surface-3);
}

.active-job-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.active-job-title {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.active-job-meta {
  color: var(--muted);
  font-size: 0.82rem;
  white-space: nowrap;
}

.progress-bar {
  width: 100%;
  height: 7px;
  border-radius: 7px;
  background: var(--surface-2);
  overflow: hidden;
  margin-bottom: 8px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-hover));
}

.active-job-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.empty-state {
  color: var(--muted);
  padding: 6px 0;
}

.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.filter-btn {
  border: 1px solid var(--border);
  background: var(--surface-3);
  color: var(--muted);
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 0.88rem;
}

.filter-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.filter-btn.active {
  border-color: var(--accent);
  color: #fff;
  background: var(--accent);
}

.history-inputs,
.library-filter-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: 1.4fr 0.7fr 0.7fr 0.7fr;
}

.library-filter-grid {
  grid-template-columns: 2fr repeat(6, minmax(0, 1fr)) auto;
}

.library-filter-grid .wide {
  min-width: 0;
}

.hidden-inputs {
  display: none;
}

.hidden {
  display: none !important;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 12px;
}

.c12 {
  grid-column: span 12;
}

.c7 {
  grid-column: span 7;
}

.c6 {
  grid-column: span 6;
}

.c5 {
  grid-column: span 5;
}

.c3 {
  grid-column: span 3;
}

.c2 {
  grid-column: span 2;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 0.82rem;
  color: var(--muted);
  font-weight: 500;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 11px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.97rem;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.row.split {
  justify-content: space-between;
}

.settings-head {
  margin-bottom: 12px;
}

.settings-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-tabs .btn.active {
  border-color: color-mix(in srgb, var(--accent), var(--border) 28%);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 89%);
}

.settings-shell .card-sub h3 {
  margin-bottom: 12px;
}

.api-token-card {
  border: 1px solid color-mix(in srgb, var(--border), transparent 10%);
  border-radius: 14px;
  background: var(--surface-3);
  padding: 16px;
}

.api-token-card h4 {
  margin-bottom: 10px;
}

.api-token-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  color: var(--muted);
  margin-bottom: 12px;
}

.api-token-current {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 10px 12px;
  margin-bottom: 10px;
}

.api-token-current-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.api-token-mask {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2), transparent 20%);
  font-size: 1.05rem;
}

.api-token-note {
  margin-bottom: 10px;
}

.api-examples {
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: color-mix(in srgb, var(--surface), var(--surface-3) 30%);
  padding: 10px;
}

.api-examples h5 {
  margin-bottom: 6px;
}

.api-examples .muted {
  margin-bottom: 6px;
}

.api-examples pre {
  margin-bottom: 8px;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(7, 10, 18, 0.38);
  display: grid;
  justify-items: end;
  z-index: 50;
}

.drawer-panel {
  width: min(540px, 100vw);
  height: 100%;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -18px 0 36px rgba(10, 15, 24, 0.16);
  padding: 18px;
  overflow-y: auto;
}

.drawer-panel .grid {
  margin-top: 12px;
}

.row-actions {
  justify-content: flex-end;
}

.btn {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-2);
  color: var(--text);
  min-height: 38px;
  padding: 7px 12px;
  font-size: 0.9rem;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn:hover {
  border-color: var(--accent);
}

.btn-primary {
  border-color: var(--accent);
  background: linear-gradient(135deg, var(--accent), var(--accent-hover));
  color: #fff;
  min-width: 128px;
  font-weight: 600;
}

.btn-primary:hover {
  opacity: 0.94;
}

.btn:disabled,
.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn.ghost {
  background: transparent;
}

.btn.warn {
  border-color: color-mix(in srgb, var(--warn), var(--border) 55%);
  color: var(--warn);
}

.btn.danger {
  border-color: color-mix(in srgb, var(--error), var(--border) 55%);
  color: var(--error);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

thead th {
  text-align: left;
  font-size: 0.8rem;
  color: var(--muted);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  padding: 10px;
  background: var(--surface-3);
}

tbody td {
  padding: 10px;
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: 0;
}

.jobs-history-actions {
  justify-content: flex-end;
  margin-bottom: 8px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.83rem;
}

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

.pill {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--surface-3);
}

.status-chip {
  display: inline-block;
  border-radius: 999px;
  border: 1px solid var(--border);
  padding: 3px 9px;
  font-size: 0.75rem;
  text-transform: lowercase;
}

.status-queued {
  color: #8a6a00;
  border-color: #d8b43f;
  background: rgba(216, 180, 63, 0.18);
}

.status-running {
  color: #0e6a8f;
  border-color: #4ca8ce;
  background: rgba(76, 168, 206, 0.16);
}

.status-completed {
  color: #1b7e42;
  border-color: #47b56f;
  background: rgba(71, 181, 111, 0.14);
}

.status-failed {
  color: #a62f2f;
  border-color: #dc7575;
  background: rgba(220, 117, 117, 0.16);
}

.status-cancelled,
.status-neutral {
  color: var(--muted);
  border-color: var(--border);
  background: var(--surface-3);
}

.source-url {
  max-width: 420px;
  word-break: break-all;
}

.kpi .k {
  color: var(--muted);
  font-size: 0.82rem;
}

.kpi .v {
  font-size: 1.8rem;
  font-weight: 700;
  margin-top: 2px;
}

.kpi-footer {
  margin-top: 10px;
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.dash-table {
  min-width: 100%;
}

.library-summary {
  margin-bottom: 10px;
}

.library-view-actions {
  margin-bottom: 8px;
}

.library-layout-toggle {
  display: inline-flex;
  gap: 8px;
  margin-bottom: 10px;
}

.library-layout-toggle .btn.active {
  border-color: color-mix(in srgb, var(--accent), var(--border) 30%);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 88%);
}

.library-bulk-toolbar {
  display: none;
  margin-bottom: 10px;
}

.library-bulk-toolbar.active {
  display: flex;
}

.library-grid-cards {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.library-card {
  position: relative;
  border: 1px solid var(--border);
  background: var(--surface-3);
  border-radius: var(--radius);
  overflow: hidden;
}

.library-card.selected {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 1px var(--accent);
}

.library-card > .lib-select-item {
  position: absolute;
  top: 9px;
  left: 9px;
  width: 18px;
  height: 18px;
  display: none;
  z-index: 2;
}

.library-cards-root.select-mode .library-card > .lib-select-item {
  display: block;
}

.library-card-thumb {
  aspect-ratio: 16 / 9;
  background: #c9cdd9;
}

.thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.library-card-body {
  padding: 10px;
}

.title-stack {
  margin-bottom: 7px;
}

.title-main {
  font-weight: 600;
}

.title-sub {
  margin-top: 2px;
  color: var(--muted);
}

.library-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
  font-size: 0.82rem;
  color: var(--muted);
}

.source-link {
  color: var(--accent);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 100%;
}

.source-link:hover {
  text-decoration: underline;
}

.library-card-actions {
  margin-top: 9px;
}

.library-card-expand {
  border-top: 1px solid color-mix(in srgb, var(--border), transparent 20%);
  margin-top: 10px;
  padding-top: 10px;
}

.library-inline-slot {
  min-height: 32px;
}

.library-inline-block {
  display: grid;
  gap: 10px;
}

.library-inline {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px;
}

.inline-detail-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.library-list-table {
  min-width: 100%;
}

.library-list-table td {
  vertical-align: top;
}

.library-list-table tr.selected {
  background: color-mix(in srgb, var(--accent), transparent 94%);
}

.library-list-table .lib-select-item {
  display: none;
  width: 18px;
  height: 18px;
}

.library-cards-root.select-mode .library-list-table .lib-select-item {
  display: inline-block;
}

.library-row-expand td {
  padding: 0 10px 12px;
}

.list-title-cell {
  min-width: 260px;
}

.list-actions-cell {
  min-width: 190px;
}

.list-actions-cell .library-card-actions {
  margin-top: 0;
}

.btn-icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.icon-only-btn {
  width: 40px;
  min-width: 40px;
  padding: 0;
}

.detail-toggle-btn.active {
  border-color: color-mix(in srgb, var(--accent), var(--border) 25%);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 86%);
}

.play-toggle-btn.active {
  border-color: color-mix(in srgb, var(--accent), var(--border) 25%);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 86%);
}

.detail-toggle-btn .btn-icon {
  transition: transform 160ms ease;
}

.detail-toggle-btn.active .btn-icon {
  transform: translateX(1px);
}

.favorite-btn.active {
  border-color: color-mix(in srgb, var(--favorite), var(--border) 25%);
  color: var(--favorite);
  background: color-mix(in srgb, var(--favorite), transparent 88%);
}

.favorite-btn.active .btn-icon {
  fill: currentColor;
  stroke: currentColor;
}

.favorite-btn.active .btn-icon path {
  fill: currentColor;
  stroke: currentColor;
}

.detail-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-bottom: 10px;
}

.detail-subhead {
  margin-top: 10px;
}

.detail-tech {
  margin-top: 10px;
  border-top: 1px solid color-mix(in srgb, var(--border), transparent 35%);
  padding-top: 10px;
}

.tech-links {
  justify-content: flex-end;
  margin-bottom: 2px;
}

.info-btn {
  min-width: 40px;
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 12px;
  border-color: color-mix(in srgb, var(--accent), var(--border) 62%);
  background: color-mix(in srgb, var(--accent), transparent 92%);
  color: color-mix(in srgb, var(--accent), var(--text) 20%);
  transition: transform 140ms ease, border-color 140ms ease, background-color 140ms ease, color 140ms ease;
}

.info-btn:hover {
  border-color: color-mix(in srgb, var(--accent), var(--border) 38%);
  background: color-mix(in srgb, var(--accent), transparent 86%);
  color: var(--accent);
  transform: translateY(-1px);
}

.info-btn:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 1px;
}

.info-btn.active {
  border-color: color-mix(in srgb, var(--accent), var(--border) 24%);
  background: color-mix(in srgb, var(--accent), transparent 79%);
  color: var(--accent);
}

.info-btn-icons {
  position: relative;
  width: 19px;
  height: 19px;
  display: inline-grid;
  place-items: center;
}

.info-icon {
  position: absolute;
  width: 18px;
  height: 18px;
  transition: opacity 160ms ease, transform 160ms ease;
}

.info-icon-close {
  opacity: 0;
  transform: scale(0.75) rotate(-25deg);
}

.info-btn.active .info-icon-info {
  opacity: 0;
  transform: scale(0.75) rotate(25deg);
}

.info-btn.active .info-icon-close {
  opacity: 1;
  transform: scale(1) rotate(0deg);
}

.detail-player {
  width: 100%;
  max-height: 420px;
  border-radius: var(--radius);
  background: #000;
  margin: 0;
}

.player-shell {
  border-radius: calc(var(--radius) + 1px);
  overflow: hidden;
  background: #0f1116;
  margin: 8px 0 10px;
}

.player-controls {
  display: grid;
  gap: 10px;
  padding: 10px 12px 12px;
  background: linear-gradient(180deg, #1b2030 0%, #131927 100%);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.player-btn {
  border: 1px solid rgba(131, 153, 207, 0.35);
  border-radius: 12px;
  background: rgba(100, 120, 180, 0.15);
  color: #eef4ff;
  min-height: 40px;
  min-width: 40px;
  padding: 0 11px;
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 120ms ease, border-color 120ms ease, transform 120ms ease;
}

.player-btn:hover {
  border-color: rgba(145, 178, 255, 0.72);
  background: rgba(123, 147, 219, 0.28);
  transform: translateY(-1px);
}

.player-btn:focus-visible {
  outline: 2px solid rgba(153, 187, 255, 0.45);
  outline-offset: 1px;
}

.player-btn.active {
  border-color: rgba(156, 186, 255, 0.88);
  background: rgba(112, 143, 231, 0.4);
}

.player-controls-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.icon-btn {
  width: 42px;
  padding: 0;
}

.play-btn {
  position: relative;
  width: 48px;
  border-radius: 13px;
}

.mute-btn {
  position: relative;
}

.player-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.play-btn .player-icon,
.mute-btn .player-icon {
  position: absolute;
  inset: 0;
  margin: auto;
}

.player-icon-pause,
.player-icon-muted {
  opacity: 0;
  transform: scale(0.75);
  transition: opacity 140ms ease, transform 140ms ease;
}

.player-icon-play,
.player-icon-volume {
  opacity: 1;
  transform: scale(1);
  transition: opacity 140ms ease, transform 140ms ease;
}

.play-btn.active .player-icon-play,
.mute-btn.active .player-icon-volume {
  opacity: 0;
  transform: scale(0.75);
}

.play-btn.active .player-icon-pause,
.mute-btn.active .player-icon-muted {
  opacity: 1;
  transform: scale(1);
}

.seek-btn {
  position: relative;
}

.seek-badge {
  position: absolute;
  right: 4px;
  bottom: 4px;
  font-size: 0.58rem;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0.01em;
  opacity: 0.92;
}

.player-volume-wrap {
  height: 40px;
  padding: 0 10px;
  border: 1px solid rgba(131, 153, 207, 0.35);
  border-radius: 999px;
  background: rgba(100, 120, 180, 0.12);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.volume-static {
  width: 16px;
  height: 16px;
  color: #d4def8;
}

.player-volume {
  width: 110px;
  accent-color: #8eaefd;
  cursor: pointer;
}

.player-progress {
  width: 100%;
  min-width: 0;
  accent-color: #8eaefd;
  cursor: pointer;
}

.player-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.player-time {
  color: #c6d3f6;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

.player-volume::-webkit-slider-runnable-track,
.player-progress::-webkit-slider-runnable-track {
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(232, 238, 255, 0.92), rgba(232, 238, 255, 0.55));
}

.player-volume::-webkit-slider-thumb,
.player-progress::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  margin-top: -4px;
  border: 2px solid #90b0ff;
  background: #f6f9ff;
  box-shadow: 0 2px 8px rgba(58, 92, 189, 0.45);
}

.player-volume::-moz-range-track,
.player-progress::-moz-range-track {
  height: 7px;
  border-radius: 999px;
  border: 0;
  background: linear-gradient(90deg, rgba(232, 238, 255, 0.92), rgba(232, 238, 255, 0.55));
}

.player-volume::-moz-range-thumb,
.player-progress::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid #90b0ff;
  background: #f6f9ff;
  box-shadow: 0 2px 8px rgba(58, 92, 189, 0.45);
}

.list {
  list-style: disc;
  margin-left: 20px;
  display: grid;
  gap: 5px;
}

.auth-submit {
  margin-top: 6px;
}

.slot {
  margin-top: 8px;
}

pre {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-3);
  padding: 10px;
  overflow: auto;
  font-size: 0.82rem;
  line-height: 1.42;
}

.link-btn {
  text-decoration: none;
}

.cookies-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 10px;
  background: var(--surface-3);
  margin: 8px 0 10px;
}

.cookies-status.ok {
  color: var(--ok);
  border-color: color-mix(in srgb, var(--ok), var(--border) 68%);
  background: color-mix(in srgb, var(--ok), transparent 92%);
}

.cookies-status.warn {
  color: var(--muted);
}

.file-btn {
  position: relative;
  overflow: hidden;
}

.hidden-file-input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

@media (max-width: 980px) {
  .wrap {
    padding: 0 12px 24px;
  }

  .topbar {
    gap: 9px;
    flex-wrap: wrap;
    padding: 9px;
  }

  .brand-text {
    font-size: 1.35rem;
  }

  .tabs {
    order: 2;
    width: 100%;
    flex: 0 0 100%;
  }

  .top-actions {
    order: 3;
    margin-left: auto;
  }

  .history-inputs,
  .library-filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .library-grid-cards {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }

  .c7,
  .c6,
  .c5,
  .c3,
  .c2 {
    grid-column: span 12;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }

  .inline-detail-grid {
    grid-template-columns: 1fr;
  }

  .settings-head {
    align-items: flex-start;
    gap: 8px;
  }
}

@media (max-width: 680px) {
  .download-form {
    flex-direction: column;
  }

  .segmented,
  .segmented.mode {
    width: 100%;
  }

  .seg-btn {
    flex: 1 1 auto;
  }

  .history-inputs,
  .library-filter-grid {
    grid-template-columns: 1fr;
  }

  .top-actions {
    width: 100%;
    justify-content: space-between;
  }

  .scope-inline {
    flex: 1;
  }

  .scope-select,
  .scope-inline select {
    min-width: 0;
    width: 100%;
  }

  .user-menu-pop {
    right: 0;
    min-width: 190px;
  }

  .drawer-panel {
    width: 100vw;
    border-left: 0;
  }
}
