@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
    /* Apple-inspired Dark Mode Palette */
    --bg-primary: #000000;
    --bg-secondary: #1c1c1e;
    --bg-tertiary: #2c2c2e;

    --text-primary: #f5f5f7;
    --text-secondary: #86868b;
    --text-tertiary: #6e6e73;

    --accent-blue: #2997ff;
    --accent-purple: #bf5af2;
    --accent-cyan: #30d158;
    /* Using green for success/connected */
    --accent-red: #ff453a;
    --accent-orange: #ff9f0a;

    --glass-bg: rgba(28, 28, 30, 0.65);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);

    --radius-lg: 24px;
    --radius-md: 18px;
    --radius-sm: 12px;
    --radius-full: 9999px;

    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    background-color: var(--bg-primary);
    color: var(--text-primary);
    font-family: var(--font-main);
    height: 100vh;
    overflow: hidden;
    position: relative;
    display: flex;
    flex-direction: column;
}

/* Background Gradient Mesh */
.bg-mesh {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    background:
        radial-gradient(circle at 15% 50%, rgba(41, 151, 255, 0.08), transparent 25%),
        radial-gradient(circle at 85% 30%, rgba(191, 90, 242, 0.08), transparent 25%);
    pointer-events: none;
}

/* Hero / Info Section */
.hero-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 1;
    padding: 2rem;
}

.hero-content {
    max-width: 800px;
    text-align: center;
    animation: fadeIn 1s ease-out;
}

.hero-title {
    font-size: clamp(3rem, 6vw, 5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    margin-bottom: 1.5rem;
    background: linear-gradient(135deg, #fff 0%, #86868b 100%);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    line-height: 1.1;
}

.hero-description {
    font-size: clamp(1.1rem, 2vw, 1.5rem);
    color: var(--text-secondary);
    line-height: 1.5;
    margin-bottom: 2.5rem;
    font-weight: 400;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.hero-description strong {
    color: var(--text-primary);
    font-weight: 600;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 1rem;
    margin-top: 3rem;
    opacity: 0.8;
}

.feature-item {
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    padding: 1rem;
    border-radius: var(--radius-md);
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 500;
    transition: transform 0.3s ease;
}

.feature-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
}

/* Message Container */
.message-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10;
    pointer-events: none;
    /* Allow clicks to pass through empty space */
}

/* Floating Bubbles */
.bubble {
    position: absolute;
    padding: 18px 24px;
    border-radius: var(--radius-lg);
    background: rgba(28, 28, 30, 0.85);
    backdrop-filter: blur(25px);
    -webkit-backdrop-filter: blur(25px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    box-shadow:
        0 4px 24px -1px rgba(0, 0, 0, 0.2),
        0 0 0 1px rgba(255, 255, 255, 0.05) inset;
    max-width: 340px;
    pointer-events: auto;
    cursor: grab;
    transform-origin: center;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
    animation: float 6s ease-in-out infinite;
}

.bubble:active {
    cursor: grabbing;
    transform: scale(0.98);
}

.bubble-content {
    color: var(--text-primary);
    font-size: 1rem;
    line-height: 1.4;
    font-weight: 500;
    margin-bottom: 8px;
}

.bubble-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.bubble-timer {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--accent-blue);
    background: rgba(41, 151, 255, 0.1);
    padding: 2px 8px;
    border-radius: var(--radius-full);
}

.bubble-timer.warning {
    color: var(--accent-orange);
    background: rgba(255, 159, 10, 0.1);
}

.bubble-timer.critical {
    color: var(--accent-red);
    background: rgba(255, 69, 58, 0.1);
}

/* Input Area */
.input-dock {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 600px;
    z-index: 100;
    display: flex;
    gap: 12px;
    padding: 10px;
    background: rgba(28, 28, 30, 0.75);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: var(--radius-full);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.input-dock:focus-within {
    transform: translateX(-50%) translateY(-5px);
    background: rgba(28, 28, 30, 0.9);
    border-color: rgba(255, 255, 255, 0.25);
}

.message-input {
    flex: 1;
    background: transparent;
    border: none;
    padding: 12px 20px;
    font-size: 1rem;
    color: var(--text-primary);
    font-family: var(--font-main);
}

.message-input:focus {
    outline: none;
}

.message-input::placeholder {
    color: var(--text-tertiary);
}

.send-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: var(--accent-blue);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.send-btn:hover {
    background: #007aff;
    /* Slightly darker blue */
    transform: scale(1.05);
}

.send-btn:active {
    transform: scale(0.95);
}

.send-btn:disabled {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: not-allowed;
}

/* Status Indicator */
.status-pill {
    position: fixed;
    top: 2rem;
    right: 2rem;
    padding: 8px 16px;
    background: rgba(28, 28, 30, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
    z-index: 100;
    transition: all 0.3s ease;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background-color: var(--text-tertiary);
    transition: background-color 0.3s ease;
}

.status-pill.connected .status-dot {
    background-color: var(--accent-cyan);
    box-shadow: 0 0 10px rgba(48, 209, 88, 0.4);
}

.status-pill.disconnected .status-dot {
    background-color: var(--accent-red);
}

.status-pill.connecting .status-dot {
    background-color: var(--accent-orange);
    animation: pulse 1s infinite;
}

/* Retry Button */
.retry-btn {
    position: fixed;
    top: 5rem;
    right: 2rem;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--glass-border);
    padding: 8px 16px;
    border-radius: var(--radius-full);
    font-size: 0.8rem;
    cursor: pointer;
    z-index: 100;
    display: none;
}

/* Animations */
@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }

    100% {
        opacity: 1;
    }
}

.bubble.visible {
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, float 6s ease-in-out infinite 0.4s;
}

@keyframes popIn {
    from {
        opacity: 0;
        transform: scale(0.5);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Responsive */
@media (max-width: 768px) {
    .hero-title {
        font-size: 2.5rem;
    }

    .input-dock {
        bottom: 1.5rem;
        width: 92%;
    }

    .status-pill {
        top: 1.5rem;
        right: 1.5rem;
        padding: 6px 12px;
    }

    .bubble {
        padding: 14px 18px;
        max-width: 280px;
    }
}

/* Info Button */
.info-btn {
    position: fixed;
    top: 2rem;
    right: calc(2rem + 160px);
    /* Adjust based on status pill width */
    width: 36px;
    height: 36px;
    background: rgba(28, 28, 30, 0.6);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: all 0.3s ease;
}

.info-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: scale(1.05);
}

/* Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: rgba(28, 28, 30, 0.95);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    width: 90%;
    max-width: 500px;
    position: relative;
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.modal-overlay.active .modal-content {
    transform: scale(1) translateY(0);
}

.modal-close {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: transparent;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    border-radius: 50%;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

.modal-content h2 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.modal-content p {
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1rem;
}

.modal-list {
    list-style: none;
    margin-bottom: 1.5rem;
}

.modal-list li {
    margin-bottom: 0.5rem;
    color: var(--text-secondary);
    padding-left: 1rem;
    position: relative;
}

.modal-list li::before {
    content: "•";
    color: var(--accent-blue);
    position: absolute;
    left: 0;
    font-weight: bold;
}

.modal-list strong {
    color: var(--text-primary);
}

.modal-footer {
    font-size: 0.9rem;
    color: var(--text-tertiary);
    border-top: 1px solid var(--glass-border);
    padding-top: 1rem;
    margin-bottom: 0 !important;
}

@media (max-width: 768px) {
    .info-btn {
        top: 1.5rem;
        right: calc(1.5rem + 130px);
    }
}