/* RESET & CORE VARIABLES */
:root {
    --bg-color: #060806;
    --terminal-bg: #090c09;
    --accent-color: #33ff33;
    --accent-glow: rgba(51, 255, 51, 0.25);
    --accent-dim: rgba(51, 255, 51, 0.4);
    --text-color: #d1ffd1;
    --error-color: #ff3333;
    --error-glow: rgba(255, 51, 51, 0.3);
    --warning-color: #ffcc00;
    --card-bg: rgba(10, 15, 10, 0.7);
    --border-color: rgba(51, 255, 51, 0.2);
    --header-height: 36px;
    --terminal-font: 'Fira Code', 'Share Tech Mono', monospace;
}

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

body {
    background-color: var(--bg-color);
    color: var(--text-color);
    font-family: var(--terminal-font);
    font-size: 16px;
    line-height: 1.5;
    height: 100vh;
    overflow: hidden;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* CRT EFFECTS */
.crt-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(15, 25, 15, 0) 50%, rgba(0, 0, 0, 0.7) 100%);
    pointer-events: none;
    z-index: 999;
}

.scanlines {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(
        rgba(18, 16, 16, 0) 50%, 
        rgba(0, 0, 0, 0.25) 50%
    );
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 998;
    opacity: 0.8;
}

/* APP CONTAINER */
.app-container {
    width: 95vw;
    height: 90vh;
    max-width: 1200px;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 20px;
    z-index: 10;
    perspective: 1000px;
}

/* TERMINAL WINDOW */
.terminal-window {
    background-color: var(--terminal-bg);
    border: 1px solid var(--accent-color);
    box-shadow: 0 0 20px var(--accent-glow);
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    height: 100%;
    position: relative;
}

.terminal-header {
    height: var(--header-height);
    background-color: #0c120c;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    padding: 0 15px;
    justify-content: space-between;
    user-select: none;
}

.window-buttons {
    display: flex;
    gap: 6px;
}

.window-buttons .btn {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    display: inline-block;
}

.window-buttons .close { background-color: #ff5f56; }
.window-buttons .minimize { background-color: #ffbd2e; }
.window-buttons .expand { background-color: #27c93f; }

.window-title {
    font-size: 13px;
    color: var(--accent-dim);
    font-weight: 600;
}

.header-status {
    font-size: 11px;
    background-color: rgba(51, 255, 51, 0.1);
    color: var(--accent-color);
    padding: 2px 8px;
    border-radius: 3px;
    border: 1px solid var(--border-color);
    letter-spacing: 1px;
}

.terminal-body {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
    font-size: 18px; /* Bigger-ish font as requested */
    display: flex;
    flex-direction: column;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.terminal-body::-webkit-scrollbar {
    width: 6px;
}

.terminal-body::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 3px;
}

.terminal-history {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end; /* Scroll-to-bottom feel */
    gap: 8px;
}

.terminal-line {
    white-space: pre-wrap;
    word-break: break-all;
}

.system-output {
    color: var(--accent-color);
    opacity: 0.95;
    text-shadow: 0 0 5px rgba(51, 255, 51, 0.5);
}

.success-output {
    color: var(--accent-color);
    font-weight: 600;
    text-shadow: 0 0 10px rgba(51, 255, 51, 0.7);
    padding: 4px 0;
}

.error-output {
    color: var(--error-color);
    text-shadow: 0 0 5px var(--error-glow);
}

.warning-output {
    color: var(--warning-color);
    text-shadow: 0 0 5px rgba(255, 204, 0, 0.3);
}

.input-line {
    display: flex;
    align-items: center;
    margin-top: 12px;
    border-top: 1px dashed var(--border-color);
    padding-top: 12px;
}

.prompt {
    color: var(--accent-color);
    margin-right: 10px;
    font-weight: bold;
    user-select: none;
}

.input-container {
    flex: 1;
    position: relative;
    display: inline-flex;
    align-items: center;
}

#terminal-input {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    border: none;
    outline: none;
    color: transparent; /* Hide text, mirror handles styling and cursor position */
    caret-color: transparent;
    font-family: inherit;
    font-size: inherit;
    z-index: 2;
}

#input-mirror {
    color: var(--text-color);
    font-family: inherit;
    font-size: inherit;
    z-index: 1;
    white-space: pre;
}

.cursor {
    color: var(--accent-color);
    animation: cursor-blink 1s steps(2, start) infinite;
    z-index: 1;
    margin-left: 1px;
}

@keyframes cursor-blink {
    to { visibility: hidden; }
}

/* SIDEBAR / DASHBOARD */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
}

.dash-card {
    background-color: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    padding: 20px;
    display: flex;
    flex-direction: column;
}

.dash-card h2 {
    font-size: 14px;
    letter-spacing: 2px;
    color: var(--accent-color);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 8px;
    margin-bottom: 15px;
    text-shadow: 0 0 5px rgba(51, 255, 51, 0.3);
}

.stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    font-size: 15px;
}

.stat-label {
    color: var(--accent-dim);
}

.stat-value {
    font-weight: bold;
    color: var(--text-color);
}

.status-locked {
    color: var(--error-color);
    text-shadow: 0 0 5px var(--error-glow);
}

.status-unlocked {
    color: var(--accent-color);
    text-shadow: 0 0 8px rgba(51, 255, 51, 0.6);
    animation: pulse 1.5s infinite alternate;
}

.progress-bar-container {
    background-color: rgba(0, 0, 0, 0.5);
    height: 14px;
    border: 1px solid var(--border-color);
    border-radius: 7px;
    overflow: hidden;
    margin-top: 15px;
}

.progress-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #119955, var(--accent-color));
    box-shadow: 0 0 10px var(--accent-color);
    transition: width 0.4s cubic-bezier(0.1, 0.8, 0.2, 1);
}

/* UNLOCK CARD */
.unlock-card {
    transition: all 0.5s ease;
}

.unlock-card.locked {
    border-color: rgba(255, 51, 51, 0.15);
    opacity: 0.7;
}

.unlock-card.unlocked-state {
    border-color: var(--accent-color);
    box-shadow: 0 0 15px var(--accent-glow);
    background-color: rgba(15, 30, 15, 0.8);
}

.prize-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 80px;
    padding: 10px 0;
}

.lock-icon {
    font-size: 32px;
    margin-bottom: 8px;
    transition: transform 0.3s ease;
}

.unlocked-state .lock-icon {
    transform: rotate(360deg) scale(1.1);
    content: "🔓";
}

.prize-hint {
    font-size: 13px;
    color: var(--accent-dim);
}

.prize-link {
    display: inline-block;
    background-color: rgba(51, 255, 51, 0.1);
    color: var(--accent-color);
    border: 2px solid var(--accent-color);
    border-radius: 4px;
    padding: 10px 20px;
    margin-top: 5px;
    font-weight: bold;
    text-decoration: none;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 10px var(--accent-glow);
    transition: all 0.3s ease;
    cursor: pointer;
    animation: glitch-button 3s infinite;
}

.prize-link:hover {
    background-color: var(--accent-color);
    color: var(--terminal-bg);
    box-shadow: 0 0 20px var(--accent-color);
    transform: translateY(-2px);
}

.prize-link:active {
    transform: translateY(1px);
}

/* LIST OF GUESSED ITEMS */
.list-card {
    flex: 1;
    overflow: hidden;
}

.empty-list-message {
    font-size: 13px;
    color: var(--accent-dim);
    text-align: center;
    margin-top: 30px;
    font-style: italic;
}

.guessed-list {
    list-style: none;
    overflow-y: auto;
    flex: 1;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 8px;
    padding-right: 5px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-color) transparent;
}

.guessed-list::-webkit-scrollbar {
    width: 4px;
}

.guessed-list::-webkit-scrollbar-thumb {
    background-color: var(--border-color);
    border-radius: 2px;
}

.guessed-item {
    font-size: 13px;
    padding: 6px 10px;
    background-color: rgba(51, 255, 51, 0.05);
    border: 1px solid var(--border-color);
    border-radius: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    color: var(--accent-color);
    animation: print-item 0.4s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

@keyframes print-item {
    from {
        transform: scale(0.7);
        opacity: 0;
        background-color: rgba(51, 255, 51, 0.5);
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

/* SHAKE ANIMATION FOR ERRORS */
.shake {
    animation: shake-anim 0.4s ease;
}

@keyframes shake-anim {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

/* KEYBOARD EFFECT (CRT FLICKER & BUTTON GLITCH) */
@keyframes pulse {
    from { text-shadow: 0 0 8px rgba(51, 255, 51, 0.6); }
    to { text-shadow: 0 0 18px rgba(51, 255, 51, 0.9), 0 0 5px rgba(51, 255, 51, 0.4); }
}

@keyframes glitch-button {
    0%, 95%, 100% {
        box-shadow: 0 0 10px var(--accent-glow);
    }
    96% {
        box-shadow: -3px 0 15px rgba(0,255,100,0.8), 3px 0 15px rgba(255,0,100,0.8);
    }
    98% {
        box-shadow: 3px 0 15px rgba(0,255,100,0.8), -3px 0 15px rgba(255,0,100,0.8);
    }
}

/* ASCII CAKE & ARTWORK */
.ascii-art {
    font-family: monospace;
    white-space: pre;
    font-size: 8px;
    line-height: 1.1;
    color: var(--accent-color);
    text-shadow: 0 0 5px rgba(51, 255, 51, 0.4);
    margin-bottom: 15px;
    user-select: none;
    overflow-x: auto;
}

/* RESPONSIVE DESIGN */
@media (max-width: 800px) {
    body {
        height: auto;
        overflow-y: auto;
        padding: 10px;
    }
    
    .app-container {
        height: auto;
        grid-template-columns: 1fr;
        grid-template-rows: minmax(400px, 500px) auto;
        gap: 15px;
    }
    
    .terminal-body {
        font-size: 15px;
    }
    
    .dashboard {
        height: auto;
    }
    
    .list-card {
        max-height: 250px;
    }
    
    .guessed-list {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
    }
}
