* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #10120f;
  --card: #191c17;
  --card-light: #20241d;
  --text: #f4f6ef;
  --muted: #a4aa9a;
  --accent: #b8f34a;
  --accent-hover: #9bd32d;
  --border: #30362b;
  --success: #b8f34a;
  --danger: #ff7777;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

a {
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}

.topbar {
  width: 100%;
  min-height: 72px;
  padding: 16px 6%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #131510;
  border-bottom: 1px solid var(--border);
}

.brand {
  color: var(--text);
  font-size: 24px;
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.5px;
}

.brand span {
  color: var(--accent);
}

.back-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  transition: color 0.2s ease;
}

.back-link:hover {
  color: var(--accent);
}

.container {
  width: min(100% - 32px, 1000px);
  margin: 0 auto;
  padding: 42px 0 60px;
}

.hero {
  text-align: center;
  margin-bottom: 30px;
}

.badge {
  display: inline-block;
  padding: 5px 12px;
  margin-bottom: 14px;
  border: 1px solid #3b4a29;
  border-radius: 30px;
  color: var(--accent);
  background: #1a2113;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.hero h1 {
  font-size: clamp(28px, 5vw, 42px);
  line-height: 1.2;
  margin-bottom: 14px;
  letter-spacing: -1px;
}

.hero p {
  max-width: 600px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 16px;
}

.tool-card,
.info-card {
  padding: 28px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 15px 45px #00000018;
}

.upload-area {
  min-height: 205px;
  padding: 25px;
  border: 2px dashed #424a39;
  border-radius: 14px;
  background: #151811;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.upload-area:hover {
  border-color: var(--accent);
  background: #202719;
}

.upload-icon {
  font-size: 40px;
  margin-bottom: 5px;
  color: var(--accent);
}

.upload-area strong {
  font-size: 19px;
}

.upload-area span:not(.upload-icon) {
  color: var(--muted);
  font-size: 13px;
}

#pdfFile {
  max-width: 100%;
  margin-top: 10px;
  font-size: 13px;
  color: var(--muted);
}

.file-info {
  color: var(--muted);
  font-size: 13px;
  margin: 12px 0 22px;
  overflow-wrap: anywhere;
}

.settings {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.field label {
  font-size: 13px;
  font-weight: 700;
  color: #dce4d2;
}

.field select,
.field input {
  width: 100%;
  min-height: 46px;
  padding: 10px 12px;
  color: var(--text);
  background: #11130f;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
}

.field select:focus,
.field input:focus {
  border-color: var(--accent);
}

.field small {
  color: var(--muted);
  font-size: 12px;
}

.primary-btn,
.secondary-btn,
.download-btn {
  border-radius: 10px;
  padding: 12px 18px;
  font-weight: 700;
  transition: background 0.2s, transform 0.2s, border-color 0.2s;
}

.primary-btn {
  display: block;
  width: 100%;
  min-height: 52px;
  border: 1px solid transparent;
  background: var(--accent);
  color: #161a10;
  font-size: 16px;
}

.primary-btn:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.secondary-btn {
  background: var(--card-light);
  color: var(--text);
  border: 1px solid var(--border);
}

.secondary-btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.progress-wrap {
  margin-top: 22px;
}

.progress-wrap p {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

progress {
  display: block;
  width: 100%;
  height: 10px;
  accent-color: var(--accent);
}

.status {
  min-height: 24px;
  margin-top: 16px;
  font-size: 13px;
  overflow-wrap: anywhere;
}

.status.success {
  color: var(--success);
}

.status.error {
  color: var(--danger);
}

.status.info {
  color: var(--accent);
}

.results-section {
  margin-top: 35px;
}

.results-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.results-heading h2 {
  font-size: 23px;
  margin-bottom: 4px;
}

.results-heading p {
  color: var(--muted);
  font-size: 13px;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.image-card {
  min-width: 0;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.image-card img {
  display: block;
  width: 100%;
  height: 230px;
  object-fit: contain;
  padding: 12px;
  background: #10110f;
}

.image-details {
  padding: 15px;
}

.image-details h3 {
  font-size: 15px;
  margin-bottom: 5px;
  overflow-wrap: anywhere;
}

.image-details p {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 12px;
}

.download-btn {
  width: 100%;
  background: #1a2113;
  color: var(--accent);
  border: 1px solid #40512a;
}

.download-btn:hover {
  background: #26351a;
  border-color: var(--accent);
}

.info-card {
  margin-top: 28px;
}

.info-card h2 {
  font-size: 21px;
  margin-bottom: 15px;
}

.info-card ol {
  padding-left: 22px;
  color: #dce4d2;
}

.info-card li {
  margin: 8px 0;
}

.info-card p {
  color: var(--muted);
  font-size: 13px;
  margin-top: 16px;
}

footer {
  padding: 22px 16px;
  text-align: center;
  color: var(--muted);
  border-top: 1px solid var(--border);
  font-size: 12px;
}

[hidden] {
  display: none !important;
}

@media (max-width: 600px) {
  .topbar {
    min-height: 62px;
    padding: 13px 18px;
  }

  .brand {
    font-size: 21px;
  }

  .container {
    width: min(100% - 22px, 1000px);
    padding-top: 30px;
  }

  .hero h1 {
    font-size: 29px;
  }

  .hero p {
    font-size: 14px;
  }

  .tool-card,
  .info-card {
    padding: 18px;
    border-radius: 14px;
  }

  .upload-area {
    min-height: 185px;
    padding: 16px;
  }

  .settings {
    grid-template-columns: 1fr;
    gap: 15px;
  }

  .results-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .image-grid {
    grid-template-columns: 1fr;
  }

  .image-card img {
    height: 250px;
  }

  .secondary-btn {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}