:root {
    --font-heading: 'Sora', sans-serif;
    --font-body: 'Lexend', sans-serif;
    --primary: #111;
    --text: #1d1d1f;
    --bg-body: #ffffff;
}

body {
    margin: 0;
    font-family: var(--font-body);
    background-color: var(--bg-body);
    height: 100vh;
    overflow: hidden;
    position: relative;
    color: var(--text);
}

button,
input {
    font-family: var(--font-body);
}

/* --- Navigation Islands --- */
.nav-layer {
    position: absolute;
    top: 40px;
    left: 40px;
    right: 40px;
    display: flex;
    justify-content: space-between;
    z-index: 20;
    pointer-events: none;
}

.nav-island {
    background: #ffffff;
    border-radius: 100px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
    display: flex;
    align-items: center;
    pointer-events: auto;
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: box-shadow 0.2s;
    height: auto;
    padding: 6px 6px;
}

.nav-island:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.logo-island {
    padding: 10px 24px;
    gap: 14px;
}

.logo-mark {
    width: 24px;
    height: 24px;
    background: radial-gradient(circle at 30% 30%, #333, #000);
    border-radius: 50%;
}

.logo-text {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 18px;
    color: #111;
    letter-spacing: -0.5px;
}

.menu-island {
    padding: 6px 8px;
    gap: 6px;
}

.nav-link {
    text-decoration: none;
    color: #555;
    font-weight: 500;
    font-size: 14px;
    padding: 10px 20px;
    border-radius: 100px;
    transition: color 0.2s, background 0.2s;
}

.nav-link:hover {
    color: #111;
    background: #f5f5f5;
}

.nav-btn-pill {
    text-decoration: none;
    background: #111;
    color: white;
    padding: 10px 24px;
    border-radius: 100px;
    font-weight: 500;
    font-size: 14px;
    transition: opacity 0.2s;
    display: inline-flex;
    align-items: center;
    line-height: 1.2;
}

.nav-btn-pill:hover {
    opacity: 0.9;
}

.close-btn-island {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: white;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #111;
    text-decoration: none;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    pointer-events: auto;
    border: 1px solid rgba(0, 0, 0, 0.06);
    transition: all 0.2s cubic-bezier(0.3, 0, 0.2, 1);
}

.close-btn-island span {
    font-size: 26px;
}

.close-btn-island:hover {
    transform: rotate(90deg) scale(1.05);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

/* --- Hero --- */
.hero {
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    position: relative;
    z-index: 10;
}

#hero-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
}

.hero-content {
    z-index: 15;
    position: relative;
    max-width: 900px;
    padding-bottom: 40px;
}

.floating-badge {
    background: white;
    padding: 8px 16px;
    border-radius: 100px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    margin-bottom: 32px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.badge-dot {
    width: 6px;
    height: 6px;
    background: #00c853;
    border-radius: 50%;
}

h1 {
    font-family: var(--font-heading);
    font-size: 80px;
    line-height: 1.05;
    color: #111;
    margin: 0 0 24px 0;
    font-weight: 800;
    letter-spacing: -2px;
}

p.subtitle {
    font-size: 20px;
    color: #666;
    line-height: 1.6;
    font-weight: 300;
    margin: 0 auto 48px auto;
    max-width: 600px;
}

.cta-group {
    display: flex;
    gap: 20px;
    justify-content: center;
}

.cta-btn {
    padding: 18px 42px;
    border-radius: 100px;
    font-size: 16px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, box-shadow 0.2s;
    border: 1px solid transparent;
}

.cta-btn.primary {
    background: #111;
    color: white;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.cta-btn.primary:hover {
    background: #000;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.cta-btn.secondary {
    background: white;
    color: #111;
    border-color: #eee;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.cta-btn.secondary:hover {
    background: #f9f9f9;
    border-color: #ddd;
}

.widget {
    position: absolute;
    z-index: 5;
    filter: drop-shadow(0 15px 30px rgba(0, 0, 0, 0.15));
}

.glass-card {
    background: white;
    border-radius: 20px;
    padding: 20px;
    border: 1px solid rgba(0, 0, 0, 0.06);
}

.w-top-left {
    top: 18%;
    left: 8%;
    transform: rotate(-4deg);
}

.w-top-right {
    top: 18%;
    right: 8%;
    transform: rotate(4deg);
}

.w-bottom-left {
    bottom: 15%;
    left: 10%;
    transform: rotate(3deg);
}

.w-bottom-right {
    bottom: 15%;
    right: 10%;
    transform: rotate(-3deg);
}

/* Components styles kept same */
.chat-preview {
    width: 260px;
    font-size: 13px;
}

.toolbar-mini {
    display: flex;
    justify-content: space-between;
    margin-bottom: 12px;
    color: #888;
    border-bottom: 1px solid #f5f5f5;
    padding-bottom: 8px;
}

.model-pill {
    background: #f0f0f0;
    color: #555;
    padding: 2px 8px;
    border-radius: 4px;
    font-weight: 500;
    font-size: 11px;
}

.chat-msg {
    padding: 10px 14px;
    border-radius: 12px;
    margin-bottom: 8px;
    line-height: 1.4;
    color: #333;
    font-size: 13px;
}

.chat-msg.user {
    background: #f5f5f5;
    color: #111;
    border-bottom-right-radius: 2px;
    margin-left: 30px;
}

.chat-msg.ai {
    background: white;
    border: 1px solid #eee;
    border-top-left-radius: 2px;
    margin-right: 30px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
}

.tree-preview {
    width: 220px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-bottom: 30px;
}

.tree-node {
    background: white;
    border: 1px solid #eee;
    padding: 8px 16px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    z-index: 2;
    margin-bottom: 6px;
}

.tree-node.root {
    background: #111;
    color: white;
    border-color: #111;
}

.tree-branches {
    display: flex;
    gap: 24px;
    margin-top: 24px;
    position: relative;
}

.tree-branches::before {
    content: '';
    position: absolute;
    top: -14px;
    left: 50%;
    width: 1px;
    height: 14px;
    background: #ddd;
    transform: translateX(-50%);
}

.tree-branches::after {
    content: '';
    position: absolute;
    top: -14px;
    left: 25%;
    width: 50%;
    height: 1px;
    background: #ddd;
}

.tree-connector {
    height: 14px;
    width: 1px;
    background: #ddd;
}

.profile-preview {
    width: 230px;
}

.profile-head {
    display: flex;
    gap: 12px;
    align-items: center;
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 12px;
    margin-bottom: 12px;
}

.avatar-circle {
    width: 40px;
    height: 40px;
    background: #111;
    color: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 16px;
}

.p-name {
    font-weight: 600;
    font-size: 14px;
}

.p-sub {
    font-size: 11px;
    margin-top: 2px;
    color: #666;
    font-weight: 500;
}

.h-item {
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 13px;
    color: #666;
    cursor: default;
}

.h-item.active {
    background: #f5f5f5;
    color: #111;
    font-weight: 500;
}

.interaction-preview {
    width: 200px;
    height: 160px;
    position: relative;
}

.node-stack {
    position: relative;
    height: 100%;
}

.node-card {
    position: absolute;
    background: white;
    border: 1px solid #eee;
    padding: 12px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    width: 150px;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 500;
}

.n1 {
    top: 30px;
    left: 20px;
    z-index: 1;
    transform: rotate(-3deg);
}

.n2 {
    top: 80px;
    left: 40px;
    z-index: 2;
    transform: rotate(3deg);
    background: #fefefe;
}

.cursor-pointer {
    position: absolute;
    bottom: 30px;
    right: 30px;
    color: #111;
    z-index: 3;
    font-size: 24px;
    filter: drop-shadow(2px 4px 6px rgba(0, 0, 0, 0.2));
}

/* --- LOGIN PAGE --- */
.login-container {
    z-index: 25;
    width: 100%;
    max-width: 440px;
    animation: fadeUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-island {
    background: white;
    padding: 40px;
    border-radius: 32px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.08), 0 0 0 1px rgba(0, 0, 0, 0.04);
    text-align: center;
    position: relative;
    /* Height handled by content flow naturally now */
}

.auth-tabs {
    display: flex;
    background: #f0f0f0;
    border-radius: 100px;
    padding: 4px;
    position: relative;
    margin-bottom: 32px;
}

.tab-btn {
    flex: 1;
    text-align: center;
    padding: 10px;
    font-weight: 600;
    font-size: 14px;
    color: #888;
    cursor: pointer;
    z-index: 2;
    transition: color 0.3s;
}

.tab-btn.active {
    color: #111;
}

.tab-indicator {
    position: absolute;
    top: 4px;
    left: 4px;
    bottom: 4px;
    width: calc(50% - 4px);
    background: white;
    border-radius: 100px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    z-index: 1;
}

.login-island h2 {
    font-family: var(--font-heading);
    font-weight: 800;
    font-size: 28px;
    margin: 0 0 8px 0;
    color: #111;
}

.login-sub {
    color: #666;
    margin: 0 0 24px 0;
    font-size: 14px;
    line-height: 1.5;
}

.input-group {
    margin-bottom: 12px;
}

.input-field {
    width: 100%;
    padding: 16px 20px;
    border-radius: 14px;
    border: 1px solid #e0e0e0;
    background: #fbfbfb;
    font-size: 14px;
    box-sizing: border-box;
    transition: all 0.2s;
    color: #111;
}

.input-field:focus {
    background: white;
    border-color: #111;
    outline: none;
}

/* REGISTER FIELDS - GRID ANIMATION */
.register-field {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    transition:
        grid-template-rows 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
        opacity 0.4s cubic-bezier(0.2, 0.8, 0.2, 1),
        margin-bottom 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    margin-bottom: 0;
}

.register-field.open {
    grid-template-rows: 1fr;
    opacity: 1;
    margin-bottom: 12px;
}

.register-field>* {
    overflow: hidden;
    /* Ensure content doesn't shift weirdly */
    min-height: 0;
}

.terms-row {
    text-align: left;
    font-size: 13px;
    color: #666;
    display: flex;
    gap: 8px;
    align-items: center;
    padding-left: 4px;
}

.link-term {
    color: #111;
    text-decoration: underline;
    cursor: pointer;
}

.auth-btn {
    width: 100%;
    border-radius: 100px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    transition: all 0.2s;
    height: 50px;
}

.submit-btn {
    background: #111;
    color: white;
    border: none;
    margin-top: 10px;
}

.submit-btn:hover {
    background: #000;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.google-btn-login {
    background: white;
    border: 1px solid #e0e0e0;
    color: #111;
    gap: 12px;
    margin-bottom: 20px;
}

.google-btn-login:hover {
    background: #f9f9f9;
    border-color: #ccc;
}

.divider-row {
    margin: 20px 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.div-line {
    height: 1px;
    background: #eee;
    flex: 1;
}

.div-text {
    font-size: 11px;
    color: #aaa;
    font-weight: 600;
    text-transform: uppercase;
}

.error-msg {
    background: #ffebee;
    color: #c62828;
    padding: 10px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 16px;
    display: none;
}

.loading::after {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid white;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.google-btn-login.loading::after {
    border-color: #555;
    border-top-color: transparent;
}

@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

@media (max-width: 900px) {
    .widget {
        display: none;
    }

    h1 {
        font-size: 48px;
    }

    .nav-layer {
        padding: 0 20px;
        width: auto;
        left: 0;
        right: 0;
        top: 20px;
    }
}