:root {
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --accent-blue: #38bdf8;
    --accent-blue-hover: #0284c7;
    --font-main: 'Inter', sans-serif;
}

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

/* Chat home: only Skipper top-left, no tier badge top-right */
body.chat-page .access-badge,
body.chat-page #access-badge,
body.chat-page #btn-pro-unlock {
    display: none !important;
}

body {
    font-family: var(--font-main);
    color: var(--text-primary);
    background-color: var(--bg-darker);
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100vh;
    height: 100dvh;
    overflow-x: hidden;
    overflow-y: hidden;
}

.chat-container {
    width: 100%;
    max-width: 800px;
    display: flex;
    flex-direction: column;
    flex: 1 1 0;
    min-height: 0;
    padding: 2rem;
    overflow: hidden;
}

.chat-bottom {
    flex-shrink: 0;
}

header {
    text-align: center;
    margin-bottom: 2rem;
    flex-shrink: 0;
    animation: fadeInDown 0.8s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.brand-logo {
    width: 90px;
    height: auto;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 0 20px rgba(56, 189, 248, 0.6));
    animation: float 4s ease-in-out infinite;
    border-radius: 50%; /* Just in case it's a square image, helps blend it */
}

@keyframes float {
    0% { transform: translateY(0px); }
    50% { transform: translateY(-8px); }
    100% { transform: translateY(0px); }
}

header h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.05em;
    background: linear-gradient(135deg, var(--text-primary), var(--accent-blue));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

header p {
    color: var(--text-secondary);
    font-weight: 300;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

button.skipper-nav-btn,
a.skipper-nav-btn {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    position: static;
    z-index: 150;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    font-family: var(--font-main), system-ui, sans-serif;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #38bdf8;
    text-decoration: none;
    border: 1px solid rgba(56, 189, 248, 0.4);
    background: rgba(15, 23, 42, 0.92);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.5rem 1rem;
    border-radius: 6px;
    line-height: 1.2;
    box-shadow: 0 0 12px rgba(56, 189, 248, 0.15);
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

button.skipper-nav-btn:hover,
a.skipper-nav-btn:hover {
    color: #7dd3fc;
    background: rgba(56, 189, 248, 0.18);
    border-color: #38bdf8;
    box-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
}

.blackbox-nav-btn {
    position: fixed;
    top: 1rem;
    left: 6.5rem;
    z-index: 100;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #f59e0b;
    text-decoration: none;
    border: 1px solid rgba(245, 158, 11, 0.35);
    background: rgba(15, 23, 42, 0.85);
    backdrop-filter: blur(8px);
    padding: 0.45rem 0.9rem;
    border-radius: 6px;
    transition: background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.blackbox-nav-btn:hover {
    background: rgba(245, 158, 11, 0.12);
    border-color: #f59e0b;
    box-shadow: 0 0 16px rgba(245, 158, 11, 0.2);
}

.chat-history {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    padding-right: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}

.chat-history::-webkit-scrollbar {
    width: 6px;
}
.chat-history::-webkit-scrollbar-thumb {
    background-color: var(--glass-border);
    border-radius: 10px;
}

.message {
    display: flex;
    gap: 1rem;
    animation: fadeIn 0.4s ease;
}

.message.user {
    flex-direction: row-reverse;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.message.ai .avatar {
    background: linear-gradient(135deg, #1e293b, #0f172a);
    border: 1px solid var(--glass-border);
    color: var(--accent-blue);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.message.user .avatar {
    background: var(--accent-blue);
    color: var(--bg-darker);
}

.content {
    max-width: 80%;
    line-height: 1.6;
    font-size: 1rem;
}

.message.ai .content {
    color: var(--text-primary);
}

.message.user .content {
    background: var(--glass-bg);
    padding: 1rem 1.25rem;
    border-radius: 18px;
    border-bottom-right-radius: 4px;
    border: 1px solid var(--glass-border);
}

.input-area {
    margin-top: 1.25rem;
    display: flex;
    gap: 0.75rem;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    padding: 0.5rem;
    border-radius: 24px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.5);
    transition: border-color 0.3s;
}

.input-area:focus-within {
    border-color: var(--accent-blue);
}

#chat-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-primary);
    padding: 0.75rem 1rem;
    font-size: 1rem;
    font-family: inherit;
    outline: none;
}

#chat-input::placeholder {
    color: var(--text-secondary);
}

#send-btn {
    background: var(--accent-blue);
    color: var(--bg-darker);
    border: none;
    border-radius: 18px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

#send-btn:hover {
    background: var(--accent-blue-hover);
    transform: scale(1.05);
}

.disclaimer {
    text-align: center;
    margin-top: 1rem;
}

.chat-memory-notice {
    margin: 0 0 0.75rem;
    padding: 0.55rem 0.85rem;
    font-size: 0.72rem;
    line-height: 1.45;
    color: var(--text-secondary);
    background: rgba(56, 189, 248, 0.08);
    border: 1px solid rgba(56, 189, 248, 0.18);
    border-radius: 0.5rem;
    text-align: center;
}

.chat-memory-notice[data-tier="pro"] {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.22);
    color: rgba(226, 232, 240, 0.92);
}

.disclaimer p {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

/* Full-width footer under chat; wave spans edge-to-edge when possible */
.app-footer {
    flex-shrink: 0;
    flex-grow: 0;
    align-self: stretch;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    text-align: center;
    font-size: 11px;
    color: var(--text-secondary);
    letter-spacing: 0.04em;
    padding: 0.35rem 0 0.65rem;
    /* Very light tint so the strip reads almost black / highly transparent */
    background-color: rgba(2, 6, 23, 0.35);
}

.footer-wave-shell {
    width: 100%;
    max-height: min(22vh, 200px);
    line-height: 0;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
    overflow: hidden;
}

.footer-wave {
    display: block;
    width: 100%;
    max-width: none;
    height: auto;
    max-height: min(20vh, 180px);
    margin: 0;
    object-fit: cover;
    object-position: bottom center;
    opacity: 0.38;
    filter: saturate(1.02) contrast(1.05) brightness(0.88);
    box-shadow: none;
}

.footer-text {
    align-self: center;
    margin-top: 0.35rem;
    font-size: 10px;
    color: rgba(148, 163, 184, 0.55);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 1rem 0;
}

.typing-indicator span {
    width: 6px;
    height: 6px;
    background-color: var(--text-secondary);
    border-radius: 50%;
    animation: typing 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 typing {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

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

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

/* Mobile — smaller input text so more of the placeholder is visible */
@media (max-width: 480px) {
    .chat-container {
        padding: 1.25rem 0.75rem 0.5rem;
    }

    header h1 {
        font-size: 1.65rem;
    }

    .input-area {
        margin-top: 0.75rem;
        gap: 0.45rem;
        padding: 0.3rem 0.3rem 0.3rem 0.55rem;
        border-radius: 20px;
    }

    #chat-input {
        padding: 0.5rem 0.45rem;
        font-size: 0.8125rem;
        line-height: 1.35;
        min-width: 0;
        -webkit-text-size-adjust: 100%;
        text-size-adjust: 100%;
    }

    #chat-input::placeholder {
        font-size: 0.8125rem;
        line-height: 1.35;
    }

    #send-btn {
        width: 40px;
        height: 40px;
        border-radius: 14px;
        flex-shrink: 0;
    }

    #send-btn svg {
        width: 18px;
        height: 18px;
    }

    .disclaimer {
        margin-top: 0.6rem;
    }

    .disclaimer p {
        font-size: 0.68rem;
    }
}

@media (max-width: 360px) {
    #chat-input,
    #chat-input::placeholder {
        font-size: 0.75rem;
    }
}
