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

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

main {
    max-width: 1400px;
    margin: 0 auto;
}

#draw-ui {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}

#drawing-section {
    text-align: center;
}

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

h2 {
    color: #666;
    font-size: 1.3em;
    margin-bottom: 20px;
    font-weight: normal;
}

#paint-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 10px;
    margin: 20px auto;
    max-width: 600px;
}

.color-container {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.color-btn {
    width: 35px;
    height: 35px;
    border: 2px solid #333;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

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

.color-btn.selected {
    border: 3px solid #007bff;
    transform: scale(1.2);
}

.tool-btn {
    padding: 8px 16px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    transition: all 0.2s ease;
}

.tool-btn:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.tool-btn.active {
    background: #28a745;
}

.size-control {
    display: flex;
    align-items: center;
    gap: 8px;
}

.size-control label {
    font-size: 14px;
    font-weight: 600;
    color: #333;
}

.size-control input[type="range"] {
    width: 100px;
    cursor: pointer;
}

.size-control .size-display {
    font-size: 14px;
    font-weight: bold;
    color: #007bff;
    min-width: 30px;
}

#draw-canvas {
    border: 3px solid #333;
    border-radius: 10px;
    cursor: crosshair;
    background: white;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    margin: 20px auto;
    display: block;
    max-width: 100%;
    height: auto;
}

nav {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

nav a,
nav button {
    padding: 12px 24px;
    background: #007bff;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

nav a:hover,
nav button:hover {
    background: #0056b3;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.2);
}

#swim-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    font-size: 18px;
    padding: 15px 30px;
}

#swim-btn:hover {
    background: linear-gradient(135deg, #f5576c 0%, #f093fb 100%);
}

#clear-btn {
    background: #dc3545;
}

#clear-btn:hover {
    background: #c82333;
}

/* Modal styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.modal-content {
    background: white;
    padding: 30px;
    border-radius: 15px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.3);
    text-align: center;
}

.modal-content h2 {
    color: #333;
    margin-bottom: 20px;
}

.modal-content input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 16px;
    margin-bottom: 20px;
}

.modal-content input:focus {
    outline: none;
    border-color: #007bff;
}

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

.modal-btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.modal-btn.primary {
    background: #007bff;
    color: white;
}

.modal-btn.primary:hover {
    background: #0056b3;
}

.modal-btn.secondary {
    background: #6c757d;
    color: white;
}

.modal-btn.secondary:hover {
    background: #5a6268;
}

/* Responsive design */
@media (max-width: 768px) {
    h1 {
        font-size: 2em;
    }
    
    h2 {
        font-size: 1em;
    }
    
    #draw-ui {
        padding: 15px;
    }
    
    #draw-canvas {
        max-width: 100%;
    }
    
    nav a,
    nav button {
        padding: 10px 15px;
        font-size: 14px;
    }
}

/* Loading animation */
@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading {
    border: 4px solid #f3f3f3;
    border-top: 4px solid #007bff;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}
