:root {
  --bg: #0b0f17;
  --bg-card: #141b28;
  --bg-card-2: #101827;
  --border: #243047;
  --text: #e8eef8;
  --muted: #8fa0bc;
  --accent: #6ee7ff;
  --accent-2: #a78bfa;
  --danger: #ff6b6b;
  --radius: 14px;
  --shadow: 0 16px 48px rgba(0, 0, 0, 0.35);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html {
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.55;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(110, 231, 255, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(167, 139, 250, 0.08), transparent);
}

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

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.hidden { display: none !important; }

.header {
  position: relative;
  z-index: 2;
  border-bottom: 1px solid var(--border);
  background: rgba(11, 15, 23, 0.92);
  backdrop-filter: blur(10px);
  padding: 0.75rem 1rem;
}

.header-inner {
  max-width: 960px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: inherit;
  text-decoration: none;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #1a2744, #2a4870);
  border: 1px solid rgba(110, 231, 255, 0.25);
  display: grid;
  place-items: center;
  font-size: 1.15rem;
  color: var(--accent);
}

.eyebrow {
  margin: 0;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
}

.brand-title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.65rem 1rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-auth {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.nav-user {
  color: var(--muted);
  font-size: 0.85rem;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-btn,
a.nav-btn,
button.nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  line-height: 1.2;
  text-decoration: none;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  white-space: nowrap;
}

.nav-btn:hover,
a.nav-btn:hover,
button.nav-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.auth-header-btn,
.auth-user-chip {
  flex-shrink: 0;
  font: inherit;
  font-size: 0.82rem;
}

.auth-header-btn {
  padding: 0.4rem 0.75rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
}

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

.auth-user-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(110, 231, 255, 0.25);
  background: rgba(110, 231, 255, 0.06);
  color: var(--muted);
}

.auth-user-chip strong {
  color: var(--accent);
  font-weight: 600;
}

.auth-user-chip button {
  padding: 0;
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  text-decoration: underline;
}

.rate-limit-hint {
  margin: 0.65rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

.auth-dialog {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
  background: var(--bg-card);
  color: var(--text);
  max-width: min(22rem, calc(100vw - 2rem));
  box-shadow: var(--shadow);
}

.auth-dialog::backdrop {
  background: rgba(0, 0, 0, 0.65);
}

.auth-dialog-inner {
  position: relative;
  padding: 1.25rem 1.25rem 1.35rem;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.auth-dialog-inner h2 {
  margin: 0 1.5rem 0 0;
  font-size: 1.1rem;
}

.auth-dialog-lead {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.auth-dialog-close {
  position: absolute;
  top: 0.65rem;
  right: 0.75rem;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}

.auth-label {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.auth-dialog input {
  width: 100%;
  padding: 0.55rem 0.7rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

.auth-error {
  margin: 0;
  font-size: 0.85rem;
  color: var(--danger);
}

.auth-submit {
  margin-top: 0.35rem;
  padding: 0.6rem 1rem;
  border-radius: 8px;
  border: 1px solid rgba(110, 231, 255, 0.4);
  background: rgba(110, 231, 255, 0.12);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

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

.lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 0.1rem;
  padding: 0.12rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.lang-btn {
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--muted);
  font: 600 0.72rem/1 inherit;
  letter-spacing: 0.04em;
  padding: 0.28rem 0.45rem;
  border-radius: 999px;
  font-family: inherit;
  min-height: 32px;
  min-width: 2.1rem;
  touch-action: manipulation;
}

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

.lang-btn.active {
  color: var(--text);
  background: rgba(99, 179, 255, 0.18);
}

.nav-link {
  color: var(--muted);
  font-size: 0.88rem;
}

.hero {
  position: relative;
  z-index: 1;
  padding: 1.5rem 1rem 2.5rem;
}

.hero-inner {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
}

.hero-badge {
  display: inline-block;
  margin: 0 0 0.75rem;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(110, 231, 255, 0.35);
  background: rgba(110, 231, 255, 0.08);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.hero h1 {
  margin: 0 0 0.65rem;
  font-size: clamp(1.55rem, 5vw, 2.15rem);
  line-height: 1.15;
}

.hero-lead {
  margin: 0 auto 1.35rem;
  max-width: 36rem;
  color: var(--muted);
  font-size: 1rem;
}

.hero-card {
  text-align: left;
  padding: 1rem;
  border-radius: calc(var(--radius) + 4px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.fetch-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.fetch-form-main {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.turnstile-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 65px;
  padding: 0.15rem 0;
}

.turnstile-wrap iframe {
  border-radius: 8px;
}

.fetch-form input {
  width: 100%;
  padding: 0.9rem 1rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  min-height: 50px;
}

.fetch-form input:focus {
  outline: 2px solid rgba(110, 231, 255, 0.35);
  border-color: var(--accent);
}

.fetch-form button {
  position: relative;
  min-height: 50px;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 12px;
  background: linear-gradient(135deg, #1a6b85, #2a9ec4);
  color: #fff;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: 0 4px 20px rgba(42, 158, 196, 0.35);
}

.fetch-form button:disabled {
  opacity: 0.75;
  cursor: wait;
}

.btn-spinner {
  display: inline-block;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-left: 0.5rem;
}

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

.hero-note {
  margin: 0.85rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
}

.status {
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--muted);
  text-align: left;
  font-size: 0.9rem;
}

.status.error {
  border-color: rgba(255, 107, 107, 0.45);
  color: #ffb4b4;
  background: rgba(255, 107, 107, 0.08);
}

.result {
  margin-top: 1.25rem;
  padding: 0;
  border-radius: var(--radius);
  background: var(--bg-card-2);
  border: 1px solid rgba(110, 231, 255, 0.22);
  text-align: left;
  overflow: hidden;
}

.result-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

.result-preview-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 1.25rem 1rem;
  border-bottom: 1px solid var(--border);
}

.result-preview-media {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.result-thumb-wrap {
  position: relative;
  flex-shrink: 0;
  width: 120px;
  aspect-ratio: 9 / 16;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.result-poster,
.result-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: var(--bg-card-2);
}

.result-video {
  object-fit: contain;
}

.result-thumb-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--accent);
  background: linear-gradient(135deg, #1a2744, #243656);
}

.result-play-btn {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  border: none;
  padding: 0;
  margin: 0;
  background: rgba(0, 0, 0, 0.22);
  color: #fff;
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.15s ease;
  z-index: 2;
}

.result-poster {
  position: relative;
  z-index: 1;
}

.result-play-btn:hover {
  background: rgba(0, 0, 0, 0.48);
}

.result-play-btn svg {
  filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.5));
}

.result-preview-hint {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  width: 100%;
}

@media (min-width: 640px) {
  .result-preview-hint {
    text-align: center;
  }
}

.result-platform {
  margin: 0.75rem 0 0.2rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 700;
}

.result-caption {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.35;
  word-break: break-word;
  color: var(--text);
  max-width: 220px;
}

.result-meta {
  margin: 0.35rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.result-downloads-col {
  padding: 1rem;
}

.dl-section + .dl-section {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.dl-section-title {
  margin: 0 0 0.65rem;
  font-size: 0.95rem;
  font-weight: 700;
}

.dl-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.dl-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.dl-table thead th {
  padding: 0.55rem 0.65rem;
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 700;
  border-bottom: 1px solid var(--border);
}

.dl-table tbody td {
  padding: 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: middle;
}

.dl-table tbody tr:last-child td {
  border-bottom: none;
}

.dl-table-action {
  text-align: right;
  white-space: nowrap;
}

.dl-table-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  border: 1px solid rgba(110, 231, 255, 0.35);
  background: rgba(110, 231, 255, 0.1);
  color: var(--accent);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  min-height: 36px;
  touch-action: manipulation;
}

.dl-table-btn:hover {
  background: rgba(110, 231, 255, 0.18);
  border-color: var(--accent);
  text-decoration: none;
}

.dl-table-btn svg {
  flex-shrink: 0;
}

.section {
  position: relative;
  z-index: 1;
  padding: 2rem 1rem;
  border-top: 1px solid var(--border);
}

.section-inner {
  max-width: 960px;
  margin: 0 auto;
}

.section h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
  text-align: center;
}

.section-sub {
  margin: 0 auto 1.25rem;
  max-width: 32rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.platform-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
}

.platform-grid li {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.25rem;
  padding: 0.85rem 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.pg-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
  background: rgba(110, 231, 255, 0.1);
  color: var(--accent);
  border: 1px solid rgba(110, 231, 255, 0.2);
}

.platform-grid strong {
  font-size: 0.88rem;
}

.platform-grid li > span:last-child {
  font-size: 0.72rem;
  color: var(--muted);
}

.steps-grid {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.steps-grid li {
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.step-num {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: rgba(110, 231, 255, 0.12);
  color: var(--accent);
  font-weight: 800;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
}

.steps-grid h3 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
}

.steps-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.faq-list {
  max-width: 640px;
  margin: 1.25rem auto 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.faq-list details {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg-card);
  padding: 0.65rem 0.85rem;
}

.faq-list summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.92rem;
}

.faq-list p {
  margin: 0.65rem 0 0.15rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.privacy-grid {
  display: grid;
  gap: 0.75rem;
}

.privacy-grid article {
  padding: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.privacy-grid h3 {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  color: var(--accent);
}

.privacy-grid p {
  margin: 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.footer {
  position: relative;
  z-index: 1;
  border-top: 1px solid var(--border);
  padding: 1.5rem 1rem 2rem;
  background: rgba(8, 11, 18, 0.95);
}

.footer-inner {
  max-width: 960px;
  margin: 0 auto;
  font-size: 0.85rem;
  color: var(--muted);
}

.footer .legal {
  font-size: 0.78rem;
  line-height: 1.5;
  margin: 0 0 0.85rem;
}

.footer-links {
  margin: 0;
  line-height: 1.6;
}

.footer-links a {
  white-space: nowrap;
}

@media (min-width: 560px) {
  .fetch-form-main {
    flex-direction: row;
  }
  .fetch-form-main input { flex: 1; }
  .fetch-form-main button {
    flex-shrink: 0;
    min-width: 11rem;
  }
}

@media (min-width: 720px) {
  .steps-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .privacy-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (min-width: 640px) {
  .result-layout {
    grid-template-columns: minmax(160px, 220px) minmax(0, 1fr);
    align-items: stretch;
  }

  .result-preview-col {
    border-bottom: none;
    border-right: 1px solid var(--border);
    padding: 1.35rem 1rem;
  }

  .result-thumb-wrap {
    width: 160px;
  }

  .result-caption {
    max-width: 180px;
  }

  .result-downloads-col {
    padding: 1.25rem 1.35rem;
  }
}

@media (max-width: 639px) {
  .result-thumb-wrap {
    width: 108px;
  }

  .dl-table thead {
    display: none;
  }

  .dl-table tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.35rem 0.75rem;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .dl-table tbody td {
    padding: 0;
    border: none;
  }

  .dl-table tbody td:not(.dl-table-action)::before {
    content: attr(data-label) ": ";
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 600;
  }

  .dl-table-action {
    grid-column: 2;
    grid-row: 1 / span 3;
    align-self: center;
  }
}

@media (max-width: 480px) {
  .header-inner {
    flex-direction: column;
    align-items: stretch;
  }
  .header-nav {
    width: 100%;
    justify-content: flex-end;
  }
  .lang-switcher {
    margin-right: auto;
  }
  .format-row {
    flex-wrap: wrap;
  }
  .format-dl-btn {
    width: 100%;
    justify-content: center;
  }
}

/* ===== Light Mode ===== */
html.light {
  --bg: #f5f7fa;
  --bg-card: #ffffff;
  --bg-card-2: #f0f2f5;
  --border: #e2e8f0;
  --text: #1a1a2e;
  --muted: #4a5568;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

html.light body {
  background: var(--bg);
}

html.light body::before {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(110, 231, 255, 0.04), transparent),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(167, 139, 250, 0.03), transparent);
}

html.light .header {
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--border);
}

html.light .footer {
  background: #f0f2f5;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

html.light .hero-card {
  background: #ffffff;
  border: 1px solid var(--border);
}

.theme-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  padding: 4px 10px;
  line-height: 1;
  transition: background 0.2s, border-color 0.2s;
}
.theme-toggle-btn:hover {
  background: var(--bg-card);
  border-color: var(--muted);
}
