/* Reset & Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f0f0;
    color: #333;
    overflow-x: hidden; /* Verhindert horizontales Scrollen */
    height: 100vh;
    /* Angepasst: Platz für Tracker (50px) + Footer (30px) = 80px */
    padding-bottom: 80px; 
}

/* Start Screen */
#startScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 100;
}

#startScreen h1 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    color: #0066cc;
}

#startScreen p {
    font-size: 1.2rem;
    margin-bottom: 2rem;
}

#startBtn {
    padding: 12px 24px;
    font-size: 1.1rem;
    background-color: #0066cc;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
}

#startBtn:hover {
    background-color: #0055aa;
}

/* Edge Ads */
.edge-ads {
    position: fixed;
    display: flex;
    background-color: rgba(221, 221, 221, 0.7);
    z-index: 1; /* Standard-Z-Index für Anzeigenränder */
    padding: 10px;
}

#topEdge {
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    flex-wrap: wrap;
    justify-content: space-around;
}

#bottomEdge {
    /* Platziert über Footer und Tracker */
    bottom: 80px; /* Höhe Footer (30px) + Höhe Tracker (50px) = 80px */
    left: 0;
    right: 0;
    height: 80px;
    flex-wrap: wrap;
    justify-content: space-around;
}

#leftEdge {
    left: 0;
    top: 80px;
    /* Vertikale Ads müssen Platz für oben (80px) und unten (80px) lassen */
    bottom: 160px; 
    width: 100px;
    flex-direction: column;
    align-items: center;
}

#rightEdge {
    right: 0;
    top: 80px;
    /* Vertikale Ads müssen Platz für oben (80px) und unten (80px) lassen */
    bottom: 160px; 
    width: 100px;
    flex-direction: column;
    align-items: center;
}

.fake-ad {
    background-color: white;
    border: 1px solid #ddd;
    border-radius: 5px;
    margin: 5px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

.fake-ad img {
    max-width: 100%;
    height: auto;
}

/* Flying Ad */
#flyingAd {
    position: absolute;
    width: 100px;
    height: 50px;
    z-index: 101; /* Über den Edge Ads */
}

/* Cursor Ad */
#cursorAd {
    position: absolute;
    width: 80px;
    height: 40px;
    z-index: 102; /* Über Flying Ad */
    pointer-events: none; /* Klicks gehen durch das Ad hindurch */
}

/* Progress Tracker */
#progressTracker {
    position: fixed;
    bottom: 30px; /* Platziert direkt über dem Footer (30px) */
    left: 0;
    right: 0;
    background-color: #0066cc; /* Hintergrundfarbe des Trackers */
    color: white;
    padding: 5px 10px; /* Kleinerer Innenabstand */
    display: flex; /* Flexbox für das Layout */
    align-items: center; /* Vertikale Zentrierung */
    justify-content: space-around; /* Verteilung der Elemente */
    z-index: 15; /* Über den Edge-Ads, unter dem Cookie-Banner */
    height: 50px; /* Feste Höhe für den Tracker */
    font-size: 0.9rem;
    flex-wrap: nowrap; /* Verhindert Umbruch */
}

#progressTracker img {
    height: 40px; /* Kleinere BMW M4 Bildgröße */
    margin-right: 10px; /* Abstand zum Fortschritt */
}

.progress-container {
    width: 40%; /* Breite anpassen */
    margin-right: 10px;
}

#progressBar { 
    width: 100%;
    height: 8px; /* Noch schmalere Fortschrittsleiste */
    background-color: #e0e0e0;
    border-radius: 4px;
    overflow: hidden;
}

#progressFill { 
    height: 100%;
    background-color: #e60000;
    width: 0%;
    transition: width 0.3s ease;
}

/* Cookie Consent Banner */
#cookie-banner {
    position: fixed;
    /* Platziert über Tracker (50px) + Footer (30px) + etwas Abstand (10px) = 90px */
    bottom: 90px; 
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.9); /* Dunklerer Hintergrund */
    color: white;
    padding: 15px 25px;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    z-index: 9999; /* Sehr hoher Z-Index, um über allem zu liegen */
    display: flex;
    align-items: center;
    gap: 15px;
    font-size: 0.95rem;
    max-width: 90%; /* Responsive Anpassung */
    text-align: center;
}

#cookie-banner p {
    margin-bottom: 0;
    line-height: 1.4;
}

#cookie-banner button {
    padding: 8px 15px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s ease;
    white-space: nowrap; /* Verhindert Zeilenumbruch bei Buttons */
}

#cookie-banner button:hover {
    background-color: #0056b3;
}


/* Clicker Game */
#clickerGame {
    position: fixed; /* Fixiert es im Viewport */
    top: 80px; /* Unter der Top Edge Ad */
    left: 100px; /* Rechts von der Left Edge Ad */
    right: 100px; /* Links von der Right Edge Ad */
    /* Platziert über bottomEdge (80px) */
    bottom: 90px; 
    width: auto;
    height: auto;
    max-width: 1800px; /* Maximale Breite */
    /* Höhe angepasst: 100vh - TopEdge (80px) - BottomEdge (80px) = 100vh - 160px */
    max-height: calc(100vh - 160px); 
    margin: auto;
    overflow-y: auto; /* Scrollbar, wenn Inhalt zu lang ist */
    background-color: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
    z-index: 20; /* Über allen Ads und Trackern, aber unter dem Cookie Banner */
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-content: flex-start;
    gap: 20px;
}

#clickerGame > .clicker-header {
    flex-basis: 100%;
    text-align: center;
    margin-bottom: 20px;
}

.game-section {
    background-color: #f9f9f9;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 15px;
    margin-bottom: 0;
    flex: 1 1 300px;
    min-width: 280px;
    max-width: 45%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: stretch;
}

.game-section h3 {
    color: #0066cc;
    margin-bottom: 10px;
    font-size: 1.3rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 5px;
}

.inventory-display p {
    font-size: 1.1rem;
    margin-bottom: 5px;
}

/* General button styling */
#clickBtn { 
    display: block;
    width: 100%;
    padding: 15px;
    margin: 20px 0;
    background-color: #0066cc;
    color: white;
    border: none;
    border-radius: 5px;
    font-size: 1.2rem;
    cursor: pointer;
    transition: transform 0.1s;
}

#clickBtn:active {
    transform: scale(0.98);
}

.production-buttons, .price-controls {
    margin-top: 10px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.buy-part-btn, .buy-producer-btn, #assembleCarBtn, 
#decreasePriceBtn, #increasePriceBtn {
    padding: 10px 15px;
    font-size: 0.95rem;
    background-color: #008CBA;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.3s;
    flex-grow: 1; /* Erlaubt Buttons, den verfügbaren Platz aufzuteilen */
}

.buy-part-btn:hover, .buy-producer-btn:hover, #assembleCarBtn:hover,
#decreasePriceBtn:hover, #increasePriceBtn:hover {
    background-color: #007bb5;
}

#assembleCarBtn {
    width: 100%;
    margin-top: 15px;
}

.price-controls {
    justify-content: center;
}

#demandDisplay {
    font-weight: bold;
    color: #0066cc;
}

.status-message {
    margin-top: 10px;
    font-style: italic;
    color: #555;
    min-height: 1.2em;
}

.upgrades-section {
    margin-top: 20px;
}

.upgrade-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin: 8px 0;
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 5px;
    text-align: left;
    cursor: pointer;
    transition: opacity 0.3s;
}

.upgrade-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Utility Class */
.hidden {
    display: none !important; 
}

/* Legal Pages */
.legal-container {
    max-width: 800px;
    margin: 2rem auto;
    padding: 2rem;
    background-color: white;
    border-radius: 10px;
    box-shadow: 0 0 10px rgba(0,0,0,0.1);
    position: relative; /* Wichtig, damit es über dem body-Hintergrund liegt */
    z-index: 5; /* Sollte über den meisten Basis-Hintergründen liegen */
}

.legal-container h1 {
    color: #0066cc;
    margin-bottom: 1.5rem;
}

.legal-container h2 {
    color: #0066cc;
    margin: 1.5rem 0 0.5rem 0;
    font-size: 1.2rem;
}

.legal-container p, .legal-container ul {
    margin-bottom: 1rem;
    line-height: 1.5;
}

.legal-container ul {
    padding-left: 1.5rem;
}

.disclaimer {
    font-style: italic;
    color: #666;
    margin-top: 2rem;
    padding-top: 1rem;
    border-top: 1px solid #eee;
}

.back-link {
    display: inline-block;
    margin-top: 2rem;
    color: #0066cc;
    text-decoration: none;
    font-weight: bold;
}

.back-link:hover {
    text-decoration: underline;
}

/* Footer (Wiederhergestellt und neu positioniert) */
footer {
    position: fixed; /* Bleibt am unteren Rand des Viewports */
    bottom: 0; /* Ganz unten */
    left: 0;
    right: 0;
    background-color: #0055aa; /* Etwas dunkler als Tracker, gut sichtbar */
    color: white;
    padding: 5px 10px; /* Schmalerer Padding */
    text-align: center;
    z-index: 10; /* Unter dem Tracker, aber über dem normalen Inhalt */
    font-size: 0.8rem; /* Kleinere Schrift für die Links */
    display: flex;
    justify-content: center;
    align-items: center;
    height: 30px; /* Feste, schmale Höhe */
}

footer a {
    color: white;
    margin: 0 8px; /* Weniger Abstand zwischen Links */
    text-decoration: none;
    transition: text-decoration 0.2s ease;
}

footer a:hover {
    text-decoration: underline;
}