:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #66727e;
  --line: #dce3e8;
  --paper: #ffffff;
  --canvas: #f4f7f8;
  --accent: #126b5b;
  --accent-dark: #0c5044;
  --accent-soft: #e1f3ee;
  --danger: #a23838;
  --danger-soft: #faeaea;
  --shadow: 0 18px 50px rgba(23, 33, 43, 0.08);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 10% 0%, rgba(18, 107, 91, 0.09), transparent 30rem),
    var(--canvas);
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding: 64px 0 80px;
}

.hero {
  max-width: 760px;
  margin-bottom: 34px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 16px;
  font-size: clamp(2.2rem, 6vw, 4.5rem);
  line-height: 0.98;
  letter-spacing: -0.055em;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.7rem;
  letter-spacing: -0.025em;
}

.lede {
  max-width: 660px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.panel,
.action-bar {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.upload-panel {
  padding: 24px;
}

.drop-zone {
  display: grid;
  min-height: 190px;
  place-content: center;
  padding: 28px;
  border: 2px dashed #b8c5cc;
  border-radius: 13px;
  text-align: center;
  cursor: pointer;
  transition: border-color 140ms ease, background 140ms ease;
}

.drop-zone:hover,
.drop-zone.dragging {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.drop-title {
  font-size: 1.25rem;
  font-weight: 750;
}

.drop-note,
.file-row span,
.action-bar span {
  margin-top: 7px;
  color: var(--muted);
  font-size: 0.9rem;
}

.file-row,
.workspace-heading,
.action-bar,
.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.file-row {
  margin-top: 18px;
}

.button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 750;
  text-decoration: none;
  cursor: pointer;
  transition: background 120ms ease, transform 120ms ease, opacity 120ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.button.primary {
  color: #fff;
  background: var(--accent);
}

.button.primary:hover:not(:disabled) {
  background: var(--accent-dark);
}

.button.quiet {
  border-color: var(--line);
  color: var(--ink);
  background: var(--paper);
}

.notice {
  margin: 18px 0;
  padding: 14px 18px;
  border: 1px solid #e7bbbb;
  border-radius: 12px;
  color: var(--danger);
  background: var(--danger-soft);
}

.notice.processing {
  border-color: #a7d5c8;
  color: var(--accent-dark);
  background: var(--accent-soft);
}

.workspace {
  margin-top: 42px;
}

.workspace-heading {
  margin-bottom: 20px;
}

.workspace-help {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.page-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 360px));
  gap: 18px;
  justify-content: start;
}

.page-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--paper);
}

.preview {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  padding: 18px;
  background: #e9eef0;
}

.preview img {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  filter: drop-shadow(0 8px 11px rgba(23, 33, 43, 0.18));
  transition: transform 160ms ease;
}

.preview img.rotation-0 {
  transform: rotate(0deg);
}

.preview img.rotation-90 {
  transform: rotate(90deg);
}

.preview img.rotation-180 {
  transform: rotate(180deg);
}

.preview img.rotation-270 {
  transform: rotate(270deg);
}

.page-meta {
  padding: 16px;
}

.page-title,
.rotation-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.page-title strong {
  font-size: 1.02rem;
}

.diagnosis {
  margin: 6px 0 15px;
  color: var(--muted);
  font-size: 0.82rem;
}

.diagnosis.bad {
  color: var(--danger);
}

.outcome-prompt {
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.page-question {
  margin-bottom: 4px;
  font-size: 0.91rem;
  font-weight: 750;
}

.page-guidance {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.45;
}

.icon-button {
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: var(--paper);
  font-size: 1.2rem;
  cursor: pointer;
}

.rotation-value {
  min-width: 120px;
  text-align: center;
  color: var(--muted);
  font-size: 0.82rem;
}

.action-bar {
  margin-top: 22px;
  padding: 20px 22px;
}

.action-bar div {
  display: grid;
}

.result {
  display: flex;
  align-items: flex-start;
  gap: 22px;
  margin-top: 32px;
  padding: 28px;
  border-color: #a7d5c8;
}

.safe-mark {
  display: grid;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--accent);
  font-size: 1.6rem;
  font-weight: 900;
}

.result p:not(.eyebrow) {
  color: var(--muted);
}

.result-actions {
  justify-content: flex-start;
  margin-top: 20px;
}

.hidden {
  display: none !important;
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 1120px);
    padding-top: 36px;
  }

  .file-row,
  .workspace-heading,
  .action-bar,
  .result-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .file-row .button,
  .action-bar .button,
  .result-actions .button {
    width: 100%;
  }

  .result {
    flex-direction: column;
  }

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