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

body {
    font-family: 'Comic Sans MS', 'Comic Sans', 'Arial Rounded MT Bold', cursive, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #333;
    min-height: 100vh;
    overflow: hidden;
}

#app {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

h1 {
    color: white;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
    margin: 0;
}

#lesson-selector {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.9);
    padding: 10px 20px;
    border-radius: 25px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#lesson-selector label {
    font-weight: bold;
    color: #555;
}

#lesson-select {
    padding: 8px 15px;
    border: 2px solid #667eea;
    border-radius: 15px;
    font-size: 1em;
    font-family: inherit;
    background: white;
    cursor: pointer;
    transition: all 0.3s;
}

#lesson-select:hover {
    border-color: #f5576c;
    transform: scale(1.05);
}

main {
    display: flex;
    flex: 1;
    gap: 20px;
    padding: 20px;
    overflow: hidden;
}

#game-area {
    flex: 1;
    background: white;
    border-radius: 20px;
    padding: 10px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    min-width: 0;
}

#canvas {
    border: 3px solid #667eea;
    border-radius: 15px;
    cursor: grab;
    background: #f8f9fa;
    flex: 1;
}

#canvas:active {
    cursor: grabbing;
}

#hint {
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    padding: 10px 15px;
    border-radius: 10px;
    text-align: center;
    font-weight: bold;
    margin-top: 10px;
    color: #2d3436;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#controls {
    display: flex;
    gap: 10px;
    margin-top: 10px;
    justify-content: center;
}

#controls button {
    padding: 12px 24px;
    font-size: 1.1em;
    font-family: inherit;
    font-weight: bold;
    border: none;
    border-radius: 25px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#reset-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

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

#controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.2);
}

#controls button:active {
    transform: translateY(0);
}

#sidebar {
    width: 350px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

#available-molecules {
    background: white;
    border-radius: 20px;
    padding: 20px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    overflow-y: auto;
    max-height: 50%;
}

#available-molecules h2 {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.5em;
}

#molecule-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.molecule-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 15px;
    transition: all 0.3s;
    border: 2px solid transparent;
}

.molecule-item:hover {
    transform: translateX(5px);
}

.molecule-item.discovered {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border-color: #4caf50;
}

.molecule-item .molecule-emoji {
    font-size: 2em;
    min-width: 40px;
    text-align: center;
}

.molecule-item .molecule-details {
    flex: 1;
}

.molecule-item strong {
    display: block;
    color: #333;
    font-size: 1.1em;
}

.molecule-formula {
    color: #666;
    font-size: 0.9em;
    margin-top: 2px;
}

.molecule-item .checkmark {
    color: #4caf50;
    font-size: 1.5em;
    font-weight: bold;
}

#molecule-info {
    background: white;
    border-radius: 20px;
    padding: 25px;
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow-y: auto;
    flex: 1;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#molecule-info.hidden {
    display: none;
}

#close-info {
    position: absolute;
    top: 15px;
    right: 15px;
    background: #ff4444;
    color: white;
    border: none;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    font-size: 1.2em;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

#close-info:hover {
    background: #cc0000;
    transform: rotate(90deg);
}

#molecule-name {
    color: #667eea;
    margin-bottom: 15px;
    font-size: 1.8em;
}

#molecule-formula {
    font-size: 1.3em;
    margin-bottom: 15px;
    color: #555;
}

#molecule-image {
    text-align: center;
    margin: 20px 0;
}

#molecule-image .molecule-emoji {
    font-size: 5em;
}

#molecule-properties p {
    margin: 10px 0;
    line-height: 1.6;
    color: #555;
}

#molecule-properties strong {
    color: #667eea;
    display: block;
    margin-top: 15px;
    margin-bottom: 5px;
}

#molecule-properties ul {
    list-style: none;
    padding-left: 0;
}

#molecule-properties li {
    padding: 8px 0;
    padding-left: 25px;
    position: relative;
}

#molecule-properties li:before {
    content: "✓";
    position: absolute;
    left: 0;
    color: #4caf50;
    font-weight: bold;
}

/* Scrollbar styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 10px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 10px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
}

/* Responsive design */
@media (max-width: 768px) {
    main {
        flex-direction: column;
    }

    #sidebar {
        width: 100%;
        max-height: 40vh;
    }

    h1 {
        font-size: 1.8em;
    }

    header {
        flex-direction: column;
    }
}
