:root,
html[data-theme="light"] {
  color-scheme: light;
  --ink: #152018;
  --muted: #3f4a42;
  --night: #f7f3ea;
  --forest: #ebe6da;
  --moss: #d4e0d0;
  --amber: #8a5208;
  --line: rgba(21, 32, 24, 0.22);
  --danger: #9b3822;
  font-family: "Avenir Next", Avenir, "Segoe UI", sans-serif;
  font-size: 106.25%;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f2ead8;
  --muted: #a8ad9d;
  --night: #0b100d;
  --forest: #142019;
  --moss: #263d2d;
  --amber: #e8a43a;
  --line: rgba(242, 234, 216, 0.18);
  --danger: #cf6b4f;
  font-size: 100%;
}

:root .ledger-chip,
html[data-theme="light"] .ledger-chip {
  font-size: 0.64rem;
}

html[data-theme="light"] .ledger-chip__value {
  font-size: 0.9rem;
}

html[data-theme="light"] .moments-calendar__stats {
  font-size: 0.58rem;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--night);
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  background-color: var(--night);
  background-image:
    linear-gradient(rgba(21, 32, 24, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(21, 32, 24, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
}

html[data-theme="dark"] body {
  background-image:
    linear-gradient(rgba(242, 234, 216, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 234, 216, 0.035) 1px, transparent 1px);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0.75rem;
  z-index: 200;
  padding: 0.55rem 0.9rem;
  color: var(--night);
  background: var(--amber);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
}

.skip-link:focus {
  left: 1rem;
}

button,
a {
  font: inherit;
}

a {
  color: var(--amber);
  text-underline-offset: 0.2em;
}

.utility-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  min-height: 54px;
  padding: 0.55rem 4vw 0.65rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.72rem;
  letter-spacing: 0.16em;
}

.utility-bar__aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.4rem;
  margin-left: auto;
  padding-top: 0.05rem;
}

.utility-bar__ledger {
  display: flex;
  justify-content: flex-end;
}

.site-brand {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-signed-in {
  margin: 0;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--amber);
  font-weight: 600;
}

.ledger-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 0.35rem;
  padding: 0.28rem 0.5rem;
  border-bottom: 1px solid rgba(232, 164, 58, 0.35);
  color: var(--muted);
  font-size: 0.56rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
}

.ledger-chip__value {
  font-size: 0.78rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: rgba(232, 164, 58, 0.78);
  letter-spacing: 0.04em;
}

.eyebrow {
  font-weight: 700;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.16em;
}

.eyebrow:hover {
  color: var(--ink);
  text-decoration: underline;
}

.eyebrow[aria-current="page"] {
  color: var(--ink);
}

.access-pill {
  padding: 0.45rem 0.65rem;
  color: var(--muted);
  border: 1px solid var(--line);
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 1.5rem;
  align-items: center;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.site-nav a[aria-current="page"],
.site-nav a:hover {
  color: var(--ink);
}

.site-nav a:hover {
  text-decoration: underline;
}

.theme-toggle,
.admin-open {
  min-height: 44px;
  padding: 0.45rem 0.75rem;
  color: var(--amber);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: transparent;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  white-space: nowrap;
}

.theme-toggle:hover,
.admin-open:hover {
  color: var(--night);
  background: var(--amber);
}

.theme-toggle[aria-pressed="true"] {
  color: var(--night);
  background: var(--amber);
}

.admin-dialog {
  width: min(68rem, calc(100vw - 2rem));
  max-height: min(52rem, calc(100dvh - 2rem));
  padding: 0;
  color: var(--ink);
  border: 1px solid var(--amber);
  background: var(--night);
  box-shadow: 20px 20px 0 rgb(0 0 0 / 45%);
}

html[data-theme="light"] .admin-dialog {
  box-shadow: 16px 16px 0 rgb(21 32 24 / 12%);
}

.admin-dialog::backdrop {
  background: rgb(3 7 4 / 82%);
  backdrop-filter: blur(3px);
}

.admin-dialog[open] {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.admin-dialog [hidden] {
  display: none;
}

.admin-header,
.admin-toolbar,
.admin-control,
.admin-section-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}

.admin-header {
  position: sticky;
  z-index: 5;
  top: 0;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--line);
  background: var(--night);
}

.admin-header h2,
.admin-control h2,
.admin-section h2 {
  margin: 0.25rem 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 400;
}

.admin-header h2 {
  font-size: 1.8rem;
}

.admin-kicker {
  color: var(--amber);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.admin-close,
.admin-secondary {
  min-height: 44px;
  padding: 0.55rem 0.9rem;
  color: var(--muted);
  border: 1px solid var(--line);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.05em;
}

.admin-close:hover,
.admin-secondary:hover {
  color: var(--ink);
  border-color: var(--amber);
  background: transparent;
}

.admin-close:focus-visible,
.admin-secondary:focus-visible,
.admin-primary:focus-visible,
.admin-danger:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 2px;
}

.admin-primary,
.admin-danger {
  min-height: 44px;
  min-width: 9.5rem;
  padding: 0.6rem 1rem;
  border: 1px solid transparent;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.admin-primary {
  color: var(--night);
  background: var(--amber);
}

.admin-primary:hover {
  color: var(--night);
  background: color-mix(in srgb, var(--amber) 82%, var(--ink));
}

.admin-primary:disabled,
.admin-danger:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

#admin-login {
  width: min(28rem, 100%);
  margin: 0 auto;
  padding: clamp(2rem, 7vw, 5rem) 1.5rem;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

.admin-intro {
  margin: 0 0 2rem;
  color: var(--muted);
  line-height: 1.6;
}

.admin-login-form {
  display: grid;
  gap: 0.65rem;
}

.admin-login-form label,
.admin-log-controls label {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-login-form input,
.admin-log-controls select {
  min-height: 44px;
  padding: 0.7rem 0.8rem;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 0;
  background: var(--forest);
  font: inherit;
}

.admin-login-form input:focus,
.admin-log-controls select:focus {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.admin-login-form button {
  margin-top: 0.75rem;
}

.admin-message {
  min-height: 1.4rem;
  margin: 1rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

#admin-dashboard {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.admin-dashboard-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 1.5rem;
}

.admin-dashboard-footer {
  flex-shrink: 0;
  margin-top: auto;
  padding: 0.85rem 1.5rem 1.25rem;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--night) 92%, var(--forest));
}

.admin-action-status {
  margin: 0;
  font-size: 0.82rem;
}

.admin-toolbar {
  padding-bottom: 1.25rem;
}

.admin-alert {
  margin-bottom: 1.25rem;
  padding: 0.85rem 1rem;
  border: 1px solid color-mix(in srgb, var(--amber) 55%, var(--line));
  background: color-mix(in srgb, var(--amber) 12%, var(--night));
  line-height: 1.55;
}

.admin-alert strong {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--amber);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.admin-alert p {
  margin: 0 0 0.65rem;
  color: var(--ink);
  font-size: 0.84rem;
}

.admin-alert p:last-child {
  margin-bottom: 0;
}

html[data-theme="dark"] .admin-alert {
  background: color-mix(in srgb, var(--amber) 14%, var(--forest));
}

.admin-toolbar strong {
  display: block;
  margin-top: 0.25rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.5rem;
  font-weight: 400;
}

.admin-toolbar strong[data-state="active"],
.admin-firebase[data-state="active"] {
  color: #8bbf72;
}

.admin-toolbar strong[data-state="inactive"],
.admin-firebase[data-state="inactive"] {
  color: var(--danger);
}

.admin-actions,
.admin-log-controls {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.admin-section--feeds > h2 {
  margin: 0 0 1rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.25rem;
  font-weight: 400;
}

.admin-feed-grid {
  display: grid;
  gap: 0.85rem;
}

@media (min-width: 720px) {
  .admin-feed-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.admin-field-trip-grid {
  display: grid;
  gap: 1.25rem;
}

@media (min-width: 720px) {
  .admin-field-trip-grid {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 0.8fr);
    align-items: start;
  }
}

.admin-ir-mode {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin: 0.75rem 0;
}

.admin-ir-mode label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
}

.admin-gpio-count {
  margin: 0.5rem 0 0;
  font-size: 0.88rem;
}

.admin-gpio-wiring-visual {
  margin: 0.75rem 0 1rem;
}

.admin-gpio-figure {
  margin: 0;
  border: 1px solid var(--line);
  background: color-mix(in srgb, #0f1410 40%, var(--forest));
  overflow: hidden;
}

.admin-gpio-photo {
  display: block;
  width: 100%;
  height: auto;
  max-height: min(52vh, 520px);
  object-fit: contain;
}

.admin-gpio-caption {
  margin: 0;
  padding: 0.65rem 0.85rem;
  font-size: 0.88rem;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.admin-gpio-callouts {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.75rem;
}

@media (min-width: 720px) {
  .admin-gpio-callouts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.admin-gpio-callout {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--forest) 58%, transparent);
}

.admin-gpio-callout-name {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.98rem;
  margin-bottom: 0.25rem;
}

.admin-gpio-callout-pins {
  display: block;
  font-size: 0.78rem;
  font-family: var(--font-mono, ui-monospace, monospace);
  color: #8bbf72;
  margin-bottom: 0.2rem;
}

.admin-gpio-callout-role {
  display: block;
  font-size: 0.85rem;
  line-height: 1.4;
  color: color-mix(in srgb, var(--ink) 88%, var(--muted));
}

.admin-gpio-header {
  display: flex;
  justify-content: center;
  gap: 0.45rem;
  margin: 0.75rem 0 1rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--forest) 48%, transparent);
}

.admin-gpio-header-col {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.admin-gpio-header-pin {
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 0.05rem;
  min-width: 3.1rem;
  padding: 0.2rem 0.15rem;
  border: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  font-size: 0.62rem;
  line-height: 1.15;
  text-align: center;
  color: var(--muted);
}

.admin-gpio-header-pin--empty {
  opacity: 0.35;
}

.admin-gpio-header-pin--used {
  color: var(--ink);
  border-color: color-mix(in srgb, var(--moss) 45%, var(--line));
  background: color-mix(in srgb, var(--moss) 10%, transparent);
}

.admin-gpio-header-pin--used[data-active="true"] {
  border-color: #8bbf72;
  background: color-mix(in srgb, #8bbf72 22%, transparent);
  box-shadow: 0 0 10px color-mix(in srgb, #8bbf72 35%, transparent);
}

.admin-gpio-header-num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.admin-gpio-header-bcm {
  font-family: var(--font-mono, ui-monospace, monospace);
}

.admin-gpio-header-sig {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.admin-gpio-board {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.admin-gpio-board-head {
  padding: 0.85rem 1rem;
  border: 1px dashed var(--line);
  background: color-mix(in srgb, var(--forest) 55%, transparent);
}

.admin-gpio-board-title {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.15rem;
  margin-bottom: 0.35rem;
}

.admin-gpio-row {
  display: grid;
  grid-template-columns: minmax(6.5rem, 1fr) minmax(2.5rem, auto) minmax(0, 2.2fr);
  gap: 0.65rem 0.75rem;
  align-items: stretch;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--forest) 62%, transparent);
}

@media (max-width: 560px) {
  .admin-gpio-row {
    grid-template-columns: 1fr;
  }

  .admin-gpio-signal {
    display: none;
  }
}

.admin-gpio-pi-side {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding-right: 0.5rem;
  border-right: 2px solid color-mix(in srgb, var(--moss) 35%, var(--line));
}

.admin-gpio-bcm {
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}

.admin-gpio-bcm[data-active="true"] {
  color: #8bbf72;
  text-shadow: 0 0 12px color-mix(in srgb, #8bbf72 45%, transparent);
}

.admin-gpio-physical {
  font-size: 0.78rem;
  color: var(--muted);
}

.admin-gpio-signal {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

.admin-gpio-device-name {
  display: block;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1rem;
  margin-bottom: 0.25rem;
}

.admin-gpio-help {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
  color: color-mix(in srgb, var(--ink) 88%, var(--muted));
}

.admin-gpio-footnote {
  margin: 0.85rem 0 0;
  color: var(--muted);
}

.admin-control,
.admin-section {
  padding: 1.25rem;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--forest) 76%, transparent);
}

.admin-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.admin-control[data-state="running"] {
  border-color: color-mix(in srgb, #8bbf72 45%, var(--line));
}

.admin-control[data-state="stopped"] {
  border-color: color-mix(in srgb, var(--danger) 35%, var(--line));
}

.admin-feed-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.1rem;
  font-weight: 400;
}

.admin-control[data-state="running"] .admin-feed-title::before,
.admin-control[data-state="stopped"] .admin-feed-title::before {
  flex-shrink: 0;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  content: "";
}

.admin-control[data-state="running"] .admin-feed-title::before {
  background: #8bbf72;
  box-shadow: 0 0 0 3px color-mix(in srgb, #8bbf72 28%, transparent);
}

.admin-control[data-state="stopped"] .admin-feed-title::before {
  background: var(--muted);
}

.admin-feed-state {
  margin: 0.45rem 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.5;
}

.admin-danger {
  color: var(--ink);
  background: var(--danger);
}

.admin-danger:hover {
  color: var(--night);
  background: color-mix(in srgb, var(--danger) 78%, var(--ink));
}

.admin-section {
  margin-top: 1rem;
}

.admin-section > h2,
.admin-section-heading {
  margin-bottom: 1rem;
}

.admin-service-grid,
.admin-metric-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1px;
  border: 1px solid var(--line);
  background: var(--line);
}

.admin-service,
.admin-metric {
  min-width: 0;
  padding: 1rem;
  background: var(--night);
}

.admin-service span,
.admin-metric span {
  display: block;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-overflow: ellipsis;
  text-transform: uppercase;
}

html[data-theme="light"] .admin-service span,
html[data-theme="light"] .admin-metric span {
  font-size: 0.74rem;
}

.admin-service strong,
.admin-metric strong {
  display: block;
  margin-top: 0.55rem;
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
}

.admin-service[data-state="active"] strong {
  color: #8bbf72;
}

.admin-service:not([data-state="active"]) strong {
  color: var(--danger);
}

.admin-firebase {
  overflow-wrap: anywhere;
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.6;
}

.admin-section small {
  color: var(--muted);
}

.admin-log-controls select {
  min-width: 9rem;
}

.admin-logs pre {
  max-height: 19rem;
  margin: 0;
  padding: 1rem;
  overflow: auto;
  color: #d4dccf;
  border: 1px solid var(--line);
  background: #050806;
  font: 0.78rem/1.6 "SFMono-Regular", Consolas, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

html[data-theme="light"] .admin-logs pre {
  color: #1a241c;
  background: #ebe6da;
}

@media (prefers-reduced-motion: reduce) {
  .admin-dialog::backdrop {
    backdrop-filter: none;
  }
}

main {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 7rem) 4vw 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(240px, 0.72fr) minmax(0, 1.6fr);
  gap: clamp(2rem, 6vw, 7rem);
  align-items: center;
}

.intro {
  max-width: 34rem;
}

.live-label {
  display: inline-flex;
  gap: 0.55rem;
  align-items: center;
  margin-bottom: 1.25rem;
  color: var(--amber);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.live-label > span {
  font-size: 0.65rem;
  animation: pulse 1.8s steps(2, end) infinite;
}

h1 {
  max-width: 9ch;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.6rem, 7vw, 7.8rem);
  font-weight: 400;
  line-height: 0.86;
  letter-spacing: -0.055em;
}

h1 .accent {
  display: block;
  margin-left: 0.55em;
  color: var(--amber);
  font-style: italic;
}

.lede {
  max-width: 34rem;
  margin: 2.2rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.65;
}

.player-shell {
  position: relative;
  border: 1px solid var(--line);
  background: #050806;
  box-shadow: 18px 18px 0 var(--moss);
}

.video-stage {
  position: relative;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #050806;
}

video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.offline-panel {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 2rem;
  text-align: center;
  background: var(--forest);
}

.offline-panel[hidden] {
  display: none;
}

.owl-mark {
  display: grid;
  width: 4.4rem;
  height: 4.4rem;
  place-items: center;
  margin-bottom: 1.2rem;
  color: var(--amber);
  border: 2px solid var(--amber);
  border-radius: 50% 50% 42% 42%;
  font-family: Georgia, serif;
  font-size: 2.6rem;
  line-height: 1;
}

.offline-panel h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  font-weight: 400;
}

.offline-panel p {
  max-width: 34rem;
  margin: 0.8rem 0 1.5rem;
  color: var(--muted);
  line-height: 1.5;
}

button {
  padding: 0.8rem 1.1rem;
  color: var(--night);
  font-weight: 800;
  border: 0;
  background: var(--amber);
  cursor: pointer;
}

button:hover {
  background: var(--ink);
}

button:focus-visible,
a:focus-visible,
video:focus-visible {
  outline: 3px solid var(--amber);
  outline-offset: 4px;
}

.player-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  min-height: 58px;
  padding: 0.75rem 1rem;
  border-top: 1px solid var(--line);
}

.player-meta small {
  color: var(--muted);
  letter-spacing: 0.05em;
}

.camera-toggle {
  display: inline-flex;
  gap: 0.35rem;
  padding: 0.2rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.25);
}

.camera-source {
  border: 0;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.camera-source[aria-pressed="true"] {
  color: var(--ink);
  background: var(--amber);
}

.camera-source:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

.audio-controls {
  display: inline-flex;
  gap: 0.6rem;
  align-items: center;
}

.audio-meter {
  width: 5.5rem;
  height: 0.45rem;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
}

.audio-meter-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--amber);
  /* The bar is redrawn every animation frame; a short transition keeps a
     peaky waveform from strobing without hiding the peak itself. */
  transition: width 80ms linear;
}

/* The meter already shows the level, so the wording is for screen readers
   only; printed beside the player it just repeated the speaker icon. */
.audio-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.status {
  display: inline-flex;
  gap: 0.65rem;
  align-items: center;
  font-size: 0.84rem;
  font-weight: 700;
}

.status-dot {
  width: 0.58rem;
  height: 0.58rem;
  border-radius: 50%;
  background: var(--amber);
}

.status-dot.online {
  background: #8bbf72;
}

.status-dot.offline {
  background: var(--danger);
}

.diagnostics {
  margin-top: clamp(4rem, 7vw, 7rem);
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--forest) 72%, transparent);
}

.diagnostics-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 1.5rem;
  padding: 1.4rem clamp(1.25rem, 3vw, 2.4rem);
  border-bottom: 1px solid var(--line);
}

.diagnostics-label,
.diagnostics-key {
  color: var(--amber);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.15em;
}

.diagnostics-header h2 {
  margin: 0.35rem 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.8rem, 3vw, 2.5rem);
  font-weight: 400;
}

.diagnostics-state {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: right;
}

.diagnostics-controls {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.temperature-toggle {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
}

.temperature-unit {
  min-width: 2.6rem;
  padding: 0.45rem 0.7rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
}

.temperature-unit[aria-pressed="true"] {
  background: var(--amber);
  color: var(--forest);
}

.temperature-unit:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: -3px;
}

.diagnostics-dot {
  flex: 0 0 auto;
  width: 0.58rem;
  height: 0.58rem;
  border-radius: 50%;
  background: var(--amber);
}

.diagnostics[data-state="online"] .diagnostics-dot {
  background: #8bbf72;
}

.diagnostics[data-state="degraded"] .diagnostics-dot,
.diagnostics[data-state="offline"] .diagnostics-dot {
  background: var(--danger);
}

.diagnostics-groups {
  display: grid;
}

.diagnostics-row-label {
  padding: 0.75rem clamp(1.25rem, 3vw, 2.4rem);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.diagnostics-row-label:not(:first-child) {
  border-top: 1px solid var(--line);
}

.diagnostics-row {
  display: grid;
}

.diagnostics-row-habitat {
  grid-template-columns: repeat(4, 1fr);
}

.diagnostics-row-system {
  grid-template-columns: repeat(4, 1fr);
}

.diagnostics-metric {
  position: relative;
  min-width: 0;
  padding: clamp(1.25rem, 3vw, 2.4rem);
  border-right: 1px solid var(--line);
}

.diagnostics-row .diagnostics-metric:last-child {
  border-right: 0;
}

.diagnostics-metric p {
  margin: 1.4rem 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.45rem, 2.8vw, 2.5rem);
}

.diagnostics-sparkline {
  display: block;
  width: 100%;
  height: 2.5rem;
  margin-top: 1rem;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--amber);
  cursor: pointer;
}

.diagnostics-sparkline:disabled {
  color: var(--muted);
  cursor: default;
  opacity: 0.55;
}

/* Global "button:hover" fills with --ink, which would bury the trend line in
   a near-black block, so the transparent face is restated here. */
.diagnostics-sparkline:hover {
  background: transparent;
}

.diagnostics-sparkline:not(:disabled):hover {
  color: var(--ink);
}

.diagnostics-sparkline:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 0.25rem;
}

.diagnostics-sparkline svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.diagnostics-sparkline-path,
.diagnostics-history-line {
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.diagnostics-sparkline-path {
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
}

.diagnostics-sparkline-status {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.diagnostics-history-dialog {
  width: min(56rem, calc(100vw - 2rem));
  max-width: none;
  padding: 0;
  border: 1px solid var(--line);
  color: var(--ink);
  background: var(--forest);
}

.diagnostics-history-dialog::backdrop {
  background: rgb(5 9 6 / 72%);
  backdrop-filter: blur(3px);
}

.diagnostics-history-content {
  padding: clamp(1.25rem, 3vw, 2.4rem);
}

.diagnostics-history-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
}

.diagnostics-history-header h2 {
  margin: 0.35rem 0 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.65rem, 4vw, 2.5rem);
  font-weight: 400;
}

.diagnostics-history-close {
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--line);
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.diagnostics-history-close:hover {
  border-color: var(--amber);
  background: var(--amber);
  color: var(--forest);
}

.diagnostics-history-close:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 0.2rem;
}

.diagnostics-history-summary {
  margin: 1.25rem 0 0.75rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.diagnostics-history-chart {
  min-height: 20rem;
  color: var(--amber);
}

.diagnostics-history-chart svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.diagnostics-history-gridline {
  stroke: var(--line);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.diagnostics-history-line {
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

.diagnostics-history-axis-label {
  fill: var(--muted);
  font: 11px "Avenir Next", Avenir, "Segoe UI", sans-serif;
}

.diagnostics-help {
  position: absolute;
  z-index: 4;
  right: 1rem;
  bottom: calc(100% - 1rem);
  left: 1rem;
  visibility: hidden;
  padding: 0.9rem 1rem;
  border: 1px solid var(--amber);
  background: #111a13;
  box-shadow: 0 12px 30px rgb(0 0 0 / 35%);
  /* Pinned to the hardcoded dark background above rather than a theme token,
     which would invert with the page and vanish in one of the two themes. */
  color: #f2ead8;
  font-size: 0.75rem;
  line-height: 1.5;
  opacity: 0;
  pointer-events: none;
  transform: translateY(0.35rem);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms;
}

.diagnostics-metric:hover .diagnostics-help,
.diagnostics-metric:focus .diagnostics-help {
  visibility: visible;
  opacity: 1;
  transform: translateY(0);
}

.diagnostics-metric:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: -3px;
}

#diagnostics-updated {
  display: block;
  padding: 0.8rem clamp(1.25rem, 3vw, 2.4rem);
  color: var(--muted);
  border-top: 1px solid var(--line);
  letter-spacing: 0.04em;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: clamp(5rem, 10vw, 10rem);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.fact {
  min-height: 230px;
  padding: clamp(1.5rem, 3vw, 2.8rem);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.fact-number {
  color: var(--amber);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.76rem;
}

.fact h2 {
  margin: 3.5rem 0 0.75rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  font-weight: 400;
}

.fact p {
  max-width: 28rem;
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

footer {
  display: flex;
  justify-content: space-between;
  gap: 1.5rem;
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 2rem 4vw 3rem;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.1em;
}

.about-intro {
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(22rem, 1.2fr);
  gap: clamp(2rem, 6vw, 6rem);
  align-items: center;
}

.about-intro h1 {
  max-width: 12ch;
}

.about-portrait {
  position: relative;
  border: 1px solid var(--amber);
  box-shadow: 14px 14px 0 var(--moss);
}

.about-portrait img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 3;
  object-fit: cover;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin-top: clamp(4rem, 8vw, 7rem);
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.about-copy {
  padding: clamp(1.5rem, 3vw, 2.8rem);
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.about-copy h2 {
  margin: 0 0 1.25rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 1.8rem;
  font-weight: 400;
}

.about-copy p {
  max-width: 38rem;
  margin: 0 0 1.1rem;
  color: var(--muted);
  line-height: 1.65;
}

.about-copy p:last-child {
  margin-bottom: 0;
}

.moments-calendar-section {
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}

.moments-calendar-drawer {
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.12);
}

html[data-theme="light"] .moments-calendar-drawer {
  background: rgba(255, 255, 255, 0.65);
}

.moments-calendar-drawer__summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.15rem;
  cursor: pointer;
  list-style: none;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 3.2vw, 1.75rem);
  font-weight: 600;
  line-height: 1.2;
  color: var(--ink);
  user-select: none;
}

.moments-calendar-drawer__summary::-webkit-details-marker {
  display: none;
}

.moments-calendar-drawer__summary::marker {
  content: "";
}

.moments-calendar-drawer__summary::after {
  flex-shrink: 0;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--amber);
  border-bottom: 2px solid var(--amber);
  transform: rotate(45deg);
  margin-top: -0.2rem;
  transition: transform 0.3s ease;
  content: "";
}

.moments-calendar-drawer[open] .moments-calendar-drawer__summary::after {
  transform: rotate(225deg);
  margin-top: 0.15rem;
}

.moments-calendar-drawer__summary:hover {
  color: var(--amber);
}

.moments-calendar-drawer__summary:focus-visible {
  color: var(--amber);
  outline: 3px solid var(--amber);
  outline-offset: 4px;
}

.moments-calendar-drawer__panel {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s ease;
}

.moments-calendar-drawer[open] .moments-calendar-drawer__panel {
  grid-template-rows: 1fr;
}

.moments-calendar-drawer__panel-inner {
  overflow: hidden;
  min-height: 0;
  padding: 0 1.15rem;
  transition: padding 0.35s ease;
}

.moments-calendar-drawer[open] .moments-calendar-drawer__panel-inner {
  padding: 0 1.15rem 1.25rem;
}

.moments-calendar-lede {
  max-width: 44rem;
  margin-bottom: 0.75rem;
}

.moments-calendar-legend {
  max-width: 44rem;
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.moments-calendar-legend__summary {
  cursor: pointer;
  color: var(--amber);
  font-weight: 600;
  letter-spacing: 0.04em;
}

.moments-calendar-legend__body {
  margin: 0.5rem 0 0;
}

.moments-calendar__offline {
  margin-bottom: 1rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--danger);
  color: var(--ink);
  background: rgba(207, 107, 79, 0.12);
  font-size: 0.82rem;
  line-height: 1.5;
}

html[data-theme="light"] .moments-calendar__offline {
  background: rgba(155, 56, 34, 0.1);
}

.moments-calendar--offline .moments-calendar__grid {
  opacity: 0.55;
  pointer-events: none;
}

.moments-calendar--offline .moments-calendar__nav {
  opacity: 0.85;
}

.moments-calendar__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.moments-calendar__month {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  flex: 1;
}

.moments-calendar__nav {
  min-height: 44px;
  padding: 0.45rem 0.85rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.moments-calendar__nav:hover {
  color: var(--amber);
  border-color: var(--amber);
}

.moments-calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
  margin-bottom: 1.75rem;
}

.moments-calendar__weekday {
  padding: 0.35rem 0.25rem;
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.moments-calendar__day {
  min-height: 4.5rem;
  padding: 0.45rem 0.35rem 0.35rem;
  color: var(--ink);
  background: rgba(11, 16, 13, 0.55);
  border: 1px solid var(--line);
  text-align: left;
  cursor: pointer;
}

.moments-calendar__day--idle {
  min-height: 2.35rem;
  padding-bottom: 0.45rem;
}

.moments-calendar__day--pad {
  border-color: transparent;
  background: transparent;
  cursor: default;
  pointer-events: none;
}

.moments-calendar__day:hover:not(.moments-calendar__day--pad) {
  border-color: rgba(232, 164, 58, 0.45);
}

.moments-calendar__day--selected {
  border-color: var(--amber);
  box-shadow: inset 0 0 0 1px rgba(232, 164, 58, 0.35);
}

.moments-calendar__day--today .moments-calendar__daynum {
  color: var(--amber);
}

.moments-calendar__daynum {
  display: block;
  font-size: 0.95rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.moments-calendar__stats {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  margin-top: 0.35rem;
  color: var(--muted);
  font-size: 0.52rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  line-height: 1.25;
}

.moments-day__title {
  margin: 0 0 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
}

.moments-day__status {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.moments-day__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.moments-day__table th,
.moments-day__table td {
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.moments-day__table th {
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.moments-day__table a {
  color: var(--amber);
  text-decoration: underline;
}

@media (max-width: 560px) {
  .moments-calendar__day {
    min-height: 3.6rem;
    padding: 0.35rem 0.25rem;
  }

  .moments-calendar__stats {
    font-size: 0.48rem;
  }

  html[data-theme="light"] .moments-calendar__stats {
    font-size: 0.54rem;
  }

  .moments-day__table {
    display: block;
    overflow-x: auto;
  }
}

.moments-intro {
  max-width: 52rem;
  margin-bottom: clamp(2rem, 5vw, 3rem);
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--line);
}

.moments-jump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.55rem;
  margin-top: 1.35rem;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.moments-jump a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.moments-jump a:hover,
.moments-jump a:focus-visible {
  color: var(--amber);
  border-bottom-color: var(--amber);
}

.moments-jump__sep {
  color: var(--muted);
  font-weight: 400;
  user-select: none;
}

.moments-intro h1 {
  max-width: 11ch;
}

.moments-notice {
  max-width: 48rem;
  margin: 1.5rem 0 0;
  padding-left: 1rem;
  color: var(--ink);
  border-left: 3px solid var(--amber);
  line-height: 1.6;
}

.moments-log {
  margin-top: clamp(4rem, 8vw, 7rem);
}

.sort-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.sort-title {
  flex-basis: 100%;
  margin-bottom: 0.35rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.16em;
}

.sort-header button {
  min-height: 44px;
  padding: 0.6rem 1.05rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.sort-header button:hover {
  color: var(--amber);
  background: transparent;
  border-color: var(--amber);
}

.sort-header button[aria-pressed="true"],
.sort-header button[aria-pressed="true"]:hover {
  color: var(--night);
  background: var(--amber);
  border-color: var(--amber);
}

.sort-header button[aria-pressed="true"]::after {
  content: " ↑";
}

.sort-header button[aria-pressed="true"][data-direction="desc"]::after {
  content: " ↓";
}

.sort-status {
  margin: 0.75rem 0 1.5rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.nest-moments {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}

.nest-moments-lede {
  max-width: 42rem;
}

.nest-moments-status {
  margin: 0.75rem 0 1.25rem;
  color: var(--muted);
  font-size: 0.82rem;
}

.nest-moments-status--error {
  color: var(--danger);
  font-weight: 600;
}

.nest-moments-grid {
  margin-top: 0.5rem;
}

.nest-moment-delete {
  position: absolute;
  top: 0.65rem;
  right: 0.65rem;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid rgba(255, 220, 160, 0.35);
  border-radius: 0.45rem;
  background: rgba(8, 12, 10, 0.82);
  color: var(--amber);
  cursor: pointer;
}

.nest-moment-delete:hover,
.nest-moment-delete:focus-visible {
  background: rgba(180, 60, 40, 0.85);
  color: #fff6eb;
  border-color: rgba(255, 200, 160, 0.55);
}

.nest-moment-badge {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  padding: 0.35rem 0.5rem;
  color: var(--night);
  background: var(--amber);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.12em;
}

.nest-moment-subject {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.15;
}

.moments-grid {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
}

.moment-card {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  background: rgba(20, 32, 25, 0.72);
}

.moment-media {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: #050806;
}

.moment-thumb {
  display: block;
  height: 100%;
}

.moment-media img,
.moment-media video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.moment-media video {
  object-fit: contain;
}

.thumb-hint {
  position: absolute;
  inset: auto 0 0 0;
  padding: 0.5rem 0.7rem;
  color: var(--night);
  background: var(--amber);
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-align: center;
  opacity: 0;
  transition: opacity 120ms ease;
}

.moment-thumb:hover .thumb-hint,
.moment-thumb:focus-visible .thumb-hint {
  opacity: 1;
}

.placeholder-badge {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  padding: 0.35rem 0.5rem;
  color: var(--night);
  background: var(--amber);
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.moment-copy {
  padding: clamp(1.1rem, 2.2vw, 1.6rem);
}

.moment-kicker {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 0.72rem;
}

.moment-type,
.story-label {
  color: var(--amber);
  font-weight: 700;
  letter-spacing: 0.1em;
}

.moment-copy h2 {
  margin: 0.7rem 0 0.6rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.5rem, 2.2vw, 1.9rem);
  font-weight: 400;
}

.moment-story {
  max-width: 62ch;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 0.98rem;
  line-height: 1.55;
}

.moment-file,
.moment-credit {
  margin: 0.9rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.moment-credit {
  margin-top: 0.5rem;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.identify-page {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 26rem);
  gap: 1.5rem 2.5rem;
  padding: 2.5rem 0 4rem;
  align-items: start;
}

/* Everything except the intro and the chart spans the full width; the two
   of them share the first row. */
.identify-page > .identify-form,
.identify-page > .identify-disclaimer,
.identify-page > .identify-results {
  grid-column: 1 / -1;
}

.identify-intro .lede {
  max-width: 42rem;
}

.identify-form {
  display: grid;
  gap: 1rem;
}

.identify-drop {
  padding: 1.5rem;
  color: var(--muted);
  border: 1px dashed var(--line);
  background: var(--forest);
  cursor: pointer;
}

.identify-drop.is-over {
  border-color: var(--amber);
}

.identify-form input[type="file"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.identify-selection {
  padding: 0.75rem;
  border: 1px solid var(--line);
}

.identify-selection[hidden] {
  display: none;
}

.identify-selection > summary {
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.identify-selection[open] > summary {
  margin-bottom: 0.75rem;
}

.identify-thumbs {
  display: grid;
  gap: 0.75rem;
  margin: 0;
  padding: 0;
  list-style: none;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.identify-thumbs li {
  display: grid;
  gap: 0.4rem;
}

.identify-thumbs img,
.identify-card img {
  width: 100%;
  height: auto;
}

.identify-results {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* The headline is only a few words, so at desktop widths it left a large
   empty block to its right. The all-time chart fills it and is readable
   before anyone uploads anything. */
.identify-summary {
  grid-column: 2;
  grid-row: 1;
  padding: 1.25rem;
  border: 1px solid var(--line);
  background: var(--forest);
}

.identify-summary[hidden] {
  display: none;
}

.identify-summary h2,
.identify-summary-total,
.identify-summary-hint {
  margin: 0;
}

.identify-summary-total {
  margin-top: 0.25rem;
  font-size: 1.1rem;
}

.identify-summary-total strong {
  color: var(--amber);
  font-size: 1.6rem;
}

.identify-summary-hint {
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.88rem;
}

.identify-chart {
  margin-top: 1rem;
}

.identify-chart details {
  border-top: 1px solid var(--line);
}

.identify-chart details:last-child {
  border-bottom: 1px solid var(--line);
}

.identify-chart summary {
  display: grid;
  grid-template-columns: 1rem minmax(7rem, 10rem) minmax(6rem, 1fr) 3ch;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem 0;
  cursor: pointer;
  list-style: none;
}

.identify-chart summary::before {
  content: "›";
  color: var(--amber);
  font-size: 1.25rem;
  line-height: 1;
  transition: transform 120ms ease;
}

.identify-chart details[open] summary::before {
  transform: rotate(90deg);
}

.identify-chart progress {
  width: 100%;
  min-width: 0;
  height: 0.65rem;
  overflow: hidden;
  border: 0;
  background: var(--moss);
  accent-color: var(--amber);
}

.identify-chart progress::-webkit-progress-bar {
  background: var(--moss);
}

.identify-chart progress::-webkit-progress-value {
  background: var(--amber);
}

.identify-chart progress::-moz-progress-bar {
  background: var(--amber);
}

.identify-species-counts {
  display: grid;
  gap: 0.4rem 1.5rem;
  margin: 0 0 1rem 1.75rem;
  padding: 0;
  list-style: none;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.identify-species-counts li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  color: var(--muted);
}

.identify-species-counts strong {
  color: var(--ink);
}

.identify-card {
  padding: 0.9rem;
  border: 1px solid var(--line);
  background: var(--forest);
}

.identify-card h2 {
  margin: 0.8rem 0 0.3rem;
  font-size: 1.25rem;
}

.identify-disclaimer,
.identify-score {
  color: var(--muted);
  font-size: 0.88rem;
}

.identify-feedback,
.identify-correction {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

/* Required, not belt-and-braces: display above outranks the hidden
   attribute's UA display:none, so the form sat open on every card. */
.identify-correction[hidden] {
  display: none;
}

.identify-correction label {
  width: 100%;
  color: var(--muted);
  font-size: 0.88rem;
}

/* The flex row would otherwise sit this beside the note field. */
.identify-correction small {
  width: 100%;
  color: var(--muted);
  font-size: 0.82rem;
}

/* Secondary actions. The global button is solid amber, which made a grid of
   cards read as a wall of calls to action. */
.identify-quiet {
  padding: 0.45rem 0.7rem;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 600;
  border: 1px solid var(--line);
  background: transparent;
}

.identify-quiet:hover {
  color: var(--night);
  background: var(--ink);
}

.identify-thumbs .identify-quiet {
  justify-self: start;
}

/* Progress owl. The track clips the flight path so the owl can enter and
   leave the frame instead of stopping at the edges. */
.identify-loader {
  position: relative;
  overflow: hidden;
  height: 4.75rem;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--moss), var(--forest));
}

.identify-loader[hidden] {
  display: none;
}

.identify-owl {
  position: absolute;
  top: 50%;
  left: 0;
  color: var(--amber);
  animation: owl-fly 7s linear infinite;
}

.identify-owl-body,
.identify-owl-wing {
  fill: currentColor;
}

.identify-owl-face,
.identify-owl-glint {
  fill: var(--ink);
}

.identify-owl-eye,
.identify-owl-beak {
  fill: var(--night);
}

/* Feather lines, not an outline: at 64px a stroked silhouette turns muddy. */
.identify-owl-quill {
  fill: none;
  stroke: var(--night);
  stroke-width: 1.2;
  stroke-linecap: round;
  opacity: 0.22;
}

.identify-owl-wing {
  transform-box: fill-box;
  animation: owl-flap 0.55s ease-in-out infinite alternate;
}

.identify-owl-wing-left {
  transform-origin: right center;
}

.identify-owl-wing-right {
  transform-origin: left center;
  animation-name: owl-flap-mirror;
}

/* Horizontal travel plus a gentle bob, so one animation reads as flight.
   The vertical half is what keeps it from looking like a sliding sticker.
   left drives the lap rather than transform because percentage translation
   resolves against the owl, not the loader: a vw lap outran the box on wide
   screens, where main caps at 1440px, and the owl spent half of it offscreen.
   The rem offsets exceed the owl's own 64px width, so it starts and ends
   fully hidden whatever the container is doing. */
@keyframes owl-fly {
  0% {
    left: -4.5rem;
    transform: translateY(-55%);
  }
  25% {
    left: 25%;
    transform: translateY(-42%);
  }
  50% {
    left: 50%;
    transform: translateY(-58%);
  }
  75% {
    left: 75%;
    transform: translateY(-44%);
  }
  100% {
    left: 100%;
    transform: translateY(-55%);
  }
}

/* A shallow beat on purpose. The wing pivots at its shoulder, so past roughly
   35deg it swings clear of the body and the silhouette comes apart. */
@keyframes owl-flap {
  from {
    transform: rotate(-22deg);
  }
  to {
    transform: rotate(11deg);
  }
}

@keyframes owl-flap-mirror {
  from {
    transform: rotate(22deg);
  }
  to {
    transform: rotate(-11deg);
  }
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

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

  /* One column: the chart falls below the form so uploading stays the
     first thing on the page. */
  .identify-page {
    grid-template-columns: 1fr;
  }

  .identify-summary {
    grid-column: 1;
    grid-row: auto;
  }

  h1 {
    max-width: 11ch;
    font-size: clamp(3.5rem, 14vw, 7rem);
  }

  .player-shell {
    box-shadow: 10px 10px 0 var(--moss);
  }

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

  .diagnostics-row-system {
    grid-template-columns: repeat(2, 1fr);
  }

  .diagnostics-row-system .diagnostics-metric:nth-child(2n) {
    border-right: 0;
  }

  .diagnostics-row-system .diagnostics-metric:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .about-intro,
  .about-grid {
    grid-template-columns: 1fr;
  }

  .identify-results,
  .identify-thumbs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .about-portrait {
    max-width: 46rem;
  }

  .moment-card {
    grid-template-columns: 1fr;
  }

  .moment-media {
    aspect-ratio: 16 / 10;
  }

  .thumb-hint {
    opacity: 1;
  }

  .fact {
    min-height: auto;
  }

  .fact h2 {
    margin-top: 2rem;
  }

  .admin-service-grid,
  .admin-metric-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .utility-bar {
    align-items: flex-start;
    flex-direction: column;
    gap: 0.7rem;
    padding-top: 0.8rem;
    padding-bottom: 0.8rem;
  }

  .utility-bar__aside {
    width: 100%;
    align-items: flex-end;
  }

  .access-pill {
    text-align: right;
  }

  .site-nav {
    gap: 0.8rem;
  }

  .identify-results,
  .identify-thumbs {
    grid-template-columns: 1fr;
  }

  .identify-chart summary {
    grid-template-columns: 1rem minmax(6rem, 1fr) 4rem 3ch;
  }

  .identify-species-counts {
    grid-template-columns: 1fr;
  }

  .admin-dialog {
    width: 100vw;
    max-width: none;
    max-height: 100dvh;
    height: 100dvh;
    border-right: 0;
    border-left: 0;
    box-shadow: none;
  }

  .admin-header,
  .admin-toolbar,
  .admin-control,
  .admin-section-heading {
    align-items: flex-start;
  }

  .admin-toolbar,
  .admin-section-heading {
    flex-direction: column;
  }

  .admin-dashboard-body {
    padding: 1rem;
  }

  .admin-control {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-control > button {
    width: 100%;
  }

  .admin-actions {
    width: 100%;
  }

  .admin-actions button {
    flex: 1;
    width: 100%;
  }

  .admin-service-grid,
  .admin-metric-grid {
    grid-template-columns: 1fr;
  }

  .admin-log-controls {
    align-items: stretch;
    flex-direction: column;
    width: 100%;
  }

  main {
    padding-right: 1rem;
    padding-left: 1rem;
  }

  .offline-panel p {
    font-size: 0.84rem;
  }

  .player-meta,
  .diagnostics-header,
  footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .diagnostics-controls {
    align-items: flex-start;
    flex-direction: column;
  }

  .diagnostics-state {
    text-align: left;
  }

  .diagnostics-row-habitat,
  .diagnostics-row-system {
    grid-template-columns: 1fr;
  }

  .diagnostics-row .diagnostics-metric,
  .diagnostics-row-system .diagnostics-metric:nth-child(2n) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .diagnostics-row .diagnostics-metric:last-child {
    border-bottom: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .live-label > span {
    animation: none;
  }

  /* Park the owl in frame and let the status text carry the progress. */
  .identify-owl {
    animation: none;
    transform: translate(1.25rem, -50%);
  }

  .identify-owl-wing {
    animation: none;
  }

  .identify-loader {
    animation: pulse 1.8s ease-in-out infinite;
  }

  .identify-chart summary::before {
    transition: none;
  }
}
