/* ============================================================
   iNaturalist Bingo Card Generator - Styles
   ============================================================ */

:root {
  --title-font: "Bitcount Prop Single", "Google Sans Flex", system-ui, sans-serif;
  --body-font: "Google Sans Flex", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --page-bg: #f3f3f3;
  --surface: #fbfbfb;
  --surface-strong: #ffffff;
  --surface-muted: #f5f5f5;
  --ink: #242424;
  --muted: #6f6f6f;
  --border: #d7d7d7;
  --border-strong: #adadad;
  --brand: #5c5c5c;
  --brand-dark: #2f2f2f;
  --brand-soft: #eeeeee;
  --blue: #3498db;
  --blue-soft: #eaf4fc;
  --red: #e74c3c;
  --yellow: #f1c40f;
  --yellow-soft: #fff8df;
  --danger: #4d4d4d;
  --warning: #5d5d5d;
}

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

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  font-family: var(--body-font);
  background: var(--page-bg);
  color: var(--ink);
  line-height: 1.5;
}

.container {
  max-width: 920px;
  margin: 0 auto;
  padding: 2.75rem 1.25rem 3rem;
}

.app-header {
  margin-bottom: 1.25rem;
  padding-bottom: 0.9rem;
}

.app-title-row {
  display: flex;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 0.45rem;
}

h1 {
  min-width: 0;
  font-family: var(--title-font);
  color: var(--ink);
  font-size: 2.65rem;
  font-weight: 300;
  letter-spacing: 0;
  line-height: 0.95;
}

.app-info-toggle {
  display: inline-flex;
  width: 1.28rem;
  height: 1.28rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  margin-top: 0.02rem;
  border: 1px solid var(--blue);
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--blue);
  appearance: none;
  cursor: pointer;
  font-family: var(--body-font);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
  transition: background 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

.app-info-toggle:hover,
.app-info-toggle[aria-expanded="true"] {
  background: var(--blue);
  color: #ffffff;
  transform: translateY(-1px);
}

.app-info-toggle:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.app-info-blurb {
  width: 100%;
  max-width: none;
  margin-top: 0.75rem;
  padding: 0.78rem 0.9rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--brand-dark);
  font-size: 0.95rem;
}

.app-info-blurb p + p {
  margin-top: 0.85rem;
}

h2 {
  margin-bottom: 1rem;
  color: var(--brand-dark);
  font-size: 1.55rem;
  letter-spacing: 0;
}

/* --- Form --- */
form {
  display: grid;
  gap: 1rem;
}

fieldset {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.1rem 1.25rem 1.25rem;
  background: var(--surface);
}

legend {
  float: left;
  width: 100%;
  padding: 0;
  margin-bottom: 1rem;
  color: var(--blue);
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

legend + * {
  clear: both;
}

.field {
  margin-bottom: 1rem;
}

.field:last-child {
  margin-bottom: 0;
}

.field label:not(.filter-toggle):not(.inline-check):not(.checkbox-chip):not(.grid-size-option):not(.species-pool-label-text),
.field-label {
  display: block;
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 620;
  margin-bottom: 0.35rem;
}

.field input[type="text"],
.field input[type="number"],
.field select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.64rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--ink);
  font-size: 0.97rem;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.field select {
  color: var(--ink);
}

.field input[type="text"]:focus,
.field input[type="number"]:focus,
.field select:focus {
  outline: none;
  border-color: var(--blue);
  background: #ffffff;
  box-shadow: none;
}

.field input[type="range"] {
  width: 100%;
  height: 0.45rem;
  padding: 0;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--blue) 0%,
    var(--blue) var(--range-progress, 0%),
    #e4e4e4 var(--range-progress, 0%),
    #e4e4e4 100%
  );
  accent-color: var(--blue);
  appearance: none;
}

.field input[type="range"]::-webkit-slider-runnable-track {
  height: 0.45rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
}

.field input[type="range"]::-webkit-slider-thumb {
  width: 1rem;
  height: 1rem;
  margin-top: -0.275rem;
  border: 0;
  border-radius: 50%;
  background: var(--blue);
  appearance: none;
}

.field input[type="range"]::-moz-range-track {
  height: 0.45rem;
  border: 0;
  border-radius: 999px;
  background: #e4e4e4;
}

.field input[type="range"]::-moz-range-progress {
  height: 0.45rem;
  border-radius: 999px;
  background: var(--blue);
}

.field input[type="range"]::-moz-range-thumb {
  width: 1rem;
  height: 1rem;
  border: 0;
  border-radius: 50%;
  background: var(--blue);
}

.inline-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.species-pool-label-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.species-pool-label-text {
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 620;
}

.species-pool-info-toggle {
  margin-top: 0;
}

.species-pool-info-blurb {
  margin-bottom: 0.8rem;
}

.species-pool-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 6rem;
  gap: 0.75rem;
  align-items: center;
}

.species-pool-controls input[type="number"] {
  text-align: right;
}

.field small {
  display: block;
  color: var(--muted);
  font-size: 0.8rem;
}

.field-warning {
  margin-top: 0.35rem;
  display: flex;
  gap: 0.5rem;
  align-items: flex-start;
  padding: 0.65rem 0.75rem;
  border: 1px solid rgba(241, 196, 15, 0.72);
  border-radius: 6px;
  background: var(--yellow-soft);
  color: #5c4700;
  font-weight: 520;
}

.field-warning::before {
  content: "!";
  display: inline-flex;
  flex: 0 0 1.15rem;
  width: 1.15rem;
  height: 1.15rem;
  align-items: center;
  justify-content: center;
  margin-right: 0.35rem;
  margin-top: 0.05rem;
  border-radius: 50%;
  background: var(--yellow);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1;
}

/* Filter controls */
.filter-fieldset {
  border-color: var(--border);
  background: var(--surface);
}

.filter-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  align-items: start;
}

.filter-option {
  margin-bottom: 0;
  padding: 0.85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
  transition: border-color 0.16s ease, background 0.16s ease;
}

.filter-option:has(.filter-toggle input:checked) {
  border-color: var(--border-strong);
  background: var(--brand-soft);
}

.filter-toggle {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.75rem;
  align-items: center;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.97rem;
  font-weight: 560;
}

.filter-toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.toggle-track {
  position: relative;
  width: 2.55rem;
  height: 1.42rem;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: #e4e4e4;
  transition: background 0.16s ease, border-color 0.16s ease;
}

.toggle-track::after {
  content: "";
  position: absolute;
  top: 0.14rem;
  left: 0.14rem;
  width: 1.02rem;
  height: 1.02rem;
  border-radius: 50%;
  background: #ffffff;
  transition: transform 0.16s ease;
}

.filter-toggle input:checked + .toggle-track {
  border-color: var(--blue);
  background: var(--blue);
}

.filter-toggle input:checked + .toggle-track::after {
  transform: translateX(1.1rem);
}

.filter-toggle:focus-within .toggle-track {
  outline: 1px solid var(--blue);
  outline-offset: 2px;
}

.multi-select-wrapper {
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.option-group-label {
  margin-bottom: 0.55rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 620;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.checkbox-group {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8.6rem, 1fr));
  gap: 0.5rem;
}

.checkbox-chip {
  display: flex;
  min-height: 2.35rem;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0.62rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 520;
  line-height: 1.2;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
  user-select: none;
}

.checkbox-chip:hover {
  border-color: var(--border-strong);
  background: #f8f8f8;
}

.checkbox-chip:focus-within {
  outline: none;
  border-color: var(--blue);
}

.checkbox-chip input {
  display: grid;
  flex: 0 0 auto;
  width: 1.02rem;
  height: 1.02rem;
  margin: 0;
  place-content: center;
  appearance: none;
  border: 1.5px solid var(--border-strong);
  border-radius: 4px;
  background: #ffffff;
}

.checkbox-chip input::before {
  content: "";
  width: 0.42rem;
  height: 0.68rem;
  margin-top: -0.08rem;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg) scale(0);
  transition: transform 0.12s ease;
}

.checkbox-chip input:checked {
  border-color: var(--blue);
  background: var(--blue);
}

.checkbox-chip input:checked::before {
  transform: rotate(45deg) scale(1);
}

.checkbox-chip:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--brand-dark);
}

.inline-check {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.5rem 0.62rem;
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 560;
}

.inline-check:hover {
  background: var(--surface-muted);
}

.inline-check input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: var(--blue);
}

.inline-field-grid .field,
.option-row-field {
  margin-bottom: 0;
}

.card-settings-fieldset > .option-row-field {
  margin-top: 1rem;
}

.option-row-field .inline-check {
  width: 100%;
  min-height: 2.75rem;
  border: 1px solid var(--border);
  background: var(--surface-strong);
}

.option-row-field .inline-check:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.display-option-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.grid-size-options {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.grid-size-option {
  position: relative;
  display: flex;
  gap: 0.65rem;
  align-items: center;
  min-height: 3.25rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
  font-size: 0.92rem;
  font-weight: 560;
}

.grid-size-option input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.grid-size-option:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.grid-size-option:focus-within {
  border-color: var(--blue);
}

.grid-size-icon {
  display: inline-flex;
  width: 1.55rem;
  height: 1.55rem;
  flex: 0 0 1.55rem;
  align-items: center;
  justify-content: center;
  color: var(--muted);
}

.grid-size-option:has(input:checked) .grid-size-icon {
  color: var(--blue);
}

.grid-size-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-linecap: square;
  stroke-linejoin: round;
  stroke-width: 0.75;
}

/* --- Place Type-Ahead --- */
.place-search-field {
  position: relative;
}

.dropdown {
  list-style: none;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--surface-strong);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
  box-shadow: none;
}

.dropdown li {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.dropdown li:hover,
.dropdown li.active {
  background: var(--blue-soft);
}

.dropdown li .place-type {
  color: var(--muted);
  font-size: 0.8rem;
  margin-left: 0.5rem;
}

/* --- Custom Boundary Controls --- */
.boundary-action-row {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 0.7rem;
}

.draw-boundary-button,
.boundary-tool-button,
.boundary-draw-actions button,
.boundary-map-search-controls button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
  border: 1px solid var(--border-strong);
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--brand-dark);
  cursor: pointer;
  font-family: var(--body-font);
  font-weight: 620;
  line-height: 1.1;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.draw-boundary-button {
  min-height: 2.8rem;
  padding: 0.65rem 0.95rem;
  font-size: 0.98rem;
}

.draw-boundary-button svg,
.boundary-tool-button svg {
  width: 1.1rem;
  height: 1.1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.draw-boundary-button:hover,
.boundary-tool-button:hover,
.boundary-draw-actions button:hover,
.boundary-map-search-controls button:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
  transform: translateY(-1px);
}

.boundary-help-toggle {
  display: inline-flex;
  width: 1.35rem;
  height: 1.35rem;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--blue);
  border-radius: 50%;
  background: var(--surface-strong);
  color: var(--blue);
  cursor: pointer;
  font-family: var(--body-font);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  padding: 0;
}

.boundary-help-toggle:hover,
.boundary-help-toggle[aria-expanded="true"] {
  background: var(--blue);
  color: #ffffff;
}

.boundary-help {
  margin-top: 0.65rem;
  padding: 0.72rem 0.82rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--blue);
  border-radius: 7px;
  background: var(--surface-strong);
  color: var(--brand-dark);
  font-size: 0.9rem;
}

.boundary-help a {
  color: var(--blue);
  font-weight: 620;
}

.boundary-draw-tools {
  display: grid;
  gap: 0.72rem;
  margin-bottom: 0.75rem;
}

.boundary-map-search {
  position: relative;
  display: grid;
  gap: 0.35rem;
}

.boundary-map-search label {
  color: var(--brand-dark);
  font-size: 0.88rem;
  font-weight: 560;
}

.boundary-map-search-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
}

.boundary-map-search-controls button,
.boundary-draw-actions button {
  min-height: 2.35rem;
  padding: 0.55rem 0.75rem;
}

.boundary-tool-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.boundary-tool-button {
  min-height: 2.3rem;
  padding: 0.52rem 0.75rem;
}

.boundary-tool-button.secondary {
  color: var(--muted);
}

.boundary-tool-button.active {
  border-color: var(--blue);
  background: var(--blue-soft);
  color: var(--blue);
}

.boundary-draw-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

#use-boundary-btn {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

#use-boundary-btn:hover {
  background: #2f89c5;
}

#use-boundary-btn:disabled {
  border-color: var(--border);
  background: var(--surface-muted);
  color: var(--muted);
  cursor: not-allowed;
  transform: none;
}

/* --- Place Boundary Map --- */
.place-map-panel {
  margin-top: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-strong);
  overflow: hidden;
}

.place-map-panel summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.6rem;
  align-items: center;
  min-height: 2.6rem;
  padding: 0.6rem 0.75rem;
  color: var(--brand-dark);
  cursor: pointer;
  font-weight: 560;
  list-style: none;
}

.place-map-panel summary::-webkit-details-marker {
  display: none;
}

.place-map-panel summary::before {
  content: ">";
  display: inline-grid;
  width: 1.35rem;
  height: 1.35rem;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  color: var(--brand-dark);
  font-size: 0.9rem;
  font-weight: 620;
  line-height: 1;
  transition: transform 0.16s ease, background 0.16s ease;
}

.place-map-panel[open] summary::before {
  background: var(--brand-soft);
  transform: rotate(90deg);
}

.place-map-body {
  padding: 0.75rem;
  border-top: 1px solid var(--border);
}

.place-map {
  width: 100%;
  height: min(52vh, 360px);
  min-height: 320px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-muted);
  overflow: hidden;
}

.place-map.is-drawing {
  cursor: crosshair;
}

.place-map-status {
  margin-top: 0.45rem;
}

.place-map-status:empty {
  display: none;
}

.leaflet-container {
  font: inherit;
}

.leaflet-control-layers,
.leaflet-bar {
  border-radius: 4px;
}

/* --- Buttons --- */
#generate-btn {
  display: block;
  width: 100%;
  padding: 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: #fff;
  background: var(--blue);
  border: none;
  border-radius: 7px;
  box-shadow: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

#generate-btn:hover {
  background: #2f89c5;
}

#generate-btn:disabled {
  background: #aaaaaa;
  box-shadow: none;
  cursor: not-allowed;
}

.download-btn {
  display: block;
  width: 100%;
  max-width: 320px;
  margin: 1rem auto;
  padding: 0.65rem;
  font-size: 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--blue);
  border: none;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.2s ease;
}

.download-btn:hover {
  background: #2f89c5;
}

.download-btn:disabled {
  background: #aaaaaa;
  cursor: not-allowed;
}

/* --- Status and Error --- */
.status, .error {
  padding: 0.75rem 1rem;
  border-radius: 6px;
  margin: 1rem 0;
  font-size: 0.95rem;
}

.status {
  background: var(--blue-soft);
  color: #1f5f89;
  border: 1px solid rgba(52, 152, 219, 0.35);
}

.error {
  background: #eeeeee;
  color: var(--danger);
  border: 1px solid rgba(80, 80, 80, 0.3);
}

/* --- Preview Navigation --- */
.preview-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.preview-nav button {
  padding: 0.4rem 0.8rem;
  font-size: 0.9rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--ink);
  cursor: pointer;
}

.preview-nav button:hover:not(:disabled) { background: var(--blue-soft); }
.preview-nav button:disabled { color: #aaaaaa; cursor: default; }

#card-counter {
  font-weight: 600;
  min-width: 100px;
  text-align: center;
}

/* --- Bingo Card Grid (Preview) --- */
.bingo-card-frame {
  width: 100%;
  margin: 0 auto 1rem;
}

.bingo-card {
  display: grid;
  border: 2px solid var(--ink);
  margin: 0 auto 1rem;
  background: var(--surface-strong);
  max-width: 100%;
  overflow: hidden;
  box-shadow: none;
}

.bingo-card-frame .bingo-card {
  margin-bottom: 0.45rem;
}

.bingo-cell {
  border: 1px solid rgba(60, 60, 60, 0.38);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px;
  overflow: hidden;
  min-height: 0;
}

.bingo-cell img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 2px;
  display: block;
}

.bingo-cell .common-name {
  font-size: 0.75em;
  font-weight: 600;
  line-height: 1.2;
  margin-top: 2px;
  word-break: break-word;
}

.bingo-cell .sci-name {
  font-size: 0.65em;
  font-style: italic;
  line-height: 1.2;
  color: var(--muted);
  word-break: break-word;
}

.bingo-cell.free-cell {
  font-size: 1.2em;
  font-weight: 700;
  color: var(--brand-dark);
}

/* Dynamic grid sizing for preview */
.bingo-card.grid-3 { grid-template-columns: repeat(3, 1fr); max-width: 480px; }
.bingo-card.grid-5 { grid-template-columns: repeat(5, 1fr); max-width: 600px; }
.bingo-card.grid-7 { grid-template-columns: repeat(7, 1fr); max-width: 700px; }
.bingo-card.grid-9 { grid-template-columns: repeat(9, 1fr); max-width: 720px; }

.bingo-metadata-footer {
  max-width: 100%;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
  text-align: center;
  overflow-wrap: break-word;
}

.bingo-metadata-footer.grid-3 { max-width: 480px; }
.bingo-metadata-footer.grid-5 { max-width: 600px; }
.bingo-metadata-footer.grid-7 { max-width: 700px; }
.bingo-metadata-footer.grid-9 { max-width: 720px; }

/* Loading skeleton */
.bingo-cell img.loading {
  background: #e6e6e6;
}

/* --- PDF Render Area (off-screen) --- */
.pdf-render-area {
  position: absolute;
  left: -9999px;
  top: 0;
}

/* --- PDF card (for html2canvas capture) --- */
.pdf-card {
  background: #fff;
  display: grid;
}

.pdf-card .bingo-cell img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.pdf-card-page {
  background: #fff;
  position: relative;
}

.pdf-card-title {
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  padding-top: 16px;
  padding-bottom: 8px;
  color: #333;
}

.site-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.55;
}

.site-footer a {
  color: var(--muted);
  font-weight: 400;
  text-decoration-color: rgba(111, 111, 111, 0.35);
  text-underline-offset: 0.18em;
}

.site-footer a:hover {
  color: var(--blue);
}

/* --- Utility --- */
.hidden { display: none !important; }

/* --- Responsive --- */
@media (max-width: 760px) {
  .container {
    padding: 1.5rem 1rem 2.25rem;
  }

  h1 {
    font-size: 2.25rem;
  }

  .app-info-toggle {
    width: 1.2rem;
    height: 1.2rem;
    font-size: 0.74rem;
  }

  fieldset {
    padding: 1rem;
  }

}

@media (max-width: 600px) {
  .container { padding: 1rem 0.85rem 2rem; }
  h1 { font-size: 1.85rem; }
  .species-pool-controls { grid-template-columns: 1fr; }
  .species-pool-controls input[type="number"] { text-align: left; }
  .filter-option-grid { grid-template-columns: 1fr; }
  .inline-field-grid { grid-template-columns: 1fr; }
  .grid-size-options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .checkbox-group { grid-template-columns: 1fr; }
  .boundary-action-row,
  .boundary-draw-actions {
    align-items: stretch;
  }
  .draw-boundary-button,
  .boundary-draw-actions button {
    width: 100%;
  }
  .boundary-map-search-controls {
    grid-template-columns: 1fr;
  }
  .preview-nav {
    flex-wrap: wrap;
    gap: 0.65rem;
  }
  .place-map-panel summary {
    grid-template-columns: auto minmax(0, 1fr);
  }
  .place-map {
    height: 280px;
    min-height: 280px;
  }
  .bingo-cell .common-name { font-size: 0.6em; }
  .bingo-cell .sci-name { font-size: 0.55em; }
}

@media (max-width: 340px) {
  h1 { font-size: 1.55rem; }
}
