/* Nowoczesny styl UI - Glassmorphism & Premium Look */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap');

body {
    margin: 0;
    overflow: hidden;
    background-color: #050508;
    /* Bardzo ciemny granat/czarny */
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #e0e0e0;
    overscroll-behavior: none;
}

canvas {
    display: block;
    touch-action: none;
    background-color: #050508;
}

/* --- Panel Sterowania --- */
#controls {
    position: absolute;
    top: 20px;
    left: 20px;
    background: rgba(15, 15, 20, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 0;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f0f0f0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    width: 300px;
    max-height: calc(100vh - 80px);
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.6);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
    overflow: hidden;
}

#controls.hidden-panel {
    transform: translateX(-340px);
    opacity: 0;
    pointer-events: none;
}

#toggleControls {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 101;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(40, 40, 50, 0.85);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #eee;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

#toggleControls:hover {
    background: rgba(50, 50, 70, 0.95);
    border-color: #4CAF50;
    color: #4CAF50;
    transform: scale(1.05);
}

#toggleControls:active {
    transform: scale(0.95);
}

#controls-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.03);
}

#controls-header h2 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    letter-spacing: 1px;
    color: #4CAF50;
    text-transform: uppercase;
}

#controls-content {
    padding: 0 20px 20px 20px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.1) transparent;
}

.control-section {
    margin-top: 20px;
}

.section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    color: #666;
    margin-bottom: 12px;
    letter-spacing: 1.5px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: rgba(255, 255, 255, 0.05);
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 14px;
}

.control-group>div {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
}

/* Nagłówki sekcji */
.label-like,
label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #aaa;
    font-weight: 600;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* --- Custom Radio & Checkbox --- */
input[type="radio"],
input[type="checkbox"] {
    appearance: none;
    background-color: rgba(255, 255, 255, 0.1);
    margin: 0;
    font: inherit;
    color: currentColor;
    width: 1.15em;
    height: 1.15em;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 0.15em;
    display: grid;
    place-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

input[type="radio"] {
    border-radius: 50%;
}

input[type="radio"]::before {
    content: "";
    width: 0.65em;
    height: 0.65em;
    border-radius: 50%;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em #4CAF50;
}

input[type="checkbox"]::before {
    content: "";
    width: 0.65em;
    height: 0.65em;
    transform: scale(0);
    transition: 120ms transform ease-in-out;
    box-shadow: inset 1em 1em #4CAF50;
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

input[type="radio"]:checked::before,
input[type="checkbox"]:checked::before {
    transform: scale(1);
}

input[type="radio"]:checked,
input[type="checkbox"]:checked {
    border-color: #4CAF50;
    background-color: rgba(76, 175, 80, 0.1);
}

label {
    cursor: pointer;
    font-size: 13px;
    color: #ddd;
    font-weight: 400;
    text-transform: none;
}

/* --- Sliders --- */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    background: transparent;
    height: 6px;
    border-radius: 3px;
    cursor: pointer;
    margin: 5px 0;
}

input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    transition: background 0.2s;
}

input[type="range"]::-moz-range-track {
    width: 100%;
    height: 4px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 2px;
    transition: background 0.2s;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: #4CAF50;
    margin-top: -5px;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
    transition: transform 0.1s, background 0.2s;
}

input[type="range"]::-moz-range-thumb {
    border: none;
    height: 14px;
    width: 14px;
    border-radius: 50%;
    background: #4CAF50;
    box-shadow: 0 0 5px rgba(76, 175, 80, 0.5);
    transition: transform 0.1s, background 0.2s;
}

input[type="range"]:hover::-webkit-slider-thumb {
    transform: scale(1.1);
    background: #66bb6a;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.min-max-label {
    font-size: 10px;
    color: #777;
    width: 25px;
    text-align: center;
}

.value-display {
    font-size: 12px;
    font-weight: 600;
    color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
    padding: 2px 6px;
    border-radius: 4px;
    min-width: 30px;
    text-align: center;
    margin-left: auto;
}

/* --- Buttons --- */
button {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: none;
    border-radius: 6px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    flex: 1;
    font-family: inherit;
}

button:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1);
}

button:active {
    transform: translateY(0);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}

#resetButton {
    background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%);
}

#pauseButton.paused {
    background: linear-gradient(135deg, #ff9800 0%, #f57c00 100%);
}

/* --- Number Input --- */
.number-input-container {
    display: flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 6px;
    padding: 2px;
}

.number-input-button {
    background: transparent;
    color: #aaa;
    width: 24px;
    height: 24px;
    min-height: auto !important;
    padding: 0;
    box-shadow: none;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.number-input-button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: none;
    box-shadow: none;
}

input[type="number"] {
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    border: none;
    color: white;
    text-align: center;
    width: 40px;
    font-family: inherit;
    font-size: 13px;
    -moz-appearance: textfield;
}

input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* --- Info & Score --- */
#score {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 28px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 10px rgba(255, 255, 255, 0.3);
    z-index: 5;
    font-variant-numeric: tabular-nums;
}

#trackingInfo {
    position: absolute;
    top: 60px;
    right: 20px;
    background: rgba(20, 20, 25, 0.65);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 12px 16px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #f0f0f0;
    z-index: 5;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    min-width: 180px;
}

#trackingInfo h3 {
    margin: 0 0 8px 0;
    font-size: 14px;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #4CAF50;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    padding-bottom: 4px;
}

#trackingInfo p {
    margin: 4px 0;
    font-size: 12px;
    display: flex;
    justify-content: space-between;
    color: #aaa;
}

#trackingInfo p span {
    color: #fff;
    font-weight: 600;
    font-family: monospace;
}

#info {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 12px;
    border-radius: 20px;
    pointer-events: none;
    backdrop-filter: blur(4px);
    white-space: nowrap;
}

#speedLabel {
    position: absolute;
    color: white;
    font-size: 12px;
    background-color: rgba(0, 0, 0, 0.8);
    padding: 4px 8px;
    border-radius: 4px;
    display: none;
    pointer-events: none;
    white-space: nowrap;
    z-index: 11;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

select {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 6px;
    color: #ddd;
    padding: 6px;
    font-family: inherit;
    font-size: 13px;
    cursor: pointer;
    width: 100%;
    outline: none;
    transition: all 0.2s ease;
    margin-top: 4px;
}

select:focus {
    border-color: #4CAF50;
    background: rgba(255, 255, 255, 0.1);
}

select option {
    background-color: #1a1a20;
    color: #ddd;
}

.hidden {
    display: none !important;
}

/* --- Mobile Responsiveness --- */
@media (max-width: 600px) {
    #controls {
        width: calc(100% - 40px);
        max-width: none;
        max-height: 35vh;
        bottom: 0;
        top: auto;
        left: 0;
        right: 0;
        margin: 10px;
        border-radius: 16px;
    }

    #score {
        font-size: 24px;
        top: 10px;
        right: 10px;
    }

    #info {
        display: none;
        /* Ukryj info na małych ekranach żeby nie zasłaniało */
    }
}