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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: linear-gradient(135deg, #050510 0%, #1a1a3e 30%, #2d1b69 60%, #0f0f23 100%);
    overflow: hidden;
    color: white;
    user-select: none;
    touch-action: none;
    position: relative;
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 20%, rgba(74, 144, 226, 0.1) 0%, transparent 50%),
                radial-gradient(circle at 70% 80%, rgba(226, 74, 144, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

#scene-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1;
}

/* Enhanced Camera Control Panel */
.camera-panel {
    position: fixed;
    top: 20px;
    left: 20px;
    z-index: 100;
    width: 280px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.camera-panel.collapsed .panel-content {
    display: none;
}

/* Enhanced HUD Styles */
.hud {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    gap: 25px;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 20px;
    padding: 20px 30px;
    transition: all 0.4s ease;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.metric {
    text-align: center;
    min-width: 70px;
    position: relative;
}

.metric.premium::before {
    content: '✨';
    position: absolute;
    top: -8px;
    right: -8px;
    font-size: 12px;
    opacity: 0.8;
}

.metric .label {
    display: block;
    font-size: 11px;
    color: #aaa;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.metric .value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    color: #4a90e2;
    text-shadow: 0 0 10px rgba(74, 144, 226, 0.5);
    transition: all 0.3s ease;
}

/* Enhanced Control Panel */
.control-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 100;
    width: 320px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.control-panel.collapsed .panel-content,
.camera-panel.collapsed .panel-content,
.leaderboard-panel.collapsed .panel-content {
    display: none;
}

/* Leaderboard Panel */
.leaderboard-panel {
    position: fixed;
    top: 20px;
    right: 360px;
    z-index: 99;
    width: 280px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 20px;
    overflow: hidden;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.2), rgba(74, 144, 226, 0.1));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.panel-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: #4a90e2;
    display: flex;
    align-items: center;
    gap: 10px;
    text-shadow: 0 0 10px rgba(74, 144, 226, 0.3);
}

.toggle-btn {
    background: rgba(74, 144, 226, 0.2);
    border: 1px solid rgba(74, 144, 226, 0.4);
    color: #4a90e2;
    font-size: 18px;
    cursor: pointer;
    padding: 8px 12px;
    border-radius: 10px;
    transition: all 0.3s ease;
    min-width: 35px;
    font-weight: bold;
}

.toggle-btn:hover {
    background: rgba(74, 144, 226, 0.4);
    transform: scale(1.05);
}

.panel-content {
    padding: 25px;
}

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

.control-group label {
    display: block;
    font-size: 12px;
    color: #ccc;
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Enhanced View Buttons */
.view-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 15px;
}

.view-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    padding: 12px 15px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    position: relative;
    overflow: hidden;
}

.view-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.view-btn:hover::before {
    left: 100%;
}

.view-btn:hover {
    background: rgba(74, 144, 226, 0.3);
    border-color: #4a90e2;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.view-btn.active {
    background: linear-gradient(135deg, #4a90e2, #357abd);
    border-color: #4a90e2;
    box-shadow: 0 0 20px rgba(74, 144, 226, 0.5);
}

/* Color Presets */
.color-presets {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.color-preset {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.color-preset:hover {
    transform: scale(1.2);
    border-color: white;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

/* Physics Grid */
.physics-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 15px;
}

.physics-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.physics-item span:first-child {
    min-width: 60px;
    font-size: 11px;
    color: #aaa;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.physics-item span:last-child {
    min-width: 40px;
    font-size: 12px;
    color: #4a90e2;
    font-weight: 600;
}

.control-group select,
.control-group input[type="color"],
.control-group input[type="range"] {
    width: 100%;
    margin-bottom: 8px;
}

.control-group select {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    color: white;
    padding: 12px 15px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-group select:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: #4a90e2;
}

.control-group input[type="color"] {
    height: 45px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    background: none;
}

.control-group input[type="range"] {
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.control-group input[type="range"]:hover {
    background: rgba(255, 255, 255, 0.3);
}

.control-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.5);
    transition: all 0.3s ease;
}

.control-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 15px rgba(74, 144, 226, 0.8);
}

.control-group input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.5);
}

.button-group {
    display: flex;
    gap: 12px;
}

.button-row {
    display: flex;
    gap: 10px;
}

.action-btn {
    flex: 1;
    padding: 15px 20px;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.action-btn:hover::before {
    left: 100%;
}

.action-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(74, 144, 226, 0.4);
}

.action-btn.secondary {
    background: linear-gradient(135deg, #666, #444);
}

.action-btn.secondary:hover {
    box-shadow: 0 8px 25px rgba(255, 255, 255, 0.2);
}

.action-btn.epic {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    animation: epicPulse 2s infinite;
}

.action-btn.zen {
    background: linear-gradient(135deg, #48cae4, #0096c7);
}

.action-btn.recording {
    background: linear-gradient(135deg, #ff4757, #c44569);
    animation: recordingPulse 1s infinite;
}

@keyframes epicPulse {
    0%, 100% { box-shadow: 0 0 20px rgba(255, 107, 107, 0.4); }
    50% { box-shadow: 0 0 30px rgba(255, 107, 107, 0.8); }
}

@keyframes recordingPulse {
    0%, 100% { box-shadow: 0 0 15px rgba(255, 71, 87, 0.6); }
    50% { box-shadow: 0 0 25px rgba(255, 71, 87, 1); }
}

.control-group input[type="checkbox"] {
    margin-right: 10px;
    transform: scale(1.3);
    accent-color: #4a90e2;
}

/* Leaderboard Styles */
.leaderboard-section {
    margin-bottom: 20px;
}

.leaderboard-section h4 {
    color: #ffd700;
    font-size: 14px;
    margin-bottom: 10px;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
}

.leader-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.leader-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    font-size: 12px;
}

.leader-item .rank {
    color: #ffd700;
    font-weight: 700;
    min-width: 20px;
}

.leader-item .name {
    flex: 1;
    color: #ccc;
}

.leader-item .score {
    color: #4a90e2;
    font-weight: 600;
}

.achievement-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.achievement-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 8px;
    border-radius: 8px;
    font-size: 10px;
    text-align: center;
    transition: all 0.3s ease;
}

.achievement-badge.earned {
    background: rgba(255, 215, 0, 0.2);
    border: 1px solid rgba(255, 215, 0, 0.4);
    color: #ffd700;
}

.achievement-badge.locked {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #666;
}

.achievement-icon {
    font-size: 16px;
}

.achievement-name {
    font-size: 9px;
    line-height: 1.2;
}

/* Enhanced Touch Hints */
.touch-hints {
    position: fixed;
    bottom: 150px;
    right: 20px;
    z-index: 200;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 15px;
    padding: 20px;
    opacity: 0;
    transform: translateX(100%);
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 220px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.touch-hints.visible {
    opacity: 1;
    transform: translateX(0);
}

.hint-item {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
    font-size: 12px;
}

.hint-item:last-child {
    margin-bottom: 0;
}

.touch-icon {
    font-size: 18px;
    width: 28px;
    text-align: center;
}

.hint-text {
    color: #ccc;
    line-height: 1.4;
}

/* Enhanced Toolbar */
.toolbar {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
    display: flex;
    align-items: center;
    gap: 25px;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 30px;
    padding: 20px 35px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.toolbar-left,
.toolbar-right {
    display: flex;
    gap: 12px;
}

.tool-btn {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    color: white;
    padding: 10px 18px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.tool-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.tool-btn:hover::before {
    left: 100%;
}

.tool-btn:hover {
    background: rgba(74, 144, 226, 0.3);
    border-color: #4a90e2;
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(74, 144, 226, 0.3);
}

.tool-btn.active {
    background: rgba(74, 144, 226, 0.5);
    border-color: #4a90e2;
    box-shadow: 0 0 20px rgba(74, 144, 226, 0.5);
}

/* Enhanced Satisfaction Meter */
.satisfaction-meter {
    text-align: center;
    min-width: 200px;
}

.meter-label {
    font-size: 11px;
    color: #ccc;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.satisfaction-bar {
    width: 200px;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
    position: relative;
}

.satisfaction-fill {
    height: 100%;
    background: linear-gradient(90deg, #4a90e2, #48cae4);
    transition: width 0.3s ease;
    border-radius: 4px;
    box-shadow: 0 0 10px rgba(74, 144, 226, 0.5);
}

.meter-indicators {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

/* Enhanced Instructions */
.instructions {
    position: fixed;
    bottom: 20px;
    left: 20px;
    z-index: 100;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 15px;
    padding: 20px;
    max-width: 220px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.instruction-category {
    margin-bottom: 15px;
}

.instruction-category:last-child {
    margin-bottom: 0;
}

.instruction-category h4 {
    color: #4a90e2;
    font-size: 12px;
    margin-bottom: 8px;
    text-shadow: 0 0 10px rgba(74, 144, 226, 0.3);
}

.instruction-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-size: 11px;
}

.instruction-item:last-child {
    margin-bottom: 0;
}

.instruction-item .key {
    color: #4a90e2;
    font-weight: 700;
    font-family: 'Courier New', monospace;
    text-shadow: 0 0 5px rgba(74, 144, 226, 0.3);
}

.instruction-item .action {
    color: #ccc;
}

/* Enhanced Achievements */
.achievements {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    background: linear-gradient(135deg, #4a90e2, #357abd);
    border: 3px solid #ffd700;
    border-radius: 20px;
    padding: 30px 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    animation: achievementPop 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 300px;
}

.achievements.hidden {
    display: none;
}

.achievement-content h4 {
    font-size: 18px;
    margin-bottom: 15px;
    color: #ffd700;
    text-shadow: 0 0 15px rgba(255, 215, 0, 0.5);
}

#achievement-text {
    font-size: 16px;
    color: white;
    line-height: 1.4;
    margin-bottom: 10px;
}

#achievement-progress {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
}

@keyframes achievementPop {
    0% { 
        transform: translate(-50%, -50%) scale(0.3) rotate(-10deg); 
        opacity: 0; 
    }
    50% { 
        transform: translate(-50%, -50%) scale(1.1) rotate(2deg); 
        opacity: 1; 
    }
    100% { 
        transform: translate(-50%, -50%) scale(1) rotate(0deg); 
        opacity: 1; 
    }
}

/* Social Feed */
.social-feed {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1000;
    width: 400px;
    max-height: 500px;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(74, 144, 226, 0.3);
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.social-feed.hidden {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.8);
    pointer-events: none;
}

.feed-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 25px;
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.2), rgba(74, 144, 226, 0.1));
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.feed-header h3 {
    color: #4a90e2;
    font-size: 16px;
    text-shadow: 0 0 10px rgba(74, 144, 226, 0.3);
}

.close-btn {
    background: none;
    border: none;
    color: #ccc;
    font-size: 20px;
    cursor: pointer;
    padding: 5px;
    border-radius: 50%;
    transition: all 0.3s ease;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: white;
}

.feed-content {
    padding: 20px 25px;
    max-height: 400px;
    overflow-y: auto;
}

.feed-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 12px;
}

.feed-item:last-child {
    border-bottom: none;
}

.feed-item .user {
    color: #4a90e2;
    font-weight: 600;
    min-width: 80px;
}

.feed-item .action {
    color: #ccc;
    flex: 1;
}

.feed-item .time {
    color: #888;
    font-size: 10px;
}

/* Footer Attribution */
.footer-attribution {
    position: fixed;
    bottom: 10px;
    right: 10px;
    z-index: 50;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.footer-attribution:hover {
    opacity: 1;
}

.footer-attribution a {
    color: #4a90e2;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    text-shadow: 0 0 10px rgba(74, 144, 226, 0.3);
}

/* Zen Mode */
body.zen-mode .control-panel,
body.zen-mode .camera-panel,
body.zen-mode .leaderboard-panel,
body.zen-mode .instructions,
body.zen-mode .toolbar,
body.zen-mode .footer-attribution {
    opacity: 0.05;
    transition: opacity 0.8s ease;
}

body.zen-mode .control-panel:hover,
body.zen-mode .camera-panel:hover,
body.zen-mode .leaderboard-panel:hover,
body.zen-mode .instructions:hover,
body.zen-mode .toolbar:hover,
body.zen-mode .footer-attribution:hover {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .hud {
        left: 10px;
        top: 10px;
        transform: none;
        flex-wrap: wrap;
        gap: 15px;
        width: calc(100vw - 20px);
        max-width: 400px;
        padding: 15px 20px;
    }

    .metric {
        min-width: 60px;
    }

    .camera-panel {
        width: calc(100vw - 40px);
        left: 20px;
        top: 100px;
    }

    .control-panel {
        width: calc(100vw - 40px);
        right: 20px;
        top: 260px;
    }

    .leaderboard-panel {
        width: calc(100vw - 40px);
        right: 20px;
        top: 420px;
    }

    .touch-hints {
        bottom: 160px;
        right: 10px;
        left: 10px;
        transform: translateY(100%);
        min-width: auto;
    }

    .touch-hints.visible {
        transform: translateY(0);
    }

    .toolbar {
        bottom: 10px;
        padding: 15px 20px;
        flex-wrap: wrap;
        gap: 12px;
        left: 10px;
        right: 10px;
        transform: none;
        width: calc(100vw - 20px);
    }

    .toolbar-center {
        order: 3;
        width: 100%;
    }

    .satisfaction-meter {
        min-width: auto;
    }

    .satisfaction-bar {
        width: 100%;
    }

    .instructions {
        bottom: 100px;
        font-size: 10px;
        left: 10px;
        max-width: 180px;
    }

    .view-buttons {
        grid-template-columns: 1fr 1fr 1fr;
        gap: 8px;
    }

    .button-group {
        flex-direction: column;
        gap: 10px;
    }

    .action-btn {
        width: 100%;
    }

    .social-feed {
        width: calc(100vw - 40px);
        max-width: 350px;
    }
}

@media (max-width: 480px) {
    .metric {
        min-width: 45px;
    }

    .metric .value {
        font-size: 16px;
    }

    .hud {
        padding: 12px 15px;
        gap: 10px;
    }

    .camera-panel,
    .control-panel,
    .leaderboard-panel {
        width: calc(100vw - 20px);
        left: 10px;
        right: 10px;
    }

    .camera-panel {
        top: 80px;
    }

    .control-panel {
        top: 220px;
    }

    .leaderboard-panel {
        top: 360px;
    }

    .view-buttons {
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .view-btn {
        padding: 10px 12px;
        font-size: 10px;
    }

    .physics-grid {
        gap: 10px;
    }

    .physics-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 5px;
    }

    .achievement-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Portrait/Landscape optimizations */
@media (orientation: portrait) and (max-width: 768px) {
    .hud {
        justify-content: space-between;
        width: calc(100vw - 20px);
    }

    .instructions {
        display: none;
    }

    .camera-panel,
    .control-panel,
    .leaderboard-panel {
        max-height: 25vh;
        overflow-y: auto;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    .camera-panel,
    .control-panel,
    .leaderboard-panel {
        top: 10px;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
    }

    .hud {
        top: 5px;
        padding: 10px 15px;
    }

    .toolbar {
        bottom: 5px;
        padding: 10px 15px;
    }
}

/* High DPI displays */
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
    .panel-content {
        font-size: 14px;
    }

    .tool-btn {
        font-size: 13px;
    }
}

/* Custom scrollbar */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.6), rgba(74, 144, 226, 0.8));
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: linear-gradient(135deg, rgba(74, 144, 226, 0.8), rgba(74, 144, 226, 1));
}

/* Smooth transitions for all interactive elements */
button, select, input {
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

button:focus, select:focus, input:focus {
    outline: 2px solid #4a90e2;
    outline-offset: 2px;
}

/* Loading animations */
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes glow {
    0%, 100% { box-shadow: 0 0 20px rgba(74, 144, 226, 0.3); }
    50% { box-shadow: 0 0 30px rgba(74, 144, 226, 0.8); }
}

.spinner-loading {
    animation: spin 2s linear infinite;
}

.glow-effect {
    animation: glow 2s ease-in-out infinite;
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode preference handling */
@media (prefers-color-scheme: dark) {
    body {
        background: linear-gradient(135deg, #000000 0%, #1a1a3e 30%, #2d1b69 60%, #0f0f23 100%);
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .panel-header,
    .hud,
    .toolbar,
    .control-panel,
    .camera-panel,
    .leaderboard-panel {
        border-color: white;
        background: rgba(0, 0, 0, 0.9);
    }

    .metric .value,
    .panel-header h3 {
        color: #ffffff;
        text-shadow: none;
    }
}

/* Special effects for premium experience */
.premium-glow {
    box-shadow: 0 0 30px rgba(74, 144, 226, 0.6);
    border: 2px solid rgba(74, 144, 226, 0.8);
}

.satisfaction-burst {
    animation: satisfactionBurst 0.8s ease-out;
}

@keyframes satisfactionBurst {
    0% { transform: scale(1); }
    50% { transform: scale(1.2); filter: brightness(1.5); }
    100% { transform: scale(1); }
}