:root {
  --sage: #6e8772;
  --sage-dark: #4f6453;
  --sage-tint: #eef2ee;
  --accent: #c79a52;
  --ink: #1f2420;
  --muted: #5f6a61;
  --line: #d5ddd6;
  --bg: #ffffff;
  --radius: 10px;
  --font: "Lexend", "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

.finder {
  max-width: 860px;
  margin: 0 auto;
  padding: 8px 16px 12px;
  display: grid;
  gap: 10px;
}

/* ---------- Illustration ---------- */
.dog-wrap { margin: 0; text-align: center; }
.dog { width: 100%; max-height: 280px; display: block; margin: 0 auto; }
.dog .body { fill: var(--sage); }

.tape path { fill: none; stroke-linecap: round; transition: stroke .25s, stroke-width .25s, opacity .25s; }
.tape .back { stroke: var(--sage-dark); stroke-width: 9; opacity: .7; }
.tape .front { stroke: #111; stroke-width: 9; }
.tape .pill rect { fill: #e9ece9; opacity: .85; transition: fill .25s; }
.tape .pill text { font: 500 40px var(--font); text-anchor: middle; fill: #111; }

/* A field is active: dim the others, highlight and "draw" its tape */
.dog[class*="active-"] .tape { opacity: .3; }
.dog.active-neck #tape-neck,
.dog.active-girth #tape-girth,
.dog.active-chest #tape-chest { opacity: 1; }
.dog.active-neck #tape-neck .front,
.dog.active-girth #tape-girth .front,
.dog.active-chest #tape-chest .front {
  stroke: var(--accent);
  stroke-width: 13;
  stroke-dasharray: 100;
  animation: draw 1.6s ease-in-out infinite;
}
.dog.active-neck #tape-neck .pill rect,
.dog.active-girth #tape-girth .pill rect,
.dog.active-chest #tape-chest .pill rect { fill: #f3e4c8; opacity: 1; }

@keyframes draw {
  0% { stroke-dashoffset: 100; }
  60%, 100% { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .dog .tape .front { animation: none !important; stroke-dasharray: none !important; }
}

.tip {
  margin: 6px 0 0;
  font-size: 13px;
  line-height: 1.35;
  color: var(--muted);
  min-height: 2.7em;
}
.tip { margin-top: 2px; }
.tip strong { color: var(--ink); font-weight: 600; }

/* ---------- Form ---------- */
.form { display: grid; gap: 10px; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.field span { font-weight: 500; color: var(--ink); }
.field em { font-style: normal; color: var(--muted); font-weight: 400; }
.field small { color: var(--muted); font-weight: 400; }

input {
  width: 100%;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom on focus */
  color: var(--ink);
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  -moz-appearance: textfield;
}
input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
input:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 3px rgba(110, 135, 114, .25); }
input.bad { border-color: #b4533a; }

.suggest {
  list-style: none;
  margin: 4px 0 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .08);
}
.suggest[hidden] { display: none; }
.suggest li {
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
}
.suggest li:hover, .suggest li.on { background: var(--sage-tint); }

/* ---------- Result ---------- */
.result {
  border-radius: var(--radius);
  background: var(--sage-tint);
  padding: 12px 14px;
  min-height: 64px;
}
.result .placeholder { margin: 0; color: var(--muted); font-size: 14px; }

.res-head { display: flex; align-items: center; gap: 14px; }
.res-size {
  font-size: 34px;
  font-weight: 600;
  line-height: 1;
  color: var(--sage-dark);
  min-width: 2.2ch;
  flex-shrink: 0;
  white-space: nowrap;
}
.res-label { font-size: 13px; color: var(--muted); }
.res-label b { display: block; color: var(--ink); font-size: 15px; font-weight: 600; }
.res-copy { margin-left: auto; }

.res-compare { margin: 8px 0 0; font-size: 13px; color: var(--muted); border-collapse: collapse; }
.res-compare th { font-weight: 500; color: var(--ink); text-align: left; padding: 1px 12px 1px 0; }
.res-compare td { padding: 1px 10px 1px 0; }
.res-compare td:first-child { color: var(--ink); white-space: nowrap; }

.note {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.4;
  padding: 8px 10px;
  border-left: 3px solid var(--accent);
  background: #fff;
  border-radius: 0 6px 6px 0;
}

.copy-hint { margin: 10px 0 0; font-size: 13px; line-height: 1.4; color: var(--muted); }
.copy-hint b { color: var(--ink); font-weight: 600; }

.copy {
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  border: 0;
  border-radius: var(--radius);
  background: var(--sage);
  color: #fff;
  padding: 10px 14px;
  cursor: pointer;
  white-space: nowrap;
}
.copy:hover { background: var(--sage-dark); }
.copy.done { background: var(--accent); }

.copy-fallback {
  width: 100%;
  margin-top: 8px;
  font: 13px/1.4 var(--font);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  resize: none;
}

/* ---------- Wider screens: illustration beside the form ---------- */
@media (min-width: 720px) {
  .finder {
    grid-template-columns: 1fr 1fr;
    grid-template-areas: "dog form" "dog result";
    align-items: start;
    column-gap: 24px;
  }
  .dog-wrap { grid-area: dog; align-self: center; }
  .dog { max-height: 340px; }
  .form { grid-area: form; }
  .result { grid-area: result; }
}
