:root {
  --ink: #14261e;
  --muted: #5b6b63;
  --line: #d9e2dc;
  --accent: #1f7a4d;
  --accent-ink: #ffffff;
  --bg: #f6f8f6;
  --card: #ffffff;
  --error-bg: #fdeceb;
  --error-ink: #9b2c2c;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ink: #e7efe9;
    --muted: #9fb0a7;
    --line: #2a3830;
    --accent: #3fae78;
    --accent-ink: #08150f;
    --bg: #0f1713;
    --card: #16211b;
    --error-bg: #3a1f1f;
    --error-ink: #f3b3b0;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 32px 16px 64px; }
header h1 { margin: 0 0 4px; font-size: 1.5rem; }
header .tagline { margin: 0 0 28px; color: var(--muted); }
main { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 24px; }
.upload-form label {
  display: block; margin-bottom: 16px; font-size: 0.9rem; color: var(--muted);
}
.upload-form input {
  display: block; width: 100%; margin-top: 6px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 8px; background: transparent;
  color: var(--ink); font-size: 1rem;
}
button {
  width: 100%; padding: 12px; border: none; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font-size: 1rem;
  font-weight: 600; cursor: pointer;
}
button:hover { opacity: 0.92; }
.notice { padding: 12px 14px; border-radius: 8px; margin-bottom: 16px; }
.notice.error { background: var(--error-bg); color: var(--error-ink); }
.upload-progress { margin-top: 16px; }
.upload-progress-bar {
  width: 100%; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden;
}
.upload-progress-fill {
  height: 100%; width: 0%; background: var(--accent); border-radius: 999px;
  transition: width 0.2s ease;
}
.upload-progress-label { margin: 8px 0 0; font-size: 0.85rem; color: var(--muted); }
.calib-section { margin: 16px 0; padding: 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 8px; }
.calib-heading, .calib-page-heading { margin: 0 0 12px; }
.calib-loading, .calib-fallback-note { color: var(--muted); font-size: 0.85rem; }
.calib-wrap { position: relative; }
.calib-canvas-holder { position: relative; display: inline-block; max-width: 100%; }
.calib-canvas { display: block; max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 8px; cursor: crosshair; background: #000; }
.calib-magnifier {
  position: absolute; border: 2px solid var(--accent); border-radius: 6px;
  pointer-events: none; background: #000; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.35);
}
.calib-instructions { margin: 0 0 10px; font-weight: 600; }
.calib-actions { margin-top: 10px; display: flex; gap: 8px; }
.calib-actions button {
  width: auto; padding: 8px 14px; font-size: 0.85rem; font-weight: 500;
  background: transparent; border: 1px solid var(--line); color: var(--ink);
}
.calib-confirm-btn { margin-top: 14px; }
.note { color: var(--muted); font-size: 0.85rem; margin-top: 20px; }
.status-label { font-size: 1.05rem; }
footer { text-align: center; color: var(--muted); font-size: 0.8rem; margin-top: 24px; }
