@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', sans-serif;
    background: #1a1a1a;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    color: #ffffff;
}

.container {
    display: flex;
    gap: 30px;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100vh;
    padding: 20px;
}

#carCanvas, #networkCanvas {
    background: #242424;
    border-radius: 20px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    border: 1px solid #333;
}

.controls-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 30px;
    background: #242424;
    border-radius: 20px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    min-width: 250px;
    border: 1px solid #333;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.control-group h3 {
    color: #ffffff;
    font-size: 14px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
}

button {
    padding: 12px 20px;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #333;
    color: #ffffff;
    border: 1px solid #444;
}

button:hover {
    background: #444;
    transform: translateY(-2px);
}

.save-btn { background: #1b4d1f; color: #ffffff; border-color: #2e7d32; }
.delete-btn { background: #641e1e; color: #ffffff; border-color: #c62828; }
.reset-btn { background: #804000; color: #ffffff; border-color: #ef6c00; }
.mode-btn { background: #4a1b68; color: #ffffff; border-color: #6a1b9a; }
.speed-btn { background: #0d47a1; color: #ffffff; border-color: #1565c0; }

.slider {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: #333;
    outline: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #ffffff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.slider-value {
    color: #ffffff;
    font-size: 12px;
    font-weight: 500;
    text-align: center;
}

.stats-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    background: #242424;
    padding: 25px;
    border-radius: 20px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    min-width: 250px;
    border: 1px solid #333;
}

.stats-panel h2 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #ffffff;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #333;
}

.stat-label {
    font-size: 14px;
    color: #999;
}

.stat-value {
    font-size: 14px;
    font-weight: 500;
    color: #ffffff;
}

.timer {
    font-size: 28px;
    font-weight: 600;
    color: #ffffff;
    text-align: center;
    margin: 10px 0;
}

.progress-bar {
    width: 100%;
    height: 4px;
    background: #333;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 10px;
}

.progress-fill {
    height: 100%;
    background: #ffffff;
    border-radius: 2px;
    transition: width 0.3s ease;
}

.mode-indicator {
    position: absolute;
    top: 20px;
    right: 20px;
    background: #242424;
    color: #ffffff;
    padding: 12px 20px;
    border-radius: 12px;
    font-weight: 500;
    font-size: 14px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    border: 1px solid #333;
}

.manual-instructions {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: #242424;
    padding: 20px;
    border-radius: 12px;
    font-size: 14px;
    max-width: 250px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    display: none;
    border: 1px solid #333;
    color: #ffffff;
}

.notification {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: #242424;
    color: #ffffff;
    padding: 16px 24px;
    border-radius: 12px;
    font-weight: 500;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 1000;
    border: 1px solid #333;
}

@media (max-width: 1200px) {
    .container {
        flex-direction: column;
        gap: 10px;
        padding: 10px;
    }
    
    .controls-panel {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        min-width: auto;
    }
    
    .control-group {
        min-width: 150px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
        overflow: auto;
    }

    .container {
        flex-direction: column;
        height: auto;
        padding: 10px;
        gap: 15px;
        overflow-y: auto;
        margin-bottom: 60px; /* Add space for manual instructions */
    }

    #carCanvas {
        width: 100%;
        height: auto;
    }

    #networkCanvas {
        width: 100%;
        height: auto;
        margin-top: 10px;
    }

    .controls-panel {
        width: 100%;
        padding: 15px;
    }

    .stats-panel {
        position: relative;
        top: 0;
        left: 0;
        width: 100%;
        margin-bottom: 15px;
    }

    .mode-indicator {
        position: fixed;
        top: 10px;
        right: 10px;
        font-size: 12px;
        padding: 8px 12px;
        z-index: 1000;
    }

    .manual-instructions {
        position: fixed;
        bottom: 10px;
        left: 10px;
        font-size: 12px;
        z-index: 1000;
    }

    button {
        padding: 15px;
        font-size: 16px; /* Larger touch targets */
    }

    .slider::-webkit-slider-thumb {
        width: 24px;
        height: 24px; /* Larger slider thumb for touch */
    }
}

.reload-btn {
    background-color: #0277bd; /* A nice shade of blue */
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.2s ease;
    margin-top: 5px; /* Adds a little space if needed */
    width: 100%; /* Makes it match the width of other buttons */
}

.reload-btn:hover {
    background-color: #01579b; /* A darker blue for the hover effect */
}

/* --- Style for the new Pause/Resume Button --- */

.pause-btn {
    background-color: #e67e22; /* Orange for Pause */
    color: white;
    border: none;
    padding: 10px 15px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: background-color 0.2s ease;
    margin-top: 5px;
    width: 100%;
}

.pause-btn:hover {
    background-color: #d35400; /* Darker Orange */
}

/* Style for when the button is in the "Resume" state */
.pause-btn.paused {
    background-color: #27ae60; /* Green for Resume */
}

.pause-btn.paused:hover {
    background-color: #229954; /* Darker Green */
}

/* New container to hold the pause button below the stats panel */
.pause-container {
    position: absolute;
    top: 400px;  /* Adjust this value to move it up/down */
    left: 20px;   /* Adjust this value to move it left/right */
    width: 260px; /* Same width as the stats panel */
}

@media (max-width: 768px) {

    .pause-container {
        position: fixed;
        top: auto;
        bottom: 20px;
        left: 10px;
        width: auto;
        z-index: 1000;
    }

    .pause-btn {
        width: auto;
        padding: 12px 20px;
        border-radius: 12px;
        font-size: 14px;
        /* Add subtle background blur for better visibility */
        background-color: rgba(230, 126, 34, 0.9);
        backdrop-filter: blur(8px);
    }

    .pause-btn.paused {
        background-color: rgba(39, 174, 96, 0.9);
    }

    /* Ensure manual instructions don't overlap with pause button */
    .manual-instructions {
        bottom: 80px;
    }
}

/* --- Mobile Screen Styles --- */

/* First, style the message itself. It should be hidden by default on PC. */
#mobile-message {
    display: none; /* Hidden on large screens */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #1c1c1c; /* Dark background */
    color: white;
    font-family: 'Arial', sans-serif;
    font-size: 18px;
    text-align: center;
    padding-top: 40vh; /* Pushes the text down to the vertical center */
    z-index: 9999; /* Ensures it's on top of everything */
}

@media (max-width: 1200px) {
    /* Hide the main content on small screens */
    .container,
    .stats-panel,
    .controls-panel,
    .mode-indicator,
    .manual-instructions,
    .notification {
        display: none !important; /* Use !important to override other styles */
    }

    /* Show our mobile message */
    #mobile-message {
        display: block;
    }
}
