:root {
  --bg: #f3efe6;
  --ink: #14241b;
  --muted: #5f6b62;
  --surface: #ffffff;
  --line: #e2ddd0;
  --forest: #1f5c3d;
  --forest-press: #184a31;
  --dump: #c2722b;
  --logging: #2e7d46;
  --pet: #2c6e8f;
  --danger: #b23b2e;
  --ok: #2e7d46;
  --shadow: 0 10px 30px -12px rgba(20, 36, 27, 0.35);
  --radius: 18px;
  --accent: var(--forest);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Commissioner", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.45;
  min-height: 100%;
}

body {
  background-image:
    radial-gradient(120% 80% at 100% 0%, rgba(31, 92, 61, 0.10), transparent 55%),
    radial-gradient(90% 60% at 0% 100%, rgba(44, 110, 143, 0.08), transparent 50%);
  background-attachment: fixed;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}

/* ---------- header ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px 10px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
}
.brand .mark {
  width: 38px; height: 38px;
  border-radius: 11px;
  background: var(--forest);
  display: grid; place-items: center;
  box-shadow: var(--shadow);
}
.brand .mark svg { width: 22px; height: 22px; }
.brand h1 {
  font-family: "Unbounded", sans-serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1;
}
.brand .sub { font-size: 12px; color: var(--muted); margin-top: 3px; }

.back {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  width: 42px; height: 42px;
  border-radius: 12px;
  font-size: 22px;
  display: grid; place-items: center;
  cursor: pointer;
}

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  padding: 8px 20px 28px;
  animation: rise 0.32s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
.screen.active { display: flex; }

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- home ---------- */
.lead {
  font-size: 14px;
  color: var(--muted);
  margin: 4px 2px 18px;
}

.choices { display: grid; gap: 14px; }

.choice {
  appearance: none;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, border-color 0.12s ease;
  position: relative;
  overflow: hidden;
}
.choice:active { transform: scale(0.985); }
.choice::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 5px;
  background: var(--c);
}
.choice .ic {
  flex: none;
  width: 54px; height: 54px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--c) 14%, white);
  display: grid; place-items: center;
}
.choice .ic svg { width: 28px; height: 28px; }
.choice .tx b {
  display: block;
  font-family: "Unbounded", sans-serif;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.choice .tx span { font-size: 13px; color: var(--muted); }
.choice .arrow { margin-left: auto; color: var(--muted); font-size: 22px; }

.maplink {
  margin-top: 22px;
  text-align: center;
}
.maplink a {
  color: var(--forest);
  font-weight: 600;
  text-decoration: none;
  font-size: 14px;
  border-bottom: 2px solid color-mix(in srgb, var(--forest) 30%, transparent);
  padding-bottom: 2px;
}

/* ---------- form ---------- */
.form-title {
  font-family: "Unbounded", sans-serif;
  font-weight: 700;
  font-size: 22px;
  margin: 6px 0 16px;
  display: flex; align-items: center; gap: 10px;
}
.form-title .dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: var(--accent);
}

.photo-zone {
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  aspect-ratio: 4 / 3;
  display: grid; place-items: center;
  cursor: pointer;
  overflow: hidden;
  position: relative;
  margin-bottom: 14px;
}
.photo-zone.filled { border-style: solid; border-color: var(--accent); }
.photo-zone img { width: 100%; height: 100%; object-fit: cover; }
.photo-zone .ph {
  text-align: center; color: var(--muted); padding: 20px;
}
.photo-zone .ph svg { width: 44px; height: 44px; margin-bottom: 8px; }
.photo-zone .ph b { display: block; color: var(--ink); font-size: 16px; }
.photo-zone .retake {
  position: absolute; right: 10px; bottom: 10px;
  background: rgba(20, 36, 27, 0.82);
  color: #fff; font-size: 13px;
  padding: 7px 12px; border-radius: 999px;
  display: none;
}
.photo-zone.filled .retake { display: block; }

.gps {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 14px;
}
.gps .gdot {
  width: 11px; height: 11px; border-radius: 50%;
  background: #c9a227; flex: none;
  box-shadow: 0 0 0 4px rgba(201, 162, 39, 0.18);
}
.gps.ok .gdot { background: var(--ok); box-shadow: 0 0 0 4px rgba(46, 125, 70, 0.18); }
.gps.err .gdot { background: var(--danger); box-shadow: 0 0 0 4px rgba(178, 59, 46, 0.18); }
.gps .gtx { flex: 1; }
.gps .gtx small { display: block; color: var(--muted); font-size: 12px; }
.gps button {
  appearance: none; border: 1px solid var(--line); background: #fff;
  border-radius: 10px; padding: 7px 12px; font-size: 13px; cursor: pointer;
  color: var(--ink);
}

.field { margin-bottom: 13px; }
.field label {
  display: block; font-size: 13px; font-weight: 600;
  color: var(--muted); margin: 0 0 6px 2px;
}
.field textarea, .field input[type="text"], .field input[type="tel"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  padding: 13px 14px;
  font: inherit;
  color: var(--ink);
}
.field textarea { min-height: 78px; resize: vertical; }
.field textarea:focus, .field input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.pet-only { display: none; }
.pet-only.show { display: block; }

.segmented { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  display: block; text-align: center;
  border: 1px solid var(--line); background: var(--surface);
  border-radius: 12px; padding: 12px 6px; cursor: pointer;
  font-weight: 600; font-size: 14px; color: var(--ink);
  margin: 0;
}
.segmented input:checked + label {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, white);
  color: var(--accent);
}

.spacer { flex: 1; min-height: 8px; }

.submit {
  appearance: none; border: none; cursor: pointer;
  width: 100%;
  background: var(--accent);
  color: #fff;
  font-family: "Unbounded", sans-serif;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.01em;
  border-radius: 15px;
  padding: 17px;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, filter 0.12s ease;
}
.submit:active { transform: scale(0.99); filter: brightness(0.96); }
.submit:disabled { opacity: 0.45; box-shadow: none; }
.submit.loading { color: transparent; position: relative; }
.submit.loading::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff; animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hint { font-size: 12px; color: var(--muted); text-align: center; margin-top: 10px; }
.errbox {
  display: none;
  background: color-mix(in srgb, var(--danger) 10%, white);
  border: 1px solid color-mix(in srgb, var(--danger) 35%, white);
  color: var(--danger);
  border-radius: 12px; padding: 11px 14px; font-size: 14px; margin-bottom: 12px;
}
.errbox.show { display: block; }

.hp { position: absolute; left: -9999px; opacity: 0; height: 0; }

/* ---------- success ---------- */
.success { text-align: center; padding-top: 8vh; }
.success .checkwrap {
  width: 96px; height: 96px; border-radius: 50%;
  background: color-mix(in srgb, var(--ok) 14%, white);
  display: grid; place-items: center; margin: 0 auto 22px;
}
.success .checkwrap svg { width: 50px; height: 50px; }
.success h2 {
  font-family: "Unbounded", sans-serif; font-size: 24px; margin: 0 0 8px;
}
.success p { color: var(--muted); margin: 0 auto 26px; max-width: 320px; }
.success .ref {
  display: inline-block; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; padding: 6px 14px; font-weight: 600; margin-bottom: 26px;
}
.success .again {
  appearance: none; border: 1px solid var(--forest); background: #fff;
  color: var(--forest); font-weight: 600; font-size: 16px;
  border-radius: 14px; padding: 15px 28px; cursor: pointer;
}

.install-tip {
  display: none;
  margin: 16px 20px 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 13px;
  color: var(--muted);
  align-items: center;
  gap: 10px;
}
.install-tip.show { display: flex; }
.install-tip button {
  margin-left: auto; appearance: none; border: none; background: var(--forest);
  color: #fff; border-radius: 9px; padding: 8px 13px; font-weight: 600; cursor: pointer;
}

.update-bar {
  display: none;
  margin: 12px 20px 0;
  background: var(--forest);
  color: #fff;
  border-radius: 14px;
  padding: 13px 15px;
  font-size: 14px;
  font-weight: 500;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
  animation: rise 0.3s ease both;
}
.update-bar.show { display: flex; }
.update-bar button {
  margin-left: auto; appearance: none; border: none; background: #fff;
  color: var(--forest); border-radius: 9px; padding: 9px 15px;
  font-weight: 600; cursor: pointer;
}

/* ---------- multi-photo grid ---------- */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.photo-grid .thumb {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
}
.photo-grid .thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-grid .thumb .rm {
  position: absolute; top: 5px; right: 5px;
  width: 26px; height: 26px; border: none; border-radius: 50%;
  background: rgba(20, 36, 27, 0.78); color: #fff;
  font-size: 17px; line-height: 1; cursor: pointer;
  display: grid; place-items: center;
}
.photo-grid .add-photo {
  aspect-ratio: 1 / 1;
  border: 2px dashed var(--line);
  border-radius: 14px;
  background: var(--surface);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  cursor: pointer; color: var(--muted);
}
.photo-grid .add-photo svg { width: 30px; height: 30px; }
.photo-grid .add-photo span { font-size: 12px; font-weight: 600; }
