:root {
  --bg: radial-gradient(circle at 15% 12%, #1f2924 0%, #111a16 45%, #0b110e 100%);
  --panel: linear-gradient(165deg, #1a241f 0%, #141d19 100%);
  --panel-elevated: #111915;
  --panel-inner: #0f1713;
  --text: #ecf4ef;
  --text-soft: #c9d8cf;
  --muted: #96a99e;
  --line: #2b3b33;
  --line-soft: #33453c;
  --accent: #5ead4c;
  --accent-strong: #4f993f;
  --accent-soft: rgba(94, 173, 76, 0.2);
  --accent-glow: rgba(94, 173, 76, 0.28);
  --cool-glow: rgba(83, 153, 198, 0.24);
  --warn: #e9b26a;
  --warn-soft: rgba(233, 178, 106, 0.14);
  --bad: #ea7e75;
  --bad-soft: rgba(234, 126, 117, 0.16);
  --good: #62d996;
  --good-soft: rgba(98, 217, 150, 0.16);
  --radius: 18px;
  --shadow: 0 18px 36px rgba(0, 0, 0, 0.45);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
}

.wrap {
  max-width: 1280px;
  margin: 0 auto;
  padding: 12px 24px 24px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  font-size: 1.9rem;
  margin-bottom: 8px;
  color: #f4fbf6;
}

.intro {
  color: var(--text-soft);
  margin-bottom: 24px;
  max-width: 760px;
}

.tool-canvas {
  border-radius: 24px;
  padding: 24px;
  background: linear-gradient(160deg, rgba(24, 34, 29, 0.96) 0%, rgba(13, 20, 17, 0.96) 100%);
  border: 1px solid #304239;
  box-shadow:
    0 28px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(94, 173, 76, 0.08) inset,
    0 0 36px rgba(83, 153, 198, 0.08);
}

.tool {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 24px;
  align-items: stretch;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow:
    var(--shadow),
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 -1px 0 rgba(0, 0, 0, 0.38) inset;
  padding: 20px;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(106, 192, 141, 0.035) 0%, transparent 38%);
  pointer-events: none;
}

.field {
  margin-bottom: 18px;
}

label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  color: #eff8f2;
}

select,
input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  font-size: 1rem;
  background: linear-gradient(180deg, #111a15 0%, #0d1511 100%);
  color: var(--text);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
  transition: border-color 150ms ease, box-shadow 180ms ease, background-color 180ms ease;
}

select:hover,
input:hover {
  border-color: #3e5247;
}

select:focus,
input:focus,
button:focus-visible {
  outline: 2px solid rgba(94, 173, 76, 0.4);
  outline-offset: 1px;
}

select:focus,
input:focus {
  border-color: rgba(94, 173, 76, 0.62);
  box-shadow: 0 0 0 3px rgba(94, 173, 76, 0.18), 0 0 18px rgba(83, 153, 198, 0.14);
}

.help {
  margin-top: 6px;
  font-size: 0.92rem;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 180ms ease, border-color 180ms ease, background-color 180ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:active {
  transform: translateY(0);
}

.btn-primary {
  background: linear-gradient(180deg, #6bbb57 0%, var(--accent) 52%, var(--accent-strong) 100%);
  color: #071209;
  box-shadow: 0 9px 18px rgba(73, 146, 59, 0.36), 0 0 0 1px rgba(164, 223, 152, 0.2) inset;
}

.btn-primary:hover {
  box-shadow: 0 12px 24px rgba(73, 146, 59, 0.4), 0 0 0 1px rgba(164, 223, 152, 0.3) inset, 0 0 14px var(--accent-glow);
}

.btn-secondary {
  background: linear-gradient(180deg, #232f29 0%, #1b2520 100%);
  color: var(--text-soft);
  border: 1px solid var(--line-soft);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset;
}

.btn-secondary:hover {
  border-color: #4a6255;
  color: #d9e6de;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.22), 0 0 0 1px rgba(83, 153, 198, 0.16);
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat {
  border: 1px solid #364941;
  border-radius: 14px;
  padding: 14px;
  background: linear-gradient(180deg, rgba(19, 28, 24, 0.94) 0%, rgba(15, 23, 19, 0.94) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

.stat-subtext {
  margin-top: 4px;
  font-size: 0.88rem;
  color: var(--text-soft);
}

.status-pill {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.92rem;
  margin-bottom: 16px;
  background: var(--accent-soft);
  color: #95e884;
  border: 1px solid rgba(94, 173, 76, 0.35);
  box-shadow: 0 0 14px rgba(94, 173, 76, 0.16);
}

.status-good {
  background: var(--good-soft);
  color: var(--good);
  border-color: rgba(98, 217, 150, 0.4);
}

.status-warn {
  background: var(--warn-soft);
  color: var(--warn);
  border-color: rgba(233, 178, 106, 0.34);
}

.status-bad {
  background: var(--bad-soft);
  color: var(--bad);
  border-color: rgba(234, 126, 117, 0.36);
}

.bar-wrap {
  margin: 12px 0 20px;
  padding: 10px 10px 12px;
  border-radius: 14px;
  border: 1px solid #33453c;
  background: linear-gradient(180deg, rgba(15, 23, 19, 0.95) 0%, rgba(10, 16, 13, 0.95) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 24px rgba(0, 0, 0, 0.26);
}

.grow-environment-card {
  min-height: 0;
}

.environment-content {
  min-height: 0;
  overflow-y: auto;
  max-height: 180px;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: #4b6257 transparent;
}

.environment-content::-webkit-scrollbar {
  width: 8px;
}

.environment-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 999px;
}

.environment-content::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #4d6358 0%, #3d4f46 100%);
  border-radius: 999px;
  border: 1px solid rgba(141, 181, 160, 0.08);
}

.environment-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #5a7366 0%, #4a6055 100%);
}

#assessmentText {
  margin: 0 0 16px;
  font-size: 1.03rem;
  color: var(--text-soft);
}

.response-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin: 0 0 20px;
  align-items: start;
}

.leaf-panel,
.risk-panel {
  min-width: 0;
}

.plant-response-card {
  min-height: 0;
}

.plant-response-content {
  margin-top: 14px;
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  max-height: 320px;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: #4b6257 transparent;
}

.plant-response-content::-webkit-scrollbar {
  width: 8px;
}

.plant-response-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 999px;
}

.plant-response-content::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #4d6358 0%, #3d4f46 100%);
  border-radius: 999px;
  border: 1px solid rgba(141, 181, 160, 0.08);
}

.plant-response-content::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, #5a7366 0%, #4a6055 100%);
}

.suggestion-panel .section-title {
  margin-top: 16px;
}

.bar-label-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.bar {
  position: relative;
  height: 16px;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(90deg, #2d6488 0%, #2e774f 50%, #8a423f 100%);
  border: 1px solid #405247;
  box-shadow: 0 2px 0 rgba(255, 255, 255, 0.08) inset, 0 -2px 4px rgba(0, 0, 0, 0.35) inset;
}

.bar::after {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0) 40%);
  pointer-events: none;
}

.bar-target-zone {
  position: absolute;
  top: 1px;
  bottom: 1px;
  left: 0;
  background: linear-gradient(180deg, rgba(114, 198, 92, 0.65) 0%, rgba(91, 161, 74, 0.46) 100%);
  border-radius: 999px;
  z-index: 1;
  box-shadow: 0 0 10px rgba(94, 173, 76, 0.34);
}

.bar-marker {
  position: absolute;
  top: -4px;
  width: 3px;
  height: 24px;
  background: #f2faf4;
  border-radius: 3px;
  transform: translateX(-50%);
  left: 50%;
  z-index: 2;
  box-shadow: 0 0 0 1px rgba(8, 14, 11, 0.55), 0 0 10px rgba(242, 250, 244, 0.3);
}

.leaf-visual-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 14px;
  border: 1px solid #395046;
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 18%, rgba(84, 156, 200, 0.12), transparent 42%),
    linear-gradient(180deg, rgba(18, 27, 23, 0.96) 0%, rgba(13, 20, 17, 0.96) 100%);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 14px 26px rgba(0, 0, 0, 0.26);
  text-align: center;
}

.leaf-visual-label {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
}

.leaf-visual {
  width: 120px;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0;
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.25));
}

.leaf-group {
  transform-origin: 50% 65%;
  transition: transform 220ms ease, opacity 220ms ease, filter 220ms ease;
}

@keyframes leafHealthyBreathe {
  0%,
  100% {
    transform: rotate(0deg) scale(1);
  }

  50% {
    transform: rotate(1deg) scale(1.018);
  }
}

@keyframes leafHumidSway {
  0%,
  100% {
    transform: rotate(0deg) scaleY(1.02);
  }

  50% {
    transform: rotate(2deg) scaleX(0.99) scaleY(1.03);
  }
}

@keyframes leafDryTension {
  0%,
  100% {
    transform: rotate(-4.8deg) scaleX(0.955) scaleY(0.978);
  }

  50% {
    transform: rotate(-6.2deg) scaleX(0.947) scaleY(0.97);
  }
}

@keyframes leafDangerStrain {
  0%,
  100% {
    transform: rotate(-7.8deg) scaleX(0.924) scaleY(0.956);
  }

  50% {
    transform: rotate(-9.6deg) scaleX(0.914) scaleY(0.948);
  }
}

.leaf-shape,
.leaf-vein,
.leaf-tip-burn,
.leaf-overlay {
  transition: fill 220ms ease, stroke 220ms ease, opacity 220ms ease;
}

.leaf-shape {
  fill: #6cab63;
}

.leaf-vein {
  fill: none;
  stroke: rgba(255, 255, 255, 0.75);
  stroke-width: 3;
  stroke-linecap: round;
}

.leaf-tip-burn {
  fill: #9a5b2d;
  opacity: 0;
}

.leaf-overlay {
  opacity: 0;
  pointer-events: none;
}

.overlay-yellowing path {
  fill: rgba(215, 204, 103, 0.5);
}

.overlay-edge-burn path {
  fill: rgba(136, 80, 44, 0.38);
}

.overlay-rust-spots circle {
  fill: rgba(151, 74, 31, 0.58);
}

.overlay-interveinal path {
  fill: rgba(223, 216, 116, 0.44);
}

.leaf-show-yellowing .overlay-yellowing {
  opacity: 1;
}

.leaf-show-edge-burn .overlay-edge-burn {
  opacity: 1;
}

.leaf-show-rust-spots .overlay-rust-spots {
  opacity: 1;
}

.leaf-show-interveinal .overlay-interveinal {
  opacity: 1;
}

.leaf-visual-text {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-soft);
}

.leaf-state-healthy .leaf-shape {
  fill: #6cab63;
}

.leaf-state-healthy .leaf-group {
  transform: rotate(0deg) scale(1);
  animation: leafHealthyBreathe 6.6s ease-in-out infinite;
}

.leaf-state-humid .leaf-shape {
  fill: #4f8f4f;
}

.leaf-state-humid .leaf-group {
  transform: rotate(0deg) scaleY(1.02);
  opacity: 0.95;
  animation: leafHumidSway 7.8s ease-in-out infinite;
}

.leaf-state-dry .leaf-shape {
  fill: #9cc56f;
}

.leaf-state-dry .leaf-group {
  transform: rotate(-4.8deg) scaleX(0.955) scaleY(0.978);
  animation: leafDryTension 4.8s ease-in-out infinite;
}

.leaf-state-dry .leaf-tip-burn {
  opacity: 0.35;
}

.leaf-state-danger .leaf-shape {
  fill: #b7c56d;
}

.leaf-state-danger .leaf-group {
  transform: rotate(-7.8deg) scaleX(0.924) scaleY(0.956);
  filter: saturate(0.9);
  animation: leafDangerStrain 4.2s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .leaf-state-healthy .leaf-group,
  .leaf-state-humid .leaf-group,
  .leaf-state-dry .leaf-group,
  .leaf-state-danger .leaf-group {
    animation: none;
  }

  button,
  select,
  input {
    transition: none;
  }
}

.leaf-state-danger .leaf-tip-burn {
  opacity: 0.7;
}

.section-title {
  font-size: 1rem;
  margin: 18px 0 8px;
  color: var(--text);
}

.response-title {
  margin-top: 0;
}

.risk-panel ul {
  margin-top: 8px;
}

ul {
  margin: 8px 0 0 18px;
  padding: 0;
  color: var(--text-soft);
}

.small {
  font-size: 0.92rem;
  color: var(--muted);
}

@media (max-width: 820px) {
  .tool-canvas {
    padding: 16px;
  }

  .tool {
    grid-template-columns: 1fr;
  }

  .response-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .plant-response-content {
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }

  .environment-content {
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }
}
