* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; }
body {
    font-family: var(--body);
    -webkit-font-smoothing: antialiased;
    background-color: var(--bg);
    color: var(--text);
    overflow-x: hidden;
    overflow-y: auto;
}

:root {
    --bg: #0A0C10;
    --bg-raise: #12151C;
    --bg-raise-2: #171B23;
    --text: #ECEDEF;
    --text-dim: #8B92A0;
    --text-faint: #565C68;
    --accent: #00E5A0;
    --accent-soft: rgba(0,229,160,0.12);
    --accent-soft-border: rgba(0,229,160,0.32);
    --line: rgba(255,255,255,0.09);
    --line-soft: rgba(255,255,255,0.055);

    --display: 'Space Grotesk', sans-serif;
    --body: 'IBM Plex Sans', sans-serif;
    --mono: 'IBM Plex Mono', ui-monospace, monospace;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.page {
    position: relative;
    width: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

/* BG — fine grid + single asymmetric glow, no centered radial cliché */
.bg-glow {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    background-image:
        linear-gradient(var(--line-soft) 1px, transparent 1px),
        linear-gradient(90deg, var(--line-soft) 1px, transparent 1px);
    background-size: 34px 34px;
    -webkit-mask-image: linear-gradient(to bottom, rgba(0,0,0,0.55), rgba(0,0,0,0) 62%);
    mask-image: linear-gradient(to bottom, rgba(0,0,0,0.55), rgba(0,0,0,0) 62%);
}
.bg-glow::after {
    content: '';
    position: absolute;
    top: -10%;
    right: -18%;
    width: 60vw;
    height: 60vw;
    max-width: 640px;
    max-height: 640px;
    background: radial-gradient(circle, rgba(255,176,32,0.16) 0%, rgba(255,176,32,0.04) 45%, transparent 72%);
    filter: blur(4px);
}

/* NAV */
.nav {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    margin: 10px 12px 0;
    border-bottom: 1px solid var(--line);
}
.nav-logo { display: flex; align-items: center; gap: 9px; }
.nav-logo svg { width: 26px; height: auto; color: var(--text); }
.nav-logo-name {
    font-family: var(--display);
    font-size: 15px; font-weight: 600; letter-spacing: -0.2px;
}
.nav-platforms { display: flex; align-items: center; gap: 18px; }
.platform-badge {
    display: flex; align-items: center; gap: 6px;
    font-family: var(--mono);
    font-size: 11px; font-weight: 500;
    letter-spacing: 0.3px;
    color: var(--text-dim);
    cursor: pointer;
}
.platform-badge svg { width: 12px; height: auto; color: var(--text-dim); }
.nav-download-top {
    display: none;
    min-height: 40px;
    padding: 0 20px;
    background: var(--text); color: var(--bg);
    border-radius: var(--radius-sm);
    font-family: var(--display);
    font-size: 13px; font-weight: 600;
    cursor: pointer; flex-shrink: 0;
    border: none;
}

/* HERO */
.hero {
    position: relative; z-index: 5;
    padding: 30px 24px 0;
}
.hero-badge {
    display: inline-flex; align-items: center; gap: 7px;
    font-family: var(--mono);
    font-size: 11px; font-weight: 500;
    letter-spacing: 0.6px; text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 18px;
}
.hero-badge-dot {
    width: 6px; height: 6px;
    background: var(--accent); border-radius: 50%;
    box-shadow: 0 0 0 0 rgba(0,229,160,0.5);
    animation: signalPing 2.2s ease-out infinite;
}
@keyframes signalPing {
    0% { box-shadow: 0 0 0 0 rgba(0,229,160,0.45); }
    70% { box-shadow: 0 0 0 7px rgba(0,229,160,0); }
    100% { box-shadow: 0 0 0 0 rgba(0,229,160,0); }
}
.hero-title {
    font-family: var(--display);
    font-size: clamp(32px,9vw,50px);
    font-weight: 600; line-height: 1.05; letter-spacing: -1px;
    margin-bottom: 14px;
}
.hero-title .accent-text { color: var(--accent); }
.hero-sub {
    font-size: 15px; line-height: 1.55;
    color: var(--text-dim);
    max-width: 320px;
}

/* STATUS PANEL — signature element */
.status-panel {
    position: relative; z-index: 5;
    margin: 22px 16px 0;
    padding: 16px 16px 14px;
    background: var(--bg-raise);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
}
.status-head {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 14px;
    font-family: var(--mono);
    font-size: 10.5px; letter-spacing: 0.5px;
}
.status-live {
    display: flex; align-items: center; gap: 7px;
    color: var(--accent);
    text-transform: uppercase;
    font-weight: 500;
}
.pulse-dot {
    width: 6px; height: 6px; border-radius: 50%;
    background: var(--accent);
    animation: signalPing 2.2s ease-out infinite;
}
.status-cipher {
    color: var(--text-faint);
}

.status-route {
    display: flex; align-items: center;
    gap: 0;
    margin-bottom: 16px;
}
.route-node {
    font-family: var(--mono);
    font-size: 10.5px;
    color: var(--text-dim);
    white-space: nowrap;
    flex-shrink: 0;
}
.route-node--end { color: var(--text); font-weight: 500; }
.route-line {
    flex: 1;
    height: 1px;
    margin: 0 8px;
    background: repeating-linear-gradient(90deg, var(--line) 0 4px, transparent 4px 8px);
    position: relative;
}
.route-line::after {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 4px; height: 4px;
    border-radius: 50%;
    background: var(--accent);
    transform: translate(-50%,-50%);
}

.status-metrics {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 1px solid var(--line);
    padding-top: 12px;
}
.metric {
    display: flex; flex-direction: column; gap: 4px;
    border-left: 1px solid var(--line);
    padding-left: 12px;
}
.metric:first-child { border-left: none; padding-left: 0; }
.metric-label {
    font-size: 9.5px; letter-spacing: 0.6px; text-transform: uppercase;
    color: var(--text-faint);
}
.metric-val {
    font-family: var(--mono);
    font-size: 15px; font-weight: 500;
    color: var(--text);
}
.metric-signal { display: flex; align-items: flex-end; gap: 2px; height: 14px; }
.metric-signal i {
    display: block; width: 3px; background: var(--line);
    border-radius: 1px;
}
.metric-signal i:nth-child(1) { height: 30%; }
.metric-signal i:nth-child(2) { height: 55%; }
.metric-signal i:nth-child(3) { height: 80%; }
.metric-signal i:nth-child(4) { height: 100%; }
.metric-signal i.on { background: var(--accent); }

/* SPEC STRIP */
.spec-strip {
    position: relative; z-index: 5;
    display: flex;
    margin: 18px 16px 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
}
.spec {
    flex: 1;
    display: flex; flex-direction: column;
    padding: 12px 10px;
    border-left: 1px solid var(--line);
}
.spec:first-child { border-left: none; }
.spec-val {
    font-family: var(--mono);
    font-size: 16px; font-weight: 500;
    letter-spacing: -0.2px;
}
.spec-lbl {
    font-size: 10px;
    color: var(--text-faint);
    margin-top: 2px;
    letter-spacing: 0.2px;
}

/* DATASHEET (protocol features) */
.datasheet {
    position: relative; z-index: 5;
    margin: 18px 16px 0;
}
.datasheet-head {
    display: flex; align-items: baseline; gap: 10px;
    margin-bottom: 4px;
}
.ds-tag {
    font-family: var(--mono);
    font-size: 10px; letter-spacing: 0.6px; text-transform: uppercase;
    color: var(--text-faint);
}
.ds-title {
    font-family: var(--display);
    font-size: 16px; font-weight: 600; letter-spacing: 0.5px;
    color: var(--accent);
}
.ds-list { list-style: none; }
.ds-list li {
    display: flex; align-items: flex-start; gap: 12px;
    padding: 13px 0;
    border-bottom: 1px solid var(--line-soft);
}
.ds-icon {
    flex-shrink: 0;
    width: 18px; height: 18px;
    margin-top: 2px;
    color: var(--accent);
}
.ds-icon svg { width: 100%; height: 100%; }
.ds-text { display: flex; flex-direction: column; gap: 2px; }
.ds-name { font-size: 13.5px; font-weight: 500; color: var(--text); }
.ds-desc { font-size: 12px; color: var(--text-dim); line-height: 1.4; }

/* DOWNLOAD BUTTONS */
.downloads {
    position: relative; z-index: 5;
    padding: 26px 16px 20px;
    display: flex; flex-direction: column; gap: 10px;
}
.dl-btn {
    display: flex; align-items: center; justify-content: center; gap: 12px;
    width: 100%; min-height: 54px; padding: 0 20px;
    border-radius: var(--radius-md);
    font-family: var(--display);
    font-size: 15px; font-weight: 600; letter-spacing: -0.1px;
    cursor: pointer; border: none;
    transition: transform 0.15s ease, opacity 0.15s ease;
    -webkit-tap-highlight-color: transparent;
}
.dl-btn:active { transform: scale(0.97); opacity: 0.85; }
.dl-btn-primary { background: var(--accent); color: #1A1200; }
.dl-btn-secondary {
    background: var(--bg-raise); color: var(--text);
    border: 1px solid var(--line);
}
.dl-btn-icon {
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0; width: 20px;
}
.dl-btn-icon svg { width: 100%; height: auto; display: block; }

/* TERMS LINK */
.terms-link {
    position: relative; z-index: 5;
    text-align: center;
    padding: 0 16px 22px;
    font-size: 11px;
    font-family: var(--mono);
    color: var(--text-faint);
}
.terms-link button {
    background: none; border: none; cursor: pointer;
    font: inherit; font-size: 11px;
    color: var(--text-dim);
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: 0;
    transition: color 0.2s;
}
.terms-link button:hover { color: var(--text); }

/* =====================================================
   MODAL
===================================================== */
.modal-overlay {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(0,0,0,0.65);
    display: flex; align-items: flex-end; justify-content: center;
    padding: 12px;
    opacity: 0; pointer-events: none;
    transition: opacity 0.3s ease;
}
.modal-overlay.open {
    opacity: 1; pointer-events: all;
}

.modal {
    width: 100%;
    max-width: 560px;
    max-height: 82vh;
    background: var(--bg-raise);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 40px 80px rgba(0,0,0,0.6);
    display: flex; flex-direction: column;
    overflow: hidden;
    transform: translateY(40px);
    transition: transform 0.35s cubic-bezier(0.32,0.72,0,1);
}
.modal-overlay.open .modal {
    transform: translateY(0);
}

.modal-handle {
    flex-shrink: 0;
    display: flex; justify-content: center;
    padding: 12px 0 8px;
}
.modal-handle-bar {
    width: 36px; height: 4px;
    background: var(--line);
    border-radius: 2px;
}

.modal-header {
    flex-shrink: 0;
    padding: 4px 20px 16px;
    display: flex; align-items: flex-start; justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--line);
}
.modal-title {
    font-family: var(--display);
    font-size: 17px; font-weight: 600;
    letter-spacing: -0.2px; color: var(--text);
}
.modal-subtitle {
    font-family: var(--mono);
    font-size: 11px; color: var(--text-faint);
    margin-top: 4px;
}
.modal-close {
    flex-shrink: 0;
    width: 30px; height: 30px;
    border-radius: 50%;
    background: var(--bg-raise-2);
    border: 1px solid var(--line);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    color: var(--text-dim);
    font-size: 16px; line-height: 1;
    transition: background 0.2s, color 0.2s;
    font-family: inherit;
}
.modal-close:hover { background: var(--line); color: var(--text); }

.modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 20px 8px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent;
}
.modal-body::-webkit-scrollbar { width: 4px; }
.modal-body::-webkit-scrollbar-thumb {
    background: var(--line); border-radius: 2px;
}

.terms-section { margin-bottom: 20px; }
.terms-section:last-child { margin-bottom: 0; }
.terms-h {
    font-family: var(--mono);
    font-size: 11px; font-weight: 500;
    letter-spacing: 0.6px; text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 8px;
}
.terms-p {
    font-size: 13px; line-height: 1.65;
    color: var(--text-dim);
}
.terms-p + .terms-p { margin-top: 6px; }
.terms-ul {
    margin: 6px 0 0 0;
    padding-left: 16px;
}
.terms-ul li {
    font-size: 13px; line-height: 1.65;
    color: var(--text-dim);
    margin-bottom: 3px;
    list-style: disc;
}

.modal-footer {
    flex-shrink: 0;
    padding: 14px 20px 20px;
    border-top: 1px solid var(--line);
}
.modal-accept {
    width: 100%; min-height: 50px;
    background: var(--accent); color: #1A1200;
    border: none; border-radius: var(--radius-md);
    font-family: var(--display);
    font-size: 15px; font-weight: 600;
    cursor: pointer;
    transition: transform 0.15s ease, opacity 0.15s ease;
}
.modal-accept:active { transform: scale(0.98); opacity: 0.85; }

/* DESKTOP */
@media (min-width: 769px) {
    .page { max-width: 640px; margin: 0 auto; }
    .nav { margin: 10px 0 0; }
    .nav-download-top { display: flex; align-items: center;}

    .hero { padding: 44px 0 0; }
    .hero-title { font-size: clamp(40px,5vw,56px); }
    .hero-sub { max-width: 400px; font-size: 16px; }

    .status-panel, .spec-strip, .datasheet { margin-left: 0; margin-right: 0; }

    .downloads {
        flex-direction: row;
        padding-bottom: 18px;
    }
}