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

body {
    overflow: hidden;
    background: #0a0a1a;
    font-family: 'IBM Plex Sans', sans-serif;
    color: #e0d6c2;
}

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

#scene-container canvas {
    display: block;
}

#header {
    position: fixed;
    top: 16px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Playfair Display', serif;
    font-weight: 900;
    font-size: 20px;
    color: #FFD700;
    text-shadow: 0 0 20px rgba(255, 215, 0, 0.5), 0 2px 4px rgba(0,0,0,0.8);
    letter-spacing: 2px;
    z-index: 100;
    pointer-events: none;
    transition: opacity 0.6s ease;
    white-space: nowrap;
}

#header .header-icon {
    font-size: 18px;
}

#header.hidden {
    opacity: 0;
}

#subtitle-overlay {
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 400;
    font-size: 14px;
    color: #c8bfa0;
    text-shadow: 0 1px 6px rgba(0,0,0,0.9);
    letter-spacing: 3px;
    text-transform: uppercase;
    z-index: 50;
    pointer-events: none;
    text-align: center;
    white-space: nowrap;
}

#controls-toggle {
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(20, 18, 30, 0.85);
    border: 1px solid rgba(255, 215, 0, 0.3);
    color: #FFD700;
    font-size: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 200;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

#controls-toggle:hover {
    border-color: rgba(255, 215, 0, 0.7);
    box-shadow: 0 0 16px rgba(255, 215, 0, 0.3);
    transform: rotate(90deg);
}

#controls-panel {
    position: fixed;
    bottom: 20px;
    left: 80px;
    width: 300px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    background: rgba(14, 12, 24, 0.92);
    border: 1px solid rgba(255, 215, 0, 0.2);
    border-radius: 16px;
    padding: 20px;
    z-index: 190;
    backdrop-filter: blur(20px);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 215, 0, 0.1);
    transform: translateX(-20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

#controls-panel.visible {
    transform: translateX(0);
    opacity: 1;
    pointer-events: all;
}

#controls-panel::-webkit-scrollbar {
    width: 4px;
}
#controls-panel::-webkit-scrollbar-thumb {
    background: rgba(255, 215, 0, 0.3);
    border-radius: 2px;
}

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    font-family: 'Playfair Display', serif;
    font-weight: 700;
    font-size: 16px;
    color: #FFD700;
}

.icon-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 16px;
    cursor: pointer;
    padding: 4px;
    transition: color 0.2s;
}
.icon-btn:hover { color: #FFD700; }

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

.control-group label {
    display: block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: #8a7e66;
    margin-bottom: 6px;
}

.control-group input[type="text"],
.control-group select {
    width: 100%;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 215, 0, 0.15);
    border-radius: 8px;
    color: #e0d6c2;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.control-group input[type="text"]:focus,
.control-group select:focus {
    border-color: rgba(255, 215, 0, 0.5);
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.15);
}

.control-group select {
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23FFD700' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

.control-group select option {
    background: #1a1a2e;
    color: #e0d6c2;
}

.color-options {
    display: flex;
    gap: 8px;
}

.color-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    position: relative;
}

.color-btn:hover {
    transform: scale(1.15);
}

.color-btn.active {
    border-color: #FFD700;
    box-shadow: 0 0 12px rgba(255, 215, 0, 0.4);
}

.control-row {
    margin-bottom: 14px;
}

.toggle-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    user-select: none;
}

.toggle-label input {
    display: none;
}

.toggle-switch {
    width: 38px;
    height: 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    position: relative;
    transition: background 0.3s;
    flex-shrink: 0;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #666;
    top: 2px;
    left: 2px;
    transition: all 0.3s;
}

.toggle-label input:checked + .toggle-switch {
    background: rgba(255, 215, 0, 0.3);
}

.toggle-label input:checked + .toggle-switch::after {
    background: #FFD700;
    left: 20px;
}

.action-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 10px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.25s;
    letter-spacing: 1px;
    margin-bottom: 8px;
}

.play-btn {
    background: linear-gradient(135deg, #FFD700, #B8860B);
    color: #1a1a0a;
    box-shadow: 0 4px 20px rgba(255, 215, 0, 0.3);
}

.play-btn:hover {
    box-shadow: 0 6px 30px rgba(255, 215, 0, 0.5);
    transform: translateY(-1px);
}

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

.capture-btn {
    background: rgba(255, 255, 255, 0.08);
    color: #c8bfa0;
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.capture-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 215, 0, 0.4);
}

#book-easter-egg {
    position: fixed;
    top: 20px;
    right: 20px;
    font-size: 24px;
    cursor: pointer;
    z-index: 100;
    opacity: 0.3;
    transition: all 0.3s;
    user-select: none;
}

#book-easter-egg:hover {
    opacity: 1;
    transform: scale(1.3) rotate(-10deg);
}

.book-float {
    position: fixed;
    z-index: 300;
    pointer-events: none;
    animation: bookFloat 4s ease-in-out forwards;
}

@keyframes bookFloat {
    0% {
        transform: translate(-100px, 50vh) rotate(0deg) scale(0.5);
        opacity: 0;
    }
    10% {
        opacity: 1;
        transform: translate(0px, 45vh) rotate(5deg) scale(1);
    }
    50% {
        transform: translate(50vw, 30vh) rotate(-10deg) scale(1.2);
        opacity: 1;
    }
    90% {
        opacity: 1;
    }
    100% {
        transform: translate(110vw, 20vh) rotate(15deg) scale(0.8);
        opacity: 0;
    }
}

#footer {
    position: fixed;
    bottom: 8px;
    right: 16px;
    z-index: 100;
    font-size: 12px;
}

#footer a {
    color: rgba(255, 215, 0, 0.4);
    text-decoration: none;
    transition: color 0.2s;
}

#footer a:hover {
    color: rgba(255, 215, 0, 0.8);
}

@media (max-width: 600px) {
    #controls-panel {
        left: 10px;
        right: 10px;
        bottom: 10px;
        width: auto;
        max-height: 60vh;
    }
    
    #controls-toggle {
        bottom: 14px;
        left: 14px;
        width: 42px;
        height: 42px;
    }

    #header {
        font-size: 15px;
    }

    #subtitle-overlay {
        font-size: 11px;
        bottom: 60px;
    }
}