:root {
    --primary-bg: #0f0c29;
    --secondary-bg: #302b63;
    --accent-color: #24243e;
    --text-color: #e0e0e0;
    --chat-bg: #ffffff;
    --chat-header-bg: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --user-msg-bg: #7c6aff;
    --william-msg-bg: #e6e6e6;
    --william-text: #333;
    --gold: #ffd700;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Lato', sans-serif;
    background: linear-gradient(to right, #0f0c29, #302b63, #24243e);
    min-height: 100vh;
    display: flex;
    color: var(--text-color);
}

.app-container {
    width: 100%;
    min-height: 100vh;
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    background-image: url('/images/star-background.jpg');
    background-size: cover;
    background-position: center;
    position: relative;
}

.app-container::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 12, 41, 0.7);
    z-index: 0;
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* ==================== */
/* Landing Page Styles  */
/* ==================== */

.landing-interface {
    z-index: 2;
    width: 100%;
    max-width: 500px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    animation: fadeIn 0.5s ease;
}

.main-title {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 2rem;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.landing-card {
    background: #ffffff;
    border-radius: 12px;
    padding: 30px 20px;
    width: 100%;
    text-align: center;
    color: #333;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.online-green {
    color: #2ecc71;
}

@keyframes pulseButton {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

.badge-icon {
    font-size: 1rem;
    opacity: 0.7;
}

.badge-text {
    text-align: left;
    line-height: 1.3;
}

.landing-avatar-top {
    margin-bottom: -70px;
    z-index: 10;
    position: relative;
}

.landing-avatar-large {
    width: 140px;
    height: 140px;
    object-fit: cover;
    border-radius: 50%;
    border: 5px solid white;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

/* ==================== */
/* Landing Page Styles   */
/* ==================== */

/* Outer wrapper — naturally flows, body handles scrolling */
.landing-interface-c-wrapper {
    z-index: 2;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* Above-the-fold section — fills the viewport with star background visible */
.landing-c-main {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

/* Inner landing interface — keeps existing card layout unchanged */
.landing-interface-c-inner {
    position: relative;
}

#landing-interface-c .main-title {
    margin-bottom: 10px;
}

.landing-avatar-top-c {
    margin-bottom: -70px;
    z-index: 10;
    position: relative;
}

.landing-card-c {
    background: #ffffff;
    border-radius: 12px;
    padding: 80px 20px 30px 20px;
    width: 100%;
    text-align: center;
    color: #333;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.landing-card-c .cta-terms {
    margin-bottom: 20px;
}

.landing-status-pill-c {
    background: #f5f5f5;
    padding: 10px 30px;
    border-radius: 30px;
    font-weight: 600;
    font-size: 0.95rem;
    display: inline-block;
    margin-bottom: 20px;
}

.landing-divider-c {
    width: 60px;
    height: 3px;
    background: #ddd;
    margin: 0 auto 25px auto;
}

.landing-headline-c {
    font-family: 'Lato', sans-serif;
    font-size: 2.2rem;
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.3;
    color: #000;
}

.landing-description-c {
    font-size: 1rem;
    line-height: 1.5;
    margin-bottom: 5px;
    color: #666;
}

.landing-description-c.bold {
    font-weight: 700;
    color: #333;
    margin-bottom: 25px;
}

.landing-cta-btn-c {
    display: block;
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
    text-decoration: none;
    border: none;
    padding: 18px 24px;
    width: 100%;
    border-radius: 8px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 20px;
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.4);
    transition: transform 0.2s;
    animation: pulseButton 2s infinite;
}

.landing-cta-btn-c:hover {
    filter: brightness(1.1);
}

.landing-footer-c {
    font-size: 0.8rem;
    color: #999;
    font-style: italic;
    margin-bottom: 25px;
}

.landing-trust-badges-c {
    display: flex;
    justify-content: center;
    gap: 30px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.trust-badge-c {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Below-the-fold footer — plain black background */
.landing-c-footer {
    background: #000000;
    padding: 30px 20px;
    text-align: center;
    flex-shrink: 0;
}

.landing-c-footer-links {
    display: flex;
    justify-content: center;
    gap: 24px;
    font-size: 0.85rem;
}

.landing-c-footer-links a {
    color: rgba(255, 255, 255, 0.6);
    text-decoration: underline;
}

.landing-c-footer-links a:hover {
    color: white;
}

.landing-c-footer-links .dot {
    color: rgba(255, 255, 255, 0.4);
}

.landing-c-copyright {
    margin-top: 12px;
    font-size: 0.75rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.6);
    text-align: center;
    max-width: 700px;
    margin-left: auto;
    margin-right: auto;
}

/* ==================== */
/* Chat Interface       */
/* ==================== */

.chat-wrapper {
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    width: 100%;
    padding: 20px;
}

.chat-title {
    font-family: 'Cinzel', serif;
    color: var(--gold);
    font-size: 2rem;
    margin-bottom: 20px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
    text-align: center;
}

.chat-interface {
    position: relative;
    z-index: 1;
    width: 450px;
    height: 80vh;
    background-color: var(--chat-bg);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Header */
.chat-header {
    background: var(--chat-header-bg);
    padding: 15px 20px;
    display: flex;
    align-items: center;
    color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.avatar-container {
    position: relative;
    margin-right: 15px;
}

.avatar {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    object-fit: cover;
}

.status-dot {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    background-color: #888;
    border-radius: 50%;
    border: 2px solid white;
}

.status-dot.online {
    background-color: #2ecc71;
}

.header-info h1 {
    font-family: 'Cinzel', serif;
    font-size: 1.2rem;
    margin-bottom: 2px;
}

.status-text {
    font-size: 0.8rem;
    opacity: 0.9;
    background: rgba(255, 255, 255, 0.2);
    padding: 2px 8px;
    border-radius: 10px;
}

/* Chat Area */
.chat-messages {
    flex: 1;
    padding: 15px 20px 20px 20px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 11px;
    background-color: #fff;
}

.message {
    max-width: 80%;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 1.05rem;
    line-height: 1.4;
    position: relative;
}

.message.william {
    align-self: flex-start;
    background-color: var(--william-msg-bg);
    color: var(--william-text);
    border-bottom-left-radius: 4px;
}

.message.user {
    align-self: flex-end;
    background-color: var(--user-msg-bg);
    color: white;
    border-bottom-right-radius: 4px;
}

.system-message {
    align-self: center;
    font-size: 0.95rem;
    color: #555;
    text-align: center;
    margin: 4px 0;
    display: flex;
    align-items: center;
    gap: 10px;
    background: none;
    padding: 0;
    max-width: 100%;
}

.mini-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    object-fit: cover;
}

/* Input Area */
.input-area {
    padding: 15px;
    background-color: #f9f9f9;
    border-top: 1px solid #eee;
    min-height: 80px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.user-controls {
    transition: opacity 0.3s ease;
}

.user-controls.fade-out {
    opacity: 0;
}

.user-controls.fade-in {
    animation: fadeInControls 0.4s ease forwards;
}

@keyframes fadeInControls {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.typing-indicator {
    align-self: flex-start;
    background-color: #e6e6e6;
    padding: 12px 16px;
    border-radius: 18px;
    border-bottom-left-radius: 4px;
    display: flex;
    gap: 5px;
    margin-bottom: 0;
    width: fit-content;
}

.typing-indicator span {
    width: 8px;
    height: 8px;
    background-color: #999;
    border-radius: 50%;
    display: inline-block;
    animation: bounce 1.4s infinite ease-in-out both;
}

.typing-indicator span:nth-child(1) {
    animation-delay: -0.32s;
}

.typing-indicator span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%,
    80%,
    100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

.user-controls {
    width: 100%;
}

.placeholder-text {
    color: #aaa;
    font-style: italic;
    text-align: center;
    font-size: 0.9rem;
    padding: 10px;
}

/* Interactive Elements */
.input-group {
    display: flex;
    gap: 10px;
}

.input-group.textarea-group {
    display: flex;
    flex-direction: row;
    gap: 10px;
    align-items: flex-end;
}

textarea.long-response {
    flex: 1;
    min-height: 100px;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 12px;
    outline: none;
    font-family: inherit;
    font-size: 16px;
    resize: none;
}

textarea.long-response:focus {
    border-color: #ddd;
}

.textarea-group .send-btn {
    height: 44px;
    align-self: flex-end;
    margin-bottom: 4px;
}

.validation-alert {
    background: linear-gradient(135deg, #8e44ad 0%, #9b59b6 100%);
    color: white;
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 10px;
    text-align: center;
    font-size: 0.95rem;
}

input[type="text"],
input[type="email"] {
    flex: 1;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 25px;
    outline: none;
    font-family: inherit;
    font-size: 16px; /* Prevents iOS zoom on focus */
}

input:focus {
    border-color: #ddd;
}

button.send-btn {
    background-color: #7c6aff;
    color: white;
    border: none;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    -webkit-transition: background 0.2s, -webkit-transform 0.2s;
    transition: background 0.2s, transform 0.2s;
    -webkit-animation: pulseSend 2s infinite;
    animation: pulseSend 2s infinite;
}

button.send-btn svg {
    width: 22px;
    height: 22px;
    transform: translateX(1px);
}

@-webkit-keyframes pulseSend {
    0% {
        -webkit-transform: scale(1);
        transform: scale(1);
    }
    50% {
        -webkit-transform: scale(1.07);
        transform: scale(1.07);
    }
    100% {
        -webkit-transform: scale(1);
        transform: scale(1);
    }
}

@keyframes pulseSend {
    0% {
        -webkit-transform: scale(1);
        transform: scale(1);
    }
    50% {
        -webkit-transform: scale(1.07);
        transform: scale(1.07);
    }
    100% {
        -webkit-transform: scale(1);
        transform: scale(1);
    }
}

button.send-btn:hover {
    background-color: #6554d9;
}

.choice-container {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

button.choice-btn {
    background-color: white;
    color: #333;
    border: 1px solid #ddd;
    padding: 12px 20px;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1.05rem;
    transition: all 0.2s;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    -webkit-tap-highlight-color: transparent;
}

button.choice-btn .choice-emoji {
    font-size: 1.4rem;
    vertical-align: middle;
    margin-right: 6px;
}

@media (hover: hover) {
    button.choice-btn:hover {
        background-color: #f0f4ff;
        border-color: #4a90e2;
        transform: translateY(-2px);
    }
}

button.choice-btn:active {
    background-color: #f0f4ff;
    border-color: #4a90e2;
}

button.choice-btn-cta {
    background: linear-gradient(135deg, #7c6aff 0%, #6554d9 100%);
    color: white;
    border: none;
    padding: 18px 24px;
    border-radius: 8px;
    font-family: 'Lato', sans-serif;
    font-size: 1.1rem;
    font-weight: bold;
    width: 100%;
    box-shadow: 0 5px 15px rgba(124, 106, 255, 0.4);
    animation: pulseCta 2s infinite;
}

button.choice-btn-cta:active,
button.choice-btn-cta:hover {
    background: linear-gradient(135deg, #6554d9 0%, #5443c0 100%);
    border-color: transparent;
}

@keyframes pulseCta {
    0% { transform: scale(1); }
    50% { transform: scale(1.02); }
    100% { transform: scale(1); }
}

button.cta-btn {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff8e53 100%);
    color: white;
    border: none;
    padding: 18px 24px;
    border-radius: 8px;
    font-family: 'Lato', sans-serif;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    width: 100%;
    box-shadow: 0 5px 15px rgba(255, 107, 107, 0.4);
    animation: pulse 2s infinite;
}

.cta-terms {
    font-size: 0.85rem;
    color: #999;
    text-align: center;
    margin-top: 10px;
    margin-bottom: 0;
}

.cta-terms a {
    color: #999;
    text-decoration: underline;
}

.cta-terms a:hover {
    color: #bbb;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile Styles */
@media (max-width: 768px) {
    body {
        height: 100%;
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }

    html {
        height: -webkit-fill-available;
    }

    .app-container {
        height: 100%;
        min-height: 100vh;
        min-height: -webkit-fill-available;
    }

    .main-title {
        font-size: 1.5rem;
    }

    .chat-title {
        display: none !important;
    }

    .chat-wrapper {
        width: 100%;
        height: 100%;
        padding: 0;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
    }

    .chat-interface {
        width: 100%;
        height: 100%;
        border-radius: 0;
    }

    .chat-messages {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .input-area {
        flex-shrink: 0;
        padding-bottom: max(15px, env(safe-area-inset-bottom));
    }

    button.send-btn {
        width: 44px;
        height: 44px;
        padding: 0;
        -webkit-animation: pulseSend 2s infinite;
        animation: pulseSend 2s infinite;
    }

    /* Version C Mobile Optimizations (tighter spacing) */
    .landing-c-main {
        min-height: 100vh;
        min-height: 100dvh;
    }

    .landing-interface-c-inner {
        padding: 15px;
    }

    #landing-interface-c .main-title {
        margin-bottom: 5px;
    }

    .landing-avatar-top-c {
        margin-bottom: -80px;
    }

    .landing-card-c {
        padding-top: 70px;
        padding-bottom: 20px;
    }

    .landing-status-pill-c {
        padding: 8px 24px;
        margin-bottom: 10px;
        font-size: 0.9rem;
    }

    .landing-divider-c {
        margin: 0 auto 15px auto;
    }

    .landing-headline-c {
        font-family: 'Lato', sans-serif;
        font-size: 1.8rem;
        font-weight: 700;
        margin-bottom: 12px;
        line-height: 1.3;
        color: #000;
    }

    .landing-description-c {
        font-size: 0.95rem;
        line-height: 1.5;
        margin-bottom: 4px;
        color: #666;
    }

    .landing-description-c.bold {
        font-weight: 700;
        color: #333;
        margin-bottom: 20px;
    }

    .landing-cta-btn-c {
        display: block;
        background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
        color: white;
        text-decoration: none;
        border: none;
        padding: 14px 20px;
        width: 100%;
        border-radius: 8px;
        font-size: 1.1rem;
        font-weight: bold;
        cursor: pointer;
        margin-bottom: 12px;
        box-shadow: 0 4px 15px rgba(155, 89, 182, 0.4);
        transition: transform 0.2s;
        animation: pulseButton 2s infinite;
    }

    .landing-footer-c {
        font-size: 0.75rem;
        color: #999;
        font-style: italic;
        margin-bottom: 15px;
    }

    .landing-trust-badges-c {
        display: flex;
        justify-content: center;
        gap: 20px;
        padding-top: 12px;
        border-top: 1px solid #eee;
    }

    .trust-badge-c {
        display: flex;
        align-items: center;
        gap: 8px;
        font-size: 0.7rem;
        color: #888;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    .landing-c-footer {
        padding: 20px 15px;
    }

    .landing-c-footer-links {
        font-size: 0.75rem;
    }

    .landing-c-copyright {
        margin-top: 8px;
        font-size: 0.65rem;
    }
}
