body { margin: 0; padding: 0; background-color: #050505; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; overflow: hidden; height: 100vh; height: 100dvh; display: flex; flex-direction: column; color: white; }

/* --- MODERN AUTH SCREEN --- */
#auth-screen { display: flex; flex-direction: column; justify-content: center; align-items: center; height: 100%; width: 100%; padding: 20px; box-sizing: border-box; background: radial-gradient(circle at 50% -20%, #1a2a1a 0%, #050505 60%); position: relative;}
.auth-card { background: rgba(20, 20, 20, 0.7); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); padding: 40px 30px; border-radius: 16px; border: 1px solid rgba(57, 255, 20, 0.1); box-shadow: 0 10px 30px rgba(0,0,0,0.5); width: 100%; max-width: 360px; text-align: center; position: relative; z-index: 10;}
.auth-card h1 { color: #fff; margin-top: 0; letter-spacing: 2px; text-transform: uppercase; font-size: 2rem; margin-bottom: 5px; text-shadow: 0 0 15px rgba(57, 255, 20, 0.4); }
.auth-card h1 span { color: #39ff14; }
.auth-subtitle { color: #888; font-size: 0.85rem; margin-bottom: 30px; letter-spacing: 0.5px;}
.input-group { position: relative; margin-bottom: 15px; }
.auth-input { width: 100%; padding: 14px 16px; background: rgba(0, 0, 0, 0.4); border: 1px solid #333; color: white; border-radius: 10px; box-sizing: border-box; font-size: 0.95rem; transition: all 0.3s ease; outline: none; }
.auth-input:focus { border-color: #39ff14; background: rgba(20, 20, 20, 0.8); box-shadow: 0 0 8px rgba(57, 255, 20, 0.2); }
.auth-btn { width: 100%; padding: 14px; font-weight: bold; background-color: #39ff14; color: #000; border: none; border-radius: 10px; cursor: pointer; text-transform: uppercase; margin-top: 10px; letter-spacing: 1px; transition: all 0.2s; box-shadow: 0 4px 15px rgba(57, 255, 20, 0.3); font-size: 0.9rem;}
.auth-btn:active { transform: scale(0.98); }
.text-btn { background: none; border: none; color: #888; font-size: 0.8rem; margin-top: 20px; cursor: pointer; text-decoration: underline; text-underline-offset: 4px; transition: color 0.2s;}
.text-btn:hover { color: #ddd; }
.auth-message { font-size: 0.85rem; margin-top: 15px; min-height: 20px; font-weight: 500;}

/* --- REGISTER MODAL --- */
#register-modal { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0, 0, 0, 0.85); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); z-index: 100; display: none; flex-direction: column; justify-content: center; align-items: center; padding: 20px; box-sizing: border-box; opacity: 0; transition: opacity 0.3s ease; }
#register-modal.show { display: flex; opacity: 1; }
#register-modal .auth-card { border: 1px solid rgba(255, 255, 255, 0.1); background: rgba(15, 15, 15, 0.9); }
#register-modal h2 { margin-top: 0; font-size: 1.4rem; color: #fff; margin-bottom: 25px;}

/* --- REST DER APP --- */
#app-screen { display: none; flex-direction: column; height: 100%; width: 100%; position: relative; }

#achievement-popup { position: absolute; top: calc(10px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%) translateY(-200%); background: rgba(17, 17, 17, 0.95); border: 1px solid #39ff14; box-shadow: 0 0 15px rgba(57, 255, 20, 0.4); border-radius: 8px; padding: 12px 20px; display: flex; align-items: center; gap: 15px; z-index: 2000; transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275); backdrop-filter: blur(5px); min-width: 260px; }
#achievement-popup.show { transform: translateX(-50%) translateY(0); }
.ach-icon { font-size: 2rem; }
.ach-title { font-size: 0.7rem; color: #aaa; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 2px;}
.ach-desc { font-size: 1.1rem; color: #39ff14; font-weight: bold; }

#top-dashboard { background: rgba(17, 17, 17, 0.65); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); padding: calc(12px + env(safe-area-inset-top)) 20px 15px 20px; border-bottom: 1px solid rgba(57, 255, 20, 0.15); z-index: 1001; display: flex; flex-direction: column; gap: 10px; position: relative; }
.dash-header { display: flex; justify-content: space-between; align-items: flex-end; }
.level-info { display: flex; align-items: flex-start; gap: 8px; flex-direction: column;}
.player-name { font-size: 0.75rem; color: #aaa; text-transform: uppercase; letter-spacing: 1px; font-weight: bold; line-height: 1;}
.level-badge-row { display: flex; align-items: center; gap: 8px;}
.level-badge { background: rgba(0,0,0,0.5); border: 1px solid #39ff14; color: #39ff14; font-size: 0.85rem; font-weight: bold; padding: 4px 8px; border-radius: 6px; box-shadow: 0 0 8px rgba(57,255,20,0.15);}
.level-title { font-size: 0.95rem; color: #fff; font-weight: 600; letter-spacing: 0.5px; }
.score-info { text-align: right; }
.dash-value { font-size: 1.6rem; font-weight: bold; color: #39ff14; line-height: 1; text-shadow: 0 0 10px rgba(57,255,20,0.3);}
.dash-label { font-size: 0.65rem; color: #aaa; text-transform: uppercase; letter-spacing: 0.5px; margin-top: 2px;}
.progress-bar-container { position: relative; width: 100%; height: 14px; background: rgba(0,0,0,0.6); border-radius: 7px; overflow: hidden; border: 1px solid #333; margin-top: 4px;}
.progress-bar-fill { background: #39ff14; height: 100%; width: 0%; transition: width 0.4s ease; box-shadow: 0 0 10px rgba(57, 255, 20, 0.5); }
.progress-text { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: flex; justify-content: center; align-items: center; font-size: 0.65rem; font-weight: bold; color: #fff; text-shadow: 1px 1px 3px #000; z-index: 2;}

#map { flex-grow: 1; width: 100%; z-index: 1; }

/* Hellere Karte (Dunkelgrau) MIT glatteren Linien UND Kartendetails */
.leaflet-tile-pane {
	/* Wir senken den Kontrast nur moderat,
	   erhöhen die Helligkeit und erhöhen die Sättigung,
	   um das Grau satter zu machen und die Linien zu glätten. */
	filter: contrast(0.8) brightness(1.0) saturate(3.0); 
}

#ui { padding: 12px 15px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; background: rgba(17, 17, 17, 0.65); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); border-top: 1px solid rgba(57, 255, 20, 0.15); box-sizing: border-box; z-index: 900; }
.left-controls { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 6px; }
.center-controls { display: flex; justify-content: center; align-items: center; gap: 8px; }
.right-stats { text-align: right; display: flex; flex-direction: column; justify-content: center;}

/* SCHMALERE BUTTONS */
button.action-btn { 
	padding: 10px 18px; 
	font-size: 0.85rem; 
	font-weight: 800; 
	background-color: #39ff14; 
	color: #000; 
	border: none; 
	border-radius: 25px; 
	cursor: pointer; 
	text-transform: uppercase; 
	letter-spacing: 0.5px; 
	box-shadow: 0 4px 15px rgba(57, 255, 20, 0.4); 
	transition: all 0.2s; 
}
button.action-btn:active { transform: scale(0.95); }
button.action-btn.active { background-color: #ff3914; color: white; box-shadow: 0 4px 15px rgba(255, 57, 20, 0.4); }

button.pause-btn { 
	padding: 10px 18px; 
	font-size: 0.85rem; 
	font-weight: 800; 
	background-color: #ffaa00; 
	color: #000; 
	border: none; 
	border-radius: 25px; 
	cursor: pointer; 
	text-transform: uppercase; 
	letter-spacing: 0.5px; 
	box-shadow: 0 4px 15px rgba(255, 170, 0, 0.4); 
	transition: all 0.2s; 
	display: none; 
}
button.pause-btn:active { transform: scale(0.95); }

.status-container { display: flex; align-items: center; font-size: 0.75rem; color: #aaa; }
.gps-dot { width: 8px; height: 8px; border-radius: 50%; background-color: red; margin-right: 6px; display: block;}
.gps-dot.active { background-color: #39ff14; box-shadow: 0 0 6px #39ff14; }
.spinner { width: 8px; height: 8px; border: 2px solid rgba(255, 255, 255, 0.2); border-top-color: #39ff14; border-radius: 50%; animation: spin 1s linear infinite; margin-right: 6px; display: none; }
.odometer-label { font-size: 0.65rem; color: #777; text-transform: uppercase; letter-spacing: 0.5px; }
.odometer-value { font-size: 1.2rem; color: #fff; font-weight: bold; text-shadow: 0 0 10px rgba(255,255,255,0.2);}

#profile-modal { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(5, 5, 5, 0.85); backdrop-filter: blur(15px); -webkit-backdrop-filter: blur(15px); z-index: 1000; display: none; flex-direction: column; padding-top: calc(120px + env(safe-area-inset-top)); padding-bottom: 40px; box-sizing: border-box; overflow-y: auto; }
.profile-header { text-align: center; margin-bottom: 25px; border-bottom: 1px solid rgba(255,255,255,0.1); padding-bottom: 15px;}
.profile-header h2 { margin: 0; color: #39ff14; letter-spacing: 2px; text-transform: uppercase; font-size: 1.2rem; text-shadow: 0 0 10px rgba(57,255,20,0.3);}
.profile-header p { margin: 5px 0 0 0; color: #aaa; font-size: 0.8rem; }

.hex-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 20px; padding: 0 20px; }
.hex-wrapper { display: flex; flex-direction: column; align-items: center; width: 85px; cursor: pointer; }
.hex-outer { width: 70px; height: 80px; clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; background: rgba(30,30,30,0.8); transition: all 0.3s ease; }
.hex-wrapper:active .hex-outer { transform: scale(0.9); }
.hex-inner { width: 62px; height: 71px; clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%); background: #111; display: flex; align-items: center; justify-content: center; flex-direction: column; }

.hex-outer.bronze { background: #cd7f32; box-shadow: 0 0 10px rgba(205, 127, 50, 0.5); }
.hex-outer.silver { background: #c0c0c0; box-shadow: 0 0 10px rgba(192, 192, 192, 0.5); }
.hex-outer.gold { background: #ffd700; box-shadow: 0 0 15px rgba(255, 215, 0, 0.6); }
.hex-outer.platin { background: #00ffff; box-shadow: 0 0 20px rgba(0, 255, 255, 0.8); }
.hex-outer.onyx { background: #000; box-shadow: 0 0 20px rgba(138, 43, 226, 0.9), inset 0 0 10px rgba(138, 43, 226, 0.5); border: 1px solid #8a2be2; }

.hex-icon { font-size: 1.5rem; }
.locked-icon { color: #444; font-size: 1.2rem; }
.hex-outer:not(.locked) .locked-icon { display: none; }
.hex-outer.locked .hex-icon { display: none; }

.medal-title { font-size: 0.65rem; color: #ddd; font-weight: bold; text-align: center; text-transform: uppercase; line-height: 1.1; margin-bottom: 2px;}
.medal-desc { font-size: 0.55rem; color: #777; text-align: center; line-height: 1.1; height: 18px;}
.medal-tier { font-size: 0.55rem; font-weight: bold; margin-top: 4px; text-transform: uppercase; }

.tier-text-bronze { color: #cd7f32; }
.tier-text-silver { color: #c0c0c0; }
.tier-text-gold { color: #ffd700; }
.tier-text-platin { color: #00ffff; text-shadow: 0 0 5px rgba(0,255,255,0.4); }
.tier-text-onyx { color: #c384ff; text-shadow: 0 0 5px rgba(138,43,226,0.6); }
.tier-text-locked { color: #555; }

/* --- MEDAL DETAIL MODAL --- */
#medal-detail-modal { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(5, 5, 5, 0.9); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); z-index: 3000; display: none; flex-direction: column; justify-content: center; align-items: center; padding: 20px; box-sizing: border-box; opacity: 0; transition: opacity 0.3s ease; }
#medal-detail-modal.show { display: flex; opacity: 1; }
.medal-detail-card { background: rgba(20, 20, 20, 0.8); border: 1px solid rgba(57, 255, 20, 0.3); border-radius: 16px; padding: 25px; width: 100%; max-width: 340px; box-shadow: 0 10px 40px rgba(0,0,0,0.8); position: relative; }
.close-btn { position: absolute; top: 15px; right: 15px; background: none; border: none; color: #888; font-size: 1.5rem; cursor: pointer; line-height: 1; padding: 5px; }
.detail-header { text-align: center; margin-bottom: 25px; }
.detail-icon { font-size: 3.5rem; margin-bottom: 5px; text-shadow: 0 0 20px rgba(255,255,255,0.2); }
.detail-title { font-size: 1.4rem; color: #fff; text-transform: uppercase; letter-spacing: 1.5px; margin: 0; }
.detail-desc { font-size: 0.85rem; color: #aaa; margin-top: 5px; }
.tier-list { display: flex; flex-direction: column; gap: 8px; }
.tier-item { display: flex; justify-content: space-between; align-items: center; background: rgba(0,0,0,0.5); padding: 12px 15px; border-radius: 8px; border-left: 4px solid #333; }
.tier-item.unlocked.bronze { border-color: #cd7f32; }
.tier-item.unlocked.silver { border-color: #c0c0c0; }
.tier-item.unlocked.gold { border-color: #ffd700; }
.tier-item.unlocked.platin { border-color: #00ffff; box-shadow: inset 20px 0 30px -20px rgba(0,255,255,0.3); }
.tier-item.unlocked.onyx { border-color: #8a2be2; box-shadow: inset 20px 0 30px -20px rgba(138,43,226,0.5); }
.tier-name { font-weight: bold; font-size: 0.95rem; text-transform: uppercase; }
.tier-req { font-size: 0.75rem; color: #aaa; margin-top: 2px;}
.tier-status { font-size: 1.1rem; }

/* Leaderboard Styles */
.lb-item { display: flex; justify-content: space-between; align-items: center; background: rgba(20,20,20,0.8); padding: 12px; border-radius: 8px; border: 1px solid #222; }
.lb-rank { width: 15%; font-weight: bold; font-size: 1.1rem; color: #666; }
.lb-name { width: 55%; font-weight: bold; font-size: 0.95rem; text-transform: uppercase; }
.lb-dist { width: 30%; text-align: right; color: #39ff14; font-weight: bold; }

/* Glanz für die Top 3 */
.lb-item.rank-1 { border-color: #ffd700; background: rgba(255, 215, 0, 0.1); }
.lb-item.rank-1 .lb-rank { color: #ffd700; text-shadow: 0 0 10px rgba(255, 215, 0, 0.5); }
.lb-item.rank-2 { border-color: #c0c0c0; background: rgba(192, 192, 192, 0.1); }
.lb-item.rank-2 .lb-rank { color: #c0c0c0; }
.lb-item.rank-3 { border-color: #cd7f32; background: rgba(205, 127, 50, 0.1); }
.lb-item.rank-3 .lb-rank { color: #cd7f32; }

/* Leaderboard Tabs & Klickbare Namen */
.lb-tab { flex: 1; padding: 10px 5px; background: rgba(0,0,0,0.5); border: 1px solid #333; color: #aaa; border-radius: 5px; cursor: pointer; text-transform: uppercase; font-size: 0.75rem; font-weight: bold; transition: all 0.2s; }
.lb-tab.active { background: rgba(57, 255, 20, 0.1); border-color: #39ff14; color: #39ff14; }
.lb-name-click { cursor: pointer; text-decoration: underline; text-underline-offset: 4px; color: #ddd; }
.lb-name-click:hover { color: #39ff14; }