/* Light and quiet: white paper, thin lines, one accent. */
:root {
  --bg: #ffffff;
  --soft: #f6f6f3;
  --softer: #fafaf8;
  --line: #e7e6e1;
  --line-2: #d5d3cc;
  --text: #17171a;
  --text-2: #5d5d64;
  --text-3: #8b8b92;
  --accent: #2b5ce6;
  --accent-soft: #eaf0ff;
  --ok: #1d7f49;
  --warn: #9a5b00;
  --warn-soft: #fff5e3;
  --err: #b4261e;
  --err-soft: #fdeceb;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow-sm: 0 1px 2px rgba(23, 23, 26, 0.04);
  --shadow-card: 0 4px 20px -2px rgba(23, 23, 26, 0.05), 0 2px 6px -1px rgba(23, 23, 26, 0.02);
  --shadow-drop: 0 12px 36px -4px rgba(23, 23, 26, 0.07), 0 2px 8px -2px rgba(23, 23, 26, 0.03);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; }
h1, h2 { font-weight: 650; letter-spacing: -0.02em; margin: 0; }
svg { flex: none; }
.muted { color: var(--text-2); }

/* ------------------------------------------------------------ header */
.top {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  flex: none;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 650; letter-spacing: -0.01em; }
.brand svg { width: 22px; height: 22px; }
.brand svg path { fill: none; stroke: var(--text); stroke-width: 2.5; }
.brand svg rect { fill: var(--text); }

.stepper { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; }
.stepper li { display: flex; align-items: center; gap: 8px; padding: 6px 12px 6px 8px; color: var(--text-3); font-size: 14px; }
.stepper li + li::before { content: ""; width: 18px; height: 1px; background: var(--line-2); margin: 0 6px 0 -12px; }
.stepper b {
  display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--line-2); font-size: 12.5px; font-weight: 600;
}
.stepper li.now { color: var(--text); font-weight: 550; }
.stepper li.now b { background: var(--text); border-color: var(--text); color: #fff; }
.stepper li.done { color: var(--text-2); }
.stepper li.done b { border-color: var(--text-2); color: var(--text-2); }

.account { display: flex; align-items: center; justify-content: flex-end; gap: 12px; font-size: 14px; }

/* account menu: a round initial, and under it a small panel */
.me { position: relative; }
.me-btn {
  display: flex; align-items: center; gap: 4px; height: 36px; padding: 0 6px 0 2px;
  border: 0; border-radius: 999px; background: none; cursor: pointer; color: var(--text-2);
}
.me-btn:hover, .me-btn[aria-expanded="true"] { background: var(--soft); color: var(--text); }
.me-btn:focus-visible, .me-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.me-btn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.avatar {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: var(--soft); border: 1px solid var(--line-2); color: var(--text);
  font-size: 14px; font-weight: 600; line-height: 1;
}
.me-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 50; width: 292px;
  background: var(--bg); border-radius: 12px; padding: 6px;
  box-shadow: 0 12px 32px rgba(20, 20, 30, .10), 0 0 0 1px var(--line);
}
.me-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 12px; }
.me-head .avatar { width: 36px; height: 36px; font-size: 15px; }
.me-email { min-width: 0; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-plan {
  display: grid; grid-template-columns: auto 1fr; column-gap: 12px; row-gap: 2px;
  margin: 0 4px 6px; padding: 10px 12px; background: var(--softer); border: 1px solid var(--line); border-radius: var(--radius);
}
.me-label { grid-row: span 2; color: var(--text-3); font-size: 13px; padding-top: 1px; }
.me-plan-name { font-weight: 600; font-size: 14.5px; }
.me-plan-note { color: var(--text-2); font-size: 13px; }
.me-plan-note:empty { display: none; }
.me-items { display: flex; flex-direction: column; padding-top: 2px; border-top: 1px solid var(--line); margin-top: 6px; }
.me-item {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%;
  padding: 9px 10px; margin-top: 2px; border: 0; border-radius: 8px; background: none; cursor: pointer;
  color: var(--text); font-size: 14.5px; text-align: left; text-decoration: none;
}
.me-item:hover { background: var(--soft); }
.me-item small { display: block; color: var(--text-3); font-size: 12.5px; margin-top: 1px; }
.me-item svg { width: 16px; height: 16px; fill: none; stroke: var(--text-3); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#me-upgrade { color: var(--accent); font-weight: 550; }
#logout { color: var(--text-2); }
.lang { display: flex; border: 1px solid var(--line); border-radius: 8px; padding: 2px; }
.lang button { border: 0; background: none; padding: 2px 8px; border-radius: 6px; font-size: 12.5px; color: var(--text-3); cursor: pointer; }
.lang button.on { background: var(--soft); color: var(--text); }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 16px; border-radius: var(--radius);
  border: 1px solid transparent; background: none; cursor: pointer;
  font-size: 15px; font-weight: 550; white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn.primary { background: var(--text); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.secondary { background: var(--bg); border-color: var(--line-2); }
.btn.secondary:hover { border-color: var(--text-3); }
.btn.secondary.on { border-color: #1c3fa6; color: #1c3fa6; background: var(--accent-soft); }
.btn.accent { background: var(--accent); color: #fff; }
.btn.accent:hover { background: #1c3fa6; }
.btn.ghost { color: var(--text-2); }
.btn.ghost:hover { color: var(--text); background: var(--soft); }
.btn.small { height: 32px; padding: 0 10px; font-size: 14px; font-weight: 500; }
.btn.big { height: 52px; font-size: 16.5px; padding: 0 22px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary:disabled:hover { background: var(--text); }
.btn.accent:disabled:hover { background: var(--accent); }
.btn:focus-visible, .link:focus-visible, .chip:focus-visible, .icon:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.link { border: 0; background: none; padding: 0; color: var(--text-2); cursor: pointer; font-size: 15px; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.link:hover { color: var(--text); text-decoration-color: currentColor; }
.icon { display: inline-grid; place-items: center; width: 32px; height: 32px; border: 0; border-radius: 8px; background: none; cursor: pointer; color: var(--text-2); }
.icon:hover { background: var(--soft); color: var(--text); }
.icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* ------------------------------------------------------------ screens */
main { flex: 1; min-height: 0; display: flex; }
.screen { flex: 1; min-width: 0; }

.upload {
  max-width: 960px;
  margin: 0 auto;
  padding: 64px 28px 72px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

/* Hero Title - Modern Big Display Font */
.upload h1 {
  font-family: var(--font-display);
  font-size: clamp(48px, 6.8vw, 78px);
  font-weight: 780;
  letter-spacing: -0.04em;
  line-height: 1.02;
  color: var(--text);
  max-width: 860px;
  margin: 0 auto;
  text-wrap: balance;
}

.lead {
  font-size: clamp(19px, 2.1vw, 22px);
  line-height: 1.48;
  color: var(--text-2);
  letter-spacing: -0.015em;
  max-width: 660px;
  margin: 20px auto 40px;
  text-wrap: balance;
}

/* Drop Zone */
.drop {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 310px;
  padding: 44px 32px;
  text-align: center;
  cursor: pointer;
  border: 1.5px dashed var(--line-2);
  border-radius: var(--radius-xl);
  background: var(--softer);
  box-shadow: var(--shadow-sm);
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease, transform .18s ease;
}
.drop:hover {
  border-color: var(--text-3);
  background: #fdfdfc;
  box-shadow: var(--shadow-drop);
}
.drop.over {
  border-color: var(--accent);
  border-style: solid;
  background: var(--accent-soft);
  box-shadow: 0 0 0 4px rgba(43, 92, 230, 0.12);
}
.drop-icon-wrap {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
  transition: transform .18s ease, border-color .18s ease;
}
.drop:hover .drop-icon-wrap {
  transform: translateY(-2px);
  border-color: var(--line-2);
}
.drop-icon {
  width: 32px;
  height: 32px;
  stroke: var(--text);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}
.drop-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 680;
  letter-spacing: -0.025em;
  color: var(--text);
  margin-bottom: 14px;
}
.drop-or {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 16px;
}
.drop-or-text {
  color: var(--text-3);
  font-size: 14px;
  font-weight: 500;
}
.drop-btn {
  box-shadow: 0 4px 14px rgba(23, 23, 26, 0.12);
}
.drop:hover .drop-btn {
  box-shadow: 0 6px 20px rgba(23, 23, 26, 0.20);
}
.drop-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-size: 13.5px;
  color: var(--text-3);
}

/* Feature/Benefit Strip */
.hero-features {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 32px;
  margin: 28px 0 0;
  padding: 16px 24px;
  border-radius: var(--radius);
  background: var(--softer);
  border: 1px solid var(--line);
  flex-wrap: wrap;
}
.feature-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 550;
  color: var(--text-2);
  letter-spacing: -0.01em;
}
.feature-item svg {
  width: 16px;
  height: 16px;
  stroke: var(--accent);
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Section Headings */
.section-head {
  width: 100%;
  margin: 64px 0 24px;
}
.section-head.center {
  text-align: center;
}
.section-label {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1.15;
  color: var(--text);
  margin: 0;
}
.section-lead {
  font-size: 16.5px;
  color: var(--text-2);
  margin: 8px auto 0;
  max-width: 580px;
  line-height: 1.5;
}

/* Interactive Demos */
.demos {
  width: 100%;
  margin: 0 0 16px;
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 20px;
  align-items: stretch;
}
.demo-stage {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--softer);
  overflow: hidden;
  cursor: ew-resize;
  touch-action: pan-y;
  user-select: none;
  box-shadow: var(--shadow-card);
}
.demo-stage:hover { border-color: var(--line-2); }
.demo-stage canvas { display: block; width: 100%; height: 100%; }
.demo-tag {
  position: absolute;
  top: 14px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.4;
  letter-spacing: 0.02em;
  pointer-events: none;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text-2);
  box-shadow: var(--shadow-sm);
  transition: opacity .15s;
}
.demo-tag.before { left: 14px; }
.demo-tag.after {
  right: 14px;
  border-color: #c5d5fb;
  background: var(--accent-soft);
  color: #1c3fa6;
}
.demo-tabs {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}
.demo-tab {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 4px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.demo-tab:hover {
  border-color: var(--line-2);
  box-shadow: var(--shadow-card);
}
.demo-tab.on {
  border-color: var(--line-2);
  background: var(--softer);
  box-shadow: var(--shadow-card);
}
.demo-tab strong {
  font-size: 16px;
  font-weight: 680;
  letter-spacing: -0.015em;
  color: var(--text-2);
  transition: color .15s;
}
.demo-tab.on strong { color: var(--text); }
.demo-tab span {
  font-size: 14px;
  color: var(--text-3);
  line-height: 1.35;
}
.demo-tab.on span { color: var(--text-2); }
.demo-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: transparent;
}
.demo-tab.on .demo-bar { background: var(--line); }
.demo-bar b {
  display: block;
  height: 100%;
  width: 0;
  background: var(--accent);
}

/* How It Works - Modern Big Numbered Cards */
.how {
  width: 100%;
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.how-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  text-align: left;
  padding: 28px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--softer);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.how-card:hover {
  border-color: var(--line-2);
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}
.how-num {
  display: block;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 780;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  margin-bottom: 18px;
}
.how-title {
  display: block;
  font-size: 18px;
  font-weight: 680;
  letter-spacing: -0.02em;
  color: var(--text);
  margin-bottom: 8px;
}
.how-desc {
  display: block;
  font-size: 14.5px;
  color: var(--text-2);
  line-height: 1.5;
}

/* Guides Home */
.guides-home {
  width: 100%;
  margin: 64px 0 0;
  padding-top: 36px;
  border-top: 1px solid var(--line);
  text-align: left;
}
.guides-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.guides-label {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--text);
}
.guides-head .link { font-size: 14.5px; font-weight: 550; }
.guides-list { display: flex; flex-direction: column; gap: 12px; }
.guide-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg);
  color: inherit;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: border-color .18s ease, background .18s ease, transform .18s ease, box-shadow .18s ease;
}
.guide-link:hover {
  border-color: var(--line-2);
  background: var(--softer);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}
.guide-link strong {
  display: block;
  font-size: 17px;
  font-weight: 680;
  color: var(--text);
  letter-spacing: -0.015em;
  margin-bottom: 4px;
}
.guide-link span {
  display: block;
  font-size: 14.5px;
  color: var(--text-2);
  line-height: 1.45;
}
.guide-link i {
  flex: none;
  font-style: normal;
  color: var(--text-3);
  font-size: 20px;
  font-weight: 500;
  transition: transform .15s ease, color .15s ease;
}
.guide-link:hover i {
  color: var(--accent);
  transform: translateX(3px);
}

/* progress */
.work { max-width: 520px; margin: 0 auto; padding: 72px 28px; text-align: center; }
.work-thumb { width: 160px; height: 160px; margin: 0 auto 28px; display: grid; place-items: center; }
.work-thumb img { max-width: 100%; max-height: 100%; border-radius: 8px; box-shadow: 0 0 0 1px var(--line); }
.work h2 { font-size: 28px; }
.bar { height: 4px; background: var(--soft); border-radius: 2px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 2px; transition: width .25s linear; }
/* one bar per stage; the finished ones stay */
.steps { list-style: none; margin: 26px 0 0; padding: 0; text-align: left; font-size: 15px; }
.steps li { margin-top: 12px; animation: step-in .3s ease; }
.steps li:first-child { margin-top: 0; }
.step-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; color: var(--text-2); }
.steps li.now .step-head { color: var(--text); font-weight: 550; }
.step-time { color: var(--text-3); font-weight: 400; font-variant-numeric: tabular-nums; white-space: nowrap; }
.steps li.done .step-time::before {
  content: ""; display: inline-block; width: 4px; height: 8px; margin: 0 8px 3px 0;
  border: solid var(--accent); border-width: 0 2px 2px 0; transform: rotate(45deg);
}
@keyframes step-in { from { opacity: 0; transform: translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .steps li { animation: none; } }
.work-queue { margin: 18px 0 0; font-weight: 550; }
.work .muted { margin-top: 18px; font-size: 14.5px; }
.work-error { margin-top: 28px; padding: 18px; border-radius: var(--radius); background: var(--err-soft); color: var(--err); }
.work-error p { margin: 0 0 14px; }

/* editor and download: picture left, panel right */
.edit, .export { display: flex; min-height: 0; }
.stage { flex: 1; min-width: 0; display: flex; flex-direction: column; padding: 16px 0 16px 20px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); padding: 3px; background: var(--bg); }
.seg button { border: 0; background: none; height: 30px; padding: 0 14px; border-radius: 7px; cursor: pointer; font-size: 14px; color: var(--text-2); }
.seg button.on { background: var(--soft); color: var(--text); font-weight: 550; }
.zoom { display: flex; align-items: center; gap: 4px; }
.zoom span { min-width: 48px; text-align: center; font-size: 13.5px; color: var(--text-2); font-variant-numeric: tabular-nums; }

.viewport { position: relative; flex: 1; min-height: 320px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-lg); cursor: grab; touch-action: none; }
.viewport.dragging { cursor: grabbing; }
.viewport.picking { cursor: crosshair; }
.viewport.still { cursor: default; display: grid; place-items: center; padding: 24px; }
/* the whole picture, however tall: sized by the frame (app.js fits the result into it) */
.viewport.still canvas { position: absolute; inset: 24px; width: calc(100% - 48px); height: calc(100% - 48px); }
.checker {
  background-color: #fff;
  background-image: linear-gradient(45deg, #f1f0ec 25%, transparent 25%), linear-gradient(-45deg, #f1f0ec 25%, transparent 25%),
                    linear-gradient(45deg, transparent 75%, #f1f0ec 75%), linear-gradient(-45deg, transparent 75%, #f1f0ec 75%);
  background-size: 16px 16px;
  background-position: 0 0, 0 8px, 8px -8px, -8px 0;
}
/* the result, drawn at the zoom shown (app.js); #page holds the raster views */
.drawn { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.page { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.page img, .page canvas { position: absolute; inset: 0; width: 100%; height: 100%; user-select: none; -webkit-user-drag: none; }
.lens { position: absolute; left: 0; top: 0; pointer-events: none; border-radius: 50%; box-shadow: 0 6px 22px rgba(23, 23, 26, .28); }
.note { margin: 10px 2px 0; font-size: 14px; color: var(--text-2); }
.busy { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255, 255, 255, .78); }
.busy-card { width: min(360px, 80%); text-align: center; }
.busy-card p { margin: 0 0 14px; font-weight: 550; }
.busy-card .steps { margin: 0; font-size: 14px; }

.panel { width: 380px; flex: none; display: flex; flex-direction: column; gap: 22px; padding: 22px 24px 0; overflow-y: auto; }
.panel-head h2 { font-size: 24px; }
.panel-head .muted { font-size: 14.5px; }
.guide { list-style: none; margin: 0; padding: 16px 18px; display: flex; flex-direction: column; gap: 12px; background: var(--soft); border-radius: var(--radius); }
.guide li { display: flex; align-items: center; gap: 12px; font-size: 16.5px; font-weight: 500; line-height: 1.35; }
.guide b { background: var(--bg); }

.selection { border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.sel-row { display: flex; align-items: center; gap: 12px; }
.sel-swatch { width: 40px; height: 40px; border-radius: 8px; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); flex: none; }
.sel-text { flex: 1; display: flex; flex-direction: column; line-height: 1.3; }
.sel-text strong { font-weight: 600; font-variant-numeric: tabular-nums; }
.sel-text span { font-size: 14px; color: var(--text-2); }
.sel-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sel-actions .btn { height: 38px; font-size: 14.5px; padding: 0 10px; }
.sel-actions .btn:first-child { grid-column: 1 / -1; }
.dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15); }
.dot.checker {
  background-image: linear-gradient(45deg, #cfcdc6 25%, transparent 25%, transparent 75%, #cfcdc6 75%),
                    linear-gradient(45deg, #cfcdc6 25%, transparent 25%, transparent 75%, #cfcdc6 75%);
  background-size: 6px 6px; background-position: 0 0, 3px 3px;
}
#picker { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.hint { margin: 0; font-size: 13.5px; color: var(--text-2); }
.merge-hint { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: var(--radius); background: var(--accent-soft); color: #1c3fa6; font-size: 15px; font-weight: 500; }
.merge-hint span { flex: 1; }

.chips { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 8px; }
.chip { aspect-ratio: 1; border: 0; border-radius: 8px; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); position: relative; padding: 0; }
.chip:hover { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1), 0 0 0 2px var(--line-2); }
.chip.sel { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1), 0 0 0 2px var(--bg), 0 0 0 4px var(--accent); }
.chip.off { background-color: #fff !important; background-image: linear-gradient(135deg, transparent 46%, var(--err) 46%, var(--err) 54%, transparent 54%); }
.merging .chip:not(.sel):hover { box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1), 0 0 0 2px var(--bg), 0 0 0 4px #1c3fa6; }

.count-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.count-head label { font-weight: 550; }
.count-head output { font-variant-numeric: tabular-nums; font-weight: 600; }
input[type=range] { width: 100%; accent-color: var(--text); }
.count .hint { margin-top: 4px; }
.history { display: flex; gap: 4px; flex-wrap: wrap; margin: -8px 0 0 -10px; }
.panel-foot {
  margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 14px;
  position: sticky; bottom: 0; padding: 14px 0 22px; background: var(--bg); box-shadow: 0 -1px 0 var(--line);
}
.panel-foot .btn { width: 100%; }

/* download */
.formats { display: flex; flex-direction: column; gap: 10px; }
.format {
  display: grid; grid-template-columns: auto 1fr auto; column-gap: 12px; row-gap: 2px; align-items: center;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer;
}
.format:hover { border-color: var(--line-2); }
.format:has(input:checked) { border-color: var(--text); box-shadow: inset 0 0 0 1px var(--text); }
.format input { margin: 0; accent-color: var(--text); width: 18px; height: 18px; }
.f-name { font-weight: 650; }
.f-tag { font-size: 12.5px; color: var(--text-3); }
.f-desc { grid-column: 2 / -1; font-size: 14px; color: var(--text-2); }
.png-width { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 550; }
.png-width .seg button { padding: 0 10px; font-variant-numeric: tabular-nums; }
.quota { margin: -6px 0 0; font-size: 14.5px; color: var(--text-2); text-align: center; }
.manage { align-self: center; margin-top: -12px; font-size: 14px; }

/* ------------------------------------------------------------ dialogs */
.dialog {
  border: 0; padding: 28px; border-radius: var(--radius-lg); width: min(640px, calc(100vw - 32px));
  box-shadow: 0 24px 64px rgba(20, 20, 30, .14), 0 0 0 1px var(--line); color: var(--text);
}
.dialog::backdrop { background: rgba(250, 250, 248, .72); backdrop-filter: blur(2px); }
.dialog h2 { font-size: 24px; margin-bottom: 18px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 26px; }
.check-body { display: flex; gap: 22px; }
.check-side { flex: none; width: 180px; display: flex; flex-direction: column; gap: 10px; }
.check-thumb { height: 180px; border-radius: var(--radius); display: grid; place-items: center; border: 1px solid var(--line); overflow: hidden; }
.check-thumb canvas { display: block; }

/* cropping: the frame keeps its handles outside the picture, the dimmed rest is clipped to it */
.dialog.check.cropping { width: min(880px, calc(100vw - 32px)); }
.crop-stage { max-height: min(56vh, 540px); display: grid; place-items: center; background: var(--soft); border-radius: var(--radius); }
.crop-pic { position: relative; touch-action: none; user-select: none; cursor: crosshair; }
.crop-pic canvas { display: block; width: 100%; height: 100%; }
.crop-dim { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.crop-hole { position: absolute; box-shadow: 0 0 0 100vmax rgba(23, 23, 26, .45); }
.crop-box { position: absolute; outline: 2px solid var(--accent); cursor: move; }
.crop-box i { position: absolute; }
.crop-box i::after {
  content: ""; position: absolute; width: 12px; height: 12px; left: calc(50% - 6px); top: calc(50% - 6px);
  box-sizing: border-box; background: #fff; border: 2px solid var(--accent); border-radius: 3px;
}
.crop-box [data-h=nw], .crop-box [data-h=ne], .crop-box [data-h=se], .crop-box [data-h=sw] { width: 26px; height: 26px; z-index: 1; }
.crop-box [data-h=nw] { left: -13px; top: -13px; cursor: nwse-resize; }
.crop-box [data-h=ne] { right: -13px; top: -13px; cursor: nesw-resize; }
.crop-box [data-h=se] { right: -13px; bottom: -13px; cursor: nwse-resize; }
.crop-box [data-h=sw] { left: -13px; bottom: -13px; cursor: nesw-resize; }
.crop-box [data-h=n], .crop-box [data-h=s] { left: 13px; right: 13px; height: 18px; cursor: ns-resize; }
.crop-box [data-h=n] { top: -9px; }
.crop-box [data-h=s] { bottom: -9px; }
.crop-box [data-h=e], .crop-box [data-h=w] { top: 13px; bottom: 13px; width: 18px; cursor: ew-resize; }
.crop-box [data-h=e] { right: -9px; }
.crop-box [data-h=w] { left: -9px; }
.levels { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 0 12px; margin-top: 14px; }
.levels-name { font-size: 14.5px; color: var(--text-2); }
.levels-hist { position: relative; height: 38px; margin-bottom: 12px; touch-action: none; user-select: none; }
.levels-hist canvas { display: block; width: 100%; height: 100%; background: var(--soft); border-radius: 6px 6px 0 0; }
.levels-hist i { position: absolute; bottom: -13px; width: 22px; height: 14px; margin-left: -11px; cursor: ew-resize; filter: drop-shadow(0 0 1px rgba(23, 23, 26, .75)); }
.levels-hist i::after { content: ""; position: absolute; left: 4px; top: 1px; width: 14px; height: 12px; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.lv-black::after { background: var(--text); }
.lv-mid::after { background: var(--text-3); }
.lv-white::after { background: #fff; }
.levels .hint { grid-column: 1 / -1; margin-top: 4px; }
.crop-hint { display: flex; justify-content: space-between; gap: 16px; margin: 12px 2px 0; font-size: 14.5px; color: var(--text-2); }
.crop-size { flex: none; color: var(--text); font-weight: 550; font-variant-numeric: tabular-nums; }
#crop-reset { margin-right: auto; }
.crop-tools { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; margin-bottom: 12px; }
.crop-angle { flex: 1; min-width: 220px; display: flex; align-items: center; gap: 10px; margin-left: 8px; font-size: 14.5px; color: var(--text-2); }
.crop-angle input { flex: 1; min-width: 80px; }
.crop-angle output { min-width: 46px; text-align: right; color: var(--text); font-weight: 550; font-variant-numeric: tabular-nums; }
#crop-corners { margin-left: auto; }
.crop-quad { position: absolute; inset: 0; }
.crop-quad svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.crop-quad .dim { fill: rgba(23, 23, 26, .45); fill-rule: evenodd; }
.crop-quad .line { fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.crop-quad i { position: absolute; width: 34px; height: 34px; margin: -17px 0 0 -17px; cursor: move; }
.crop-quad i::after {
  content: ""; position: absolute; left: 8px; top: 8px; width: 18px; height: 18px; box-sizing: border-box;
  border-radius: 50%; background: #fff; border: 2px solid var(--accent); box-shadow: 0 1px 4px rgba(23, 23, 26, .3);
}
.crop-pic .loupe { position: absolute; width: 120px; height: 120px; border-radius: 50%; pointer-events: none; background: #fff; box-shadow: 0 0 0 3px #fff, 0 6px 22px rgba(23, 23, 26, .3); z-index: 2; }
.check-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.check-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.check-info > .muted { font-size: 14.5px; }
.checks { list-style: none; margin: 14px 0 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.checks li { display: flex; gap: 10px; font-size: 15px; line-height: 1.4; }
.checks svg { width: 20px; height: 20px; margin-top: 1px; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.checks .ok svg { stroke: var(--ok); }
.checks .info svg { stroke: var(--text-2); }
.checks .warn { color: var(--warn); }
.checks .warn svg { stroke: var(--warn); }
.checks .error { color: var(--err); }
.checks .error svg { stroke: var(--err); }
.kind { margin-top: 18px; display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.kind-name { font-size: 14.5px; font-weight: 550; }
.kind .seg button { height: auto; min-height: 30px; padding: 5px 14px; line-height: 1.3; }
.clean { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 14.5px; cursor: pointer; }
.clean input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
/* a coloring page has no colours step: it shows as skipped */
.stepper li.skip { color: var(--text-3); }
.stepper li.skip b { border-color: var(--line-2); color: var(--text-3); }
.stepper li.skip span { text-decoration: line-through; }

.login { width: min(420px, calc(100vw - 32px)); }
.login h2 { margin-bottom: 6px; }
.login .muted { margin: 0 0 22px; }
.close { position: absolute; top: 14px; right: 14px; }
.btn .g { stroke: none; }
.soon { margin: 6px 0 0; text-align: center; font-size: 13px; color: var(--text-3); }
.or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--text-3); font-size: 13.5px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.login form { display: flex; flex-direction: column; gap: 8px; }
.login label { font-size: 14px; font-weight: 550; }
.login input[type=email] {
  height: 44px; padding: 0 14px; border: 1px solid var(--line-2); border-radius: var(--radius); font: inherit;
}
.login input[type=email]:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.login form .btn { margin-top: 6px; }
.field-error { margin: 0; color: var(--err); font-size: 14px; }
.sent { margin: 0; padding: 14px 16px; border-radius: var(--radius); background: var(--accent-soft); color: #1c3fa6; font-weight: 500; }
.dev { margin: 16px 0 0; font-size: 13px; color: var(--warn); background: var(--warn-soft); padding: 8px 12px; border-radius: 8px; }
.limit { width: min(460px, calc(100vw - 32px)); }
.limit p { margin: 0 0 10px; }
.pack-list { display: flex; flex-direction: column; gap: 8px; margin: 16px 0 12px; }
.pack { justify-content: space-between; }
.pack-price { font-variant-numeric: tabular-nums; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 10;
  max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: var(--radius);
  background: var(--text); color: #fff; font-size: 15px; box-shadow: 0 10px 30px rgba(0, 0, 0, .16);
}
.toast.err { background: var(--err); }

.fine { margin: 44px 0 0; }
.fine .link { font-size: 13px; color: var(--text-3); }
.fine .link + .link { margin-left: 16px; }

/* ------------------------------------------------------------ narrow screens */
@media (max-width: 960px) {
  .top { grid-template-columns: auto 1fr auto; padding: 0 16px; gap: 12px; }
  .stepper { justify-content: center; }
  .stepper span { display: none; }
  .stepper li { padding: 6px 2px; }
  .stepper li + li::before { width: 10px; margin: 0 4px 0 -2px; }
  .brand > span { display: none; }
  .me-menu { width: min(292px, calc(100vw - 24px)); }
  .upload { padding: 40px 18px 48px; }
  .upload h1 { font-size: clamp(34px, 8.5vw, 46px); }
  .lead { font-size: 17.5px; margin: 16px auto 30px; }
  .drop { padding: 32px 18px; min-height: 260px; }
  .drop-title { font-size: 20px; }
  .hero-features { flex-direction: column; gap: 12px; align-items: flex-start; padding: 16px; }
  .section-head { margin: 44px 0 18px; }
  .section-title { font-size: 26px; }
  .demos { grid-template-columns: 1fr; gap: 14px; }
  .how { grid-template-columns: 1fr; gap: 14px; }
  .edit, .export { flex-direction: column; overflow-y: auto; }
  .stage { padding: 12px 16px 0; }
  .panel { width: auto; padding: 18px 16px 0; overflow: visible; }
  .viewport { min-height: 46vh; }
  .check-body { flex-direction: column; }
  .check-side { width: 100%; }
  .check-thumb { height: 200px; }
  .kind .seg { width: 100%; }
  .kind .seg button { flex: 1; padding: 6px 10px; }
  .crop-stage { max-height: 52vh; }
  .crop-hint { flex-direction: column; gap: 4px; }
  #crop-foot { flex-wrap: wrap; }
  #crop-reset { order: 3; flex-basis: 100%; margin: 0; }
  .dialog { padding: 22px 18px; }
}
