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

:root {
    --primary: #FF6B6B;
    --primary-dark: #E55555;
    --accent: #FF8E53;
    --bg: #121212;
    --bg-card: #1E1E1E;
    --bg-elevated: #2A2A2A;
    --text: #FFFFFF;
    --text-secondary: #A0A0A0;
    --text-muted: #666;
    --success: #4ECB71;
    --danger: #FF4458;
    --super: #2EBAFF;
    --radius: 16px;
    --radius-sm: 10px;
    --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

body {
    font-family: 'Inter', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    height: 100dvh;
    overflow: hidden;
    user-select: none;
}

.screen { display: none; height: 100dvh; flex-direction: column; }
.screen.active { display: flex; }

/* Welcome */
#WelcomeScreen {
    justify-content: center;
    align-items: center;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
}
.welcome-container { text-align: center; padding: 2rem; max-width: 400px; width: 100%; }
.logo-area { margin-bottom: 3rem; }
.logo-icon { font-size: 4rem; margin-bottom: 0.5rem; animation: pulse 2s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }
.welcome-container h1 {
    font-size: 2.5rem; font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.tagline { color: var(--text-secondary); margin-top: 0.5rem; font-size: 1.1rem; }
.welcome-form { display: flex; flex-direction: column; gap: 1rem; }
.welcome-form label { color: var(--text-secondary); font-size: 0.9rem; text-align: left; }
.welcome-form input {
    padding: 1rem; border-radius: var(--radius-sm); border: 1px solid #333;
    background: var(--bg-elevated); color: var(--text); font-size: 1rem;
    outline: none; transition: border-color 0.2s;
}
.welcome-form input:focus { border-color: var(--primary); }
#StartButton {
    padding: 1rem; border: none; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white; font-size: 1.1rem; font-weight: 600; cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}
#StartButton:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(255,107,107,0.4); }
.powered-by { margin-top: 2rem; color: var(--text-muted); font-size: 0.8rem; }
.powered-by a { color: var(--primary); text-decoration: none; }

/* Header */
header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 1rem 1.25rem; background: var(--bg-card);
    border-bottom: 1px solid #2a2a2a; min-height: 60px; flex-shrink: 0;
}
.header-left { display: flex; align-items: center; gap: 0.5rem; }
.logo-small { font-size: 1.5rem; }
.app-name { font-weight: 600; font-size: 1.1rem; }
.icon-btn {
    background: none; border: none; color: var(--text); font-size: 1.3rem;
    cursor: pointer; position: relative; padding: 0.5rem;
}
.badge {
    position: absolute; top: 0; right: -4px;
    background: var(--primary); color: white; font-size: 0.65rem;
    width: 18px; height: 18px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.badge.hidden { display: none; }

/* Card */
#CardStack {
    flex: 1; display: flex; align-items: center; justify-content: center;
    padding: 1rem; overflow: hidden; position: relative;
}
.profile-card {
    width: 100%; max-width: 380px; background: var(--bg-card);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
    transition: transform 0.4s ease, opacity 0.4s ease;
    position: relative;
}
.profile-card.swipe-left { transform: translateX(-150%) rotate(-20deg); opacity: 0; }
.profile-card.swipe-right { transform: translateX(150%) rotate(20deg); opacity: 0; }
.card-image {
    width: 100%; height: 380px; background: var(--bg-elevated);
    display: flex; align-items: center; justify-content: center;
    overflow: hidden; position: relative;
}
.card-image img { width: 100%; height: 100%; object-fit: cover; }
.loading-spinner {
    width: 40px; height: 40px; border: 3px solid #333;
    border-top-color: var(--primary); border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.card-info { padding: 1.25rem; }
.card-info h2 { font-size: 1.5rem; font-weight: 600; }
.card-info .age { color: var(--text-secondary); margin-top: 0.25rem; }
.card-info .bio { color: var(--text-secondary); margin-top: 0.75rem; font-size: 0.95rem; line-height: 1.4; }
.tags { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.tags .tag {
    padding: 0.3rem 0.75rem; border-radius: 20px; font-size: 0.8rem;
    background: var(--bg-elevated); color: var(--text-secondary);
}

/* Swipe Actions */
#SwipeActions {
    display: flex; justify-content: center; gap: 1.5rem;
    padding: 1.25rem; flex-shrink: 0;
}
.action-btn {
    width: 60px; height: 60px; border-radius: 50%; border: 2px solid;
    background: var(--bg-card); font-size: 1.5rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: transform 0.2s, background 0.2s;
}
.action-btn:hover { transform: scale(1.1); }
.action-btn.nope { border-color: var(--danger); color: var(--danger); }
.action-btn.nope:hover { background: var(--danger); color: white; }
.action-btn.like { border-color: var(--success); color: var(--success); }
.action-btn.like:hover { background: var(--success); color: white; }
.action-btn.super { border-color: var(--super); color: var(--super); width: 50px; height: 50px; font-size: 1.2rem; }
.action-btn.super:hover { background: var(--super); color: white; }

/* Match Popup */
.popup {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8);
    display: flex; align-items: center; justify-content: center;
    z-index: 100; animation: fadeIn 0.3s;
}
.popup.hidden { display: none; }
@keyframes fadeIn { from { opacity: 0; } }
.popup-content {
    background: var(--bg-card); border-radius: var(--radius);
    padding: 2rem; text-align: center; max-width: 340px; width: 90%;
}
.match-content h2 {
    font-size: 2rem; margin-bottom: 1rem;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.match-photos img {
    width: 120px; height: 120px; border-radius: 50%; object-fit: cover;
    border: 3px solid var(--primary); margin-bottom: 1rem;
}
#MatchText { color: var(--text-secondary); margin-bottom: 1.5rem; }
.btn-primary {
    display: block; width: 100%; padding: 0.9rem; border: none; border-radius: var(--radius-sm);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white; font-size: 1rem; font-weight: 600; cursor: pointer; margin-bottom: 0.75rem;
}
.btn-secondary {
    display: block; width: 100%; padding: 0.9rem; border: 1px solid #444;
    border-radius: var(--radius-sm); background: none; color: var(--text-secondary);
    font-size: 0.95rem; cursor: pointer;
}

/* Matches List */
.matches-list { flex: 1; overflow-y: auto; padding: 0.5rem; }
.match-item {
    display: flex; align-items: center; gap: 1rem; padding: 1rem;
    border-bottom: 1px solid #222; cursor: pointer; transition: background 0.2s;
}
.match-item:hover { background: var(--bg-elevated); }
.match-item img { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.match-item-info h4 { font-size: 1rem; font-weight: 500; }
.match-item-info p { color: var(--text-secondary); font-size: 0.85rem; margin-top: 0.2rem; }
.empty-state { flex: 1; display: flex; align-items: center; justify-content: center; color: var(--text-muted); }
.back-btn {
    background: none; border: none; color: var(--text); font-size: 1.1rem;
    cursor: pointer; padding: 0.5rem;
}

/* Chat */
#ChatHeader .chat-header-info { display: flex; align-items: center; gap: 0.75rem; }
.chat-avatar { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; }
#ChatHeader h3 { font-size: 1rem; font-weight: 600; }
.status { font-size: 0.75rem; color: var(--success); }
#ChatWindowMain {
    flex: 1; overflow-y: auto; padding: 1rem; display: flex;
    flex-direction: column; gap: 0.5rem;
}
.message {
    max-width: 80%; padding: 0.75rem 1rem; border-radius: 18px;
    font-size: 0.95rem; line-height: 1.4; animation: msgIn 0.3s ease;
}
@keyframes msgIn { from { opacity: 0; transform: translateY(10px); } }
.message.sent {
    align-self: flex-end; background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white; border-bottom-right-radius: 4px;
}
.message.received {
    align-self: flex-start; background: var(--bg-elevated);
    color: var(--text); border-bottom-left-radius: 4px;
}
.typing-indicator {
    padding: 0.5rem 1rem; display: flex; gap: 4px; align-self: flex-start;
}
.typing-indicator.hidden { display: none; }
.typing-indicator span {
    width: 8px; height: 8px; background: var(--text-muted); border-radius: 50%;
    animation: typing 1.4s infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); } }
.chat-input-area {
    display: flex; gap: 0.5rem; padding: 0.75rem 1rem;
    background: var(--bg-card); border-top: 1px solid #2a2a2a; flex-shrink: 0;
}
#MessageInput {
    flex: 1; padding: 0.75rem 1rem; border-radius: 24px; border: 1px solid #333;
    background: var(--bg-elevated); color: var(--text); font-size: 0.95rem; outline: none;
}
#MessageInput:focus { border-color: var(--primary); }
.send-btn {
    width: 44px; height: 44px; border-radius: 50%; border: none;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    color: white; font-size: 1.2rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}

/* Responsive */
@media (min-width: 500px) {
    .profile-card { max-width: 400px; }
    .card-image { height: 420px; }
}
