:root {
  --bg: #eef2ee;
  --paper: #f8f8f4;
  --ink: #122229;
  --muted: #5f6d73;
  --line: #d7dfda;
  --brand: #0d6c78;
  --brand-dark: #0a4f58;
  --accent: #f1b544;
  --warn: #d65d43;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 20% 10%, #d8ece5, #dbe6df 45%, #c8d8d0);
  color: var(--ink);
  font-family: "Segoe UI", Tahoma, Verdana, sans-serif;
}

button {
  border: 0;
  font: inherit;
}

.app-shell {
  width: min(100vw, 430px);
  min-height: 100vh;
  background: var(--paper);
  position: relative;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(16, 34, 41, .2);
}

.screen {
  display: none;
  min-height: 100vh;
  overflow-y: auto;
  padding: 18px 16px 94px;
}

.screen.active {
  display: block;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.eyebrow {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--brand-dark);
}

.main-brand {
  margin-bottom: 0;
  font-size: 30px;
  line-height: 1.05;
}

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

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.1;
}

h2 {
  font-size: 22px;
  margin-bottom: 10px;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--brand-dark);
  background: #fff;
  border: 1px solid var(--line);
}

.hero {
  border-radius: 8px;
  padding: 16px;
  color: #fff;
  background: linear-gradient(140deg, #0b4550 0%, #0f7d8c 55%, #35a2aa 100%);
}

.hero p {
  line-height: 1.45;
  margin-bottom: 14px;
  color: rgba(255, 255, 255, .9);
}

.primary-btn {
  min-height: 44px;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
  color: #2b1f08;
  background: var(--accent);
}

.panel {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips span {
  border-radius: 999px;
  border: 1px solid #bde0d7;
  background: #ebfaf5;
  color: #0c5f69;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
}

.chip-btn {
  border-radius: 999px;
  border: 1px solid #bde0d7;
  background: #ebfaf5;
  color: #0c5f69;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.chip-btn.active {
  background: #0f6f7b;
  border-color: #0f6f7b;
  color: #fff;
}

.conservation-intent p {
  color: var(--muted);
  line-height: 1.45;
}

.conservation-intent #conservation-map {
  width: 100%;
  height: 240px;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: block;
}

#conservation-map-info {
  margin-top: 8px;
  font-size: 13px;
}

.catalog-intent p {
  color: var(--muted);
  line-height: 1.45;
}

.setup-intent p {
  color: var(--muted);
  line-height: 1.45;
}

.setup-grid {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.setup-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.setup-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  object-position: center;
  display: block;
}

.setup-body {
  padding: 10px;
}

.setup-tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 8px;
  border: 1px solid #bde0d7;
  background: #ebfaf5;
  color: #0c5f69;
  font-size: 11px;
  font-weight: 700;
}

.setup-body h4 {
  margin: 8px 0 6px;
  font-size: 18px;
  line-height: 1.25;
}

.setup-body p {
  margin: 0 0 8px;
}

.health-intent p {
  color: var(--muted);
  line-height: 1.45;
}

.health-grid {
  margin-top: 10px;
  display: grid;
  gap: 8px;
}

.health-grid article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.health-grid h4 {
  margin: 0 0 6px;
  font-size: 15px;
}

.list.compact li {
  margin-bottom: 5px;
  font-size: 13px;
}

.catalog-products {
  margin-top: 10px;
  display: grid;
  gap: 10px;
}

.product-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  display: grid;
  grid-template-rows: auto 1fr;
}

.product-card img {
  width: 100%;
  height: 190px;
  object-fit: cover;
  object-position: center;
  display: block;
}

.product-body {
  padding: 10px;
}

.product-body h4 {
  margin: 0 0 4px;
  font-size: 16px;
  line-height: 1.25;
}

.product-meta {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
}

.product-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.product-tags span {
  font-size: 11px;
  font-weight: 700;
  color: #0c5f69;
  border: 1px solid #bde0d7;
  border-radius: 999px;
  padding: 3px 8px;
  background: #ebfaf5;
}

.list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.list li {
  line-height: 1.45;
  margin-bottom: 8px;
}

.segmented {
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  background: #fff;
}

.segmented button {
  min-height: 36px;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.segmented button.active {
  background: var(--brand);
  color: #fff;
}

.stack {
  display: grid;
  gap: 10px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  cursor: pointer;
}

.card p {
  color: var(--muted);
  line-height: 1.45;
}

.card small {
  color: var(--brand-dark);
  font-weight: 700;
}

.card:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

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

.tile {
  min-height: 54px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f7faf8;
  color: var(--ink);
  font-weight: 700;
  padding: 8px;
  text-align: left;
}

.tool-btn.active {
  border-color: #89bdb0;
  background: #eaf6f1;
  color: #0b5e68;
}

.tool-fragment {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.tool-fragment h4 {
  margin: 0 0 8px;
  font-size: 16px;
}

.tool-form {
  display: grid;
  gap: 8px;
}

.tool-form label {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}

.tool-form input,
.tool-form select {
  width: 100%;
  min-height: 38px;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 0 10px;
  font: inherit;
  background: #fff;
}

.tool-form button {
  min-height: 40px;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.tool-result {
  margin: 8px 0 0;
  color: var(--brand-dark);
  font-size: 14px;
  font-weight: 800;
}

.tool-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.tool-graph {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fbfdfc, #eef6f2);
  padding: 8px;
}

.tool-graph svg {
  width: 100%;
  height: auto;
  display: block;
}

.tool-graph-caption {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.tool-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.tool-status.safe {
  background: #e8f7ef;
  color: #17633e;
}

.tool-status.dense {
  background: #fff1d8;
  color: #8a5a05;
}

.tool-status.over {
  background: #ffe6e0;
  color: #a23524;
}

.tool-subfragment {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  padding: 10px;
}

.tool-subfragment h5 {
  margin: 0 0 8px;
  font-size: 14px;
}

.tool-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.tool-table th,
.tool-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.tool-table th {
  color: var(--brand-dark);
}

.tool-chart-stack {
  display: grid;
  gap: 10px;
}

.species-tile.active {
  border-color: #89bdb0;
  background: #eaf6f1;
  color: #0b5e68;
}

.species-fragment {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.species-fragment img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}

.species-fragment > div {
  padding: 12px;
}

.species-fragment p {
  color: var(--muted);
  line-height: 1.45;
}

.species-fragment ul {
  margin: 0;
  padding-left: 18px;
}

.species-fragment li {
  margin-bottom: 7px;
  line-height: 1.4;
  color: var(--ink);
}

.quiz-panel .quiz-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.quiz-step {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--brand-dark);
}

.quiz-answers {
  display: grid;
  gap: 8px;
}

.quiz-answers button {
  min-height: 50px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f6f8f7;
  text-align: left;
  padding: 10px;
  color: var(--ink);
  font-weight: 700;
}

.quiz-answers button.correct {
  border-color: #59a084;
  background: #e9f8f0;
}

.quiz-answers button.wrong {
  border-color: var(--warn);
  background: #ffebe5;
}

.quiz-feedback {
  min-height: 24px;
  margin-top: 10px;
  font-weight: 800;
  color: var(--brand-dark);
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
  padding: 10px 6px;
}

.stats strong {
  display: block;
  font-size: 21px;
}

.stats span {
  color: var(--muted);
  font-size: 12px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(calc(100vw - 16px), 414px);
  bottom: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 5px;
  background: rgba(255, 255, 255, .97);
  z-index: 30;
}

.bottom-nav button {
  min-height: 52px;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.bottom-nav button.active {
  background: #0f3a45;
  color: #fff;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(16, 34, 41, .45);
  display: grid;
  align-items: end;
}

.modal[hidden] {
  display: none;
}

.modal-card {
  max-height: 80vh;
  overflow: auto;
  border-radius: 8px 8px 0 0;
  background: var(--paper);
  padding: 14px;
}

.modal-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.modal-card p {
  line-height: 1.45;
  color: var(--muted);
}

.modal-card ul {
  margin: 0;
  padding-left: 18px;
}

.modal-card li {
  margin-bottom: 8px;
  line-height: 1.4;
}

@media (min-width: 520px) {
  body {
    padding: 24px;
  }

  .app-shell {
    min-height: 860px;
    border-radius: 22px;
  }
}
