/* Birdz. Colours are tokens so the light and dark themes share every rule. */
:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #efece5;
  --surface-3: #e6e2d9;
  --border: #dedad0;
  --text: #1c1f24;
  --muted: #646b76;
  --brand: #f6c445;
  --brand-hover: #f0b92b;
  --brand-ink: #1a1400;
  --brand-text: #8a5d00;
  --brand-soft: #fdf3d3;
  --ok: #17865a;
  --ok-soft: #dff4ea;
  --bad: #c9353b;
  --bad-soft: #fbe4e4;
  --shadow: 0 1px 2px rgb(30 25 10 / 0.05), 0 6px 20px rgb(30 25 10 / 0.06);
  --radius: 14px;
  --radius-sm: 9px;
  --font: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0e1116;
    --surface: #171b22;
    --surface-2: #1f242d;
    --surface-3: #2a303b;
    --border: #2c333f;
    --text: #e9ecf1;
    --muted: #98a1b0;
    --brand-text: #f6c445;
    --brand-soft: #33290c;
    --ok: #3ecf8e;
    --ok-soft: #12301f;
    --bad: #ff6b70;
    --bad-soft: #3a1719;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #0e1116;
  --surface: #171b22;
  --surface-2: #1f242d;
  --surface-3: #2a303b;
  --border: #2c333f;
  --text: #e9ecf1;
  --muted: #98a1b0;
  --brand-text: #f6c445;
  --brand-soft: #33290c;
  --ok: #3ecf8e;
  --ok-soft: #12301f;
  --bad: #ff6b70;
  --bad-soft: #3a1719;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.25);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: -0.025em;
  font-weight: 750;
}

h2 {
  font-size: 1.05rem;
  letter-spacing: -0.01em;
}

a {
  color: inherit;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--brand-text);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.bad {
  color: var(--bad);
}

.grow {
  flex: 1;
  min-width: 0;
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.row.center {
  justify-content: center;
}

/* ------------------------------------------------------------------ top bar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px max(16px, calc((100vw - 1148px) / 2));
  background: color-mix(in srgb, var(--bg) 85%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topnav a {
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  color: var(--muted);
}

.topnav a:hover {
  color: var(--text);
  background: var(--surface-2);
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}

.icon-btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

body.in-quiz .topbar {
  display: none;
}

/* --------------------------------------------------------------------- page */
.page {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 16px 80px;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

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

.back {
  display: inline-block;
  margin-bottom: 14px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
}

.back:hover {
  color: var(--text);
}

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

.section-title {
  margin: 32px 0 14px;
}

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 7px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}

.btn:hover {
  background: var(--surface-2);
}

.btn:active {
  transform: translateY(1px);
}

.btn.primary {
  background: var(--brand);
  border-color: transparent;
  color: var(--brand-ink);
}

.btn.primary:hover {
  background: var(--brand-hover);
}

.btn.danger {
  color: var(--bad);
}

.btn.danger:hover {
  background: var(--bad-soft);
  border-color: transparent;
}

.btn.ok {
  background: var(--ok-soft);
  border-color: transparent;
  color: var(--ok);
}

.btn.bad {
  background: var(--bad-soft);
  border-color: transparent;
  color: var(--bad);
}

.btn.small {
  min-height: 32px;
  padding: 4px 12px;
  font-size: 0.88rem;
}

.btn.big {
  min-height: 48px;
  padding: 10px 20px;
  font-size: 1.02rem;
  border-radius: 12px;
  width: 100%;
}

.btn:disabled,
.btn.disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand-text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
}

.link:hover {
  text-decoration-color: currentColor;
}

.pill {
  flex: none;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 0.8rem;
  font-weight: 650;
  font-style: normal;
}

/* ------------------------------------------------------------------- inputs */
.input {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.input:focus {
  outline: 2px solid var(--brand);
  outline-offset: 0;
  border-color: transparent;
}

.input.big {
  min-height: 50px;
  padding: 10px 16px;
  font-size: 1.05rem;
  border-radius: 12px;
}

textarea.input {
  resize: vertical;
  line-height: 1.5;
}

select.input {
  width: auto;
}

.inline {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 650;
  font-size: 0.92rem;
}

.label .muted {
  font-weight: 500;
}

.label output {
  font-variant-numeric: tabular-nums;
  color: var(--brand-text);
}

.hint {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.hint.bad {
  color: var(--bad);
}

.hint-block {
  padding: 14px;
  color: var(--muted);
  text-align: center;
}

.hint-block.bad {
  color: var(--bad);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin: 14px 0;
}

input[type='range'] {
  width: 100%;
  accent-color: var(--brand-hover);
  height: 24px;
  margin: 0;
}

.range-row {
  display: flex;
  align-items: center;
  gap: 14px;
}

.range-row output {
  min-width: 3ch;
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.seg {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  padding: 3px;
  background: var(--surface-2);
  border-radius: 11px;
}

.seg button {
  flex: 1 1 auto;
  min-height: 36px;
  padding: 6px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  white-space: nowrap;
}

.seg button:hover {
  color: var(--text);
}

.seg button.on {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.14);
}

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

.chip {
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  font-size: 0.88rem;
}

.chip:hover {
  color: var(--text);
  border-color: var(--muted);
}

.chip.on {
  background: var(--brand);
  border-color: transparent;
  color: var(--brand-ink);
}

.toggles {
  display: grid;
  gap: 14px;
  margin-top: 4px;
}

.toggle {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  cursor: pointer;
}

.toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch {
  flex: none;
  position: relative;
  width: 40px;
  height: 24px;
  margin-top: 1px;
  border-radius: 999px;
  background: var(--surface-3);
  transition: background 0.15s;
}

.switch::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
  transition: transform 0.15s;
}

.toggle input:checked + .switch {
  background: var(--brand-hover);
}

.toggle input:checked + .switch::after {
  transform: translateX(16px);
}

.toggle input:focus-visible + .switch {
  outline: 2px solid var(--brand-text);
  outline-offset: 2px;
}

.toggle-label {
  display: block;
  font-weight: 650;
}

/* --------------------------------------------------------------- home lists */
.list-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 18px;
}

.list-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.mosaic {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  aspect-ratio: 16 / 10;
  background: var(--surface-2);
}

.mosaic.n1 {
  grid-template: 1fr / 1fr;
}

.mosaic.n2 {
  grid-template-rows: 1fr;
}

.mosaic.n3 .tile:first-child {
  grid-row: span 2;
}

.mosaic .tile {
  overflow: hidden;
  min-height: 0;
}

.mosaic img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}

.list-card:hover .mosaic img {
  transform: scale(1.04);
}

.mosaic-empty {
  grid-column: 1 / -1;
  grid-row: 1 / -1;
  display: grid;
  place-items: center;
  color: var(--muted);
}

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

.list-card-body h2 a {
  text-decoration: none;
}

.list-card-body .row {
  margin-top: 8px;
}

.list-card-body .btn {
  flex: 1;
}

.empty {
  max-width: 600px;
  margin: 6vh auto 0;
  padding: 44px 28px;
  text-align: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: 20px;
}

.empty-art {
  display: inline-grid;
  place-items: center;
  width: 92px;
  height: 92px;
  margin-bottom: 18px;
  border-radius: 28px;
  overflow: hidden;
}

.empty-art img {
  width: 100%;
  height: 100%;
}

.empty h2 {
  font-size: 1.4rem;
  letter-spacing: -0.02em;
}

.empty p {
  margin: 10px auto 22px;
  max-width: 44ch;
}

/* -------------------------------------------------------------- list editor */
.title-input {
  width: 100%;
  padding: 2px 8px;
  margin-left: -9px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.1rem);
  font-weight: 750;
  letter-spacing: -0.025em;
  line-height: 1.2;
}

.title-input:hover {
  border-color: var(--border);
}

.title-input:focus {
  background: var(--surface);
  border-color: var(--border);
  outline: 2px solid var(--brand);
}

.add-panel {
  padding: 16px;
  margin-bottom: 22px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 14px;
  overflow-x: auto;
}

.tabs button {
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-weight: 650;
  white-space: nowrap;
}

.tabs button:hover {
  color: var(--text);
  background: var(--surface-2);
}

.tabs button.on {
  background: var(--text);
  color: var(--bg);
}

.tight {
  margin-bottom: 12px;
}

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

.results:empty {
  display: none;
}

.results.floating {
  position: absolute;
  z-index: 5;
  left: 0;
  right: 0;
  top: 100%;
  margin-top: 4px;
  padding: 4px;
  max-height: 280px;
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.place-picker {
  position: relative;
}

.chosen-place {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: 10px;
  background: var(--brand-soft);
  font-weight: 650;
}

.result,
.pick {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
}

.result:hover,
.pick:hover:not(:disabled) {
  background: var(--surface-2);
}

.result-photo {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 9px;
  overflow: hidden;
  background: var(--surface-2);
}

.result-photo img,
.result-photo .no-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.result-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.result-name {
  font-weight: 650;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-sub {
  color: var(--muted);
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result .pill {
  background: var(--brand);
  color: var(--brand-ink);
}

.result.added .pill {
  background: var(--ok-soft);
  color: var(--ok);
}

.region-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  margin: 20px 0 10px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 4px;
  max-height: 440px;
  overflow: auto;
}

.pick {
  border: 1px solid transparent;
}

.pick.on {
  background: var(--brand-soft);
}

.pick.in-list {
  opacity: 0.5;
  cursor: default;
}

.pick.in-list .check {
  visibility: hidden;
}

.check {
  flex: none;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 2px solid var(--border);
  border-radius: 7px;
  font-size: 0.8rem;
  font-weight: 800;
}

.pick.on .check {
  background: var(--brand);
  border-color: var(--brand);
  color: var(--brand-ink);
}

.report {
  display: grid;
  gap: 6px;
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-2);
}

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

.toolbar > .input {
  flex: 1;
  min-width: 180px;
  max-width: 340px;
}

.species-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 14px;
}

.species-card {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.species-photo {
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
}

.species-photo img,
.no-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.no-photo {
  background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 8px, var(--surface-3) 8px, var(--surface-3) 16px);
}

.remove {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgb(0 0 0 / 0.55);
  color: #fff;
  font-size: 0.78rem;
  opacity: 0;
  transition: opacity 0.12s;
}

.species-card:hover .remove,
.remove:focus-visible {
  opacity: 1;
}

@media (hover: none) {
  .remove {
    opacity: 1;
  }
}

.remove:hover {
  background: var(--bad);
}

.species-body {
  padding: 10px 12px 12px;
}

.species-name {
  font-weight: 700;
  line-height: 1.25;
}

.species-sci {
  color: var(--muted);
  font-style: italic;
  font-size: 0.86rem;
}

.species-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  font-size: 0.8rem;
}

.family {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acc {
  flex: none;
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.acc.good {
  background: var(--ok-soft);
  color: var(--ok);
}

.acc.mid {
  background: var(--brand-soft);
  color: var(--brand-text);
}

.acc.low {
  background: var(--bad-soft);
  color: var(--bad);
}

/* -------------------------------------------------------------------- setup */
.presets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.preset {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
}

.preset span {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.35;
}

.preset:hover {
  border-color: var(--muted);
}

.preset.on {
  border-color: var(--brand-hover);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand-hover);
}

.setup-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

.setup-main {
  display: grid;
  gap: 20px;
}

.group {
  display: grid;
  gap: 20px;
  padding: 20px;
}

.group > h2 {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.group .form-grid {
  margin: 0;
}

.setup-side {
  position: sticky;
  top: 76px;
}

.summary {
  display: grid;
  gap: 14px;
  padding: 20px;
}

.summary ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
  color: var(--muted);
}

.summary li {
  padding-left: 18px;
  position: relative;
}

.summary li::before {
  content: '';
  position: absolute;
  left: 2px;
  top: 0.55em;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--brand);
}

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

  .setup-side {
    position: sticky;
    top: auto;
    bottom: 12px;
    z-index: 10;
  }

  .summary ul,
  .summary h2 {
    display: none;
  }

  .summary {
    padding: 10px;
  }
}

/* --------------------------------------------------------------------- quiz */
.quiz {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
}

.quiz-top {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
}

.progress {
  flex: 1;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--brand);
  transition: width 0.3s;
}

.quiz-count {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.quiz-count b {
  color: var(--text);
}

.quiz-score {
  color: var(--muted);
  white-space: nowrap;
}

.quiz-score:empty {
  display: none;
}

.score-ok {
  color: var(--ok);
  font-weight: 750;
}

.streak {
  color: var(--brand-text);
  font-weight: 700;
}

.quiz-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  min-height: 0;
}

.stage {
  position: relative;
  display: grid;
  gap: 2px;
  min-height: 0;
  background: #07080a;
  overflow: hidden;
}

.stage.n2 {
  grid-template-columns: 1fr 1fr;
}

.stage.n3 {
  grid-template-columns: 1fr 1fr 1fr;
}

.stage.loading {
  place-items: center;
}

.stage-msg {
  place-self: center;
  display: grid;
  gap: 6px;
  padding: 24px;
  color: #d7dbe2;
  text-align: center;
}

.spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgb(255 255 255 / 0.18);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.shot {
  position: relative;
  min-width: 0;
  min-height: 0;
  padding: 0;
  border: 0;
  background: #07080a;
  overflow: hidden;
  cursor: zoom-in;
}

.shot-bg {
  position: absolute;
  inset: -40px;
  background-size: cover;
  background-position: center;
  filter: blur(30px) brightness(0.45) saturate(1.2);
}

.shot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: filter 0.35s, transform 0.35s;
}

.shot:focus-visible {
  outline-offset: -3px;
}

.fx-gray .shot,
.lightbox.fx-gray img {
  filter: grayscale(1);
}

.fx-blur .shot img,
.lightbox.fx-blur img {
  filter: blur(9px);
}

.fx-crop .shot img,
.lightbox.fx-crop img {
  transform: scale(2.4);
}

.timer {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 6px;
  background: rgb(255 255 255 / 0.14);
}

.timer-fill {
  height: 100%;
  background: var(--brand);
  transform-origin: left;
}

.timer-fill.low {
  background: #ff6b70;
}

.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px 20px 0;
  overflow-y: auto;
  border-left: 1px solid var(--border);
  background: var(--surface);
}

.prompt {
  font-size: 1.3rem;
  letter-spacing: -0.02em;
}

/* Stays in view so the next step is reachable when credits make the panel scroll. */
.panel-foot {
  position: sticky;
  bottom: 0;
  display: grid;
  gap: 10px;
  justify-items: center;
  margin-top: auto;
  padding: 10px 0 20px;
  background: var(--surface);
}

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

.choice {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 50px;
  padding: 9px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
  font-weight: 600;
  transition: border-color 0.1s, background 0.1s;
}

button.choice:hover {
  border-color: var(--brand-hover);
  background: var(--brand-soft);
}

.choice kbd {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: var(--surface-2);
  color: var(--muted);
  font: 700 0.8rem var(--font);
}

.choice .sci,
.suggestion .sci,
.your-answer .sci {
  display: block;
  color: var(--muted);
  font-weight: 500;
  font-size: 0.86rem;
}

.choices.done .choice {
  color: var(--muted);
}

.choice.right {
  border-color: var(--ok);
  background: var(--ok-soft);
  color: var(--text) !important;
}

.choice.right kbd {
  background: var(--ok);
  color: #fff;
}

.choice.wrong {
  border-color: var(--bad);
  background: var(--bad-soft);
  color: var(--text) !important;
}

.choice.wrong kbd {
  background: var(--bad);
  color: #fff;
}

.typeahead {
  display: grid;
  gap: 6px;
}

.suggestions {
  display: grid;
  gap: 2px;
}

.suggestion {
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  font-weight: 600;
}

.suggestion:hover {
  background: var(--surface-2);
}

.suggestion.on {
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px var(--brand-hover);
}

.verdict {
  align-self: flex-start;
  padding: 5px 14px;
  border-radius: 999px;
  font-weight: 750;
  font-size: 0.95rem;
}

.verdict.ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.verdict.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.answer-card {
  display: flex;
  align-items: center;
  gap: 14px;
}

.answer-photo {
  flex: none;
  width: 76px;
  height: 76px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-2);
}

.answer-photo img,
.answer-photo .no-photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.answer-name {
  font-size: 1.3rem;
  font-weight: 750;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.answer-sci {
  color: var(--muted);
}

.answer-family {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.86rem;
}

.your-answer {
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--bad-soft);
}

.credits {
  display: grid;
  gap: 10px;
}

.credit {
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}

.credit-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 4px;
}

.credit a {
  color: var(--brand-text);
  font-weight: 600;
}

.grade {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
}

.auto-bar {
  flex: none;
  height: 3px;
  margin: -12px 0 16px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.auto-bar div {
  height: 100%;
  background: var(--brand);
  transform-origin: left;
  animation: drain linear forwards;
}

@keyframes drain {
  from {
    transform: scaleX(1);
  }
  to {
    transform: scaleX(0);
  }
}

@media (max-width: 900px) {
  .quiz-body {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(220px, 46dvh) minmax(0, 1fr);
  }

  .panel {
    border-left: 0;
    border-top: 1px solid var(--border);
    padding: 16px 16px 0;
  }

  .panel-foot {
    padding-bottom: 16px;
  }

  .stage.n2,
  .stage.n3 {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 88%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
  }

  .stage .shot {
    scroll-snap-align: center;
  }

  .quiz-score .streak {
    display: none;
  }
}

/* ------------------------------------------------------------------ results */
.result-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 28px;
  padding: 26px;
}

.ring-track {
  fill: none;
  stroke: var(--surface-3);
  stroke-width: 10;
}

.ring-fill {
  fill: none;
  stroke: var(--brand);
  stroke-width: 10;
  stroke-linecap: round;
}

.ring-num {
  fill: var(--text);
  font: 800 26px var(--font);
  letter-spacing: -0.03em;
}

.ring-sub {
  fill: var(--muted);
  font: 600 10px var(--font);
}

.hero-text {
  flex: 1;
  min-width: 260px;
  display: grid;
  gap: 16px;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stat {
  display: grid;
  min-width: 96px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-2);
}

.stat b {
  font-size: 1.3rem;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat span {
  color: var(--muted);
  font-size: 0.82rem;
}

.results-page .group {
  margin-top: 20px;
}

.mixups {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.mixups li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.mixups li > span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mixups img,
.mixups .no-photo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  object-fit: cover;
}

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

.review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
}

.review {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.review-photo {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  padding: 0;
  border: 0;
  background: var(--surface-2);
  cursor: zoom-in;
}

.review-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  color: #fff;
  font-weight: 800;
  font-size: 0.85rem;
  box-shadow: 0 2px 6px rgb(0 0 0 / 0.35);
}

.review.bad {
  color: inherit;
}

.review.ok .badge {
  background: #17865a;
}

.review.bad .badge {
  background: #c9353b;
}

.review-body {
  padding: 10px 12px 12px;
}

.review-guess {
  margin-top: 6px;
  color: var(--bad);
  font-weight: 600;
  font-size: 0.88rem;
}

.review-link {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ----------------------------------------------------------- lightbox, toast */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: rgb(0 0 0 / 0.92);
  cursor: zoom-out;
}

.lightbox img {
  max-width: 100vw;
  max-height: 100dvh;
  object-fit: contain;
}

.lightbox-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 1;
  background: rgb(255 255 255 / 0.14);
  color: #fff;
}

.toasts {
  position: fixed;
  left: 50%;
  bottom: 22px;
  z-index: 60;
  display: grid;
  gap: 8px;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100vw - 32px);
}

.toast {
  padding: 10px 16px;
  border-radius: 12px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  box-shadow: var(--shadow);
  animation: rise 0.2s ease-out;
  transition: opacity 0.3s;
}

.toast.bad {
  background: var(--bad);
  color: #fff;
}

.toast.out {
  opacity: 0;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
}

@media (max-width: 560px) {
  .page {
    padding-top: 20px;
  }

  .page-head .row {
    width: 100%;
  }

  .species-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
  }

  .result-hero {
    justify-content: center;
    text-align: center;
  }

  .stat-row,
  .hero-text .row {
    justify-content: center;
  }
}

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

  .spinner {
    animation-duration: 1.2s !important;
  }
}
