/* --- RESET & BASICS --- */
* {
    box-sizing: border-box;
}

body {
    background-color: #050505; /* Deep black-grey */
    color: #33ff00; /* Terminal Green */
    font-family: 'Courier New', Courier, monospace;

    /* Use dvh (Dynamic Viewport Height) for better mobile support */
    min-height: 100vh;
    min-height: 100dvh;

    margin: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden; /* Keeps the static background contained */

    /* Prevent text selection to feel more like an interface */
    user-select: none;
    -webkit-user-select: none;
}

/* --- LAYOUT CONTAINER --- */
.container {
    width: 90%;          /* 90% width on mobile */
    max-width: 650px;    /* Max width on desktop */
    padding: 20px;

    /* Slight adjustment up visually looks better */
    transform: translateY(-5%);
}

/* --- OUTPUT TEXT --- */
#output {
    margin-bottom: 30px;
    white-space: pre-wrap;
    min-height: 1.5em;
    font-size: 1.1rem;
    line-height: 1.4;
    text-shadow: 0 0 5px rgba(51, 255, 0, 0.5); /* Glowing text effect */
}

/* --- THE FORM ROW --- */
form {
    display: flex;
    align-items: center;
    border-bottom: 2px solid #33ff00;
    padding-bottom: 5px;
    position: relative;
    transition: border-color 0.2s;
}

/* Glow effect on the bottom border when focused */
form:focus-within {
    border-bottom-color: #33ff00;

    /* Offset-Y (10px) pushes it down, Negative Spread (-10px) hides it from sides/top */
    /* This makes it look like just the line is glowing, not the box */
    box-shadow: 0 10px 20px -10px rgba(51, 255, 0, 0.8);
}

.prompt {
    margin-right: 15px;
    font-weight: bold;
    font-size: 1.2rem;
}

/* --- INPUT FIELD --- */
input {
    background: transparent;
    border: none;
    color: #33ff00;
    font-family: inherit;

    /* 16px minimum prevents iOS from zooming in when you tap it */
    font-size: 16px;

    flex-grow: 1;
    outline: none;
    text-transform: uppercase;
    caret-color: #33ff00; /* Cursor color */
    border-radius: 0; /* Remove rounded corners on iOS */
}

/* Larger font on desktop */
@media (min-width: 768px) {
    input {
        font-size: 1.5rem;
    }

    #output {
        font-size: 1.3rem;
    }
}

/* --- BACKGROUND LAYERS --- */
#noise-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -2;
    opacity: 0.12;
}

.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    pointer-events: none;
    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)
    );
    background-size: 100% 4px, 6px 100%;
    box-shadow: inset 0 0 100px rgba(0,0,0,0.9);
}

/* --- MOBILE SUBMIT BUTTON --- */
#mobile-submit {
    display: none; /* Hidden on Desktop */
}

@media (max-width: 768px) {
    #mobile-submit {
        display: block;
        background: rgba(51, 255, 0, 0.1);
        border: 1px solid #33ff00;
        color: #33ff00;
        font-family: inherit;
        font-size: 0.9rem;
        font-weight: bold;
        letter-spacing: 1px;

        /* Nice spacing */
        padding: 10px 15px;
        margin-left: 10px;

        text-transform: uppercase;
        cursor: pointer;
        border-radius: 0;
        -webkit-appearance: none;
        transition: all 0.1s ease;
    }

    #mobile-submit:active {
        background: #33ff00;
        color: #000;
        transform: scale(0.98);
    }

    /* Ensure input doesn't get squashed too small */
    input {
        width: 100%;
        min-width: 0; /* Flexbox fix */
    }
}

/* --- ANIMATIONS --- */
.shake {
    animation: shake 0.5s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
    10%, 90% { transform: translate3d(-1px, 0, 0); }
    20%, 80% { transform: translate3d(2px, 0, 0); }
    30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
    40%, 60% { transform: translate3d(4px, 0, 0); }
}
