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

body {
    font-family: 'Inter', sans-serif;
    overflow: hidden;
    background: linear-gradient(to bottom, #87CEEB, #E0F6FF);
}

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

/* Header */
.header {
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    z-index: 100;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.logo {
    font-size: 24px;
}

.title-block h1 {
    font-family: 'Press Start 2P', cursive;
    font-size: 14px;
    color: #E91E63;
    margin-bottom: 4px;
}

.title-block p {
    font-size: 11px;
    color: #FFC107;
}

.header-center {
    display: flex;
    gap: 12px;
}

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 6px;
}

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

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

.btn-randomize {
    background: linear-gradient(135deg, #FF9800, #FF5722);
    color: white;
}

.btn-chicken {
    background: linear-gradient(135deg, #FFC107, #FFD54F);
    color: #333;
}

.btn-share {
    background: linear-gradient(135deg, #4CAF50, #8BC34A);
    color: white;
}

.header-right {
    display: flex;
    gap: 12px;
    align-items: center;
}

.theme-select {
    padding: 8px 12px;
    border-radius: 6px;
    border: 2px solid #E91E63;
    background: white;
    font-weight: 600;
    cursor: pointer;
}

.reset-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: none;
    background: #F44336;
    color: white;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
}

.reset-btn:hover {
    transform: rotate(180deg);
}

/* Main Layout */
.main-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* Left Sidebar */
.left-sidebar {
    width: 320px;
    background: #F5F5F5;
    display: flex;
    flex-direction: column;
    box-shadow: 2px 0 10px rgba(0,0,0,0.1);
    z-index: 50;
}

.sidebar-header {
    padding: 20px;
    background: white;
    border-bottom: 2px solid #E0E0E0;
}

.sidebar-header h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 12px;
}

.add-lane-btn {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #E91E63, #C2185B);
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

.add-lane-btn:hover {
    transform: scale(1.02);
}

.lanes-container {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
}

.lane-card {
    background: white;
    border-radius: 8px;
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: move;
    transition: all 0.2s;
}

.lane-card:hover {
    box-shadow: 0 4px 12px rgba(0,0,0,0.2);
}

.lane-card.grass {
    background: linear-gradient(to bottom, #E8F5E9, white);
}

.lane-card.road {
    background: linear-gradient(to bottom, #E0E0E0, white);
}

.lane-card.river {
    background: linear-gradient(to bottom, #E3F2FD, white);
}

.lane-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.lane-number {
    background: #E91E63;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.lane-type-select {
    padding: 6px 12px;
    border-radius: 6px;
    border: 2px solid #E91E63;
    font-weight: 600;
    cursor: pointer;
}

.delete-btn {
    background: #F44336;
    color: white;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
}

.delete-btn:hover {
    transform: scale(1.1);
}

.lane-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-label {
    font-size: 12px;
    font-weight: 600;
    color: #555;
}

.slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: #E0E0E0;
    outline: none;
    -webkit-appearance: none;
}

.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #E91E63;
    cursor: pointer;
}

.slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #E91E63;
    cursor: pointer;
    border: none;
}

.checkbox-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.checkbox-group input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.direction-toggle {
    display: flex;
    gap: 8px;
}

.direction-btn {
    flex: 1;
    padding: 8px;
    border: 2px solid #E0E0E0;
    background: white;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.direction-btn.active {
    background: #E91E63;
    color: white;
    border-color: #E91E63;
}

.vehicle-types {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.vehicle-chip {
    padding: 6px 12px;
    border: 2px solid #E0E0E0;
    background: white;
    border-radius: 16px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s;
}

.vehicle-chip.active {
    background: #E91E63;
    color: white;
    border-color: #E91E63;
}

.sidebar-footer {
    padding: 16px;
    background: white;
    border-top: 2px solid #E0E0E0;
    text-align: center;
}

.creation-score {
    font-weight: 700;
    color: #E91E63;
    font-size: 16px;
}

/* Canvas Area */
.canvas-area {
    flex: 1;
    position: relative;
}

#scene-container {
    width: 100%;
    height: 100%;
}

.fps-counter {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(0,0,0,0.7);
    color: #0F0;
    padding: 6px 12px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    font-size: 12px;
}

.camera-controls {
    position: absolute;
    bottom: 20px;
    right: 20px;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(10px);
    padding: 12px;
    border-radius: 12px;
    display: flex;
    gap: 8px;
}

.camera-btn {
    width: 40px;
    height: 40px;
    background: rgba(255,255,255,0.2);
    border: 2px solid white;
    color: white;
    border-radius: 8px;
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
}

.camera-btn:hover {
    background: rgba(255,255,255,0.3);
    transform: scale(1.1);
}

.chicken-status {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 18px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -60%);
    }
    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Right Sidebar */
.right-sidebar {
    width: 280px;
    background: white;
    box-shadow: -2px 0 10px rgba(0,0,0,0.1);
    z-index: 50;
    overflow-y: auto;
    padding: 20px;
}

.color-studio h2 {
    font-size: 18px;
    font-weight: 700;
    margin-bottom: 16px;
}

.theme-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 24px;
}

.theme-card {
    padding: 12px;
    border: 2px solid #E0E0E0;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.theme-card:hover {
    transform: scale(1.05);
    border-color: #E91E63;
}

.theme-preview {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
    justify-content: center;
}

.theme-color {
    width: 24px;
    height: 24px;
    border-radius: 4px;
}

.theme-name {
    font-size: 11px;
    font-weight: 600;
}

.color-pickers {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.color-group h3 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: #555;
}

.color-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.color-picker-wrapper {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid #E0E0E0;
    cursor: pointer;
    overflow: hidden;
}

.color-picker-wrapper input[type="color"] {
    width: 100%;
    height: 100%;
    border: none;
    cursor: pointer;
}

.color-label {
    flex: 1;
    font-size: 13px;
}

.save-palette-btn {
    width: 100%;
    padding: 12px;
    background: #8BC34A;
    color: white;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 16px;
    transition: all 0.2s;
}

.save-palette-btn:hover {
    background: #7CB342;
}

/* Footer */
.footer {
    background: rgba(0,0,0,0.8);
    color: white;
    padding: 12px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    z-index: 100;
}

.footer a {
    color: #E91E63;
    text-decoration: none;
    font-weight: 600;
}

.footer a:hover {
    color: #FFC107;
}

/* Loading State */
.loading-message {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 20px 40px;
    border-radius: 12px;
    font-size: 16px;
    text-align: center;
}

/* Share Modal */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal {
    background: white;
    border-radius: 16px;
    padding: 32px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

.modal h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: #E91E63;
}

.share-url {
    background: #F5F5F5;
    padding: 12px;
    border-radius: 8px;
    word-break: break-all;
    margin-bottom: 16px;
    font-family: monospace;
}

.modal-buttons {
    display: flex;
    gap: 12px;
}

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

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

.modal-btn.secondary {
    background: #E0E0E0;
    color: #333;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .header-center {
        flex-direction: column;
        gap: 6px;
    }
    
    .btn {
        padding: 8px 12px;
        font-size: 12px;
    }
    
    .title-block h1 {
        font-size: 10px;
    }
    
    .left-sidebar,
    .right-sidebar {
        position: fixed;
        bottom: 0;
        width: 100%;
        height: 50vh;
        transform: translateY(calc(100% - 60px));
        transition: transform 0.3s;
    }
    
    .left-sidebar.open,
    .right-sidebar.open {
        transform: translateY(0);
    }
}

/* Tooltip */
.tooltip {
    position: absolute;
    background: rgba(0,0,0,0.9);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    pointer-events: none;
    z-index: 1000;
    animation: fadeIn 0.2s;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* Scrollbar */
.lanes-container::-webkit-scrollbar {
    width: 8px;
}

.lanes-container::-webkit-scrollbar-track {
    background: #F5F5F5;
}

.lanes-container::-webkit-scrollbar-thumb {
    background: #E91E63;
    border-radius: 4px;
}

.lanes-container::-webkit-scrollbar-thumb:hover {
    background: #C2185B;
}