/* Switzer (Fontshare, ITF Free Font License), self-hosted from /fonts. */
@font-face {
  font-family: "Switzer";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url(/fonts/switzer-400.woff2) format("woff2");
}
@font-face {
  font-family: "Switzer";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url(/fonts/switzer-500.woff2) format("woff2");
}
@font-face {
  font-family: "Switzer";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url(/fonts/switzer-600.woff2) format("woff2");
}
:root {
  --bg: #ffffff;
  --fg: #2b2b2e;     /* softened black */
  --muted: #7a7a80;
  --line: #e7e7e7;
  --line-strong: #c4c4c8;
  --card: #f4f4f5;
  --accent: #0d99ff;
  --accent-fg: #ffffff;
  --ok: #14ae5c;
  --danger: #e5484d;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1c1f;     /* less black */
    --fg: #f0f0f2;     /* slightly off-white */
    --muted: #93939a;
    --line: #333337;
    --line-strong: #55555b;
    --card: #28282c;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg); }
body {
  font: 16px/1.45 "Switzer", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}
#app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 96px);
}

.view { padding-top: 16px; }
h1 { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 8px; }
.muted { color: var(--muted); margin: 0 0 20px; }
.small { font-size: 14px; }
.error { color: var(--danger); }
.row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.link { color: var(--accent); font-weight: 500; cursor: pointer; }

.btn {
  appearance: none; border: 0; border-radius: 12px; cursor: pointer;
  font: inherit; font-weight: 600; padding: 14px 18px;
  background: var(--card); color: var(--fg);
  display: inline-flex; align-items: center; justify-content: center;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { transform: scale(0.98); }
.btn.primary { background: var(--accent); color: var(--accent-fg); }
.btn.big { width: 100%; padding: 18px; font-size: 17px; }

.grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
}
.grid li { position: relative; aspect-ratio: 9 / 16; border-radius: 10px; overflow: hidden; background: var(--card); }
.grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.grid .num {
  position: absolute; left: 6px; top: 6px; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 11px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.grid .remove {
  position: absolute; right: 4px; top: 4px; width: 28px; height: 28px; border-radius: 50%;
  border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 18px; line-height: 1; cursor: pointer;
}

.bar {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px);
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 1fr 2fr; gap: 8px;
  max-width: 560px; margin: 0 auto;
}

.progress { height: 6px; border-radius: 3px; background: var(--card); overflow: hidden; margin: 16px 0 10px; }
#progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .25s ease; }

.check {
  width: 56px; height: 56px; border-radius: 50%; background: var(--ok); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 28px; margin-bottom: 16px;
}

/* Plain text screens (landing, connected) */
.plain .brand { font-weight: 600; }

/* Primary action pinned to the bottom of the screen */
.dock {
  position: fixed; left: 0; right: 0; bottom: 0;
  padding: 12px 16px calc(env(safe-area-inset-bottom) + 16px);
  max-width: 560px; margin: 0 auto;
}

/* Squircle corners: squircle.js replaces this radius with a smoothed clip-path */
.btn { border-radius: 16px; }

/* Landing: plain text, no heading styles */
.plain p { margin: 0 0 16px; }
.plain ol { margin: 0 0 16px; padding-left: 1.4em; }
.plain li { margin: 0 0 6px; }

/* Pick / upload / done: text on top, the rest of the screen is a zone or the dot animation */
body[data-view="pick"] #app, body[data-view="upload"] #app, body[data-view="done"] #app {
  min-height: 100dvh; display: flex; flex-direction: column;
  padding-bottom: calc(env(safe-area-inset-bottom) + 16px);
}
#view-pick:not([hidden]), #view-upload:not([hidden]), #view-done:not([hidden]) {
  flex: 1; display: flex; flex-direction: column;
}
.dots-area { position: relative; flex: 1; min-height: 200px; margin-top: 24px; }
.dots-area canvas {
  position: absolute; inset: 0; width: 100%; height: 100%;
  transition: opacity .6s ease;
  /* soft edges: fade to transparent on all four sides */
  -webkit-mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent),
                      linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 14%, #000 86%, transparent),
              linear-gradient(to bottom, transparent, #000 14%, #000 86%, transparent);
  mask-composite: intersect;
}
#view-upload.finishing canvas { opacity: 0; }
/* Over-the-limit note sits right under "Sending X of Y" as its second line */
#upload-text:has(+ #upload-note:not([hidden])) { margin-bottom: 0; }

/* Done: one bright green for both themes, white text on it */
html, body { transition: background-color .5s ease, color .5s ease; }
:root { --done-bg: #3db364; --done-fg: #ffffff; }
html:has(body[data-view="done"]), body[data-view="done"] { background: var(--done-bg); }
body[data-view="done"] { --fg: var(--done-fg); --muted: color-mix(in srgb, var(--done-fg) 65%, transparent); color: var(--fg); }
/* Daily limit reached: same recipe in red — one colour for both themes, "Drop" in white,
   the message in the dimmed (grey-on-white elsewhere) text colour */
:root { --limit-bg: #e5484d; --limit-fg: #ffffff; }
html:has(body[data-view="limit"]), body[data-view="limit"] { background: var(--limit-bg); }
body[data-view="limit"] { --fg: var(--limit-fg); --muted: color-mix(in srgb, var(--limit-fg) 65%, transparent); color: var(--fg); }
.zone {
  position: relative; flex: 1; min-height: 200px; margin-top: 24px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  color: var(--muted); font-weight: 400; cursor: pointer; /* same type as body text */
  -webkit-tap-highlight-color: transparent;
}
.zone:active { color: var(--fg); }
.zone > span { pointer-events: none; }
.zone:focus { outline: none; }
.zone-input {
  position: absolute; left: 50%; top: 50%; width: 1px; height: 1px;
  opacity: 0; pointer-events: none; border: 0; padding: 0;
}
.zone-border { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.zone-border path { fill: none; stroke: color-mix(in srgb, var(--fg) 28%, transparent); stroke-width: 2; stroke-dasharray: 0 5; stroke-linecap: round; } /* round 2px dots, 3px gap (5px centre-to-centre) */

/* iOS has no Vibration API. A system switch control is the one thing that ticks
   (Safari 17.4+), and since iOS 26.5 the tap has to land on the control itself —
   so an invisible one is stretched over the whole zone. Never give it
   appearance:none: the haptic comes from the native control. */
.zone-haptic {
  position: absolute; inset: 0; width: 100%; height: 100%;
  margin: 0; padding: 0; border: 0; opacity: 0;
}
/* Off-screen twin for the scripted ticks (success / error). */
.haptic-probe {
  position: fixed; left: 0; bottom: 0; width: 1px; height: 1px;
  margin: 0; padding: 0; border: 0; opacity: 0; pointer-events: none;
}
