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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 20px;
    padding: 30px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

header {
    text-align: center;
    margin-bottom: 30px;
}

header h1 {
    color: #333;
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
}

header p {
    color: #666;
    font-size: 1.1rem;
}


.color-palette {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.color-palette h3 {
    color: #333;
    margin-bottom: 15px;
    text-align: center;
}

.color-options {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.color-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.color-count {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.color-input {
    width: 60px;
    padding: 4px 8px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    text-align: center;
    font-size: 0.9rem;
    font-weight: bold;
    background: white;
    transition: all 0.3s ease;
}

.color-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.color-label {
    font-size: 0.8rem;
    font-weight: bold;
    color: #333;
    text-align: center;
}

.color-option {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    border: 4px solid transparent;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.color-option:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.color-option.selected {
    border-color: #333;
    transform: scale(1.15);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.color-option[data-color="black"] {
    border: 3px solid #fff;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.color-option[data-color="black"]:hover {
    border-color: #007bff;
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.color-option[data-color="black"].selected {
    border-color: #007bff;
    transform: scale(1.15);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.5);
}

.color-option[data-color="white"] {
    border: 3px solid #333;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.color-option[data-color="white"]:hover {
    border-color: #007bff;
    transform: scale(1.1);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}

.color-option[data-color="white"].selected {
    border-color: #007bff;
    transform: scale(1.15);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

.selected-color {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: bold;
    color: #333;
    flex-wrap: wrap;
}

.selected-count {
    background: #e9ecef;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.9rem;
    color: #495057;
}

.bulk-placement {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    flex-wrap: wrap;
}

.bulk-placement label {
    font-weight: bold;
    color: #333;
}

.bulk-placement input {
    width: 80px;
    padding: 8px 12px;
    border: 2px solid #dee2e6;
    border-radius: 6px;
    text-align: center;
    font-size: 1rem;
    font-weight: bold;
}

.bulk-placement input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.1);
}

.selected-tube {
    background: #007bff;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    font-size: 0.9rem;
}

.current-color {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #333;
    background-color: #ddd;
}

.game-area {
    display: flex;
    justify-content: space-around;
    gap: 40px;
    margin-bottom: 30px;
    flex-wrap: wrap;
}

.group {
    background: #fff;
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
    min-width: 300px;
}

.group h3 {
    text-align: center;
    color: #333;
    margin-bottom: 20px;
    font-size: 1.3rem;
}

.tubes {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.tube {
    width: 80px;
    min-height: 200px;
    height: 200px;
    background: linear-gradient(to bottom, #e9ecef, #f8f9fa);
    border: 3px solid #dee2e6;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
}

.tube:hover {
    border-color: #007bff;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 123, 255, 0.3);
}

.tube.selected {
    border-color: #28a745;
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(40, 167, 69, 0.4);
    background: linear-gradient(to bottom, #d4edda, #f8f9fa);
}

.tube.selected .tube-label {
    background: #28a745;
}

.tube-label {
    background: #007bff;
    color: white;
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 0.8rem;
    font-weight: bold;
    margin-top: 5px;
    margin-bottom: 5px;
    position: relative;
    z-index: 10;
    cursor: pointer;
    transition: all 0.3s ease;
    user-select: none;
    text-align: center;
    width: 90%;
}

.tube-label:hover {
    background: #0056b3;
    transform: scale(1.05);
}

.tube-label::after {
    content: ' ✏️';
    font-size: 0.7rem;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tube-label:hover::after {
    opacity: 1;
}

.tube-content {
    flex: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    padding: 0 5px 10px 5px;
    gap: 3px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #007bff #f1f1f1;
}

.tube-content::-webkit-scrollbar {
    width: 6px;
}

.tube-content::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 3px;
}

.tube-content::-webkit-scrollbar-thumb {
    background: #007bff;
    border-radius: 3px;
}

.tube-content::-webkit-scrollbar-thumb:hover {
    background: #0056b3;
}

.bead {
    width: 45px;
    height: 18px;
    border-radius: 9px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    position: relative;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.bead-count {
    font-size: 8px;
    font-weight: bold;
    color: #333;
    background: rgba(255, 255, 255, 0.9);
    padding: 1px 3px;
    border-radius: 3px;
    margin-top: 2px;
    text-align: center;
    min-width: 12px;
    line-height: 1;
}

.bead:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.bead::before {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    right: 1px;
    height: 5px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0.3), transparent);
    border-radius: 7px;
}

.controls {
    display: flex;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
}

.btn {
    background: linear-gradient(45deg, #007bff, #0056b3);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 123, 255, 0.4);
}

.btn:active {
    transform: translateY(0);
}

.btn.clear {
    background: linear-gradient(45deg, #dc3545, #c82333);
    box-shadow: 0 4px 8px rgba(220, 53, 69, 0.3);
}

.btn.clear:hover {
    box-shadow: 0 6px 12px rgba(220, 53, 69, 0.4);
}

@media (max-width: 768px) {
    .game-area {
        flex-direction: column;
        align-items: center;
    }
    
    .tubes {
        flex-wrap: wrap;
    }
    
    .tube {
        width: 70px;
        min-height: 180px;
        height: 180px;
    }
    
    .bead {
        width: 40px;
        height: 16px;
    }
}

/* Advanced Controls */
.advanced-controls {
    background: #f8f9fa;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-around;
    gap: 20px;
    flex-wrap: wrap;
}

.control-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.control-group h3 {
    color: #333;
    font-size: 1rem;
    margin-bottom: 5px;
}

.action-btn {
    min-width: 120px;
    padding: 10px 20px;
    font-size: 0.9rem;
}

/* Statistics */
.statistics {
    background: #fff;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 30px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.statistics h3 {
    color: #333;
    text-align: center;
    margin-bottom: 15px;
}

.stats-content {
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px 20px;
    background: #f8f9fa;
    border-radius: 10px;
}

.stat-label {
    font-size: 0.9rem;
    color: #666;
    font-weight: bold;
}

.stat-value {
    font-size: 1.5rem;
    color: #007bff;
    font-weight: bold;
}

.color-distribution {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 15px;
}

.distribution-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 15px;
    background: #f8f9fa;
    border-radius: 8px;
}

.distribution-color {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 2px solid #dee2e6;
}

.distribution-label {
    flex: 1;
    font-weight: bold;
    color: #333;
}

.distribution-count {
    background: #007bff;
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Keyboard Shortcuts */
.keyboard-shortcuts {
    background: #fff;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.keyboard-shortcuts h3 {
    color: #333;
    text-align: center;
    margin-bottom: 15px;
}

.shortcuts-list {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
}

.shortcut-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: #f8f9fa;
    border-radius: 8px;
    font-size: 0.9rem;
}

kbd {
    background: #333;
    color: white;
    padding: 4px 8px;
    border-radius: 5px;
    font-family: monospace;
    font-weight: bold;
    font-size: 0.85rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Button disabled state */
.btn:disabled {
    cursor: not-allowed;
    opacity: 0.5;
}
