/* Symphony of the Tempest — Styles */
body {
    margin: 0;
    padding: 0;
    background: #000;
    font-family: 'Courier New', monospace;
    color: white;
    font-size: 12px;
    width: 100%;
    height: 100%;
    overflow: hidden;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

html {
    overflow: hidden;
    width: 100%;
    height: 100%;
}

#canvas-wrapper {
    position: relative;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    box-sizing: border-box;
    touch-action: none;
    pointer-events: none; /* canvas only displays — never needs touch input */
}

#artwork-scaler {
    width: 100% !important;
    height: 100% !important;
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: center center;
}

#frame-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    box-sizing: border-box;
    border: 4px solid #c0c0c0;
    border-top-color: #f0f0f0;
    border-left-color: #f0f0f0;
    border-right-color: #404040;
    border-bottom-color: #404040;
    box-shadow:
        inset 4px 4px 0px #000000,
        inset -4px -4px 0px #c0c0c0,
        15px 15px 30px rgba(0, 0, 0, 0.6);
}

canvas#threeCanvas {
    display: block;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 1;
    background: transparent;
    pointer-events: none; /* never intercept touches */
}

/* UI Elements */
.retro-btn {
    position: fixed;
    z-index: 1000;
    padding: 6px 10px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 14px;
    color: lightgrey;
    background-color: #000000;
    border-top: 3px solid #ff69b4;
    border-left: 3px solid #ff69b4;
    border-right: 3px solid #8b3a62;
    border-bottom: 3px solid #8b3a62;
    box-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    text-transform: uppercase;
    outline: none;
    user-select: none;
    overflow: hidden;
    touch-action: manipulation; /* reliable iOS tap */
    -webkit-tap-highlight-color: transparent;
}

.retro-btn span {
    position: relative;
    z-index: 2;
    pointer-events: none;
    background: linear-gradient(180deg,
            #f5e6a3 0%,
            #d4af37 25%,
            #b8860b 50%,
            #d4af37 75%,
            #f5e6a3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.9)) drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.7));
    font-weight: bold;
}

.retro-btn .btn-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0.9;
    mix-blend-mode: screen;
    filter: brightness(1.2);
    pointer-events: none;
}

.retro-btn:active,
.retro-btn.active {
    border-top: 3px solid #000000;
    border-left: 3px solid #000000;
    border-right: 3px solid #ff69b4;
    border-bottom: 3px solid #ff69b4;
    box-shadow: inset 2px 2px 0px #000000;
}

.retro-btn.active .btn-canvas {
    filter: hue-rotate(-120deg) saturate(2) brightness(0.8) contrast(1.3);
}

#retroAutoplayBtn {
    bottom: 20px;
    left: 20px;
}

#fullscreenBtn {
    top: 20px;
    right: 20px;
}

#postBtn {
    bottom: 20px;
    left: 130px;
}

#soloBtn {
    bottom: 20px;
    right: 20px;
}

/* Post-processing control panel */
#post-panel {
    position: fixed;
    bottom: 55px;
    left: 130px;
    background: rgba(0, 0, 0, 0.92);
    border: 1px solid rgba(255, 200, 50, 0.4);
    padding: 10px 12px;
    font-family: 'Courier New', monospace;
    font-size: 9px;
    color: rgba(255, 200, 50, 0.6);
    z-index: 999;
    width: 200px;
    display: none;
}

#post-panel.active {
    display: block;
}

#post-panel label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}

#post-panel input[type='range'] {
    width: 100px;
    accent-color: #ffc832;
    height: 2px;
}

#post-panel .post-val {
    min-width: 28px;
    text-align: right;
    color: rgba(255, 200, 50, 0.5);
}

/* Loading Screen */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    pointer-events: none;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: opacity 0.5s ease-in-out;
}

.loader-marble {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    opacity: 0.9;
    mix-blend-mode: screen;
    pointer-events: none;
}

.retro-window {
    background-color: #000000;
    border-top: 3px solid #ff69b4;
    border-left: 3px solid #ff69b4;
    border-right: 3px solid #8b3a62;
    border-bottom: 3px solid #8b3a62;
    padding: 8px;
    width: 600px;
    box-sizing: border-box;
    box-shadow: 4px 4px 10px rgba(0, 0, 0, 0.5);
    text-align: center;
    position: relative;
    overflow: hidden;
}

@media (max-width: 600px) {
    .retro-window {
        width: 100%;
    }
}

.retro-header {
    font-weight: bold;
    margin-bottom: 6px;
    text-align: left;
    text-transform: uppercase;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    position: relative;
    z-index: 2;
    background: linear-gradient(180deg,
            #f5e6a3 0%,
            #d4af37 25%,
            #b8860b 50%,
            #d4af37 75%,
            #f5e6a3 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(2px 2px 3px rgba(0, 0, 0, 0.9)) drop-shadow(1px 1px 2px rgba(0, 0, 0, 0.7));
}

.retro-bar-container {
    height: 20px;
    background-color: #000000;
    border: 2px solid #ff69b4;
    padding: 2px;
    text-align: left;
    position: relative;
    z-index: 2;
}

.retro-bar-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(180deg, #ff69b4 0%, #ff1493 50%, #ff69b4 100%);
    transition: width 0.1s linear;
}

/* GUI Overrides */
.dg.ac {
    z-index: 9999 !important;
}