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

:root {
    --gold: #C47B2C;
    --gold-dark: #8C5C2B;
    --gold-light: #D4A04A;
    --cream: #FFFAEB;
    --cream-dark: #F5EED9;
    --text-dark: #4A3520;
    --text-muted: #8B7355;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--cream);
    color: var(--text-dark);
    overflow: hidden;
}

/* Unity Container */
#unity-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--cream);
}

#unity-container.unity-desktop {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

#unity-container.unity-mobile {
    width: 100%;
    height: 100%;
}

#unity-canvas {
    background: #000;
    border-radius: 8px;
    box-shadow: 0 8px 40px rgba(140, 92, 43, 0.2);
}

#unity-canvas.unity-mobile {
    width: 100%;
    height: 100%;
    border-radius: 0;
}

/* Loading Bar */
#unity-loading-bar {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: none;
}

#unity-logo {
    width: 154px;
    height: 130px;
    background: url('unity-logo-light.png') no-repeat center;
    margin: 0 auto 20px;
}

#unity-progress-bar-empty {
    width: 200px;
    height: 8px;
    background: var(--cream-dark);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(140, 92, 43, 0.2);
}

#unity-progress-bar-full {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, var(--gold-light) 0%, var(--gold) 50%, var(--gold-dark) 100%);
    transition: width 0.1s ease;
}

/* Warning Banner */
#unity-warning {
    position: absolute;
    left: 50%;
    top: 10px;
    transform: translateX(-50%);
    max-width: 600px;
    z-index: 1000;
}

/* Footer */
#unity-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    background: rgba(255, 250, 235, 0.95);
    backdrop-filter: blur(8px);
    border-top: 1px solid rgba(140, 92, 43, 0.15);
    z-index: 100;
}

.unity-mobile #unity-footer {
    display: none;
}

#unity-build-title {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 16px;
    font-weight: 600;
    color: var(--gold-dark);
}

#unity-fullscreen-button {
    width: 32px;
    height: 32px;
    background: url('fullscreen-button.png') no-repeat center center;
    background-size: contain;
    cursor: pointer;
    opacity: 0.7;
    transition: opacity 0.2s ease;
}

#unity-fullscreen-button:hover {
    opacity: 1;
}

#unity-logo-title-footer {
    display: none;
}

/* Back Button */
.back-button {
    position: fixed;
    top: 20px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(140, 92, 43, 0.2);
    border-radius: 8px;
    color: var(--gold-dark);
    text-decoration: none;
    font-size: 14px;
    font-weight: 500;
    z-index: 200;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(140, 92, 43, 0.1);
}

.back-button:hover {
    background: rgba(196, 123, 44, 0.1);
    border-color: var(--gold);
    box-shadow: 0 4px 12px rgba(196, 123, 44, 0.2);
}

.back-icon {
    font-size: 18px;
}

/* Controls Panel */
.controls-panel {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 200;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.controls-toggle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.95);
    border: 1px solid rgba(140, 92, 43, 0.2);
    color: var(--gold-dark);
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    backdrop-filter: blur(8px);
    box-shadow: 0 2px 8px rgba(140, 92, 43, 0.1);
}

.controls-toggle:hover {
    background: rgba(196, 123, 44, 0.1);
    border-color: var(--gold);
}

.toggle-icon {
    line-height: 1;
}

.controls-content {
    display: none;
    margin-top: 12px;
    padding: 20px;
    background: rgba(255, 255, 255, 0.98);
    border: 1px solid rgba(140, 92, 43, 0.15);
    border-radius: 12px;
    min-width: 280px;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(140, 92, 43, 0.15);
}

.controls-panel.expanded .controls-content {
    display: block;
    animation: slideIn 0.2s ease;
}

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

.controls-content h3 {
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(140, 92, 43, 0.15);
    color: var(--gold-dark);
}

.control-section {
    margin-bottom: 16px;
}

.control-section:last-child {
    margin-bottom: 0;
}

.control-section h4 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--gold);
    margin-bottom: 8px;
}

.control-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 0;
    font-size: 13px;
    color: var(--text-muted);
}

.key {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 80px;
    padding: 4px 8px;
    background: rgba(196, 123, 44, 0.1);
    border: 1px solid rgba(196, 123, 44, 0.25);
    border-radius: 4px;
    font-size: 11px;
    font-weight: 500;
    color: var(--gold-dark);
    text-align: center;
}

/* Scrollbar for controls */
.controls-content::-webkit-scrollbar {
    width: 6px;
}

.controls-content::-webkit-scrollbar-track {
    background: transparent;
}

.controls-content::-webkit-scrollbar-thumb {
    background: var(--gold-light);
    border-radius: 3px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .back-button {
        top: 10px;
        left: 10px;
        padding: 8px 12px;
    }

    .back-text {
        display: none;
    }

    .controls-panel {
        top: 10px;
        right: 10px;
    }

    .controls-content {
        min-width: 260px;
        max-width: calc(100vw - 40px);
    }

    #unity-footer {
        height: 36px;
    }
}

/* Unity mobile */
@media (max-aspect-ratio: 1/1) {
    .unity-mobile #unity-canvas {
        width: 100%;
        height: 100%;
    }
}
