:root {
  --cream: #FFF8EC;
  --paper: #FFFFFF;
  --ink: #1F3A2B;
  --muted: #4E6556;
  --green: #2E7D4F;
  --green-dark: #1F5C38;
  --leaf: #DFF1E1;
  --sky: #D6EEF8;
  --sun: #FFC94A;
  --sun-soft: #FFF0C2;
  --clay: #B4452A;
  --clay-soft: #FBE3DB;
  --line: #E3DCCB;
  --radius: 18px;
  --shadow: 0 4px 14px rgba(31, 58, 43, .10);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--cream);
  color: var(--ink);
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 18px;
  line-height: 1.6;
}

h1, h2, h3 {
  font-family: "Fredoka", "Nunito", system-ui, sans-serif;
  font-weight: 600;
  line-height: 1.2;
  margin: 0 0 .5em;
}
h1 { font-size: clamp(2rem, 6vw, 3.2rem); }
h2 { font-size: clamp(1.5rem, 4vw, 2.1rem); }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
a { color: var(--green-dark); }
a:hover { color: var(--clay); }

:focus-visible { outline: 3px solid #1B6FD8; outline-offset: 2px; border-radius: 6px; }

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; left: -999px; top: 0; background: var(--ink); color: #fff; padding: 8px 14px; z-index: 99; }
.skip:focus { left: 8px; top: 8px; }

/* ---------- header ---------- */
.site-header { background: var(--paper); border-bottom: 3px solid var(--leaf); position: sticky; top: 0; z-index: 20; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding-top: 8px; padding-bottom: 8px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 1.35rem; }
.brand svg { width: 42px; height: 42px; }
nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
nav a { display: block; padding: 8px 14px; border-radius: 999px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: .98rem; }
nav a:hover { background: var(--leaf); color: var(--ink); }
nav a[aria-current="page"] { background: var(--green); color: #fff; }

/* ---------- hero ---------- */
.hero { background: linear-gradient(180deg, var(--sky) 0%, var(--cream) 100%); padding: 44px 0 36px; text-align: center; }
.hero p.lead { font-size: 1.25rem; max-width: 640px; margin: 0 auto 1.2em; color: var(--muted); }
.page-hero { background: var(--leaf); padding: 30px 0 22px; }
.page-hero p { max-width: 720px; color: var(--muted); font-size: 1.1rem; margin-bottom: 0; }

.btn { display: inline-block; background: var(--green); color: #fff; text-decoration: none; padding: 12px 22px; border-radius: 999px; font-weight: 800; border: 0; cursor: pointer; font-size: 1rem; font-family: inherit; box-shadow: var(--shadow); }
.btn:hover { background: var(--green-dark); color: #fff; }
.btn.alt { background: var(--sun); color: var(--ink); }
.btn.alt:hover { background: #F2B72D; color: var(--ink); }
.btn.ghost { background: transparent; color: var(--green-dark); border: 2px solid var(--green); box-shadow: none; }
.btn.ghost:hover { background: var(--leaf); color: var(--green-dark); }
.btn-row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- layout blocks ---------- */
section.block { padding: 36px 0; }
.grid { display: grid; gap: 18px; }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

.card { background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card h3 { margin-bottom: .3em; }
.card .icon { font-size: 2.2rem; line-height: 1; display: block; margin-bottom: 8px; }
.card.link { text-decoration: none; color: inherit; display: block; transition: transform .15s; }
.card.link:hover { transform: translateY(-3px); border-color: var(--green); }

.callout { border-radius: var(--radius); padding: 16px 20px; margin: 18px 0; border: 2px solid; }
.callout.safety { background: var(--sun-soft); border-color: var(--sun); }
.callout.expert { background: var(--sky); border-color: #8CC7E3; }
.callout.warn { background: var(--clay-soft); border-color: #E7A593; }
.callout p:last-child { margin-bottom: 0; }

.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; }
.steps li { counter-increment: s; position: relative; padding: 4px 0 14px 54px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 0; width: 38px; height: 38px; border-radius: 50%; background: var(--green); color: #fff; font-family: "Fredoka", sans-serif; font-weight: 600; display: grid; place-items: center; }

.badge { display: inline-block; padding: 2px 12px; border-radius: 999px; font-size: .82rem; font-weight: 800; }
.badge.native { background: var(--leaf); color: var(--green-dark); border: 2px solid #9FD2A8; }
.badge.invasive { background: var(--clay-soft); color: var(--clay); border: 2px solid #E7A593; }
.badge.habitat { background: var(--sky); color: #1E5670; border: 2px solid #8CC7E3; }

details { background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius); padding: 4px 20px; margin-bottom: 12px; box-shadow: var(--shadow); }
details[open] { border-color: var(--green); }
summary { cursor: pointer; font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 1.25rem; padding: 12px 0; }

table { border-collapse: collapse; width: 100%; background: var(--paper); border-radius: 12px; overflow: hidden; }
th, td { border: 1px solid var(--line); padding: 8px 10px; text-align: left; }
th { background: var(--leaf); }

/* ---------- plants ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; align-items: center; }
.chip { background: var(--paper); border: 2px solid var(--line); border-radius: 999px; padding: 6px 16px; font-weight: 800; font-family: inherit; font-size: .95rem; cursor: pointer; color: var(--ink); }
.chip[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: #fff; }
.search { flex: 1 1 200px; padding: 9px 16px; border: 2px solid var(--line); border-radius: 999px; font-size: 1rem; font-family: inherit; min-width: 180px; }
.plant-card { background: var(--paper); border: 2px solid var(--line); border-radius: var(--radius); padding: 14px; text-align: center; box-shadow: var(--shadow); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.plant-card.invasive { border-color: #E7A593; }
.plant-card.native { border-color: #9FD2A8; }
.plant-card h3 { margin: 4px 0 0; font-size: 1.15rem; }
.plant-card .sci { font-style: italic; color: var(--muted); font-size: .9rem; margin: 0; }
.plant-card .fact { font-size: .95rem; margin: 6px 0 0; }
.plant-card .warnline { font-size: .88rem; background: var(--clay-soft); color: var(--clay); border-radius: 8px; padding: 4px 8px; font-weight: 700; margin-top: 6px; }
.plant-card .badges { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.plant-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.plant-svg, .plant-photo { border-radius: 14px; background: linear-gradient(180deg, #EAF6FB, #F6FBEF); }
.plant-photo { object-fit: cover; }
.count { color: var(--muted); font-weight: 700; margin-bottom: 8px; }

/* ---------- map ---------- */
#map { height: 440px; border-radius: var(--radius); border: 3px solid var(--line); background: var(--sky); z-index: 1; }
.map-note { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 12px 0; }
.pin-form { display: none; gap: 8px; flex-wrap: wrap; align-items: center; background: var(--sun-soft); border: 2px solid var(--sun); border-radius: var(--radius); padding: 12px; margin-top: 12px; }
.pin-form.show { display: flex; }
.pin-form input { flex: 1 1 220px; padding: 9px 14px; border: 2px solid var(--line); border-radius: 999px; font-size: 1rem; font-family: inherit; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { margin-bottom: 8px; }
.checklist label { display: flex; gap: 12px; align-items: flex-start; background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; cursor: pointer; }
.checklist input { width: 22px; height: 22px; margin-top: 3px; accent-color: var(--green); flex: none; }
.checklist input:checked + span { text-decoration: line-through; color: var(--muted); }

/* ---------- games ---------- */
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.tab { font-family: "Fredoka", sans-serif; font-weight: 600; font-size: 1.1rem; padding: 10px 22px; border-radius: 999px; border: 2px solid var(--green); background: var(--paper); color: var(--green-dark); cursor: pointer; }
.tab[aria-selected="true"] { background: var(--green); color: #fff; }
.game { background: var(--paper); border: 3px solid var(--line); border-radius: 24px; padding: 22px; box-shadow: var(--shadow); min-height: 360px; }
.game[hidden] { display: none; }
.game-top { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px; font-weight: 800; color: var(--muted); margin-bottom: 12px; }
.progress { height: 10px; background: var(--leaf); border-radius: 99px; overflow: hidden; margin-bottom: 18px; }
.progress > div { height: 100%; background: var(--green); width: 0; transition: width .3s; }
.q-pic { text-align: center; margin-bottom: 10px; }
.q-pic svg, .q-pic img { width: 140px; height: 140px; }
.q-text { font-family: "Fredoka", sans-serif; font-size: 1.4rem; font-weight: 500; margin-bottom: 14px; }
.options { display: grid; gap: 10px; }
.opt { text-align: left; font-family: inherit; font-size: 1.05rem; font-weight: 700; padding: 12px 16px; border-radius: 14px; border: 2px solid var(--line); background: var(--cream); color: var(--ink); cursor: pointer; }
.opt:hover:not(:disabled) { border-color: var(--green); background: var(--leaf); }
.opt.right { background: #CDEFD3; border-color: var(--green); }
.opt.wrong { background: var(--clay-soft); border-color: var(--clay); }
.opt:disabled { cursor: default; }
.two-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.two-btns .opt { text-align: center; font-size: 1.2rem; padding: 16px; }
.feedback { min-height: 3.4em; margin: 14px 0; padding: 10px 14px; border-radius: 12px; background: var(--sun-soft); display: none; }
.feedback.show { display: block; }
.feedback.good { background: #E1F5E4; }
.feedback.bad { background: var(--clay-soft); }
.final { text-align: center; padding: 20px 0; }
.final .big { font-family: "Fredoka", sans-serif; font-size: 3rem; color: var(--green); margin: 0; }

.sort-bins { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; margin: 14px 0; }
.bin { border: 3px dashed #8CC7E3; background: var(--sky); border-radius: var(--radius); padding: 10px; min-height: 130px; cursor: pointer; }
.bin h3 { font-size: 1.05rem; margin-bottom: 6px; text-align: center; }
.bin.over { background: #BFE3F3; border-style: solid; }
.bin .placed { display: flex; flex-wrap: wrap; gap: 6px; }
.sort-pool { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px; border-radius: var(--radius); background: var(--cream); border: 2px solid var(--line); min-height: 100px; }
.sort-card { background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 6px 10px; display: flex; align-items: center; gap: 8px; cursor: grab; font-weight: 800; font-size: .95rem; font-family: inherit; color: var(--ink); }
.sort-card svg { width: 42px; height: 42px; flex: none; }
.sort-card.sel { border-color: #1B6FD8; box-shadow: 0 0 0 3px #BBD6F8; }
.sort-card.ok { background: #CDEFD3; border-color: var(--green); cursor: default; padding: 4px 8px; font-size: .85rem; }
.sort-card.ok svg { width: 28px; height: 28px; }
.sort-card.shake { animation: shake .35s; border-color: var(--clay); }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }

/* ---------- footer ---------- */
.site-footer { background: var(--ink); color: #E6F0E9; padding: 28px 0; margin-top: 40px; font-size: .95rem; }
.site-footer a { color: #BFE8C8; }
.site-footer p { margin-bottom: .6em; }
.sources { font-size: .92rem; color: var(--muted); }
.sources li { margin-bottom: 4px; }

@media (max-width: 600px) {
  body { font-size: 17px; }
  #map { height: 340px; }
  .game { padding: 14px; }
  nav a { padding: 7px 11px; }
}

/* make the hidden attribute always win, even on buttons */
[hidden] { display: none !important; }

/* ---------- fire map ---------- */
.fire-controls { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; margin: 0 0 10px; background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 8px 14px; }
.fire-controls label { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; cursor: pointer; }
.fire-controls .btn { margin-left: auto; }
.dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; border: 2px solid; }
.dot-active { background: #FF7A1A; border-color: #FF3B1F; }
.dot-recent { background: #E8A33A; border-color: #FFD23F; }
.dot-old { background: #B070D0; border-color: #E9A8FF; }
.fire-status { font-size: .95rem; border-radius: 12px; padding: 8px 12px; background: var(--leaf); margin: 10px 0; }
.fire-status.warn { background: var(--sun-soft); }
.flame-icon { background: none; border: 0; }
.flame-icon svg { display: block; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .5)); }
.flame-icon.pulse svg { animation: flame-pulse 1.1s ease-in-out infinite alternate; transform-origin: 50% 100%; }
@keyframes flame-pulse { from { transform: scale(1); } to { transform: scale(1.14); } }
.fire-panel { position: relative; background: var(--paper); border: 3px solid #F0A06A; border-radius: var(--radius); padding: 18px 20px; margin: 16px 0; box-shadow: var(--shadow); scroll-margin-top: 80px; }
.fire-panel h3 { margin-top: .8em; }
.fire-panel > h3:first-of-type { margin-top: 0; }
.fire-close { position: absolute; top: 12px; right: 12px; }
.fire-kind { display: inline-block; font-weight: 800; font-size: .85rem; padding: 2px 12px; border-radius: 99px; margin: 0 0 6px; }
.fire-kind-active { background: #FFD9CC; color: #8E2A12; }
.fire-kind-old { background: #F0DDF8; color: #5A2A75; }
.fire-facts { display: flex; flex-wrap: wrap; gap: 4px 18px; margin: 0 0 8px; }
.fire-safety { background: var(--sun-soft); border-radius: 12px; padding: 8px 12px; font-size: .95rem; }
.muted-note { color: var(--muted); font-size: .92rem; }
.fire-habs { display: grid; grid-template-columns: 1fr; gap: 10px; }
@media (min-width: 760px) { .fire-habs { grid-template-columns: 1fr 1fr; } }
.fire-hab { background: var(--clay-soft); border-radius: 14px; padding: 10px 14px; }
.fire-hab h4 { margin: 0 0 4px; }
.fire-hab p { margin: 0; font-size: .95rem; }
.animal-grid { display: grid; grid-template-columns: 1fr; gap: 12px; margin: 10px 0 16px; }
@media (min-width: 760px) { .animal-grid { grid-template-columns: 1fr 1fr; } }
.animal-card { display: grid; grid-template-columns: 96px 1fr; gap: 12px; background: var(--cream); border: 2px solid var(--line); border-radius: 16px; padding: 12px; }
.animal-pic svg, .animal-pic img { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; display: block; }
.animal-body h4 { margin: 0; font-size: 1.15rem; }
.animal-body p { margin: 4px 0; font-size: .93rem; }
.animal-body .sci { font-style: italic; color: var(--muted); margin-top: 0; }
.animal-body .status { display: inline-block; background: #FFD9CC; color: #8E2A12; font-weight: 800; font-size: .78rem; padding: 1px 10px; border-radius: 99px; }
.animal-body .fire-effect { background: var(--clay-soft); border-radius: 10px; padding: 6px 10px; }
@media (max-width: 480px) { .animal-card { grid-template-columns: 72px 1fr; } .animal-pic svg, .animal-pic img { width: 72px; height: 72px; } }
.btn.small { padding: 6px 14px; font-size: .9rem; }

/* Fire map: key, burn scars, home pin, "biggest fires" list */
.fire-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 18px; padding: 0; margin: 0 0 10px; font-size: .95rem; }
.fire-legend li { display: inline-flex; align-items: center; gap: 6px; }
.fire-legend .lg-note { color: var(--muted); font-style: italic; }
.lg { width: 16px; height: 16px; display: inline-block; flex: none; border: 2px solid; }
.lg-flame { background: #FF7A1A; border-color: #FF3B1F; border-radius: 50% 0 50% 50%; transform: rotate(-45deg); }
.lg-old { background: #B070D0; border-color: #E9A8FF; border-radius: 50% 0 50% 50%; transform: rotate(-45deg); }
.lg-scar { background: #8B5A2B; border-color: #5C3A1A; border-radius: 45% 55% 40% 60%; box-shadow: inset 0 -5px 0 -2px #7CD45B; }
.lg-home { background: #E2574C; border-color: #8E2A12; border-radius: 2px; clip-path: polygon(50% 0, 100% 40%, 100% 100%, 0 100%, 0 40%); }
.scar-icon, .home-icon { background: none; border: 0; }
.scar-icon svg, .home-icon svg { display: block; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .5)); }
.leaflet-tooltip.home-label { font-weight: 800; color: var(--green-dark); border: 2px solid var(--green); }
.fire-top { background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 12px 16px; margin: 10px 0 14px; }
.fire-top h3 { margin: 0 0 2px; }
.fire-top .muted-note { margin: 0 0 8px; }
.fire-top-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.fire-top-btn { width: 100%; display: flex; align-items: center; gap: 12px; text-align: left; font-family: inherit; font-size: 1rem; color: var(--ink); background: var(--cream); border: 2px solid var(--line); border-radius: 12px; padding: 8px 12px; cursor: pointer; }
.fire-top-btn:hover, .fire-top-btn:focus-visible { border-color: var(--green); background: var(--leaf); }
.ftb-icon { width: 22px; height: 22px; flex: none; border: 2px solid; }
.ftb-icon.ftb-active { background: #FF7A1A; border-color: #FF3B1F; border-radius: 50% 0 50% 50%; transform: rotate(-45deg); }
.ftb-icon.ftb-recent { background: #8B5A2B; border-color: #5C3A1A; border-radius: 45% 55% 40% 60%; }
.ftb-text { display: flex; flex-direction: column; }
.ftb-sub { font-size: .9rem; color: var(--muted); }
.ftb-new { display: inline-block; background: #FF7A1A; color: #fff; font-size: .75rem; font-weight: 800; border-radius: 999px; padding: 1px 8px; margin-left: 4px; vertical-align: middle; }
.fire-kind-recent { background: #EAD7C3; color: #5C3A1A; }
