:root {
  --bg: #eaf5f3;
  --ink: #0b2e36;
  --muted: #3f646b;
  --sea: #0c7471;
  --sea-soft: #b9dcd7;
  --mango: #e8962c;
  --field: #ffffff;
  --line: #c6e0dc;
  --danger: #b3261e;

  --font: "Archivo", system-ui, sans-serif;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-6: 1.5rem;
  --space-8: 2rem;
  --space-12: 3rem;
  --radius-s: 8px;
  --radius-pill: 999px;
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #06232a;
    --ink: #e2f2ef;
    --muted: #9cc0c0;
    --sea: #4cc3b8;
    --sea-soft: #1d4a50;
    --mango: #f4b356;
    --field: #0b313a;
    --line: #1f4a52;
    --danger: #ff8a80;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

::selection {
  background: var(--mango);
  color: #1a1200;
}

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

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.page {
  width: 100%;
  max-width: 44rem;
  margin: 0 auto;
  padding: var(--space-8) var(--space-4) var(--space-12);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* Header */

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  font-stretch: 112%;
  letter-spacing: -0.01em;
}

.title-mark {
  flex: none;
  border-radius: 8px;
}

/* Currency switch */

.currency {
  display: inline-flex;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--field);
}

.currency label {
  position: relative;
}

.currency input {
  position: absolute;
  inset: 0;
  opacity: 0;
  margin: 0;
  cursor: pointer;
}

.currency span {
  display: block;
  min-width: 3.25rem;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-pill);
  font-size: 0.875rem;
  font-weight: 600;
  text-align: center;
  color: var(--muted);
  transition: background-color 200ms var(--ease-out), color 200ms var(--ease-out);
}

.currency label:hover span {
  color: var(--ink);
}

.currency input:checked + span {
  background: var(--sea);
  color: var(--bg);
}

.currency input:focus-visible + span {
  outline: 2px solid var(--sea);
  outline-offset: 2px;
}

/* Remaining amount */

main {
  flex: 1;
}

.remaining {
  margin-top: clamp(var(--space-12), 10vh, 6rem);
}

.remaining-label {
  margin: 0;
  font-size: 1.125rem;
  color: var(--muted);
}

.remaining-amount {
  margin: var(--space-1) 0 0;
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.15em;
  font-size: clamp(3.25rem, 15vw, 6rem);
  font-weight: 750;
  font-stretch: 125%;
  line-height: 1;
  letter-spacing: -0.03em;
}

.remaining-amount .sym {
  font-size: 0.4em;
  font-weight: 600;
  font-stretch: 100%;
  letter-spacing: 0;
  color: var(--sea);
}

/* Route */

.route {
  margin: var(--space-12) 0 0;
}

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

.route-ahead,
.route-done {
  fill: none;
  stroke-width: 3;
  stroke-linecap: round;
}

.route-ahead {
  stroke: var(--sea-soft);
  stroke-dasharray: 2 9;
}

.route-done {
  stroke: var(--sea);
}

.route-stop {
  fill: var(--bg);
  stroke: var(--sea);
  stroke-width: 3;
}

.route-stop--end {
  stroke: var(--mango);
}

.plane path {
  fill: var(--mango);
}

.route-ends {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-2);
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
}

.route-caption {
  margin-top: var(--space-6);
  font-size: 1.125rem;
  text-align: center;
}

.route-caption strong {
  font-weight: 700;
  font-stretch: 112%;
  color: var(--sea);
}

/* Saved / goal figures */

.figures {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
  margin: var(--space-12) 0 0;
  padding-top: var(--space-6);
  border-top: 1px solid var(--line);
}

.figures dt {
  font-size: 0.875rem;
  color: var(--muted);
}

.figures dd {
  margin: var(--space-1) 0 0;
  font-size: clamp(1.25rem, 5vw, 1.625rem);
  font-weight: 650;
  font-stretch: 112%;
  letter-spacing: -0.01em;
}

/* Footer */

.foot {
  margin-top: var(--space-12);
  font-size: 0.8125rem;
  color: var(--muted);
}

.foot p {
  margin: 0;
}

.foot a,
.admin a {
  color: var(--sea);
  text-underline-offset: 3px;
}

.rate-line {
  color: var(--ink);
  font-weight: 500;
}

/* Admin page */

.admin {
  margin-top: clamp(var(--space-12), 10vh, 6rem);
  max-width: 26rem;
}

.admin h2 {
  margin: 0 0 var(--space-2);
  font-size: clamp(1.75rem, 6vw, 2.25rem);
  font-weight: 700;
  font-stretch: 118%;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.admin-intro {
  margin: 0 0 var(--space-8);
  color: var(--muted);
}

.field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.field label {
  font-weight: 600;
}

.field-hint {
  font-size: 0.875rem;
  color: var(--muted);
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input {
  width: 100%;
  min-height: 3rem;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 1.125rem;
  caret-color: var(--sea);
}

.input-wrap .input {
  padding-right: 4rem;
}

.input-unit {
  position: absolute;
  right: var(--space-4);
  font-weight: 600;
  color: var(--muted);
  pointer-events: none;
}

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

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

.input[aria-invalid="true"] {
  border-color: var(--danger);
}

.error {
  margin: 0;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--danger);
}

.error:empty {
  display: none;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3);
  margin-top: var(--space-6);
}

.btn {
  min-height: 2.75rem;
  padding: var(--space-3) var(--space-6);
  border: 1px solid transparent;
  border-radius: var(--radius-pill);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 150ms var(--ease-out), transform 150ms var(--ease-out);
}

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

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

.btn-primary {
  background: var(--sea);
  color: var(--bg);
}

.btn-primary:hover:not(:disabled) {
  background: color-mix(in srgb, var(--sea) 85%, var(--ink));
}

.btn-quiet {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.btn-quiet:hover:not(:disabled) {
  border-color: var(--sea);
}

.status {
  margin: var(--space-4) 0 0;
  font-weight: 500;
  color: var(--sea);
  min-height: 1.5em;
}

.admin-preview {
  margin: var(--space-8) 0 0;
  padding-top: var(--space-6);
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.admin-preview strong {
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

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