:root {
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --text: #14201D;
  --muted: #66756F;
  --accent: #00614A;
  --on-accent: #FFFFFF;
  --border: #E1E1E1;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0A1512;
    --surface: #101E1A;
    --text: #F3F6F4;
    --muted: #8FA39D;
    --accent: #1FBA8F;
    --on-accent: #04231C;
    --border: #1E2E29;
  }
}

:root[data-theme="dark"] {
  --bg: #0A1512;
  --surface: #101E1A;
  --text: #F3F6F4;
  --muted: #8FA39D;
  --accent: #1FBA8F;
  --on-accent: #04231C;
  --border: #1E2E29;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

html {
  -webkit-tap-highlight-color: transparent;
}

body {
  height: 100vh;
  height: 100dvh;
  display: flex;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Standalone/PWA mode needs this exemption explicitly — the app-wide
   user-select: none above is for tap-friendly chrome, not for text the
   user actually needs to type into. */
input,
textarea {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}

img,
svg {
  -webkit-user-drag: none;
}

.screen {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  /* The illustration's margin-top:auto pulls all free vertical space above
     it, which otherwise leaves the whole content cluster flush against the
     bottom edge. Reserving ~10dvh here (mid-point of the requested 8-12%)
     below it shifts that cluster upward by the same amount, without
     touching the adaptive short-screen clamps that guarantee no scrolling. */
  padding: max(clamp(20px, 4dvh, 40px), env(safe-area-inset-top)) 28px calc(clamp(16px, 3dvh, 28px) + 10dvh + env(safe-area-inset-bottom));
  text-align: center;
}

.theme-switch {
  position: fixed;
  top: max(16px, env(safe-area-inset-top));
  right: max(16px, env(safe-area-inset-right));
  z-index: 10;
  display: flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.theme-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: transform 120ms ease;
}

.theme-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.theme-btn[aria-pressed="true"] {
  background: var(--accent);
  color: var(--on-accent);
}

.theme-btn:active {
  transform: scale(0.88);
}

.illustration {
  margin-top: auto;
  margin-bottom: clamp(12px, 3dvh, 32px);
  color: var(--accent);
}

.illustration svg {
  display: block;
  width: clamp(84px, 24dvh, 240px);
  height: clamp(84px, 24dvh, 240px);
}

.pulses circle {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  opacity: 0;
  transform-origin: 150px 150px;
  animation: dvr-pulse 3.6s ease-out infinite;
}

.pulses circle:nth-child(2) { animation-delay: 1.2s; }
.pulses circle:nth-child(3) { animation-delay: 2.4s; }

@keyframes dvr-pulse {
  0%   { transform: scale(0.3); opacity: 0.75; }
  70%  { opacity: 0.16; }
  100% { transform: scale(1.35); opacity: 0; }
}

/* Signal flow: a short dash travelling outward from the hub toward each
   node, on top of the always-visible line. Cheap (stroke-dashoffset only,
   no repaint-heavy properties) so it stays smooth on low-end Android. */
.mesh line {
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  opacity: 0.42;
  stroke-dasharray: 6 10;
  stroke-dashoffset: 0;
  animation: dvr-line-flow 3.6s linear infinite;
}

.mesh line:nth-child(1) { animation-delay: 0s; }
.mesh line:nth-child(2) { animation-delay: 0.3s; }
.mesh line:nth-child(3) { animation-delay: 0.6s; }
.mesh line:nth-child(4) { animation-delay: 0.9s; }
.mesh line:nth-child(5) { animation-delay: 1.2s; }
.mesh line:nth-child(6) { animation-delay: 1.5s; }

@keyframes dvr-line-flow {
  to { stroke-dashoffset: -32; }
}

.nodes circle {
  fill: var(--accent);
  opacity: 0.5;
  transform-box: fill-box;
  transform-origin: center;
  animation: dvr-node-glow 2.8s ease-in-out infinite;
}

.nodes circle:nth-child(1) { animation-delay: 0s; }
.nodes circle:nth-child(2) { animation-delay: 0.4s; }
.nodes circle:nth-child(3) { animation-delay: 0.8s; }
.nodes circle:nth-child(4) { animation-delay: 1.2s; }
.nodes circle:nth-child(5) { animation-delay: 1.6s; }
.nodes circle:nth-child(6) { animation-delay: 2s; }

@keyframes dvr-node-glow {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50%      { opacity: 1; transform: scale(1.25); }
}

/* Central core: a slow breathe (scale) with a restrained glow that only
   brightens at the peak of the breath, so it reads as "occasionally
   brighter" rather than a constant halo. color-mix keeps it automatically
   more restrained in light mode (dark accent = low-luminance shadow) and
   more present in dark mode (mint accent = brighter glow), with no
   separate light/dark tuning needed. */
.hub {
  fill: var(--accent);
  transform-box: fill-box;
  transform-origin: center;
  animation: dvr-hub-breathe 4s ease-in-out infinite;
}

@keyframes dvr-hub-breathe {
  0%, 100% {
    transform: scale(1);
    filter: drop-shadow(0 0 1px color-mix(in srgb, var(--accent) 35%, transparent));
  }
  50% {
    transform: scale(1.12);
    filter: drop-shadow(0 0 6px color-mix(in srgb, var(--accent) 70%, transparent));
  }
}

@media (prefers-reduced-motion: reduce) {
  .pulses circle {
    animation: none;
    opacity: 0.22;
    transform: scale(1);
  }
  .mesh line {
    animation: none;
  }
  .nodes circle {
    animation: none;
    opacity: 0.85;
    transform: scale(1);
  }
  .hub {
    animation: none;
    filter: none;
  }
  .theme-btn,
  .btn-primary {
    transition: none;
  }
}

.content {
  display: flex;
  flex-direction: column;
  align-items: center;
}

h1 {
  font-size: clamp(26px, 8vw, 38px);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 12px;
}

.lead {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 8px;
}

.sub {
  font-size: 15px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--muted);
  max-width: 30ch;
  margin-bottom: clamp(16px, 4dvh, 36px);
}

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 100%;
  height: clamp(48px, 9dvh, 56px);
  background: var(--accent);
  color: var(--on-accent);
  border-radius: 16px;
  text-decoration: none;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: transform 120ms ease, opacity 160ms ease;
}

.btn-primary:active {
  transform: scale(0.97);
  opacity: 0.92;
}

.brand-footer {
  flex: none;
  margin-top: clamp(10px, 3dvh, 28px);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--muted);
}

@media (min-width: 560px) {
  html, body {
    overflow: auto;
  }
  body {
    align-items: center;
  }
  .screen {
    height: auto;
    min-height: 480px;
    padding-top: 40px;
    padding-bottom: 40px;
  }
}
