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

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #87CEEB 0%, #98FB98 100%);
    min-height: 100vh;
    overflow: hidden;
    user-select: none;
}

#canvas-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    cursor: pointer;
}

#control-panel {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 200;
    max-width: 280px;
}

#control-toggle {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    color: #333;
    text-align: center;
}

#control-toggle:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#control-content {
    margin-top: 8px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 20px;
    max-height: 80vh;
    overflow-y: auto;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: top left;
    width: 320px;
}

.control-closed, .menu-closed {
    opacity: 0;
    transform: scale(0.8) translateY(-10px);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-open, .menu-open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#control-content h3 {
    margin: 0 0 12px 0;
    color: #2c3e50;
    font-size: 16px;
    font-weight: 600;
    border-bottom: 2px solid #3498db;
    padding-bottom: 4px;
}

.control-group {
    margin-bottom: 20px;
}

.control-group label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 13px;
    color: #2c3e50;
    font-weight: 500;
    transition: color 0.2s ease;
}

.control-group label:hover {
    color: #34495e;
}

.control-group input[type="range"] {
    width: 100%;
    margin: 4px 0;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    border-radius: 4px;
    background: linear-gradient(90deg, #e0e0e0 0%, #f0f0f0 100%);
    outline: none;
    transition: all 0.2s ease;
}

.control-group input[type="range"]:hover {
    background: linear-gradient(90deg, #d0d0d0 0%, #e8e8e8 100%);
}

.control-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: linear-gradient(135deg, #3498db, #2980b9);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    background: linear-gradient(135deg, #2980b9, #1e6091);
    transform: scale(1.1);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
}

.control-group input[type="checkbox"] {
    margin-right: 8px;
    transform: scale(1.2);
}

.control-group input[type="color"] {
    width: 60px;
    height: 35px;
    border: 2px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    margin-left: 10px;
    transition: all 0.2s ease;
}

.control-group input[type="color"]:hover {
    border-color: #3498db;
    box-shadow: 0 2px 8px rgba(52, 152, 219, 0.3);
}

.control-group button {
    background: linear-gradient(135deg, #3498db, #2980b9);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 10px 15px;
    margin: 4px 4px 4px 0;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.control-group button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
    background: linear-gradient(135deg, #2980b9, #1e6091);
}

.control-group button:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#controls {
    top: auto;
    bottom: 20px;
    left: 20px;
    color: white;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    z-index: 100;
    font-size: 14px;
    background: rgba(0,0,0,0.2);
    padding: 10px 15px;
    border-radius: 8px;
    backdrop-filter: blur(5px);
}

#menu-container {
    position: absolute;
    top: 20px;
    right: 20px;
    z-index: 200;
}

#menu-toggle {
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid rgba(0, 0, 0, 0.1);
    border-radius: 8px;
    padding: 10px 15px;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    backdrop-filter: blur(5px);
    transition: all 0.3s ease;
    color: #333;
}

#menu-toggle:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

#dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    width: 320px;
    max-height: 80vh;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    margin-top: 8px;
    overflow: hidden;
    transform-origin: top right;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

#menu-content {
    padding: 20px;
    color: #333;
    font-size: 13px;
    line-height: 1.5;
    max-height: calc(80vh - 40px);
    overflow-y: auto;
    overflow-x: hidden;
}

#menu-content h3 {
    margin: 0 0 12px 0;
    color: #2c3e50;
    font-size: 18px;
    font-weight: 600;
}

#menu-content h4 {
    margin: 16px 0 8px 0;
    color: #34495e;
    font-size: 14px;
    font-weight: 600;
}

#menu-content p {
    margin: 0 0 12px 0;
    text-align: justify;
}

#menu-content ul {
    margin: 0 0 16px 0;
    padding-left: 20px;
}

#menu-content li {
    margin-bottom: 8px;
}

#menu-content details {
    margin-bottom: 12px;
    border-bottom: 1px solid #e0e0e0;
    padding-bottom: 12px;
}

#menu-content details:last-of-type {
    border-bottom: none;
    margin-bottom: 0;
}

#menu-content summary {
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    color: #34495e;
    transition: color 0.2s ease;
    list-style: none; /* Hide default arrow */
    position: relative;
    padding-left: 20px;
}

#menu-content summary::before {
    content: '▶';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%) rotate(0deg);
    transition: transform 0.2s ease;
    font-size: 10px;
}

#menu-content details[open] > summary::before {
    transform: translateY(-50%) rotate(90deg);
}

#menu-content summary:hover {
    color: #2980b9;
}

#menu-content strong {
    color: #2980b9;
}

.tip {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    padding: 12px;
    border-radius: 8px;
    border-left: 4px solid #3498db;
    margin: 16px 0 0 0 !important;
    font-style: italic;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    #controls {
        font-size: 12px;
        padding: 8px 12px;
    }
    
    #menu-container {
        top: 15px;
        right: 15px;
    }
    
    #dropdown-menu {
        width: 280px;
    }
    
    #menu-toggle {
        padding: 8px 12px;
        font-size: 13px;
    }
    
    #menu-content {
        padding: 16px;
        font-size: 12px;
    }
}

@media (max-width: 480px) {
    #controls {
        top: 10px;
        left: 10px;
        font-size: 11px;
    }
    
    #menu-container {
        top: 10px;
        right: 10px;
    }
    
    #dropdown-menu {
        width: 260px;
        right: -20px;
    }
    
    #menu-content h3 {
        font-size: 16px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    canvas {
        image-rendering: -webkit-optimize-contrast;
        image-rendering: crisp-edges;
    }
}

/* Landscape mobile */
@media (max-height: 500px) and (orientation: landscape) {
    #controls {
        top: 5px;
        font-size: 10px;
        padding: 5px 8px;
    }
}

/* Enhanced menu transition effects */
.control-closed, .menu-closed {
    opacity: 0;
    transform: scale(0.8) translateY(-10px);
    pointer-events: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.control-open, .menu-open {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* @tweakable Enhanced hover effects for menu buttons */
#control-toggle:hover, #menu-toggle:hover {
    background: rgba(255, 255, 255, 1);
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* @tweakable Menu content scrollbar styling improvements */
#control-content::-webkit-scrollbar, #menu-content::-webkit-scrollbar {
    width: 8px;
}

#control-content::-webkit-scrollbar-track, #menu-content::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

#control-content::-webkit-scrollbar-thumb, #menu-content::-webkit-scrollbar-thumb {
    background: rgba(52, 152, 219, 0.6);
    border-radius: 4px;
    transition: background 0.3s ease;
}

#control-content::-webkit-scrollbar-thumb:hover, #menu-content::-webkit-scrollbar-thumb:hover {
    background: rgba(52, 152, 219, 0.8);
}

/* Task completion indicators */
.task-completed {
    color: #27ae60;
    font-weight: bold;
}

.task-locked {
    color: #95a5a6;
    font-style: italic;
}

.task-available {
    color: #e67e22;
    font-weight: 500;
}

.progress-indicator {
    display: inline-block;
    margin-right: 8px;
    font-size: 14px;
}

/* Achievement progress bars */
.achievement-progress {
    width: 100%;
    height: 4px;
    background: #ecf0f1;
    border-radius: 2px;
    margin: 4px 0 8px 0;
    overflow: hidden;
}

.achievement-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #3498db, #2980b9);
    transition: width 0.5s ease;
    border-radius: 2px;
}

/* Achievement System */
#achievement-popup {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: white;
    border-radius: 12px;
    padding: 15px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
    transform: translateX(400px);
    transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    max-width: 300px;
}

.achievement-hidden {
    transform: translateX(400px) !important;
}

.achievement-visible {
    transform: translateX(0) !important;
}

.achievement-content {
    display: flex;
    align-items: center;
    gap: 12px;
}

.achievement-icon {
    font-size: 24px;
    background: rgba(255, 255, 255, 0.2);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.achievement-title {
    font-weight: bold;
    font-size: 14px;
    margin-bottom: 2px;
}

.achievement-desc {
    font-size: 12px;
    opacity: 0.9;
}

/* Environmental effect overlays */
#weather-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 50;
}

/* Enhanced select styling */
select {
    background: linear-gradient(135deg, white, #f8f9fa);
    border: 2px solid #ddd;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 12px;
    margin-left: 8px;
    min-width: 130px;
    transition: all 0.2s ease;
}

select:hover {
    border-color: #3498db;
    box-shadow: 0 2px 6px rgba(52, 152, 219, 0.2);
}

select:focus {
    border-color: #2980b9;
    box-shadow: 0 0 0 2px rgba(52, 152, 219, 0.2);
    outline: none;
}

select:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    background: #f5f5f5;
}