/* ==========================================================================
   WIN86 RETRO CYBERPUNK OS WINDOW & PROGRESSIVE GLITCH LEAK STYLES
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. Progressive Glitch & Code Leak Overlays (Clicks 1-5)
   -------------------------------------------------------------------------- */
.code-leak-particle {
    position: fixed;
    pointer-events: none;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    z-index: 10006;
    user-select: none;
    white-space: nowrap;
    animation: particle-float-fade 1.4s cubic-bezier(0.1, 0.8, 0.3, 1) forwards;
}

@keyframes particle-float-fade {
    0% {
        opacity: 1;
        transform: translate(0, 0) scale(1.1);
        filter: blur(0px);
    }
    50% {
        opacity: 0.9;
        filter: blur(0.5px);
    }
    100% {
        opacity: 0;
        transform: translate(var(--dx, 30px), var(--dy, -60px)) scale(0.8);
        filter: blur(2px);
    }
}

/* Screen Shatter Glitch Slice */
.glitch-slice-bar {
    position: fixed;
    left: 0;
    width: 100vw;
    height: 18px;
    pointer-events: none;
    z-index: 10004;
    background: rgba(255, 255, 255, 0.95);
    mix-blend-mode: difference;
    transform: translateX(var(--shift, 14px));
    animation: slice-snap 0.08s steps(2, start) infinite;
}

@keyframes slice-snap {
    0% { opacity: 0.9; transform: translateX(var(--shift, 14px)); }
    50% { opacity: 0.2; transform: translateX(calc(var(--shift, 14px) * -0.6)); }
    100% { opacity: 0.8; transform: translateX(0); }
}

/* Heavy Reality Tear (Clicks 3-4) */
body.reality-tear-stage-3 #main-content {
    filter: drop-shadow(4px 0 0 rgba(255, 45, 133, 0.6)) drop-shadow(-4px 0 0 rgba(0, 255, 255, 0.6));
    animation: tear-jitter 0.08s infinite alternate;
}

body.reality-tear-stage-4 #main-content {
    filter: drop-shadow(8px 0 0 rgba(255, 45, 133, 0.8)) drop-shadow(-8px 0 0 rgba(0, 255, 255, 0.8)) contrast(1.4);
    animation: tear-shake-wild 0.05s infinite;
}

@keyframes tear-jitter {
    0% { transform: translate(-3px, 1px); }
    100% { transform: translate(3px, -1px); }
}

@keyframes tear-shake-wild {
    0% { transform: translate(-7px, 3px) skewX(1deg); }
    25% { transform: translate(6px, -4px) skewX(-1.5deg); }
    50% { transform: translate(-5px, -2px) skewX(2deg); }
    75% { transform: translate(7px, 3px) skewX(-1deg); }
    100% { transform: translate(0, 0); }
}

/* --------------------------------------------------------------------------
   2. Win86 Classic Window System
   -------------------------------------------------------------------------- */
#win86-modal {
    position: fixed;
    top: 60px;
    left: 60px;
    width: 860px;
    max-width: 95vw;
    height: 620px;
    max-height: 88vh;
    background-color: #c0c0c0;
    border: 3px outset #ffffff;
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.85), 0 0 0 1px #000000;
    z-index: 10090;
    display: none;
    flex-direction: column;
    font-family: 'Space Mono', monospace, -apple-system, sans-serif;
    color: #000000;
    user-select: none;
    overflow: hidden;
}

/* Win86 Backdrop Overlay */
#win86-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.86);
    z-index: 10085;
    display: none;
}

/* Title Bar */
.win86-titlebar {
    height: 32px;
    background: linear-gradient(90deg, #000080 0%, #1084d0 100%);
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 0 8px;
    cursor: move;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.win86-title-left {
    display: flex;
    align-items: center;
    gap: 7px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.win86-icon {
    width: 16px;
    height: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.win86-controls {
    display: flex;
    gap: 3px;
}

.win86-btn {
    width: 20px;
    height: 20px;
    background: #c0c0c0;
    border: 2px outset #ffffff;
    color: #000000;
    font-family: 'VT323', monospace;
    font-size: 14px;
    font-weight: 900;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.win86-btn:active {
    border-style: inset;
    padding: 1px 0 0 1px;
}

.win86-btn.close-btn {
    font-family: sans-serif;
    font-size: 12px;
    font-weight: bold;
}

#win86-cam-btn {
    width: auto;
    height: 20px;
    padding: 0 6px;
    font-size: 10px;
    font-weight: 700;
    font-family: 'Consolas', monospace;
    margin-right: 4px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}

/* Menu Bar */
.win86-menubar {
    height: 24px;
    background-color: #c0c0c0;
    border-bottom: 1px solid #808080;
    display: flex;
    align-items: center;
    padding: 0 6px;
    font-size: 11px;
    gap: 12px;
}

.win86-menu-item {
    cursor: pointer;
    padding: 1px 6px;
    transition: background 0.1s;
}

.win86-menu-item:hover, .win86-menu-item.active {
    background-color: #000080;
    color: #ffffff;
}

.win86-fx-tabs {
    display: flex;
    align-items: center;
    gap: 3px;
}

.win86-fx-tab {
    padding: 2px 7px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    background: #d4d0c8;
    border: 1px outset #ffffff;
    color: #222222;
    cursor: pointer;
    user-select: none;
    transition: background 0.1s, color 0.1s;
}

.win86-fx-tab:hover {
    background: #e8e4dc;
}

.win86-fx-tab.active {
    background: #000080;
    color: #ffffff;
    border: 1px inset #ffffff;
}

/* Viewport Area */
.win86-viewport {
    flex: 1;
    background: #050508;
    border: 3px inset #ffffff;
    margin: 4px;
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#td-webcam-feed {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transform: scaleX(-1); /* Mirror camera */
    opacity: 0.92;
}

#td-interactive-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2;
    pointer-events: auto;
}

/* Camera Launch Overlay inside Viewport */
.win86-cam-starter {
    position: absolute;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    background: rgba(12, 12, 16, 0.92);
    border: 1px solid #555;
    padding: 28px 36px;
    color: #fff;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.8);
}

.win86-starter-title {
    font-size: 13px;
    font-weight: 700;
    color: #00FF66;
    letter-spacing: 1px;
}

.win86-starter-sub {
    font-size: 11px;
    color: #aaa;
    max-width: 320px;
    line-height: 1.5;
}

.win86-cam-btn-group {
    display: flex;
    gap: 10px;
}

.win86-cam-btn {
    background: #c0c0c0;
    border: 2px outset #fff;
    color: #000;
    font-family: 'Space Mono', monospace;
    font-size: 11px;
    font-weight: 700;
    padding: 7px 14px;
    cursor: pointer;
    transition: background 0.1s;
}

.win86-cam-btn:hover {
    background: #e0e0e0;
}

.win86-cam-btn:active {
    border-style: inset;
}

.win86-cam-btn.secondary {
    background: transparent;
    border: 1px solid #777;
    color: #ccc;
}

.win86-cam-btn.secondary:hover {
    color: #fff;
    border-color: #aaa;
    background: rgba(255, 255, 255, 0.1);
}

/* Status Bar */
.win86-statusbar {
    height: 24px;
    background-color: #c0c0c0;
    border-top: 1px solid #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 8px;
    font-size: 10px;
    font-family: 'Space Mono', monospace;
    color: #333333;
}

.win86-status-pane {
    border: 1px inset #ffffff;
    padding: 2px 6px;
    background: #d4d4d4;
    white-space: nowrap;
}

/* Win86 Maximize State */
#win86-modal.maximized {
    top: 0 !important;
    left: 0 !important;
    transform: none !important;
    width: 100vw !important;
    max-width: 100vw !important;
    height: 100vh !important;
    max-height: 100vh !important;
    border: none !important;
}

/* --------------------------------------------------------------------------
   7. Win86 Virus Error Window Cascade
   -------------------------------------------------------------------------- */
.win86-cascade-window {
    position: fixed;
    background: #c0c0c0;
    border: 2px outset #ffffff;
    box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.65);
    z-index: 10015;
    font-family: 'Space Mono', 'MS Sans Serif', sans-serif, monospace;
    color: #000000;
    display: flex;
    flex-direction: column;
    user-select: none;
    overflow: hidden;
    pointer-events: none;
    will-change: transform;
    transform: translateZ(0);
}

.win86-cascade-titlebar {
    height: 20px;
    background: #000080;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 0 6px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.3px;
}

.win86-cascade-titlebar .cascade-title-left {
    display: flex;
    align-items: center;
    gap: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.win86-cascade-titlebar .cascade-close {
    width: 14px;
    height: 14px;
    background: #c0c0c0;
    border: 1px outset #ffffff;
    color: #000;
    font-size: 9px;
    font-weight: bold;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.win86-cascade-body {
    padding: 10px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    background: #c0c0c0;
}

.win86-cascade-icon {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.win86-cascade-msg {
    flex: 1;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.35;
    color: #000000;
    white-space: pre-line;
}

.win86-cascade-footer {
    padding: 0 14px 8px;
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    background: #c0c0c0;
}

.win86-cascade-btn {
    background: #c0c0c0;
    border: 2px outset #ffffff;
    font-family: 'Space Mono', 'MS Sans Serif', monospace;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 14px;
    color: #000000;
    box-shadow: 1px 1px 0 #000;
}

/* ==========================================================================
   8. Win86 Slide-Out FX & Filter Drawer
   ========================================================================== */
.win86-filter-drawer {
    position: absolute;
    top: 0;
    right: 0;
    width: 290px;
    max-width: 85%;
    height: 100%;
    background: #c0c0c0;
    border-left: 3px outset #ffffff;
    box-shadow: -6px 0 24px rgba(0, 0, 0, 0.7);
    z-index: 20;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
    font-family: 'Space Mono', 'MS Sans Serif', monospace;
    color: #000000;
    user-select: none;
}

.win86-filter-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    height: 26px;
    background: #000080;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 0 8px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

.drawer-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.drawer-close-btn {
    width: 18px;
    height: 18px;
    background: #c0c0c0;
    border: 2px outset #ffffff;
    color: #000000;
    font-family: sans-serif;
    font-size: 11px;
    font-weight: bold;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.drawer-close-btn:active {
    border-style: inset;
}

.drawer-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Custom Retro Scrollbar */
.drawer-body::-webkit-scrollbar {
    width: 14px;
    background: #dfdfdf;
}
.drawer-body::-webkit-scrollbar-thumb {
    background: #c0c0c0;
    border: 2px outset #ffffff;
}

.drawer-section {
    border: 2px groove #ffffff;
    padding: 7px 8px;
    background: #d6d6d6;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.drawer-section-title {
    font-size: 10px;
    font-weight: bold;
    color: #000080;
    letter-spacing: 0.5px;
    border-bottom: 1px solid #a0a0a0;
    padding-bottom: 3px;
}

.drawer-btn-group {
    display: flex;
    gap: 4px;
}

.drawer-toggle-btn {
    flex: 1;
    background: #c0c0c0;
    border: 2px outset #ffffff;
    padding: 5px 2px;
    font-family: 'Space Mono', monospace;
    font-size: 10px;
    font-weight: bold;
    cursor: pointer;
    color: #000;
    text-align: center;
    transition: background 0.1s;
}

.drawer-toggle-btn.active {
    border-style: inset;
    background: #000080;
    color: #ffffff;
}

/* Filter Presets Grid */
.filter-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 5px;
}

.filter-preset-btn {
    background: #c0c0c0;
    border: 2px outset #ffffff;
    padding: 6px 4px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    transition: background 0.1s;
}

.filter-preset-btn:hover {
    background: #e0e0e0;
}

.filter-preset-btn:active, .filter-preset-btn.active {
    border-style: inset;
    background: #000080;
    color: #ffffff;
}

.filter-name {
    font-size: 9.5px;
    font-weight: bold;
    letter-spacing: 0.5px;
}

.filter-sub {
    font-size: 9px;
    opacity: 0.8;
}

.filter-preset-btn.active .filter-sub {
    color: #00FF66;
}

/* Retro Sliders */
.drawer-slider-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    font-weight: bold;
    color: #333333;
}

.slider-val {
    color: #000080;
    font-weight: bold;
}

.win86-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 14px;
    background: #ffffff;
    border: 2px inset #ffffff;
    outline: none;
    margin: 2px 0 6px;
}

.win86-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 12px;
    height: 18px;
    background: #c0c0c0;
    border: 2px outset #ffffff;
    cursor: pointer;
    box-shadow: 1px 1px 0 #000;
}

.win86-slider::-webkit-slider-thumb:active {
    border-style: inset;
}

.drawer-toggle-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 0;
}

.win86-checkbox {
    width: 14px;
    height: 14px;
    cursor: pointer;
    accent-color: #000080;
}

/* ==========================================================================
   9. Floating Air Gesture HUD (Left Filter / Right FX)
   ========================================================================== */
.air-hud-panel {
    display: none !important;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 15;
    background: rgba(6, 8, 14, 0.88);
    border: 1px solid rgba(0, 255, 102, 0.35);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85), inset 0 0 12px rgba(0, 255, 102, 0.08);
    backdrop-filter: blur(12px);
    width: 146px;
    display: flex;
    flex-direction: column;
    pointer-events: auto;
    font-family: 'Space Mono', monospace;
    user-select: none;
    transition: opacity 0.2s, border-color 0.2s;
}

.air-hud-left {
    left: 14px;
    width: 156px;
    border-left: 2px solid #00FF66;
}

.air-hud-right {
    right: 14px;
    width: 142px;
    border-right: 2px solid #00E5FF;
    border-color: rgba(0, 229, 255, 0.35);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.85), inset 0 0 12px rgba(0, 229, 255, 0.08);
}

.air-hud-header {
    background: linear-gradient(90deg, #050b18 0%, #0d1e3d 100%);
    color: #ffffff;
    padding: 5px 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}

.air-hud-badge {
    color: #00FF66;
    font-size: 8.5px;
    letter-spacing: 0.5px;
}

.air-hud-right .air-hud-badge {
    color: #00E5FF;
}

.air-hud-list {
    display: flex;
    flex-direction: column;
}

.air-hud-item {
    position: relative;
    padding: 7px 9px;
    font-size: 9.5px;
    font-weight: 700;
    color: #b0b8c4;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
    cursor: pointer;
    overflow: hidden;
    transition: background 0.15s, color 0.15s, transform 0.1s;
}

.air-hud-item:last-child {
    border-bottom: none;
}

.air-hud-item:hover, .air-hud-item.hovered {
    background: rgba(255, 255, 255, 0.12);
    color: #ffffff;
}

.air-hud-item.active {
    background: rgba(0, 255, 102, 0.16);
    color: #00FF66;
    border-left: 3px solid #00FF66;
}

.air-hud-right .air-hud-item.active {
    background: rgba(0, 229, 255, 0.16);
    color: #00E5FF;
    border-left: none;
    border-right: 3px solid #00E5FF;
}

.air-item-tag {
    font-size: 8.5px;
    opacity: 0.65;
}

.air-check {
    font-family: monospace;
    font-size: 11px;
    margin-right: 5px;
    color: #667788;
}

.air-hud-item.active .air-check {
    color: #00E5FF;
}

/* Air Hover Trigger Progress Bar */
.air-progress-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 2.5px;
    background: #00FF66;
    width: 0%;
    transition: width 0.05s linear;
}

.air-hud-right .air-progress-bar {
    background: #00E5FF;
}

.air-hud-item.triggering .air-progress-bar {
    animation: air-progress-fill 0.35s linear forwards;
}

.air-hud-item.just-clicked {
    animation: airItemClickFlash 0.35s ease-out;
}

@keyframes air-progress-fill {
    0% { width: 0%; }
    100% { width: 100%; }
}

@keyframes airItemClickFlash {
    0% { background: rgba(0, 255, 102, 0.7); color: #000; }
    100% { background: rgba(0, 255, 102, 0.16); color: #00FF66; }
}

@keyframes airPinchPulse {
    0% { transform: scale(0.6); opacity: 1; }
    100% { transform: scale(1.8); opacity: 0; }
}

/* FX Checklist Grid in Drawer */
.fx-checklist-grid {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.fx-checkbox-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 700;
    cursor: pointer;
    padding: 2px 4px;
    background: #e4e4e4;
    border: 1px inset #ffffff;
    transition: background 0.1s;
}

.fx-checkbox-row:hover {
    background: #f0f0f0;
}

.fx-name {
    flex: 1;
    color: #222222;
}


