/* YouTube Yuklovchi - self-hosted styles (system fonts, light + dark, mobile first). */

:root {
  color-scheme: light dark;

  --bg: #f5f6fa;
  --bg-glow: rgba(255, 0, 51, 0.10);
  --surface: #ffffff;
  --surface-2: #f0f2f7;
  --surface-3: #e7eaf1;
  --border: #e2e5ee;
  --border-strong: #c9cedb;
  --text: #12141a;
  --text-2: #5a6071;
  --brand: #e8002d;
  --brand-hover: #c90027;
  --brand-soft: rgba(232, 0, 45, 0.08);
  --brand-text: #c4002a;
  --on-brand: #ffffff;
  --success: #12924a;
  --danger: #d4202f;
  --danger-soft: #fdeef0;
  --focus: #2f6bff;
  --overlay: rgba(10, 12, 18, 0.82);

  --radius: 18px;
  --radius-md: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 10px 30px -12px rgba(16, 24, 40, 0.12);
  --shadow-hover: 0 2px 4px rgba(16, 24, 40, 0.06), 0 14px 34px -12px rgba(16, 24, 40, 0.2);

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif,
    "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji";
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0c0e13;
    --bg-glow: rgba(255, 40, 80, 0.13);
    --surface: #151821;
    --surface-2: #1c2029;
    --surface-3: #252a35;
    --border: #262b37;
    --border-strong: #394051;
    --text: #eceef3;
    --text-2: #9ca3b4;
    --brand: #ff2e55;
    --brand-hover: #ff4d6d;
    --brand-soft: rgba(255, 46, 85, 0.14);
    --brand-text: #ff6b86;
    --success: #34c773;
    --danger: #ff5c6a;
    --danger-soft: rgba(255, 92, 106, 0.12);
    --focus: #6d9bff;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 30px -12px rgba(0, 0, 0, 0.5);
    --shadow-hover: 0 2px 4px rgba(0, 0, 0, 0.35), 0 14px 34px -12px rgba(0, 0, 0, 0.6);
  }
}

/* ------------------------------------------------------------------ base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(900px 420px at 50% -120px, var(--bg-glow), transparent 70%),
    var(--bg);
  background-repeat: no-repeat;
  -webkit-font-smoothing: antialiased;
}

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

img {
  max-width: 100%;
}

a {
  color: var(--brand-text);
}

button,
input {
  font: inherit;
  color: inherit;
}

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

[hidden] {
  display: none !important;
}

.container {
  width: 100%;
  max-width: 920px;
  margin: 0 auto;
  padding: 0 16px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

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

.small {
  font-size: 0.875rem;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 10;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease, box-shadow 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  cursor: progress;
  opacity: 0.65;
}

.btn-primary {
  background: var(--brand);
  color: var(--on-brand);
  box-shadow: 0 6px 18px -8px var(--brand);
}

.btn-primary:hover {
  background: var(--brand-hover);
}

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

.btn-soft:hover {
  background: var(--surface-3);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}

.btn-ghost:hover {
  background: var(--surface-2);
}

.btn-sm {
  min-height: 36px;
  padding: 6px 12px;
  font-size: 0.875rem;
  border-radius: 10px;
}

.btn-lg {
  min-height: 56px;
  padding: 12px 22px;
  font-size: 1.05rem;
  border-radius: 14px;
}

.btn-xl {
  width: 100%;
  min-height: 60px;
  padding: 14px 28px;
  font-size: 1.15rem;
  border-radius: 16px;
}

.btn-xl .icon {
  width: 24px;
  height: 24px;
}

/* ------------------------------------------------------------------ header */

.site-header {
  padding: 14px 0;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
}

.brand-logo {
  flex: none;
}

.brand-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-accent {
  color: var(--brand-text);
}

.ui-lang {
  display: inline-flex;
  flex: none;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}

.ui-lang-btn {
  min-width: 40px;
  min-height: 34px;
  padding: 4px 8px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  cursor: pointer;
}

.ui-lang-btn:hover {
  color: var(--text);
}

.ui-lang-btn[aria-pressed="true"] {
  background: var(--brand);
  color: var(--on-brand);
}

@media (max-width: 420px) {
  .brand {
    gap: 8px;
    font-size: 1rem;
  }

  .brand-logo {
    width: 30px;
    height: 30px;
  }

  .ui-lang-btn {
    min-width: 34px;
    padding: 4px 6px;
  }
}

/* ------------------------------------------------------------------ hero + form */

main {
  flex: 1;
  outline: none;
}

.hero {
  padding: 20px 0 8px;
  text-align: center;
}

.hero h1 {
  max-width: 720px;
  margin: 0 auto;
  font-size: clamp(1.6rem, 5.4vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 800;
  text-wrap: balance;
}

.lead {
  max-width: 620px;
  margin: 12px auto 0;
  color: var(--text-2);
  font-size: clamp(1rem, 2.6vw, 1.1rem);
  text-wrap: pretty;
}

.url-form {
  margin-top: 24px;
  padding: 12px;
  text-align: left;
}

.input-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}

.input-icon {
  position: absolute;
  left: 16px;
  color: var(--text-2);
  pointer-events: none;
}

#url-input {
  width: 100%;
  height: 56px;
  padding: 0 104px 0 48px;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  font-size: 1rem; /* >= 16px: no zoom on iOS */
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

#url-input::placeholder {
  color: var(--text-2);
  opacity: 0.9;
}

#url-input:hover {
  border-color: var(--border-strong);
}

#url-input:focus {
  outline: none;
  border-color: var(--focus);
  background: var(--surface);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--focus) 22%, transparent);
}

#url-input[aria-invalid="true"] {
  border-color: var(--danger);
}

.paste-btn {
  position: absolute;
  right: 8px;
}

.input-wrap.no-paste #url-input {
  padding-right: 16px;
}

.submit-btn {
  width: 100%;
}

.hint {
  margin: 10px 4px 2px;
  font-size: 0.8125rem;
  color: var(--text-2);
}

.field-error {
  margin: 10px 4px 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 600;
}

.alert-plain {
  margin-top: 16px;
  padding: 16px;
}

@media (min-width: 640px) {
  .hero {
    padding-top: 40px;
  }

  .url-form {
    padding: 14px;
  }

  .input-row {
    flex-direction: row;
  }

  .submit-btn {
    width: auto;
    min-width: 168px;
  }
}

/* ------------------------------------------------------------------ result area */

.result {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 24px;
  scroll-margin-top: 16px;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* video card */

.video-card {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 12px;
}

.thumb {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.thumb img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-placeholder {
  width: 40px;
  height: 40px;
  color: var(--text-2);
  opacity: 0.6;
}

.duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--overlay);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.video-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 2px 4px 4px;
}

.video-title {
  font-size: 1.15rem;
  line-height: 1.3;
  font-weight: 700;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  outline: none;
}

.video-channel {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-2);
  font-size: 0.95rem;
  min-width: 0;
}

.video-channel .icon {
  width: 16px;
  height: 16px;
}

.video-channel span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

.pill .icon {
  width: 14px;
  height: 14px;
}

.pill-brand {
  background: var(--brand-soft);
  color: var(--brand-text);
}

@media (min-width: 640px) {
  .video-card {
    grid-template-columns: 260px 1fr;
    gap: 18px;
    padding: 14px;
  }

  .video-meta {
    padding: 4px 4px 4px 0;
  }
}

/* loading skeleton */

.sk {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

.sk-line {
  height: 14px;
  border-radius: 7px;
}

.sk-w90 { width: 90%; height: 18px; }
.sk-w60 { width: 60%; }
.sk-w30 { width: 30%; }

.loading-text {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-weight: 600;
}

.spinner {
  width: 18px;
  height: 18px;
  flex: none;
  border: 2.5px solid var(--surface-3);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* alerts */

.alert {
  display: flex;
  gap: 12px;
  padding: 16px;
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
  background: var(--danger-soft);
}

.alert-inline {
  border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border));
  border-radius: var(--radius-md);
}

.alert-icon {
  width: 24px;
  height: 24px;
  color: var(--danger);
}

.alert-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.alert-title {
  font-size: 1.05rem;
  font-weight: 700;
}

.details summary {
  cursor: pointer;
  color: var(--text-2);
  font-size: 0.8125rem;
}

.details code {
  display: block;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--surface-2);
  font-family: var(--mono);
  font-size: 0.78rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

/* steps */

.step {
  padding: 18px 16px;
  scroll-margin-top: 16px;
}

.step-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.15rem;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.step-title .icon {
  color: var(--brand-text);
}

.step-hint {
  margin-top: 6px;
  color: var(--text-2);
  font-size: 0.95rem;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 14px;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--text-2);
  pointer-events: none;
}

#lang-search {
  width: 100%;
  height: 44px;
  padding: 0 12px 0 40px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
  font-size: 1rem;
}

#lang-search:focus {
  outline: none;
  border-color: var(--focus);
  background: var(--surface);
}

/* language chips (native radio inputs, visually hidden) */

.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

@media (min-width: 560px) {
  .lang-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }
}

.lang-chip {
  position: relative;
  display: block;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.lang-chip input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
  pointer-events: none;
}

.chip-body {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  height: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.lang-chip:hover .chip-body {
  border-color: var(--border-strong);
}

.lang-chip input:focus-visible + .chip-body {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.lang-chip input:checked + .chip-body {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.chip-flag {
  flex: none;
  font-size: 1.45rem;
  line-height: 1;
}

.chip-names {
  display: flex;
  flex-direction: column;
  min-width: 0;
  flex: 1;
}

.chip-name {
  font-weight: 650;
  line-height: 1.25;
  overflow-wrap: anywhere;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.chip-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  margin-top: 2px;
}

.chip-sub {
  min-width: 0;
  color: var(--text-2);
  font-size: 0.78rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-badge {
  flex: none;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-text);
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.4;
}

.chip-check {
  display: none;
  flex: none;
  width: 18px;
  height: 18px;
  color: var(--brand-text);
}

.lang-chip input:checked + .chip-body .chip-check {
  display: block;
}

@media (max-width: 380px) {
  .chip-body {
    gap: 8px;
    padding: 8px 10px;
  }

  .chip-flag {
    font-size: 1.25rem;
  }
}

/* quality buttons */

.quality-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

@media (min-width: 560px) {
  .quality-grid {
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  }
}

.quality-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 92px;
  padding: 14px 14px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.quality-btn:hover {
  border-color: var(--brand);
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.quality-btn:active {
  transform: translateY(0);
}

.quality-btn:disabled {
  cursor: progress;
  opacity: 0.6;
  transform: none;
}

.q-top {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.q-label {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.q-tag {
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.q-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 10px;
  color: var(--text-2);
  font-size: 0.8125rem;
}

.q-size {
  font-weight: 600;
  color: var(--text);
}

.q-icon {
  width: 22px;
  height: 22px;
  color: var(--brand-text);
}

.quality-btn.is-best {
  border-color: var(--brand);
  background: linear-gradient(180deg, var(--brand-soft), transparent 70%), var(--surface);
  padding-top: 22px;
}

.quality-btn.is-best .q-tag {
  background: var(--brand);
  color: var(--on-brand);
}

.q-ribbon {
  position: absolute;
  top: -10px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-brand);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 4px 10px -4px var(--brand);
}

.q-ribbon .icon {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.quality-btn.is-audio {
  grid-column: 1 / -1; /* MP3 is always last: give it a row of its own */
  min-height: 0;
  background: var(--surface-2);
}

/* ------------------------------------------------------------------ job */

.job {
  padding: 18px 16px;
}

.job-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.job-title {
  font-size: 1.2rem;
  font-weight: 750;
  outline: none;
}

.progress-block {
  margin-top: 16px;
}

.progress {
  position: relative;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.progress-fill {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 70%, #ff8a3d));
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform 0.6s ease;
}

.progress.is-indeterminate .progress-fill,
.progress.is-processing .progress-fill {
  background-image: repeating-linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.22) 0 10px,
    transparent 10px 20px
  ), linear-gradient(90deg, var(--brand), color-mix(in srgb, var(--brand) 70%, #ff8a3d));
  background-size: 28px 28px, 100% 100%;
  animation: stripes 0.9s linear infinite;
}

.progress.is-indeterminate .progress-fill {
  opacity: 0.45;
}

@keyframes stripes {
  to { background-position: 28px 0, 0 0; }
}

.progress-stats {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
  margin-top: 10px;
  color: var(--text-2);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.stat-percent {
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 800;
}

#job-note {
  margin-top: 8px;
}

.done {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 14px;
}

.done-file {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
}

.done-icon {
  width: 28px;
  height: 28px;
  color: var(--success);
}

.done-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.done-filename {
  font-weight: 650;
  overflow-wrap: anywhere;
}

.job .alert-inline {
  margin-top: 14px;
  padding: 14px;
  display: flex;
  gap: 10px;
  background: var(--danger-soft);
}

.job .actions {
  margin-top: 16px;
}

@media (min-width: 640px) {
  .step,
  .job {
    padding: 22px;
  }

  .btn-xl {
    width: auto;
    align-self: flex-start;
  }
}

/* ------------------------------------------------------------------ features + footer */

.features {
  margin: 48px 0 8px;
}

.section-title {
  margin-bottom: 14px;
  font-size: 1.25rem;
  font-weight: 750;
  text-align: center;
}

.feature-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 640px) {
  .feature-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.feature {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
}

.feature h3 {
  margin-top: 10px;
  font-size: 1rem;
  font-weight: 700;
}

.feature p {
  margin-top: 4px;
  color: var(--text-2);
  font-size: 0.92rem;
}

.feature-icon {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand-text);
}

.site-footer {
  padding: 28px 0 32px;
  color: var(--text-2);
  font-size: 0.85rem;
  text-align: center;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  column-gap: 20px;
}

.footer-links a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px; /* comfortable touch target */
  color: var(--text-2);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}

.footer-links a:hover {
  color: var(--text);
  text-decoration-color: currentColor;
}

.footer-links a[aria-current="page"] {
  color: var(--text);
  text-decoration: none;
}

.footer-links .icon {
  width: 16px;
  height: 16px;
}

/* ------------------------------------------------------------------ terms page */

.legal-main {
  max-width: 760px;
  padding-top: 8px;
}

.back-link {
  margin: 0 0 12px;
}

.back-link a {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  font-weight: 600;
  text-decoration: none;
}

.back-link a:hover span {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.back-link .icon {
  width: 18px;
  height: 18px;
}

.legal {
  padding: 22px 18px;
  overflow-wrap: break-word;
}

.legal h1 {
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

.legal h2 {
  margin: 26px 0 8px;
  font-size: 1.1rem;
  line-height: 1.3;
}

.legal-updated {
  margin-top: 6px;
  color: var(--text-2);
  font-size: 0.875rem;
}

.legal-lead {
  margin-top: 14px;
}

.legal ul {
  margin: 0;
  padding-left: 1.25em;
}

.legal li + li {
  margin-top: 8px;
}

.legal li::marker {
  color: var(--brand-text);
}

@media (min-width: 640px) {
  .legal {
    padding: 32px 36px;
  }

  .legal h1 {
    font-size: 1.85rem;
  }
}

/* ------------------------------------------------------------------ 404 page */

.plain-page {
  justify-content: center;
}

.notfound {
  width: calc(100% - 32px);
  max-width: 480px;
  margin: 10vh auto;
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: center;
  align-items: center;
}

.notfound h1 {
  font-size: 1.35rem;
  line-height: 1.25;
}

.notfound p {
  color: var(--text);
}

.notfound p.muted {
  color: var(--text-2);
  font-size: 0.9rem;
}

.notfound-code {
  font-size: 3.5rem;
  font-weight: 900;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--brand-text);
}

.notfound .btn {
  margin-top: 8px;
}

/* ------------------------------------------------------------------ motion */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }

  .spinner {
    animation: spin 1.6s linear infinite !important;
  }
}
