:root {
  --bg0: #f3efe6;
  --bg1: #e7f0ea;
  --ink: #14201a;
  --muted: #5a6b62;
  --line: rgba(20, 32, 26, 0.12);
  --card: rgba(255, 255, 255, 0.72);
  --accent: #0f7a5a;
  --accent2: #d97706;
  --danger: #b42318;
  --ok: #027a48;
  --shadow: 0 18px 50px rgba(20, 32, 26, 0.08);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(1100px 500px at 10% -10%, #d8efe4 0%, transparent 55%),
    radial-gradient(900px 420px at 100% 0%, #f6e2c4 0%, transparent 50%),
    linear-gradient(165deg, var(--bg0), var(--bg1));
  background-attachment: fixed;
}

.app {
  width: min(760px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.4rem 0 3.5rem;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 0.7rem;
  margin-bottom: 0.35rem;
  animation: rise 0.6s ease both;
}
.brand strong {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.8rem, 4vw, 2.35rem);
  letter-spacing: -0.03em;
}
.brand span {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: rgba(15, 122, 90, 0.1);
  border: 1px solid rgba(15, 122, 90, 0.2);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
}

.lede {
  margin: 0 0 1.6rem;
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 38rem;
  line-height: 1.5;
  animation: rise 0.7s ease both;
}

.panel {
  background: var(--card);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  animation: rise 0.8s ease both;
}

label.field-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.45rem;
}

textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 0.9rem 1rem;
  font: inherit;
  color: var(--ink);
  background: #fff;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
textarea:focus {
  border-color: rgba(15, 122, 90, 0.55);
  box-shadow: 0 0 0 4px rgba(15, 122, 90, 0.12);
}

.qualities {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.55rem;
  margin: 1rem 0 1.1rem;
}
@media (max-width: 640px) {
  .qualities { grid-template-columns: repeat(2, 1fr); }
}

.q {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 0.75rem 0.65rem;
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s ease, border-color 0.15s, box-shadow 0.15s;
}
.q:hover { transform: translateY(-1px); }
.q.active {
  border-color: rgba(15, 122, 90, 0.65);
  box-shadow: inset 0 0 0 1px rgba(15, 122, 90, 0.35), 0 8px 20px rgba(15, 122, 90, 0.08);
  background: #f3fbf7;
}
.q b { display: block; font-size: 0.92rem; }
.q small { color: var(--muted); font-size: 0.72rem; line-height: 1.3; }

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
button {
  font: inherit;
  font-weight: 700;
  border: 0;
  border-radius: 999px;
  padding: 0.78rem 1.2rem;
  cursor: pointer;
  transition: transform 0.15s ease, opacity 0.15s;
}
button:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
button:not(:disabled):hover { transform: translateY(-1px); }
.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 24px rgba(15, 122, 90, 0.25);
}
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.status {
  margin-top: 1rem;
  min-height: 1.25rem;
  font-size: 0.92rem;
  color: var(--muted);
}
.status.err { color: var(--danger); }
.status.ok { color: var(--ok); }

.result {
  display: none;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--line);
  gap: 1rem;
  align-items: center;
}
.result.show { display: grid; grid-template-columns: 96px 1fr; }
.result img {
  width: 96px;
  height: 128px;
  object-fit: cover;
  border-radius: 12px;
  background: #ddd;
}
.result h2 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 0.35rem;
  line-height: 1.25;
}
.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.4rem 0 0.8rem;
}
.chip {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.7);
}
.chip.good {
  color: var(--ok);
  border-color: rgba(2, 122, 72, 0.25);
  background: rgba(2, 122, 72, 0.08);
}
.chip.warn {
  color: #b54708;
  border-color: rgba(217, 119, 6, 0.3);
  background: rgba(217, 119, 6, 0.1);
}

.foot {
  margin-top: 1.4rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
  animation: rise 0.9s ease both;
}
.foot code {
  font-size: 0.78em;
  background: rgba(20,32,26,0.06);
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
}

.spinner {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid rgba(15,122,90,0.25);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
  margin-right: 0.35rem;
}

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
