/* VeraDownloader Studio-Instrument Design System
   Light: Warm Slate-Graphite #F6F7F4 / Dark: #101316
   Accent: Signal Teal #0F766E (light) / #14B8A6 (dark) */

:root {
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-muted: #eef0eb;
  --border: #d7dbd2;
  --border-strong: #bac0b3;
  --text: #161a1d;
  --text-muted: #525b61;
  --accent: #0f766e;
  --accent-hover: #0d5e58;
  --accent-soft: rgba(15, 118, 110, 0.1);
  --accent-ink: #ffffff;
  --danger: #b91c1c;
  --danger-soft: rgba(185, 28, 28, 0.08);
  --warning: #a16207;
  --warning-soft: rgba(161, 98, 7, 0.1);
  --success: #0f766e;
  --success-soft: rgba(15, 118, 110, 0.1);
  --shadow-sm: 0 1px 2px rgba(22, 26, 29, 0.06);
  --shadow-md: 0 10px 28px -12px rgba(22, 26, 29, 0.14);
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

[data-theme="dark"] {
  --bg: #101316;
  --surface: #171b1f;
  --surface-muted: #1e2429;
  --border: #2a3138;
  --border-strong: #3b444e;
  --text: #eef1f3;
  --text-muted: #98a2aa;
  --accent: #14b8a6;
  --accent-hover: #2dd4bf;
  --accent-soft: rgba(20, 184, 166, 0.14);
  --accent-ink: #081c1a;
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --success: #2dd4bf;
  --success-soft: rgba(45, 212, 191, 0.14);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 14px 32px -12px rgba(0, 0, 0, 0.55);
}

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

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

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.55;
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

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

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

.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;
}

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* Header */
.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
  flex-wrap: wrap;
  padding: 0.5rem 0;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  text-decoration: none;
}

.brand:hover {
  text-decoration: none;
}

.brand img {
  width: 30px;
  height: 30px;
  display: block;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.nav-links a {
  padding: 0.5rem 0.75rem;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
}

.nav-links a:hover,
.nav-links a.is-active {
  color: var(--text);
  background: var(--surface-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle {
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.75rem;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.theme-toggle:hover {
  background: var(--surface-muted);
}

.theme-toggle:active {
  transform: translateY(1px);
}

/* Main */
.site-main {
  flex: 1;
  padding: 2.25rem 0 3.5rem;
}

/* Notices */
.banner-notice {
  border: 1px solid var(--border);
  background: var(--warning-soft);
  color: var(--text);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 1.5rem;
  font-size: 0.9rem;
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
}

.banner-notice strong {
  color: var(--warning);
}

/* Asymmetric Studio Workbench */
.workbench {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(260px, 0.85fr);
  gap: 2rem;
  align-items: start;
}

.hero-eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 600;
  margin: 0 0 0.5rem;
}

.hero-title {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  margin: 0 0 0.65rem;
  font-weight: 700;
  text-wrap: balance;
}

.hero-subtitle {
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 1.02rem;
  max-width: 58ch;
}

/* Converter Deck */
.converter-deck {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.field-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.45rem;
  color: var(--text);
}

.url-input-wrap {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.url-input {
  width: 100%;
  min-height: 50px;
  padding: 0.75rem 0.95rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.url-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.url-input.is-invalid {
  border-color: var(--danger);
}

.btn-paste {
  min-height: 50px;
  min-width: 78px;
  padding: 0 0.9rem;
  border: 1px solid var(--border);
  background: var(--surface-muted);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-paste:hover {
  background: var(--border);
}

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

.controls-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 1.15rem;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  padding: 0.25rem;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.seg-btn {
  min-height: 44px;
  border: 0;
  background: transparent;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: background-color 150ms ease, color 150ms ease, transform 80ms ease;
}

.seg-btn[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.seg-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.seg-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.quality-select {
  width: 100%;
  min-height: 50px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
  font-size: 0.93rem;
  font-weight: 500;
}

.compliance-check {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-top: 1.15rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  border: 1px solid var(--border);
  font-size: 0.84rem;
  color: var(--text-muted);
}

.compliance-check input[type="checkbox"] {
  width: 20px;
  height: 20px;
  margin-top: 0.1rem;
  accent-color: var(--accent);
  flex-shrink: 0;
  cursor: pointer;
}

.submit-row {
  margin-top: 1.15rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.btn-primary {
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 1.4rem;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 700;
  font-size: 0.98rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  text-decoration: none;
  transition: background-color 150ms ease, transform 80ms ease;
}

.btn-primary:hover {
  background: var(--accent-hover);
  text-decoration: none;
}

.btn-primary:active {
  transform: translateY(1px) scale(0.99);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: wait;
}

.btn-secondary {
  min-height: 44px;
  padding: 0.6rem 1rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.btn-secondary:hover {
  background: var(--surface-muted);
  text-decoration: none;
}

/* Inline Errors & Status Panel */
.inline-error {
  margin-top: 0.85rem;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(185, 28, 28, 0.3);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 500;
}

.status-panel {
  margin-top: 1.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg);
  padding: 1rem 1.1rem;
}

.status-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.status-badge {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
}

.status-badge.is-error {
  background: var(--danger-soft);
  color: var(--danger);
}

.status-title {
  margin: 0.55rem 0 0.25rem;
  font-weight: 600;
  font-size: 0.95rem;
  word-break: break-word;
}

.status-meta {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.progress-track {
  margin-top: 0.8rem;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-muted);
  overflow: hidden;
  border: 1px solid var(--border);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 250ms ease;
}

.status-actions {
  margin-top: 0.95rem;
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

/* Telemetry / Spec Sidebar */
.spec-rail {
  border-top: 2px solid var(--text);
  padding-top: 1rem;
}

.spec-heading {
  font-size: 0.82rem;
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0 0 0.85rem;
}

.spec-list {
  margin: 0;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--border);
}

.spec-list li {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.7rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.88rem;
}

.spec-list li span:first-child {
  color: var(--text-muted);
}

.spec-list li span:last-child {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.legal-box {
  margin-top: 1.25rem;
  padding: 0.95rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  font-size: 0.84rem;
  color: var(--text-muted);
}

.legal-box h2 {
  margin: 0 0 0.35rem;
  font-size: 0.9rem;
  color: var(--text);
}

/* Content & Legal Pages */
.page-article {
  max-width: 780px;
}

.page-article h1 {
  font-size: clamp(1.75rem, 3vw, 2.35rem);
  letter-spacing: -0.02em;
  margin: 0 0 0.75rem;
}

.page-article h2 {
  font-size: 1.2rem;
  margin: 1.75rem 0 0.55rem;
}

.page-article p,
.page-article li {
  color: var(--text-muted);
  max-width: 68ch;
}

.form-grid {
  display: grid;
  gap: 1rem;
  max-width: 600px;
  margin-top: 1.25rem;
}

.form-input,
.form-textarea {
  width: 100%;
  min-height: 46px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.form-textarea {
  min-height: 130px;
  resize: vertical;
}

/* Ad & Native Sponsor Slots */
.ad-slot {
  margin: 1.5rem 0;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.82rem;
}

.ad-slot-result {
  margin: 1.15rem 0 0;
}

.ad-slot-sidebar {
  margin: 1.15rem 0 0;
}

.ad-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.45rem;
}

.ad-network-body {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 60px;
  overflow: hidden;
}

.sponsor-card {
  margin: 1.35rem 0;
  padding: 0.95rem 1.05rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.sponsor-slot-result,
.sponsor-slot-sidebar {
  margin: 1.15rem 0 0;
}

.sponsor-body {
  min-width: 0;
  flex: 1 1 220px;
}

.sponsor-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.14rem 0.45rem;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.sponsor-title {
  display: block;
  font-size: 0.95rem;
  color: var(--text);
}

.sponsor-desc {
  margin: 0.2rem 0 0;
  font-size: 0.84rem;
  color: var(--text-muted);
}

.sponsor-cta {
  min-height: 44px;
  padding: 0.5rem 0.95rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--text);
  font-weight: 600;
  font-size: 0.86rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  white-space: nowrap;
}

.sponsor-cta:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.guide-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--surface);
  font-size: 0.9rem;
}

.guide-table th,
.guide-table td {
  padding: 0.65rem 0.85rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.guide-table th {
  background: var(--surface-muted);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.guide-table tr:last-child td {
  border-bottom: 0;
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  background: var(--surface);
  padding: 1.5rem 0;
  font-size: 0.86rem;
  color: var(--text-muted);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

@media (max-width: 820px) {
  .workbench {
    grid-template-columns: 1fr;
    gap: 1.75rem;
  }
}

@media (max-width: 600px) {
  .controls-row {
    grid-template-columns: 1fr;
  }

  .url-input-wrap {
    flex-direction: column;
  }

  .converter-deck {
    padding: 1.1rem;
  }
}

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