:root {
  --ink: #0b1220;
  --blue: #0ea5a4;
  --lime: #22c55e;
  --mute: #9fb0d0;
  --text: #f2f6ff;
  --alert: #ffb347;
  --font: "Avenir Next", "Segoe UI", "Helvetica Neue", system-ui, sans-serif;
}

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

html { scroll-behavior: smooth; background: var(--ink); }

body {
  background: var(--ink);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

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

.hero {
  position: relative;
  min-height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: var(--ink) url("poster.jpg") center / cover no-repeat;
}

.gl, .gl canvas, .fade, .scrim {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.gl { z-index: -3; }
.gl canvas { display: block; opacity: 0; transition: opacity 0.8s ease; }
html[data-ready] .gl canvas { opacity: 1; }
html[data-frozen] .gl canvas { transition: none; }
html[data-gl="off"] .gl { display: none; }

.fade { background: var(--ink); opacity: 0; pointer-events: none; }

.scrim {
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(11, 18, 32, 0.92) 0%, rgba(11, 18, 32, 0.72) 32%, rgba(11, 18, 32, 0) 62%),
    linear-gradient(180deg, rgba(11, 18, 32, 0.55) 0%, rgba(11, 18, 32, 0) 22%, rgba(11, 18, 32, 0) 78%, rgba(11, 18, 32, 0.6) 100%);
}

.top {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px max(16px, 4vw);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.brand-mark { width: 26px; height: 26px; border-radius: 7px; display: block; }
.top-nav { display: flex; align-items: center; gap: clamp(12px, 2vw, 28px); }
.top-link:focus-visible, .brand:focus-visible, .btn:focus-visible { outline: 2px solid var(--lime); outline-offset: 4px; }

.top-link {
  color: #cbd7ee;
  font-size: 0.95rem;
  text-decoration: none;
  padding: 10px 4px;
}
.top-link:hover { color: #fff; }
@media (max-width: 520px) {
  .top-nav .top-link:last-child { display: none; }
  .top-link { font-size: 0.88rem; white-space: nowrap; }
}

.hero-copy {
  position: relative;
  z-index: 3;
  max-width: 640px;
  padding: clamp(24px, 7vh, 88px) max(16px, 4vw) 0;
}

.eyebrow {
  color: var(--lime);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin-top: 16px;
  font-size: clamp(2.3rem, 5.6vw, 4.6rem);
  line-height: 1.02;
  letter-spacing: -0.035em;
  font-weight: 800;
  text-wrap: balance;
  text-shadow: 0 2px 30px rgba(11, 18, 32, 0.7);
}
h1 span { color: var(--lime); }

.lead {
  margin-top: 22px;
  max-width: 34ch;
  color: #dbe5f8;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  line-height: 1.45;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 30px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0 24px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  text-decoration: none;
  transition: transform 0.15s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--lime); color: var(--ink); }
.btn-primary:hover { background: #4ade80; }
.btn-ghost {
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.32);
  background: rgba(11, 18, 32, 0.35);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.08); }

.btn:focus-visible, .top-link:focus-visible, .brand:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.note {
  margin-top: 22px;
  max-width: 44ch;
  color: #b3c2de;
  font-size: 0.95rem;
  line-height: 1.5;
}

.hud {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.zone-tag {
  position: absolute;
  top: 18%;
  right: 22%;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(255, 179, 71, 0.55);
  background: rgba(40, 26, 8, 0.6);
  color: var(--alert);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}
.hero[data-phase="offline"] .zone-tag { opacity: 1; transform: none; }

.phone {
  position: absolute;
  right: max(16px, 4vw);
  bottom: clamp(20px, 6vh, 56px);
  width: clamp(210px, 19vw, 270px);
  padding: 14px 14px 16px;
  border-radius: 26px;
  background: rgba(6, 11, 22, 0.86);
  border: 1.5px solid #2a3858;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  font-size: 0.82rem;
}

.phone-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--mute);
  font-weight: 600;
  font-size: 0.85em;
}

.signal { display: inline-flex; align-items: flex-end; gap: 2px; height: 12px; transition: opacity 0.4s; }
.signal i { display: block; width: 3px; border-radius: 1px; background: var(--text); }
.signal i:nth-child(1) { height: 30%; }
.signal i:nth-child(2) { height: 52%; }
.signal i:nth-child(3) { height: 76%; }
.signal i:nth-child(4) { height: 100%; }
.hero[data-phase="offline"] .signal { opacity: 0.18; }

.phone-title {
  margin-top: 12px;
  font-weight: 800;
  font-size: 1.2em;
  letter-spacing: -0.01em;
}

.chips { position: relative; height: 2.3em; margin-top: 8px; }

.chip {
  position: absolute;
  left: 0;
  top: 0;
  padding: 0.42em 0.9em;
  border-radius: 999px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.c-online, .c-done { background: rgba(34, 197, 94, 0.16); color: var(--lime); }
.c-offline { background: rgba(255, 179, 71, 0.16); color: var(--alert); }
.c-sending { background: rgba(14, 165, 164, 0.24); color: #5eead4; }

.hero[data-phase="online"] .c-online,
.hero[data-phase="offline"] .c-offline,
.hero[data-phase="sending"] .c-sending,
.hero[data-phase="done"] .c-done { opacity: 1; }

.pending {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 8px;
  padding: 9px 12px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--mute);
  font-weight: 600;
}
.pending strong {
  color: var(--text);
  font-size: 2em;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.hero[data-phase="offline"] .pending strong { color: var(--alert); }

.msg {
  position: absolute;
  margin-top: 10px;
  color: var(--mute);
  line-height: 1.3;
  opacity: 0;
  transition: opacity 0.3s ease;
}
.msg-wrap { position: relative; }
.phone { padding-bottom: 46px; }
.phone .msg { left: 14px; bottom: 16px; margin: 0; }
.hero[data-phase="offline"] .m-offline { opacity: 1; }
.hero[data-phase="sending"] .m-sync,
.hero[data-phase="done"] .m-sync { opacity: 1; color: var(--lime); }

.panel {
  position: absolute;
  top: 16%;
  right: max(16px, 4vw);
  width: clamp(230px, 20vw, 290px);
  padding: 16px 18px;
  border-radius: 16px;
  background: #f4f7fd;
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  font-size: 0.85rem;
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.7s cubic-bezier(0.2, 0.8, 0.2, 1), transform 0.7s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.hero[data-panel="1"] .panel { opacity: 1; transform: none; }

.panel-title { margin-top: 0; font-weight: 800; font-size: 1.3em; letter-spacing: -0.01em; }
.panel ul { margin: 12px 0 0; padding: 0; list-style: none; }
.panel li { position: relative; padding-left: 18px; margin-top: 7px; line-height: 1.3; }
.panel li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue);
}

.stamp {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 6px 14px 6px 7px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--lime);
  font-weight: 800;
  opacity: 0;
  transform: scale(0.5);
  transform-origin: left center;
  transition: opacity 0.4s ease 0.35s, transform 0.5s cubic-bezier(0.3, 1.5, 0.5, 1) 0.35s;
}
.hero[data-panel="1"] .stamp { opacity: 1; transform: none; }
.stamp b { position: relative; width: 18px; height: 18px; border-radius: 50%; background: var(--lime); }
.stamp b::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 4px;
  height: 8px;
  border: solid var(--ink);
  border-width: 0 2px 2px 0;
  transform: rotate(40deg);
}

html[data-bare] .hero-copy,
html[data-bare] .top,
html[data-bare] .hud,
html[data-bare] .scrim { display: none; }

@media (max-width: 899px) {
  .scrim {
    background:
      linear-gradient(180deg, rgba(11, 18, 32, 0.92) 0%, rgba(11, 18, 32, 0.78) 40%, rgba(11, 18, 32, 0) 64%),
      linear-gradient(0deg, rgba(11, 18, 32, 0.6) 0%, rgba(11, 18, 32, 0) 22%);
  }
  .hero { min-height: 900px; }
  .phone {
    right: 16px;
    bottom: 16px;
    width: min(230px, calc(100vw - 32px));
    font-size: 0.78rem;
    transition: opacity 0.5s ease;
  }
  .hero[data-panel="1"] .phone { opacity: 0; }
  .panel {
    top: auto;
    bottom: 16px;
    right: 16px;
    width: min(270px, calc(100vw - 32px));
    font-size: 0.8rem;
  }
  .zone-tag { top: 84px; right: 16px; }
}

@media (min-width: 900px) and (max-height: 760px) {
  .phone { transform: scale(0.88); transform-origin: bottom right; }
}

@media (prefers-reduced-motion: reduce) {
  .gl canvas, .panel, .stamp, .chip, .msg, .zone-tag { transition: none; }
}
