/* ============================================================
   NATURE SPOTTER GUIDE — Design System
   Premium field guide aesthetic
   ============================================================ */

/* --- Custom Properties --- */
:root {
  --moss: #3d5a2e;
  --fern: #5a7a40;
  --chalk: #f5f0e8;
  --cream: #faf7f0;
  --bark: #8b6f4e;
  --mist: #e8ede0;
  --amber: #d4a574;
  --orange: #c97a45;
  --danger: #8b2020;
  --text-dark: #2b3a1f;
  --text-light: #6b7a5a;
  --border: #d6cfc3;

  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Source Serif 4', Georgia, serif;

  --radius: 8px;
  --radius-sm: 4px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.12);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.16);

  --transition: all 0.2s ease;
}

/* --- Reset & Base --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.6;
  color: var(--text-dark);
  background: var(--chalk);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--font-heading);
  line-height: 1.2;
  color: var(--moss);
}

h1 { font-size: clamp(28px, 5vw, 42px); font-weight: 700; }
h2 { font-size: clamp(22px, 3.5vw, 30px); font-weight: 700; }
h3 { font-size: clamp(18px, 2.5vw, 24px); font-weight: 600; }
h4 { font-size: 17px; font-weight: 600; }

a { color: var(--moss); text-decoration: underline; text-underline-offset: 3px; }
a:hover { color: var(--fern); }

img { max-width: 100%; display: block; }
button { cursor: pointer; font-family: var(--font-body); }

.hidden { display: none !important; }
.screen { min-height: 100vh; }
.screen.active { display: block; }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-primary {
  display: inline-block;
  background: var(--moss);
  color: var(--cream);
  border: none;
  border-radius: var(--radius);
  padding: 12px 28px;
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  text-decoration: none;
}
.btn-primary:hover:not(:disabled) {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px) scale(1.01);
}
.btn-primary:active:not(:disabled) { transform: scale(0.98); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn-ghost {
  display: inline-block;
  background: transparent;
  color: var(--moss);
  border: 1.5px solid var(--moss);
  border-radius: var(--radius);
  padding: 9px 20px;
  font-family: var(--font-body);
  font-size: 15px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.btn-ghost:hover { background: var(--mist); }

.btn-icon {
  background: transparent;
  border: none;
  color: var(--moss);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--fern);
  transition: var(--transition);
  cursor: pointer;
}
.btn-icon:hover { background: var(--mist); }

.btn-back {
  background: none;
  border: none;
  color: var(--moss);
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  padding: 8px 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  transition: var(--transition);
}
.btn-back:hover { color: var(--fern); }

/* ============================================================
   CUSTOM CHECKBOX
   ============================================================ */
.custom-checkbox {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  min-width: 22px;
  border: 2px solid var(--moss);
  border-radius: var(--radius-sm);
  background: var(--cream);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.custom-checkbox:hover { border-color: var(--fern); background: var(--mist); }
.custom-checkbox.checked {
  background: var(--moss);
  border-color: var(--moss);
  color: var(--cream);
}
.custom-checkbox.checked::after {
  content: '✓';
  font-size: 13px;
  font-weight: 700;
  color: var(--cream);
  animation: checkmark-pop 0.25s ease;
}

@keyframes checkmark-pop {
  0% { transform: scale(0); }
  70% { transform: scale(1.2); }
  100% { transform: scale(1); }
}

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 15px;
  color: var(--text-dark);
}

/* ============================================================
   SCREEN: DISCLAIMER
   ============================================================ */
#screen-disclaimer {
  background: var(--chalk);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}

.disclaimer-wrap {
  width: 100%;
  max-width: 560px;
}

.disclaimer-inner {
  background: var(--cream);
  border-radius: 12px;
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
}

.disclaimer-header {
  text-align: center;
  margin-bottom: 32px;
}

.disclaimer-logo {
  max-width: 160px;
  height: auto;
  display: block;
  margin: 0 auto 16px;
}

.guide-emblem {
  font-size: 48px;
  margin-bottom: 12px;
  display: block;
  filter: grayscale(0.3);
}
.guide-emblem-small { font-size: 22px; }

.disclaimer-header h1 {
  font-size: 32px;
  color: var(--moss);
  margin-bottom: 6px;
}

.tagline {
  color: var(--text-light);
  font-style: italic;
  font-size: 15px;
}

.disclaimer-box {
  background: var(--chalk);
  border-left: 4px solid var(--bark);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 20px 20px 16px;
  margin-bottom: 20px;
}

.disclaimer-box h2 {
  font-size: 18px;
  color: var(--bark);
  margin-bottom: 10px;
}

.disclaimer-box p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-dark);
}

.danger-link {
  display: inline-block;
  margin-top: 12px;
  font-size: 13px;
  color: var(--danger);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.key-dangers {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.key-dangers h3 { font-size: 16px; margin-bottom: 12px; color: var(--danger); }
.key-dangers ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.key-dangers li { font-size: 14px; line-height: 1.5; }
.key-dangers li strong { color: var(--text-dark); }

.danger-tag {
  display: inline-block;
  background: var(--danger);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 20px;
  vertical-align: middle;
  margin-left: 4px;
  letter-spacing: 0.03em;
}
.caution-tag {
  display: inline-block;
  background: var(--orange);
  color: white;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 20px;
  vertical-align: middle;
  margin-left: 4px;
}

.disclaimer-accept {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-top: 8px;
}

/* ============================================================
   SCREEN: BROWSE
   ============================================================ */
#screen-browse { background: var(--chalk); }

.browse-header {
  background: var(--moss);
  color: var(--cream);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.15);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-title h1 {
  color: var(--cream);
  font-size: 22px;
  font-weight: 700;
}

.header-logo {
  height: 52px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.header-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.header-name {
  color: var(--cream);
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.header-tagline {
  color: rgba(255,255,255,0.75);
  font-size: 12px;
  font-style: italic;
  margin-top: 2px;
}

.header-actions .btn-icon {
  color: var(--cream);
  border-color: rgba(255,255,255,0.4);
  font-size: 13px;
}
.header-actions .btn-icon:hover { background: rgba(255,255,255,0.12); }

.browse-layout {
  max-width: 1400px;
  margin: 0 auto;
  display: flex;
  min-height: calc(100vh - 60px);
}

/* --- Filters Panel --- */
.filters-panel {
  width: 260px;
  min-width: 260px;
  background: var(--cream);
  border-right: 1px solid var(--border);
  padding: 24px 20px 32px;
  overflow-y: auto;
  position: sticky;
  top: 60px;
  height: calc(100vh - 60px);
}

.filters-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.filters-header h2 { font-size: 17px; color: var(--moss); }
.filters-close { display: none; border: none; background: none; font-size: 18px; color: var(--text-light); }

.filter-group { margin-bottom: 22px; }

.filter-label {
  display: block;
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-light);
  margin-bottom: 8px;
}

.filter-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.filter-label-row .filter-label { margin-bottom: 0; }

.btn-right-now {
  background: var(--fern);
  color: white;
  border: none;
  border-radius: 20px;
  padding: 3px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-right-now:hover { background: var(--moss); }

.filter-input, .filter-select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--chalk);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-dark);
  transition: var(--transition);
}
.filter-input:focus, .filter-select:focus {
  outline: none;
  border-color: var(--fern);
  background: var(--cream);
}


.checkbox-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-dark);
  padding: 3px 0;
}
.check-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--moss);
  cursor: pointer;
  flex-shrink: 0;
}
.check-item:hover { color: var(--moss); }

.filter-actions {
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* --- Browse Main --- */
.browse-main {
  flex: 1;
  padding: 20px 32px 40px;
  min-width: 0;
}

.browse-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.btn-filter-toggle {
  display: none;
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--moss);
  cursor: pointer;
  align-items: center;
  gap: 8px;
  transition: var(--transition);
}
.btn-filter-toggle:hover { background: var(--mist); }

.filter-badge {
  background: var(--fern);
  color: white;
  border-radius: 20px;
  padding: 1px 7px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.6;
}

.results-count {
  font-size: 14px;
  color: var(--text-light);
  font-style: italic;
}

.active-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-chip {
  background: var(--mist);
  color: var(--moss);
  border: 1px solid var(--fern);
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}
.filter-chip .chip-remove { color: var(--text-light); font-size: 14px; line-height: 1; }
.filter-chip:hover { background: var(--chalk); }

/* --- Species Grid --- */
.species-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.species-card {
  background: var(--cream);
  border-left: 4px solid var(--moss);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  position: relative;
}
.species-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  border-left-color: var(--fern);
}

.card-img-wrap {
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  background: var(--mist);
  position: relative;
}
.card-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.species-card:hover .card-img-wrap img { transform: scale(1.04); }

.card-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-light);
  font-size: 40px;
  background: var(--mist);
}

.card-body {
  padding: 14px 16px 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.card-name {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 700;
  color: var(--moss);
  line-height: 1.25;
}

.card-latin {
  font-style: italic;
  font-size: 13px;
  color: var(--text-light);
}

.card-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 4px;
}

.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.badge-type { background: var(--mist); color: var(--moss); }
.badge-native { background: #dde8d0; color: var(--moss); }
.badge-non-native { background: #f0e8d0; color: var(--bark); }
.badge-invasive { background: #f5ddd0; color: #7a3010; }
.badge-featured { background: #fef3cc; color: #7c5a00; }
.badge-danger-low { background: #f5ead0; color: #7a5010; }
.badge-danger-caution { background: #f5e0cc; color: #8a4010; }
.badge-danger-dangerous { background: #f5d5d5; color: var(--danger); }

.card-footer {
  padding: 8px 16px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.spotted-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--text-light);
  padding: 4px 0;
  transition: var(--transition);
}
.spotted-btn:hover { color: var(--moss); }
.spotted-btn.spotted { color: var(--moss); font-weight: 600; }

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
}
.empty-state p { font-size: 17px; margin-bottom: 8px; }
.empty-hint { font-style: italic; font-size: 15px; }
.empty-state .btn-ghost { margin-top: 20px; }

/* --- Mobile: Filters Overlay --- */
.filters-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(43, 58, 31, 0.5);
  z-index: 199;
}

/* ============================================================
   SCREEN: SPECIES DETAIL
   ============================================================ */
#screen-detail { background: var(--chalk); }

.detail-header-bar {
  background: var(--moss);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.detail-header-bar .btn-back { color: var(--cream); }
.detail-header-bar .btn-back:hover { color: var(--amber); }
.detail-submit-btn,
.detail-header-bar .btn-icon { color: var(--cream); border-color: rgba(255,255,255,0.4); font-size: 13px; }
.detail-submit-btn:hover,
.detail-header-bar .btn-icon:hover { background: rgba(255,255,255,0.12); }

.detail-content {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 0 60px;
}
.detail-content-inner {
  padding: 0 20px;
}

/* Detail Hero Photo */
.detail-hero-img {
  width: 100%;
  height: clamp(220px, 40vw, 380px);
  overflow: hidden;
  position: relative;
  margin-bottom: 0;
  background: var(--mist);
}
.detail-hero-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}
.detail-hero-img .hero-attribution {
  position: absolute;
  bottom: 0;
  right: 0;
  background: rgba(0,0,0,0.55);
  color: rgba(255,255,255,0.85);
  font-size: 11px;
  padding: 4px 8px;
  opacity: 0;
  transition: opacity 0.2s;
}
.detail-hero-img:hover .hero-attribution { opacity: 1; }
.detail-hero-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 5rem;
  background: var(--mist);
}

/* Species Header */
.detail-hero {
  padding: 28px 0 20px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}
.detail-hero h1 {
  font-size: clamp(28px, 5vw, 40px);
  margin-bottom: 4px;
  color: var(--moss);
}
.detail-latin {
  font-style: italic;
  font-size: 18px;
  color: var(--text-light);
  font-family: var(--font-body);
  margin-bottom: 12px;
}
.detail-badges { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }

.danger-banner {
  background: var(--danger);
  color: white;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 12px;
}
.danger-banner.level-caution { background: var(--orange); }
.danger-banner.level-low { background: var(--amber); color: var(--text-dark); }

.weather-banner {
  background: #fef3cc;
  border: 1px solid var(--amber);
  color: #5a3a00;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 12px;
  display: flex;
  gap: 8px;
  align-items: flex-start;
}
.weather-banner::before { content: '☁'; flex-shrink: 0; }

/* Quick ID */
.detail-section { margin-bottom: 32px; }
.detail-section h2 {
  font-size: 20px;
  color: var(--bark);
  border-bottom: 2px solid var(--mist);
  padding-bottom: 8px;
  margin-bottom: 16px;
}
.quick-id {
  background: var(--cream);
  border-left: 4px solid var(--fern);
  border-radius: 0 var(--radius) var(--radius) 0;
  padding: 16px 20px;
  font-size: 16px;
  line-height: 1.65;
  color: var(--text-dark);
}

.inline-disclaimer {
  font-size: 13px;
  color: var(--text-light);
  font-style: italic;
  border-top: 1px solid var(--border);
  padding-top: 10px;
  margin-top: 10px;
}

/* Life Stages */
.stages-tabs {
  display: flex;
  gap: 0;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--mist);
  margin-bottom: 20px;
}
.stage-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 9px 18px;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.stage-tab:hover { color: var(--moss); }
.stage-tab.active { color: var(--moss); border-bottom-color: var(--moss); }

.stage-panel { display: none; }
.stage-panel.active { display: block; }

.stage-months { margin-bottom: 12px; }
.months-label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-light); margin-bottom: 6px; }
.month-bar { display: flex; gap: 3px; }
.month-pip {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--mist);
  transition: var(--transition);
  cursor: default;
}
.month-pip.visible { background: var(--fern); }
.month-pip.peak { background: var(--moss); }
.month-pip[title] { cursor: help; }

.stage-description { line-height: 1.7; margin-bottom: 16px; }

.stage-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
}
.stage-photo-item {
  position: relative;
  border-radius: var(--radius-sm);
  overflow: hidden;
  cursor: pointer;
  background: var(--mist);
  aspect-ratio: 4/3;
}
.stage-photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.stage-photo-item:hover img { transform: scale(1.05); }
.photo-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.65));
  padding: 20px 8px 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.stage-photo-item:hover .photo-overlay { opacity: 1; }
.photo-credit { font-size: 11px; color: rgba(255,255,255,0.9); }
.no-photo-note { font-size: 13px; color: var(--text-light); font-style: italic; padding: 8px 0; }

/* When & Where */
.when-where-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 540px) { .when-where-grid { grid-template-columns: 1fr; } }

.when-where-block h4 { font-size: 14px; color: var(--bark); margin-bottom: 10px; }

.months-full-bar { margin-bottom: 16px; }
.month-names { display: flex; gap: 3px; margin-bottom: 4px; }
.month-name { flex: 1; font-size: 10px; text-align: center; color: var(--text-light); }
.months-full-bar .month-bar { margin-bottom: 0; }

.location-tags, .habitat-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.loc-tag, .hab-tag {
  background: var(--mist);
  color: var(--text-dark);
  border-radius: 20px;
  padding: 3px 11px;
  font-size: 13px;
}

/* Ecological Value */
.eco-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}
@media (max-width: 540px) { .eco-grid { grid-template-columns: 1fr; } }

.eco-block { background: var(--cream); padding: 14px 16px; border-radius: var(--radius); }
.eco-block h4 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-light); margin-bottom: 8px; }
.eco-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.eco-tag {
  background: var(--mist);
  color: var(--moss);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 13px;
}
.eco-tag a { color: inherit; }

/* Similar Species */
.similar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.similar-card {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
  color: var(--text-dark);
  display: block;
}
.similar-card:hover { box-shadow: var(--shadow-sm); border-color: var(--fern); }
.similar-card.missing { opacity: 0.5; pointer-events: none; cursor: default; }
.similar-card.missing:hover { box-shadow: none; border-color: var(--border); }

.similar-name { font-family: var(--font-heading); font-weight: 700; font-size: 15px; color: var(--moss); margin-bottom: 2px; }
.similar-latin { font-style: italic; font-size: 12px; color: var(--text-light); margin-bottom: 8px; }
.similar-note { font-size: 13px; color: var(--text-dark); margin-bottom: 6px; line-height: 1.5; }
.similar-diff {
  font-size: 12px;
  background: var(--mist);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  line-height: 1.5;
  color: var(--text-dark);
}
.similar-diff strong { color: var(--moss); }
.not-in-guide {
  font-size: 12px;
  color: var(--text-light);
  font-style: italic;
  margin-top: 6px;
}

/* Photos Gallery */
.photos-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.gallery-item {
  position: relative;
  aspect-ratio: 4/3;
  overflow: hidden;
  border-radius: var(--radius-sm);
  cursor: pointer;
  background: var(--mist);
}
.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}
.gallery-item:hover img { transform: scale(1.05); }
.gallery-attribution {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(transparent, rgba(0,0,0,0.7));
  padding: 24px 8px 6px;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.gallery-item:hover .gallery-attribution { opacity: 1; }
.attr-caption { font-size: 11px; color: white; display: block; }
.attr-credit { font-size: 10px; color: rgba(255,255,255,0.7); display: block; }

/* ============================================================
   SCREEN: SUBMISSION FORM
   ============================================================ */
#screen-submit { background: var(--chalk); }

.form-header-bar {
  background: var(--moss);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.form-header-bar .btn-back { color: var(--cream); }
.form-header-bar h2 { color: var(--cream); font-size: 18px; }

.form-content {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 20px 60px;
}

.form-intro {
  font-size: 15px;
  color: var(--text-light);
  font-style: italic;
  margin-bottom: 28px;
  line-height: 1.65;
}

.field-form { display: flex; flex-direction: column; gap: 20px; }

.field-group { display: flex; flex-direction: column; gap: 6px; }

.field-label {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  color: var(--bark);
}
.field-label .required { color: var(--danger); }

.field-input, .field-textarea, .field-input-file {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--cream);
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--text-dark);
  transition: var(--transition);
}
.field-input:focus, .field-textarea:focus {
  outline: none;
  border-color: var(--fern);
  background: white;
}
.field-textarea { resize: vertical; min-height: 120px; }

.field-input-file {
  padding: 8px 10px;
  cursor: pointer;
}

.field-hint { font-size: 12px; color: var(--text-light); font-style: italic; }

.field-actions { margin-top: 8px; }

.thankyou {
  text-align: center;
  padding: 60px 20px;
}
.thankyou-inner { max-width: 400px; margin: 0 auto; }
.thankyou-icon {
  width: 56px;
  height: 56px;
  background: var(--moss);
  color: white;
  border-radius: 50%;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
}
.thankyou h3 { font-size: 24px; margin-bottom: 12px; }
.thankyou p { color: var(--text-light); margin-bottom: 24px; }

/* ============================================================
   SCREEN: ADMIN PANEL
   ============================================================ */
#screen-admin { background: var(--chalk); }

.admin-header-bar {
  background: var(--moss);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.admin-header-bar .btn-back { color: var(--cream); }
.admin-header-bar h2 { color: var(--cream); font-size: 18px; }

.admin-content {
  max-width: 1000px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.admin-tabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 24px;
  /* Four tabs (Pending/Reviewed/Spotted/Sightings) no longer fit in one row
     on a narrow phone — scroll sideways rather than clipping the last tab. */
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.admin-tab { flex-shrink: 0; }
.admin-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 10px 20px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  color: var(--text-light);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  gap: 7px;
}
.admin-tab:hover { color: var(--moss); }
.admin-tab.active { color: var(--moss); border-bottom-color: var(--moss); }

.tab-badge {
  background: var(--fern);
  color: white;
  border-radius: 20px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 700;
}

.admin-tab-content { display: none; }
.admin-tab-content.active { display: block; }

.admin-empty { color: var(--text-light); font-style: italic; padding: 24px 0; }

.admin-submissions { display: flex; flex-direction: column; gap: 14px; }

.sub-card {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
}
.sub-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 10px;
}
.sub-type-badge {
  background: var(--mist);
  color: var(--moss);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.sub-date { font-size: 12px; color: var(--text-light); }
.sub-species { font-weight: 700; font-size: 15px; color: var(--moss); margin-bottom: 4px; }
.sub-suggestion { font-size: 14px; line-height: 1.6; color: var(--text-dark); margin-bottom: 8px; }
.sub-meta { font-size: 12px; color: var(--text-light); display: flex; flex-wrap: wrap; gap: 12px; }
.sub-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.btn-approve {
  background: var(--fern);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-approve:hover { background: var(--moss); }

.btn-reject {
  background: transparent;
  color: var(--danger);
  border: 1.5px solid var(--danger);
  border-radius: var(--radius-sm);
  padding: 6px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-reject:hover { background: #fff0f0; }

.btn-claude-review {
  background: transparent;
  color: var(--bark);
  border: 1.5px solid var(--amber);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.btn-claude-review:hover { background: #fdf6ec; }

.status-badge {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
}
.status-approved { background: #ddf0dd; color: #225522; }
.status-rejected { background: #f5dddd; color: var(--danger); }

.spotted-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.spotted-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--cream);
  border-radius: var(--radius-sm);
  font-size: 14px;
}
.spotted-row-name { flex: 1; font-weight: 600; color: var(--moss); }
.spotted-row-date { font-size: 12px; color: var(--text-light); }

/* ============================================================
   LIGHTBOX
   ============================================================ */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.88);
  z-index: 999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.lightbox.hidden { display: none !important; }

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 20px;
  background: none;
  border: none;
  color: white;
  font-size: 36px;
  cursor: pointer;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s;
}
.lightbox-close:hover { opacity: 1; }

.lightbox-inner {
  max-width: min(900px, 100%);
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.lightbox-inner img {
  max-height: 80vh;
  max-width: 100%;
  object-fit: contain;
  border-radius: var(--radius-sm);
}
.lightbox-caption { color: rgba(255,255,255,0.8); font-size: 14px; text-align: center; }

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  /* Filters become a drawer */
  .filters-panel {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    z-index: 200;
    box-shadow: var(--shadow-lg);
    transition: left 0.3s ease;
    padding-top: 20px;
  }
  .filters-panel.open {
    left: 0;
  }
  .filters-close { display: block; }
  .filters-overlay { display: block; }
  .filters-overlay.visible { display: block !important; }

  .btn-filter-toggle { display: flex; }

  .browse-main { padding: 16px 20px 40px; }

  .species-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }

  .disclaimer-inner { padding: 28px 20px; }

  .when-where-grid { grid-template-columns: 1fr; }
  .eco-grid { grid-template-columns: 1fr; }

  .stage-photos { grid-template-columns: repeat(2, 1fr); }
  .photos-gallery { grid-template-columns: repeat(2, 1fr); }

  .similar-grid { grid-template-columns: 1fr; }
}

@media (max-width: 400px) {
  .species-grid { grid-template-columns: 1fr; }
  .stage-photos { grid-template-columns: 1fr; }
}

@media (min-width: 1200px) {
  .species-grid { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
}

/* Touch targets */
@media (hover: none) {
  .spotted-btn, .btn-back, .filter-tab, .stage-tab { min-height: 44px; }
  .check-item { min-height: 36px; align-items: center; }
}

/* ============================================================
   LOCATIONS SCREEN
============================================================ */
.locations-content {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

.locations-intro {
  text-align: center;
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 32px;
}
.locations-intro h1 {
  font-family: var(--font-heading);
  font-size: clamp(26px, 4vw, 36px);
  color: var(--moss);
  margin-bottom: 10px;
}
.locations-intro p {
  color: var(--text-light);
  font-style: italic;
  line-height: 1.6;
}

.location-card {
  background: var(--cream);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 28px;
  overflow: hidden;
}
.location-card-header {
  padding: 20px 24px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.old-down-header   { background: var(--moss); color: white; }
.sholing-header    { background: var(--fern); color: white; }
.southuk-header    { background: var(--bark); color: white; }
.location-card-header h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  margin: 0;
  color: inherit;
}
.loc-badge {
  background: rgba(255,255,255,0.25);
  color: white;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 20px;
  font-family: var(--font-body);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.location-card-body {
  padding: 22px 24px 24px;
}
.location-card-body p {
  line-height: 1.75;
  margin-bottom: 14px;
  color: var(--text-dark);
}

.location-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--border);
}
.loc-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 60px;
}
.loc-stat-num {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--moss);
  line-height: 1.1;
}
.loc-stat-label {
  font-size: 11px;
  color: var(--text-light);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-top: 2px;
}

.location-highlights { margin: 18px 0 16px; }
.location-highlights h4,
.location-seasons h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  margin-bottom: 10px;
  font-family: var(--font-body);
  font-weight: 600;
}
.highlight-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.highlight-tag {
  background: var(--mist);
  color: var(--moss);
  font-size: 13px;
  padding: 4px 11px;
  border-radius: 20px;
  font-family: var(--font-body);
}

.location-seasons { margin: 18px 0 20px; }
.season-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text-dark);
  line-height: 1.5;
}
.season-chip {
  font-size: 11px;
  padding: 2px 9px;
  border-radius: 12px;
  font-family: var(--font-body);
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.season-chip.spring { background: #d4edbc; color: #3a6b1a; }
.season-chip.summer { background: #fde68a; color: #7c5a00; }
.season-chip.autumn { background: #fed7aa; color: #7c3a0a; }

.location-footer {
  border-top: 1px solid var(--border);
  padding-top: 14px;
  margin-top: 4px;
}
.location-managed {
  font-size: 13px;
  color: var(--text-light);
  font-style: italic;
  margin-bottom: 8px !important;
}
.location-link {
  font-size: 13px;
  color: var(--fern);
  text-decoration: none;
  font-family: var(--font-body);
}
.location-link:hover { text-decoration: underline; }

.location-address {
  font-size: 13px;
  color: var(--text-light);
  font-style: normal;
  margin-bottom: 8px;
  line-height: 1.6;
}
.volunteer-sessions {
  list-style: none;
  padding: 0;
  margin: 0 0 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.volunteer-sessions li {
  font-size: 13px;
  color: var(--text-light);
  padding-left: 12px;
  position: relative;
}
.volunteer-sessions li::before {
  content: '·';
  position: absolute;
  left: 0;
  color: var(--fern);
}

/* ============================================================
   FOOTER
============================================================ */
.site-footer {
  background: var(--moss);
  color: rgba(255,255,255,0.8);
  margin-top: auto;
}

.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}

.footer-links a {
  color: rgba(255,255,255,0.9);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--font-body);
  transition: color 0.2s;
}
.footer-links a:hover { color: white; text-decoration: underline; }

.footer-text {
  font-family: var(--font-heading);
  font-size: 15px;
  color: rgba(255,255,255,0.95);
  font-weight: 600;
}

.footer-legal {
  font-size: 12px;
  color: rgba(255,255,255,0.55);
  line-height: 1.5;
}
.footer-legal a { color: rgba(255,255,255,0.7); }
.footer-legal a:hover { color: white; }

.footer-contact {
  font-size: 13px;
  color: rgba(255,255,255,0.65);
}
.footer-contact a { color: rgba(255,255,255,0.8); }

@media (max-width: 768px) {
  .footer-inner { padding: 24px 20px 20px; gap: 10px; }
  .footer-links { gap: 6px 16px; }
}

/* ============================================================
   SCREEN: RECORD A SIGHTING
   ============================================================ */
#screen-sighting { background: var(--chalk); }

/* Detail header bar now holds two action buttons (sighting + suggest) —
   wrap on narrow phones rather than squeezing them off-screen. */
.detail-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sg-heading {
  font-family: var(--font-heading);
  font-size: 15px;
  color: var(--moss);
  border-bottom: 1px solid var(--border);
  padding-bottom: 6px;
  margin: 8px 0 -6px;
}
.field-form > .sg-heading:first-child { margin-top: 0; }

.btn-secondary {
  display: inline-block;
  background: var(--mist);
  color: var(--moss);
  border: 1.5px solid var(--fern);
  border-radius: var(--radius);
  padding: 11px 20px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}
.btn-secondary:hover:not(:disabled) { background: var(--chalk); }
.btn-secondary:disabled { opacity: 0.45; cursor: not-allowed; }

.sg-photo-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.sg-photo-btn { min-height: 44px; }

.sg-thumbs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Each accepted photo: thumbnail + its verdict note side by side */
.sg-photo-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.sg-photo-item img {
  width: 64px;
  height: 64px;
  min-width: 64px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--mist);
}

/* Photo verdict notes — blocked/warn/ok share a shape, differ by colour */
.sg-note {
  flex: 1;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 13px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sg-note-blocked { background: #f5dddd; color: var(--danger); border: 1px solid #e3baba; }
.sg-note-warn { background: #fbf1de; color: var(--bark); border: 1px solid var(--amber); }
.sg-note-ok { background: #e3efe0; color: var(--moss); border: 1px solid var(--fern); }
.sg-note-link {
  align-self: flex-start;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  text-decoration: underline;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.sg-note-fills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 2px; }
.sg-note-fill-btn {
  background: white;
  border: 1.5px solid var(--fern);
  color: var(--moss);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.sg-note-fill-btn:hover { background: var(--mist); }

.sg-photo-panel { display: flex; flex-direction: column; gap: 10px; }
.sg-prompt-panel {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sg-prompt-amber { background: #fbf1de; color: var(--bark); border: 1px solid var(--amber); }
.sg-prompt-good { background: #e3efe0; color: var(--moss); border: 1px solid var(--fern); }

.sg-declaration { gap: 4px; }
.sg-own-checkbox[aria-disabled="true"] { opacity: 0.4; cursor: not-allowed; }
.sg-declaration .checkbox-label { font-size: 14px; }

.sg-location-loading { color: var(--text-light); font-style: italic; }
.sg-location-error { color: var(--danger); }
.sg-location-ok { color: var(--moss); }

/* ============================================================
   ADMIN: SIGHTINGS TAB
   ============================================================ */
.sightings-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.sighting-card {
  background: var(--cream);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.sighting-card-thumbs { display: flex; gap: 8px; flex-wrap: wrap; }
.sighting-card-thumbs img {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.sighting-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.sighting-species { font-weight: 700; font-size: 16px; color: var(--moss); }
.sighting-meta { font-size: 13px; color: var(--text-light); line-height: 1.6; }
.sighting-notes { font-size: 13px; color: var(--text-dark); line-height: 1.6; font-style: italic; }
.sighting-sent-toggle { display: flex; align-items: center; gap: 8px; font-size: 13px; }

@media (max-width: 480px) {
  .sg-photo-buttons { flex-direction: column; }
  .sg-photo-buttons .sg-photo-btn { width: 100%; }
}

/* ---------- Sighting: photo-use permissions ---------- */
.sg-perm-intro { margin: -4px 0 14px; }

.sg-perms { display: flex; flex-direction: column; gap: 14px; }

.sg-perm-row { align-items: flex-start; gap: 10px; }
.sg-perm-row .custom-checkbox { flex: 0 0 auto; margin-top: 2px; }

.sg-perm-hint { display: block; margin: 3px 0 0; }

.custom-checkbox.is-disabled {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--mist);
}
.custom-checkbox.is-disabled:hover { border-color: var(--border); background: var(--mist); }

/* A disabled credit field must look disabled — otherwise it reads as an
   ordinary box that silently swallows what you type. */
.field-input:disabled {
  opacity: 0.45;
  background: var(--mist);
  cursor: not-allowed;
}

.sg-perm-nophotos { margin: 2px 0 0; font-style: italic; }

.sg-perm-note {
  margin: 4px 0 22px;
  padding: 10px 12px;
  background: var(--mist);
  border-radius: var(--radius-sm);
  line-height: 1.5;
}

/* ---------- Admin: permission badges ---------- */
.sighting-perms {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 10px 0 4px;
}

.perm-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  white-space: nowrap;
}
.perm-badge-yes { background: #e3efe0; color: var(--moss); border: 1px solid var(--fern); }
.perm-badge-no  { background: var(--chalk); color: var(--text-light); border: 1px solid var(--border); }
.perm-badge-na  { background: var(--chalk); color: var(--text-light); border: 1px dashed var(--border); }

.perm-credit { font-size: 0.78rem; color: var(--text-light); font-style: italic; }

.sightings-held-back {
  flex-basis: 100%;
  margin: 6px 0 0;
  color: var(--bark);
}
