:root {
  --ink: #1f2937;
  --muted: #4b5563;
  --bg: #f5f7ef;
  --card: rgba(255, 255, 255, 0.86);
  --line: #d8e1d0;
  --accent: #0f766e;
  --accent-soft: #99f6e4;
  --chip-bg: #ecfdf5;
  --shadow: 0 16px 40px rgba(2, 44, 34, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Space Grotesk", sans-serif;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  overscroll-behavior-y: contain;
}

body.modal-open {
  overflow: hidden;
}

.sky-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 15% 20%, rgba(153, 246, 228, 0.6), transparent 35%),
    radial-gradient(circle at 85% 15%, rgba(252, 211, 77, 0.45), transparent 30%),
    linear-gradient(180deg, #f0fdf4 0%, #f5f7ef 45%, #eef8ff 100%);
}

.container {
  width: min(1140px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2.2rem 0 0;
}

.hero {
  text-align: center;
  margin-bottom: 1.6rem;
  animation: floatIn 460ms ease-out;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  font-weight: 700;
  font-size: 0.74rem;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Fraunces", serif;
}

h1 {
  margin-top: 0.45rem;
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.05;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  padding: 1rem;
  margin-bottom: 1rem;
  animation: floatIn 560ms ease-out;
}

.toolbar label {
  font-weight: 700;
  color: var(--muted);
}

input[type="date"],
select,
button {
  height: 40px;
  border-radius: 10px;
  border: 1px solid #b7cbbf;
  padding: 0 0.75rem;
  font: inherit;
}

input[type="date"] {
  background: #fff;
  color: var(--ink);
}

select {
  background: #fff;
  color: var(--ink);
  min-width: 220px;
}

button {
  background: linear-gradient(135deg, #0f766e, #14b8a6);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: transform 140ms ease, filter 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  filter: brightness(1.04);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.2rem;
}

.stat-card {
  padding: 0.9rem 1rem;
  text-align: center;
}

.stat-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.stat-card strong {
  display: block;
  margin-top: 0.25rem;
  font-size: 1.6rem;
  font-family: "Fraunces", serif;
}

.birds-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.9rem;
}

.bird-card.card {
  background: transparent;
  overflow: hidden;
  border: 0;
  animation: riseIn 420ms ease both;
}

.bird-photo-wrap {
  position: relative;
  height: 280px;
  overflow: hidden;
  background: linear-gradient(120deg, #dcfce7, #dbeafe);
  cursor: pointer;
}

.bird-photo-wrap:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.65);
  outline-offset: 3px;
}

.bird-photo-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to top,
    rgba(0, 0, 0, 0.74) 0%,
    rgba(0, 0, 0, 0.42) 34%,
    rgba(0, 0, 0, 0.1) 58%,
    rgba(0, 0, 0, 0) 76%
  );
  pointer-events: none;
}

.bird-photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 18%;
  display: none;
}

.confidence-badge {
  background: rgba(10, 20, 18, 0.6);
  border: 1px solid rgba(185, 236, 220, 0.45);
  color: #f3fffb;
  backdrop-filter: blur(2px);
  border-radius: 999px;
  padding: 0.22rem 0.58rem;
  font-size: 0.83rem;
  font-weight: 700;
}

.play-btn {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.52);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(6px);
  transition: background 140ms ease, transform 140ms ease;
}

.play-btn:hover {
  background: rgba(15, 118, 110, 0.82);
  transform: scale(1.1);
}

.play-btn .icon-pause {
  display: none;
}

.play-btn--playing {
  background: rgba(15, 118, 110, 0.9);
}

.play-btn--playing .icon-play {
  display: none;
}

.play-btn--playing .icon-pause {
  display: block;
}

.play-btn--loading {
  cursor: wait;
  opacity: 0.8;
}

.play-btn--loading .icon-play,
.play-btn--loading .icon-pause {
  display: none;
}

.play-btn--loading::after {
  content: "";
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.65s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.photo-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #e8fff8;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.bird-content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  padding: 0.8rem 0.9rem 1rem;
}

.com-name {
  color: #ffffff;
  font-size: 1.2rem;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.55);
}

.sci-name {
  margin: 0.15rem 0 0.7rem;
  color: rgba(255, 255, 255, 0.88);
  font-style: italic;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.48);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.8rem;
}

.chip {
  background: rgba(10, 20, 18, 0.6);
  border: 1px solid rgba(185, 236, 220, 0.45);
  color: #f3fffb;
  backdrop-filter: blur(2px);
  border-radius: 999px;
  padding: 0.22rem 0.58rem;
  font-size: 0.83rem;
  font-weight: 700;
}

.empty-state {
  padding: 1.2rem;
  text-align: center;
  color: var(--muted);
}

.chart-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.chart-modal[hidden] {
  display: none;
}

.chart-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 22, 18, 0.56);
  backdrop-filter: blur(8px);
}

.chart-panel {
  position: relative;
  width: min(980px, 100%);
  max-height: min(88vh, 760px);
  padding: 1.2rem 1.2rem 1.4rem;
  overflow: auto;
}

.chart-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
}

.chart-subtitle,
.chart-message {
  margin: 0.45rem 0 0;
  color: var(--muted);
}

.hourly-chart {
  display: grid;
  grid-template-columns: repeat(24, minmax(20px, 1fr));
  gap: 0.35rem;
  align-items: end;
  min-height: 320px;
  margin-top: 1rem;
  padding: 1rem 0.25rem 0;
  border-top: 1px solid var(--line);
}

.hour-bar-wrap {
  display: grid;
  gap: 0.35rem;
  justify-items: center;
}

.hour-bar-track {
  width: 100%;
  height: 220px;
  display: flex;
  align-items: end;
  justify-content: center;
  padding: 0 0.1rem;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(153, 246, 228, 0.12), rgba(15, 118, 110, 0.04));
}

.hour-bar {
  width: 100%;
  border-radius: 999px;
  min-height: 0;
  background: linear-gradient(180deg, #14b8a6, #0f766e);
  box-shadow: 0 10px 18px rgba(15, 118, 110, 0.18);
}

.hour-bar-wrap strong {
  font-size: 0.8rem;
}

.hour-bar-wrap span {
  font-size: 0.73rem;
  color: var(--muted);
}

@keyframes floatIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes riseIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 640px) {
  .container {
    width: calc(100% - 1rem);
    padding-top: 1.2rem;
  }

  .bird-photo-wrap {
    height: 230px;
  }

  .toolbar {
    padding: 0.85rem;
  }

  .chart-panel {
    padding-top: 3.9rem;
  }

  .hourly-chart {
    grid-template-columns: repeat(12, minmax(24px, 1fr));
    min-height: auto;
  }

  .hour-bar-track {
    height: 140px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

.location-map {
  height: 300px;
  border-radius: 1rem;
  overflow: hidden;
  margin-top: 0.9rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
}

.site-footer {
  text-align: center;
  padding: 0 1rem 2rem;
  margin-top: 0.9rem;
  color: rgba(0, 0, 0, 0.45);
  font-size: 0.85rem;
  line-height: 1.8;
}

.site-footer a {
  color: rgba(0, 0, 0, 0.6);
  text-decoration: underline;
}

.site-footer a:hover {
  color: rgba(0, 0, 0, 0.85);
}

.lang-toggle {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 30;
  background: none;
  border: none;
  padding: 0;
  display: flex;
  cursor: pointer;
  transition: transform 140ms ease, opacity 140ms ease;
}

.lang-toggle:hover {
  transform: translateY(-1px);
  opacity: 0.85;
  filter: none;
}

.lang-toggle svg {
  display: block;
  border-radius: 3px;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
}
