:root {
  color-scheme: light;
  --bg: #f6f8f4;
  --panel: #ffffff;
  --text: #16211c;
  --muted: #64736a;
  --line: #d8e0da;
  --accent: #16624f;
  --accent-strong: #0d493a;
  --warning: #9a5b16;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app-page {
  min-height: 100vh;
}

.cover-page {
  min-height: 100svh;
  overflow-x: hidden;
  background: #111612;
}

.cover-shell {
  position: relative;
  min-height: 100svh;
  isolation: isolate;
}

.cover-image,
.cover-shade {
  position: absolute;
  inset: 0;
}

.cover-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.cover-shade {
  z-index: 1;
  background:
    linear-gradient(180deg, rgb(6 12 10 / 0.32), rgb(6 12 10 / 0.1) 36%, rgb(6 12 10 / 0.82) 100%),
    linear-gradient(90deg, rgb(6 12 10 / 0.56), rgb(6 12 10 / 0.08) 52%, rgb(6 12 10 / 0.38));
}

.cover-content {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 100svh;
  flex-direction: column;
  justify-content: space-between;
  gap: 32px;
  padding: 34px;
  color: #fffdf6;
}

.cover-title {
  max-width: 660px;
  text-shadow: 0 2px 18px rgb(0 0 0 / 0.32);
}

.cover-title h1 {
  font-size: 4rem;
  line-height: 0.95;
}

.cover-title p {
  margin-top: 10px;
  color: #f0dfc7;
  font-size: 1.05rem;
  font-weight: 700;
}

.login-form {
  display: grid;
  width: min(760px, 100%);
  gap: 10px;
  align-self: center;
  margin-bottom: 8px;
}

.login-form label {
  color: #f8ead4;
  text-shadow: 0 1px 10px rgb(0 0 0 / 0.42);
}

.login-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.login-row input {
  min-width: 0;
  border-color: rgb(255 250 241 / 0.72);
  background: rgb(255 250 241 / 0.9);
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.18);
}

.login-row button {
  min-width: 112px;
  background: #c65f2a;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.18);
}

.login-row button:hover {
  background: #a94c1f;
}

.shell {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.shell.wide {
  width: min(1120px, calc(100% - 32px));
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 2rem;
  line-height: 1.1;
  font-weight: 720;
}

h2 {
  font-size: 1.2rem;
}

.eyebrow {
  margin-bottom: 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.muted {
  margin-top: 8px;
  color: var(--muted);
}

.panel,
.player-band {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgb(22 33 28 / 0.04);
}

.panel {
  padding: 20px;
}

.upload-form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
}

input {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--text);
  font: inherit;
  background: #fff;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  padding: 10px 14px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

button:hover,
.button-link:hover {
  background: var(--accent-strong);
}

button:disabled {
  cursor: wait;
  opacity: 0.78;
}

.button-secondary {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent);
}

.button-secondary:hover {
  background: #eef5f1;
}

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

.logout-form {
  margin: 0;
}

.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 800;
  background: #fff;
}

.analysis-progress {
  display: grid;
  gap: 12px;
  overflow: hidden;
  border: 1px solid #cddbd3;
  border-radius: 8px;
  padding: 16px;
  background:
    linear-gradient(135deg, rgb(22 98 79 / 0.08), rgb(198 95 42 / 0.11)),
    #fbfdf9;
}

.analysis-progress-copy {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px 16px;
}

.analysis-progress-copy strong {
  color: var(--accent-strong);
  font-size: 1rem;
}

.analysis-progress-copy span {
  color: var(--warning);
  font-size: 0.92rem;
  font-weight: 800;
}

.analysis-progress-track {
  position: relative;
  overflow: hidden;
  height: 32px;
  border: 1px solid rgb(13 73 58 / 0.24);
  border-radius: 999px;
  background: #e8efe9;
  box-shadow: inset 0 1px 5px rgb(22 33 28 / 0.12);
}

.analysis-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 48%;
  border-radius: inherit;
  background:
    linear-gradient(90deg, #16624f, #c65f2a, #16624f),
    repeating-linear-gradient(45deg, rgb(255 255 255 / 0.2) 0 10px, transparent 10px 20px);
  box-shadow: 0 0 22px rgb(198 95 42 / 0.28);
  animation: analysis-sweep 1.35s ease-in-out infinite;
}

.analysis-progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgb(255 255 255 / 0.5), transparent);
  animation: analysis-shine 1.35s linear infinite;
}

.upload-form[aria-busy="true"] .analysis-progress {
  animation: analysis-pulse 1.8s ease-in-out infinite;
}

@keyframes analysis-sweep {
  0% {
    transform: translateX(-52%);
  }

  50% {
    transform: translateX(68%);
  }

  100% {
    transform: translateX(160%);
  }
}

@keyframes analysis-shine {
  0% {
    transform: translateX(-120%);
  }

  100% {
    transform: translateX(120%);
  }
}

@keyframes analysis-pulse {
  0%,
  100% {
    box-shadow: 0 1px 2px rgb(22 33 28 / 0.04);
  }

  50% {
    box-shadow: 0 14px 32px rgb(22 98 79 / 0.14);
  }
}

.player-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 16px;
  align-items: center;
  padding: 14px;
  margin-bottom: 18px;
}

audio {
  width: 100%;
}

.search {
  min-height: 40px;
}

.summary-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.species-chip {
  min-height: 38px;
  gap: 10px;
  background: #eaf2ed;
  color: var(--accent-strong);
}

.species-chip:hover {
  background: #dbe9e1;
}

.species-chip span {
  min-width: 24px;
  border-radius: 999px;
  background: #fff;
  padding: 2px 7px;
}

.event-list {
  display: grid;
  gap: 8px;
}

.event-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 84px;
  gap: 16px;
  align-items: center;
  width: 100%;
  min-height: 58px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  text-align: left;
}

.event-row:hover {
  background: #f3f8f5;
}

.time {
  color: var(--warning);
  font-weight: 800;
}

.bird {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.bird strong,
.bird em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bird em {
  color: var(--muted);
  font-size: 0.9rem;
  font-style: normal;
}

.confidence {
  justify-self: end;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.empty-state {
  display: grid;
  gap: 8px;
  min-height: 160px;
  place-content: center;
  text-align: center;
}

.hidden {
  display: none;
}

@media (max-width: 720px) {
  .cover-content {
    padding: 24px 18px 20px;
  }

  .cover-title h1 {
    font-size: 2.7rem;
  }

  .cover-title p {
    font-size: 1rem;
  }

  .login-row {
    grid-template-columns: 1fr;
  }

  .analysis-progress {
    padding: 14px;
  }

  .analysis-progress-track {
    height: 28px;
  }

  .page-header,
  .player-band {
    grid-template-columns: 1fr;
    display: grid;
  }

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

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

  .event-row {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .confidence {
    justify-self: start;
  }
}

@media (max-width: 360px) {
  .cover-title h1 {
    font-size: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .analysis-progress-fill,
  .analysis-progress-fill::after,
  .upload-form[aria-busy="true"] .analysis-progress {
    animation: none;
  }

  .analysis-progress-fill {
    width: 100%;
  }
}
