/* ===================================================================
   HabitQR Private Beta - True Luni.app Scrollable 3D Luniverse
   Full-screen fixed WebGL 3D world with scroll-driven camera choreography
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Syne:wght@500;600;700;800&family=Plus+Jakarta+Sans:wght@300;400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root {
    --bg-main: #0c0d12;
    --bg-surface: #14161f;
    --bg-card: rgba(20, 23, 34, 0.72);
    --bg-card-hover: rgba(28, 32, 46, 0.88);
    
    /* Authentic Luni Brand Palette */
    --luni-green: #b7f452;       /* Iconic Acid Lime Green */
    --luni-lavender: #d2b1ff;   /* Soft Lavender */
    --luni-phantom: #c5cafb;    /* Pastel Blue-Violet */
    --luni-mint: #eaffd9;
    --luni-orange: #ff9f76;
    --luni-charcoal: #1b1a1a;
    --luni-white: #ffffff;
    
    --border-subtle: rgba(255, 255, 255, 0.1);
    --border-hover: rgba(183, 244, 82, 0.5);
    
    --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
    --ease-out-back: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-font-smoothing: antialiased;
}

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg-main);
    color: #f1f5f9;
    font-family: 'Plus Jakarta Sans', sans-serif;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* Headings & Monospace */
.font-syne {
    font-family: 'Syne', sans-serif;
}
.font-mono-code {
    font-family: 'JetBrains Mono', monospace;
}

/* Custom Interactive Cursor */
.custom-cursor-dot {
    position: fixed;
    top: 0;
    left: 0;
    width: 10px;
    height: 10px;
    background-color: var(--luni-green);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9999;
    transform: translate(-50%, -50%);
    mix-blend-mode: difference;
    transition: width 0.2s, height 0.2s;
}

.custom-cursor-ring {
    position: fixed;
    top: 0;
    left: 0;
    width: 40px;
    height: 40px;
    border: 1.5px solid rgba(183, 244, 82, 0.6);
    border-radius: 50%;
    pointer-events: none;
    z-index: 9998;
    transform: translate(-50%, -50%);
    transition: width 0.25s, height 0.25s, border-color 0.25s;
}

@media (hover: none) or (max-width: 800px) {
    .custom-cursor-dot, .custom-cursor-ring {
        display: none !important;
    }
}

/* Full-Screen Fixed 3D Luniverse Canvas */
#three-luni-stage {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

/* Subtle Noise Texture for Cinematic Studio Depth */
.noise-overlay {
    position: fixed;
    inset: 0;
    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.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)' opacity='0.02'/%3E%3C/svg%3E");
    pointer-events: none;
    z-index: 1;
}

/* Soft Background Glows */
.luni-glow-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.luni-blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(140px);
    opacity: 0.25;
    will-change: transform;
    animation: blobMorph 22s ease-in-out infinite alternate;
}

.blob-green {
    width: 550px;
    height: 550px;
    top: -100px;
    right: 5%;
    background: radial-gradient(circle, #b7f452 0%, rgba(183, 244, 82, 0) 70%);
}

.blob-lavender {
    width: 600px;
    height: 600px;
    top: 35%;
    left: -120px;
    background: radial-gradient(circle, #d2b1ff 0%, rgba(210, 177, 255, 0) 70%);
    animation-delay: -7s;
}

.blob-phantom {
    width: 700px;
    height: 700px;
    bottom: -150px;
    right: 20%;
    background: radial-gradient(circle, #7f40f3 0%, rgba(127, 64, 243, 0) 70%);
    animation-delay: -14s;
}

@keyframes blobMorph {
    0% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(50px, -30px) scale(1.1); }
    100% { transform: translate(-30px, 50px) scale(0.95); }
}

/* Luni Floating Chapter Progress Track (Left Side) */
.luni-scroll-tracker {
    position: fixed;
    left: 28px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 40;
    display: flex;
    flex-direction: column;
    gap: 16px;
    font-size: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    letter-spacing: 0.08em;
    user-select: none;
}

.tracker-node {
    display: flex;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.35);
    transition: color 0.3s ease;
    cursor: pointer;
    text-decoration: none;
}

.tracker-node .node-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transition: all 0.3s var(--ease-out-back);
}

.tracker-node.is-active {
    color: #ffffff;
}

.tracker-node.is-active .node-indicator {
    background: var(--luni-green);
    transform: scale(1.8);
    box-shadow: 0 0 12px var(--luni-green);
}

@media (max-width: 1024px) {
    .luni-scroll-tracker {
        display: none !important;
    }
}

/* Luni Buttons with Rolling Fill */
.btn-luni-square {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background-color: var(--luni-green);
    color: var(--luni-charcoal);
    font-weight: 700;
    font-size: 13px;
    letter-spacing: -0.01em;
    padding: 14px 26px;
    border-radius: 9999px;
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.25s var(--ease-out-back), box-shadow 0.25s;
    box-shadow: 0 10px 30px -5px rgba(183, 244, 82, 0.35);
    border: none;
}

.btn-luni-square::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    border-radius: 9999px;
    transform: translateY(105%);
    transition: transform 0.35s cubic-bezier(0.245, 1, 0.48, 0.825);
    z-index: 1;
}

.btn-luni-square span, 
.btn-luni-square svg,
.btn-luni-square i {
    position: relative;
    z-index: 2;
    transition: color 0.3s, transform 0.3s;
}

.btn-luni-square:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 16px 40px -8px rgba(183, 244, 82, 0.5);
}

.btn-luni-square:hover::before {
    transform: translateY(0);
}

.btn-luni-square:hover span {
    color: #ffffff !important;
}

.btn-luni-square:hover svg, 
.btn-luni-square:hover i {
    color: #ffffff !important;
    stroke: #ffffff !important;
    transform: translateX(3px) translateY(-3px);
}

/* Secondary Ghost Pill Button */
.btn-luni-ghost {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(255, 255, 255, 0.06);
    color: #ffffff;
    font-weight: 600;
    font-size: 13px;
    padding: 13px 24px;
    border-radius: 9999px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    cursor: pointer;
    transition: all 0.25s ease;
    text-decoration: none;
}

.btn-luni-ghost:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.35);
    transform: translateY(-2px);
    color: #ffffff;
}

/* Luni Pill Tags */
.luni-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    backdrop-filter: blur(10px);
}

.luni-pill-green {
    background: rgba(183, 244, 82, 0.12);
    color: var(--luni-green);
    border: 1px solid rgba(183, 244, 82, 0.35);
}

.luni-pill-lavender {
    background: rgba(210, 177, 255, 0.12);
    color: var(--luni-lavender);
    border: 1px solid rgba(210, 177, 255, 0.35);
}

.luni-pill-white {
    background: rgba(255, 255, 255, 0.08);
    color: #ffffff;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

/* Glass Studio Cards */
.luni-card {
    background: var(--bg-card);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid var(--border-subtle);
    border-radius: 28px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    transition: transform 0.35s var(--ease-out-expo), border-color 0.3s, box-shadow 0.3s;
    position: relative;
    overflow: hidden;
}

.luni-card:hover {
    border-color: rgba(255, 255, 255, 0.25);
    box-shadow: 0 30px 70px -15px rgba(0, 0, 0, 0.6), 0 0 30px -5px rgba(183, 244, 82, 0.15);
}

/* Marquee */
.luni-marquee-wrap {
    overflow: hidden;
    white-space: nowrap;
    display: flex;
    user-select: none;
    mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
    -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent);
}

.luni-marquee-track {
    display: flex;
    gap: 40px;
    animation: marqueeScroll 24s linear infinite;
    will-change: transform;
}

@keyframes marqueeScroll {
    0% { transform: translateX(0%); }
    100% { transform: translateX(-50%); }
}

/* Floating Bottom Navigation Widget */
.luni-bottom-widget {
    position: fixed;
    bottom: 30px;
    right: 30px;
    z-index: 50;
    background: rgba(20, 22, 32, 0.9);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 22px;
    padding: 8px 16px;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    gap: 12px;
    transition: transform 0.25s var(--ease-out-back);
}

.luni-bottom-widget:hover {
    transform: translateY(-4px) scale(1.02);
    border-color: var(--luni-green);
}

/* 6-Digit OTP Inputs */
.luni-otp-input {
    width: 52px;
    height: 60px;
    border-radius: 16px;
    background: rgba(15, 17, 24, 0.9);
    border: 2px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 26px;
    font-weight: 800;
    text-align: center;
    font-family: 'Syne', sans-serif;
    transition: all 0.2s ease;
}

.luni-otp-input:focus {
    border-color: var(--luni-green);
    background: rgba(20, 24, 34, 1);
    box-shadow: 0 0 0 3px rgba(183, 244, 82, 0.25), 0 0 25px rgba(183, 244, 82, 0.3);
    outline: none;
    transform: translateY(-2px);
}

/* Form Inputs */
.luni-input {
    width: 100%;
    background: rgba(14, 16, 24, 0.85);
    border: 1.5px solid rgba(255, 255, 255, 0.12);
    color: #ffffff;
    font-size: 14px;
    padding: 14px 18px;
    border-radius: 16px;
    transition: all 0.2s ease;
}

.luni-input:focus {
    border-color: var(--luni-green);
    box-shadow: 0 0 0 3px rgba(183, 244, 82, 0.2);
    outline: none;
    background: rgba(18, 22, 32, 0.95);
}

/* 3D Tilt Card */
.tilt-card-3d {
    transform-style: preserve-3d;
    transition: transform 0.2s cubic-bezier(0.2, 0, 0, 1);
    will-change: transform;
}

/* =============================================================
   DEDICATED IMMERSIVE PORTAL VIEW (WHEN USER LOGGED IN)
   ============================================================= */
body.is-authenticated {
    overflow-x: hidden;
    min-height: 100vh;
}

body.is-authenticated .marketing-view,
body.is-authenticated .luni-scroll-tracker {
    display: none !important;
}

body.is-authenticated header {
    position: relative;
    z-index: 40;
}

body.is-authenticated header nav {
    display: none !important;
}

body.is-authenticated #terminal {
    min-height: calc(100vh - 100px);
    padding: 1rem 1rem 2.5rem;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

body.is-authenticated #terminal-heading,
body.is-authenticated #terminal-subheading,
body.is-authenticated #terminal-badge-wrap {
    display: none !important;
}

body.is-authenticated .portal-gateway-card {
    max-width: 660px;
    width: 100%;
    margin-left: auto;
    margin-right: auto;
    backdrop-filter: blur(32px);
    -webkit-backdrop-filter: blur(32px);
    background: rgba(12, 16, 25, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 28px;
    box-shadow: 0 35px 90px rgba(0, 0, 0, 0.75), 0 0 70px rgba(183, 244, 82, 0.08);
    position: relative;
    overflow: hidden;
    animation: portalFadeIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes portalFadeIn {
    from {
        opacity: 0;
        transform: translateY(16px) scale(0.98);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

body.is-authenticated .portal-gateway-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, rgba(183, 244, 82, 0.9), rgba(168, 192, 255, 0.8), transparent);
    z-index: 2;
}

body.is-authenticated.is-admin .portal-gateway-card {
    max-width: 1040px;
}
