:root {
  --ink: #1e3f73;
  --muted: #5b6f8c;
  --paper: #f4f8ff;
  --panel: #ffffff;
  --line: #d5e4f6;
  --accent: #2f7de1;
  --accent-hot: #ff8a3c;
  --accent-ink: #ffffff;
  --ok: #1f9d6a;
  --shadow: 0 18px 50px rgba(30, 63, 115, 0.08);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: Nunito, "Segoe UI", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 12% 8%, #cfe4ff 0, transparent 28%),
    radial-gradient(circle at 88% 4%, #ffe3c8 0, transparent 24%),
    radial-gradient(circle at 78% 80%, #d4f5e6 0, transparent 22%),
    linear-gradient(180deg, transparent 0, transparent 31px, #e3eefb 32px),
    linear-gradient(90deg, transparent 0, transparent 31px, #e3eefb 32px);
  background-size: auto, auto, auto, 32px 32px, 32px 32px;
  opacity: 0.55;
  pointer-events: none;
}

.shell {
  position: relative;
  max-width: 980px;
  margin: 0 auto;
  padding: 48px 20px 80px;
}

.brand-bar {
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.hero {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.brand-logo {
  display: block;
  height: 148px;
  width: auto;
  max-width: min(420px, 100%);
  object-fit: contain;
}

.hero h1 {
  font-family: Nunito, "Segoe UI", sans-serif;
  font-weight: 800;
  font-size: clamp(1.85rem, 3.6vw, 2.7rem);
  line-height: 1.15;
  margin: 8px 0 12px;
  max-width: 22ch;
}

.eyebrow {
  display: inline-block;
  margin: 0;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 800;
  color: var(--accent);
}

.lede {
  margin: 0;
  color: var(--muted);
  max-width: 52ch;
  line-height: 1.55;
}

.panel,
.preview {
  margin-top: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel {
  padding: 22px;
}

.dropzone {
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 168px;
  padding: 24px;
  border: 1.5px dashed #9fc2ea;
  border-radius: 14px;
  background: #f3f8ff;
  cursor: pointer;
  text-align: center;
}

.dropzone.dragover {
  border-color: var(--accent-hot);
  background: #fff6ee;
}

.dropzone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
}

.dropzone-mark {
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.18em;
  color: var(--accent-hot);
}

.dropzone-title {
  font-weight: 600;
}

.dropzone-hint {
  color: var(--muted);
  font-size: 0.92rem;
}

.controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.field[hidden] {
  display: none;
}

select,
.btn {
  font: inherit;
}

select {
  appearance: none;
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath fill='%231e3f73' d='M0 0l6 8 6-8z'/%3E%3C/svg%3E") no-repeat right 12px center;
  color: var(--ink);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

#quality-output {
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font-weight: 600;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.primary {
  background: linear-gradient(90deg, var(--accent) 0%, #3ecf8e 100%);
  color: var(--accent-ink);
}

.btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.status {
  min-height: 1.4em;
  margin: 14px 0 0;
  color: var(--ok);
  font-size: 0.92rem;
}

.status.error {
  color: #9b2c2c;
}

.progress {
  margin-top: 10px;
  height: 6px;
  background: #e4eef9;
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  background: var(--accent);
  transition: width 0.2s ease;
}

.preview {
  padding: 8px 22px 22px;
}

.preview-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}

.preview-head h2 {
  font-family: Nunito, "Segoe UI", sans-serif;
  font-weight: 800;
  font-size: 1.35rem;
  margin: 16px 0 8px;
}

#page-count {
  color: var(--muted);
  margin: 0;
  font-size: 0.9rem;
}

.page-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}

.page-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  display: grid;
}

.page-card img {
  width: 100%;
  aspect-ratio: 3 / 4;
  object-fit: contain;
  background: #f3f8ff;
}

.page-card footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 10px 10px;
  gap: 8px;
}

.page-card button {
  border: 0;
  background: #e8f1fd;
  color: var(--ink);
  border-radius: 999px;
  padding: 6px 10px;
  font-weight: 600;
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.about {
  margin-top: 28px;
  text-align: center;
  color: var(--muted);
  max-width: 58ch;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.55;
}

.about h2 {
  font-family: Nunito, "Segoe UI", sans-serif;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink);
  margin: 0 0 10px;
}

.about p {
  margin: 0;
}

.site-footer {
  margin-top: 28px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

.site-footer strong {
  color: var(--ink);
  font-weight: 800;
}

@media (max-width: 720px) {
  .controls {
    grid-template-columns: 1fr;
  }

  .brand-logo {
    height: 104px;
  }
}
