:root {
  color-scheme: light;
  --ink: #20332c;
  --muted: #52645d;
  --green: #275d43;
  --green-dark: #1c4733;
  --leaf: #dcebdc;
  --coral: #ef805f;
  --cream: #fffdf7;
  --line: #d9e2d8;
  --error: #8f2d25;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background-color: #f4f8ee;
  background-image: radial-gradient(#dce8d3 0.8px, transparent 0.8px);
  background-size: 19px 19px;
}

button,
input {
  font: inherit;
}

.page-shell {
  width: min(100% - 32px, 980px);
  margin-inline: auto;
}

.site-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.wordmark {
  color: var(--green-dark);
  font-size: 1.18rem;
  font-weight: 800;
  text-decoration-thickness: 2px;
  text-underline-offset: 4px;
}

.header-note {
  color: var(--muted);
  font-size: 0.82rem;
  text-align: right;
}

.intro {
  max-width: 680px;
  padding-block: 42px 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #a94e37;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 620px;
  margin-bottom: 14px;
  color: var(--green-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2.2rem, 8vw, 4.5rem);
  font-weight: 600;
  line-height: 0.98;
}

.intro-copy {
  max-width: 550px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.55;
}

.match-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.upload-panel,
.result-panel {
  min-width: 0;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--cream);
  box-shadow: 0 10px 26px rgb(33 59 44 / 7%);
}

.field-label {
  display: block;
  margin-bottom: 9px;
  font-weight: 800;
}

input[type="file"] {
  width: 100%;
  min-height: 48px;
  padding: 8px;
  border: 1px dashed #94ab96;
  border-radius: 6px;
  background: #f7faf3;
  color: var(--ink);
}

input[type="file"]::file-selector-button {
  min-height: 32px;
  margin-right: 10px;
  padding: 6px 10px;
  border: 0;
  border-radius: 4px;
  color: #fff;
  background: var(--green);
  cursor: pointer;
}

.help-text,
.privacy-note,
.disclaimer,
.site-footer {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.5;
}

.help-text {
  margin: 9px 0 18px;
}

button[type="submit"] {
  width: 100%;
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border: 0;
  border-radius: 6px;
  color: #fff;
  background: var(--green);
  font-weight: 800;
  cursor: pointer;
  transition: background-color 140ms ease, transform 140ms ease;
}

button[type="submit"]:hover:not(:disabled) {
  background: var(--green-dark);
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--coral);
  outline-offset: 3px;
}

.button-arrow {
  font-size: 1.3rem;
}

.privacy-note {
  margin: 14px 0 0;
}

.loading-message {
  margin: 15px 0 0;
  color: var(--green-dark);
  font-weight: 700;
}

.error-message {
  margin-top: 14px;
  padding: 12px;
  border-left: 4px solid var(--error);
  border-radius: 4px;
  color: var(--error);
  background: #fff0ed;
  line-height: 1.45;
}

.result-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
}

.result-panel[hidden] {
  display: none;
}

.result-copy h2 {
  margin-bottom: 8px;
  color: var(--green-dark);
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
}

.breed-name {
  margin-bottom: 18px;
  font-size: 1.2rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.score-label {
  margin-bottom: 3px;
  color: var(--muted);
  font-size: 0.9rem;
}

.similarity-score {
  margin-bottom: 12px;
  color: #a94e37;
  font-size: 2.1rem;
  font-weight: 900;
}

.disclaimer {
  margin-bottom: 0;
}

.reference-figure {
  min-width: 0;
  margin: 0;
}

.reference-figure img {
  display: block;
  width: 100%;
  max-height: 360px;
  aspect-ratio: 4 / 3;
  object-fit: contain;
  border-radius: 5px;
  background: #edf2e9;
}

#reference-images {
  display: grid;
  gap: 10px;
}

.reference-figure figcaption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.82rem;
}

.site-footer {
  margin: 26px 0 36px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

@media (min-width: 700px) {
  .intro {
    padding-top: 58px;
  }

  .match-layout {
    grid-template-columns: minmax(290px, 0.78fr) minmax(0, 1.22fr);
    gap: 22px;
  }

  .upload-panel,
  .result-panel {
    padding: 26px;
  }

  .result-panel {
    grid-template-columns: minmax(0, 0.9fr) minmax(180px, 1.1fr);
    align-items: center;
  }
}
