:root {
  color-scheme: light;
  --ink: #19221f;
  --muted: #5d6b65;
  --line: #d9e2dc;
  --paper: #f8faf7;
  --panel: #ffffff;
  --leaf: #2f7d59;
  --river: #2077a1;
  --sun: #d99a20;
  --heat: #b6513b;
  --shadow: 0 16px 48px rgba(32, 42, 38, 0.13);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
}

.skip-link {
  position: fixed;
  left: 12px;
  top: 12px;
  z-index: 10000;
  transform: translateY(-160%);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--ink);
  color: white;
  font-weight: 800;
}

.skip-link:focus {
  transform: translateY(0);
}

:where(a, button, input, textarea, select, summary, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 3px solid #f0b429;
  outline-offset: 3px;
}

button,
textarea,
input {
  font: inherit;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 22px clamp(18px, 4vw, 44px);
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.9);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(12px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--river);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 3vw, 2.7rem);
  line-height: 1.03;
}

h2 {
  margin-bottom: 5px;
  font-size: 1.2rem;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.top-actions a,
.map-tools button,
.participant-form button,
.recover-form button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 13px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.top-actions a:last-child,
.map-tools button:first-child,
.participant-form button,
.recover-form button {
  border-color: var(--leaf);
  background: var(--leaf);
  color: white;
}

.layout {
  display: grid;
  grid-template-columns: minmax(360px, 46vw) minmax(0, 1fr);
  min-height: calc(100vh - 112px);
}

.map-panel {
  position: sticky;
  top: 88px;
  height: calc(100vh - 88px);
  min-height: 560px;
}

.map {
  width: 100%;
  height: 100%;
}

.map-tools {
  position: absolute;
  left: 18px;
  bottom: 18px;
  z-index: 10;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.content-panel {
  padding: 24px clamp(16px, 3vw, 34px) 36px;
}

.admin-layout {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 42px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-grid article,
.field-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.summary-grid article {
  padding: 16px;
}

.summary-grid span {
  display: block;
  font-size: 1.65rem;
  font-weight: 900;
}

.summary-grid p,
.section-heading p,
.hunt-item p,
.observation-meta,
.app-footer {
  color: var(--muted);
}

.summary-grid p,
.section-heading p,
.hunt-item p {
  margin-bottom: 0;
}

.field-card {
  margin-bottom: 18px;
  padding: 18px;
}

.section-heading {
  margin-bottom: 14px;
}

.hunt-list {
  display: grid;
  gap: 10px;
}

.participant-form,
.recover-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.participant-form button[type="button"] {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 13px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

.participant-form label,
.recover-form label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 800;
}

.participant-form input,
.recover-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--ink);
}

.recover-form {
  grid-template-columns: minmax(220px, 1fr) auto;
  margin-top: 12px;
}

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

.recover-results button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fbfdfb;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
  text-align: left;
}

.hunt-item {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.hunt-item input {
  width: 24px;
  height: 24px;
  margin-top: 2px;
  accent-color: var(--leaf);
}

.hunt-item.is-disabled {
  opacity: 0.62;
}

.hunt-item.is-disabled input {
  cursor: not-allowed;
}

.hunt-item h3 {
  margin: 0 0 4px;
  font-size: 1rem;
}

.proof-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.proof-tools input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px;
  background: white;
}

.proof-status {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 800;
}

.inat-submit {
  margin-top: 10px;
  min-height: 38px;
  border: 1px solid var(--river);
  border-radius: 8px;
  padding: 8px 10px;
  background: #eef7fb;
  color: #165779;
  font-weight: 900;
  cursor: pointer;
}

.observation-feed {
  display: grid;
  gap: 10px;
}

.leaderboard {
  display: grid;
  gap: 8px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.leaderboard-rank {
  color: var(--river);
  font-weight: 900;
}

.leaderboard-count {
  font-weight: 900;
}

.admin-table {
  overflow-x: auto;
}

.admin-table table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.admin-table th,
.admin-table td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
}

.observation {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.observation img {
  width: 72px;
  height: 72px;
  border-radius: 7px;
  object-fit: cover;
  background: #e8eee9;
}

.observation strong {
  display: block;
}

.observation a {
  font-weight: 800;
  text-decoration-color: rgba(47, 125, 89, 0.45);
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
}

.app-footer {
  padding: 16px clamp(18px, 4vw, 44px) 28px;
  font-size: 0.86rem;
}

.leaflet-popup-content h3 {
  margin: 0 0 4px;
}

.leaflet-popup-content p {
  margin-bottom: 7px;
}

@media (max-width: 880px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
    position: static;
  }

  .top-actions {
    justify-content: flex-start;
  }

  .layout {
    display: block;
  }

  .map-panel {
    position: relative;
    top: 0;
    height: 20vh;
    min-height: 155px;
    max-height: 190px;
  }

  .map {
    pointer-events: none;
    touch-action: pan-y !important;
  }

  .leaflet-control-attribution {
    font-size: 8px;
    line-height: 1.15;
  }

  .participant-form,
  .recover-form,
  .proof-tools {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

@media (max-width: 560px) {
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .map-tools {
    width: 100%;
  }

  .top-actions a,
  .map-tools button {
    flex: 1 1 180px;
    text-align: center;
  }
}
