:root {
    /* Skywave brand tokens — see docs/STYLE_GUIDE.md.
       Teal is the canonical interactive accent (was blue #2e6df0, now legacy). */
    --skywave-navy: #0b1d3a;
    --skywave-navy-deep: #06122a;
    --skywave-teal: #14b8a6;
    --skywave-teal-active: #0f766e;
    --skywave-blue-soft: #12305f;
    --skywave-mute: #a8bcd8;
    --skywave-warn: #ffb84d;
    --skywave-text: #ffffff;
    --skywave-radius: 0.75rem;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    color: var(--skywave-text);
    /* No body background — the website backdrop fills the page. */
    overscroll-behavior: contain;
}

/* The website backdrop. Just a passthrough container; everything is styled
   under .skywave-site in website.css. */
#site-root { display: block; min-height: 100vh; }

/* ── MODAL OVERLAY ─────────────────────────────────────────────────────── */
.sw-modal {
    position: fixed; inset: 0; z-index: 9999;
    display: flex; align-items: center; justify-content: center;
    padding: 1rem;
    transition: opacity 0.18s ease;
}
.sw-modal[data-state="hidden"] {
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
}
.sw-modal[data-state="open"]   { opacity: 1; pointer-events: auto; }

.sw-modal-backdrop {
    position: absolute; inset: 0;
    background: rgba(6, 18, 42, 0.72);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    cursor: pointer;
}
.sw-modal-card {
    position: relative;
    width: 100%;
    max-width: 32rem;
    /* Use dynamic viewport units so mobile browsers' chrome (URL bar) is
       accounted for. Fall back to 100vh for engines without dvh support. */
    max-height: calc(100vh - 3rem);
    max-height: calc(100dvh - 3rem);
    background: var(--skywave-navy);
    color: var(--skywave-text);
    border-radius: var(--skywave-radius);
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    /* The card is the boundary; content scrolls inside it. */
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.sw-modal-close {
    position: absolute; top: 0.75rem; right: 0.75rem; z-index: 2;
    width: 2rem; height: 2rem;
    background: rgba(255, 255, 255, 0.10);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--skywave-text);
    border-radius: 50%;
    cursor: pointer;
    display: grid; place-items: center;
    transition: background 0.15s;
}
.sw-modal-close:hover { background: rgba(255, 255, 255, 0.20); }
.sw-modal-close svg { width: 14px; height: 14px; }
/* Content area scrolls; close button floats above it. */
.sw-modal-content {
    padding: 1.5rem 1.5rem 1.5rem;
    padding-top: 2.5rem;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    flex: 1 1 auto;
    min-height: 0;
}
.sw-modal-content > .center { text-align: center; }

.brand {
    font-size: 1.4rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}
.brand-sub {
    color: var(--skywave-mute);
    font-size: 0.85rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    margin-bottom: 2rem;
}

.card {
    width: 100%;
    background: var(--skywave-blue-soft);
    border-radius: var(--skywave-radius);
    padding: 1.5rem;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
}
.card h1 { font-size: 1.25rem; margin: 0 0 0.75rem; }
.card p { color: var(--skywave-mute); line-height: 1.5; margin: 0 0 1rem; font-size: 0.95rem; }
.card p strong { color: var(--skywave-text); }

.btn {
    display: block;
    width: 100%;
    padding: 0.85rem 1rem;
    border: none;
    border-radius: 0.5rem;
    background: var(--skywave-teal);
    color: var(--skywave-text);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s;
    font-family: inherit;
}
.btn:active { background: var(--skywave-teal-active); }

.center { text-align: center; }
.muted { color: var(--skywave-mute); }
.tiny { font-size: 0.75rem; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.dim { opacity: 0.6; }

.session-info {
    margin-top: 1.5rem;
    padding: 0.75rem 1rem;
    background: rgba(0,0,0,0.2);
    border-radius: 0.5rem;
    font-size: 0.75rem;
    color: var(--skywave-mute);
}
.session-info-label { text-transform: uppercase; letter-spacing: 0.1em; }
.session-info-value { font-family: ui-monospace, "SF Mono", Menlo, monospace; color: var(--skywave-text); margin-top: 0.2rem; word-break: break-all; }

.stage-pill {
    display: inline-block;
    padding: 0.4rem 0.75rem;
    background: var(--skywave-teal);
    border-radius: 1rem;
    font-size: 0.8rem;
    font-weight: 500;
    text-transform: capitalize;
    margin-top: 1rem;
}
.stage-pill.disconnected { background: var(--skywave-warn); color: var(--skywave-navy-deep); }

.survey-screen {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    padding: 0.5rem 0;
}
.survey-progress {
    color: var(--skywave-mute);
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}
.survey-question {
    font-size: 1.5rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.25;
}
.survey-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}
.survey-option {
    background: var(--skywave-blue-soft);
    border: 2px solid transparent;
    border-radius: var(--skywave-radius);
    padding: 0.75rem;
    color: var(--skywave-text);
    font-family: inherit;
    text-align: left;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    transition: border-color 0.15s, transform 0.1s, opacity 0.2s;
}
.survey-option:hover { border-color: var(--skywave-teal); }
.survey-option:active { transform: scale(0.98); }
.survey-option.selected { border-color: var(--skywave-teal); background: var(--skywave-teal); }
.survey-option:disabled { cursor: default; }
.survey-option:disabled:not(.selected) { opacity: 0.4; }
.survey-option-img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border-radius: 0.5rem;
    background: rgba(0,0,0,0.2);
}
.survey-option-img.placeholder {
    display: grid;
    place-items: center;
    color: var(--skywave-mute);
    font-size: 0.75rem;
}
.survey-option-label {
    font-weight: 500;
    font-size: 0.95rem;
    line-height: 1.2;
}


/* The custom chat client (.miaw-root) is hidden by default so the FAB never
 * flashes before it's eligible. site.js's syncEswButtonVisibility is the
 * single source of truth: it sets an inline display (block when the visitor
 * has consented and is off the demo modal, or whenever the panel is open;
 * none otherwise), which overrides this default. No !important — we never
 * want CSS to fight an open panel. */
.miaw-root { display: none; }
