:root {
  color-scheme: light;
  --bg: #f2efe9;
  --bg-deep: #e8e3d9;
  --paper: #fbfaf6;
  --paper-soft: rgba(251, 250, 246, 0.72);
  --ink: #202622;
  --ink-soft: #48524b;
  --muted: #666e67;
  --line: rgba(32, 38, 34, 0.11);
  --line-strong: rgba(32, 38, 34, 0.2);
  --accent: #23634f;
  --accent-soft: rgba(35, 99, 79, 0.1);
  --accent-ink: #174638;
  --danger: #9b3d32;
  --danger-soft: rgba(155, 61, 50, 0.09);
  --shadow: 0 24px 70px rgba(44, 51, 45, 0.12);
  --font-sans:
    "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Segoe UI", system-ui,
    sans-serif;
  --font-mono:
    "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, "Liberation Mono",
    monospace;
  --radius: 22px;
}

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

[hidden] {
  display: none !important;
}

html {
  min-width: 300px;
  background: var(--bg);
}

body {
  min-height: 100svh;
  margin: 0;
  display: flex;
  flex-direction: column;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  background:
    radial-gradient(1100px 760px at 8% -12%, rgba(139, 185, 166, 0.26), transparent 58%),
    radial-gradient(900px 640px at 102% -4%, rgba(211, 197, 164, 0.42), transparent 58%),
    linear-gradient(145deg, #f4f1eb 0%, var(--bg) 52%, #eeeae2 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.4;
  background-image:
    linear-gradient(rgba(32, 38, 34, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(32, 38, 34, 0.025) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 72%);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

a {
  color: var(--accent);
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}

a:hover {
  color: var(--accent-ink);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

::selection {
  color: var(--ink);
  background: rgba(177, 205, 187, 0.65);
}

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

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 100;
  transform: translateY(-160%);
  padding: 10px 16px;
  border-radius: 999px;
  color: var(--paper);
  background: var(--ink);
  transition: transform 160ms ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 500;
  letter-spacing: 0.19em;
  line-height: 1.4;
  text-transform: uppercase;
}

/* ------------------------------------------------------------------ */
/* Shared page structure                                               */
/* ------------------------------------------------------------------ */

.page-main {
  display: flex;
  flex: 1 0 auto;
  flex-direction: column;
  width: 100%;
}

.view {
  flex: 1 0 auto;
  width: 100%;
}

.site-footer {
  flex: 0 0 auto;
  padding: 22px 24px 26px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.8;
  text-align: center;
}

.site-footer p {
  max-width: 760px;
  margin: 0 auto;
}

.site-footer a {
  margin-left: 4px;
  white-space: nowrap;
}

/* ------------------------------------------------------------------ */
/* View 1: locating                                                   */
/* ------------------------------------------------------------------ */

.view-locating {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 32px 24px;
}

.locating-card {
  width: min(460px, 100%);
  text-align: center;
  animation: rise-in 500ms ease both;
}

.orbit-loader {
  position: relative;
  width: 58px;
  height: 58px;
  margin: 0 auto 30px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}

.orbit-loader::before,
.orbit-loader::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.orbit-loader::before {
  inset: 10px;
  border: 1px solid var(--line);
}

.orbit-loader::after {
  inset: -1px;
  border: 1px solid transparent;
  border-top-color: var(--accent);
  animation: spin 1.15s linear infinite;
}

.orbit-loader__core {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 7px var(--accent-soft);
  animation: breathe 2.2s ease-in-out infinite;
}

.locating-title {
  margin: 0;
  font-size: clamp(1.55rem, 3.4vw, 2rem);
  font-weight: 520;
  letter-spacing: -0.02em;
}

.locating-hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ------------------------------------------------------------------ */
/* View 2: result                                                     */
/* ------------------------------------------------------------------ */

.view-result {
  display: flex;
  flex-direction: column;
  min-height: calc(100svh - 76px);
}

.result-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 20px clamp(20px, 4vw, 44px);
}

.private-mark {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.64rem;
  letter-spacing: 0.18em;
  opacity: 0.7;
}

.private-mark__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.admin-entry {
  display: inline-grid;
  width: 40px;
  height: 40px;
  margin: -8px -8px -8px 0;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
  opacity: 0.62;
  transition:
    opacity 160ms ease,
    color 160ms ease,
    background-color 160ms ease;
}

.admin-entry:hover,
.admin-entry:focus-visible {
  color: var(--ink);
  background: rgba(251, 250, 246, 0.65);
  opacity: 1;
}

.result-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 36px 24px 88px;
  text-align: center;
  animation: rise-in 560ms 70ms ease both;
}

.result-eyebrow {
  margin-bottom: 20px;
}

.result-title {
  max-width: 1100px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(2rem, 5.9vw, 5rem);
  font-weight: 480;
  letter-spacing: -0.045em;
  line-height: 1.2;
  text-wrap: balance;
}

.result-province {
  display: inline-block;
  padding: 0 0.06em;
  color: var(--accent);
  font-weight: 620;
  line-height: 1.1;
  white-space: nowrap;
  background: linear-gradient(
    to top,
    rgba(35, 99, 79, 0.16) 0,
    rgba(35, 99, 79, 0.16) 0.19em,
    transparent 0.19em
  );
}

.result-caption {
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  letter-spacing: 0.02em;
}

.result-controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  min-height: 92px;
  margin-top: 36px;
}

.geo-status {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.geo-status::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex: 0 0 auto;
}

.text-button {
  min-height: 40px;
  padding: 8px 4px;
  border: 0;
  color: var(--accent);
  background: transparent;
  font-size: 0.86rem;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.3em;
}

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

#retry-geolocation {
  min-height: 42px;
  padding: 9px 18px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  background: var(--paper-soft);
  text-decoration: none;
  transition:
    border-color 160ms ease,
    background-color 160ms ease;
}

#retry-geolocation:hover {
  border-color: var(--accent);
  background: var(--paper);
}

.text-button--muted {
  color: var(--muted);
  font-size: 0.76rem;
  text-decoration-color: var(--line-strong);
}

.text-button--muted:hover {
  color: var(--ink-soft);
}

.optout-status {
  max-width: 540px;
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
  line-height: 1.7;
}

/* ------------------------------------------------------------------ */
/* View 3: admin                                                      */
/* ------------------------------------------------------------------ */

.view-admin {
  width: 100%;
  padding: 36px clamp(18px, 4vw, 48px) 54px;
  animation: fade-in 280ms ease both;
}

.admin-header,
.admin-main {
  width: min(1500px, 100%);
  margin-inline: auto;
}

.admin-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 26px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line-strong);
}

.admin-header__note {
  margin: 0 0 5px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.admin-title {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 540;
  letter-spacing: -0.035em;
  line-height: 1.15;
}

.admin-main {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.stats-section {
  display: grid;
  grid-template-columns: minmax(160px, 0.72fr) minmax(160px, 0.72fr) minmax(320px, 1.5fr);
  gap: 14px;
}

.stat-card {
  min-width: 0;
  padding: 22px 24px;
  border: 1px solid rgba(32, 38, 34, 0.1);
  border-radius: 18px;
  background: var(--paper-soft);
  box-shadow: 0 10px 35px rgba(44, 51, 45, 0.035);
  backdrop-filter: blur(12px);
}

.stat-card__label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.74rem;
  letter-spacing: 0.04em;
}

.stat-card__value {
  margin: 0;
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 3.2vw, 2.4rem);
  font-weight: 450;
  letter-spacing: -0.04em;
  line-height: 1.1;
}

.province-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px 24px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: province;
}

.province-list__item {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  font-size: 0.8rem;
}

.province-list__name {
  min-width: 0;
  overflow: hidden;
  color: var(--ink-soft);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.province-list__name::before {
  counter-increment: province;
  content: counter(province, decimal-leading-zero) "  ";
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.66rem;
}

.province-list__count {
  flex: 0 0 auto;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.7rem;
}

.province-list__empty {
  color: var(--muted);
  font-size: 0.8rem;
}

.admin-records {
  overflow: hidden;
  border: 1px solid rgba(32, 38, 34, 0.12);
  border-radius: var(--radius);
  background: rgba(251, 250, 246, 0.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.records-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 18px 22px;
}

.records-heading {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.range-filter {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(232, 227, 218, 0.52);
}

.range-button {
  min-height: 36px;
  padding: 6px 16px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  font-size: 0.78rem;
  line-height: 1;
  transition:
    color 140ms ease,
    background-color 140ms ease,
    box-shadow 140ms ease;
}

.range-button:hover:not(:disabled):not(.is-active) {
  color: var(--ink);
}

.range-button.is-active {
  color: var(--paper);
  background: var(--ink);
  box-shadow: 0 2px 8px rgba(32, 38, 34, 0.15);
}

.range-button:disabled {
  cursor: wait;
}

.admin-message {
  margin: 0;
  padding: 10px 22px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  background: rgba(232, 227, 218, 0.32);
  font-size: 0.78rem;
}

.admin-message.is-error {
  color: var(--danger);
  background: var(--danger-soft);
}

.table-scroll {
  max-height: min(66vh, 720px);
  overflow: auto;
  border-top: 1px solid var(--line);
  overscroll-behavior: contain;
}

.records-table {
  width: 100%;
  min-width: 1320px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.76rem;
  line-height: 1.55;
  text-align: left;
}

.records-table th,
.records-table td {
  padding: 11px 10px;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}

.records-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: var(--muted);
  background: #f6f3ed;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.035em;
  white-space: nowrap;
  border-bottom-color: var(--line-strong);
}

.records-table th:first-child,
.records-table td:first-child {
  padding-left: 18px;
}

.records-table th:last-child,
.records-table td:last-child {
  padding-right: 18px;
}

.records-table tbody tr {
  transition: background-color 120ms ease;
}

.records-table tbody tr:hover {
  background: rgba(35, 99, 79, 0.035);
}

.records-table tbody tr:last-child td {
  border-bottom: 0;
}

.records-table td {
  color: var(--ink-soft);
}

.cell-time {
  color: var(--ink);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.cell-time time {
  font-family: var(--font-mono);
  font-size: 0.71rem;
}

.cell-mono,
.coord-text {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-variant-numeric: tabular-nums;
}

.cell-empty {
  color: #8a9089 !important;
}

.ua-cell {
  width: 230px;
  max-width: 230px;
}

.ua-text {
  display: block;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.coords-cell {
  width: 210px;
}

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

.coord-text {
  display: inline-block;
  padding: 3px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink-soft);
  background: rgba(232, 227, 218, 0.28);
  user-select: all;
  white-space: nowrap;
}

.copy-button {
  min-height: 28px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 0.68rem;
  line-height: 1.4;
  white-space: nowrap;
}

.copy-button:hover {
  color: var(--accent);
  border-color: rgba(35, 99, 79, 0.36);
  background: var(--accent-soft);
}

.copy-button.is-copied {
  color: var(--accent);
  border-color: rgba(35, 99, 79, 0.36);
  background: var(--accent-soft);
}

.copy-button.is-copy-error {
  color: var(--danger);
  border-color: rgba(155, 61, 50, 0.3);
  background: var(--danger-soft);
}

.table-empty {
  height: 240px;
  color: var(--muted) !important;
  font-size: 0.84rem;
  text-align: center;
  vertical-align: middle !important;
}

.table-footnote {
  margin: 0;
  padding: 13px 22px 15px;
  color: var(--muted);
  font-size: 0.7rem;
}

.table-scroll::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.table-scroll::-webkit-scrollbar-track {
  background: rgba(232, 227, 218, 0.25);
}

.table-scroll::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: rgba(102, 110, 103, 0.34);
  background-clip: padding-box;
}

/* ------------------------------------------------------------------ */
/* Admin dialog                                                       */
/* ------------------------------------------------------------------ */

.admin-dialog {
  width: min(432px, calc(100vw - 28px));
  max-height: calc(100dvh - 28px);
  margin: auto;
  padding: 0;
  overflow: auto;
  border: 1px solid rgba(32, 38, 34, 0.13);
  border-radius: 22px;
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 30px 100px rgba(20, 26, 22, 0.28);
}

.admin-dialog[open] {
  animation: dialog-in 180ms ease both;
}

.admin-dialog::backdrop {
  background: rgba(24, 31, 27, 0.48);
  backdrop-filter: blur(7px);
}

.admin-form {
  padding: 26px;
}

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

.dialog-heading .eyebrow {
  margin-bottom: 6px;
}

.dialog-heading h2 {
  margin: 0;
  font-size: 1.38rem;
  font-weight: 580;
  letter-spacing: -0.025em;
}

.icon-button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  padding: 0;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 50%;
  color: var(--muted);
  background: transparent;
}

.icon-button:hover {
  color: var(--ink);
  border-color: var(--line);
  background: rgba(232, 227, 218, 0.42);
}

.field-label {
  display: block;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 550;
}

.key-input {
  display: block;
  width: 100%;
  height: 48px;
  padding: 10px 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink);
  background: #fdfcf9;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  letter-spacing: 0.04em;
  transition:
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.key-input:focus {
  border-color: var(--accent);
  outline: 0;
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.key-input[readonly] {
  cursor: wait;
  opacity: 0.7;
}

.form-error {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-radius: 8px;
  color: var(--danger);
  background: var(--danger-soft);
  font-size: 0.78rem;
  line-height: 1.55;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 24px;
}

.button {
  min-height: 41px;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: 9px;
  font-size: 0.82rem;
  font-weight: 550;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease;
}

.button--quiet {
  border-color: var(--line);
  color: var(--muted);
  background: transparent;
}

.button--quiet:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.button--primary {
  min-width: 92px;
  color: #f8f6f1;
  background: var(--ink);
}

.button--primary:hover {
  background: #0f1511;
}

/* ------------------------------------------------------------------ */
/* Privacy document                                                   */
/* ------------------------------------------------------------------ */

.legal-page {
  width: min(820px, 100%);
  margin: 0 auto;
  padding: 36px clamp(20px, 5vw, 44px) 72px;
}

.legal-back {
  display: inline-block;
  margin-bottom: clamp(40px, 8vw, 76px);
  color: var(--muted);
  font-size: 0.8rem;
  text-decoration: none;
}

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

.legal-header {
  padding-bottom: 30px;
  border-bottom: 1px solid var(--line-strong);
}

.legal-header h1 {
  max-width: 620px;
  margin: 0;
  font-size: clamp(2.3rem, 6vw, 4.2rem);
  font-weight: 500;
  letter-spacing: -0.055em;
  line-height: 1.1;
}

.legal-lead {
  max-width: 600px;
  margin: 22px 0 0;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.8;
}

.legal-meta {
  margin: 24px 0 0;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
}

.legal-content {
  padding-top: 16px;
}

.legal-content section {
  padding: 26px 0;
  border-bottom: 1px solid var(--line);
}

.legal-content section:last-child {
  border-bottom: 0;
}

.legal-content h2 {
  margin: 0 0 12px;
  font-size: 1.06rem;
  font-weight: 620;
  letter-spacing: -0.015em;
}

.legal-content p {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.85;
}

.legal-content p:last-child {
  margin-bottom: 0;
}

.legal-content ul {
  margin: 0;
  padding-left: 1.2em;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.85;
}

.legal-content li + li {
  margin-top: 5px;
}

.legal-content strong {
  color: var(--ink);
  font-weight: 600;
}

.field-list {
  display: grid;
  grid-template-columns: minmax(130px, 0.55fr) minmax(0, 1.45fr);
  margin: 0;
  border-top: 1px solid var(--line);
}

.field-list > div {
  display: contents;
}

.field-list dt,
.field-list dd {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.86rem;
  line-height: 1.7;
}

.field-list dt {
  padding-right: 18px;
  color: var(--ink);
  font-weight: 550;
}

.field-list dd {
  margin: 0;
}

.legal-note {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: 0 10px 10px 0;
  color: var(--ink-soft);
  background: rgba(251, 250, 246, 0.62);
  font-size: 0.84rem;
  line-height: 1.8;
}

.legal-footer {
  margin-top: 44px;
  color: var(--muted);
  font-size: 0.76rem;
}

.legal-footer a {
  margin-left: 6px;
}

@media (max-width: 560px) {
  .legal-page {
    padding-top: 24px;
    padding-bottom: 46px;
  }

  .legal-back {
    margin-bottom: 42px;
  }

  .field-list {
    grid-template-columns: 1fr;
  }

  .field-list dt {
    padding-bottom: 2px;
    border-bottom: 0;
  }

  .field-list dd {
    padding-top: 0;
  }
}

/* ------------------------------------------------------------------ */
/* Motion + responsive                                                */
/* ------------------------------------------------------------------ */

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

@keyframes breathe {
  0%,
  100% {
    transform: translate(-50%, -50%) scale(0.8);
  }
  50% {
    transform: translate(-50%, -50%) scale(1.1);
  }
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 980px) {
  .stats-section {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-card--wide {
    grid-column: 1 / -1;
  }
}

@media (max-width: 720px) {
  body {
    background-attachment: scroll;
  }

  .view-result {
    min-height: calc(100svh - 92px);
  }

  .result-main {
    padding-top: 18px;
    padding-bottom: 58px;
  }

  .result-title {
    font-size: clamp(1.45rem, 7.7vw, 3.2rem);
    letter-spacing: -0.035em;
  }

  .result-caption {
    max-width: 280px;
    font-size: 0.78rem;
  }

  .result-controls {
    min-height: 84px;
    margin-top: 28px;
  }

  .admin-header {
    display: block;
    padding-bottom: 18px;
  }

  .admin-header__note {
    margin-top: 9px;
    white-space: normal;
  }

  .view-admin {
    padding-top: 26px;
    padding-bottom: 38px;
  }

  .stats-section {
    gap: 10px;
  }

  .stat-card {
    padding: 17px 18px;
  }

  .records-toolbar {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
    padding: 16px 18px;
  }

  .range-filter {
    width: 100%;
  }

  .range-button {
    flex: 1;
    padding-inline: 8px;
  }

  .table-scroll {
    max-height: 62vh;
  }

  .records-table th:first-child,
  .records-table td:first-child {
    padding-left: 18px;
  }

  .admin-message {
    padding-inline: 18px;
  }

  .table-footnote {
    padding-inline: 18px;
  }

  .admin-form {
    padding: 22px;
  }

  .site-footer {
    padding: 17px 20px 22px;
    font-size: 0.73rem;
  }
}

@media (max-width: 480px) {
  .private-mark {
    font-size: 0.58rem;
  }

  .stats-section {
    grid-template-columns: 1fr;
  }

  .stat-card--wide {
    grid-column: auto;
  }

  .province-list {
    grid-template-columns: 1fr;
  }

  .result-controls {
    align-self: stretch;
  }

  .result-eyebrow {
    margin-bottom: 14px;
  }

  .admin-records {
    border-radius: 16px;
  }

  .dialog-actions {
    margin-top: 20px;
  }

  .button {
    flex: 1;
  }
}

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