* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    overflow: hidden;
    background: #1a0a0a;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

#gameCanvas {
    display: block;
    cursor: none;
}

/* Tryb obserwatora - normalny kursor */
body.spectator-mode #gameCanvas {
    cursor: default;
}

#ui {
    position: fixed;
    top: 20px;
    left: 20px;
    color: white;
    z-index: 100;
    user-select: none;
}

#score {
    font-size: 24px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    margin-bottom: 10px;
}

#sizeDisplay {
    color: #4CAF50;
    font-weight: bold;
}

#boostIndicator {
    font-size: 16px;
    padding: 8px 16px;
    background: rgba(76, 175, 80, 0.8);
    border-radius: 4px;
    display: inline-block;
    transition: all 0.2s;
}

#boostIndicator.cooldown {
    background: rgba(255, 87, 34, 0.8);
}

#boostIndicator.boosting {
    background: rgba(255, 235, 59, 0.9);
    color: #333;
    animation: pulse 0.2s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* Kontrolka audio */
#audioControl {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 100;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 10px;
}

.audio-button {
    width: 50px;
    height: 50px;
    border: none;
    border-radius: 50%;
    background: rgba(76, 175, 80, 0.8);
    cursor: pointer;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.audio-button:hover {
    background: rgba(76, 175, 80, 1);
    transform: scale(1.1);
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.5);
}

.audio-button:active {
    transform: scale(0.95);
}

.audio-button.muted {
    background: rgba(244, 67, 54, 0.8);
}

.audio-button.muted:hover {
    background: rgba(244, 67, 54, 1);
    box-shadow: 0 4px 15px rgba(244, 67, 54, 0.5);
}

#audioIcon {
    pointer-events: none;
}

#audioHint {
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}

/* ============================================
   MENU GŁÓWNE
   ============================================ */

#mainMenu {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(26, 10, 10, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.5s ease-in;
}

#mainMenu.hidden {
    animation: fadeOut 0.3s ease-out;
    pointer-events: none;
    opacity: 0;
}

#menuContainer {
    background: rgba(61, 37, 37, 0.9);
    border: 3px solid rgba(139, 34, 34, 0.8);
    border-radius: 15px;
    padding: 25px 35px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
    max-width: 450px;
    width: 90%;
    max-height: 95vh;
    overflow-y: auto;
    overflow-x: hidden;
}

#gameTitle {
    font-size: 36px;
    font-weight: bold;
    color: #ff6b6b;
    margin: 0 0 5px 0;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.7);
    letter-spacing: 3px;
}

#gameSubtitle {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 15px 0;
    font-style: italic;
}

#nameForm {
    margin-bottom: 10px;
}

#playerNameInput {
    width: 100%;
    padding: 12px 18px;
    font-size: 17px;
    border: 2px solid rgba(139, 34, 34, 0.6);
    border-radius: 8px;
    background: rgba(26, 10, 10, 0.7);
    color: white;
    text-align: center;
    margin-bottom: 8px;
    transition: all 0.3s;
    outline: none;
}

#playerNameInput:focus {
    border-color: #ff6b6b;
    background: rgba(26, 10, 10, 0.9);
    box-shadow: 0 0 10px rgba(255, 107, 107, 0.3);
}

#playerNameInput::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.error-message {
    color: #ff5252;
    font-size: 14px;
    min-height: 20px;
    margin-bottom: 10px;
}

#startButton {
    width: 100%;
    padding: 12px 28px;
    font-size: 18px;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #ff6b6b 0%, #c92a2a 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 2px;
    box-shadow: 0 4px 15px rgba(255, 107, 107, 0.3);
}

#startButton:hover {
    background: linear-gradient(135deg, #ff8787 0%, #e03131 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 107, 107, 0.5);
}

#startButton:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(255, 107, 107, 0.3);
}

#startButton:disabled {
    background: rgba(100, 100, 100, 0.5);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* Przycisk obserwuj grę */
.spectate-button {
    width: 100%;
    padding: 10px 25px;
    margin-top: 10px;
    font-size: 15px;
    font-weight: bold;
    color: rgba(255, 255, 255, 0.9);
    background: linear-gradient(135deg, #5a6c7a 0%, #3a4c5a 100%);
    border: 2px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.spectate-button:hover {
    background: linear-gradient(135deg, #6a7c8a 0%, #4a5c6a 100%);
    border-color: rgba(255, 255, 255, 0.4);
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(90, 108, 122, 0.4);
}

.spectate-button:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.spectate-button:disabled {
    background: rgba(100, 100, 100, 0.5);
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    border-color: rgba(255, 255, 255, 0.1);
}

/* Opcje menu (checkbox dla audio i wybór motywu) */
.menu-option {
    margin: 10px 0;
    text-align: left;
}

.menu-option label {
    display: flex;
    align-items: center;
    cursor: pointer;
    padding: 10px 12px;
    background: rgba(26, 10, 10, 0.5);
    border: 2px solid rgba(139, 34, 34, 0.4);
    border-radius: 8px;
    transition: all 0.3s;
}

.menu-option label:hover {
    background: rgba(26, 10, 10, 0.7);
    border-color: rgba(255, 107, 107, 0.6);
}

.menu-option input[type="checkbox"] {
    width: 20px;
    height: 20px;
    margin-right: 12px;
    cursor: pointer;
    accent-color: #ff6b6b;
}

.menu-option .checkbox-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 16px;
    user-select: none;
}

/* Wybór motywu */
#themeSelector {
    padding: 10px 12px;
    background: rgba(26, 10, 10, 0.5);
    border: 2px solid rgba(139, 34, 34, 0.4);
    border-radius: 8px;
}

#themeSelector > label {
    display: block;
    padding: 0;
    margin-bottom: 8px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.9);
    font-size: 15px;
    font-weight: 500;
}

.theme-buttons {
    display: flex;
    justify-content: center;
    gap: 12px;
    flex-wrap: wrap;
}

.theme-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.theme-button:hover {
    transform: scale(1.15);
    border-color: rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.theme-button.active {
    border-color: #fff;
    border-width: 4px;
    transform: scale(1.2);
    box-shadow: 0 0 20px rgba(255, 255, 255, 0.6);
}

/* Kolory przycisków motywów */
.theme-button[data-theme="mikroswiat"] {
    background: linear-gradient(135deg, #8B4C5C 0%, #A85C6C 50%, #8B4C5C 100%);
}

.theme-button[data-theme="ocean"] {
    background: linear-gradient(135deg, #1e5a7a 0%, #2e7a9a 50%, #1e5a7a 100%);
}

.theme-button[data-theme="las"] {
    background: linear-gradient(135deg, #4a6c3a 0%, #5a8c4a 50%, #4a6c3a 100%);
}

.theme-button[data-theme="pustynia"] {
    background: linear-gradient(135deg, #8c6c3a 0%, #ac8c5a 50%, #8c6c3a 100%);
}

.theme-button[data-theme="pastelowy"] {
    background: linear-gradient(135deg, #B89968 0%, #C8A978 50%, #B89968 100%);
}

.theme-button[data-theme="lodowy"] {
    background: linear-gradient(135deg, #7FB3D5 0%, #9AC8E0 50%, #7FB3D5 100%);
}

#gameInstructions {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    color: rgba(255, 255, 255, 0.7);
    font-size: 13px;
    line-height: 1.5;
}

#gameInstructions p {
    margin: 3px 0;
}

#gameInstructions strong {
    color: #ff6b6b;
}

#gameAuthor {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
    font-style: italic;
}

#gameVersion {
    margin-top: 6px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
    font-family: 'Courier New', monospace;
}

/* Niestandardowy scrollbar dla menu */
#menuContainer::-webkit-scrollbar {
    width: 8px;
}

#menuContainer::-webkit-scrollbar-track {
    background: rgba(26, 10, 10, 0.5);
    border-radius: 10px;
}

#menuContainer::-webkit-scrollbar-thumb {
    background: rgba(255, 107, 107, 0.5);
    border-radius: 10px;
}

#menuContainer::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 107, 107, 0.7);
}

/* Licznik graczy online */
.player-count {
    margin-top: 10px;
    padding: 8px 12px;
    background: rgba(26, 10, 10, 0.6);
    border: 2px solid rgba(139, 34, 34, 0.5);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.8);
    font-size: 14px;
    text-align: center;
}

#playerCountNumber {
    color: #4CAF50;
    font-weight: bold;
}

/* Animacje */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes fadeOut {
    from {
        opacity: 1;
        transform: scale(1);
    }
    to {
        opacity: 0;
        transform: scale(0.95);
    }
}

/* Ukryj UI gry gdy menu jest widoczne */
body.menu-active #ui,
body.menu-active #audioControl {
    display: none;
}

/* Media queries dla małych ekranów */
@media (max-height: 700px) {
    #menuContainer {
        padding: 20px 30px;
        max-height: 98vh;
    }

    #gameTitle {
        font-size: 32px;
        margin: 0 0 3px 0;
    }

    #gameSubtitle {
        font-size: 14px;
        margin: 0 0 12px 0;
    }

    #playerNameInput {
        padding: 10px 15px;
        font-size: 16px;
    }

    #startButton {
        padding: 10px 25px;
        font-size: 17px;
    }

    .spectate-button {
        padding: 9px 22px;
        font-size: 14px;
    }

    .menu-option {
        margin: 8px 0;
    }

    #gameInstructions {
        margin-top: 10px;
        padding-top: 10px;
        font-size: 12px;
    }

    #gameAuthor {
        margin-top: 8px;
        padding-top: 8px;
        font-size: 11px;
    }
}

@media (max-height: 550px) {
    #gameInstructions {
        display: none;
    }

    #gameAuthor {
        margin-top: 6px;
        padding-top: 6px;
    }

    #gameVersion {
        font-size: 10px;
        margin-top: 4px;
    }
}

/* ========================================
   PANEL ADMINA
   ======================================== */

/* Panel z listą graczy */
.admin-panel {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(20, 20, 20, 0.95);
    border: 2px solid rgba(255, 50, 50, 0.8);
    border-radius: 12px;
    padding: 0;
    z-index: 1000;
    min-width: 350px;
    max-width: 500px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 10px 40px rgba(255, 50, 50, 0.3);
}

.admin-panel.hidden {
    display: none;
}

.admin-panel-header {
    background: rgba(255, 50, 50, 0.2);
    padding: 15px 20px;
    border-bottom: 1px solid rgba(255, 50, 50, 0.3);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-panel-header h3 {
    color: #fff;
    font-size: 18px;
    margin: 0;
}

.admin-close-btn {
    background: none;
    border: none;
    color: #fff;
    font-size: 24px;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s;
}

.admin-close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
}

.admin-panel-content {
    padding: 20px;
    overflow-y: auto;
}

.admin-instruction {
    color: rgba(255, 255, 255, 0.7);
    font-size: 14px;
    margin-bottom: 15px;
    text-align: center;
}

.admin-player-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.admin-player-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    padding: 12px 15px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.admin-player-item:hover {
    background: rgba(255, 50, 50, 0.3);
    border-color: rgba(255, 50, 50, 0.5);
    transform: translateX(5px);
}

.admin-player-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.admin-player-name {
    color: #fff;
    font-size: 16px;
    font-weight: bold;
}

.admin-player-details {
    color: rgba(255, 255, 255, 0.6);
    font-size: 12px;
}

.admin-player-kick {
    color: rgba(255, 100, 100, 0.8);
    font-size: 14px;
    font-weight: bold;
}

/* Scrollbar dla listy graczy */
.admin-player-list::-webkit-scrollbar {
    width: 8px;
}

.admin-player-list::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
}

.admin-player-list::-webkit-scrollbar-thumb {
    background: rgba(255, 50, 50, 0.5);
    border-radius: 4px;
}

.admin-player-list::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 50, 50, 0.7);
}

/* Prompt hasła admina */
.admin-prompt {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.admin-prompt.hidden {
    display: none;
}

.admin-prompt-content {
    background: rgba(20, 20, 20, 0.95);
    border: 2px solid rgba(255, 50, 50, 0.8);
    border-radius: 12px;
    padding: 30px;
    min-width: 350px;
    box-shadow: 0 10px 40px rgba(255, 50, 50, 0.3);
}

.admin-prompt-content h3 {
    color: #fff;
    font-size: 20px;
    margin-bottom: 20px;
    text-align: center;
}

#adminPasswordInput {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: #fff;
    font-size: 16px;
    margin-bottom: 20px;
    outline: none;
    transition: all 0.2s;
}

#adminPasswordInput:focus {
    border-color: rgba(255, 50, 50, 0.8);
    background: rgba(255, 255, 255, 0.15);
}

.admin-prompt-buttons {
    display: flex;
    gap: 10px;
}

.admin-btn-submit,
.admin-btn-cancel {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.admin-btn-submit {
    background: rgba(255, 50, 50, 0.8);
    color: #fff;
}

.admin-btn-submit:hover {
    background: rgba(255, 50, 50, 1);
    transform: translateY(-2px);
}

.admin-btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

.admin-btn-cancel:hover {
    background: rgba(255, 255, 255, 0.2);
}
