/* ==========================================================================
   tepanje.com — design tokens
   Everything visual resolves through this block: one palette, one type scale,
   one spacing rhythm. Component rules below only use var(), never raw values.
   ========================================================================== */
:root {
  color-scheme: light dark;

  /* Surfaces */
  --bg: #f4f0e7;
  --surface: #fbfaf6;
  --surface-raised: #fffdfa;
  --surface-sunken: #eff3ec;
  --surface-dark: #222a2c;
  --surface-glass: rgba(251, 250, 246, 0.96);
  --line: #dedbd2;

  /* Ink */
  --ink: #20252c;
  --ink-soft: #565b57;
  --ink-muted: #6b6f68; /* 4.5:1 on --bg */
  --ink-inverse: #f7f2e9;
  --ink-inverse-soft: #bbc0b8;
  --ink-on-dark-muted: #a8b1a6;

  /* Brand */
  --accent: #b4552a; /* 4.7:1 with white, 4.7:1 as link text */
  --accent-hover: #9c4722;
  --accent-soft: #f4e5d9;
  --on-accent: #fffaf4;
  --sage: #54735c; /* 4.6:1 on --bg */
  --sage-line: #d4dfd3;
  --accent-rgb: 180, 85, 42;
  --sage-rgb: 84, 115, 92;

  /* State */
  --danger: #a33f31;
  --danger-line: #e7c0b6;
  --danger-bg: #f7e8e3;
  --success: #355d3d;
  --success-soft: #496b50;
  --success-line: #cedbce;
  --success-bg: #eaf1e7;
  --warning: #795c28;
  --warning-line: #e4c99a;
  --warning-bg: #f4ebd8;
  --note-ink: #5b4538;
  --note-line: #e1c4ad;
  --note-bg: #f2e4d7;
  --danger-rgb: 163, 63, 49;
  --success-rgb: 53, 93, 61;
  --warning-rgb: 121, 92, 40;

  /* Map */
  --map-water: #cfe0e4;
  --marker-border: #fff;
  --marker-player: #ff843d;
  --marker-heart: #ff426f;
  --marker-cooperative: #137554;
  --marker-equipment: #245b85;
  --marker-cow: #1a3c35;
  --marker-report: #c84336;
  --marker-start: #118a63;
  --marker-destination: #e97423;

  /* Space */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;

  /* Radius */
  --r-xs: 4px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-pill: 999px;

  /* Elevation */
  --shadow-sm: 0 2px 6px rgba(32, 37, 44, 0.08);
  --shadow-md: 0 10px 30px rgba(52, 59, 36, 0.08);
  --shadow-lg: 0 18px 44px rgba(32, 37, 44, 0.14);
  --shadow-accent: 0 8px 20px rgba(var(--accent-rgb), 0.24);
  --shadow-marker: 0 2px 10px rgba(0, 0, 0, 0.45);

  /* Type scale */
  --fs-2xs: 0.6875rem;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-md: 0.875rem;
  --fs-base: 0.9375rem;
  --fs-lg: 1rem;
  --fs-xl: 1.125rem;
  --fs-2xl: 1.5rem;
  --fs-title: clamp(1.6rem, 3vw, 2.25rem);
  --fs-display: clamp(2rem, 5vw, 3.5rem);

  /* Typefaces — Inter loads from assets/fonts when you add it, otherwise the
     system UI face is used. No third party font requests. */
  --font-sans: "Inter", "Inter var", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

  /* Layout */
  --container: 1180px;
  --measure: 68ch;
  --header-h: 76px;

  /* Compatibility aliases for existing rules */
  --panel: var(--surface);
  --text: var(--ink);
  --text-soft: var(--ink-soft);
  --muted: var(--ink-muted);
  --accent-blue: var(--sage);
  --shadow: var(--shadow-md);

  /* Cosmos zoom scene (intentionally dark) */
  --cosmos-bg: #030611;
  --cosmos-ink: #f4f0e7;
}

/* Self hosted Inter. Drop inter-latin-var.woff2 into assets/fonts/ and this
   block takes over from the system UI font.
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("assets/fonts/inter-latin-var.woff2") format("woff2");
}
*/

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.container {
  width: min(1180px, calc(100% - 36px));
  margin: 0 auto;
}

/* ==========================================================================
   Header
   ========================================================================== */
.topbar {
  position: sticky;
  top: 0;
  z-index: 1000;
  border-bottom: 1px solid var(--line);
  background: var(--surface-glass);
  backdrop-filter: blur(16px);
}

.nav-wrap {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: -0.05em;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--on-accent);
  font-weight: 900;
}

.main-nav,
.nav-form {
  display: flex;
  align-items: center;
  gap: 24px;
}

.mobile-menu {
  display: none;
}

.main-nav {
  color: var(--text-soft);
  font-size: var(--fs-base);
}

.main-nav a:hover,
.main-nav a:focus-visible {
  color: var(--accent);
}

.nav-form {
  gap: 12px;
}

.nav-signin {
  color: var(--ink-soft);
  font-size: var(--fs-base);
  font-weight: 600;
}

.nav-signin:hover,
.nav-signin:focus-visible {
  color: var(--accent);
}

.signed-in {
  color: var(--text-soft);
  font-size: var(--fs-base);
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, filter 0.18s ease;
}

.button:hover,
.button:focus-visible {
  transform: translateY(-1px);
}

.button-primary {
  background: var(--accent);
  color: var(--on-accent);
  box-shadow: var(--shadow-accent);
}

.button-primary:hover,
.button-primary:focus-visible {
  background: var(--accent-hover);
}

.button-secondary {
  border-color: var(--line);
  background: transparent;
  color: var(--ink);
}

.button-secondary:hover,
.button-secondary:focus-visible {
  border-color: var(--accent);
  background: rgba(var(--accent-rgb), 0.06);
  color: var(--accent);
}

/* ==========================================================================
   Collapsible sections
   ========================================================================== */
.section-summary {
  display: flex;
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  color: var(--text);
  cursor: pointer;
  list-style: none;
}

.section-summary::-webkit-details-marker {
  display: none;
}

.section-summary::after {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--accent);
  content: "+";
  font-size: var(--fs-xl);
  line-height: 1;
}

.collapsible-section[open] > .section-summary::after {
  content: "−";
}

.section-summary:focus-visible {
  outline: 3px solid rgba(var(--sage-rgb), 0.65);
  outline-offset: -3px;
}

.section-summary-copy {
  display: grid;
  min-width: 0;
  gap: var(--space-1);
}

.section-summary-copy .eyebrow {
  margin: 0;
  font-size: var(--fs-xs);
}

.section-summary-copy > strong {
  font-size: var(--fs-xl);
  letter-spacing: -0.025em;
  line-height: 1.3;
}

.section-summary-copy > span:last-child:not(.eyebrow) {
  color: var(--text-soft);
  font-size: var(--fs-sm);
  line-height: 1.4;
}

.section-content {
  min-width: 0;
}

.hero {
  padding: var(--space-7) 0 0;
}

.hero-content {
  padding: var(--space-6) 0 0;
}

.hero-inner {
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 36px;
  align-items: center;
}

/* ==========================================================================
   Typography primitives
   ========================================================================== */
.eyebrow {
  margin: 0 0 10px;
  color: var(--accent-blue);
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-copy h1 {
  max-width: 720px;
  margin: 0;
  font-size: var(--fs-display);
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.lead {
  max-width: 640px;
  margin: 22px 0 26px;
  color: var(--text-soft);
  font-size: var(--fs-xl);
}

.cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-card,
.account-card,
.privacy-card {
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.map-intro {
  padding: 26px;
  border: 1px solid var(--surface-dark);
  background: var(--surface-dark);
  color: var(--ink-inverse);
}

.map-intro h2 {
  color: var(--ink-inverse);
}

.map-intro p {
  color: var(--ink-inverse-soft);
}

.panel-header {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--accent);
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 14px rgba(var(--success-rgb), 0.45);
}

.map-intro h2 {
  margin: 16px 0 8px;
  font-size: var(--fs-2xl);
  letter-spacing: -0.06em;
}

.map-intro p {
  margin: 0;
  color: var(--text-soft);
}

.map-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  color: var(--muted);
  font-size: var(--fs-md);
}

.legend-heart {
  color: var(--marker-heart);
  font-size: var(--fs-2xl);
  line-height: 1;
  text-shadow: 0 2px 9px rgba(var(--danger-rgb), 0.65);
}

.notice {
  margin: 0 0 18px;
  padding: 13px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.notice-error {
  border-color: var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger);
}

.notice-success {
  border-color: var(--success-line);
  background: var(--success-bg);
  color: var(--success);
}

.form-feedback {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 20px;
  padding: 14px 15px;
  border: 1px solid;
  border-radius: var(--r-md);
  font-size: var(--fs-base);
  line-height: 1.5;
  scroll-margin-top: 100px;
}

.form-feedback[hidden] {
  display: none;
}

.feedback-error {
  border-color: var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger);
}

.feedback-success {
  border-color: var(--success-line);
  background: var(--success-bg);
  color: var(--success);
}

.feedback-icon {
  display: inline-grid;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  place-items: center;
  border: 1px solid currentColor;
  border-radius: 50%;
  font-size: var(--fs-sm);
  font-weight: 800;
}

.form-feedback a {
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.form-feedback a:hover,
.form-feedback a:focus-visible {
  color: var(--accent-hover);
}

.route-section {
  margin-top: var(--space-4);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.route-section > .section-summary {
  border-radius: var(--r-xl);
}

.route-content {
  padding: 0 24px 24px;
}

.route-summary {
  border-radius: var(--r-xl);
}

.route-badge {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(var(--success-rgb), 0.25);
  border-radius: var(--r-pill);
  background: rgba(var(--success-rgb), 0.08);
  color: var(--success-soft);
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
}

.route-controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 12px;
  margin-top: 22px;
}

.route-endpoint {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-raised);
}

.endpoint-symbol {
  display: grid;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  place-items: center;
  border-radius: var(--r-md);
  font-size: var(--fs-md);
  font-weight: 800;
}

.endpoint-start {
  background: rgba(var(--sage-rgb), 0.15);
  color: var(--sage);
}

.endpoint-destination {
  background: rgba(var(--accent-rgb), 0.15);
  color: var(--accent);
}

.endpoint-copy {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 2px;
}

.endpoint-label {
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.endpoint-value {
  overflow: hidden;
  color: var(--text);
  font-size: var(--fs-md);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pick-route-point {
  min-height: 38px;
  padding: 0 12px;
  font-size: var(--fs-sm);
  white-space: nowrap;
}

.pick-route-point.is-picking {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.route-submit {
  min-height: 100%;
  padding: 0 20px;
}

.route-submit:disabled {
  cursor: not-allowed;
  filter: grayscale(0.55);
  opacity: 0.55;
  transform: none;
}

.route-pick-hint {
  min-height: 1.4em;
  margin: 12px 1px 0;
  color: var(--accent-blue);
  font-size: var(--fs-md);
}

.route-pick-hint[data-state="error"] {
  color: var(--danger);
}

.route-option {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-raised);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.route-option:hover,
.route-option:focus-visible {
  border-color: var(--accent-blue);
}

.route-option.is-recommended {
  border-color: rgba(var(--success-rgb), 0.5);
  background: rgba(var(--success-rgb), 0.15);
}

.route-option-label {
  font-size: var(--fs-md);
  font-weight: 800;
}

.route-option-details {
  color: var(--muted);
  font-size: var(--fs-sm);
}

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

.route-results[hidden] {
  display: none;
}

.route-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  border: 1px solid rgba(var(--success-rgb), 0.26);
  border-radius: var(--r-md);
  background: rgba(var(--success-rgb), 0.13);
}

.route-summary h3 {
  margin: 0;
  font-size: var(--fs-lg);
}

.route-summary p {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: var(--fs-md);
}

.route-metrics {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.route-metric {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface-raised);
  color: var(--text);
  font-size: var(--fs-sm);
  white-space: nowrap;
}

.route-warning-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.route-warning {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid rgba(var(--warning-rgb), 0.2);
  border-radius: var(--r-md);
  background: rgba(var(--accent-rgb), 0.07);
  color: var(--text-soft);
  font-size: var(--fs-sm);
}

.route-warning-icon {
  flex: 0 0 auto;
  color: var(--danger);
  font-weight: 800;
}

.route-attribution {
  margin: 4px 2px 0;
  color: var(--muted);
  font-size: var(--fs-xs);
}

.route-attribution a,
.route-data-note a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.route-data-note {
  margin: 13px 1px 0;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.55;
}

/* ==========================================================================
   Farm
   ========================================================================== */
.farm-section {
  display: grid;
  gap: 0;
  margin-top: var(--space-4);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.farm-summary {
  min-height: 82px;
}

.farm-content {
  display: grid;
  gap: var(--space-4);
  padding: 0 var(--space-5) var(--space-5);
}

.farm-gold {
  display: grid;
  min-width: 170px;
  gap: var(--space-1);
  padding: 12px 16px;
  border: 1px solid var(--warning-line);
  border-radius: var(--r-md);
  background: var(--warning-bg);
}

.farm-gold-label,
.farm-gold-rate {
  color: var(--muted);
  font-size: var(--fs-xs);
}

.farm-gold strong {
  color: var(--warning);
  font-size: var(--fs-2xl);
}

.farm-message,
.farm-area-note {
  margin: 0;
  color: var(--text-soft);
  font-size: var(--fs-md);
  line-height: 1.55;
}

.farm-message-error {
  color: var(--danger);
}

.farm-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.farm-picked-location {
  flex: 1 1 220px;
  color: var(--muted);
  font-size: var(--fs-md);
}

.farm-controls .button {
  min-height: 42px;
}

.farm-controls .button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.55);
  opacity: 0.55;
  transform: none;
}

.farm-upgrade-form {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid rgba(var(--warning-rgb), 0.25);
  border-radius: var(--r-md);
  background: rgba(var(--warning-rgb), 0.06);
}

.farm-upgrade-details {
  flex: 1 1 230px;
  color: var(--warning);
  font-size: var(--fs-md);
  font-weight: 700;
}

.farm-max-level {
  color: var(--warning);
  font-weight: 700;
}

.farm-sharing {
  display: grid;
  gap: 13px;
  padding: 16px;
  border: 1px solid rgba(var(--sage-rgb), 0.2);
  border-radius: var(--r-md);
  background: var(--surface-raised);
}

.farm-sharing-heading h3,
.farm-share-list h4 {
  margin: 0;
  color: var(--text);
  font-size: var(--fs-base);
}

.farm-sharing-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.farm-share-form {
  display: grid;
  gap: 6px;
}

.farm-share-form label {
  color: var(--text-soft);
  font-size: var(--fs-sm);
  font-weight: 700;
}

.farm-share-input-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.farm-share-input-row input {
  min-width: 180px;
  min-height: 42px;
  flex: 1;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-raised);
  color: var(--text);
}

.farm-share-input-row input:focus-visible {
  outline: 3px solid rgba(var(--sage-rgb), 0.55);
  outline-offset: 2px;
}

.farm-share-input-row .button {
  min-height: 42px;
}

.farm-access-request-form {
  margin-top: 4px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.farm-share-list {
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.farm-share-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  color: var(--text-soft);
  font-size: var(--fs-sm);
}

.farm-share-pending {
  border-color: rgba(var(--warning-rgb), 0.22);
  background: rgba(var(--warning-rgb), 0.045);
}

.farm-share-row > span {
  flex: 1 1 210px;
}

.farm-share-row > form {
  margin: 0;
}

.farm-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.farm-share-small-button {
  min-height: 34px;
  padding: 0 12px;
  font-size: var(--fs-xs);
}

.farm-share-status,
.farm-share-feedback {
  margin: 0;
  color: var(--text-soft);
  font-size: var(--fs-sm);
}

.farm-share-feedback {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.farm-share-success {
  border-color: var(--success-line);
  color: var(--success-soft);
}

.farm-share-error {
  border-color: rgba(var(--danger-rgb), 0.28);
  color: var(--danger);
}

.farm-area-note {
  padding-top: 11px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--fs-xs);
}

.farm-boosts {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(var(--sage-rgb), 0.2);
  border-radius: var(--r-md);
  background: var(--surface-raised);
}

.farm-boosts h3 {
  margin: 0;
  font-size: var(--fs-base);
}

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

.farm-boost-status {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--muted);
  font-size: var(--fs-xs);
}

.farm-boost-status strong {
  color: var(--text-soft);
}

.farm-shop-status,
.farm-shop-attribution {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.5;
}

.farm-shop-status[data-state="error"] {
  color: var(--danger);
}

.farm-shop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 10px;
}

.farm-shop-toolbar p {
  margin: 0;
  color: var(--text-soft);
  font-size: var(--fs-sm);
}

.farm-shop-toolbar .button {
  min-height: 38px;
  padding: 7px 12px;
  font-size: var(--fs-sm);
}

.farm-fuel-price {
  margin: 0 2px 12px;
  color: var(--success-soft);
  font-size: var(--fs-md);
  font-weight: 700;
}

.farm-fuel-price[data-state="error"] {
  color: var(--danger);
  font-weight: 500;
}

.farm-shop-attribution {
  margin-top: 2px;
  text-align: right;
}

.farm-shop-attribution a {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.farm-shop-marker {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 2px solid var(--marker-border);
  border-radius: 50%;
  box-shadow: var(--shadow-marker);
  font-size: 21px;
  line-height: 1;
}

.farm-cooperative-marker {
  background: var(--marker-cooperative);
}

.farm-equipment-marker {
  background: var(--marker-equipment);
}

.farm-shop-popup {
  display: grid;
  min-width: 235px;
  gap: 7px;
  color: var(--text);
  font-family: var(--font-sans);
}

.farm-shop-popup > strong {
  font-size: var(--fs-base);
}

.farm-shop-popup p {
  margin: 0;
  font-size: var(--fs-xs);
  line-height: 1.45;
}

.farm-shop-quote-status[data-state="error"] {
  color: var(--danger);
  font-weight: 700;
}

.farm-shop-popup a {
  color: var(--accent);
  font-size: var(--fs-xs);
  text-decoration: underline;
}

.farm-shop-actions {
  display: grid;
  gap: 6px;
}

.farm-shop-actions .farm-shop-fare,
.farm-shop-actions .farm-shop-pricing-note {
  margin: 0;
}

.farm-shop-buy {
  min-height: 36px;
  padding: 5px 10px;
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  white-space: normal;
}

.farm-shop-route {
  min-height: 36px;
  padding: 5px 10px;
  font-size: var(--fs-xs);
  white-space: normal;
}

.farm-shop-buy:disabled {
  cursor: wait;
  opacity: 0.65;
}

.route-start-marker,
.route-destination-marker {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 2px solid white;
  border-radius: 50% 50% 50% var(--r-sm);
  box-shadow: var(--shadow-marker);
  color: white;
  font-size: var(--fs-xs);
  font-weight: 900;
  transform: rotate(-45deg);
}

.route-start-marker span,
.route-destination-marker span {
  transform: rotate(45deg);
}

.route-start-marker {
  background: var(--marker-start);
}

.route-destination-marker {
  background: var(--marker-destination);
}

.cow-farm-marker {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--marker-cow);
  box-shadow: var(--shadow-marker);
  font-size: 25px;
  line-height: 1;
}

.route-report-marker {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border: 2px solid var(--marker-border);
  border-radius: 50%;
  background: var(--marker-report);
  box-shadow: var(--shadow-marker);
  color: white;
  font-size: var(--fs-base);
  font-weight: 900;
}

.map-section {
  margin-top: var(--space-4);
  padding-top: 0;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.map-content {
  padding: 0 var(--space-4) var(--space-3);
}

.map-canvas-wrap {
  position: relative;
}

.map-route-planner {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 900;
  width: min(430px, calc(100% - 24px));
  margin: 0;
  overflow: hidden;
  border-color: var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
  box-shadow: var(--shadow-lg);
}

.map-route-planner.cosmic-hidden {
  display: none;
}

.map-route-planner > .section-summary {
  min-height: 58px;
  padding: 9px 12px;
  border-radius: var(--r-lg);
}

.map-route-planner .section-summary-copy .eyebrow {
  margin-bottom: 2px;
}

.map-route-planner .section-summary-copy > strong {
  font-size: var(--fs-base);
}

.map-route-planner .section-summary-copy > span:last-child:not(.eyebrow) {
  display: none;
}

.map-route-planner .route-badge {
  min-height: 28px;
  padding: 0 9px;
  font-size: var(--fs-xs);
}

.map-route-planner .route-content {
  max-height: min(58vh, 430px);
  overflow-y: auto;
  padding: 0 12px 12px;
}

.map-route-planner .route-controls {
  grid-template-columns: 1fr;
  gap: 8px;
  margin-top: 0;
}

.map-route-planner .route-endpoint {
  gap: 8px;
  padding: 8px;
  border-radius: var(--r-md);
}

.map-route-planner .endpoint-symbol {
  width: 30px;
  height: 30px;
  flex-basis: 30px;
}

.map-route-planner .pick-route-point {
  min-height: 34px;
  padding: 0 10px;
}

.map-route-planner .route-submit {
  min-height: 40px;
}

.map-route-planner .route-pick-hint {
  margin-top: 8px;
  font-size: var(--fs-xs);
}

.map-route-planner .route-data-note {
  margin-top: 9px;
  font-size: var(--fs-xs);
}

.map-toolbar h2,
.account-heading h2 {
  margin: 0;
  font-size: var(--fs-title);
  letter-spacing: -0.06em;
}

.selected-location {
  max-width: 48%;
  margin: 0;
  color: var(--accent-blue);
  font-size: var(--fs-base);
  text-align: right;
}

/* ==========================================================================
   Map, shops and route planner
   ========================================================================== */
#worldMap {
  width: 100%;
  height: min(62vh, 620px);
  min-height: 380px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--map-water);
  box-shadow: var(--shadow);
}

#worldMap.cosmic-zoom-active {
  background: var(--cosmos-bg);
}

#worldMap.cosmic-zoom-active .leaflet-pane {
  display: none;
}

#worldMap.cosmic-zoom-active .leaflet-control-attribution {
  display: none;
}

.cosmic-scene {
  position: absolute;
  inset: 0;
  z-index: 450;
  display: none;
  overflow: hidden;
  border-radius: inherit;
  background:
    radial-gradient(ellipse at 50% 55%, rgba(27, 40, 92, 0.42), transparent 48%),
    radial-gradient(ellipse at 16% 82%, rgba(68, 26, 91, 0.28), transparent 38%),
    var(--cosmos-bg);
  color: var(--cosmos-ink);
}

.cosmic-jump-space {
  display: block;
  width: auto;
  min-width: 104px;
  min-height: 26px;
  padding: 4px 8px;
  border: 0;
  border-radius: 0;
  background: #fff;
  color: #233259;
  font-family: inherit;
  font-size: var(--fs-xs);
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}

.cosmic-jump-space:hover,
.cosmic-jump-space:focus-visible {
  background: #e5ebff;
  color: #141b3a;
}

#worldMap.cosmic-zoom-active .cosmic-scene {
  display: block;
}

.cosmic-heading {
  position: absolute;
  top: clamp(18px, 5%, 34px);
  left: 54px;
  z-index: 6;
  max-width: min(430px, calc(100% - 70px));
  text-shadow: 0 2px 14px #030611;
}

.cosmic-eyebrow {
  margin: 0 0 6px;
  color: #b9c7f6;
  font-size: var(--fs-xs);
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.cosmic-title {
  margin: 0;
  font-size: var(--fs-title);
  letter-spacing: -0.04em;
}

.cosmic-description {
  max-width: 400px;
  margin: 8px 0 0;
  color: #d2d7e8;
  font-size: var(--fs-base);
  line-height: 1.5;
}

.cosmic-stage {
  position: absolute;
  inset: 0;
  display: none;
  overflow: hidden;
  transition: opacity 140ms linear;
}

#worldMap.cosmic-zoom-active .cosmic-stage {
  display: block;
}

.cosmic-stage-earth {
  z-index: 2;
  opacity: var(--earth-opacity, 1);
}

.cosmic-stage-solar {
  z-index: 1;
  opacity: var(--solar-opacity, 0);
}

.cosmic-stage-galaxies {
  z-index: 3;
  background: #080c1a;
  opacity: var(--galaxies-opacity, 0);
}

.cosmic-galaxy-map {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

.cosmic-galaxy-map.is-dragging {
  cursor: grabbing;
}

.cosmic-earth-photo {
  position: absolute;
  top: 56%;
  left: 50%;
  width: min(80%, 620px);
  aspect-ratio: 1;
  object-fit: contain;
  border-radius: 50%;
  filter: drop-shadow(0 0 32px rgba(73, 147, 255, 0.55));
  transform: translate(-50%, -50%) scale(var(--earth-zoom, 1));
  transition: transform 100ms linear;
}

.cosmic-solar-system {
  position: absolute;
  inset: 0;
  transform: scale(var(--solar-zoom, 1));
  transform-origin: 50% 56%;
  transition: transform 100ms linear;
}

.cosmic-orbit {
  position: absolute;
  top: 56%;
  left: 50%;
  width: var(--orbit-width);
  height: var(--orbit-height);
  border: 1px solid rgba(191, 207, 255, 0.2);
  border-radius: 50%;
  transform: translate(-50%, -50%);
}

.cosmic-solar-sun {
  position: absolute;
  top: 56%;
  left: 50%;
  width: clamp(62px, 12vw, 142px);
  aspect-ratio: 1;
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 42px rgba(255, 148, 40, 0.65);
}

.cosmic-planet {
  position: absolute;
  top: calc(56% + var(--planet-y));
  left: calc(50% + var(--planet-x));
  min-width: 0;
  margin: 0;
  text-align: center;
  transform: translate(-50%, -50%);
}

.cosmic-planet img {
  display: block;
  width: clamp(12px, var(--planet-size), 42px);
  aspect-ratio: 1;
  margin: 0 auto;
  border-radius: 50%;
  object-fit: contain;
  filter: drop-shadow(0 0 14px rgba(103, 146, 255, 0.34));
}

.cosmic-planet figcaption {
  color: #f5f4ff;
  font-size: var(--fs-2xs);
  font-weight: 700;
  text-shadow: 0 2px 8px #030611;
}

.cosmic-image-credit {
  position: absolute;
  right: 12px;
  bottom: 52px;
  left: 12px;
  margin: 0;
  color: #cbd2e5;
  font-size: var(--fs-2xs);
  text-align: center;
  text-shadow: 0 1px 8px #030611;
}

.cosmic-image-credit a {
  color: #d8e0ff;
  text-decoration: underline;
}

.cosmic-stage-galaxies .cosmic-image-credit {
  right: auto;
  bottom: 10px;
  left: 12px;
  z-index: 2;
  width: min(72%, 760px);
  text-align: left;
}

.cosmic-return {
  position: absolute;
  right: 18px;
  bottom: 14px;
  z-index: 7;
  min-height: 40px;
  padding: 0 15px;
  border: 1px solid rgba(217, 225, 255, 0.38);
  border-radius: var(--r-pill);
  background: rgba(18, 26, 50, 0.86);
  color: #f4f0e7;
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-sm);
  font-weight: 700;
}

.cosmic-return:hover,
.cosmic-return:focus-visible {
  border-color: #b6c5ff;
  background: #26345e;
}

.map-attribution {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: var(--fs-xs);
  text-align: right;
}

.map-attribution a {
  text-decoration: underline;
}

.chat-section {
  display: grid;
  gap: 0;
  margin-top: var(--space-4);
}

.chat-summary {
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chat-content-wrap {
  padding-top: 14px;
}

.chat-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 11px;
  border: 1px solid rgba(var(--success-rgb), 0.24);
  border-radius: var(--r-pill);
  background: rgba(var(--success-rgb), 0.08);
  color: var(--success-soft);
  font-size: var(--fs-xs);
  font-weight: 700;
  white-space: nowrap;
}

.chat-live-badge span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 10px rgba(var(--success-rgb), 0.45);
}

/* ==========================================================================
   Chat
   ========================================================================== */
.chat-panel {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.chat-tabs {
  display: flex;
  gap: 4px;
  padding: 8px 12px 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface-raised);
}

.chat-tab {
  min-height: 44px;
  padding: 0 16px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: var(--fs-md);
  font-weight: 700;
}

.chat-tab:hover,
.chat-tab:focus-visible {
  color: var(--text);
}

.chat-tab.is-active {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.chat-content {
  padding: 16px;
}

.chat-content[hidden],
.chat-form[hidden] {
  display: none;
}

.chat-messages {
  display: flex;
  min-height: 150px;
  max-height: 340px;
  flex-direction: column;
  gap: 9px;
  overflow-y: auto;
  margin: 0;
  padding: 4px 8px 14px 0;
  list-style: none;
  overscroll-behavior: contain;
  scrollbar-color: rgba(var(--sage-rgb), 0.4) var(--surface-raised);
}

.chat-message {
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-raised);
}

.chat-message-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.chat-message-author {
  color: var(--accent);
  font-size: var(--fs-sm);
}

.chat-message-time {
  color: var(--muted);
  font-size: var(--fs-xs);
  white-space: nowrap;
}

.chat-message-text {
  margin: 3px 0 0;
  color: var(--text-soft);
  font-size: var(--fs-md);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.chat-status {
  min-height: 1.5em;
  margin: 2px 0 10px;
  color: var(--muted);
  font-size: var(--fs-sm);
}

.chat-status[data-state="error"] {
  color: var(--danger);
}

.chat-form {
  display: grid;
  gap: 8px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.chat-form textarea,
.private-chat-recipient {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-raised);
  color: var(--text);
  font: inherit;
}

.chat-form textarea {
  min-height: 72px;
  padding: 10px 12px;
  resize: vertical;
}

.private-chat-recipient {
  max-width: 430px;
  min-height: 44px;
  margin-bottom: 12px;
  padding: 0 12px;
}

.private-chat-recipient option {
  background: var(--surface-raised);
  color: var(--text);
}

.private-chat-label {
  display: block;
  margin-bottom: 6px;
  color: var(--text-soft);
  font-size: var(--fs-md);
  font-weight: 700;
}

.chat-form textarea:focus-visible,
.private-chat-recipient:focus-visible {
  outline: 3px solid rgba(var(--sage-rgb), 0.55);
  outline-offset: 2px;
}

.chat-form textarea::placeholder {
  color: var(--muted);
}

.chat-form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.chat-counter {
  color: var(--muted);
  font-size: var(--fs-xs);
}

.chat-form .button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.chat-signin-note,
.chat-guidelines {
  margin: 10px 0 0;
  color: var(--text-soft);
  font-size: var(--fs-sm);
}

.chat-signin-note a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chat-guidelines {
  color: var(--muted);
  font-size: var(--fs-xs);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.leaflet-container {
  font-family: var(--font-sans);
}

.custom-marker-icon {
  border: 0;
  background: transparent;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  background: var(--surface-raised);
  color: var(--text);
}

.leaflet-popup-content {
  margin: 11px 14px;
}

.player-tooltip {
  font-weight: 700;
}

.player-marker {
  width: 19px;
  height: 19px;
  border: 3px solid white;
  border-radius: 50%;
  background: var(--marker-player);
  box-shadow: var(--shadow-marker);
}

.selected-marker {
  display: block;
  width: 42px;
  height: 42px;
  overflow: visible;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.85)) drop-shadow(0 0 8px rgba(var(--danger-rgb), 0.85));
}

/* ==========================================================================
   Account and authentication
   ========================================================================== */
.account-section {
  display: block;
  padding-top: var(--space-4);
}

.account-summary {
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
}

.account-content {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 20px;
  padding-top: 18px;
}

.auth-content {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  align-items: start;
  gap: 20px;
}

.auth-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
  gap: 22px;
}

.account-card {
  padding: 26px;
}

.auth-card {
  position: relative;
  overflow: hidden;
  padding: 26px;
}

.signup-card {
  border-color: rgba(var(--accent-rgb), 0.4);
  background:
    radial-gradient(ellipse at top left, rgba(var(--accent-rgb), 0.12), transparent 54%),
    var(--surface);
}

.signin-card {
  border-color: rgba(var(--sage-rgb), 0.32);
  background:
    radial-gradient(ellipse at top left, rgba(var(--sage-rgb), 0.1), transparent 54%),
    var(--surface);
}

.auth-card-heading {
  position: relative;
  min-height: 150px;
  margin-bottom: 22px;
  padding: 0 0 20px 58px;
  border-bottom: 1px solid var(--line);
}

.auth-card-heading .eyebrow {
  padding-top: 2px;
  font-size: var(--fs-xs);
}

.auth-card-heading h2 {
  margin: 7px 0 6px;
  font-size: var(--fs-title);
  letter-spacing: -0.06em;
  line-height: 1.12;
}

.auth-card-heading > p:last-child {
  margin: 0;
  color: var(--text-soft);
  font-size: var(--fs-md);
}

.auth-icon {
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  font-size: var(--fs-2xl);
  font-weight: 700;
}

.signup-icon {
  border-color: rgba(var(--accent-rgb), 0.36);
  background: rgba(var(--accent-rgb), 0.14);
  color: var(--accent);
}

.signin-icon {
  border-color: var(--sage-line);
  background: var(--surface-sunken);
  color: var(--accent-blue);
}

.optional-label {
  margin-left: 5px;
  color: var(--muted);
  font-size: var(--fs-xs);
  font-weight: 400;
}

.account-heading {
  margin-bottom: 22px;
}

.account-heading > p:last-child {
  margin: 8px 0 0;
  color: var(--text-soft);
}

.account-form,
.login-form {
  display: grid;
  gap: 9px;
}

.account-form label:not(.checkbox-row),
.login-form label {
  margin-top: 5px;
  color: var(--text-soft);
  font-size: var(--fs-md);
  font-weight: 600;
}

.account-form input:not([type="hidden"]),
.login-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  outline: none;
  background: var(--surface-raised);
  color: var(--text);
}

.account-form input:focus,
.login-form input:focus {
  border-color: var(--accent);
}

.checkbox-row {
  display: flex;
  align-items: start;
  gap: 10px;
  margin: 8px 0;
  max-width: 100%;
  color: var(--text-soft);
  font-size: var(--fs-md);
}

.checkbox-row input {
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  margin: 2px 0 0;
  border: 1px solid var(--surface);
  border-radius: var(--r-xs);
  accent-color: var(--accent);
  cursor: pointer;
}

.checkbox-row span {
  flex: 1 1 auto;
  min-width: 0;
}

.checkbox-row input:focus-visible {
  outline: 3px solid rgba(var(--sage-rgb), 0.75);
  outline-offset: 2px;
}

.login-form .button {
  margin-top: 8px;
}

.auth-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 8px;
  border-radius: var(--r-md);
}

.signin-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 24px;
  padding: 14px;
  border: 1px solid rgba(var(--sage-rgb), 0.2);
  border-radius: var(--r-md);
  background: rgba(var(--sage-rgb), 0.06);
  color: var(--text-soft);
  font-size: var(--fs-sm);
}

.signin-note-mark {
  color: var(--accent-blue);
  font-weight: 800;
}

.privacy-card {
  align-self: start;
  padding: 25px;
  background: var(--surface);
}

.privacy-icon {
  display: inline-grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: var(--r-md);
  background: rgba(var(--sage-rgb), 0.13);
  color: var(--accent-blue);
  font-size: var(--fs-2xl);
}

.privacy-card h3 {
  margin: 15px 0 8px;
}

.privacy-card p {
  margin: 0;
  color: var(--text-soft);
  font-size: var(--fs-base);
}

.legal-page a {
  color: var(--accent);
}

.legal-page {
  max-width: 900px;
  padding-top: 48px;
  padding-bottom: 24px;
}

.landing-page {
  padding-top: 48px;
  padding-bottom: 36px;
}

/* ==========================================================================
   Landing, services, legal
   ========================================================================== */
.landing-hero {
  max-width: 850px;
  margin: 0 auto 48px;
  padding: clamp(28px, 6vw, 64px);
  border: 1px solid var(--surface-dark);
  border-radius: var(--r-xl);
  background: var(--surface-dark);
  box-shadow: var(--shadow-lg);
  color: var(--ink-inverse);
  text-align: center;
}

.landing-hero h1 {
  max-width: 720px;
  margin: 0 auto;
  color: var(--ink-inverse);
  font-size: var(--fs-display);
  letter-spacing: -0.04em;
  line-height: 1.02;
}

.landing-hero > p:not(.eyebrow) {
  max-width: 620px;
  margin: 20px auto 24px;
  color: var(--ink-inverse-soft);
  font-size: var(--fs-xl);
}

.landing-hero .eyebrow {
  color: var(--ink-on-dark-muted);
}

.landing-hero .button-secondary {
  border-color: rgba(247, 242, 233, 0.34);
  color: var(--ink-inverse);
}

.landing-hero .button-secondary:hover,
.landing-hero .button-secondary:focus-visible {
  border-color: var(--ink-inverse);
  background: rgba(247, 242, 233, 0.12);
  color: var(--ink-inverse);
}

.landing-hero .cta-row {
  justify-content: center;
}

.landing-section {
  margin: 0 auto 52px;
  scroll-margin-top: 100px;
}

.landing-section-heading {
  max-width: 760px;
  margin-bottom: 22px;
}

.landing-section-heading h2,
.landing-final-cta h2 {
  margin: 0;
  font-size: var(--fs-title);
  letter-spacing: -0.055em;
  line-height: 1.1;
}

.landing-section-heading > p:last-child:not(.eyebrow) {
  margin: 12px 0 0;
  color: var(--text-soft);
}

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

.landing-guide-card {
  min-width: 0;
  padding: var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.landing-guide-card:hover {
  transform: translateY(-2px);
  border-color: var(--sage-line);
  box-shadow: var(--shadow-md);
}

.landing-step {
  display: inline-flex;
  width: 34px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: var(--r-sm);
  background: rgba(var(--sage-rgb), 0.12);
  color: var(--sage);
  font-size: var(--fs-sm);
  font-weight: 800;
  letter-spacing: 0.12em;
}

.landing-guide-card h3 {
  margin: 10px 0 8px;
  font-size: var(--fs-xl);
  letter-spacing: -0.025em;
}

.landing-guide-card p {
  margin: 0;
  color: var(--ink-soft);
  font-size: var(--fs-base);
  line-height: 1.65;
}

.landing-guide-card a {
  display: inline-block;
  margin-top: 14px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.landing-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: var(--fs-md);
}

.landing-faq {
  max-width: 900px;
}

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

.landing-faq summary {
  padding: 16px 0;
  color: var(--text);
  cursor: pointer;
  font-weight: 700;
}

.landing-faq details p {
  margin: 0;
  padding: 0 0 16px;
  color: var(--text-soft);
}

.landing-faq a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.landing-final-cta {
  padding: 34px 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  text-align: center;
}

.landing-final-cta p {
  margin: 10px 0 18px;
  color: var(--text-soft);
}

.services-page {
  padding-top: 48px;
  padding-bottom: 24px;
}

.services-heading {
  max-width: 760px;
  margin-bottom: 24px;
}

.services-heading h1 {
  margin: 0;
  font-size: var(--fs-display);
  letter-spacing: -0.075em;
  line-height: 1;
}

.services-heading > p:last-child {
  margin: 16px 0 0;
  color: var(--text-soft);
  font-size: var(--fs-lg);
}

.affiliate-disclosure {
  margin: 0 0 22px;
  padding: 16px 18px;
  border: 1px solid var(--note-line);
  border-radius: var(--r-md);
  background: var(--note-bg);
  color: var(--note-ink);
}

.landing-guide-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.services-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.service-card {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: var(--space-6);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.service-card-top {
  display: grid;
  gap: var(--space-1);
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
}

.service-starlink .service-category {
  color: var(--accent);
}

.service-kryptex .service-category {
  color: var(--sage);
}

.service-card .service-card-top h2 {
  margin: 0;
}

.service-category {
  color: var(--accent-blue);
  font-size: var(--fs-sm);
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.service-card h2 {
  margin: 6px 0 14px;
  font-size: var(--fs-title);
  letter-spacing: -0.055em;
}

.service-card > p,
.service-card li,
.services-note {
  color: var(--ink-soft);
}

.service-card > p {
  margin: 0 0 12px;
  font-size: var(--fs-lg);
  line-height: 1.65;
}

.service-card ul {
  display: grid;
  gap: var(--space-2);
  margin: 4px 0 16px;
  padding-left: 21px;
}

.service-card li {
  padding-left: 2px;
  line-height: 1.55;
}

.service-card .service-caution {
  margin-top: auto;
  padding: 14px;
  border-left: 3px solid var(--accent);
  border-radius: var(--r-sm) 0 0 var(--r-sm);
  background: var(--bg);
  color: var(--ink-soft);
  font-size: var(--fs-base);
}

.service-cta {
  align-self: flex-start;
  margin-top: 14px;
}

.service-details-link {
  align-self: flex-start;
  margin-top: 14px;
  color: var(--accent);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.services-note {
  margin: 22px 0 0;
  font-size: var(--fs-base);
}

.legal-page h1 {
  margin: 0;
  font-size: var(--fs-display);
  letter-spacing: -0.07em;
  line-height: 1;
}

.legal-updated {
  margin: 12px 0 28px;
  color: var(--muted);
  font-size: var(--fs-base);
}

.legal-page > p,
.legal-page section p,
.legal-page li {
  color: var(--text-soft);
}

.legal-page section {
  margin-top: 30px;
}

.legal-page section h2 {
  margin: 0 0 10px;
  font-size: var(--fs-2xl);
  letter-spacing: -0.035em;
}

.legal-page section p {
  margin: 0 0 12px;
}

.legal-page ul {
  display: grid;
  gap: 9px;
  padding-left: 22px;
}

.legal-page a,
.footer-wrap a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.legal-page .legal-contact {
  margin-top: 34px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--panel);
}

.privacy-note {
  margin: 0;
  color: var(--muted);
  font-size: var(--fs-md);
}

.reset-page {
  max-width: 620px;
}

.reset-page > p:not(.eyebrow, .reset-feedback, .privacy-note) {
  margin: 18px 0 24px;
}

.reset-form {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--panel);
}

.reset-form label {
  color: var(--text-soft);
  font-size: var(--fs-base);
  font-weight: 700;
}

.reset-feedback {
  margin: 18px 0;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}

.reset-error {
  border-color: var(--danger-line);
  color: var(--danger);
  background: var(--danger-bg);
}

.reset-success {
  border-color: var(--success-line);
  color: var(--success);
  background: var(--success-bg);
}

.site-footer {
  padding: 40px 0 30px;
}

.footer-wrap {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--fs-md);
}

.footer-wrap p {
  margin: 0;
}

/* The header runs out of room well before the layout does. */
/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 1024px) {
  .nav-wrap {
    position: relative;
    min-height: 68px;
  }

  .main-nav {
    gap: 18px;
  }

  .nav-wrap.has-mobile-menu > .main-nav,
  .nav-wrap.has-mobile-menu > .nav-form,
  .nav-wrap.has-mobile-menu > .button {
    display: none;
  }

  .nav-wrap.has-mobile-menu > .mobile-menu {
    display: block;
    margin-left: auto;
  }

  .mobile-menu > summary {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    gap: 10px;
    padding: 0 14px;
    border: 1px solid var(--line);
    border-radius: var(--r-pill);
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
    font-weight: 700;
    list-style: none;
  }

  .mobile-menu > summary::-webkit-details-marker {
    display: none;
  }

  .mobile-menu > summary:focus-visible,
  .mobile-menu-panel a:focus-visible,
  .mobile-menu-logout button:focus-visible {
    outline: 3px solid var(--accent-blue);
    outline-offset: 3px;
  }

  .mobile-menu-icon,
  .mobile-menu-icon::before,
  .mobile-menu-icon::after {
    display: block;
    width: 17px;
    height: 2px;
    border-radius: var(--r-xs);
    background: currentColor;
  }

  .mobile-menu-icon {
    position: relative;
  }

  .mobile-menu-icon::before,
  .mobile-menu-icon::after {
    position: absolute;
    left: 0;
    content: "";
  }

  .mobile-menu-icon::before {
    top: -6px;
  }

  .mobile-menu-icon::after {
    top: 6px;
  }

  .mobile-menu[open] > summary {
    border-color: rgba(var(--sage-rgb), 0.55);
  }

  .mobile-menu-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    z-index: 1100;
    display: grid;
    width: min(320px, calc(100vw - 24px));
    gap: 4px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--surface);
    box-shadow: var(--shadow);
  }

  .mobile-menu-panel a {
    display: block;
    padding: 11px 12px;
    border-radius: var(--r-sm);
    color: var(--text);
    font-weight: 650;
  }

  .mobile-menu-panel a:hover {
    background: rgba(var(--sage-rgb), 0.11);
    color: var(--accent);
  }

  .mobile-menu-user {
    padding: 10px 12px 4px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: var(--fs-base);
  }

  .mobile-menu-logout {
    padding: 4px 8px 8px;
  }

  .mobile-menu-logout .button {
    width: 100%;
  }

}

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

  .hero-inner,
  .account-content {
    grid-template-columns: 1fr;
  }

  .route-controls {
    grid-template-columns: 1fr;
  }

  .farm-gold {
    width: 100%;
  }

  .farm-boost-grid {
    grid-template-columns: 1fr;
  }

  .farm-summary {
    flex-wrap: wrap;
  }

  .farm-summary .farm-gold {
    width: auto;
  }

  .route-submit {
    min-height: 46px;
  }

  .auth-content {
    grid-column: auto;
    grid-template-columns: 1fr;
  }

}

@media (max-width: 560px) {
  .container {
    width: min(100% - 24px, 1180px);
  }

  .nav-wrap {
    min-height: 68px;
  }

  .landing-guide-grid {
    grid-template-columns: 1fr;
  }

  .signed-in {
    display: none;
  }

  .nav-wrap > .mobile-menu > summary {
    min-height: 40px;
    padding: 0 13px;
    font-size: var(--fs-md);
  }

  .cosmic-heading {
    top: 76px;
    left: 12px;
    max-width: calc(100% - 24px);
  }

  .cosmic-planet figcaption,
  .cosmic-planet figcaption {
    font-size: var(--fs-2xs);
  }

  .cosmic-solar-sun {
    width: 62px;
  }

  .cosmic-image-credit {
    right: 8px;
    bottom: 55px;
    left: 8px;
    font-size: var(--fs-2xs);
  }

  .cosmic-stage-galaxies .cosmic-image-credit {
    right: auto;
    bottom: 8px;
    left: 8px;
    width: 64%;
    font-size: var(--fs-2xs);
  }

  .cosmic-return {
    right: 10px;
    bottom: 10px;
  }

  .chat-content {
    padding: 12px;
  }

  .chat-tabs {
    padding-right: 6px;
    padding-left: 6px;
  }

  .chat-tab {
    flex: 1;
    padding: 0 8px;
    font-size: var(--fs-sm);
  }

  .route-content {
    padding: 0 16px 18px;
  }

  .farm-content {
    padding: 0 16px 16px;
  }

  .section-summary {
    padding: 12px 14px;
  }

  .section-summary-copy > span:last-child:not(.eyebrow) {
    max-width: 55ch;
  }

  .map-content {
    padding: 0 10px 10px;
  }

  .map-summary {
    flex-wrap: wrap;
  }

  .map-summary .selected-location {
    max-width: calc(100% - 46px);
    flex: 1;
    text-align: left;
  }

  .farm-summary {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .farm-summary .farm-gold {
    width: auto;
    min-width: 120px;
    padding: 8px 10px;
  }

  .farm-summary .farm-gold strong {
    font-size: var(--fs-lg);
  }

  .route-endpoint {
    flex-wrap: wrap;
  }

  .route-endpoint .pick-route-point {
    margin-left: 46px;
  }

  .route-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .route-metrics {
    justify-content: flex-start;
  }

  .selected-location {
    max-width: none;
    text-align: left;
  }

  #worldMap {
    height: 56vh;
    min-height: 340px;
  }

  .map-route-planner {
    top: 8px;
    left: 8px;
    width: min(390px, calc(100% - 16px));
  }

  .map-route-planner .route-content {
    max-height: 52vh;
  }

  .account-card,
  .map-intro {
    padding: 20px;
  }

  .auth-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .auth-card {
    padding: 20px;
  }

  .auth-card-heading {
    min-height: auto;
    padding-bottom: 18px;
  }

  .footer-wrap {
    flex-direction: column;
  }
}

/* ==========================================================================
   Readability and rhythm
   ========================================================================== */

/* Headings break more evenly on narrow screens. */
h1,
h2,
h3,
.section-summary-copy > strong {
  text-wrap: balance;
}

/* Long paragraphs read better at a fixed measure. */
.section-content > p,
.section-content > .farm-message,
.landing-section-heading > p:last-child,
.landing-hero > p:not(.eyebrow) {
  max-width: var(--measure);
}

.landing-hero > p:not(.eyebrow) {
  margin-inline: auto;
}

/* Anchors must not disappear under the sticky header. */
[id] {
  scroll-margin-top: calc(var(--header-h) + 12px);
}

::selection {
  background: rgba(var(--accent-rgb), 0.2);
}

/* A single, visible focus ring for everything interactive. */
:focus-visible {
  outline: 3px solid rgba(var(--sage-rgb), 0.65);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ==========================================================================
   Header state — the link of the section you are looking at
   ========================================================================== */
.main-nav a {
  position: relative;
  padding-block: 6px;
}

.main-nav a::after {
  position: absolute;
  right: 0;
  bottom: -2px;
  left: 0;
  height: 2px;
  border-radius: var(--r-xs);
  background: var(--accent);
  content: "";
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.18s ease;
}

.main-nav a.is-active {
  color: var(--accent);
}

.main-nav a.is-active::after {
  transform: scaleX(1);
}

/* ==========================================================================
   Quick start — three steps for new players
   ========================================================================== */
.quickstart {
  display: grid;
  width: min(var(--container), calc(100% - 36px));
  margin: var(--space-4) auto 0;
  gap: var(--space-3);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.quickstart-step {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: var(--fs-md);
  line-height: 1.5;
}

.quickstart-step strong {
  display: block;
  color: var(--ink);
  font-size: var(--fs-base);
}

.quickstart-step a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.quickstart-num {
  display: grid;
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  place-items: center;
  border-radius: var(--r-pill);
  background: rgba(var(--sage-rgb), 0.18);
  color: var(--sage);
  font-size: var(--fs-sm);
  font-weight: 800;
}

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

/* ==========================================================================
   Loading state — a small spinner while data is fetched
   ========================================================================== */
@keyframes tepanje-spin {
  to {
    transform: rotate(360deg);
  }
}

.is-loading::after {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.55em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  vertical-align: -0.1em;
  animation: tepanje-spin 0.75s linear infinite;
}

/* ==========================================================================
   Dark theme — the same tokens, re-pointed
   ========================================================================== */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --bg: #14181a;
    --surface: #1b2022;
    --surface-raised: #232a2c;
    --surface-sunken: #1f2624;
    --surface-dark: #0d1011;
    --surface-glass: rgba(20, 24, 26, 0.92);
    --line: #2e3537;

    --ink: #f2efe8;
    --ink-soft: #b9bdb6;
    --ink-muted: #9aa096;
    --ink-inverse: #f2efe8;
    --ink-inverse-soft: #c3c7c0;
    --ink-on-dark-muted: #98a094;

    --accent: #e08a55;
    --accent-hover: #eda06b;
    --accent-soft: #33241c;
    --on-accent: #17130f;
    --sage: #8fb397;
    --sage-line: #33403a;
    --accent-rgb: 224, 138, 85;
    --sage-rgb: 143, 179, 151;

    --danger: #e08b7d;
    --danger-line: #5b3a33;
    --danger-bg: #3a2420;
    --success: #8fc79c;
    --success-soft: #9bd0a7;
    --success-line: #33503c;
    --success-bg: #1f2f24;
    --warning: #e6c17e;
    --warning-line: #5c4a2b;
    --warning-bg: #33291a;
    --note-ink: #e7cdb8;
    --note-line: #57443a;
    --note-bg: #2f2620;
    --danger-rgb: 224, 139, 125;
    --success-rgb: 143, 199, 156;
    --warning-rgb: 230, 193, 126;

    --map-water: #232b2e;

    --shadow-sm: 0 2px 6px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.55);
    --shadow-marker: 0 2px 10px rgba(0, 0, 0, 0.6);
  }

  .brand-mark {
    color: #17130f;
  }

  /* Keep the dark showcase cards distinguishable from the page. */
  .map-intro,
  .landing-hero {
    border-color: var(--line);
  }

  .leaflet-popup-content-wrapper,
  .leaflet-popup-tip {
    background: var(--surface-raised);
    color: var(--ink);
  }

  .leaflet-container a.leaflet-popup-close-button {
    color: var(--ink-muted);
  }
}

