:root[data-theme="dark"] {
    --bg-dark: #0f172a;
    --bg-darker: #020617;
    --glass-bg: rgba(30, 41, 59, 0.4);
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
    
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    
    --accent-primary: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.4);
    
    --color-correct: #10b981;
    --color-partial: #f59e0b;
    --color-wrong: #ef4444;
    
    --input-bg: rgba(15, 23, 42, 0.6);
    --circle-bg: rgba(30, 41, 59, 0.8);
}

:root[data-theme="light"] {
    --bg-dark: #f8fafc;
    --bg-darker: #f1f5f9;
    --glass-bg: rgba(255, 255, 255, 0.6);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    
    --text-main: #0f172a;
    --text-muted: #64748b;
    
    --accent-primary: #2563eb;
    --accent-glow: rgba(37, 99, 235, 0.2);
    
    --color-correct: #059669;
    --color-partial: #d97706;
    --color-wrong: #dc2626;
    
    --input-bg: rgba(255, 255, 255, 0.8);
    --circle-bg: #e2e8f0;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

body {
    background-color: var(--bg-darker);
    color: var(--text-main);
    min-height: 100vh;
    font-size: 14px;
}

/* Background Effects */
.background-effects {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: -1; pointer-events: none; overflow: hidden;
}

.glow {
    position: absolute; width: 400px; height: 400px;
    border-radius: 50%; filter: blur(80px); opacity: 0.1;
}

.glow-1 { top: -100px; left: -100px; background: var(--accent-primary); }
.glow-2 { bottom: -100px; right: -100px; background: var(--color-correct); }

/* Navbar */
.navbar {
    display: flex; justify-content: space-between; align-items: center;
    padding: 1rem 1.5rem; background: transparent;
}

.nav-brand {
    font-size: 1.25rem; font-weight: 700; display: flex; align-items: center; gap: 0.5rem;
}
.brand-icon { width: 20px; height: 20px; color: var(--accent-primary); }

.nav-controls { display: flex; gap: 0.75rem; align-items: center; }

.icon-btn {
    background: var(--input-bg); border: 1px solid var(--glass-border);
    color: var(--text-main); width: 36px; height: 36px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center; cursor: pointer;
}
.icon-btn i { width: 18px; height: 18px; }
.icon-btn:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

.control-group.mini select {
    background: transparent; border: none; color: var(--text-main); outline: none; font-size: 0.9rem; font-weight: 500; cursor: pointer;
}
.control-group.mini select option { background: var(--bg-dark); }

/* Main Container */
.container {
    max-width: 1000px; margin: 0 auto; padding: 1.5rem;
    display: flex; flex-direction: column; gap: 4rem;
}

/* Hero & Game Settings */
.hero-game { display: flex; flex-direction: column; gap: 2rem; align-items: center; }

.header { text-align: center; }
.header h1 {
    font-size: 3.5rem; font-weight: 800; letter-spacing: -1px;
    background: linear-gradient(135deg, var(--text-main), var(--text-muted));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 0.5rem;
}

.subtitle { color: var(--text-muted); font-size: 1.1rem; letter-spacing: 2px; margin-bottom: 1rem; }

.user-stats {
    display: flex; justify-content: center; gap: 1rem; font-size: 0.9rem; font-weight: 600; color: var(--accent-primary);
    background: var(--glass-bg); padding: 0.5rem 1.5rem; border-radius: 100px; display: inline-flex; border: 1px solid var(--glass-border);
}

.game-settings {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem;
    background: var(--glass-bg); padding: 0.6rem 1.2rem; border-radius: 100px;
    border: 1px solid var(--glass-border); backdrop-filter: blur(8px);
}

.setting-item {
    display: flex; align-items: center; gap: 0.4rem; padding: 0 0.5rem; border-right: 1px solid var(--glass-border);
}
.setting-item:last-child { border-right: none; }
.setting-item i { width: 18px; height: 18px; color: var(--text-muted); }

.setting-item select {
    background: transparent; border: none; color: var(--text-main); font-size: 0.95rem; font-weight: 500; outline: none; cursor: pointer;
}
.setting-item select option { background: var(--bg-dark); }

.game-status {
    display: flex; align-items: center; gap: 0.5rem; padding: 0 0.5rem; font-size: 0.95rem; font-weight: 600;
}
#guesses-left { color: var(--accent-primary); font-size: 1.2rem; }

/* Search Box */
.search-section { width: 100%; max-width: 650px; position: relative; z-index: 50; margin-bottom: 1.5rem; }

.search-box { width: 100%; position: relative; }
.search-icon { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); width: 22px; }

input[type="text"] {
    width: 100%; padding: 1.3rem 1.3rem 1.3rem 3.2rem; font-size: 1.2rem;
    background: var(--input-bg); border: 1px solid var(--glass-border);
    border-radius: 100px; color: var(--text-main); outline: none;
    box-shadow: var(--glass-shadow); backdrop-filter: blur(10px);
}
input[type="text"]:focus { border-color: var(--accent-primary); }

.autocomplete-items {
    position: absolute; top: calc(100% + 8px); left: 0; right: 0;
    background: var(--input-bg); border: 1px solid var(--glass-border);
    border-radius: 16px; max-height: 280px; overflow-y: auto; box-shadow: var(--glass-shadow); backdrop-filter: blur(16px);
}
.autocomplete-item {
    padding: 12px 18px; cursor: pointer; display: flex; align-items: center; gap: 14px; font-size: 1.1rem; font-weight: 500; border-bottom: 1px solid var(--glass-border);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--glass-bg); }

.auto-photo {
    width: 40px; height: 40px; border-radius: 50%; object-fit: cover; background-color: #ffffff; border: 2px solid #ffffff; padding: 2px;
}
.auto-flag { width: 20px; border-radius: 2px; }

/* Guesses Board (Circles) */
.guesses-header {
    display: flex; width: 100%; max-width: 800px; align-items: center; padding-bottom: 0.8rem; font-size: 0.85rem; font-weight: 700; color: var(--text-muted); text-align: center;
}
.guess-player-info { width: 160px; flex-shrink: 0; }
.guess-attributes { display: flex; flex: 1; justify-content: space-between; gap: 0.5rem; }
.attr-header { width: 64px; text-align: center; }

.guesses-container {
    width: 100%; max-width: 800px; display: flex; flex-direction: column; gap: 1.2rem;
}

.guess-row {
    display: flex; align-items: center; background: transparent;
}

.guess-player {
    width: 160px; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; flex-shrink: 0;
}
.guess-photo {
    width: 64px; height: 64px; border-radius: 50%; object-fit: cover; background-color: #ffffff; border: 3px solid #ffffff; padding: 2px;
}
.guess-name { font-size: 0.95rem; font-weight: 600; text-align: center; line-height: 1.3; }

.guess-circles {
    display: flex; flex: 1; justify-content: space-between; gap: 0.5rem;
}

.circle {
    width: 64px; height: 64px; border-radius: 50%;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    background: var(--circle-bg); border: 2px solid var(--glass-border);
    font-size: 0.95rem; font-weight: 700; position: relative;
    opacity: 0; animation: popIn 0.4s ease forwards;
}

.circle.correct { background: var(--color-correct); border-color: var(--color-correct); color: white; }
.circle.partial { background: var(--color-partial); border-color: var(--color-partial); color: white; }
.circle.wrong { background: var(--color-wrong); border-color: var(--color-wrong); color: white; }

.circle img.flag-img { width: 24px; border-radius: 2px; }
.circle img.club-logo { width: 34px; height: 34px; object-fit: contain; }
.circle .club-text { font-size: 0.7rem; text-align: center; line-height: 1; padding: 0 2px; }
.arrow { font-size: 0.8rem; opacity: 0.8; margin-top: -2px; }

/* Buttons */
.action-buttons {
    display: flex; gap: 1rem; justify-content: center; width: 100%; margin-top: 0.5rem;
}
.btn {
    padding: 0.6rem 1.2rem; border: none; border-radius: 100px; font-weight: 600; cursor: pointer; font-size: 0.9rem; display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
}
.btn.primary { background: var(--accent-primary); color: white; box-shadow: 0 4px 12px var(--accent-glow); }
.btn.primary:hover { transform: translateY(-1px); filter: brightness(1.1); }
.btn.secondary { background: var(--color-wrong); color: white; box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3); }
.btn.secondary:hover { transform: translateY(-1px); filter: brightness(1.1); }

#search-section { display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.search-box { width: 100%; position: relative; }

/* Info Section */
.info-card { padding: 2rem; border-radius: 20px; margin-top: 1rem; }
.info-header { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 1rem; color: var(--text-main); }
.info-header i { color: var(--accent-primary); width: 20px; }
.info-header h2 { font-size: 1.25rem; }
.info-card p { font-size: 0.9rem; color: var(--text-muted); margin-bottom: 1.5rem; line-height: 1.5; }

.rules-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }
.rule-item { display: flex; align-items: center; gap: 0.5rem; font-size: 0.85rem; font-weight: 500; }
.color-dot { width: 12px; height: 12px; border-radius: 50%; }
.color-dot.correct { background: var(--color-correct); }
.color-dot.partial { background: var(--color-partial); }
.color-dot.wrong { background: var(--color-wrong); }
.icon-hint { font-size: 1.1rem; display: inline-block; width: 16px; text-align: center; margin-right: 4px; }

/* Features Section */
.features-section { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; margin-top: 1rem; }
.feature-card { padding: 2rem; border-radius: 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.feature-icon { width: 40px; height: 40px; color: var(--accent-primary); }
.feature-card h3 { font-size: 1.1rem; color: var(--text-main); }
.feature-card p { font-size: 0.9rem; color: var(--text-muted); line-height: 1.5; }

/* Modal */
.modal {
    display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0, 0, 0, 0.7); z-index: 1000; justify-content: center; align-items: center; backdrop-filter: blur(4px);
}
.modal-content {
    background: var(--bg-dark); padding: 2rem; border-radius: 24px; border: 1px solid var(--glass-border);
    text-align: center; max-width: 320px; width: 90%; animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
#result-title { font-size: 1.5rem; margin-bottom: 1rem; }
.mystery-player-card { margin-bottom: 1.5rem; }
.photo-wrapper { width: 100px; height: 100px; margin: 0 auto 1rem; border-radius: 50%; padding: 4px; background: linear-gradient(135deg, var(--accent-primary), var(--color-correct)); }
.player-photo { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 4px solid #ffffff; background-color: #ffffff; padding: 3px; }
#mystery-name { font-size: 1.25rem; font-weight: 700; margin-bottom: 0.25rem; }
.mystery-details { display: flex; justify-content: center; align-items: center; gap: 0.5rem; font-size: 0.85rem; color: var(--text-muted); }
.mystery-details img { width: 16px; border-radius: 2px; }

footer { text-align: center; color: var(--text-muted); font-size: 0.8rem; padding-bottom: 2rem; }

@keyframes popIn {
    0% { transform: scale(0.8); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* Responsive fixes for circles */
@media (max-width: 600px) {
    .container { padding: 1.5rem 0; overflow-x: hidden; }
    .search-section, .hero-game > .header, .game-settings { padding: 0 1rem; }
    
    .guesses-container, .guesses-header {
        width: 100%; max-width: 100vw;
        overflow-x: auto;
        padding: 0 1rem;
    }
    
    .guess-row, .guesses-header {
        min-width: 480px; /* Forces scrolling instead of squishing */
    }

    .circle { width: 44px; height: 44px; font-size: 0.75rem; }
    .guess-photo { width: 44px; height: 44px; }
    .guess-player { width: 100px; }
    .guess-player-info { width: 100px; }
    .attr-header { width: 44px; font-size: 0.65rem; }
    .circle img.flag-img { width: 18px; }
    .circle img.club-logo { width: 24px; height: 24px; }
    .circle .club-text { font-size: 0.6rem; }
    .circle .arrow { margin-top: -2px; font-size: 0.7rem; }
}
