/* Base styles */
body {
    font-family: 'Arial', sans-serif;
    background-color: #f0f0f0;
    color: #333;
    margin: 0;
    padding: 20px;
}

/* Layout containers */
#game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    min-height: 100vh;
    background-color: #f5f5f5;
    position: relative;
}

#main-content {
    background-color: #f0f0f0;
    padding: 8px 15px 0;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    width: 100%;
    max-width: 800px;
    margin-top: 10px;
    position: relative;
    display: block;
}

/* Challenge container and layout */
#challenge-container {
    margin: 20px 0;
    text-align: center;
    padding: 15px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
}

.challenge-rows {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 800px;
    margin: 0 auto;
}

.challenge-row {
    display: flex;
    justify-content: center;
    gap: 10px;
}

/* Canvas styles */
#gameCanvas {
    border: 1px solid #ddd;
    border-radius: 8px;
    background-color: white;
    width: 100%;
    max-width: 800px;
    height: 500px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    margin: 5px auto 0;
    display: block;
    image-rendering: -moz-crisp-edges;
    image-rendering: -webkit-crisp-edges;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* Button base styles */
.button-base {
    border: none;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 14px;
}

/* Mode buttons */
#mode-buttons-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 15px;
    width: 100%;
    max-width: 600px;
    padding: 10px 0;
}

.mode-button {
    padding: 12px 24px;
    min-width: 140px;
    font-weight: 600;
    letter-spacing: 0.5px;
    border-radius: 6px;
    background: white;
    color: #555;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
}

.mode-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.mode-button.active {
    color: white;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.1);
}

/* Mode button variants */
.mode-button.active[data-mode="random"] {
    background: linear-gradient(145deg, #2196F3, #1976D2);
    border-color: #1565C0;
}

.mode-button.active[data-mode="challenge"] {
    background: linear-gradient(145deg, #4CAF50, #45a049);
    border-color: #388E3C;
}

.mode-button.active[data-mode="sketch"] {
    background: linear-gradient(145deg, #FF9800, #F57C00);
    border-color: #EF6C00;
}

/* Color palette */
#colorPalette {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    padding: 15px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    min-width: 300px;
}

.color-option {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: all 0.3s ease;
}

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

.color-option.selected {
    border-color: #333;
    transform: scale(1.1);
}

/* Challenge buttons */
.challenge-button {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: white;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.challenge-number {
    font-weight: 600;
    font-size: 16px;
    color: #2E7D32;
    min-width: 100px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.challenge-desc {
    color: #424242;
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.lock-icon {
    font-size: 18px;
    color: #757575;
    margin-right: 8px;
}

.locked {
    background: #f5f5f5;
    cursor: not-allowed;
}

.locked .challenge-number {
    color: #9e9e9e;
}

.challenge-button:not(.locked):hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.08);
}

/* Same colors but with better hover states */
#verticesBtn, button:contains("Vertices") {
    border-color: #43A047;
    color: #2E7D32;
}
#verticesBtn:hover, button:contains("Vertices"):hover {
    background: #f1f8f1;
}

#edgesBtn, button:contains("Edges") {
    border-color: #1E88E5;
    color: #1565C0;
}
#edgesBtn:hover, button:contains("Edges"):hover {
    background: #f1f7fd;
}

#deleteBtn, button:contains("Delete") {
    border-color: #E53935;
    color: #C62828;
}
#deleteBtn:hover, button:contains("Delete"):hover {
    background: #fef5f5;
}

#playBtn, button:contains("Play") {
    border-color: #FB8C00;
    color: #EF6C00;
}
#playBtn:hover, button:contains("Play"):hover {
    background: #fff8f0;
}

/* Same active states but smoother */
.challenge-button.active {
    background: linear-gradient(145deg, #2E7D32, #388E3C) !important;
    border-color: #1B5E20 !important;
    color: #ffffff !important;
    font-weight: 600;
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(46, 125, 50, 0.4);
    text-shadow: 0 1px 2px rgba(0,0,0,0.1);
    letter-spacing: 0.5px;
}

#verticesBtn.active {
    background: #4CAF50 !important;
    border-color: #43A047 !important;
}

#edgesBtn.active {
    background: #2196F3 !important;
    border-color: #1E88E5 !important;
}

#deleteBtn.active {
    background: #f44336 !important;
    border-color: #E53935 !important;
}

#playBtn.active {
    background: #FF9800 !important;
    border-color: #FB8C00 !important;
}

.challenge-button.completed {
    background: linear-gradient(145deg, #f0f7f0, #e8f5e9);
    border: 1px solid #81c784;
}

.challenge-button.completed .challenge-number {
    color: #2E7D32;
}

.challenge-button.completed .challenge-desc {
    color: #43A047;
    font-weight: 500;
}

/* Game messages */
.game-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 20px 30px;
    border-radius: 12px;
    text-align: center;
    z-index: 9999;
    box-shadow: 0 4px 20px rgba(0,0,0,0.2);
    background: rgba(255, 255, 255, 0.95);
    transition: opacity 1s ease;
}

.game-message h3 {
    margin: 0 0 10px;
    font-size: 24px;
}

.game-message p {
    margin: 0;
    font-size: 16px;
}

/* Message variants */
.game-message.perfect {
    border: 2px solid #4CAF50;
}

.game-message.success {
    border: 2px solid #2196F3;
}

.game-message.error {
    border: 2px solid #f44336;
}

.game-message.exceptional {
    border: 2px solid #FFC107;
}

/* Sketch mode buttons */
.sketch-button {
    padding: 4px 16px;
    border: 2px solid #e0e0e0;
    min-width: 70px;
    height: 25px;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.sketch-button:hover {
    background: #f8f9fa;
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.sketch-button.active {
    color: white;
    border: none;
}

/* Sketch button variants */
#verticesBtn.active { 
    background: #4CAF50 !important; /* Green */
    color: white !important;
    border-color: #4CAF50 !important;
}

#edgesBtn.active { 
    background: #2196F3 !important; /* Blue */
    color: white !important;
    border-color: #2196F3 !important;
}

#deleteBtn.active { 
    background: #f44336 !important; /* Red */
    color: white !important;
    border-color: #f44336 !important;
}

#playBtn.active { 
    background: #FF9800 !important; /* Orange */
    color: white !important;
    border-color: #FF9800 !important;
}

#resetBtn { 
    background: #757575 !important; /* Gray */
    color: white !important;
    border-color: #757575 !important;
}

/* Add hover states */
#verticesBtn:hover { background: #45a049; }
#edgesBtn:hover { background: #1e88e5; }
#deleteBtn:hover { background: #e53935; }
#playBtn:hover { background: #fb8c00; }
#resetBtn:hover { background: #616161; }

/* Responsive styles */
@media (max-width: 768px) {
    #game-container {
        padding: 10px;
    }
    
    #controls {
        flex-direction: column;
    }
    
    #controls label, 
    #controls input, 
    #controls button, 
    #controls select {
        margin: 5px 0;
        width: 100%;
    }
    
    .color-option {
        width: 40px;
        height: 40px;
    }

    .challenge-row {
        flex-wrap: wrap;
    }

    .challenge-button {
        min-width: 70px;
        flex: 0 0 calc(25% - 10px);
    }
}

/* Utility classes */
.hidden {
    display: none;
}

/* Animations */
@keyframes completeChallenge {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Add specific styles for each color button */
.color-button[data-color="#f44336"] { order: 1; }  /* red */
.color-button[data-color="#2196F3"] { order: 2; }  /* blue */
.color-button[data-color="#4CAF50"] { order: 3; }  /* green */
.color-button[data-color="#FFC107"] { order: 4; }  /* yellow */
.color-button[data-color="#1a237e"] { order: 5; }  /* dark blue */
.color-button[data-color="#9C27B0"] { order: 6; }  /* purple */
.color-button[data-color="#FF9800"] { order: 7; }  /* orange */

/* Challenge container styles */
.challenge-container {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 20px;
    background: white;
    border-radius: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
}

.challenge-container:hover {
    transform: translateY(-1px);
    box-shadow: 0 3px 8px rgba(0,0,0,0.08);
}

/* Challenge icon/number styles */
.challenge-icon {
    font-size: 20px;
    min-width: 30px;
    color: #2E7D32; /* Same green as active buttons */
}

.about-container {
    margin-top: 20px;
    text-align: center;
}

.about-content {
    color: #666;
    font-size: 0.9em;
}

.author {
    font-weight: 600;
    color: #2196F3;
    cursor: pointer;
    transition: color 0.3s ease;
}

.author:hover {
    color: #1976D2;
    text-decoration: underline;
}