:root {
    --bg-color: #0f172a;
    --bg-secondary: #020617;
    --card-bg: #1e293b;
    --primary: #6366f1;
    --primary-gradient: linear-gradient(135deg, #6366f1 0%, #a855f7 100%);
    --accent: #ec4899;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --border-color: #334155;
    --shadow-soft: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
    --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
    --radius-lg: 1rem;
    --radius-md: 0.75rem;
    --radius-full: 9999px;
    --font-main: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-main);
    font-family: var(--font-main);
    line-height: 1.5;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* App-like feel */
}

/* Header */
.app-header {
    padding: 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(15, 23, 42, 0.8);
    backdrop-filter: blur(10px);
    z-index: 10;
    border-bottom: 1px solid var(--border-color);
}

.logo {
    font-weight: 700;
    font-size: 1.25rem;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.025em;
}

.location-indicator {
    font-size: 0.875rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Main Container */
main {
    flex: 1;
    position: relative;
    overflow-y: auto;
    padding-bottom: 5rem;
    /* Space for nav */
}

.view {
    padding: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.view.hidden {
    display: none;
}

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

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

/* Compare View - Split Screen */
.compare-container {
    display: flex;
    flex-direction: column;
    /* Fixed position to fill main area minus nav */
    position: fixed;
    top: 4rem;
    /* Below Header */
    left: 0;
    right: 0;
    bottom: 5rem;
    /* Above Bottom Nav */
    padding: 0;
    gap: 0;
    z-index: 5;
}

.compare-card {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background-size: cover;
    background-position: center;
    background-color: var(--card-bg);
    overflow: hidden;
    border: 2px solid rgba(15, 23, 42, 1);
    /* Dark border for Cards */
    border-radius: 0;
    margin: 0;
    transition: filter 0.2s;
}

.compare-card:active {
    filter: brightness(0.8);
    transform: none;
    /* Disable scale effect for split view */
}

/* Gradient Overlay for text readability */
.compare-card::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.7));
    z-index: 1;
}

.card-content {
    position: relative;
    z-index: 2;
    padding: 1rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    width: 100%;
}

.compare-card h2 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
    color: white;
    font-weight: 700;
}

.compare-card p {
    color: rgba(255, 255, 255, 0.9);
    font-size: 1rem;
}

/* Center Badge Interaction Area */
.vs-badge-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    pointer-events: auto;

    /* Original Theme Style: White/Light box with dark border */
    background: rgba(255, 255, 255, 0.95);
    color: #0f172a;
    padding: 0.75rem 1.5rem;
    /* Reduced padding */
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    border: 4px solid #0f172a;
    /* Dark border from original design */

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    /* Reduced gap */
    /* More spacing */
    max-width: 90%;
    width: max-content;
}

.vs-question-text {
    font-size: 1rem;
    /* Reduced font size from 1.25rem */
    font-weight: 700;
    color: #0f172a;
    text-align: center;
    line-height: 1.3;
    font-family: var(--font-main);
}

.vs-action-row {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    width: 100%;
    justify-content: center;
}

.vs-divider-small {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: #475569;
    /* Muted text color */
    font-size: 0.9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.vs-divider-small i {
    font-size: 1.1rem;
}

/* Reusing 'btn-skip-blue' class but with theme styling */
.btn-skip-blue {
    background: var(--bg-secondary);
    /* Dark background */
    color: white;
    border: 1px solid var(--border-color);
    padding: 0.75rem 1.5rem;
    font-size: 0.9rem;
    border-radius: 99px;
    /* Rounded pills like other UI elements */
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    white-space: nowrap;
    font-family: var(--font-main);
}

.btn-skip-blue:hover {
    background: var(--primary);
    /* Hover to primary brand color */
    border-color: var(--primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.btn-skip-blue:active {
    transform: scale(0.98);
}

/* Hide Old Elements */
.skip-container,
.vs-question,
.vs-divider,
.btn-skip-center {
    display: none;
}


/* Rankings View */
#view-rankings h1 {
    margin-bottom: 1rem;
    font-size: 1.75rem;
    text-align: center;
    /* Optional: Center title too? User didn't ask, but looks better. Let's keep it left if standard. */
}

/* Map Wrapper: Limit width on desktop */
.map-wrapper {
    position: relative;
    width: 100%;
    max-width: 1024px;
    margin: 0 0 1rem 0;
    /* Align Left */
}

.filters {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    /* Firefox */
}

.filters::-webkit-scrollbar {
    display: none;
    /* Chrome/Safari */
}

.filter-pill {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    color: var(--text-muted);
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-family: inherit;
    font-size: 0.875rem;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
}

.filter-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.label-pill-small {
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    cursor: pointer;
    transition: background 0.2s;
}

.label-pill-small:hover {
    background: var(--primary);
    border-color: var(--primary);
}

/* Labels Overlay (Top Left) */
.card-labels-overlay {
    position: absolute;
    top: 2rem;
    left: 1rem;
    z-index: 10;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    max-width: 70%;
    pointer-events: auto;
}

/* Push bottom labels down to separate from VS Badge */
.labels-bottom {
    top: 5rem;
}



.ranking-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--card-bg);
    padding: 0.5rem;
    border-radius: var(--radius-md);
    margin-bottom: 0.75rem;
    border: 1px solid transparent;
    transition: transform 0.1s;
}

.ranking-item:active {
    transform: scale(0.99);
}

.rank-number {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--text-muted);
    width: 2rem;
    text-align: center;
}

.rank-number.top-3 {
    /* Fallback/Base */
    font-weight: 800;
}

.ranking-item.rank-1 {
    border-color: rgba(245, 158, 11, 0.5);
    background: linear-gradient(to right, rgba(245, 158, 11, 0.1), var(--card-bg));
    padding: 0.75rem;
    /* Increased height */
}

.ranking-item.rank-1 .rank-number {
    background: linear-gradient(135deg, #fcd34d 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
    font-size: 1.5rem;
    /* Larger number */
}

.ranking-item.rank-2 {
    border-color: rgba(148, 163, 184, 0.5);
    background: linear-gradient(to right, rgba(148, 163, 184, 0.1), var(--card-bg));
    padding: 0.75rem;
    /* Increased height */
}

.ranking-item.rank-2 .rank-number {
    background: linear-gradient(135deg, #e2e8f0 0%, #94a3b8 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.35rem;
}

.ranking-item.rank-3 {
    border-color: rgba(217, 119, 6, 0.5);
    background: linear-gradient(to right, rgba(217, 119, 6, 0.1), var(--card-bg));
    padding: 0.75rem;
    /* Increased height */
}

.ranking-item.rank-3 .rank-number {
    background: linear-gradient(135deg, #fbbf24 0%, #d97706 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: 1.35rem;
}

.rank-info {
    flex: 1;
}

.rank-name {
    font-weight: 600;
    font-size: 1.125rem;
}

.rank-meta {
    font-size: 0.875rem;
    color: var(--text-muted);
    display: flex;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.elo-badge {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary);
    padding: 0.125rem 0.375rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
}

.rank-image {
    width: 80px;
    height: 80px;
    border-radius: var(--radius-md);
    background-size: cover;
    background-position: center;
    background-color: var(--border-color);
    flex-shrink: 0;
}

/* Profile View */
.btn-back {
    background: none;
    border: none;
    color: var(--text-main);
    font-family: inherit;
    font-size: 1rem;
    cursor: pointer;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.profile-header {
    margin-bottom: 2rem;
}

.profile-carousel {
    display: flex;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    gap: 10px;
    min-height: 250px;
    height: auto;
    margin-bottom: 1.5rem;
    margin-left: -1.5rem;
    /* Break out of padding */
    margin-right: -1.5rem;
    padding-left: 1.5rem;
    /* Add padding back to content start */
    padding-right: 1.5rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.profile-carousel::-webkit-scrollbar {
    display: none;
}

.profile-carousel-item {
    flex: 0 0 280px;
    scroll-snap-align: center;
    background-size: cover;
    background-position: center;
    border-radius: var(--radius-md);
    background-color: var(--card-bg);
}

.profile-stat-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 2rem;
}

.stat-card {
    background: var(--card-bg);
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
    border: 1px solid var(--border-color);
}

.stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    display: block;
}

.stat-label {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Bottom Nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background: rgba(30, 41, 59, 0.9);
    backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-around;
    padding: 0.75rem;
    z-index: 20;
}

/* Bottom Nav Button */
.nav-action-btn {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
    background: var(--primary-gradient);
    color: white;
    border: none;
    padding: 1rem;
    border-radius: var(--radius-full);
    font-size: 1.125rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(99, 102, 241, 0.4);
    transition: transform 0.2s, box-shadow 0.2s;
    font-family: var(--font-main);
    letter-spacing: 0.025em;
    text-transform: uppercase;
}

.nav-action-btn:active {
    transform: scale(0.98);
}

/* Loader */
.loader {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 100;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 1rem;
    backdrop-filter: blur(4px);
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: var(--bg-dark);
    width: 100%;
    max-width: 500px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    max-height: 80vh;
}

.modal-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 1.25rem;
    margin: 0;
}

.modal-body {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.search-bar {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.search-bar input {
    flex: 1;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    padding: 0.75rem;
    border-radius: var(--radius-md);
    color: white;
    font-family: inherit;
}

.btn-primary {
    background: var(--primary);
    border: none;
    color: white;
    padding: 0 1rem;
    border-radius: var(--radius-md);
    cursor: pointer;
}

.btn-icon {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
}

.search-results {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.search-result-item {
    background: var(--card-bg);
    padding: 0.75rem;
    border-radius: 4px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: background 0.2s;
}

.search-result-item:hover {
    border-color: var(--primary);
    background: rgba(99, 102, 241, 0.1);
}

.search-result-name {
    font-weight: 600;
    display: block;
}

.search-result-address {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Inline Edit Icon */
.edit-icon {
    display: inline-block;
    font-size: 0.8em;
    /* Slightly smaller than text */
    margin-left: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: color 0.2s, transform 0.2s;
    vertical-align: middle;
    pointer-events: auto;
    /* Ensure it captures clicks */
    padding: 0.25rem;
    /* increase clickable area */
}

.edit-icon:hover {
    color: var(--primary);
    transform: scale(1.1);
}

/* Header Help Button */
.btn-header-help {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: var(--text-muted);
    padding: 0.35rem 0.75rem;
    border-radius: 99px;
    font-size: 0.85rem;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.2s;
}

.btn-header-help:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.btn-header-help i {
    color: var(--primary);
    transition: color 0.2s;
}

.btn-header-help:hover i {
    color: white;
}

/* Review Summary Styles */
.review-summary-section {
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
}

.review-summary-section h3 {
    margin-bottom: 1rem;
    font-size: 1.25rem;
    color: var(--text-main);
}

/* Reusing .profile-carousel for layout */

.summary-category {
    /* Styles for the content inside the carousel item */
    padding: 1rem;
    height: 100%;
    /* Fill the carousel item */
    box-sizing: border-box;
}

.summary-category h4 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-main);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
}

.summary-points {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.summary-point {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.9rem;
    line-height: 1.4;
}

.summary-point.positive {
    color: #10b981;
    /* Green */
}

.summary-point.positive span {
    color: var(--text-main);
}

.summary-point.negative {
    color: #ef4444;
    /* Red */
}

.summary-point.negative span {
    color: var(--text-main);
}

.summary-point i {
    margin-top: 3px;
    /* Align icon with first line of text */
    flex-shrink: 0;
}