/* Стилі для екрану вибору налаштувань (час + аватар + ім'я) */

#time-select {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    padding: 15px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
}

#time-select h1 {
    text-align: center;
    margin-bottom: 15px;
    color: #fff;
    font-size: 28px;
}

/* Секція введення імені */
.name-input-section {
    margin-bottom: 15px;
    text-align: center;
    width: 100%;
}

.name-input-section h2 {
    color: #fff;
    font-size: 16px;
    margin-bottom: 8px;
}

.name-input-container {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    max-width: 450px;
    margin: 0 auto;
    flex-direction: row-reverse; /* Кубик справа */
}

.player-name-input {
    flex: 1;
    padding: 10px 15px;
    font-size: 16px;
    border: 2px solid #4CAF50;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    text-align: center;
    transition: all 0.3s ease;
    order: 1; /* Поле зліва */
}

.player-name-input:focus {
    outline: none;
    border-color: #45a049;
    background: #fff;
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.player-name-input::placeholder {
    color: #999;
}

.random-name-btn {
    width: 45px;
    height: 45px;
    padding: 0;
    border: 2px solid #4CAF50;
    border-radius: 8px;
    background: rgba(76, 175, 80, 0.2);
    color: #4CAF50;
    font-size: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.random-name-btn:hover {
    background: rgba(76, 175, 80, 0.4);
    transform: rotate(180deg);
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.random-name-btn:active {
    transform: rotate(360deg) scale(0.95);
}

/* Секція вибору аватара */
.avatar-selection-section {
    margin: 0 auto 15px;
    width: 85%;
    max-width: 900px;
}

.avatar-selection-section h2 {
    color: #fff;
    font-size: 18px;
    margin-bottom: 10px;
    text-align: center;
    font-weight: bold;
    text-transform: uppercase;
}

.avatar-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(65px, 65px));
    gap: 8px;
    max-height: 220px;
    overflow-y: auto;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    margin: 0 auto;
    justify-content: center; /* Центруємо аватари */
}

.avatar-option {
    width: 65px;
    height: 65px;
    border: 2px solid transparent;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.1);
}

.avatar-option:hover {
    border-color: #4CAF50;
    transform: scale(1.05);
    box-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
}

.avatar-option.selected {
    border-color: #FFD700;
    background: rgba(255, 215, 0, 0.2);
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
}

.avatar-option img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Секція вибору часу */
.time-settings-container {
    margin-top: 10px;
    width: 100%;
    max-width: 900px;
}

.time-select-section h2 {
    color: #fff;
    font-size: 16px;
    margin-bottom: 8px;
    text-align: center;
}

.time-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-bottom: 15px;
}

.time-option {
    padding: 8px 16px;
    font-size: 14px;
    border: 2px solid #555;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
}

.time-option:hover {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.2);
    transform: translateY(-2px);
}

.time-option.selected {
    border-color: #e74c3c;
    background: rgba(231, 76, 60, 0.3);
    box-shadow: 0 0 10px rgba(231, 76, 60, 0.5);
}

/* Кнопка підтвердження */
#confirm-settings-btn,
#confirm-time-btn {
    display: block;
    margin: 15px auto 0;
    padding: 12px 30px;
    font-size: 18px;
    font-weight: bold;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #000;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
}

#confirm-settings-btn:hover,
#confirm-time-btn:hover {
    background: linear-gradient(135deg, #FFA500, #FFD700);
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(255, 215, 0, 0.5);
}

/* Мобільна адаптація */
@media (max-width: 768px) {
    #time-select {
        padding: 10px;
    }
    
    #time-select h1 {
        font-size: 18px;
        margin-bottom: 10px;
    }
    
    .name-input-section,
    .avatar-selection-section,
    .time-select-section {
        margin-bottom: 10px;
    }
    
    .name-input-section h2,
    .avatar-selection-section h2,
    .time-select-section h2 {
        font-size: 14px;
        margin-bottom: 6px;
    }
    
    .player-name-input {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    .random-name-btn {
        width: 38px;
        height: 38px;
        font-size: 16px;
    }
    
    .avatar-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
        gap: 6px;
        max-height: 180px;
    }
    
    .avatar-option {
        width: 50px;
        height: 50px;
    }
    
    /* Кнопки часу в 2 колонки */
    .time-options {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 8px;
        max-width: 100%;
    }
    
    .time-option {
        padding: 8px 12px;
        font-size: 12px;
        width: 100%;
    }
    
    .time-settings-container {
        margin-bottom: 10px;
    }
    
    #confirm-settings-btn,
    #confirm-time-btn {
        padding: 10px 20px;
        font-size: 14px;
        margin-top: 10px;
    }
}
