@font-face {
    font-family: VCR;
    src: url(../font/VCR_OSD_MONO_1.001.ttf);
}

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

body {
    background: #0a0a0a;
    overflow: hidden;
    height: 100vh;
    width: 100vw;
}

#terminal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    font-family: 'VCR', monospace;
    font-size: clamp(16px, 2.3vh, 26px);
    color: #55ff55;
    background: #0a0a0a;
    text-shadow: 0 0 10px rgba(85, 255, 85, 0.5);
}

#terminal-scanlines {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: repeating-linear-gradient(
        0deg,
        rgba(0, 0, 0, 0.35) 0px,
        rgba(0, 0, 0, 0.35) 1px,
        transparent 1px,
        transparent 3px
    );
    pointer-events: none;
    z-index: 10;
    animation: crt-flicker 0.08s infinite;
}

/* Vignette */
#terminal::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.7) 100%);
    pointer-events: none;
    z-index: 11;
}

@keyframes crt-flicker {
    0%   { opacity: 0.93; }
    50%  { opacity: 1; }
    100% { opacity: 0.95; }
}

#terminal-content {
    position: relative;
    padding: 30px;
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    z-index: 5;
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.3;
}

/* Scrollbar styling */
#terminal-content::-webkit-scrollbar {
    width: 8px;
}
#terminal-content::-webkit-scrollbar-track {
    background: #0a0a0a;
}
#terminal-content::-webkit-scrollbar-thumb {
    background: #1a5c1a;
    border-radius: 0;
}

/* Blinking cursor */
.cursor {
    display: inline;
    animation: blink 1s step-end infinite;
}

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

/* Hack container — 3-column layout */
.hack-container {
    flex: 1;
    display: flex;
    gap: 20px;
    min-height: 0;
}

/* Hack grid layout */
.hack-grid {
    display: flex;
    gap: 20px;
    white-space: pre;
    flex-shrink: 0;
}

.hack-column {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}

.hack-addresses {
    color: #33ff33;
    opacity: 0.7;
}

.hack-chars {
    position: relative;
    white-space: nowrap;
}

/* Selectable words in hack */
.hack-word {
    cursor: pointer;
    transition: none;
}

.hack-word:hover {
    background: #55ff55;
    color: #0a0a0a;
    text-shadow: none;
}

/* Selectable bracket groups */
.hack-bracket {
    cursor: pointer;
}

.hack-bracket:hover {
    background: #55ff55;
    color: #0a0a0a;
    text-shadow: none;
}

/* Keyboard selection highlight */
.kb-selected,
.menu-entry.kb-selected,
.hack-word.kb-selected,
.hack-bracket.kb-selected {
    background: #55ff55;
    color: #0a0a0a !important;
    text-shadow: none;
}

/* Attempt indicators */
.attempts {
    margin: 10px 0;
}

/* Hack output log — third column */
.hack-output {
    flex: 1;
    overflow-y: auto;
    border-left: 1px solid rgba(51, 255, 51, 0.3);
    padding-left: 15px;
}

.hack-output div {
    margin: 2px 0;
}

/* Menu entries */
.menu-entry {
    cursor: pointer;
    display: block;
    padding: 2px 0;
    text-decoration: none;
    color: #33ff33;
}

.menu-entry:hover {
    background: #55ff55;
    color: #0a0a0a;
    text-shadow: none;
}

/* Post view */
.post-content {
    max-width: 80ch;
    overflow-y: auto;
    white-space: pre-wrap;
}

.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
    color: #55ff55;
    text-transform: uppercase;
    text-shadow: 0 0 12px rgba(51, 255, 51, 0.6);
    margin: 1.5em 0 0.5em;
    font-size: 1em;
}

.post-content h1 { font-size: 1.2em; }
.post-content h2 { font-size: 1.1em; }

.post-content p {
    margin: 0.8em 0;
}

.post-content code {
    color: #ffaa33;
    background: rgba(255, 170, 51, 0.1);
    padding: 1px 4px;
}

.post-content pre {
    background: rgba(255, 170, 51, 0.05);
    border-left: 2px solid #ffaa33;
    padding: 10px;
    margin: 1em 0;
    overflow-x: auto;
}

.post-content pre code {
    background: none;
    padding: 0;
}

.post-content a {
    color: #33ff33;
    background: rgba(51, 255, 51, 0.15);
    text-decoration: none;
    padding: 0 2px;
}

.post-content a:hover {
    background: #33ff33;
    color: #0a0a0a;
    text-shadow: none;
}

.post-content blockquote {
    border-left: 2px solid #33ff33;
    padding-left: 15px;
    opacity: 0.85;
    margin: 1em 0;
}

.post-content ul,
.post-content ol {
    padding-left: 20px;
    margin: 0.8em 0;
}

.post-content img {
    max-width: 100%;
    filter: grayscale(100%) brightness(0.8) sepia(100%) hue-rotate(70deg) saturate(300%);
}

/* Locked screen flash */
.terminal-locked {
    animation: lock-flash 0.15s ease-in-out 3;
}

@keyframes lock-flash {
    0%, 100% { background: #0a0a0a; }
    50% { background: #1a0a0a; }
}

/* Responsive */
@media (max-width: 768px) {
    #terminal {
        font-size: 16px;
    }

    #terminal-content {
        padding: 20px;
        overflow: auto !important;
    }

    .hack-container {
        flex-direction: column;
    }

    .hack-grid {
        gap: 10px;
        font-size: 11px;
    }

    .hack-output {
        border-left: none;
        border-top: 1px solid rgba(51, 255, 51, 0.3);
        padding-left: 0;
        padding-top: 10px;
    }
}

@media (max-width: 480px) {
    #terminal {
        font-size: 14px;
    }

    #terminal-content {
        padding: 15px;
    }

    .hack-grid {
        font-size: 12px;
    }
}
