:root {
  --bg: #f3efe6;
  --ink: #16120d;
  --muted: #6f6559;
  --panel: rgba(255, 250, 240, 0.82);
  --line: rgba(22, 18, 13, 0.12);
  --accent: #b3532f;
  --accent-strong: #8f3d1e;
  --shadow: 0 24px 80px rgba(55, 35, 16, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Manrope", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(179, 83, 47, 0.2), transparent 30%),
    radial-gradient(circle at top right, rgba(49, 86, 71, 0.16), transparent 28%),
    linear-gradient(180deg, #fbf7f0 0%, var(--bg) 100%);
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(22, 18, 13, 0.04) 1px, transparent 1px), linear-gradient(90deg, rgba(22, 18, 13, 0.04) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: radial-gradient(circle at center, black 25%, transparent 80%);
  pointer-events: none;
}

.app-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 48px 0 72px;
}

.hero {
  padding: 12px 0 28px;
}

.eyebrow {
  margin: 0 0 12px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
  color: var(--accent-strong);
}

.hero h1 {
  margin: 0;
  max-width: 900px;
  font-size: clamp(2.4rem, 6vw, 4.8rem);
  line-height: 0.96;
}

.hero-copy {
  max-width: 760px;
  font-size: 1.05rem;
  line-height: 1.7;
  color: var(--muted);
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.62);
  color: var(--ink);
  font-weight: 700;
  text-decoration: none;
}

.panel {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.control-panel,
.progress-panel,
.summary-panel {
  padding: 24px;
}

.dropzone {
  display: block;
  border: 1.5px dashed rgba(179, 83, 47, 0.45);
  border-radius: 24px;
  padding: 32px;
  background: rgba(255, 255, 255, 0.56);
  cursor: pointer;
}

.dropzone input {
  display: none;
}

.dropzone-title {
  display: block;
  font-size: 1.4rem;
  font-weight: 800;
}

.dropzone-copy {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.upload-status {
  display: block;
  margin-top: 12px;
  color: var(--accent-strong);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.controls {
  display: flex;
  gap: 18px;
  align-items: end;
  margin-top: 20px;
  flex-wrap: wrap;
}

.range-field {
  flex: 1 1 0;
  min-width: 170px;
}

.range-field span {
  display: block;
  margin-bottom: 8px;
  color: #5d5246;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.range-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  flex: 1 1 520px;
  padding: 14px;
  border-radius: 24px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.18));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 -1px 0 rgba(255, 255, 255, 0.22),
    0 14px 40px rgba(143, 96, 44, 0.08);
  backdrop-filter: blur(16px) saturate(130%);
}

.range-field input {
  min-height: 54px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.46);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(255, 255, 255, 0.58));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.92),
    inset 0 -1px 0 rgba(255, 255, 255, 0.18),
    0 10px 30px rgba(82, 51, 20, 0.06);
  padding: 0 16px;
}

.range-field input:focus {
  outline: none;
  border-color: rgba(179, 83, 47, 0.5);
  box-shadow: 0 0 0 4px rgba(179, 83, 47, 0.12);
}


.controls input,
.controls button,
.downloads a,
textarea {
  font: inherit;
}

.action-group {
  display: flex;
  gap: 12px;
  align-items: center;
}

.glass-button {
  min-height: 54px;
  padding: 0 20px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.42);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  backdrop-filter: blur(16px) saturate(135%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.8),
    inset 0 -1px 0 rgba(255, 255, 255, 0.16),
    0 14px 28px rgba(76, 46, 19, 0.11);
}

.glass-button-primary {
  background: linear-gradient(180deg, rgba(196, 103, 58, 0.94), rgba(164, 75, 34, 0.86));
  color: white;
}

.glass-button-secondary {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(236, 225, 210, 0.56));
  color: #5d2f20;
}

.glass-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.progress-panel,
.summary-panel {
  margin-top: 20px;
}

.progress-panel {
  padding-left: 38px;
  padding-right: 38px;
  overflow: hidden;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.progress-head h2 {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.progress-ring {
  --progress: 0;
  width: 110px;
  height: 110px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background:
    radial-gradient(closest-side, rgba(255, 250, 240, 1) 74%, transparent 76% 100%),
    conic-gradient(var(--accent) calc(var(--progress) * 1%), rgba(22, 18, 13, 0.08) 0);
  font-family: "IBM Plex Mono", monospace;
  font-size: 1rem;
  font-weight: 700;
}

.progress-bar {
  margin-top: 18px;
  height: 14px;
  border-radius: 999px;
  background: rgba(22, 18, 13, 0.08);
  overflow: hidden;
}

.progress-bar-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), #d18e57);
  transition: width 0.4s ease;
}

.status-copy {
  margin: 14px 0 0;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.92rem;
  color: var(--muted);
  overflow-wrap: anywhere;
  word-break: break-word;
  padding-right: 8px;
}

.disabled-link {
  pointer-events: none;
  opacity: 0.45;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.downloads {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.summary-actions {
  margin-top: 18px;
}

.summary-actions button {
  min-height: 46px;
  padding: 0 18px;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.downloads a {
  text-decoration: none;
  color: var(--accent-strong);
  font-weight: 700;
}

.results {
  display: grid;
  gap: 20px;
  margin-top: 24px;
}

.page-card {
  display: grid;
  grid-template-columns: minmax(240px, 320px) 1fr;
  gap: 18px;
  padding: 18px;
}

.page-preview {
  border-radius: 20px;
  overflow: hidden;
  background: #e7ddce;
  min-height: 240px;
  position: relative;
}

.page-preview img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.zoom-button {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 999px;
  background: rgba(22, 18, 13, 0.82);
  color: white;
  font: inherit;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.page-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.page-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.page-head h2 {
  margin: 0;
  font-size: 1.1rem;
}

textarea {
  width: 100%;
  min-height: 280px;
  margin-top: 12px;
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  resize: vertical;
  background: rgba(255, 255, 255, 0.78);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9rem;
  line-height: 1.6;
}

.hidden {
  display: none;
}

.zoom-dialog {
  width: min(96vw, 1200px);
  max-width: none;
  border: 0;
  padding: 0;
  background: transparent;
}

.zoom-dialog::backdrop {
  background: rgba(16, 10, 5, 0.72);
}

.zoom-shell {
  position: relative;
  padding: 20px;
  border-radius: 28px;
  background: rgba(255, 251, 246, 0.98);
}

.zoom-shell img {
  display: block;
  width: 100%;
  max-height: 84vh;
  object-fit: contain;
}

.zoom-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: 0;
  border-radius: 14px;
  min-height: 44px;
  padding: 0 16px;
  background: var(--accent);
  color: white;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

@media (max-width: 820px) {
  .app-shell {
    width: min(100% - 20px, 100%);
    padding-top: 28px;
  }

  .summary-grid,
  .page-card {
    grid-template-columns: 1fr;
  }

  .progress-head {
    align-items: start;
    flex-direction: column;
  }

  .progress-panel {
    padding-left: 24px;
    padding-right: 24px;
  }
}
