@import url('https://fonts.googleapis.com/css2?family=VT323&display=swap');

:root {
    --terminal-green: #00ff33;
    --terminal-dim: #004411;
    --terminal-red: #ff3333;
    
    /* REFINED GLOW: Tight and crisp for mobile readability */
    --glow-text: 0 0 2px var(--terminal-green); 
    --glow-box: 0 0 8px rgba(0, 255, 51, 0.3);
    --glow-red: 0 0 3px var(--terminal-red);
}

* { box-sizing: border-box; }

body {
    background-color: #000;
    color: var(--terminal-green);
    font-family: 'VT323', monospace;
    font-size: 18px;
    margin: 0;
    padding: 10px;
    text-align: center;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-user-select: none;
    user-select: none;
}

.container {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    border: 1px solid var(--terminal-green);
    background-color: #020b02; 
    padding: 15px;
    box-shadow: var(--glow-box);
    position: relative;
    z-index: 5;
}

/* --- STATUS BAR --- */
.status-bar {
    display: flex;
    justify-content: space-between;
    font-size: 14px;
    border-bottom: 1px solid var(--terminal-dim);
    padding-bottom: 8px;
    margin-bottom: 15px;
    letter-spacing: 1px;
}

.blink-slow {
    animation: blink 2s infinite;
}

/* --- ASCII ART --- */
pre.ascii-logo {
    font-family: 'Courier New', monospace; 
    font-weight: bold;
    font-size: 12px; 
    line-height: 10px;
    color: var(--terminal-green);
    text-shadow: var(--glow-text);
    margin: 0 auto 10px auto;
    white-space: pre;   
    display: inline-block;
    text-align: center;
}

/* --- DYNAMIC HEADER --- */
.dynamic-header {
    font-size: 8vw; 
    max-font-size: 32px; 
    margin: 0 0 20px 0;
    letter-spacing: 2px;
    white-space: nowrap; 
    text-shadow: var(--glow-text);
    border-bottom: 1px dashed var(--terminal-dim);
    padding-bottom: 10px;
}
@media (min-width: 500px) {
    .dynamic-header { font-size: 32px; }
}

/* --- THE TIMER --- */
#timer-display {
    font-size: 18vw; 
    font-weight: bold;
    color: var(--terminal-red);
    text-shadow: var(--glow-red);
    margin: 20px 0;
    font-family: 'VT323', monospace;
    border: 2px solid var(--terminal-red);
    padding: 5px;
    background: rgba(30, 0, 0, 0.4);
    line-height: 1;
}
@media (min-width: 500px) {
    #timer-display { font-size: 80px; }
}

.unlocked-glow {
    box-shadow: 0 0 20px var(--terminal-green);
    animation: pulse-green 1s infinite alternate;
}

/* --- THE RIDDLE --- */
.riddle-box {
    border: 1px solid var(--terminal-green);
    padding: 15px;
    min-height: 100px;
    font-size: 20px;
    background-color: #031303;
    text-shadow: var(--glow-text);
    word-wrap: break-word;
    display: flex;
    align-items: center;
    justify-content: center;
}

.locked-text {
    color: var(--terminal-dim) !important;
    font-style: italic;
    text-shadow: none !important;
}

/* --- TYPING CURSOR --- */
.typing-cursor::after {
    content: '█';
    color: var(--terminal-green);
    margin-left: 2px;
    animation: blink-cursor 0.8s step-end infinite;
}

/* --- CHAOS MODE --- */
body.chaos-mode {
    animation: shake 0.4s cubic-bezier(.36,.07,.19,.97) both infinite;
}
body.chaos-mode .container {
    border-color: var(--terminal-red);
}
body.chaos-mode * {
    color: var(--terminal-red) !important;
    text-shadow: 0 0 5px var(--terminal-red) !important;
}

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

@keyframes pulse-green {
    from { box-shadow: 0 0 10px var(--terminal-green); }
    to { box-shadow: 0 0 25px var(--terminal-green); }
}

@keyframes blink { 50% { opacity: 0.3; } }
@keyframes blink-cursor { 50% { opacity: 0; } }

/* --- EFFECTS --- */
.scanlines {
    background: linear-gradient(
        to bottom,
        rgba(255,255,255,0),
        rgba(255,255,255,0) 50%,
        rgba(0,0,0,0.1) 50%,
        rgba(0,0,0,0.1)
    );
    background-size: 100% 3px;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
    z-index: 10;
}
.vignette {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: radial-gradient(circle, rgba(0,0,0,0) 50%, rgba(0,0,0,0.6) 100%);
    pointer-events: none;
    z-index: 11;
}

input, button {
    font-family: 'VT323';
    font-size: 20px; 
    width: 100%; 
    padding: 10px; 
    margin-bottom: 10px; 
    background: #000;
    color: var(--terminal-green);
    border: 1px solid var(--terminal-green);
}
/* ... [Keep all previous CSS] ... */

/* --- INPUT SECTION --- */
#code-input {
    background: #000;
    border: 2px solid var(--terminal-red);
    color: var(--terminal-red);
    font-family: 'VT323';
    font-size: 30px;
    text-align: center;
    width: 100%;
    margin-bottom: 15px;
    text-transform: uppercase;
    box-shadow: 0 0 10px rgba(255, 50, 50, 0.2);
    outline: none;
}
#code-input:focus {
    box-shadow: 0 0 20px rgba(255, 50, 50, 0.5);
}

#submit-btn {
    background: var(--terminal-red);
    color: #000;
    border: none;
    font-weight: bold;
    font-size: 24px;
    cursor: pointer;
    box-shadow: 0 0 10px var(--terminal-red);
}
#submit-btn:hover {
    background: #fff;
}

.shake-input {
    animation: shake 0.4s ease-in-out;
}

/* --- WINNER SCREEN --- */
#winner-screen {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: var(--terminal-green); /* Inverted Theme */
    color: #000;
    z-index: 100;
    display: none; /* Hidden by default */
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-family: 'VT323';
    text-align: center;
}

.winner-content h1 {
    font-size: 40px;
    border: none;
    text-shadow: none;
    color: #000;
}

.winner-content p {
    font-size: 24px;
    font-weight: bold;
}

.blink-fast {
    animation: blink-fast 0.2s infinite;
}

@keyframes blink-fast {
    50% { opacity: 0; }
}
