:root { 
    --bg-dark: #07070a; 
    --bg-panel: rgba(18, 18, 24, 0.75); 
    --bg-panel-hover: rgba(28, 28, 38, 0.9); 
    --accent-gold: #d4af37; 
    --accent-gold-dim: rgba(212, 175, 55, 0.5); 
    --accent-red: #8b0000; 
    --text-main: #f0f0f5; 
    --text-muted: #8e8e9f; 
    --border-subtle: rgba(255, 255, 255, 0.06); 
    --font-title: 'Playfair Display', serif; 
    --font-body: 'Inter', sans-serif; 
} 

* { box-sizing: border-box; } 

body { 
    margin: 0; padding: 0; 
    background: radial-gradient(circle at 50% 40%, #151520 0%, var(--bg-dark) 100%); 
    color: var(--text-main); font-family: var(--font-body); 
    height: 100vh; overflow: hidden; 
    display: flex; justify-content: center; align-items: center; 
} 

#noise-overlay { 
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; 
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E"); 
    opacity: 0.03; pointer-events: none; z-index: 9999; 
} 

#app { 
    width: 95%; max-width: 1400px; height: 90vh; 
    position: relative; display: flex; flex-direction: column; 
    animation: fadeIn 1.5s ease; 
} 

.glass-panel { 
    background: var(--bg-panel); 
    backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); 
    border: 1px solid rgba(255, 255, 255, 0.08); 
    border-radius: 24px; /* Curved Edges */
    padding: 24px; box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6); 
} 

h1, h2, h3, h4 { font-family: var(--font-title); font-weight: 600; margin: 0; } 

/* --- PREMIUM HEADER CLUSTER --- */
.user-header-container {
    position: absolute; top: 20px; right: 20px; z-index: 1010;
}

.header-pill-cluster {
    display: flex; align-items: center; gap: 14px; padding: 6px 16px;
    background: rgba(0, 0, 0, 0.45); border-radius: 50px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}

.identity-section {
    display: flex; align-items: center; gap: 12px;
    padding-right: 14px; border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.user-avatar { width: 34px; height: 34px; border-radius: 50%; border: 1.5px solid var(--accent-gold); object-fit: cover; }

.identity-text { display: flex; flex-direction: column; line-height: 1.1; justify-content: center; }
.detective-name { 
    font-family: var(--font-title); font-size: 0.85rem; font-weight: 700; 
    color: white; letter-spacing: 0.3px; margin: 0;
}
.detective-score { 
    font-family: 'JetBrains Mono', monospace; font-size: 0.65rem; 
    font-weight: 700; color: var(--accent-gold); margin: 0;
}

.stat-pills-inner { display: flex; gap: 6px; align-items: center; }

.compact-pill {
    padding: 2.5px 12px; border-radius: 20px; font-size: 10px;
    font-weight: 800; font-family: var(--font-body); letter-spacing: 0.5px;
    text-transform: uppercase; white-space: nowrap;
}

.version-pill { background: #000; color: var(--accent-gold); border: 1px solid rgba(212, 175, 55, 0.2); font-family: 'JetBrains Mono', monospace; }
.difficulty-pill { border: 1px solid rgba(255, 255, 255, 0.1); background: #1e293b; color: #94a3b8; }
.difficulty-pill.easy { background: #064e3b; color: #6ee7b7; }
.difficulty-pill.medium { background: #1e3a8a; color: #93c5fd; }
.difficulty-pill.hard { background: #312e81; color: #c7d2fe; }

.streak-pill { background: #431407; color: #ff9d00; border: 1px solid rgba(255, 157, 0, 0.2); }
.accusation-pill { background: #450a0a; color: #f87171; border: 1px solid rgba(248, 113, 113, 0.2); }

.sign-out-link {
    background: transparent; border: none; color: #ef4444; font-size: 11px;
    font-weight: 700; cursor: pointer; padding: 0 4px; transition: opacity 0.2s;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.sign-out-link:hover { opacity: 0.7; text-decoration: underline; }

/* Bonus Summary */ 
.bonus-summary { 
    background: rgba(0, 0, 0, 0.3); padding: 20px; 
    border-radius: 12px; border: 1px solid var(--border-subtle); 
    margin: 20px 0; width: 100%; max-width: 400px; 
} 
.bonus-row { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--text-muted); font-family: var(--font-body); } 
.bonus-row .pts { color: #4ade80; font-weight: bold; } 
.total-mystery-score { margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--border-subtle); font-size: 1.2rem; color: var(--accent-gold); font-family: var(--font-title); text-align: right; } 

/* --- Custom Modal --- */
.custom-modal-overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh;
    background: rgba(0,0,0,0.8); backdrop-filter: blur(8px);
    display: flex; justify-content: center; align-items: center;
    z-index: 10000;
}

.custom-modal {
    max-width: 500px; width: 90%;
    text-align: center;
    border: 1px solid var(--accent-gold-dim) !important;
}

.custom-modal h2 { color: var(--accent-gold); margin-bottom: 15px; }
.custom-modal p { color: var(--text-main); line-height: 1.6; margin-bottom: 25px; }

/* --- Start Screen --- */ 
.start-screen { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; text-align: center; } 
.start-screen h1 { font-size: 5rem; letter-spacing: 0.05em; color: var(--accent-gold); text-shadow: 0 4px 20px var(--accent-gold-dim); margin-bottom: 20px; } 
.start-screen p { font-size: 1.2rem; color: var(--text-muted); max-width: 600px; line-height: 1.6; margin-bottom: 40px; } 

.primary-btn { 
    background: transparent; color: var(--accent-gold); border: 1px solid var(--accent-gold); 
    padding: 14px 40px; font-size: 1.1rem; font-family: var(--font-body); 
    text-transform: uppercase; letter-spacing: 2px; cursor: pointer; 
    border-radius: 12px; transition: all 0.3s ease; 
    display: flex; align-items: center; gap: 10px; 
} 
.primary-btn:hover { background: var(--accent-gold); color: var(--bg-dark); box-shadow: 0 0 20px var(--accent-gold-dim); } 
.primary-btn:disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; } 

/* --- Game Layout --- */ 
.game-layout { display: grid; grid-template-columns: 280px 1fr 380px; gap: 24px; height: 100%; padding-top: 60px; /* space for header */ } 
.column { display: flex; flex-direction: column; height: 100%; min-height: 0; } 
.column-header { padding: 20px; border-bottom: 1px solid var(--border-subtle); font-size: 1.2rem; color: var(--accent-gold); letter-spacing: 1px; } 

/* Suspects List */ 
.suspect-list { padding: 16px; overflow-y: auto; flex: 1; } 
.suspect-card { 
    display: flex; align-items: center; gap: 12px; 
    padding: 12px 16px; border-radius: 16px; cursor: pointer; 
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); border: 1px solid transparent; margin-bottom: 12px; 
} 
.suspect-card:hover { background: rgba(255, 255, 255, 0.05); transform: scale(1.02); border-color: rgba(255, 255, 255, 0.1); box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3); } 
.suspect-card.active { background: rgba(212, 175, 55, 0.08); border-color: var(--accent-gold-dim); transform: scale(1.02); } 
.suspect-card h3 { font-size: 1.2rem; margin-bottom: 4px; } 
.suspect-card p { font-size: 0.85rem; color: var(--text-muted); margin: 0; } 
.card-avatar { background: rgba(255, 255, 255, 0.05); width: 75px; height: 75px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.1); background-size: cover; background-position: center; flex-shrink: 0; } 

/* Shop UI */ 
.shop-panel { display: flex; flex-direction: column; gap: 12px; background: rgba(0, 0, 0, 0.4); padding: 16px; border-bottom: 1px solid var(--border-subtle); align-items: center; border-radius: 16px; margin-bottom: 10px; } 
.shop-row { display: flex; gap: 10px; justify-content: center; width: 100%; } 
.powerup-btn { background: rgba(40, 40, 60, 0.6); border: 1px solid var(--border-subtle); color: var(--text-main); padding: 8px 12px; border-radius: 8px; cursor: pointer; font-family: var(--font-body); transition: all 0.2s; flex: 1; font-size: 0.85rem; } 
.powerup-btn.active { background: var(--accent-gold); color: var(--bg-dark); font-weight: bold; box-shadow: 0 0 15px var(--accent-gold-dim); } 
.powerup-btn:hover:not(:disabled) { background: var(--bg-panel-hover); border-color: var(--accent-gold); } 
.powerup-btn:disabled { opacity: 0.3; cursor: not-allowed; } 

/* Interrogation Area */ 
.interrogation-area { padding: 30px; display: flex; flex-direction: column; flex: 1; overflow-y: auto; } 
.suspect-profile { margin-bottom: 30px; padding-bottom: 20px; border-bottom: 1px solid var(--border-subtle); display: flex; justify-content: space-between; align-items: flex-start; } 
.profile-header { display: flex; gap: 20px; align-items: center; } 
.profile-avatar { background: rgba(255, 255, 255, 0.05); width: 160px; height: 160px; border-radius: 50%; border: 3px solid var(--accent-gold); box-shadow: 0 0 35px var(--accent-gold-dim); background-size: cover; background-position: center; flex-shrink: 0; } 
.suspect-profile .info h2 { font-size: 2.2rem; color: var(--accent-gold); margin-bottom: 8px; } 
.suspect-profile .info p { color: var(--text-muted); font-size: 1.1rem; max-width: 400px; } 
.questions-container { display: flex; flex-direction: column; gap: 12px; } 
.question-btn { background: rgba(0, 0, 0, 0.3); border: 1px solid var(--border-subtle); color: var(--text-main); padding: 16px 20px; text-align: left; font-family: var(--font-body); font-size: 1rem; border-radius: 12px; cursor: pointer; transition: all 0.2s ease; } 
.question-btn:hover:not(:disabled) { background: var(--bg-panel-hover); border-color: rgba(255, 255, 255, 0.2); transform: translateX(4px); } 
.question-btn:disabled { opacity: 0.4; cursor: not-allowed; background: rgba(0, 0, 0, 0.5); } 
.accuse-btn { background: rgba(139, 0, 0, 0.2); color: #ff6b6b; border: 1px solid #ff6b6b; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-family: var(--font-body); text-transform: uppercase; letter-spacing: 1px; transition: all 0.2s; } 
.accuse-btn:hover { background: #ff6b6b; color: #fff; box-shadow: 0 0 15px rgba(255, 107, 107, 0.5); } 

/* Detective Notebook */ 
.notebook { flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding-right: 10px; overscroll-behavior: contain; }
.log-entry { background: rgba(0, 0, 0, 0.4); padding: 14px; border-radius: 12px; border: 1px solid transparent; animation: slideIn 0.4s ease; margin-bottom: 8px; flex-shrink: 0; } 
.log-entry.system { border: none; color: #94a3b8; font-style: italic; text-align: center; background: transparent; } 
.log-character { color: var(--accent-gold); font-weight: bold; margin-bottom: 4px; display: block; font-size: 0.85rem; } 
.log-q { color: var(--text-muted); margin-bottom: 4px; font-size: 0.85rem; } 
.log-a { color: var(--text-main); font-size: 0.95rem; font-family: 'JetBrains Mono', monospace; line-height: 1.5; border-left: 2px solid var(--accent-gold-dim); padding-left: 10px; margin-top: 5px; max-height: 250px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; padding-right: 12px; } 

.thinking-text { color: var(--accent-gold); font-style: italic; opacity: 0.7; animation: pulse-opacity 1s infinite alternate; }
@keyframes pulse-opacity { from { opacity: 0.3; } to { opacity: 0.8; } }

.fade-in { animation: smoothFadeIn 0.5s cubic-bezier(0.4, 0, 0.2, 1) forwards; } 
@keyframes smoothFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } } 
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } } 
::-webkit-scrollbar { width: 6px; } ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 10px; }

/* Leaderboard Modal */
.leaderboard-modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, 0.85); display: flex; align-items: center; justify-content: center; z-index: 1000; backdrop-filter: blur(8px); }
.leaderboard-content { width: 95%; max-width: 850px; padding: 40px; border-radius: 24px; text-align: left; background: linear-gradient(135deg, rgba(20,20,30,0.95), rgba(10,10,15,0.95)); border: 1px solid var(--accent-gold-dim); box-shadow: 0 0 50px rgba(0,0,0,0.8); }

.lb-header-row { display: flex; align-items: center; padding: 0 20px 10px 20px; border-bottom: 2px solid rgba(255,255,255,0.1); margin-bottom: 15px; font-family: 'Inter', sans-serif; text-transform: uppercase; font-size: 0.85rem; color: var(--text-muted); letter-spacing: 2px; }
.lb-rank-header { width: 80px; }
.lb-detective-header { flex-grow: 1; padding-left: 10px; }
.lb-stats-header { text-align: right; width: 220px; }

#leaderboard-list { display: flex; flex-direction: column; gap: 12px; max-height: 55vh; overflow-y: auto; padding-right: 15px; }

.leaderboard-row { display: flex; align-items: center; padding: 14px 20px; background: rgba(255, 255, 255, 0.02); border: 1px solid rgba(255,255,255,0.05); border-radius: 16px; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); font-family: 'Inter', sans-serif; }
.leaderboard-row:hover { background: rgba(255, 255, 255, 0.05); transform: translateX(5px) scale(1.01); border-color: rgba(255, 255, 255, 0.2); box-shadow: 0 4px 20px rgba(0,0,0,0.3); }

/* Tier Highlights */
.gold-tier { background: linear-gradient(90deg, rgba(255,215,0,0.1) 0%, rgba(255,255,255,0.02) 100%); border-left: 4px solid #ffd700; }
.silver-tier { background: linear-gradient(90deg, rgba(192,192,192,0.1) 0%, rgba(255,255,255,0.02) 100%); border-left: 4px solid #c0c0c0; }
.bronze-tier { background: linear-gradient(90deg, rgba(205,127,50,0.1) 0%, rgba(255,255,255,0.02) 100%); border-left: 4px solid #cd7f32; }

.lb-rank { font-weight: 700; font-family: 'JetBrains Mono', monospace; font-size: 1.3rem; color: rgba(255,255,255,0.4); width: 80px; }
.gold-tier .lb-rank { color: #ffd700; font-size: 1.8rem; text-shadow: 0 0 15px rgba(255, 215, 0, 0.6); }
.silver-tier .lb-rank { color: #c0c0c0; font-size: 1.6rem; }
.bronze-tier .lb-rank { color: #cd7f32; font-size: 1.5rem; }

.lb-identity { display: flex; align-items: center; gap: 20px; flex-grow: 1; }
.lb-avatar-wrapper { width: 56px; height: 56px; border-radius: 50%; padding: 3px; background: linear-gradient(135deg, var(--accent-gold), transparent); flex-shrink: 0; }
.lb-avatar { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; overflow: hidden; background-color: #000; }
.lb-name { font-weight: 600; font-size: 1.25rem; color: #f8fafc; letter-spacing: 0.5px; }

.lb-stats { display: flex; align-items: center; justify-content: flex-end; gap: 25px; width: 220px; flex-shrink: 0; text-align: right; }
.lb-score { font-weight: 700; font-family: 'JetBrains Mono', monospace; color: var(--accent-gold); font-size: 1.4rem; min-width: 100px; }
.lb-streak { font-family: 'JetBrains Mono', monospace; font-size: 0.95rem; color: #ff9b43; background: rgba(255, 155, 67, 0.15); border: 1px solid rgba(255, 155, 67, 0.3); padding: 6px 12px; border-radius: 8px; font-weight: 600; white-space: nowrap; }

/* Global Nav & Settings */
.global-nav-container {
    position: absolute; top: 20px; left: 20px; z-index: 1000;
}
.global-nav-links { display: flex; gap: 12px; align-items: center; }

.leaderboard-btn { 
    background: transparent !important; 
    border: 1.5px solid var(--accent-gold) !important; 
    color: var(--accent-gold) !important;
    padding: 8px 20px !important;
    font-size: 0.81rem !important;
    font-weight: 800 !important;
    letter-spacing: 1px !important;
    border-radius: 50px !important;
}
.leaderboard-btn:hover { background: rgba(212, 175, 55, 0.1) !important; transform: scale(1.02); }

.settings-gear-btn {
    width: 38px; height: 38px; border-radius: 50%;
    background: rgba(0,0,0,0.5); border: 1px solid rgba(255,255,255,0.1);
    color: white; cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: all 0.3s; backdrop-filter: blur(10px);
}
.settings-gear-btn:hover { background: var(--accent-gold); color: black; transform: rotate(45deg); }

/* Settings Modal */
.settings-modal {
    width: 95%; max-width: 450px; padding: 40px !important; text-align: left;
}
.settings-group { margin-bottom: 25px; }
.settings-group label { display: block; color: var(--text-muted); font-size: 0.8rem; text-transform: uppercase; margin-bottom: 12px; letter-spacing: 1px; font-weight: 700; }

.toggle-btn, .pill-btn {
    background: rgba(255,255,255,0.05); border: 1px solid var(--border-subtle);
    color: white; padding: 10px 20px; border-radius: 12px; cursor: pointer;
    font-size: 0.9rem; font-weight: bold; transition: all 0.2s;
}
.toggle-btn.active, .pill-btn.active {
    background: var(--accent-gold); color: black; border-color: var(--accent-gold);
    box-shadow: 0 0 15px rgba(212, 175, 55, 0.4);
}
.pill-selector { display: flex; gap: 10px; flex-wrap: wrap; }

/* Custom Range Input */
input[type="range"] {
    appearance: none; -webkit-appearance: none; width: 100%; background: transparent;
}
input[type="range"]::-webkit-slider-runnable-track {
    width: 100%; height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px;
}
input[type="range"]::-webkit-slider-thumb {
    appearance: none; -webkit-appearance: none; height: 18px; width: 18px; border-radius: 50%;
    background: var(--accent-gold); cursor: pointer; margin-top: -6px;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

/* --- ELEGANT LIGHT MODE (PARCHMENT) --- */
body.light-mode {
    --bg-dark: #fbf9f4; /* Warm Parchment */
    --bg-panel: rgba(255, 255, 255, 0.7);
    --bg-panel-hover: rgba(252, 250, 245, 0.9);
    --text-main: #2c2c34;
    --text-muted: #5a5a66;
    --border-subtle: rgba(0, 0, 0, 0.1);
}

body.light-mode {
    background: radial-gradient(circle at 50% 40%, #ffffff 0%, #fbf9f4 100%);
}

body.light-mode .glass-panel { 
    box-shadow: 0 12px 40px rgba(0,0,0,0.08); 
    border: 1.5px solid rgba(0,0,0,0.06);
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
}

body.light-mode .header-pill-cluster { 
    background: rgba(255, 255, 255, 0.9); 
    border-color: rgba(0,0,0,0.08); 
    box-shadow: 0 4px 20px rgba(0,0,0,0.06);
}

body.light-mode .detective-name { color: #1a1a24; }
body.light-mode .identity-section { border-color: rgba(0,0,0,0.08); }
body.light-mode .settings-gear-btn { background: white; color: #1a1a24; border-color: rgba(0,0,0,0.1); }
body.light-mode .compact-pill.version-pill { background: #e2e8f0; color: #1e293b; border-color: #cbd5e1; }

body.light-mode .primary-btn { 
    background: #1a1a24; color: white; 
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    border: none;
}
body.light-mode .primary-btn:hover { background: #34343d; transform: translateY(-2px); color: white; }

body.light-mode .toggle-btn, body.light-mode .pill-btn {
    background: #f1f5f9; color: #334155; border-color: #cbd5e1;
}
body.light-mode .toggle-btn.active, body.light-mode .pill-btn.active {
    background: var(--accent-gold); color: black; border-color: var(--accent-gold);
}

body.light-mode .question-btn { background: rgba(255, 255, 255, 0.6); border-color: rgba(0,0,0,0.08); color: #2c2c34; }
body.light-mode .question-btn:hover:not(:disabled) { background: white; border-color: var(--accent-gold); }

/* Text Size Scalability */
body { font-size: 16px; transition: font-size 0.3s; }
.text-small { font-size: 14px !important; }
.text-small h1 { font-size: 2rem !important; }
.text-small .suspect-card h3 { font-size: 1.1rem !important; }
.text-medium { font-size: 16px !important; }
.text-large { font-size: 18px !important; }
.text-large h1 { font-size: 3.5rem !important; }
.text-large .suspect-card h3 { font-size: 1.6rem !important; }
.text-large .interrogation-log p { font-size: 1.2rem !important; }
.text-large .user-header span { font-size: 1.1rem !important; }

/* Light Mode Contrast Overrides */
body.light-mode .log-entry { 
    background: rgba(0, 0, 0, 0.03); 
    border-color: rgba(0, 0, 0, 0.05); 
}
body.light-mode .log-a { color: #1a1a24; }
body.light-mode .log-q { color: #5a5a66; }

body.light-mode .motive-reveal {
    background: rgba(212, 175, 55, 0.05) !important;
    border-color: var(--accent-gold) !important;
}

body.light-mode .bonus-summary {
    background: rgba(0, 0, 0, 0.02);
    border-color: rgba(0, 0, 0, 0.05);
}

body.light-mode .lb-name { color: #1a1a24; }
body.light-mode .lb-rank { color: rgba(0,0,0,0.3); }
