/* ==========================================================================
   AnonStream application styles
   Depends on tokens.css. No inline styles are permitted anywhere in this app
   because the Content Security Policy restricts style-src to 'self'.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Reset and base
   -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* The canvas colour lives on html so the negative z-index ambient layer is
     not painted over by a body background. */
  background-color: var(--canvas);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15.5px;
  line-height: 1.6;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'ss01';
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

p {
  margin: 0;
}

a {
  color: var(--cyan-bright);
  text-decoration: none;
  transition: color var(--dur-micro) var(--ease);
}

a:hover {
  color: var(--text);
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

::selection {
  background: rgba(139, 92, 246, 0.4);
  color: #fff;
}

/* --------------------------------------------------------------------------
   Ambient background
   Two fixed radial washes plus a fine noise layer. The noise is a data URI,
   which the Content Security Policy allows through img-src data:.
   -------------------------------------------------------------------------- */

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(60rem 40rem at 12% -8%, rgba(139, 92, 246, 0.22), transparent 62%),
    radial-gradient(52rem 34rem at 92% 4%, rgba(34, 211, 238, 0.14), transparent 60%),
    radial-gradient(44rem 30rem at 50% 108%, rgba(109, 63, 224, 0.16), transparent 64%);
}

.ambient::after {
  content: '';
  position: absolute;
  inset: 0;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

/* --------------------------------------------------------------------------
   Accessibility helpers
   -------------------------------------------------------------------------- */

.skip-link {
  position: absolute;
  top: var(--space-3);
  left: var(--space-3);
  z-index: 200;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--violet);
  color: #fff;
  font-weight: var(--weight-semibold);
  transform: translateY(-160%);
  transition: transform var(--dur-micro) var(--ease);
}

.skip-link:focus-visible {
  transform: translateY(0);
  color: #fff;
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.hidden {
  display: none !important;
}

/* --------------------------------------------------------------------------
   Layout shell
   -------------------------------------------------------------------------- */

.shell {
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: var(--space-7) var(--space-6) var(--space-10);
}

.shell--narrow {
  max-width: var(--shell-narrow);
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   Glass surface primitives
   -------------------------------------------------------------------------- */

.glass {
  position: relative;
  background: var(--glass-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm), var(--glass-highlight);
  -webkit-backdrop-filter: blur(var(--blur-md)) saturate(140%);
  backdrop-filter: blur(var(--blur-md)) saturate(140%);
}

.glass::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--glass-sheen);
  pointer-events: none;
  opacity: 0.9;
}

.panel {
  position: relative;
  padding: var(--space-6);
  background: var(--glass-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm), var(--glass-highlight);
  -webkit-backdrop-filter: blur(var(--blur-md)) saturate(140%);
  backdrop-filter: blur(var(--blur-md)) saturate(140%);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--glass-1);
  border-bottom: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(var(--blur-lg)) saturate(160%);
  backdrop-filter: blur(var(--blur-lg)) saturate(160%);
}

.site-header > .shell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-5);
  max-width: var(--shell-max);
  min-height: var(--header-height);
  padding-top: var(--space-3);
  padding-bottom: var(--space-3);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text);
  font-weight: var(--weight-semibold);
  letter-spacing: -0.02em;
  font-size: 1.0625rem;
}

.brand:hover {
  color: var(--text);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-xs);
  background: var(--accent-gradient);
  box-shadow: 0 6px 18px rgba(109, 63, 224, 0.42), var(--glass-highlight);
}

.brand-mark svg {
  width: 18px;
  height: 18px;
}

.brand-name {
  background: linear-gradient(120deg, #ffffff 20%, #cfc4ff 60%, #a5f0fb 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1);
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
}

.nav-link {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 0.9375rem;
  font-weight: var(--weight-medium);
  transition:
    color var(--dur-micro) var(--ease),
    background var(--dur-micro) var(--ease);
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.nav-link.is-active,
.nav-link.active {
  color: var(--text);
  background: rgba(139, 92, 246, 0.18);
  box-shadow: inset 0 0 0 1px rgba(167, 139, 250, 0.32);
}

/* --------------------------------------------------------------------------
   Page headings
   -------------------------------------------------------------------------- */

.page-head {
  margin-bottom: var(--space-7);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
  padding: 6px var(--space-3);
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-soft);
  font-size: 0.75rem;
  font-weight: var(--weight-medium);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-gradient);
  box-shadow: var(--glow-cyan);
}

.page-title {
  margin-bottom: var(--space-2);
  font-size: clamp(1.75rem, 1.2rem + 1.8vw, 2.5rem);
  font-weight: var(--weight-bold);
  letter-spacing: -0.03em;
}

.page-subtitle {
  max-width: 56ch;
  color: var(--text-muted);
  font-size: 1rem;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

button,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: var(--space-3) var(--space-5);
  border: 1px solid transparent;
  border-radius: var(--radius-xs);
  background: var(--accent-gradient);
  color: #0a0616;
  font-size: 0.9375rem;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
  cursor: pointer;
  transition:
    transform var(--dur-micro) var(--ease),
    box-shadow var(--dur-micro) var(--ease),
    background var(--dur-micro) var(--ease),
    border-color var(--dur-micro) var(--ease),
    opacity var(--dur-micro) var(--ease);
}

button:hover,
.button:hover {
  box-shadow: var(--glow-violet);
  transform: translateY(-1px);
}

button:active,
.button:active {
  transform: translateY(0);
  box-shadow: none;
}

button.secondary,
.button.secondary {
  background: var(--glass-3);
  border-color: var(--glass-border);
  color: var(--text);
  box-shadow: var(--glass-highlight);
}

button.secondary:hover,
.button.secondary:hover {
  background: var(--glass-2);
  border-color: var(--glass-border-strong);
  box-shadow: var(--shadow-sm);
}

button.ghost,
.button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-soft);
}

button.ghost:hover,
.button.ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  box-shadow: none;
}

button.danger,
.button.danger {
  background: rgba(244, 63, 94, 0.16);
  border-color: rgba(244, 63, 94, 0.38);
  color: #ffd7de;
}

button.danger:hover,
.button.danger:hover {
  background: rgba(244, 63, 94, 0.26);
  border-color: rgba(244, 63, 94, 0.6);
  box-shadow: 0 8px 24px rgba(244, 63, 94, 0.22);
}

button:disabled,
.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

button[data-loading='true'] {
  color: transparent;
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Form controls
   -------------------------------------------------------------------------- */

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.8125rem;
  font-weight: var(--weight-medium);
  letter-spacing: 0.01em;
  color: var(--text-muted);
}

input[type='text'],
input[type='password'],
input[type='number'],
input[type='search'],
select,
textarea {
  width: 100%;
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  background: rgba(8, 8, 14, 0.62);
  color: var(--text);
  font-size: 0.9375rem;
  transition:
    border-color var(--dur-micro) var(--ease),
    box-shadow var(--dur-micro) var(--ease),
    background var(--dur-micro) var(--ease);
}

input::placeholder {
  color: var(--text-faint);
}

input:hover,
select:hover,
textarea:hover {
  border-color: var(--glass-border-strong);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(139, 92, 246, 0.7);
  background: rgba(8, 8, 14, 0.82);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.16);
}

input:disabled,
select:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

input[aria-invalid='true'] {
  border-color: rgba(244, 63, 94, 0.7);
  box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.12);
}

select {
  appearance: none;
  padding-right: var(--space-8);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8' fill='none' stroke='%239393a8' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-4) center;
  background-size: 12px 8px;
  cursor: pointer;
}

.field-error {
  color: #ffb3c0;
  font-size: 0.8125rem;
  font-weight: var(--weight-regular);
}

/* --------------------------------------------------------------------------
   Chips and badges
   -------------------------------------------------------------------------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-soft);
  font-size: 0.75rem;
  font-weight: var(--weight-medium);
  white-space: nowrap;
}

.chip--violet {
  border-color: rgba(139, 92, 246, 0.38);
  background: rgba(139, 92, 246, 0.14);
  color: #ddd0ff;
}

.chip--cyan {
  border-color: rgba(34, 211, 238, 0.34);
  background: rgba(34, 211, 238, 0.12);
  color: #a9f0fb;
}

.chip--warning {
  border-color: rgba(251, 191, 36, 0.38);
  background: var(--warning-soft);
  color: #ffe6a8;
}

.chip--danger {
  border-color: rgba(244, 63, 94, 0.38);
  background: var(--danger-soft);
  color: #ffc2cd;
}

/* --------------------------------------------------------------------------
   Drop zone
   -------------------------------------------------------------------------- */

.drop-zone {
  position: relative;
  display: grid;
  place-items: center;
  gap: var(--space-2);
  padding: var(--space-9) var(--space-6);
  text-align: center;
  border: 1px dashed rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-lg);
  background: var(--glass-1);
  box-shadow: var(--glass-highlight);
  -webkit-backdrop-filter: blur(var(--blur-md));
  backdrop-filter: blur(var(--blur-md));
  cursor: pointer;
  overflow: hidden;
  transition:
    border-color var(--dur-base) var(--ease),
    background var(--dur-base) var(--ease),
    transform var(--dur-base) var(--ease);
}

.drop-zone::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--accent-gradient-soft);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease);
  pointer-events: none;
}

.drop-zone:hover {
  border-color: rgba(167, 139, 250, 0.55);
}

.drop-zone:hover::after {
  opacity: 0.6;
}

.drop-zone.dragover {
  border-color: var(--cyan);
  transform: scale(1.006);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.4), 0 24px 60px rgba(34, 211, 238, 0.14);
}

.drop-zone.dragover::after {
  opacity: 1;
}

.drop-zone p {
  position: relative;
  z-index: 1;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.drop-zone p strong {
  color: var(--text);
  font-weight: var(--weight-semibold);
}

.drop-zone .icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-bottom: var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--accent-gradient-soft);
  color: var(--violet-bright);
  box-shadow: var(--glass-highlight);
}

.drop-zone .icon svg {
  width: 24px;
  height: 24px;
}

/* --------------------------------------------------------------------------
   Upload queue
   -------------------------------------------------------------------------- */

.queue,
.results {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin-top: var(--space-6);
}

.queue:empty,
.results:empty {
  display: none;
}

.queue-item {
  position: relative;
  padding: var(--space-5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-2);
  box-shadow: var(--shadow-sm), var(--glass-highlight);
  -webkit-backdrop-filter: blur(var(--blur-md)) saturate(140%);
  backdrop-filter: blur(var(--blur-md)) saturate(140%);
  transition: border-color var(--dur-base) var(--ease);
}

.queue-item.is-uploading {
  border-color: rgba(139, 92, 246, 0.4);
}

.queue-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.queue-file {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-width: 0;
}

.queue-icon {
  display: grid;
  flex: none;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--glass-border);
  background: var(--accent-gradient-soft);
  color: var(--violet-bright);
}

.queue-icon svg {
  width: 18px;
  height: 18px;
}

.queue-naming {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.3;
}

.queue-title {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
}

.queue-size {
  color: var(--text-faint);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.queue-status {
  flex: none;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: var(--weight-medium);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.queue-status.is-done {
  border-color: rgba(52, 211, 153, 0.4);
  background: var(--success-soft);
  color: #a7f3d0;
}

.queue-status.is-error {
  border-color: rgba(244, 63, 94, 0.42);
  background: var(--danger-soft);
  color: #ffc2cd;
  white-space: normal;
}

.queue-item.is-done {
  border-color: rgba(52, 211, 153, 0.32);
}

.queue-item.is-failed {
  border-color: rgba(244, 63, 94, 0.4);
}

.queue-progress-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.queue-percent {
  flex: none;
  min-width: 38px;
  text-align: right;
  color: var(--text-faint);
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
}

.queue-fields {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.queue-fields input,
.queue-fields select {
  font-size: 0.875rem;
}

.queue-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

/* --------------------------------------------------------------------------
   Progress
   -------------------------------------------------------------------------- */

.progress-bar {
  width: 100%;
  height: 6px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent-gradient);
  box-shadow: var(--glow-cyan);
  transition: width var(--dur-base) var(--ease);
}

.progress-fill.done {
  background: linear-gradient(135deg, #34d399, #6ee7b7);
  box-shadow: 0 0 18px rgba(52, 211, 153, 0.32);
}

.progress-fill.failed {
  background: linear-gradient(135deg, #f43f5e, #fb7185);
  box-shadow: 0 0 18px rgba(244, 63, 94, 0.32);
}

/* --------------------------------------------------------------------------
   Notices and result cards
   -------------------------------------------------------------------------- */

.notice {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xs);
  background: var(--glass-3);
  color: var(--text-soft);
  font-size: 0.875rem;
}

.result-card {
  position: relative;
  padding: var(--space-5);
  border: 1px solid rgba(139, 92, 246, 0.34);
  border-radius: var(--radius-md);
  background: var(--glass-2);
  box-shadow: var(--shadow-md), 0 0 0 1px rgba(139, 92, 246, 0.12);
  -webkit-backdrop-filter: blur(var(--blur-md)) saturate(150%);
  backdrop-filter: blur(var(--blur-md)) saturate(150%);
  animation: rise var(--dur-page) var(--ease-out) both;
}

.result-card h3 {
  margin-bottom: 2px;
  font-size: 1.0625rem;
}

.result-card p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.result-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
}

.result-check {
  display: grid;
  flex: none;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(52, 211, 153, 0.42);
  background: var(--success-soft);
  color: var(--success);
}

.result-check svg {
  width: 17px;
  height: 17px;
}

.result-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: var(--space-4);
}

.result-link {
  display: flex;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.result-link input {
  flex: 1;
  min-width: 0;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
}

/* --------------------------------------------------------------------------
   Library grid
   -------------------------------------------------------------------------- */

.library-head {
  margin-bottom: var(--space-6);
}

.library-head .page-head {
  margin-bottom: 0;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.stats:empty {
  display: none;
}

.stat {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: var(--glass-1);
  box-shadow: var(--glass-highlight);
}

.stat-value {
  display: block;
  font-variant-numeric: tabular-nums;
  font-size: 1.25rem;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.02em;
}

.stat-label {
  display: block;
  color: var(--text-faint);
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-5);
}

.video-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-2);
  box-shadow: var(--shadow-sm), var(--glass-highlight);
  overflow: hidden;
  -webkit-backdrop-filter: blur(var(--blur-sm));
  backdrop-filter: blur(var(--blur-sm));
  transition:
    transform var(--dur-base) var(--ease),
    border-color var(--dur-base) var(--ease),
    box-shadow var(--dur-base) var(--ease);
}

.video-card:hover {
  transform: translateY(-3px);
  border-color: var(--glass-border-strong);
  box-shadow: var(--shadow-lg), 0 0 0 1px rgba(139, 92, 246, 0.18);
}

.video-card .thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #05050a;
  overflow: hidden;
}

.video-card .thumb::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 55%, rgba(5, 5, 10, 0.75) 100%);
  pointer-events: none;
}

.video-card .thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.video-card .thumb .thumb-lock {
  display: grid;
  place-items: center;
  height: 100%;
  color: var(--text-faint);
  background: radial-gradient(circle at 50% 45%, rgba(139, 92, 246, 0.22), transparent 62%);
}

.video-card .thumb .thumb-lock svg {
  width: 30px;
  height: 30px;
}

.video-card .info {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-4) var(--space-5);
}

.video-card .info h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1rem;
  font-weight: var(--weight-semibold);
}

.video-card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.video-card .meta br {
  display: none;
}

.video-card .actions {
  display: flex;
  gap: var(--space-2);
  margin-top: auto;
}

.video-card .actions button {
  flex: 1;
  min-width: 0;
  min-height: 38px;
  padding: var(--space-2) var(--space-3);
  font-size: 0.8125rem;
}

/* --------------------------------------------------------------------------
   Empty state
   -------------------------------------------------------------------------- */

.empty-state {
  display: grid;
  place-items: center;
  gap: var(--space-3);
  padding: var(--space-9) var(--space-6);
  text-align: center;
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-lg);
  background: var(--glass-1);
  color: var(--text-muted);
}

.empty-state h2 {
  color: var(--text);
  font-size: 1.25rem;
  font-weight: var(--weight-semibold);
}

.empty-state p {
  max-width: 46ch;
}

.empty-state a,
.empty-state .button {
  margin-top: var(--space-2);
}

.empty-art {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  margin-bottom: var(--space-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--glass-border);
  background: var(--accent-gradient-soft);
  color: var(--violet-bright);
}

.empty-art svg {
  width: 28px;
  height: 28px;
}

/* --------------------------------------------------------------------------
   Watch page
   -------------------------------------------------------------------------- */

.watch-shell {
  max-width: 1000px;
}

.watch-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: #05050a;
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 80px rgba(109, 63, 224, 0.16);
}

.watch-player video {
  width: 100%;
  height: 100%;
}

.watch-info {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  flex-wrap: wrap;
  margin-top: var(--space-5);
  padding: var(--space-5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-1);
  box-shadow: var(--glass-highlight);
  -webkit-backdrop-filter: blur(var(--blur-md)) saturate(140%);
  backdrop-filter: blur(var(--blur-md)) saturate(140%);
}

.watch-info h1 {
  margin-bottom: var(--space-2);
  font-size: clamp(1.25rem, 1rem + 1vw, 1.625rem);
  overflow-wrap: anywhere;
}

.watch-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   PIN gate
   -------------------------------------------------------------------------- */

.pin-gate {
  width: 100%;
  max-width: 400px;
  margin: var(--space-9) auto;
  padding: var(--space-7);
  text-align: center;
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: var(--glass-2);
  box-shadow: var(--shadow-lg), var(--glass-highlight);
  -webkit-backdrop-filter: blur(var(--blur-lg)) saturate(150%);
  backdrop-filter: blur(var(--blur-lg)) saturate(150%);
}

.pin-gate h2 {
  margin-bottom: var(--space-2);
  font-size: 1.25rem;
}

.pin-gate > p {
  margin-bottom: var(--space-5);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.pin-gate input {
  margin-bottom: var(--space-4);
  padding: var(--space-4);
  text-align: center;
  font-family: var(--font-mono);
  font-size: 1.375rem;
  letter-spacing: 0.42em;
  text-indent: 0.42em;
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.pin-key {
  min-height: 50px;
  padding: 0;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  color: var(--text);
  font-size: 1.0625rem;
  font-weight: var(--weight-medium);
  font-variant-numeric: tabular-nums;
  box-shadow: var(--glass-highlight);
}

.pin-key:hover {
  background: rgba(139, 92, 246, 0.16);
  border-color: rgba(167, 139, 250, 0.42);
  box-shadow: none;
  transform: none;
}

.pin-key--alt {
  color: var(--text-muted);
  font-size: 0.8125rem;
  letter-spacing: 0.02em;
}

#unlockBtn {
  width: 100%;
}

#downloadBtn svg {
  width: 16px;
  height: 16px;
}

.pin-error {
  min-height: 1.25rem;
  margin-top: var(--space-3);
  color: #ffb3c0;
  font-size: 0.875rem;
}

.pin-error:empty {
  min-height: 0;
  margin-top: 0;
}

/* --------------------------------------------------------------------------
   Toasts
   -------------------------------------------------------------------------- */

.toast-stack {
  position: fixed;
  right: var(--space-5);
  bottom: var(--space-5);
  z-index: 150;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  max-width: min(360px, calc(100vw - var(--space-8)));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: var(--glass-3);
  box-shadow: var(--shadow-md), var(--glass-highlight);
  color: var(--text);
  font-size: 0.875rem;
  pointer-events: auto;
  -webkit-backdrop-filter: blur(var(--blur-md)) saturate(150%);
  backdrop-filter: blur(var(--blur-md)) saturate(150%);
  animation: toast-in var(--dur-base) var(--ease-out) both;
}

.toast.is-leaving {
  animation: toast-out var(--dur-micro) var(--ease) both;
}

.toast--success {
  border-color: rgba(52, 211, 153, 0.4);
}

.toast--error {
  border-color: rgba(244, 63, 94, 0.45);
}

.toast-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--violet-bright);
  box-shadow: 0 0 10px currentColor;
}

.toast--success .toast-dot {
  background: var(--success);
}

.toast--error .toast-dot {
  background: var(--danger);
}

/* --------------------------------------------------------------------------
   Dialog
   -------------------------------------------------------------------------- */

dialog {
  width: min(440px, calc(100vw - var(--space-7)));
  padding: var(--space-6);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  background: var(--glass-3);
  box-shadow: var(--shadow-lg);
  color: var(--text);
}

dialog::backdrop {
  background: rgba(4, 4, 7, 0.62);
  -webkit-backdrop-filter: blur(var(--blur-sm));
  backdrop-filter: blur(var(--blur-sm));
}

dialog h2 {
  margin-bottom: var(--space-2);
  font-size: 1.125rem;
}

dialog p {
  margin-bottom: var(--space-6);
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

/* --------------------------------------------------------------------------
   Skeletons
   -------------------------------------------------------------------------- */

.skeleton {
  position: relative;
  border-radius: var(--radius-xs);
  background: rgba(255, 255, 255, 0.06);
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.09),
    transparent
  );
  animation: shimmer 1.6s infinite;
}

.skeleton-card {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-1);
  overflow: hidden;
}

.skeleton-card .skeleton {
  height: 170px;
  border-radius: 0;
}

.skeleton-lines {
  display: grid;
  gap: var(--space-2);
  padding: var(--space-4);
}

.skeleton-lines .skeleton:first-child {
  height: 14px;
  width: 70%;
}

.skeleton-lines .skeleton:last-child {
  height: 12px;
  width: 45%;
}

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-out {
  from {
    opacity: 1;
    transform: translateY(0);
  }

  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes shake {
  10%,
  90% {
    transform: translateX(-1px);
  }

  20%,
  80% {
    transform: translateX(2px);
  }

  30%,
  50%,
  70% {
    transform: translateX(-3px);
  }

  40%,
  60% {
    transform: translateX(3px);
  }
}

.is-shaking {
  animation: shake 420ms var(--ease);
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .skeleton::after {
    display: none;
  }
}

/* --------------------------------------------------------------------------
   Authentication and settings
   -------------------------------------------------------------------------- */

.auth-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  min-height: calc(100vh - var(--header-height));
  padding-top: var(--space-9);
  padding-bottom: var(--space-9);
}

.auth-brand {
  margin-bottom: var(--space-1);
}

.auth-card {
  width: 100%;
  max-width: 460px;
  padding: var(--space-8) var(--space-7);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md), var(--glass-highlight);
  text-align: center;
  animation: rise var(--dur-page) var(--ease-out) both;
}

.auth-card .eyebrow {
  justify-content: center;
}

.auth-card h1 {
  margin-bottom: var(--space-2);
  font-size: clamp(1.6rem, 1.2rem + 1.4vw, 2rem);
  font-weight: var(--weight-bold);
  letter-spacing: -0.03em;
}

.auth-mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto var(--space-5);
  border: 1px solid rgba(167, 139, 250, 0.28);
  border-radius: 18px;
  background: var(--accent-gradient-soft);
  box-shadow: var(--glow-cyan);
}

.auth-mark svg {
  width: 28px;
  height: 28px;
  color: var(--violet-bright);
}

.auth-sub {
  margin-bottom: var(--space-6);
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.auth-error {
  margin-bottom: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border: 1px solid rgba(244, 63, 94, 0.32);
  border-radius: var(--radius-xs);
  background: var(--danger-soft);
  color: #ffd7de;
  font-size: 0.875rem;
  text-align: left;
}

.discord-button {
  width: 100%;
}

.discord-button svg {
  width: 20px;
  height: 20px;
}

.auth-note {
  margin-top: var(--space-5);
  color: var(--text-faint);
  font-size: 0.8125rem;
}

.auth-foot {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.auth-foot a {
  color: var(--text-soft);
}

#authUnavailable {
  margin-top: var(--space-4);
  text-align: left;
}

#authUnavailable p {
  margin: var(--space-2) 0 var(--space-4);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.settings-stack {
  display: grid;
  gap: var(--space-5);
  max-width: 820px;
}

.account-panel {
  display: flex;
  align-items: center;
  gap: var(--space-5);
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--accent-gradient);
  box-shadow: var(--glow-cyan);
  color: #0a0616;
  font-size: 1.0625rem;
  font-weight: var(--weight-bold);
  letter-spacing: 0.02em;
}

.avatar--admin {
  box-shadow: var(--glow-violet);
}

.account-meta {
  display: grid;
  flex: 1 1 auto;
  gap: var(--space-1);
  min-width: 0;
}

.account-meta .eyebrow {
  justify-self: start;
  margin-bottom: 0;
}

.account-name {
  overflow-wrap: anywhere;
  font-size: 1.375rem;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.02em;
}

.account-detail {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-top: var(--space-1);
  color: var(--text-muted);
  font-size: 0.875rem;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.section-head h2 {
  margin-bottom: var(--space-1);
  font-size: 1.125rem;
  letter-spacing: -0.01em;
}

.section-head p {
  max-width: 54ch;
  color: var(--text-muted);
  font-size: 0.875rem;
  line-height: 1.55;
}

.token-list {
  display: grid;
  gap: var(--space-3);
}

.token-empty {
  padding: var(--space-4) 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
}

.token-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.03);
  transition:
    border-color var(--dur-micro) var(--ease),
    background var(--dur-micro) var(--ease);
}

.token-item:hover {
  border-color: var(--glass-border-strong);
  background: rgba(255, 255, 255, 0.05);
}

.token-info {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.token-name {
  overflow-wrap: anywhere;
  font-weight: var(--weight-semibold);
}

.token-meta {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-3);
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.token-prefix {
  color: var(--cyan-bright);
  font-family: var(--font-mono);
}

.token-actions {
  display: flex;
  flex: 0 0 auto;
  gap: var(--space-2);
}

.token-actions button {
  min-height: 38px;
  padding: var(--space-2) var(--space-3);
  font-size: 0.875rem;
}

.token-actions button svg {
  width: 16px;
  height: 16px;
}

.token-actions button.danger-text {
  color: #fda4b4;
}

.token-actions button.danger-text:hover {
  background: var(--danger-soft);
  color: #ffd7de;
}

.token-reveal {
  display: grid;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  padding: var(--space-4);
  border: 1px dashed rgba(167, 139, 250, 0.42);
  border-radius: var(--radius-sm);
  background: var(--accent-gradient-soft);
}

.token-reveal-title {
  color: var(--text-soft);
  font-size: 0.875rem;
  font-weight: var(--weight-medium);
}

.token-reveal .result-link {
  margin-top: 0;
}

.dialog-input {
  width: 100%;
  margin-bottom: var(--space-2);
}

#tokenDialog .field-error {
  margin-bottom: var(--space-4);
}

@media (max-width: 640px) {
  .auth-card {
    padding: var(--space-7) var(--space-5);
  }

  .account-panel {
    flex-wrap: wrap;
  }

  .account-panel > button {
    width: 100%;
  }

  .section-head {
    flex-direction: column;
  }

  .token-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .token-actions {
    width: 100%;
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 820px) {
  .queue-fields {
    grid-template-columns: 1fr;
  }

  .shell {
    padding: var(--space-6) var(--space-4) var(--space-9);
  }

  .site-header > .shell {
    padding-top: var(--space-2);
    padding-bottom: var(--space-2);
  }

  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 15px;
  }

  .brand-name {
    display: none;
  }

  .drop-zone {
    padding: var(--space-7) var(--space-4);
  }

  .result-link {
    flex-wrap: wrap;
  }

  .result-link input {
    flex-basis: 100%;
  }

  .library-head {
    align-items: flex-start;
  }

  .stats {
    gap: var(--space-2);
  }

  .stat {
    padding: var(--space-2) var(--space-3);
  }

  .stat-value {
    font-size: 1.0625rem;
  }

  .stat-label {
    font-size: 0.6875rem;
  }
}

/* Setup page ------------------------------------------------------------- */

.steps {
  display: grid;
  gap: var(--space-5);
  margin: var(--space-2) 0 0;
  padding: 0;
  list-style: none;
}

.step {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: var(--space-4);
  align-items: start;
}

.step-num {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-pill);
  background: var(--accent-gradient-soft);
  border: 1px solid var(--glass-border-strong);
  color: var(--cyan-bright);
  font-size: 0.875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.step-body h3 {
  margin: 0 0 var(--space-1);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
}

.step-body p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.step-body code {
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--glass-3);
  border: 1px solid var(--glass-border);
  color: var(--text-soft);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.8125rem;
  white-space: nowrap;
}

.panel .actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.security-note h2 {
  margin: 0 0 var(--space-2);
  font-size: 1.0625rem;
}

.security-note p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.token-note {
  margin: 0 0 var(--space-5);
  padding: var(--space-4);
  border: 1px solid var(--glass-border);
  border-left: 3px solid var(--violet);
  border-radius: var(--radius-xs);
  background: var(--accent-gradient-soft);
}

.token-note h3 {
  margin: 0 0 var(--space-1);
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
}

.token-note p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.6;
  color: var(--text-soft);
}

/* Admin ------------------------------------------------------------------ */

.admin-list {
  display: grid;
  gap: var(--space-4);
}

.admin-row {
  display: grid;
  gap: var(--space-4);
  padding: var(--space-5);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-md);
  background: var(--glass-2);
}

.admin-row-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.admin-identity {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.avatar--sm {
  width: 42px;
  height: 42px;
  font-size: 0.875rem;
}

.admin-names {
  display: grid;
  gap: var(--space-1);
  min-width: 0;
}

.admin-name {
  overflow-wrap: anywhere;
  font-size: 1.0625rem;
  font-weight: var(--weight-semibold);
  letter-spacing: -0.01em;
}

.admin-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.admin-usage {
  display: grid;
  flex: 1 1 260px;
  gap: 6px;
  max-width: 340px;
}

.admin-usage-head {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}

.admin-usage-percent {
  color: var(--text-soft);
}

.admin-usage-note {
  color: var(--text-faint);
  font-size: 0.8125rem;
}

.admin-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--glass-border);
}

.admin-quota-field {
  flex: 0 1 170px;
  min-width: 130px;
}

.admin-quota-field input {
  min-height: 40px;
}

.admin-controls button {
  min-height: 40px;
}

.notice--error {
  border-color: rgba(244, 63, 94, 0.42);
  background: var(--danger-soft);
  color: #ffc2cd;
}

@media (max-width: 640px) {
  .admin-usage {
    max-width: none;
  }

  .admin-controls button {
    flex: 1 1 auto;
  }
}

.account-usage {
  display: grid;
  flex: 1 1 100%;
  gap: 6px;
  margin-top: var(--space-1);
  color: var(--text-faint);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
