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

:root {
  --bg: #0d0f16;
  --bg-grad: radial-gradient(1200px 600px at 50% -10%, #1b2138 0%, #0d0f16 55%);
  --surface: #161a25;
  --surface-2: #1b2030;
  --border: #2a2f3d;
  --text: #e8eaef;
  --muted: #8b919e;
  --accent: #6c8cff;
  --accent-hover: #8aa4ff;
  --success: #4ade80;
  --warning: #fbbf24;
  --error: #f87171;
  --radius: 14px;
  --radius-sm: 9px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg-grad), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.55;
}

/* ---------- Nav ---------- */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  max-width: 1120px;
  margin: 0 auto;
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.05rem;
}

.nav-logo {
  width: 26px;
  height: 26px;
  color: var(--accent);
}

.nav-right {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
}

.nav-link:hover {
  color: var(--text);
}

.lang-switch {
  display: inline-flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
}

.lang-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.lang-btn:hover { color: var(--text); }
.lang-btn.active { background: var(--accent); color: #fff; }
.lang-btn:focus-visible { outline: 2px solid var(--accent-hover); outline-offset: 1px; }

/* ---------- Page / hero ---------- */
.page {
  max-width: 1120px;
  margin: 0 auto;
  padding: 1rem 1.5rem 3rem;
}

.hero {
  text-align: center;
  margin: 1.5rem 0 2.5rem;
}

.hero-title {
  margin: 0 0 0.6rem;
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.badge-beta {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #cdd9ff;
  background: rgba(108, 140, 255, 0.18);
  border: 1px solid rgba(108, 140, 255, 0.4);
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  white-space: nowrap;
}

.tagline {
  margin: 0 0 1.25rem;
  color: var(--muted);
  font-size: 1.05rem;
}

.trust {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 0.85rem;
}

.trust-item {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
}

.trust-item svg { width: 16px; height: 16px; }
.trust-ok svg { color: var(--success); }
.trust-wip svg { color: var(--warning); }

/* ---------- Layout grid ---------- */
.layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.col {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
}

.card-title {
  margin: 0 0 0.5rem;
  font-size: 1.05rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-title.accent { color: var(--accent-hover); }

.card-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.card-beta {
  background: linear-gradient(180deg, rgba(108, 140, 255, 0.08), rgba(108, 140, 255, 0.02));
  border-color: rgba(108, 140, 255, 0.3);
}

.card-help {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.5rem 1rem;
  align-items: center;
}

.card-help-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--accent);
}

.card-help-icon svg { width: 22px; height: 22px; }
.card-help-body { grid-column: 2; }
.card-help .btn-ghost { grid-column: 2; justify-self: start; margin-top: 0.25rem; }

/* ---------- Format picker ---------- */
.format-picker {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.format-label {
  font-size: 0.85rem;
  color: var(--muted);
}

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

.seg-option { position: relative; cursor: pointer; }

.seg-option input {
  position: absolute;
  opacity: 0;
  inset: 0;
  cursor: pointer;
}

.seg-option span {
  display: block;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  font-size: 0.85rem;
  color: var(--muted);
  transition: background 0.15s, color 0.15s;
}

.seg-option input:checked + span { background: var(--accent); color: #fff; }
.seg-option input:focus-visible + span { outline: 2px solid var(--accent-hover); outline-offset: 1px; }

/* ---------- Dropzone ---------- */
.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 2.5rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone:focus-visible { border-color: var(--accent); outline: none; }
.dropzone.dragover { border-color: var(--accent); background: #1e2333; }
.dropzone.processing { pointer-events: none; opacity: 0.6; }

.dropzone-icon {
  width: 44px;
  height: 44px;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

.dropzone-title { margin: 0 0 0.25rem; font-weight: 600; font-size: 1.05rem; }
.dropzone-hint { margin: 0.15rem 0; font-size: 0.85rem; color: var(--muted); }

.dropzone-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0.6rem 0;
  padding: 0.3rem 0.7rem;
  font-size: 0.78rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* ---------- Status ---------- */
.status {
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

.status.loading {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

.status.error {
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: var(--error);
}

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

.status.loading::before {
  content: "";
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 0.5rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
}

/* ---------- Results ---------- */
.results {
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.results h2 { margin: 0 0 1rem; font-size: 1.1rem; }

.summary {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  margin: 0 0 1rem;
  font-size: 0.9rem;
}

.summary dt { color: var(--muted); }
.summary dd { margin: 0; font-weight: 500; }

.tracks {
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.tracks li { padding: 0.25rem 0; border-bottom: 1px solid var(--border); }
.tracks li:last-child { border-bottom: none; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn svg { width: 17px; height: 17px; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }

.btn-ghost {
  background: transparent;
  color: var(--accent-hover);
  border: 1px solid var(--border);
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
}
.btn-ghost:hover { border-color: var(--accent); }

.btn-danger {
  width: 100%;
  background: rgba(248, 113, 113, 0.14);
  color: #fca5a5;
  border: 1px solid rgba(248, 113, 113, 0.4);
  margin-top: 0.25rem;
}
.btn-danger:hover { background: rgba(248, 113, 113, 0.22); }

/* ---------- Feedback cards ---------- */
.card-feedback .card-text { margin-bottom: 0.9rem; }
.feedback-ok { border-color: rgba(74, 222, 128, 0.3); }
.feedback-ko { border-color: rgba(248, 113, 113, 0.3); }

.fb-icon { width: 20px; height: 20px; }
.fb-icon.ok { color: var(--success); }
.fb-icon.ko { color: var(--error); }

.field-label {
  margin: 0.9rem 0 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text);
}

.field-hint {
  margin: 0.6rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.pill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.pill:hover { color: var(--text); border-color: var(--accent); }
.pill.selected { background: var(--accent); color: #fff; border-color: var(--accent); }
.feedback-ko .pill.selected { background: var(--error); border-color: var(--error); color: #fff; }

.text-input {
  width: 100%;
  margin-top: 0.9rem;
  padding: 0.6rem 0.8rem;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.85rem;
  font-family: inherit;
}

.text-input::placeholder { color: var(--muted); }
.text-input:focus { outline: none; border-color: var(--accent); }

.feedback-thanks {
  margin: 0.8rem 0 0;
  padding: 0.6rem 0.8rem;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.35);
  border-radius: var(--radius-sm);
  color: var(--success);
  font-size: 0.85rem;
}

/* ---------- Footer ---------- */
.footer {
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--muted);
}

.footer-privacy {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  max-width: 60ch;
}

.footer-privacy svg { width: 15px; height: 15px; flex-shrink: 0; }

.footer-links {
  display: inline-flex;
  gap: 1.25rem;
}

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

.legal-page {
  max-width: 720px;
  margin-top: 1rem;
}

.legal-page h1 {
  font-size: 1.75rem;
  margin: 0 0 1rem;
}

.legal-page h2 {
  font-size: 1.1rem;
  margin: 1.5rem 0 0.5rem;
}

.legal-page p,
.legal-page li {
  color: var(--muted);
  font-size: 0.95rem;
}

.legal-page a { color: var(--accent-hover); }

.hidden { display: none !important; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .hero-title { font-size: 2rem; }
  .footer { flex-direction: column; text-align: center; }
  .footer-privacy { max-width: none; }
}
