:root {
    --bg-color: #0000AA;
    --text-color: #FFFFFF;
    --font-family: 'Press Start 2P', cursive;
}

body {
    margin: 0;
    font-family: sans-serif;
    background-color: #1a1a1a;
    color: #f0f0f0;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
}

#app {
    display: flex;
    flex-wrap: wrap;
    gap: 2rem;
    padding: 2rem;
    width: 100%;
    max-width: 1200px;
    box-sizing: border-box;
}

.controls {
    flex: 1;
    min-width: 300px;
    background-color: #2a2a2a;
    padding: 1.5rem;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    height: fit-content;
}

.controls h1 {
    margin: 0 0 0.5rem 0;
    font-size: 1.5rem;
    color: #fff;
    border-bottom: 2px solid #444;
    padding-bottom: 0.5rem;
}

.controls .description {
    font-size: 0.9rem;
    color: #ccc;
    margin: 0 0 1rem 0;
}

.control-group {
    display: flex;
    flex-direction: column;
}

.control-group-inline {
    display: flex;
    gap: 1rem;
}

.control-group-inline .control-group {
    flex: 1;
}

.controls label {
    margin-bottom: 0.5rem;
    font-weight: bold;
    font-size: 0.9rem;
    color: #ddd;
}

.controls input[type="text"],
.controls textarea,
.controls select {
    width: 100%;
    padding: 0.5rem;
    border: 1px solid #444;
    background-color: #333;
    color: #f0f0f0;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
}

.controls input[type="color"] {
    width: 100%;
    height: 40px;
    border: 1px solid #444;
    padding: 2px;
    border-radius: 4px;
    background-color: #333;
}

.controls button {
    padding: 0.75rem;
    border: none;
    border-radius: 4px;
    background-color: #007bff;
    color: white;
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.2s;
}

.controls button:hover {
    background-color: #0056b3;
}

#download-button {
    background-color: #28a745;
}
#download-button:hover {
    background-color: #218838;
}

.checkbox-label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.checkbox-label input {
    margin-right: 0.5rem;
}

.preview-container {
    flex: 1.5;
    display: flex;
    justify-content: center;
    align-items: center;
    min-width: 300px;
    min-height: 400px;
}

#preview-screen {
    width: 100%;
    height: 100%;
    max-width: 640px;
    max-height: 480px;
    aspect-ratio: 4 / 3;
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--font-family);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    box-sizing: border-box;
    text-align: center;
    border-radius: 15px / 20px;
    overflow: hidden;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.5), inset 0 0 30px rgba(0,0,0,0.5);
    line-height: 1.6;
}

/* CRT Scanlines */
#preview-screen::before {
    content: " ";
    display: block;
    position: absolute;
    top: 0;
    left: 0;
    bottom: 0;
    right: 0;
    background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%), linear-gradient(90deg, rgba(255, 0, 0, 0.06), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.06));
    z-index: 2;
    background-size: 100% 2px, 3px 100%;
    pointer-events: none;
}

#preview-content {
    z-index: 1;
}

#preview-screen h1 {
    font-size: 2em;
    margin-bottom: 1em;
    text-transform: uppercase;
    position: relative;
}

#preview-screen p {
    font-size: 1em;
}

/* Glitch Effect */
.glitch #preview-content h1,
.glitch #preview-content p {
    animation: glitch-anim 1.5s infinite steps(2, end);
}

.glitch #preview-content h1::before,
.glitch #preview-content p::before,
.glitch #preview-content h1::after,
.glitch #preview-content p::after {
    content: attr(data-text);
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-color);
}

.glitch #preview-content h1::before,
.glitch #preview-content p::before {
    left: 2px;
    text-shadow: -2px 0 #ff00c1;
    clip: rect(44px, 450px, 56px, 0);
    animation: glitch-anim-2 1.5s infinite steps(2, end) reverse;
}

.glitch #preview-content h1::after,
.glitch #preview-content p::after {
    left: -2px;
    text-shadow: -2px 0 #00fff9, 2px 2px #ff00c1;
    clip: rect(86px, 450px, 100px, 0);
    animation: glitch-anim-2 1s infinite steps(2, end);
}

@keyframes glitch-anim {
  0% { transform: translate(0); }
  20% { transform: translate(-5px, 5px); }
  40% { transform: translate(-5px, -5px); }
  60% { transform: translate(5px, 5px); }
  80% { transform: translate(5px, -5px); }
  to { transform: translate(0); }
}

@keyframes glitch-anim-2 {
    0% { clip: rect(42px, 9999px, 43px, 0); }
    10% { clip: rect(22px, 9999px, 55px, 0); }
    20% { clip: rect(66px, 9999px, 73px, 0); }
    30% { clip: rect(18px, 9999px, 25px, 0); }
    40% { clip: rect(88px, 9999px, 92px, 0); }
    50% { clip: rect(42px, 9999px, 79px, 0); }
    60% { clip: rect(10px, 9999px, 99px, 0); }
    70% { clip: rect(33px, 9999px, 40px, 0); }
    80% { clip: rect(1px, 9999px, 15px, 0); }
    90% { clip: rect(50px, 9999px, 51px, 0); }
    100% { clip: rect(29px, 9999px, 68px, 0); }
}


#jumpscare-image {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 10;
    pointer-events: none;
}

.hidden {
    display: none;
}

