/* Classic iOS 5 Gray Linen Background Texture */
body {
    margin: 0;
    padding: 20px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background-color: #2c2f33;
    background-image:
        linear-gradient(rgba(0, 0, 0, 0.4) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 0, 0, 0.4) 1px, transparent 1px),
        linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
    background-size: 4px 4px, 4px 4px, 4px 4px, 4px 4px;
    background-position: -1px -1px, -1px -1px, 0px 0px, 0px 0px;
    box-shadow: inset 0 0 150px rgba(0,0,0,0.85);
    font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
    user-select: none;
    -webkit-user-select: none;
}

/* Eliminate tap-flashing rectangles & focus outlines on touch/click elements */
button, input, label, .ios-switch, .video-viewport, .viewport-fs-btn {
    -webkit-tap-highlight-color: transparent !important;
    outline: none !important;
}

/* Outer Chassis: Clean Anodized Cherry-Red Console */
.player-container {
    position: relative;
    max-width: 760px;
    width: 100%;
    background: linear-gradient(180deg, #d3161c 0%, #7e0306 100%);
    border-radius: 20px;
    padding: 20px;
    box-shadow:
        0 20px 45px rgba(0,0,0,0.85),
        inset 0 1px 0 rgba(255,255,255,0.4),
        inset 0 -3px 8px rgba(0,0,0,0.6),
        0 0 0 1px #a6a6a6,
        0 0 0 2px #f2f2f2,
        0 0 0 3px #858585;
    border: 1px solid #4e0204;
    box-sizing: border-box;
}

/* White Bezel Compartment */
.device-front {
    background: #ffffff;
    border-radius: 12px;
    padding: 2px;
    border: 1px solid #a3a3a3;
    box-shadow:
        0 1px 0 rgba(255,255,255,0.4),
        inset 0 1px 4px rgba(0,0,0,0.3);
    overflow: hidden;
    margin-bottom: 16px;
}

/* Bezel frame containing the screen */
.bezel-content {
    background: #fafafa;
    padding: 14px;
    position: relative;
    border-radius: 10px;
    box-shadow: inset 0 -1px 3px rgba(0,0,0,0.1);
}

/* Screen Viewport Frame */
.video-viewport {
    background: #0a0a0a;
    border-radius: 6px;
    overflow: hidden;
    position: relative;
    box-shadow: inset 0 0 15px rgba(0,0,0,0.95);
    border: 1px solid #2d2d2d;
    aspect-ratio: 16/9;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Fullscreen scaling override rules */
.video-viewport:fullscreen {
    width: 100vw;
    height: 100vh;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0;
    border: none;
}
.video-viewport:-webkit-full-screen {
    width: 100vw;
    height: 100vh;
    background: #000;
    display: flex;
    justify-content: center;
    align-items: center;
    border-radius: 0;
    border: none;
}

#glcanvas {
    max-width: 100%;
    max-height: 100%;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

/* Viewport Fullscreen Overlay Button */
.viewport-fs-btn {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #ffffff;
    font-size: 16px;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 15;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5);
    transition: opacity 0.3s ease, background-color 0.2s ease, transform 0.1s ease;
    opacity: 1;
}
.viewport-fs-btn:hover {
    background: rgba(0, 0, 0, 0.85);
    border-color: rgba(255, 255, 255, 0.4);
}
.viewport-fs-btn:active {
    transform: scale(0.92);
}
.viewport-fs-btn.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Curved Glass reflection */
.screen-gloss {
    position: absolute;
    top: 14px;
    left: 14px;
    right: 14px;
    height: 70px;
    background: linear-gradient(180deg, rgba(255,255,255,0.2) 0%, rgba(255,255,255,0) 100%);
    pointer-events: none;
    border-top-left-radius: 6px;
    border-top-right-radius: 6px;
    z-index: 10;
}

/* Play/Pause Overlay */
.video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.25s ease;
    z-index: 5;
}

.play-bubble {
    width: 65px;
    height: 65px;
    background: radial-gradient(circle, rgba(16,16,16,0.7) 0%, rgba(0,0,0,0.85) 100%);
    border: 3px solid rgba(255,255,255,0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow:
        0 4px 15px rgba(0,0,0,0.65),
        inset 0 2px 4px rgba(255,255,255,0.4);
}

.play-triangle {
    width: 0;
    height: 0;
    border-top: 13px solid transparent;
    border-bottom: 13px solid transparent;
    border-left: 22px solid #fff;
    margin-left: 5px;
    filter: drop-shadow(0 2px 2px rgba(0,0,0,0.6));
}

/* Matte Red Soft-Gradient Control Deck (No hard split-line) */
.control-deck {
    background-color: #b30f14;
    background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.15) 0%, rgba(0, 0, 0, 0.3) 100%);
    border-radius: 10px;
    border: 1px solid #6b0305;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,0.25),
        0 2px 5px rgba(0,0,0,0.45);
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Grid layout for cards */
.deck-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

@media (max-width: 680px) {
    .deck-grid {
        grid-template-columns: 1fr;
    }
}

.deck-card {
    background: rgba(0, 0, 0, 0.18);
    border-radius: 8px;
    padding: 14px;
    border: 1px solid rgba(0, 0, 0, 0.25);
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.card-title {
    font-size: 11px;
    font-weight: bold;
    text-transform: uppercase;
    color: #ffffff;
    text-shadow: 0 -1px 0 rgba(0,0,0,0.8);
    letter-spacing: 0.8px;
    border-bottom: 1px dashed rgba(255,255,255,0.15);
    padding-bottom: 6px;
    display: flex;
    align-items: center;
}

/* Inline title icon overrides */
.title-icon {
    width: 14px;
    height: 14px;
    object-fit: contain;
    vertical-align: middle;
    margin-right: 6px;
    display: inline-block;
}

/* Clean, deep recessed inputs with no bottom white line highlights */
.input-retro {
    width: 100%;
    box-sizing: border-box;
    background: #eef2f3;
    border: 1px solid #9ea5a9;
    border-radius: 6px;
    padding: 10px 12px;
    font-size: 13px;
    font-family: monospace;
    color: #1a252f;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.25);
    outline: none;
    transition: all 0.2s;
}
.input-retro:focus {
    background: #ffffff;
    border-color: #3498db;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.15), 0 0 5px rgba(52, 152, 219, 0.5);
}
.input-retro::placeholder {
    color: #95a5a6;
    font-family: sans-serif;
}

/* Green LCD readouts with no white highlights */
.lcd-display {
    background-color: #0b0f0b;
    border: 1px solid #232e23;
    border-radius: 6px;
    padding: 8px 10px;
    font-family: "Courier New", Courier, monospace;
    font-weight: bold;
    color: #39ff14;
    text-shadow: 0 0 4px rgba(57, 255, 20, 0.6);
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.85);
    font-size: 12px;
    min-height: 34px;
    display: flex;
    align-items: center;
    box-sizing: border-box;
    overflow: hidden;
    text-overflow: ellipsis;
}
.lcd-display.error {
    color: #ff3b30;
    text-shadow: 0 0 4px rgba(255, 59, 48, 0.6);
    border-color: #4e1c1a;
    background-color: #140b0b;
}

/* Action Rows */
.btn-row {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

/* White Gloss Buttons (Kept sharp and glossy as requested) */
.btn-glossy-white {
    flex: 1;
    background: #ffffff;
    background-image:
        linear-gradient(to bottom,
            #ffffff 0%,
            #f2f2f2 50%,
            #e1e1e1 50%,
            #f5f5f5 100%
        );
    border: 1px solid #919191;
    border-radius: 6px;
    box-shadow:
        inset 0 1px 0 #fff,
        0 1px 2px rgba(0,0,0,0.25);
    color: #d6181f;
    text-shadow: 0 1px 0 #fff;
    font-weight: 900;
    font-size: 13px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    outline: none;
    box-sizing: border-box;
    transition: transform 0.05s ease;
}
.btn-glossy-white:active {
    background-image:
        linear-gradient(to bottom,
            #dcdcdc 0%,
            #cbcbcb 50%,
            #b8b8b8 50%,
            #e2e2e2 100%
        );
    box-shadow:
        inset 0 2px 4px rgba(0,0,0,0.35),
        0 1px 0 #fff;
    transform: translateY(1px);
}
.btn-glossy-white.highlighted {
    color: #ffffff;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.4);
    background-image:
        linear-gradient(to bottom,
            #ff4d52 0%,
            #d6181f 50%,
            #b30c12 50%,
            #e6393f 100%
        );
    border: 1px solid #7c0407;
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.35),
        0 1px 2px rgba(0,0,0,0.3);
}
.btn-glossy-white.highlighted:active {
    background-image:
        linear-gradient(to bottom,
            #a0070c 0%,
            #7a0307 100%
        );
    box-shadow:
        inset 0 2px 4px rgba(0,0,0,0.5),
        0 1px 0 rgba(255,255,255,0.1);
}

.label-file-btn {
    margin: 0;
}

/* iOS Toggle Row with no bottom line highlights */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
}
.toggle-label {
    font-size: 11px;
    font-weight: bold;
    color: #ffffff;
    text-shadow: 0 -1px 0 rgba(0,0,0,0.8);
    text-transform: uppercase;
}
.ios-switch {
    position: relative;
    width: 60px;
    height: 28px;
    background: #dfdfdf;
    border-radius: 14px;
    border: 1px solid #b3b3b3;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.2);
    cursor: pointer;
}
.ios-switch input { opacity: 0; width: 0; height: 0; }
.ios-switch-slider {
    position: absolute; top: 0; left: 0; right: 0; bottom: 0;
    border-radius: 14px;
    background: linear-gradient(180deg, #e0e0e0 0%, #cacaca 100%);
    transition: 0.2s;
}

/* iOS switch label centering adjustments */
.ios-switch-slider::before {
    position: absolute; content: "OFF";
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 9px;
    font-weight: bold;
    color: #777;
    text-shadow: 0 1px 0 #fff;
    line-height: 1;
}
.ios-switch input:checked + .ios-switch-slider {
    background: linear-gradient(180deg, #3498db 0%, #2980b9 100%);
}
.ios-switch input:checked + .ios-switch-slider::before {
    content: "ON";
    left: 8px; right: auto; color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,0.4);
}
.ios-switch-knob {
    position: absolute; width: 26px; height: 26px;
    background: radial-gradient(circle at 50% 30%, #ffffff 0%, #e0e0e0 45%, #aeaeae 90%, #8c8c8c 100%);
    border: 1px solid #888;
    border-radius: 50%;
    top: 0px; left: 0px;
    transition: 0.2s;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3), inset 0 1px 0 #fff;
}
.ios-switch input:checked ~ .ios-switch-knob {
    transform: translateX(32px);
}

/* Bottom drop instructions label */
.instruction-tag {
    margin-top: 20px;
    color: rgba(255, 255, 255, 0.4);
    font-size: 11px;
    text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.8);
    text-align: center;
}