:root {
  --bg: #0f1419;
  --bg-card: #1a222d;
  --bg-elevated: #232d3b;
  --text: #eef2f7;
  --muted: #8b9cb3;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --danger: #f87171;
  --warn: #fbbf24;
  --border: rgba(255, 255, 255, 0.08);
  --radius: 12px;
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  background-image:
    radial-gradient(ellipse 70% 45% at 20% -10%, rgba(99, 102, 241, 0.2), transparent),
    radial-gradient(ellipse 50% 35% at 90% 10%, rgba(34, 211, 238, 0.1), transparent);
}

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

.container { width: min(1100px, 92vw); margin: 0 auto; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  background: rgba(15, 20, 25, 0.9);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 0;
}

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

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: #0f1419;
}

.nav { display: flex; gap: 1.25rem; flex-wrap: wrap; }
.nav a { color: var(--muted); font-size: 0.92rem; }
.nav a:hover { color: var(--text); text-decoration: none; }

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

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.6rem 1.1rem;
  border-radius: 9px;
  font-weight: 600;
  font-size: 0.9rem;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
  font-family: inherit;
}

.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #4f46e5);
  color: #fff;
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.35);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 10px 26px rgba(99, 102, 241, 0.45);
}

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

.btn-ghost:hover:not(:disabled) { border-color: rgba(99, 102, 241, 0.5); }

.hero { padding: 3rem 0 2rem; }
.hero h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  line-height: 1.2;
  margin: 0 0 0.75rem;
  letter-spacing: -0.02em;
}

.hero .lead { color: var(--muted); margin: 0 0 1.5rem; max-width: 56ch; }

.converter-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.35);
}

.dropzone {
  border: 2px dashed rgba(99, 102, 241, 0.45);
  border-radius: var(--radius);
  padding: 2.5rem 1.5rem;
  text-align: center;
  background: rgba(99, 102, 241, 0.06);
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.dropzone:hover,
.dropzone.dragover {
  border-color: var(--accent-2);
  background: rgba(34, 211, 238, 0.08);
}

.dropzone-icon { font-size: 2.5rem; margin-bottom: 0.5rem; }
.dropzone p { margin: 0.25rem 0; color: var(--muted); font-size: 0.92rem; }
.dropzone strong { color: var(--text); }

.converter-options {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1rem;
  align-items: end;
  margin-top: 1.25rem;
}

@media (max-width: 640px) {
  .converter-options { grid-template-columns: 1fr; }
  .convert-arrow { display: none; }
  .nav { display: none; }
}

.field label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.35rem;
}

.field select,
.field input {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
}

.convert-arrow {
  text-align: center;
  font-size: 1.5rem;
  color: var(--accent-2);
  padding-bottom: 0.5rem;
}

.converter-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.25rem;
  align-items: center;
}

.converter-hint {
  font-size: 0.85rem;
  color: var(--muted);
  flex: 1;
  min-width: 200px;
}

.form-msg {
  font-size: 0.88rem;
  margin-top: 0.75rem;
  min-height: 1.2rem;
}

.form-msg.ok { color: var(--accent-2); }
.form-msg.err { color: var(--danger); }
.form-msg.warn { color: var(--warn); }

.file-list {
  margin-top: 1rem;
  padding: 0;
  list-style: none;
}

.file-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  background: var(--bg-elevated);
  border-radius: 8px;
  margin-bottom: 0.4rem;
  font-size: 0.88rem;
}

.file-list .remove-file {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
}

section { padding: 3rem 0; }
.section-title { text-align: center; margin-bottom: 2rem; }
.section-title h2 { margin: 0 0 0.4rem; font-size: 1.65rem; }
.section-title p { margin: 0; color: var(--muted); }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

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

.card h3 { margin: 0 0 0.4rem; font-size: 1rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.88rem; }

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.5rem 0 2rem;
  color: var(--muted);
  font-size: 0.85rem;
}

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

.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
}

.footer-nav a {
  color: var(--muted);
  font-size: 0.85rem;
  text-decoration: none;
}

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

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.show { display: flex; }

.modal {
  width: min(420px, 100%);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  position: relative;
}

.modal h2 { margin: 0 0 0.35rem; font-size: 1.35rem; }
.modal .modal-sub { margin: 0 0 1.25rem; color: var(--muted); font-size: 0.9rem; }

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
}

.auth-form label {
  display: block;
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 0.3rem;
}

.auth-form input {
  width: 100%;
  margin-bottom: 0.9rem;
  padding: 0.65rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
  color: var(--text);
  font: inherit;
}

.auth-form .btn { width: 100%; margin-top: 0.25rem; }

.auth-switch {
  margin-top: 1rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
}

.auth-switch button {
  background: none;
  border: none;
  color: var(--accent-2);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
  padding: 0;
}

.spinner-inline {
  display: inline-block;
  width: 1em;
  height: 1em;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -0.15em;
  margin-right: 0.35rem;
}

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

.cookie {
  position: fixed;
  bottom: 1rem;
  left: 1rem;
  right: 1rem;
  max-width: 400px;
  margin: 0 auto;
  padding: 1rem 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.4);
  z-index: 200;
  display: none;
}

.cookie.show { display: block; }
.cookie p { margin: 0 0 0.65rem; font-size: 0.85rem; color: var(--muted); }
