html {
    display: flex;
    display: -webkit-flex;
    flex: 1;
    -webkit-flex: 1;
    width: 100vw;
    height: 100vh;
    -webkit-user-drag: none;
}

body {
    display: flex;
    display: -webkit-flex;
    position: relative;
    width: 100%;
    height: auto;
    top: 0;
    left: 0;
    margin: 0;
    padding: 0;
    -webkit-transform-style: preserve-3d;
    transform-style: preserve-3d;
    background: -webkit-linear-gradient(to bottom right, #000000 0%, #181135 40%);
    background: linear-gradient(to bottom right, #000000 0%, #181135 40%);
    background-image: url("../img/bg4.png");
    background-size: 100% 125%;
    background-position: center;
    background-repeat: no-repeat;
    border: 2px solid #33ff00;
    -webkit-box-shadow: inset 0 0 6vw #00ff40aa, inset 0 0 2vw #ffffff99;
    box-shadow: inset 0 0 6vw #00ff40aa, inset 0 0 2vw #ffffff99;
    font-family: 'Gill Sans', 'Gill Sans MT', Calibri, 'Trebuchet MS', sans-serif;
    color: white;
    overflow: hidden;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
}

#wrapper {
    display: flex;
    display: -webkit-flex;
    position: relative;
    top: 0;
    left: 0;
    height: 100%;
    width: 100%;
    min-width: 1150px;
}

@font-face {
    font-family: "glitchFont";
    src: url("../font/KerX.ttf");
}

@font-face {
    font-family: "permanentMarker";
    src: url("../font/PermanentMarker.ttf");
}

@font-face {
    font-family: "vcr";
    src: url("../font/Vcr.ttf");
}

/* RESPONSIVE: Left side controls container */
#wrapsContainer {
    display: inline-flex;
    display: -webkit-inline-flex;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-justify-content: center;
    justify-content: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-align-content: center;
    align-content: center;
    width: 37%;
    height: 82%;
    min-height: 500px;
    position: absolute;
    top: 4%;
    left: 4%;
    line-height: 5%;
    margin-top: -1%;
}

/* RESPONSIVE: Control panel with grid background */
#wrapContainer {
    display: inline-block;
    width: 60%;
    height: 98%;
    min-height: 500px;
    position: absolute;
    top: 0;
    left: 0;
    border: 5px solid #00c3ff;
    background:
        linear-gradient(#001aff79 1px, #5f01ca88 1px),
        linear-gradient(90deg, #001aff79 1px, #52006388 1px);
    background:
        -webkit-linear-gradient(#001aff79 1px, #5f01ca88 1px),
        -webkit-linear-gradient(90deg, #001aff79 1px, #52006388 1px);
    background-size: 30px 30px;
    -webkit-box-shadow: inset 0 0 20px #ff00ff, inset 0 0 20px #00ff0080, inset 0 0 20px #0000ff80;
    box-shadow: inset 0 0 20px #ff00ff, inset 0 0 20px #00ff0080, inset 0 0 20px #0000ff80;
    -webkit-border-radius: 20px;
    border-radius: 20px;
    padding-top: 0;
    padding-bottom: 18%;
}

/* RESPONSIVE: Controls content wrapper */
#wrap2 {
    display: inline-block;
    width: 100%;
    height: 96%;
    position: relative;
    top: 2%;
    left: 5%;
    text-align: start;
    -webkit-justify-content: left;
    justify-content: left;
    -webkit-align-items: start;
    align-items: start;
    -webkit-align-content: start;
    align-content: start;
    z-index: 1;
    white-space: nowrap;
    padding-top: 0;
}

#wrap2 input {
    margin-bottom: 4px;
}

/* RESPONSIVE: Countdown timer */
#countdownTimer {
    display: inline-block;
    position: relative;
    top: 2.4%;
    left: 5.5%;
    width: 100%;
    text-align: left;
    font-size: 15px;
    white-space: nowrap;
    color: #ffffff;
    margin-bottom: 5px;
}

/* RESPONSIVE: Canvas container - uses aspect-ratio for perfect 4:3 */
#canvasContainer {
    display: flex;
    display: -webkit-flex;
    position: relative; 
    width: 100%; 
    height: 100%;
    background-color: #70ffdb;
    image-rendering: crisp-edges;
    -webkit-image-rendering: crisp-edges;
    outline: #70ffdb solid 2vw;
    background-image: url("../img/vcr5.png");
    background-repeat: no-repeat;
    background-position: bottom;
    background-size: 100% 23%;
    -webkit-border-radius: 0.3vw;
    border-radius: 0.3vw;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
}

/* Deprecated - keeping for compatibility */
#canvasDiv {
    display: flex;
    display: -webkit-flex;
    position: absolute;
    top: 5%;
    left: 41%;
    margin: 0 5%;
    width: 100%;
    height: 88%;
    min-height: 550px;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
}

/* RESPONSIVE: Canvas elements */
#canvasVid, #canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%; 
    height: 79.5%;
    display: block;
    -webkit-box-shadow: #ffffff 0 0 1vw;
    box-shadow: #ffffff 0 0 1vw;
    image-rendering: crisp-edges;
    -webkit-image-rendering: crisp-edges;
    max-width: -webkit-calc(100vh * (4/3));
    max-width: calc(100vh * (4/3));
    max-height: 100vh;
    aspect-ratio: 4 / 3;
}

#canvasVid {
    background-color: black;
}

#canvas {
    background-color: transparent;
}

/* Logo animation */
#logo {
    display: inline-block;
    position: absolute;
    top: 5.3%;
    left: 46%;
    margin: 0 auto;
    width: 48.4%;
    height: 69.3%;
    opacity: 0;
    border: #0055c4 .1vw solid;
    -webkit-box-shadow: #ff00ff 0 0 50px;
    box-shadow: #ff00ff 0 0 50px;
    background-color: transparent;
    background-image: url("../img/logo.gif");
    background-size: 130% 100%;
    background-repeat: no-repeat;
    background-position: center center;
    -webkit-animation: none;
    animation: none;
    z-index: 100;
}

/* VCR display elements */
#vcr {
    display: inline-block;
    position: absolute;
    top: 80%;
    left: 0;
    width: 49%;
    height: 20%;
    z-index: 100000000;
}

#vcrStatus {
    display: inline-block;
    position: absolute;
    bottom: 30%;
    left: 33%;
    color: #33ff00;
}

#vcrStatus2 {
    display: inline-block;
    position: absolute;
    bottom: 30%;
    left: 58.5%;
    color: #33ff00;
}

#vhs {
    display: inline-block;
    position: absolute;
    bottom: 65%;
    left: 23%;
    width: 53%;
    height: 35%;
    color: #000000;
    background-image: url("../img/vhs.png");
    background-size: 100% 95%;
    background-repeat: no-repeat;
    opacity: 1;
    border: 1px solid black;
}

#vhsLabel {
    display: inline-flex;
    display: -webkit-inline-flex;
    position: absolute;
    bottom: 28%;
    left: 20.1%;
    width: 70%;
    height: 50%;
    font-family: "permanentMarker";
    font-size: 100%;
    text-align: center;
    -webkit-justify-content: center;
    justify-content: center;
    -webkit-align-items: center;
    align-items: center;
    -webkit-align-content: center;
    align-content: center;
    color: #003cff;
    opacity: 1;
}

/* RESPONSIVE: Input controls */
input {
    z-index: 1000;
}

input[type=range] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-color: #ffbe45;
    -webkit-box-shadow: 0 0 8px #ffbe45;
    box-shadow: 0 0 8px #ffbe45;
    height: 100%;
    width: auto;
}

input[type="range"]::-webkit-slider-runnable-track {
    background-color: #ff004c;
    border: #ff75ed solid 1px;
    height: 90%;
    width: 100%;
    -webkit-border-radius: 0;
    border-radius: 0;
    min-width: 125px;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 2vw;
    height: 1.1vw;
    min-width: 20px;
    min-height: 10px;
    background: 
        -webkit-linear-gradient(to right, #dd009b 2px, transparent 4px) 0 0,
        -webkit-linear-gradient(to right, #8c00dd 5px, transparent 2px) calc(50% - 19px) 0,
        -webkit-linear-gradient(to right, #d600dd 5px, transparent 2px) calc(50% - 11px) 0,
        -webkit-linear-gradient(to left, #8c00dd 2px, transparent 4px) 100% 0,
        -webkit-linear-gradient(to bottom, #ffffff, #94009988);
    background: 
        linear-gradient(to right, #dd009b 2px, transparent 4px) 0 0,
        linear-gradient(to right, #8c00dd 5px, transparent 2px) calc(50% - 19px) 0,
        linear-gradient(to right, #d600dd 5px, transparent 2px) calc(50% - 11px) 0,
        linear-gradient(to left, #8c00dd 2px, transparent 4px) 100% 0,
        linear-gradient(to bottom, #ffffff, #94009988);
    border: 2px solid #fa68ff;
    -webkit-border-radius: 3px;
    border-radius: 3px;
    -webkit-box-shadow: 0 0 15px #94009988;
    box-shadow: 0 0 15px #94009988;
    outline: 2px solid #ca00a988;
}

#schizoKnob::-webkit-slider-runnable-track {
    background-color: #00ff40;
}

#schizoKnob::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 34px;
    height: 19px;
    background: 
        -webkit-linear-gradient(to right, #4fffa7 2px, transparent 4px) 0 0,
        -webkit-linear-gradient(to right, #00ff80 5px, transparent 2px) calc(50% - 19px) 0,
        -webkit-linear-gradient(to right, #009991 5px, transparent 2px) calc(50% - 11px) 0,
        -webkit-linear-gradient(to left, #009991 2px, transparent 4px) 100% 0,
        -webkit-linear-gradient(to bottom, #006eff, #003cff);
    background: 
        linear-gradient(to right, #4fffa7 2px, transparent 4px) 0 0,
        linear-gradient(to right, #00ff80 5px, transparent 2px) calc(50% - 19px) 0,
        linear-gradient(to right, #009991 5px, transparent 2px) calc(50% - 11px) 0,
        linear-gradient(to left, #009991 2px, transparent 4px) 100% 0,
        linear-gradient(to bottom, #006eff, #003cff);
    border: 2px solid #00ff80;
    -webkit-border-radius: 3px;
    border-radius: 3px;
    -webkit-box-shadow: 0 0 15px #00ff80;
    box-shadow: 0 0 15px #00ff80;
    outline: 3px solid #0073b6;
}

input[type="file"] {
    border: #ff00ff solid 1px;
    color: #00adc4;
}

input:hover {
    -webkit-box-shadow: #00ff62 0 0 15px;
    box-shadow: #00ff62 0 0 15px;
}

input[type="checkbox"] {
    -webkit-box-shadow: #00a2ff 0 0 15px;
    box-shadow: #00a2ff 0 0 15px;
}

input[type="checkbox"]:checked {
    -webkit-box-shadow: #d0ff00 0 0 15px;
    box-shadow: #d0ff00 0 0 15px;
}

/* RESPONSIVE: Buttons */
button {
    -webkit-align-items: center;
    align-items: center;
    text-align: center;
    height: 3.5%;
    min-height: 18px;
    text-decoration: none;
    color: #fff;
    background-color: #00c3ff;
    border: 2px solid #00c3ff;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    margin-top: 1px;
    -webkit-box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
    box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.2);
}

button:hover {
    -webkit-box-shadow: #ff00ff 0 0 15px;
    box-shadow: #ff00ff 0 0 15px;
}

/* File inputs */
#fileInput {
    width: 45.4%;
    color: #33ff00;
    background-color: #181135;
    content: "yyy";
}

#loadImage {
    width: 45%;
    color: #33ff00;
    background-color: #181135;
    content: "yyy";
}

#file-input {
    width: 45.6%;
    color: #33ff00;
    background-color: #181135;
    content: "yyy";
}

#fileInput:hover {
    -webkit-box-shadow: #00ff62 0 0 15px;
    box-shadow: #00ff62 0 0 15px;
}

/* Hide file upload buttons */
#loadImage::-webkit-file-upload-button,
#fileInput::-webkit-file-upload-button,
#file-input::-webkit-file-upload-button {
    display: flex;
    display: -webkit-flex;
    position: relative;
    width: 100%;
    height: 0;
    background-color: #240961;
    color: white;
    border: none;
    text-align: center;
}

/* RESPONSIVE: Glitch knob container */
#glitchKnobContainer {
    display: flex;
    display: -webkit-flex;
    position: absolute;
    -webkit-flex-direction: column;
    flex-direction: column;
    top: 0;
    left: 100%;
    margin-left: 8%;
    margin-top: 3%;
    width: 52%;
    height: 98%;
    border: #ffffff 5px solid;
    background-color: #00ff9588;
    background-image: url("../img/cb.png");
    background-repeat: no-repeat;
    background-size: cover;
    -webkit-border-radius: 10px;
    border-radius: 10px;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    -webkit-align-content: center;
    align-content: center;
}

/* RESPONSIVE: Glitch knobs */
#glitchKnob1,
#glitchKnob2,
#glitchKnob3 {
    display: inline-block;
    position: relative;
    top: 1.5%;
    left: 0;
    margin-bottom: 17%;
    width: 7vw;
    height: 7vw;
    min-width: 75px;
    min-height: 75px;
    background-color: #bbff00;
    background-image: url("../img/knob6.png");
    background-repeat: no-repeat;
    background-size: 100%;
    -webkit-transform-origin: center center;
    transform-origin: center center;
    border: 1vw solid;
    box-shadow: 0 0 0 .2vw #faae00;
    -webkit-border-radius: 50%;
    border-radius: 50%;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    z-index: 1;
}

#glitchKnob1 {
    /* Keeps the glow AND the round "outline" */
    box-shadow: 0 0 0 .2vw #faae00, #fbff0075 0 0 20px 20px;
    border-color: #00a2ff;
}

#glitchKnob2,
#glitchKnob3 {
    /* Keeps the glow AND the round "outline" */
    box-shadow: 0 0 0 .2vw #faae00, #00ff8075 0 0 20px 20px;
    border-color: #00ff55;
}

/* Knob container at bottom */
.knob-container {
    display: inline-flex;
    display: -webkit-inline-flex;
    position: relative;
    top: 87%;
    right: 93%;
    -webkit-transform: translate(93%, -87%);
    transform: translate(93%, -87%);
    margin: 22px;
    height: 40%;
    width: 100%;
    -webkit-align-items: center;
    align-items: center;
    color: #000000;
    font-weight: bold;
    z-index: 100;
}

#schizoPower {
    display: inline-block;
    position: relative;
    top: 0;
    left: 0;
}

#schizoKnob {
    height: 8%;
    min-height: 10px;
    width: 80%;
}

/* RESPONSIVE: Labels and text */
label {
    font-size: -webkit-calc(0.5vw + 0.5vh + 5px);
    font-size: calc(0.5vw + 0.5vh + 5px);
}

span {
    font-size: -webkit-calc(0.5vw + 0.5vh + 5px);
    font-size: calc(0.5vw + 0.5vh + 5px);
    white-space: nowrap;
}

/* Other elements */
#distortionLevel,
#distortionDisplay {
    display: none;
}

#videoLength {
    white-space: nowrap;
    width: 40%;
}

#videoLengthDisplay {
    margin-left: 2px;
}

#vid {
    display: inline-block;
    position: relative;
    top: 0;
    left: 0;
    opacity: 0;
    z-index: -1;
}

.container {
    display: block;
    position: relative;
    top: 0;
    left: 0;
    height: 5%;
    width: 100%;
}

.controls {
    display: flex;
    display: -webkit-flex;
    position: relative;
    -webkit-flex-direction: column;
    flex-direction: column;
    -webkit-align-items: left;
    align-items: left;
    bottom: 46%;
    left: 9%;
    height: 5%;
    width: 100%;
    z-index: 1;
}

.controls > div {
    margin-bottom: 0px;
}

.input-container {
    display: flex;
    display: -webkit-flex;
    -webkit-align-items: center;
    align-items: center;
    margin-top: 5px;
    height: 3%;
}

textarea {
    display: inline-block;
    position: relative;
    top: 1%;
    left: 0;
    height: 2.5%;
    width: 70%;
    resize: none;
}

#colorPicker {
    height: 4%;
    border: none;
}

#opacityWarps {
    display: inline-block;
    position: relative;
    top: 1%;
    left: 0;
    width: 100%;
    height: auto;
    margin-top: -1vh;
}

#playSong {
    display: none;
    position: relative;
    top: 0;
    right: 0;
}

.box {
    -webkit-box-shadow: #00eeff 0 0 15px;
    box-shadow: #00eeff 0 0 15px;
}

#playButton,
#playButton2,
#stopButton {
    display: inline-block;
    position: relative;
    top: 1%;
}

#exportButton {
    display: inline-block;
    position: relative;
    top: 0;
    left: 0;
}

.frequency {
    margin-bottom: 10px;
}

.mixer {
    margin-top: 10px;
}

/* Animations */
@-webkit-keyframes spin {
    0% {
        -webkit-transform: rotateX(-10deg) rotateY(0deg) rotateZ(-10deg);
        transform: rotateX(-10deg) rotateY(0deg) rotateZ(-10deg);
    }
    100% {
        -webkit-transform: rotateX(10deg) rotateY(.1deg) rotateZ(10deg);
        transform: rotateX(10deg) rotateY(.1deg) rotateZ(10deg);
    }
}

@keyframes spin {
    0% {
        -webkit-transform: rotateX(-10deg) rotateY(0deg) rotateZ(-10deg);
        transform: rotateX(-10deg) rotateY(0deg) rotateZ(-10deg);
    }
    100% {
        -webkit-transform: rotateX(10deg) rotateY(.1deg) rotateZ(10deg);
        transform: rotateX(10deg) rotateY(.1deg) rotateZ(10deg);
    }
}

@-webkit-keyframes glitch {
    0% { -webkit-transform: translate(0); transform: translate(0); }
    10% { -webkit-transform: translate(-.1px, .1px); transform: translate(-.1px, .1px); }
    20% { -webkit-transform: translate(.1px, -.1px); transform: translate(.1px, -.1px); }
    30% { -webkit-transform: translate(-.1px, .1px); transform: translate(-.1px, .1px); }
    40% { -webkit-transform: translate(.1px, -.1px); transform: translate(.1px, -.1px); }
    50% { -webkit-transform: translate(-.1px, .1px); transform: translate(-.1px, .1px); }
    60% { -webkit-transform: translate(.1px, -.1px); transform: translate(.1px, -.1px); }
    70% { -webkit-transform: translate(-.1px, .1px); transform: translate(-.1px, .1px); }
    80% { -webkit-transform: translate(.1px, -.1px); transform: translate(.1px, -.1px); }
    90% { -webkit-transform: translate(-1px, 1px); transform: translate(-1px, 1px); }
    100% { -webkit-transform: translate(0); transform: translate(0); }
}

@keyframes glitch {
    0% { -webkit-transform: translate(0); transform: translate(0); }
    10% { -webkit-transform: translate(-.1px, .1px); transform: translate(-.1px, .1px); }
    20% { -webkit-transform: translate(.1px, -.1px); transform: translate(.1px, -.1px); }
    30% { -webkit-transform: translate(-.1px, .1px); transform: translate(-.1px, .1px); }
    40% { -webkit-transform: translate(.1px, -.1px); transform: translate(.1px, -.1px); }
    50% { -webkit-transform: translate(-.1px, .1px); transform: translate(-.1px, .1px); }
    60% { -webkit-transform: translate(.1px, -.1px); transform: translate(.1px, -.1px); }
    70% { -webkit-transform: translate(-.1px, .1px); transform: translate(-.1px, .1px); }
    80% { -webkit-transform: translate(.1px, -.1px); transform: translate(.1px, -.1px); }
    90% { -webkit-transform: translate(-1px, 1px); transform: translate(-1px, 1px); }
    100% { -webkit-transform: translate(0); transform: translate(0); }
}

@-webkit-keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 100%; }
}

@keyframes fadeIn {
    0% { opacity: 0; }
    100% { opacity: 100%; }
}

@-webkit-keyframes fadeOut {
    0% { opacity: 100%; }
    100% { opacity: 0; }
}

@keyframes fadeOut {
    0% { opacity: 100%; }
    100% { opacity: 0; }
}

/* FULLSCREEN - Maintains 4:3 aspect ratio with black bars */
#canvasContainer:fullscreen,
#canvasContainer:-webkit-full-screen,
#canvasContainer:-moz-full-screen,
#canvasContainer:-ms-fullscreen {
    display: flex;
    display: -webkit-flex;
    -webkit-align-items: center;
    align-items: center;
    -webkit-justify-content: center;
    justify-content: center;
    background-color: black;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    outline: none;
    background-image: none;
    -webkit-border-radius: 0;
    border-radius: 0;
}

#canvasContainer:fullscreen #canvas, 
#canvasContainer:fullscreen #canvasVid,
#canvasContainer:-webkit-full-screen #canvas,
#canvasContainer:-webkit-full-screen #canvasVid,
#canvasContainer:-moz-full-screen #canvas,
#canvasContainer:-moz-full-screen #canvasVid,
#canvasContainer:-ms-fullscreen #canvas,
#canvasContainer:-ms-fullscreen #canvasVid {
    position: relative;
    width: auto;
    height: 100vh;
    max-width: -webkit-calc(100vh * (4/3));
    max-width: calc(100vh * (4/3)); 
    max-height: 100vh;
    aspect-ratio: 4 / 3;
    -webkit-box-shadow: none;
    box-shadow: none;
}
