:root {
    /* Accent colors (common to both themes) */
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --secondary: #f472b6;

    /* Dark theme defaults (Gravity/anti-gravity style) */
    --bg-color: #111827;
    /* Midnight Charcoal */
    --card-bg: rgba(31, 41, 55, 0.7);
    --glass-bg: rgba(17, 24, 39, 0.85);
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --border: rgba(255, 255, 255, 0.05);
    --shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Respect system light / dark preference */
@media (prefers-color-scheme: light) {
    :root {
        --bg-color: #f4f4f5;
        --card-bg: rgba(255, 255, 255, 0.9);
        --glass-bg: rgba(255, 255, 255, 0.9);
        --text-main: #111827;
        --text-muted: #6b7280;
        --border: rgba(0, 0, 0, 0.06);
        --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    }

    .glass {
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
    }

    .bottom-nav {
        background: rgba(255, 255, 255, 0.92);
    }

    .voice-call-overlay {
        background: rgba(15, 23, 42, 0.96);
        color: #f9fafb;
    }
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.5;
    overflow-x: hidden;
    padding-bottom: 70px;
    /* Space for bottom nav */
}

/* Glassmorphism Effect */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

/* Layout */
.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 0 10px;
}

.header {
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 10px 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.header h1 {
    font-size: 1.5rem;
    font-weight: 800;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Feed Moments */
.moment-card {
    border-radius: 16px;
    padding: 16px;
    margin-bottom: 16px;
    transition: transform 0.2s;
}

.moment-card:active {
    transform: scale(0.98);
}

.user-info {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
}

.avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    margin-right: 12px;
    object-fit: cover;
    border: 2px solid white;
}

.user-meta h4 {
    font-size: 0.95rem;
    font-weight: 600;
}

.user-meta span {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.moment-content {
    font-size: 1rem;
    margin-bottom: 12px;
}

.moment-actions {
    display: flex;
    gap: 20px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* Bottom Navigation */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 65px;
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    border-top: 1px solid var(--border);
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.7rem;
    cursor: pointer;
    transition: color 0.3s;
}

.nav-item.active {
    color: var(--primary);
}

.nav-icon {
    font-size: 1.4rem;
    margin-bottom: 2px;
}

/* Discovery Page */
.match-card {
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    margin-top: 40px;
}

.match-avatar {
    width: 88px;
    height: 88px;
    border-radius: 50%;
    margin-bottom: 16px;
    border: 4px solid var(--primary);
}

.match-tags {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 12px 0;
}

.tag {
    padding: 4px 12px;
    border-radius: 20px;
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    font-size: 0.75rem;
    font-weight: 500;
}

button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    width: 100%;
}

button:active {
    opacity: 0.8;
}

/* Page Control */
.page {
    display: none;
    animation: fadeIn 0.3s ease;
    padding-top: 10px;
}

.page.active {
    display: block;
}

/* Forms */
.glass-input {
    width: 100%;
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.4);
    margin-bottom: 12px;
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.3s;
}

.glass-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(255, 255, 255, 0.7);
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Discover Page Extensions */
.discover-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.random-match-card {
    background: linear-gradient(135deg, #4338ca, #6366f1);
    color: #e2e8f0;
    padding: 30px;
    border-radius: 28px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    margin-bottom: 25px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(67, 56, 202, 0.2);
}

.random-match-card:active {
    transform: scale(0.97);
}

.random-match-card i {
    font-size: 2.2rem;
    margin-bottom: 8px;
    display: block;
}

.random-match-card h3 {
    font-size: 1.1rem;
    margin-bottom: 4px;
}

.random-match-card p {
    font-size: 0.8rem;
    opacity: 0.8;
}

.random-match-card button {
    border: none;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: filter 0.2s;
}

.random-match-card button:hover {
    filter: brightness(1.1);
}

.section-title {
    font-size: 1.1rem;
    font-weight: 700;
    margin: 10px 0 15px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.party-list {
    display: flex;
    gap: 15px;
    overflow-x: auto;
    padding-bottom: 15px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.party-list::-webkit-scrollbar {
    display: none;
}

.party-card {
    min-width: 160px;
    padding: 18px;
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.party-card h4 {
    font-size: 0.9rem;
    line-height: 1.3;
    margin: 0;
}

.party-card .stats {
    font-size: 0.8rem;
    opacity: 0.9;
    background: rgba(0, 0, 0, 0.1);
    padding: 4px 8px;
    border-radius: 8px;
    align-self: flex-start;
}

/* Talk Page specific */
#talk-page {
    /* Special page that might need 100% height minus header/nav */
    height: calc(100vh - 150px);
    display: none;
    flex-direction: column;
}

#talk-page.active {
    display: flex;
}

.voice-call-overlay-content {
    background: var(--card-bg);
    border-radius: 24px;
    border: 1px solid var(--border);
    overflow: hidden;
    flex: 1;
}

/* Speaker Grid Layout */
.call-chat-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    margin-top: 15px;
    overflow: hidden;
    display: none;
    /* Only show in expanded */
}

.expanded .call-chat-container {
    display: flex;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.chat-msg {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 85%;
}

.chat-msg.me {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.chat-bubble {
    padding: 10px 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
}

.chat-msg.me .chat-bubble {
    background: var(--primary);
}

.chat-input-area {
    padding: 15px;
    display: flex;
    gap: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.chat-input-area input {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 20px;
    padding: 10px 15px;
    color: var(--text-main);
    font-size: 0.9rem;
}

/* Speaker Grid Layout */
.voice-avatar-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    /* Reduced gap */
    position: relative;
    padding: 10px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 16px;
    transition: all 0.3s ease;
}

.voice-avatar {
    width: 64px;
    /* Slightly smaller base size */
    height: 64px;
    border-radius: 50%;
    border: 3px solid var(--primary);
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
    object-fit: cover;
}

.minimized .voice-avatar {
    width: 40px;
    height: 40px;
    border-width: 2px;
}

.minimized .voice-avatar-container {
    padding: 0;
    background: transparent;
    flex-direction: row;
}

.wave-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 30px;
    /* Compact wave height */
    margin-bottom: -5px;
}

.wave-bar {
    width: 4px;
    /* Thinner bars */
    height: 6px;
    background: var(--primary);
    border-radius: 2px;
    transition: height 0.05s ease;
}

.call-controls {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin-top: auto;
    /* Push to bottom */
    padding-top: 20px;
}

.control-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.15);
    transition: background 0.2s;
}

.control-btn:hover {
    background: rgba(255, 255, 255, 0.25);
}

.control-btn.end {
    background: #ef4444;
}

/* Listener Avatar */
.listener-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    opacity: 0.6;
    border: 1px solid rgba(255, 255, 255, 0.2);
}