:root {
  --void: #020812;
  --deep: #040e1e;
  --surface: #071426;
  --card: #081830;
  --card-hover: #0c2040;
  --border: rgba(32, 120, 200, 0.18);
  --border-glow: rgba(56, 189, 248, 0.35);
  --cyan: #38bdf8;
  --cyan-bright: #7dd3fc;
  --cyan-dim: #0ea5e9;
  --neon: #00f0ff;
  --neon-soft: rgba(0, 240, 255, 0.12);
  --neon-glow:
    0 0 20px rgba(0, 240, 255, 0.4), 0 0 60px rgba(0, 240, 255, 0.15);
  --text: #e2f0ff;
  --text-dim: #7eb4d4;
  --text-muted: #3a6080;
  --accent: #0f3558;
  --pdf-red: #ff5d5d;
  --pdf-red-glow: rgba(255, 93, 93, 0.25);
  --font-display: "Poppins", sans-serif;
  --font-body: "Poppins", sans-serif;
  --font-mono: "JetBrains Mono", monospace;
}

[data-theme="light"] {
  --void: #f0f5ff;
  --deep: #e4ecf7;
  --surface: #dce6f5;
  --card: #ffffff;
  --card-hover: #eef3fc;
  --border: rgba(14, 100, 180, 0.15);
  --border-glow: rgba(14, 120, 200, 0.35);
  --cyan: #0077cc;
  --cyan-bright: #005fa3;
  --cyan-dim: #0ea5e9;
  --neon: #0090cc;
  --neon-soft: rgba(0, 144, 204, 0.1);
  --neon-glow:
    0 0 20px rgba(0, 144, 204, 0.25), 0 0 60px rgba(0, 144, 204, 0.1);
  --text: #0d1f35;
  --text-dim: #2a5070;
  --text-muted: #7a9ab8;
  --accent: #cfe0f5;
  --pdf-red: #e23c3c;
  --pdf-red-glow: rgba(226, 60, 60, 0.15);
}

[data-theme="light"] nav {
  background: rgba(240, 245, 255, 0.85);
}
[data-theme="light"] .dropzone {
  background: rgba(210, 225, 245, 0.5);
}
[data-theme="light"] footer {
  background: linear-gradient(to top, rgba(200, 218, 240, 0.5), transparent);
}
[data-theme="light"] #particles {
  opacity: 0.15;
}
[data-theme="light"] .result-card {
  box-shadow: 0 4px 20px rgba(14, 100, 180, 0.1);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--void);
  color: var(--text);
  font-family: var(--font-body);
  font-weight: 400;
  line-height: 1.6;
  overflow-x: hidden;
  transition:
    background 0.4s ease,
    color 0.4s ease;
}

.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.03;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

#particles {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(1px 1px at 20% 30%, rgba(125, 211, 252, 0.5), transparent),
    radial-gradient(1px 1px at 70% 60%, rgba(125, 211, 252, 0.3), transparent),
    radial-gradient(1px 1px at 40% 80%, rgba(255, 93, 93, 0.25), transparent),
    radial-gradient(1px 1px at 85% 15%, rgba(125, 211, 252, 0.4), transparent),
    radial-gradient(1px 1px at 10% 90%, rgba(125, 211, 252, 0.3), transparent);
  background-size: 100% 100%;
  pointer-events: none;
}

a {
  text-decoration: none;
  color: inherit;
}
button {
  font-family: inherit;
  cursor: pointer;
}

nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(2, 8, 18, 0.75);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  width: 100%;
  padding: 16px 40px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 9px 16px;
  border-radius: 9px;
  transition: all 0.2s;
}
.nav-link:hover {
  color: var(--cyan);
  background: var(--neon-soft);
}

.nav-link-btn {
  font-family: inherit;
}

.caret {
  width: 14px;
  height: 14px;
  transition: transform 0.2s;
}

.nav-dropdown {
  position: relative;
}
.nav-dropdown.open .caret {
  transform: rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(-6px);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease,
    transform 0.2s ease;
  transition-delay: 0.3s;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  z-index: 60;
}
.nav-dropdown.open .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
  transition-delay: 0s;
}

.dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  color: var(--text-dim);
  transition: all 0.15s;
  white-space: nowrap;
  gap: 8px;
}
.dropdown-item:hover {
  background: var(--neon-soft);
  color: var(--cyan-bright);
}
.has-submenu {
  cursor: default;
}
.submenu-caret {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.5;
}
.dropdown-submenu {
  position: relative;
}
.submenu {
  position: absolute;
  top: 0;
  right: calc(100% + 6px);
  left: auto;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  min-width: 180px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
  z-index: 70;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.2s ease,
    visibility 0.2s ease;
  transition-delay: 0s;
}
.dropdown-submenu:hover .submenu {
  transition-delay: 0.3s;
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}
.dropdown-submenu.open .submenu {
  transition-delay: 0s;
  opacity: 1;
  visibility: visible;
  pointer-events: all;
}
.coming-soon {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

.paper-size-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}

.paper-btns {
  display: flex;
  gap: 6px;
}

.paper-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 5px 16px;
  border-radius: 999px;
  font-family: var(--font-mono);
  transition: all 0.2s;
}

.paper-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.paper-btn.active {
  background: linear-gradient(120deg, var(--cyan-dim), var(--cyan));
  border-color: transparent;
  color: #021018;
}
.badge {
  font-size: 0.68rem;
  background: var(--pdf-red);
  color: #fff;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  flex-shrink: 0;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  object-fit: contain;
  box-shadow: 0 0 16px var(--pdf-red-glow);
  flex-shrink: 0;
}

.logo {
  cursor: default;
}
.logo-text {
  color: var(--text);
  transition: text-shadow 0.2s ease;
}
.logo:hover .logo-text {
  text-shadow:
    0 0 12px rgba(56, 189, 248, 0.6),
    0 0 30px rgba(56, 189, 248, 0.3);
}
.logo-accent {
  color: var(--pdf-red);
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text-dim);
  transition: all 0.2s;
}
.icon-btn:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}
.icon-btn svg {
  width: 17px;
  height: 17px;
}
.icon-moon {
  display: none;
}
.icon-sun {
  display: block;
}
[data-theme="light"] .icon-sun {
  display: none;
}
[data-theme="light"] .icon-moon {
  display: block;
}
[data-theme="dark"] .icon-sun {
  display: block;
}
[data-theme="dark"] .icon-moon {
  display: none;
}

.btn-ghost {
  border: 1px solid var(--border);
  color: var(--text-dim);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  transition: all 0.2s;
}
.btn-ghost:hover {
  border-color: var(--cyan);
  color: var(--cyan);
}

.hero {
  max-width: 1100px;
  margin: 0 auto;
  padding: 56px 24px 36px;
  text-align: center;
  position: relative;
  z-index: 2;
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: var(--pdf-red);
  margin-bottom: 18px;
  font-weight: 600;
}

.hero h1 {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3.2rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
}

.gradient-text {
  background: linear-gradient(120deg, var(--cyan-bright), var(--neon));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero-sub {
  max-width: 540px;
  margin: 22px auto 0;
  color: var(--text-dim);
  font-size: 1.02rem;
}

.convert-section {
  position: relative;
  z-index: 2;
  padding: 10px 24px 60px;
}
.section-inner {
  max-width: 760px;
  margin: 0 auto;
}

.active-mode {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
  font-size: 0.85rem;
}
.mode-label {
  color: var(--text-muted);
}
.mode-value {
  color: var(--cyan-bright);
  font-weight: 600;
  background: var(--neon-soft);
  border: 1px solid var(--border-glow);
  padding: 5px 14px;
  border-radius: 999px;
}

.dropzone {
  border: 2px dashed var(--border);
  border-radius: 18px;
  padding: 50px 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s;
  background: rgba(4, 14, 30, 0.4);
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--cyan);
  background: var(--neon-soft);
}

.dz-icon {
  width: 46px;
  height: 46px;
  color: var(--text-muted);
  margin: 0 auto 14px;
}
.dropzone:hover .dz-icon,
.dropzone.dragover .dz-icon {
  color: var(--cyan);
}

.dz-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 4px;
}
.dz-sub {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(120deg, var(--cyan-dim), var(--cyan));
  color: #021018;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 11px 26px;
  border: none;
  border-radius: 999px;
  transition: all 0.2s;
  box-shadow: 0 0 18px var(--neon-soft);
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 24px var(--neon-soft);
}

.progress-area {
  margin-top: 24px;
  text-align: center;
}
.progress-bar-track {
  width: 100%;
  height: 8px;
  background: var(--surface);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--cyan-dim), var(--neon));
  border-radius: 999px;
  transition: width 0.3s ease;
}
.progress-label {
  margin-top: 12px;
  font-size: 0.85rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.result-area {
  margin-top: 24px;
}
.result-card {
  background: var(--card);
  border: 1px solid var(--border-glow);
  border-radius: 18px;
  padding: 40px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 0 30px rgba(56, 189, 248, 0.08);
}
.result-icon {
  width: 52px;
  height: 52px;
  color: #22c55e;
  margin-bottom: 8px;
}
.result-filename {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text);
  word-break: break-all;
}
.result-status {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 16px;
}
.result-card .btn-primary {
  margin-bottom: 10px;
}

.info-strip {
  padding: 10px 24px 100px;
  position: relative;
  z-index: 2;
}
.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 24px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
}
.info-item svg {
  width: 30px;
  height: 30px;
  color: var(--cyan);
}
.info-item p {
  font-size: 0.85rem;
  color: var(--text-dim);
}

.about-section {
  padding: 20px 24px 100px;
  position: relative;
  z-index: 2;
}
.about-header {
  text-align: center;
  margin-bottom: 36px;
}
.about-header h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 3.5vw, 2.2rem);
  font-weight: 700;
  margin-top: 10px;
}
.about-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  max-width: 1000px;
  margin: 0 auto;
}
.about-step {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px 22px;
}
.step-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--pdf-red);
  font-weight: 600;
  margin-bottom: 12px;
}
.about-step h3 {
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}
.about-step p {
  font-size: 0.85rem;
  color: var(--text-dim);
  line-height: 1.6;
}

footer {
  border-top: 1px solid var(--border);
  background: linear-gradient(to top, rgba(8, 24, 48, 0.4), transparent);
  padding: 32px 24px;
  position: relative;
  z-index: 2;
}
.footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}
.footer-note {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 6px;
}
.footer-note a {
  color: var(--cyan);
}
.footer-copy {
  font-size: 0.75rem;
  color: var(--text-muted);
}

#toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--card);
  border: 1px solid var(--border-glow);
  color: var(--text);
  padding: 12px 22px;
  border-radius: 12px;
  font-size: 0.85rem;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
@media (max-width: 480px) {
  #toast {
    bottom: 16px;
    left: 16px;
    right: 16px;
    transform: translateY(100px);
    padding: 12px 16px;
    font-size: 0.8rem;
    border-radius: 10px;
    width: auto;
  }
  #toast.show {
    transform: translateY(0);
  }
}
#toast.error {
  border-color: var(--pdf-red);
  color: var(--pdf-red);
}

#scroll-top {
  position: fixed;
  bottom: 32px;
  right: 32px;
  z-index: 999;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border-glow);
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition:
    opacity 0.35s ease,
    visibility 0.35s ease,
    transform 0.35s ease,
    background 0.2s,
    border-color 0.2s;
}
#scroll-top svg {
  width: 18px;
  height: 18px;
  transition: transform 0.2s ease;
}
#scroll-top:hover {
  background: var(--neon-soft);
  border-color: var(--cyan);
}
#scroll-top:hover svg {
  transform: translateY(-2px);
}
#scroll-top.visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

::-webkit-scrollbar {
  width: 6px;
}
::-webkit-scrollbar-track {
  background: var(--void);
  transition: background 0.4s ease;
}
::-webkit-scrollbar-thumb {
  background: var(--border-glow);
  border-radius: 999px;
  transition: background 0.4s ease;
}
::-webkit-scrollbar-thumb:hover {
  background: var(--cyan-dim);
}

@media (max-width: 768px) {
  .nav-inner {
    flex-wrap: wrap;
    padding: 12px 16px;
  }
  .nav-menu {
    order: 3;
    width: 100%;
    justify-content: center;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    margin-top: 10px;
    margin-left: 0;
    flex-wrap: wrap;
    gap: 4px;
  }
  .nav-actions {
    margin-left: auto;
  }
  .dropdown-menu {
    left: 0;
    transform: translateX(0);
    min-width: 180px;
  }
  .submenu {
    right: auto;
    left: 0;
    top: 100%;
    min-width: 160px;
  }
  .dropdown-submenu {
    position: relative;
  }
}

@media (max-width: 400px) {
  .nav-link span {
    display: none;
  }
  .nav-link {
    padding: 6px 10px;
    font-size: 0.78rem;
  }
  .logo-text {
    font-size: 0.9rem;
  }
  .logo-mark {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
  }
  .dropdown-menu {
    min-width: 150px;
  }
}

@media (max-width: 640px) {
  .hero {
    padding: 44px 20px 28px;
  }
  .hero h1 {
    font-size: 1.8rem;
  }
  .info-grid {
    grid-template-columns: 1fr;
  }
  .about-steps {
    grid-template-columns: 1fr;
  }
  .dropzone {
    padding: 36px 16px;
  }
  .coming-soon {
    pointer-events: none;
  }
  .section-inner {
    padding: 0 4px;
  }
  .active-mode {
    flex-wrap: wrap;
  }
}
