@font-face {
  font-family: 'Source Serif 4';
  src: url('/fonts/source-serif-4.var.woff2') format('woff2-variations');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('/fonts/source-serif-4-italic.var.woff2') format('woff2-variations');
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: 'Source Sans 3';
  src: url('/fonts/source-sans-3.var.woff2') format('woff2-variations');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Source Code Pro';
  src: url('/fonts/source-code-pro.var.woff2') format('woff2-variations');
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #1C1E21;
  --surface: #24262A;
  --surface-hi: #2E3136;
  --text: #FFFFFF;
  --text-2: #E4E6EB;
  --muted: #B0B3B8;
  --focus: #00D4FF;
  --focus-glow: rgba(0, 212, 255, 0.4);
  --ok: #4ADE80;
  --warn: #FACC15;
  --err: #F87171;
  --danger: #FF4466;
  --primary: #00D4FF;
  --primary-on: #0A1014;
  --accent: #46A4D9;
  --accent-glow: rgba(70, 164, 217, 0.55);
  --serif: 'Source Serif 4', 'New York', Georgia, serif;
  --mono: 'Source Code Pro', 'SF Mono', Menlo, ui-monospace, monospace;
  --sans: 'Source Sans 3', -apple-system, BlinkMacSystemFont, sans-serif;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --ease-out: cubic-bezier(0.16, 0.84, 0.32, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);
  --ease-soft: cubic-bezier(0.32, 0.72, 0.32, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 600px;
  height: 600px;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}

#app {
  width: 600px;
  height: 600px;
  position: relative;
}

.screen {
  position: absolute;
  inset: 0;
  width: 600px;
  height: 600px;
  display: flex;
  flex-direction: column;
}
.screen.hidden { display: none !important; }
.hidden { display: none !important; }

.header {
  display: flex;
  align-items: center;
  padding: 18px 24px 16px;
  background: transparent;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  gap: 12px;
  flex: 0 0 auto;
}
.header h1 {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 32px;
  letter-spacing: 0.005em;
  line-height: 1.1;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding-top: 8px;
}
#summary .header { padding: 12px 24px 10px; }
#summary .header h1 { font-size: 28px; padding-top: 4px; }
.back-btn {
  background: transparent;
  color: var(--text);
  font-size: 28px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  min-width: 52px;
  min-height: 52px;
}
.header-icon {
  background: transparent;
  color: var(--text-2);
  font-size: 28px;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  min-width: 52px;
  min-height: 52px;
}

.content {
  flex: 1;
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.stack-center {
  align-items: center;
  justify-content: center;
  text-align: center;
}

.focusable {
  transition:
    border-color 180ms ease,
    box-shadow 220ms ease,
    background-color 180ms ease,
    color 180ms ease,
    filter 160ms ease,
    transform 220ms var(--ease-soft);
  border: 2px solid transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.focusable:focus,
.focusable:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 24px var(--focus-glow);
}
.focusable:active {
  transition-duration: 90ms;
  transform: scale(0.96);
}

/* Per-type press feedback */
.nav-item.primary:active {
  filter: brightness(1.12) saturate(1.06);
  box-shadow: 0 0 28px var(--focus-glow);
}
.nav-item.danger:active {
  filter: brightness(1.12);
  box-shadow: 0 0 22px rgba(255, 68, 102, 0.45);
}
.nav-item:not(.primary):not(.danger):active {
  background: var(--bg);
  filter: brightness(1.18);
}
.new-hike-card:active {
  filter: brightness(1.08) saturate(1.06);
  box-shadow: 0 0 28px var(--focus-glow);
}
.hike-row:active {
  background: var(--surface-hi);
  filter: brightness(1.05);
}
.settings-row:active {
  background: var(--surface-hi);
}
.back-btn:active,
.header-icon:active {
  background: rgba(255, 255, 255, 0.08);
}
.hud-tap-zone:active {
  box-shadow: inset 0 0 0 2px var(--focus), inset 0 0 50px var(--focus-glow);
}

.nav-bar {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  background: var(--surface);
  flex: 0 0 auto;
}
.nav-bar-stack { flex-direction: column; }
.nav-item {
  flex: 1;
  min-height: 64px;
  padding: 16px 20px;
  background: var(--surface-hi);
  border-radius: var(--radius-md);
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid transparent;
  cursor: pointer;
}
.nav-item.primary {
  background: var(--primary);
  color: var(--primary-on);
}
.nav-item.danger { background: var(--danger); color: white; }
.nav-item[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
  background: var(--surface-hi);
  color: var(--muted);
}

/* ===== Splash ===== */
#splash {
  position: absolute;
  inset: 0;
  width: 600px;
  height: 600px;
  overflow: hidden;
  background:
    radial-gradient(120% 80% at 50% 38%, rgba(70, 164, 217, 0.06) 0%, transparent 55%),
    linear-gradient(180deg, #14171B 0%, #1C1E21 55%, #181A1D 100%);
}

.splash-topo {
  position: absolute;
  inset: 0;
  width: 600px;
  height: 600px;
  opacity: 0;
  animation: splash-fade 900ms 80ms cubic-bezier(.16,.84,.32,1) forwards;
  pointer-events: none;
}
.splash-topo-lines path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.085);
  stroke-width: 1.25;
}
.splash-topo-lines path:nth-child(odd) { stroke: rgba(255, 255, 255, 0.07); }
.splash-topo-lines path:nth-child(6),
.splash-topo-lines path:nth-child(7) { stroke: rgba(70, 164, 217, 0.14); }

.splash-stage {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 32px 110px;
  text-align: center;
}

.splash-logo {
  width: 144px;
  height: auto;
  display: block;
  margin-bottom: 24px;
  opacity: 0;
  animation: splash-pop 620ms 220ms cubic-bezier(.16,.84,.32,1) forwards;
}

.splash-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 68px;
  letter-spacing: 0.005em;
  line-height: 0.95;
  color: #FFFFFF;
  margin: 0;
  opacity: 0;
  animation: splash-rise 720ms 380ms cubic-bezier(.16,.84,.32,1) forwards;
}

.splash-rule {
  display: block;
  width: 64px;
  height: 1.5px;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent-glow);
  margin: 18px 0 12px;
  transform: scaleX(0);
  transform-origin: center;
  animation: splash-grow 620ms 600ms cubic-bezier(.16,.84,.32,1) forwards;
}

.splash-tagline {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.44em;
  text-transform: uppercase;
  color: rgba(232, 236, 240, 0.62);
  padding-left: 0.44em;
  margin: 0;
  opacity: 0;
  animation: splash-fade 620ms 760ms cubic-bezier(.16,.84,.32,1) forwards;
}

.splash-ridge {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 600px;
  height: 120px;
  display: block;
  opacity: 0;
  animation: splash-fade 900ms 900ms cubic-bezier(.16,.84,.32,1) forwards;
  pointer-events: none;
}
.splash-ridge polyline {
  fill: rgba(255, 255, 255, 0.035);
  stroke: rgba(255, 255, 255, 0.42);
  stroke-width: 1.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

@keyframes splash-fade { to { opacity: 1; } }
@keyframes splash-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes splash-pop {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}
@keyframes splash-grow {
  to { transform: scaleX(1); }
}

/* ===== Permission ===== */
.permission-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  font-size: 44px;
  letter-spacing: 0.005em;
  line-height: 1;
  margin-top: 24px;
  color: var(--text);
}
.title-rule {
  display: block;
  width: 56px;
  height: 1.5px;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent-glow);
  margin: 18px auto 4px;
}
.permission-body {
  font-family: var(--sans);
  font-size: 20px;
  color: var(--text-2);
  max-width: 500px;
  line-height: 1.45;
}
.permission-status {
  font-family: var(--sans);
  font-size: 18px;
  color: var(--muted);
  min-height: 1.4em;
}
.permission-status.error { color: var(--err); }
.permission-status.ok { color: var(--ok); }

/* ===== List (Past Hikes) ===== */
.list-content { padding-bottom: 32px; }
.hikes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.new-hike-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--primary);
  color: var(--primary-on);
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  border: 2px solid transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.new-hike-card:focus,
.new-hike-card:focus-visible {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 24px var(--focus-glow);
}
.new-hike-plus {
  font-size: 40px;
  font-weight: 300;
  line-height: 1;
  background: rgba(10, 16, 20, 0.18);
  width: 52px;
  height: 52px;
  border-radius: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 7px;
}
.new-hike-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  font-size: 26px;
  letter-spacing: 0.005em;
}
.new-hike-sub {
  font-family: var(--sans);
  font-size: 16px;
  opacity: 0.85;
  letter-spacing: 0.01em;
}

.hike-row {
  display: block;
  width: 100%;
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  text-align: left;
  border: 2px solid transparent;
  cursor: pointer;
  font: inherit;
}
.hike-row-title {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  font-size: 24px;
  letter-spacing: 0.005em;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.hike-row-title > span:first-child {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hike-row-chev { color: var(--muted); font-size: 24px; flex: 0 0 auto; }
.hike-row-meta {
  margin-top: 8px;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
}
.empty-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 26px;
  color: var(--text-2);
  margin-bottom: 10px;
}
.empty-body {
  font-family: var(--sans);
  font-size: 18px;
}

/* ===== Summary =====
   600x600 budget: header ~64 + content (flex 1) + nav ~76. The content packs
   meta + sparkline + 3-row tile grid; rows are forced equal via 1fr so the
   combined gain/loss tile never sticks out past its siblings. */
#summary .content {
  padding: 12px 20px 14px;
  gap: 10px;
  overflow: hidden;
}
.summary-meta {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 0;
  letter-spacing: 0.01em;
}
.summary-grid {
  flex: 1 1 auto;
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-rows: 1fr;
  gap: 8px;
}
.summary-tile {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
}
.summary-label {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  font-size: 14px;
  color: var(--text-2);
  letter-spacing: 0.005em;
  margin-bottom: 2px;
  text-transform: none;
}
.summary-value {
  font-family: var(--mono);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.04;
  color: var(--text);
}
.summary-unit {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px;
  letter-spacing: 0.01em;
}

/* ===== Preflight ===== */
.preflight-icon {
  width: 96px;
  height: 96px;
  border-radius: 48px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}
.preflight-status {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  font-size: 34px;
  letter-spacing: 0.005em;
  color: var(--text);
}
.preflight-accuracy {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
  min-height: 1.4em;
}

/* ===== GPS quality dot ===== */
.gps-dot {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--muted);
  vertical-align: middle;
  margin-right: 10px;
  transition: background 200ms ease;
}
.gps-dot.ok { background: var(--ok); box-shadow: 0 0 12px rgba(74, 222, 128, 0.5); }
.gps-dot.warn { background: var(--warn); }
.gps-dot.err { background: var(--err); }
.preflight-icon .gps-dot { width: 24px; height: 24px; margin: 0; }

/* ===== HUD ===== */
#hud {
  background:
    radial-gradient(70% 50% at 50% 40%, rgba(70, 164, 217, 0.04) 0%, transparent 70%),
    var(--bg);
}
.hud-wrap {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: 0 28px 18px;
}

.hud-brand {
  flex: 0 0 auto;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 8px 0 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}
.hud-brand::after {
  content: '';
  position: absolute;
  left: 50%;
  bottom: -1px;
  transform: translateX(-50%);
  width: 56px;
  height: 1.5px;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent-glow);
}
.hud-wordmark {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 500;
  font-size: 40px;
  letter-spacing: 0.005em;
  line-height: 1;
  color: var(--text);
  margin: 0;
  margin-top: 8px;
}

.hud-corner-logo {
  position: absolute;
  bottom: 12px;
  right: 14px;
  width: 56px;
  height: auto;
  opacity: 0.55;
  pointer-events: none;
}

.hud-heading {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 12px;
  padding: 8px 0 4px;
}
.hud-heading-cardinal {
  font-family: var(--serif);
  font-style: italic;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.hud-heading-deg {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 600;
  color: var(--muted);
}

.hud-hero {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 6px 0 4px;
}
.hud-hero-value {
  font-family: var(--mono);
  font-size: 116px;
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: #FFFFFF;
}
.hud-hero-rule {
  display: block;
  width: 56px;
  height: 1.5px;
  background: var(--accent);
  box-shadow: 0 0 14px var(--accent-glow);
  margin: 8px 0 6px;
}
.hud-hero-unit {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  font-size: 30px;
  color: var(--accent);
  letter-spacing: 0.005em;
}

.hud-row {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.hud-stat {
  text-align: center;
}
.hud-stat-value {
  font-family: var(--mono);
  font-size: 52px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  color: #FFFFFF;
}
.hud-stat.small .hud-stat-value {
  font-size: 40px;
}
.hud-stat-label {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  font-size: 22px;
  color: var(--text-2);
  margin-top: 8px;
  letter-spacing: 0.005em;
  text-transform: none;
}

.hud-status {
  flex: 0 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--muted);
}
.hud-gps { display: inline-flex; align-items: center; }
.hud-pause-indicator {
  color: var(--warn);
  font-weight: 600;
}

.hud-tap-zone {
  position: absolute;
  inset: 0;
  background: transparent;
  border: none;
  cursor: pointer;
}
.hud-tap-zone:focus,
.hud-tap-zone:focus-visible {
  outline: none;
  box-shadow: inset 0 0 0 2px var(--focus), inset 0 0 32px var(--focus-glow);
}

/* ===== Pause / Resume ===== */
.pause-title {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 44px;
  letter-spacing: 0.005em;
  line-height: 1;
  margin-bottom: 6px;
}
.pause-body {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: 0.01em;
}
.resume-body {
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 400;
  color: var(--text-2);
  line-height: 1.45;
}
.resume-meta {
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.01em;
  margin-top: 8px;
}

/* ===== Settings ===== */
.settings-row {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  border: 2px solid transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
  text-align: left;
}
.settings-row-text { flex: 1; }
.settings-row-title { font-size: 20px; font-weight: 600; }
.settings-row-sub { font-size: 16px; color: var(--muted); margin-top: 4px; }
.settings-toggle {
  background: var(--surface-hi);
  padding: 8px 18px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  transition: background 220ms var(--ease-out), color 220ms var(--ease-out), box-shadow 220ms var(--ease-out);
}
.settings-toggle.on {
  background: var(--primary);
  color: var(--primary-on);
  box-shadow: 0 0 18px var(--focus-glow);
}

/* ===== Confirm Overlay ===== */
.overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 16, 20, 0.78);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.overlay-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.overlay-title {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 30px;
  letter-spacing: 0.005em;
  line-height: 1.1;
}
.overlay-body {
  font-family: var(--sans);
  font-size: 18px;
  color: var(--text-2);
  line-height: 1.45;
}
.overlay-actions {
  display: flex;
  gap: 12px;
  margin-top: 10px;
}
.overlay-actions .nav-item { min-height: 60px; }

/* ===== Screen Transitions ===== */
.screen-entering { z-index: 2; will-change: transform, opacity; }
.screen-exiting { z-index: 1; pointer-events: none; will-change: transform, opacity; }

.screen-enter-forward { animation: screen-fwd-in 340ms var(--ease-out) both; }
.screen-exit-forward  { animation: screen-fwd-out 240ms var(--ease-in) both; }
.screen-enter-back    { animation: screen-back-in 340ms var(--ease-out) both; }
.screen-exit-back     { animation: screen-back-out 240ms var(--ease-in) both; }
.screen-enter-into-trail { animation: screen-trail-in 460ms var(--ease-out) both; }
.screen-exit-into-trail  { animation: screen-trail-out 320ms var(--ease-in) both; }
.screen-enter-overlay { animation: screen-overlay-in 320ms var(--ease-out) both; }
.screen-exit-overlay  { animation: screen-overlay-out 240ms var(--ease-in) both; }
.screen-enter-lift    { animation: screen-lift-in 380ms 80ms var(--ease-out) both; }
.screen-exit-lift     { animation: screen-lift-out 140ms var(--ease-in) both; }
.screen-enter-fade    { animation: screen-fade-in 360ms var(--ease-out) both; }
.screen-exit-fade     { animation: screen-fade-out 280ms var(--ease-in) both; }

@keyframes screen-fwd-in {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes screen-fwd-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(-10px); }
}
@keyframes screen-back-in {
  from { opacity: 0; transform: translateY(-14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes screen-back-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(10px); }
}
@keyframes screen-trail-in {
  from { opacity: 0; transform: scale(0.92); }
  to   { opacity: 1; transform: none; }
}
@keyframes screen-trail-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: scale(1.06); }
}
@keyframes screen-overlay-in {
  from { opacity: 0; transform: translateY(16px) scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes screen-overlay-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: scale(0.98); }
}
@keyframes screen-lift-in {
  from { opacity: 0; transform: scale(0.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes screen-lift-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: translateY(-10px); }
}
@keyframes screen-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes screen-fade-out {
  from { opacity: 1; transform: none; }
  to   { opacity: 0; transform: scale(1.02); }
}

/* ===== Header topo decoration (list + summary) ===== */
.header-with-topo { position: relative; overflow: hidden; }
.header-topo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  opacity: 0.12;
}
.header-topo path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.7);
  stroke-width: 1.25;
}
.header-with-topo > h1,
.header-with-topo > button {
  position: relative;
  z-index: 1;
}

/* ===== HUD ambient topo ===== */
.hud-topo {
  position: absolute;
  inset: 0;
  width: 600px;
  height: 600px;
  pointer-events: none;
  opacity: 0.06;
}
.hud-topo path {
  fill: none;
  stroke: rgba(255, 255, 255, 0.7);
  stroke-width: 1.25;
}
.hud-topo path:nth-child(5),
.hud-topo path:nth-child(6) { stroke: rgba(70, 164, 217, 0.9); }
.hud-wrap { z-index: 1; }
.hud-tap-zone { z-index: 2; }

/* ===== HUD sunset countdown ===== */
.hud-sunset {
  font-family: var(--sans);
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-2);
  transition: color 220ms var(--ease-out);
}
.hud-sunset.warn { color: var(--warn); }
.hud-sunset.err  { color: var(--err); }
.hud-sunset.muted { color: var(--muted); }

/* ===== Summary: combined gain/loss tile =====
   Lives in the same 1fr row as its neighbors. Inside, two half-cells with
   their own vertical center; a hairline rule keeps the pair feeling
   intentional rather than crammed. */
.tile-dual {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 14px;
  padding: 10px 14px;
}
.tile-dual-half {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.tile-dual-half + .tile-dual-half {
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  padding-left: 14px;
}
.tile-dual .summary-label {
  font-size: 13px;
  margin-bottom: 1px;
}
.tile-dual .summary-value {
  font-size: 22px;
  letter-spacing: -0.01em;
}
.tile-dual .summary-unit {
  font-size: 11px;
  margin-top: 0;
}

/* ===== Summary: sparkline ===== */
.summary-sparkline {
  position: relative;
  width: 100%;
  height: 88px;
  margin: 2px 0 0;
  border-radius: var(--radius-md);
  overflow: visible;
  flex: 0 0 auto;
  padding-top: 16px;
}
.summary-sparkline.hidden { display: none !important; }
#summary .nav-bar { padding: 10px 20px; }
#summary .nav-item { min-height: 52px; }
.sparkline-chart {
  position: relative;
  width: 100%;
  height: 100%;
}
.sparkline-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.sparkline-stroke {
  fill: none;
  stroke: var(--focus);
  stroke-width: 2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}
.sparkline-fill {
  fill: rgba(0, 212, 255, 0.1);
  stroke: none;
}
.sparkline-pause {
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  vector-effect: non-scaling-stroke;
}
.sparkline-peak-label {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  pointer-events: none;
  letter-spacing: 0.02em;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(28, 30, 33, 0.72);
  border: 1px solid rgba(0, 212, 255, 0.35);
  line-height: 14px;
}
.sparkline-peak-leader {
  position: absolute;
  top: 0;
  width: 1px;
  background: linear-gradient(to bottom, rgba(0, 212, 255, 0), rgba(0, 212, 255, 0.55));
  transform: translateX(-50%);
  pointer-events: none;
}
.sparkline-peak-dot {
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--focus);
  box-shadow: 0 0 0 2px rgba(28, 30, 33, 0.95), 0 0 6px rgba(0, 212, 255, 0.55);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.sparkline-flat-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -110%);
  font-family: var(--serif);
  font-style: italic;
  font-size: 14px;
  color: var(--muted);
  pointer-events: none;
}

/* ===== Confirm Overlay Entrance ===== */
.overlay:not(.hidden) {
  animation: overlay-backdrop-in 220ms var(--ease-out) both;
}
.overlay:not(.hidden) .overlay-card {
  animation: overlay-card-in 320ms 40ms var(--ease-out) both;
}
@keyframes overlay-backdrop-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes overlay-card-in {
  from { opacity: 0; transform: translateY(14px) scale(0.94); }
  to   { opacity: 1; transform: none; }
}
