* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --fg: #28fe14;
    --fg-dim: #1a9e0d;
    --bg: #000000;
    --accent: #00ffff;
    --error: #ff0000;
    --warning: #ffff00;
    --success: #28fe14;
}

body {
    background: var(--bg);
    color: var(--fg);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 14px;
    line-height: 1.5;
    min-height: 100vh;
    overflow-x: hidden;
}

#terminal {
    max-width: 800px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: 100px;
    min-height: calc(100vh - 60px);
}

#terminal-header {
    text-align: center;
    margin-bottom: 10px;
}

.terminal-title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: 4px;
    text-shadow: 0 0 10px var(--fg);
}

.terminal-subtitle {
    font-size: 12px;
    color: var(--fg-dim);
    letter-spacing: 2px;
    margin-top: 5px;
}

#terminal-divider {
    border-top: 1px solid var(--fg-dim);
    margin: 15px 0;
    opacity: 0.5;
}

#terminal-output {
    min-height: 300px;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.line {
    margin-bottom: 2px;
    opacity: 0;
    animation: fadeIn 0.1s forwards;
}

@keyframes fadeIn {
    to { opacity: 1; }
}

.line.system { color: var(--fg-dim); }
.line.prompt { color: var(--accent); }
.line.hint { color: var(--warning); font-style: italic; }
.line.error { color: var(--error); }
.line.success { color: var(--success); font-weight: bold; }
.line.status { color: var(--accent); }
.line.reward { color: var(--warning); font-weight: bold; }

.typing {
    overflow: hidden;
    border-right: 2px solid var(--fg);
    animation: typing 0.5s steps(40, end), blink-caret 0.5s step-end infinite;
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: var(--fg); }
}

#terminal-input-line {
    display: flex;
    align-items: center;
    margin-top: 10px;
    padding: 10px 0;
    border-top: 1px solid var(--fg-dim);
}

#terminal-prompt {
    color: var(--accent);
    margin-right: 10px;
    font-weight: bold;
}

#terminal-input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--fg);
    font-family: inherit;
    font-size: inherit;
    outline: none;
    caret-color: var(--fg);
}

#terminal-input::placeholder {
    color: var(--fg-dim);
}

#terminal-cursor {
    display: none;
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

#terminal-status {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #111;
    padding: 10px 20px;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    border-top: 1px solid var(--fg-dim);
}

#status-stage { color: var(--accent); }
#status-keys { color: var(--fg-dim); }
#status-countdown {
    color: #ff6b6b;
    font-weight: bold;
    animation: pulse-warning 1s ease-in-out infinite;
}
#status-countdown.rate-limited {
    display: inline;
}
@keyframes pulse-warning {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.glitch {
    animation: glitch 0.3s linear;
}

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

.progress-bar {
    color: var(--success);
    font-family: monospace;
}

@media (max-width: 600px) {
    body { font-size: 14px; }
    #terminal { 
        padding: 15px; 
        padding-bottom: 120px;
    }
    .terminal-title { font-size: 18px; letter-spacing: 2px; }
    .terminal-subtitle { font-size: 10px; }
    
    #terminal-input-line {
        padding: 15px 0;
        margin-top: 15px;
        position: sticky;
        bottom: 50px;
        background: var(--bg);
        z-index: 100;
    }
    
    #terminal-input {
        font-size: 16px;
        padding: 10px 0;
    }
    
    #terminal-status {
        padding: 12px 15px;
        font-size: 11px;
    }
    
    .line {
        padding: 2px 0;
        line-height: 1.6;
    }
}

#terminal::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.1),
        rgba(0, 0, 0, 0.1) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
    z-index: 1000;
}

.loading::after {
    content: '...';
    animation: dots 1.5s infinite;
}

@keyframes dots {
    0%, 20% { content: '.'; }
    40% { content: '..'; }
    60%, 100% { content: '...'; }
}

#mobile-splash {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--bg);
    z-index: 9999;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    -webkit-tap-highlight-color: transparent;
}

#mobile-splash.active {
    display: flex;
}

.splash-content {
    text-align: center;
    padding: 40px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.splash-logo {
    font-size: 80px;
    color: var(--fg);
    text-shadow: 0 0 30px var(--fg), 0 0 60px var(--fg);
    margin-bottom: 20px;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from { text-shadow: 0 0 20px var(--fg), 0 0 40px var(--fg); }
    to { text-shadow: 0 0 40px var(--fg), 0 0 80px var(--fg), 0 0 120px var(--fg); }
}

.splash-title {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: 6px;
    color: var(--fg);
    text-shadow: 0 0 10px var(--fg);
    margin-bottom: 10px;
}

.splash-subtitle {
    font-size: 12px;
    color: var(--fg-dim);
    letter-spacing: 3px;
    margin-bottom: 40px;
}

.splash-divider {
    width: 200px;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--fg), transparent);
    margin-bottom: 40px;
}

.splash-btn {
    background: transparent;
    border: 2px solid var(--fg);
    color: var(--fg);
    font-family: inherit;
    font-size: 16px;
    letter-spacing: 4px;
    padding: 15px 40px;
    cursor: pointer;
    margin-bottom: 20px;
    animation: pulse-btn 2s ease-in-out infinite;
    transition: all 0.3s ease;
}

@keyframes pulse-btn {
    0%, 100% { 
        box-shadow: 0 0 5px var(--fg), 0 0 10px var(--fg);
        opacity: 1;
    }
    50% { 
        box-shadow: 0 0 20px var(--fg), 0 0 40px var(--fg);
        opacity: 0.8;
    }
}

.splash-btn:hover, .splash-btn:active {
    background: var(--fg);
    color: var(--bg);
    box-shadow: 0 0 30px var(--fg);
}

.splash-btn-secondary {
    background: transparent;
    border: 1px solid var(--fg-dim);
    color: var(--fg-dim);
    font-family: inherit;
    font-size: 11px;
    letter-spacing: 2px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.splash-btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.splash-scanlines {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.15),
        rgba(0, 0, 0, 0.15) 1px,
        transparent 1px,
        transparent 2px
    );
    pointer-events: none;
}

@media (display-mode: standalone) {
    #mobile-splash .splash-btn-secondary {
        display: none;
    }
}

/* Desktop splash - blocks desktop users */
#desktop-splash {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000000;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    text-align: center;
}

#desktop-splash.active {
    display: flex;
}

.desktop-splash-content {
    padding: 2rem;
}

.desktop-splash-text {
    font-family: 'JetBrains Mono', 'Courier New', monospace;
    font-size: 2rem;
    font-weight: 400;
    color: #28fe14;
    text-shadow: 0 0 20px rgba(40, 254, 20, 0.5);
    letter-spacing: 2px;
    line-height: 1.4;
}

.desktop-splash-emoji {
    font-size: 4rem;
    margin-top: 2rem;
    filter: grayscale(0.3);
}

@media (max-width: 768px) {
    .desktop-splash-text {
        font-size: 1.3rem;
    }
    .desktop-splash-emoji {
        font-size: 3rem;
    }
}
