/* ==========================================================================
   MARSAPIENS // STYLE MANIFEST
   Production Build — Mobile-First Responsive
   ========================================================================== */

/* --- 1. DESIGN TOKENS --------------------------------------------------- */
:root {
    --color-primary: #ffffff;
    --color-accent: #007bff;
    --color-danger: #ff003c;
    --color-cyan: #00f0ff;
    --color-bg: #000000;
    --color-surface: #050505;
    --color-muted: #888888;
    --color-success: #00ff00;

    --font-sans: 'Arial', 'Helvetica Neue', Helvetica, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;

    --z-base: 1;
    --z-slideshow: 1;
    --z-vfx: 5;
    --z-ui: 10;
    --z-nav-overlay: 100;
    --z-nav-panel: 110;
    --z-sync: 9999;

    --header-height: 64px;
    --touch-min: 44px;
    /* WCAG minimum touch target */

    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-out-back: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* --- 2. RESET & BASE ---------------------------------------------------- */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    -webkit-text-size-adjust: 100%;
    -webkit-tap-highlight-color: transparent;
    overflow-x: hidden;
}

body {
    font-family: var(--font-sans);
    background-color: var(--color-bg);
    color: var(--color-primary);
    overflow: hidden;
    opacity: 1;
    transition: opacity 1s ease-in-out;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Allow scrolling on pages that need it */
body[data-page-id="avatar-lab"],
body[data-page-id="marspedia"],
body[data-page-id="faq"],
body[data-page-id="about"] {
    overflow-y: auto;
    overflow-x: hidden;
}

img {
    display: block;
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    cursor: pointer;
    border: none;
    outline: none;
    background: none;
    font-family: inherit;
    transition: all 0.3s ease;
    -webkit-appearance: none;
    appearance: none;
}

ul {
    list-style: none;
}

/* --- 3. LAYOUT PRIMITIVES ----------------------------------------------- */
.landing-ui-layer {
    position: relative;
    z-index: var(--z-ui);
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px;
    pointer-events: none;
}

.landing-ui-layer header,
.landing-ui-layer .hero-section,
.landing-ui-layer .site-footer {
    pointer-events: auto;
}

/* --- 4. HEADER ---------------------------------------------------------- */
header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    min-height: var(--header-height);
}

.logo {
    display: flex;
    align-items: center;
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.logo img {
    height: 22px;
    width: auto;
    margin-right: 8px;
    flex-shrink: 0;
}

.logo-link {
    display: flex;
    align-items: center;
    gap: 8px;
    white-space: nowrap;
    transition: opacity 0.3s ease;
}

.logo-link:hover {
    opacity: 0.8;
    filter: drop-shadow(0 0 5px var(--color-primary));
}

/* --- Marspedia badge (logo area) --------------------------------------- */
.header-left {
    display: flex;
    align-items: center;
    gap: 14px;
}

.marspedia-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border: 1px solid rgba(255, 100, 50, 0.45);
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    color: var(--color-primary);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.marspedia-badge svg {
    flex-shrink: 0;
    color: var(--color-primary);
    opacity: 0.85;
}

.marspedia-badge:hover {
    background: rgba(255, 100, 50, 0.12);
    border-color: var(--color-primary);
    color: #fff;
}

.marspedia-nav {
    color: var(--color-primary) !important;
    font-weight: 700;
    letter-spacing: 1px;
}


/* --- 5. NAVIGATION ------------------------------------------------------ */
.main-nav {
    display: flex;
    align-items: center;
}

/* Hamburger — always visible (off-canvas pattern) */
.hamburger-menu {
    position: relative;
    z-index: var(--z-nav-panel);
    cursor: pointer;
    width: var(--touch-min);
    height: var(--touch-min);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 0;
    -webkit-tap-highlight-color: transparent;
}

.hamburger-menu .bar {
    display: block;
    width: 24px;
    height: 2px;
    background-color: var(--color-primary);
    margin: 3px 0;
    transition: transform 0.35s ease, opacity 0.25s ease;
    transform-origin: center;
}

/* When open, hamburger is moved to <body> and needs fixed positioning */
.hamburger-menu.open {
    position: fixed;
    top: 24px;
    right: 16px;
    z-index: calc(var(--z-nav-panel) + 1);
}

.hamburger-menu.open .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.hamburger-menu.open .bar:nth-child(2) {
    opacity: 0;
}

.hamburger-menu.open .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* Backdrop overlay when nav is open */
.nav-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: var(--z-nav-overlay);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.nav-backdrop.active {
    opacity: 1;
    visibility: visible;
}

/* Off-canvas panel */
.nav-links {
    position: fixed;
    top: 0;
    right: 0;
    width: 280px;
    max-width: 85vw;
    height: 100vh;
    height: 100dvh;
    background: rgba(5, 5, 5, 0.98);
    border-left: 1px solid var(--color-danger);
    display: flex;
    flex-direction: column;
    padding: 100px 32px 40px;
    z-index: var(--z-nav-panel);
    transform: translateX(100%);
    transition: transform 0.4s var(--ease-out-expo);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.nav-links.active {
    transform: translateX(0);
}

.nav-links li {
    margin-bottom: 28px;
}

.nav-links a {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 2px;
    text-transform: uppercase;
    transition: color 0.3s ease;
    display: block;
    padding: 8px 0;
    min-height: var(--touch-min);
    display: flex;
    align-items: center;
}

.nav-links a:hover,
.nav-links a:focus-visible {
    color: var(--color-danger);
    text-shadow: 0 0 8px var(--color-danger);
}

.nav-links a.special {
    color: var(--color-accent);
}

.nav-links a.special:hover {
    color: var(--color-danger);
}

/* --- 6. HERO SECTION ---------------------------------------------------- */
.hero-section {
    text-align: center;
    padding: 0 16px;
    margin-bottom: 12vh;
}

.hero-section h1 {
    font-size: clamp(1.4rem, 5vw, 3.5rem);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    line-height: 1.2;
    margin-bottom: 16px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.separator {
    width: 50px;
    height: 4px;
    background-color: var(--color-accent);
    margin: 0 auto 32px;
}

/* --- 7. BUTTONS --------------------------------------------------------- */
.cta-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 10px 28px;
    min-height: var(--touch-min);
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: #00f0ff;
    background: rgba(0, 20, 35, 0.75);
    border: 1px solid rgba(0, 240, 255, 0.85);
    box-shadow: 0 0 12px rgba(0, 240, 255, 0.2), inset 0 0 10px rgba(0, 240, 255, 0.06);
    clip-path: polygon(10px 0%, 100% 0%, calc(100% - 10px) 100%, 0% 100%);
    overflow: hidden;
    cursor: pointer;
    transition: color 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
    -webkit-tap-highlight-color: transparent;
}

/* inner tinted background */
.cta-button::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(0, 240, 255, 0.12) 0%, rgba(0, 100, 200, 0.06) 100%);
    transition: opacity 0.25s ease;
}

/* scan-line sweep on hover */
.cta-button::after {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 60%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(0, 240, 255, 0.18), transparent);
    transition: left 0.45s ease;
}

/* corner tick marks */
.cta-button .cta-corner {
    position: absolute;
    width: 6px;
    height: 6px;
    border-color: rgba(0, 240, 255, 0.7);
    border-style: solid;
    transition: border-color 0.25s ease;
}

.cta-button .cta-corner--tl {
    top: 3px;
    left: 3px;
    border-width: 1px 0 0 1px;
}

.cta-button .cta-corner--tr {
    top: 3px;
    right: 3px;
    border-width: 1px 1px 0 0;
}

.cta-button .cta-corner--bl {
    bottom: 3px;
    left: 3px;
    border-width: 0 0 1px 1px;
}

.cta-button .cta-corner--br {
    bottom: 3px;
    right: 3px;
    border-width: 0 1px 1px 0;
}

.cta-button:hover,
.cta-button:focus-visible {
    color: #fff;
    background: rgba(0, 40, 60, 0.9);
    border-color: #00f0ff;
    box-shadow: 0 0 24px rgba(0, 240, 255, 0.55), 0 0 60px rgba(0, 240, 255, 0.18), inset 0 0 18px rgba(0, 240, 255, 0.12);
    animation: glitch-skew 0.3s var(--ease-out-back) both;
}

.cta-button:hover::before {
    opacity: 1.6;
}

.cta-button:hover::after {
    left: 140%;
}

.cta-button:hover .cta-corner {
    border-color: rgba(0, 240, 255, 1);
}

.cta-button.mini {
    padding: 10px 20px;
    font-size: 0.85rem;
}

/* --- 8. CORNER DECORATION ----------------------------------------------- */
.corner-decoration {
    position: absolute;
    width: 16px;
    height: 16px;
    background-color: var(--color-primary);
    transform: rotate(45deg);
    pointer-events: none;
}

.corner-decoration.bottom-right {
    bottom: 16px;
    right: 16px;
}

/* --- 9. SLIDESHOW ------------------------------------------------------- */
.slideshow-container {
    position: absolute;
    inset: 0;
    z-index: var(--z-slideshow);
}

.background-image {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    transform-origin: 0 0;
    opacity: 0;
    transition: opacity 1.5s ease-in-out, transform 0.1s ease-out;
    will-change: transform, opacity;
    z-index: 1;
}

.background-image.active {
    opacity: 1;
    z-index: 2;
}

/* --- 11. VFX OVERLAYS --------------------------------------------------- */
.vfx-overlay {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: var(--z-vfx);
}

/* Vignette */
.vfx-overlay::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(circle, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.7) 100%);
    z-index: 1;
}

/* Scanlines */
.vfx-overlay::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0) 50%,
            rgba(0, 0, 0, 0.15) 50%,
            rgba(0, 0, 0, 0.15) 100%);
    background-size: 100% 4px;
    opacity: 0.4;
    z-index: 2;
}

/* Animated grain */
.noise-layer {
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.75' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
    opacity: 0.06;
    animation: staticNoise 0.2s steps(2) infinite;
    z-index: 3;
}

.scanline-layer {
    position: absolute;
    inset: 0;
    background:
        linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%),
        linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.03));
    background-size: 100% 4px, 3px 100%;
    pointer-events: none;
    z-index: 5;
}

@keyframes staticNoise {
    0% {
        transform: translate(0, 0);
    }

    10% {
        transform: translate(-2%, -2%);
    }

    20% {
        transform: translate(-4%, 2%);
    }

    30% {
        transform: translate(2%, -4%);
    }

    40% {
        transform: translate(-2%, 6%);
    }

    50% {
        transform: translate(-4%, 2%);
    }

    60% {
        transform: translate(6%, 0);
    }

    70% {
        transform: translate(0, 4%);
    }

    80% {
        transform: translate(-6%, 0);
    }

    90% {
        transform: translate(4%, 2%);
    }

    100% {
        transform: translate(2%, 0);
    }
}

/* --- 12. GLITCH TEXT ---------------------------------------------------- */
.glitch-text {
    animation: glitch-skew 4s cubic-bezier(0.25, 0.46, 0.45, 0.94) both infinite;
    position: relative;
}

@keyframes glitch-skew {
    0% {
        transform: skew(0deg);
    }

    4% {
        transform: skew(0deg);
        text-shadow: none;
    }

    4.1% {
        transform: skew(10deg);
        text-shadow: -4px 0 var(--color-danger), 4px 0 var(--color-cyan);
    }

    4.5% {
        transform: skew(-10deg);
        text-shadow: 4px 0 var(--color-danger), -4px 0 var(--color-cyan);
        filter: blur(1px);
    }

    4.6% {
        transform: skew(0deg);
        text-shadow: none;
        filter: blur(0);
    }

    50% {
        transform: skew(0deg);
    }

    50.1% {
        transform: skew(4deg);
        text-shadow: -2px 0 var(--color-danger), 2px 0 var(--color-cyan);
    }

    50.3% {
        transform: skew(-4deg);
        text-shadow: 2px 0 var(--color-danger), -2px 0 var(--color-cyan);
    }

    50.4% {
        transform: skew(0deg);
        text-shadow: none;
    }

    100% {
        transform: skew(0deg);
    }
}

/* --- 13. SYNC / TERMINAL OVERLAY ---------------------------------------- */
.sync-overlay {
    position: fixed;
    inset: 0;
    background: var(--color-surface);
    z-index: var(--z-sync);
    display: none;
    justify-content: center;
    align-items: center;
    font-family: var(--font-mono);
    color: var(--color-danger);
    padding: 24px;
}

.terminal-content {
    width: 100%;
    max-width: 480px;
    text-align: left;
}

.line {
    margin: 5px 0;
    overflow: hidden;
    white-space: nowrap;
    border-right: 2px solid var(--color-danger);
    animation: typing 1s steps(30, end), blink 0.5s step-end infinite;
    font-size: clamp(0.65rem, 2.5vw, 0.9rem);
}

.progress-bar-container {
    width: 100%;
    height: 4px;
    background: #222;
    margin-top: 20px;
    border-radius: 2px;
    overflow: hidden;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: var(--color-danger);
    transition: width 2s ease-in-out;
}

@keyframes typing {
    from {
        width: 0;
    }

    to {
        width: 100%;
    }
}

@keyframes blink {

    from,
    to {
        border-color: transparent;
    }

    50% {
        border-color: var(--color-danger);
    }
}

.bg-video {
    position: fixed;
    top: 50%;
    left: 50%;
    min-width: 100%;
    min-height: 100%;
    width: auto;
    height: auto;
    z-index: -100;
    /* Behind everything */
    transform: translate(-50%, -50%);
    /* Centers the video */
    object-fit: cover;
    /* Ensures it fills the screen perfectly */
    filter: brightness(0.6) contrast(1.2);
    /* Keep it dystopian and dark */
}

.fade-in {
    animation: simpleFade 1.5s ease-in;
}

@keyframes simpleFade {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* --- 14. ERROR PAGE ----------------------------------------------------- */
.error-page {
    background-color: var(--color-surface);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    height: 100dvh;
    text-align: center;
    color: var(--color-danger);
    padding: 24px;
}

.error-container {
    width: 100%;
    max-width: 560px;
}

.error-container h1 {
    font-size: clamp(4rem, 15vw, 8rem);
    margin: 0;
    letter-spacing: 0.1em;
    line-height: 1;
}

.sub-glitch {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: var(--color-primary);
    letter-spacing: 3px;
    margin-bottom: 16px;
}

.error-container p {
    max-width: 500px;
    color: var(--color-muted);
    line-height: 1.6;
    margin: 0 auto 24px;
    font-size: clamp(0.85rem, 2vw, 1rem);
}


/* --- 15. SHARED PAGE HEADER --------------------------------------------- */
.lab-header {
    position: sticky;
    top: 0;
    z-index: var(--z-ui);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 0 8px;
    padding: 12px 16px;
    min-height: var(--header-height);
    background: rgba(0, 0, 0, 0.6);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

/* Page title badge — centered in header */
.page-title-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.85);
    pointer-events: none;
    overflow: hidden;
    min-width: 0;
}

.page-title-badge span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.page-title-badge svg {
    opacity: 0.8;
    flex-shrink: 0;
    width: 14px;
    height: 14px;
}

.lab-main {
    position: relative;
    z-index: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 12px 20px;
    /* full viewport minus header, leaving room for footer */
    height: calc(100vh - var(--header-height));
    height: calc(100dvh - var(--header-height));
    box-sizing: border-box;
}

/* --- 17. FOCUS & ACCESSIBILITY ------------------------------------------ */
:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

/* Disable heavy VFX for users who prefer reduced motion */
@media (prefers-reduced-motion: reduce) {

    .glitch-text,
    .noise-layer,
    .line {
        animation: none !important;
    }

    .background-image,
    .progress-fill,
    .nav-links,
    .nav-backdrop {
        transition-duration: 0.01ms !important;
    }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS — TABLET (≥600px)
   ========================================================================== */
@media screen and (min-width: 600px) {
    .landing-ui-layer {
        padding: 20px 32px;
    }

    header {
        padding: 16px 8px;
    }

    .hamburger-menu.open {
        top: 32px;
        right: 32px;
    }

    .hero-section {
        margin-bottom: 15vh;
        padding: 0 32px;
    }

    .cta-button {
        padding: 11px 28px;
        font-size: 0.9rem;
    }

    .glass-panel {
        padding: 24px;
    }

    .terminal-content {
        max-width: 480px;
    }

    .error-container p {
        padding: 0;
    }

    .lab-header {
        display: flex;
        justify-content: space-between;
        gap: 0;
        padding: 12px 32px;
    }

    .page-title-badge {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        justify-content: flex-start;
        gap: 10px;
        font-size: 0.88rem;
        letter-spacing: 2.5px;
        overflow: visible;
        min-width: unset;
    }

    .page-title-badge span {
        overflow: visible;
        text-overflow: clip;
        white-space: nowrap;
    }

    .page-title-badge svg {
        width: 20px;
        height: 20px;
    }

    .lab-main {
        padding: 20px;
    }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS — DESKTOP (≥1024px)
   ========================================================================== */
@media screen and (min-width: 1024px) {
    .landing-ui-layer {
        padding: 20px 40px;
    }

    header {
        padding: 20px 0;
    }

    .hamburger-menu.open {
        top: 36px;
        right: 40px;
    }

    .logo {
        font-size: 1.2rem;
    }

    .logo img {
        height: 24px;
    }

    .nav-links {
        width: 300px;
    }

    .nav-links a {
        font-size: 0.88rem;
    }

    .cta-button {
        padding: 12px 32px;
        font-size: 0.95rem;
    }


    .corner-decoration {
        width: 20px;
        height: 20px;
    }

    .corner-decoration.bottom-right {
        bottom: 20px;
        right: 20px;
    }

    .lab-header {
        padding: 16px 40px;
    }

    .lab-main {
        padding: 24px;
    }
}

/* ==========================================================================
   RESPONSIVE BREAKPOINTS — LARGE DESKTOP (≥1440px)
   ========================================================================== */
@media screen and (min-width: 1440px) {
    .hero-section h1 {
        font-size: 4rem;
    }
}

/* ==========================================================================
   UTILITY: LANDSCAPE PHONES
   ========================================================================== */
@media screen and (max-height: 500px) and (orientation: landscape) {
    .hero-section {
        margin-bottom: 4vh;
    }

    .hero-section h1 {
        font-size: clamp(1.1rem, 4vw, 2rem);
    }

    .separator {
        margin-bottom: 16px;
    }
}

/* ── Nav: vault auth button (used site-wide by nav-injector.js) ───────────── */

.nav-vault-btn {
    font-family:     var(--font-mono, 'Share Tech Mono', monospace);
    font-size:       0.68rem;
    letter-spacing:  0.1em;
    text-transform:  uppercase;
    border-radius:   2px;
    cursor:          pointer;
    transition:      opacity 0.15s, color 0.15s;
    white-space:     nowrap;
    background:      transparent;
    border:          none;
    padding:         0;
    text-decoration: none;
}

.nav-vault-btn--join {
    color:          var(--color-amber, #f5c842);
    border:         1px solid #f5c84255;
    padding:        0.25em 0.75em;
    border-radius:  2px;
}
.nav-vault-btn--join:hover {
    color:          #fff;
    border-color:   #f5c84299;
}

.nav-vault-btn--agent {
    display:     flex;
    align-items: center;
    gap:         0.35em;
    color:       #aaa;
    text-decoration: none;
}
.nav-vault-btn--agent:hover { color: #e05555; }

.nav-vault-icon {
    font-size: 0.55rem;
    color:     var(--color-amber, #f5c842);
}
.nav-vault-name {
    max-width:     8em;
    overflow:      hidden;
    text-overflow: ellipsis;
}


/* ── Vault auth modal — loaded on every page ───────────────────────────────── */

.va-overlay {
    position:        fixed;
    inset:           0;
    background:      rgba(0, 0, 0, 0.78);
    z-index:         9000;
    display:         flex;
    align-items:     center;
    justify-content: center;
    padding:         12px;
    backdrop-filter: blur(4px);
    overflow:        hidden;
}

.va-modal {
    background:    #0d0d16;
    border:        1px solid #2a2a3a;
    border-radius: 4px;
    width:         100%;
    max-width:     420px;
    max-height:    90vh;
    overflow-y:    auto;
    padding:       2rem;
    box-shadow:    0 0 40px rgba(0, 0, 0, 0.7);
    font-family:   var(--font-mono, 'Courier New', monospace);
    box-sizing:    border-box;
}

.va-header {
    display:         flex;
    align-items:     center;
    justify-content: space-between;
    margin-bottom:   1.25rem;
}

.va-title {
    font-size:      1rem;
    letter-spacing: 0.12em;
    color:          var(--color-amber, #f5c842);
}

.va-close {
    background:  transparent;
    border:      none;
    color:       #666;
    cursor:      pointer;
    font-size:   1.1rem;
    line-height: 1;
    padding:     0;
}
.va-close:hover { color: #ccc; }

.va-tabs {
    display:       flex;
    gap:           0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #222;
}

.va-tab {
    background:     transparent;
    border:         none;
    border-bottom:  2px solid transparent;
    color:          #555;
    cursor:         pointer;
    font-family:    inherit;
    font-size:      0.7rem;
    letter-spacing: 0.1em;
    margin-bottom:  -1px;
    padding:        0.4em 1em;
    text-transform: uppercase;
    transition:     color 0.15s, border-color 0.15s;
}
.va-tab--active {
    color:        var(--color-amber, #f5c842);
    border-color: var(--color-amber, #f5c842);
}
.va-tab:hover:not(.va-tab--active) { color: #aaa; }

.va-error {
    background:     #2a0d0d;
    border:         1px solid rgba(224, 85, 85, 0.33);
    border-radius:  2px;
    color:          #e05555;
    font-size:      0.68rem;
    letter-spacing: 0.06em;
    margin-bottom:  1rem;
    padding:        0.5em 0.75em;
}

.va-field-group {
    margin-bottom: 1rem;
    min-width:     0;
    max-width:     100%;
}

.va-label {
    display:        block;
    color:          #555;
    font-size:      0.62rem;
    letter-spacing: 0.1em;
    margin-bottom:  0.35rem;
    text-transform: uppercase;
}

.va-input {
    width:          100%;
    max-width:      100%;
    min-width:      0;
    background:     #111118;
    border:         1px solid #2a2a3a;
    border-radius:  2px;
    color:          #ccc;
    font-family:    inherit;
    font-size:      0.8rem;
    letter-spacing: 0.04em;
    padding:        0.55em 0.75em;
    box-sizing:     border-box;
    transition:     border-color 0.15s;
}
.va-input:focus {
    border-color: rgba(245, 200, 66, 0.4);
    outline:      none;
}

.va-submit {
    width:          100%;
    margin-top:     0.5rem;
    font-family:    inherit;
    font-size:      0.75rem;
    letter-spacing: 0.1em;
}

.va-info {
    color:          #444;
    font-size:      0.62rem;
    letter-spacing: 0.04em;
    line-height:    1.5;
    margin-top:     1rem;
    text-align:     center;
}

/* S22 — OTP, forgot password, success banner */
.va-success {
    background:     #0d2a0d;
    border:         1px solid rgba(85, 224, 85, 0.33);
    border-radius:  2px;
    color:          #6dbf7a;
    font-size:      0.68rem;
    letter-spacing: 0.06em;
    margin-bottom:  1rem;
    padding:        0.5em 0.75em;
}

.va-forgot-wrap {
    text-align: right;
    margin-top: -0.5rem;
    margin-bottom: 0.75rem;
}

.va-forgot-link {
    background:     transparent;
    border:         none;
    color:          #666;
    cursor:         pointer;
    font-family:    inherit;
    font-size:      0.58rem;
    letter-spacing: 0.06em;
    padding:        0;
    text-transform: uppercase;
}
.va-forgot-link:hover { color: var(--color-amber, #f5c842); }

.va-otp-inputs {
    display:         flex;
    gap:             8px;
    justify-content: center;
    margin:          12px 0;
}

.va-otp-digit {
    width:          44px;
    height:         52px;
    background:     #111118;
    border:         1px solid #2a2a3a;
    border-radius:  4px;
    color:          var(--color-amber, #f5c842);
    font-family:    inherit;
    font-size:      1.4rem;
    font-weight:    bold;
    letter-spacing: 0;
    text-align:     center;
    box-sizing:     border-box;
    transition:     border-color 0.15s;
}
.va-otp-digit:focus {
    border-color: var(--color-amber, #f5c842);
    outline: none;
    box-shadow: 0 0 0 2px rgba(245, 200, 66, 0.15);
}

.va-otp-hint {
    color:       #555;
    font-size:   0.62rem;
    text-align:  center;
    margin:      8px 0 12px;
    letter-spacing: 0.04em;
}

.va-resend-btn {
    display:        block;
    margin:         8px auto 0;
    background:     transparent;
    border:         1px solid #333;
    border-radius:  2px;
    color:          #888;
    cursor:         pointer;
    font-family:    inherit;
    font-size:      0.6rem;
    letter-spacing: 0.08em;
    padding:        0.4em 1.2em;
    transition:     color 0.15s, border-color 0.15s;
}
.va-resend-btn:hover:not(:disabled) {
    color: var(--color-amber, #f5c842);
    border-color: var(--color-amber, #f5c842);
}
.va-resend-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.va-back-link {
    display:        block;
    margin:         12px auto 0;
    background:     transparent;
    border:         none;
    color:          #666;
    cursor:         pointer;
    font-family:    inherit;
    font-size:      0.6rem;
    letter-spacing: 0.06em;
    padding:        0;
}
.va-back-link:hover { color: #ccc; }

@media (max-width: 480px) {
    .va-modal {
        padding: 1.25rem 1rem;
    }
    .va-title {
        font-size: 0.88rem;
    }
    .va-tabs {
        margin-bottom: 1rem;
    }
    .va-otp-digit {
        width: 36px;
        height: 44px;
        font-size: 1.1rem;
    }
    .va-otp-inputs {
        gap: 5px;
    }
}
