: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;
    -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 "VS" or Question */
.vs-badge {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 10;
    background: rgba(255, 255, 255, 0.95);
    color: #0f172a;
    padding: 1rem 2rem;
    border-radius: 4px;
    /* Square/Boxy look from image? Or Keep rounded? User said "Welches ... ist besser" overlay */
    font-size: 1.125rem;
    font-weight: 700;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
    text-align: center;
    min-width: 200px;
    border: 5px solid rgba(15, 23, 42);
    /* Dark border for Question */
    pointer-events: none;
    /* Let clicks pass through if needed, but usually it's in dead space */
}

.skip-container {
    position: absolute;
    bottom: 80px;
    /* Above nav */
    left: 0;
    width: 100%;
    z-index: 5;
    pointer-events: none;
}

.btn-text {
    pointer-events: auto;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    color: white;
    text-decoration: none;
    backdrop-filter: blur(4px);
}


/* Rankings View */
#view-rankings h1 {
    margin-bottom: 1rem;
    font-size: 1.75rem;
}

.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);
}

.ranking-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--card-bg);
    padding: 1rem;
    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 {
    color: var(--accent);
    /* Pink for top 3? Or Gold? */
    background: linear-gradient(135deg, #fcd34d 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.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;
}

/* 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-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;
}

.nav-item {
    background: none;
    border: none;
    color: var(--text-muted);
    font-family: inherit;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: color 0.2s;
    width: 4rem;
}

.nav-item i {
    font-size: 1.25rem;
    margin-bottom: 2px;
}

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

/* 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);
}

/* Select Contender Button */
.btn-select-contender {
    position: absolute;
    top: 1rem;
    right: 1rem;
    z-index: 20;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    backdrop-filter: blur(4px);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-select-contender:hover {
    background: var(--primary);
    border-color: var(--primary);
}