/*
   CONTINUITY ARCHIVE SYSTEMS — TERMINAL INTERFACE
   Terminal stylesheet v1.2.4 — T. KESWICK 1998
*/

body.terminal-body {
    background-color: #000000;
    color: #00FF00;
    font-family: "Courier New", Courier, monospace;
    font-size: 12pt;
    margin: 0;
    padding: 0;
    overflow: hidden;
    cursor: default;
}

#terminal-wrapper {
    width: 100vw;
    height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #000000;
}

#terminal-header {
    background-color: #000011;
    border-bottom: 1px solid #004400;
    padding: 4px 10px;
    font-size: 9pt;
    color: #008800;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-shrink: 0;
}

#terminal-header .header-title {
    color: #00FF00;
    font-weight: bold;
    letter-spacing: 2px;
}

#terminal-header .header-info {
    color: #006600;
    font-size: 8pt;
}

#terminal-screen {
    flex: 1;
    overflow-y: auto;
    padding: 10px 15px;
    background-color: #000000;
    /* Subtle scanline effect using gradient */
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(0, 0, 0, 0.08) 2px,
        rgba(0, 0, 0, 0.08) 4px
    );
}

#terminal-screen::-webkit-scrollbar {
    width: 6px;
}

#terminal-screen::-webkit-scrollbar-track {
    background: #000000;
}

#terminal-screen::-webkit-scrollbar-thumb {
    background: #004400;
}

#terminal-output {
    white-space: pre-wrap;
    word-wrap: break-word;
    line-height: 1.4;
    color: #00FF00;
    font-size: 12pt;
}

.output-command {
    color: #00FF00;
}

.output-response {
    color: #00CC00;
}

.output-error {
    color: #FF4444;
}

.output-warning {
    color: #FFAA00;
}

.output-continuity {
    color: #CC00FF;
    font-style: italic;
}

.output-system {
    color: #008800;
}

#terminal-input-line {
    display: flex;
    align-items: center;
    padding: 5px 15px 10px;
    border-top: 1px solid #003300;
    flex-shrink: 0;
    background-color: #000000;
}

#terminal-prompt {
    color: #00FF00;
    margin-right: 6px;
    font-weight: bold;
    white-space: nowrap;
    font-size: 12pt;
}

#terminal-input {
    background: transparent;
    border: none;
    color: #00FF00;
    font-family: "Courier New", monospace;
    font-size: 12pt;
    flex: 1;
    outline: none;
    caret-color: #00FF00;
    padding: 0;
}

#terminal-input::selection {
    background-color: #004400;
}

/* Cursor blink */
@keyframes cursor-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0; }
}

.terminal-cursor {
    display: inline-block;
    width: 8px;
    height: 1.2em;
    background-color: #00FF00;
    animation: cursor-blink 1s step-end infinite;
    vertical-align: text-bottom;
    margin-left: 1px;
}

/* Auth screen */
#auth-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    padding: 20px;
}

.auth-box {
    border: 2px solid #004400;
    padding: 30px 40px;
    background-color: #000011;
    text-align: center;
    max-width: 500px;
    width: 100%;
}

.auth-box pre {
    color: #004400;
    font-size: 10pt;
    text-align: left;
    margin-bottom: 20px;
    line-height: 1.3;
}

.auth-prompt {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-top: 15px;
}

.auth-prompt label {
    color: #008800;
    white-space: nowrap;
}

.auth-input {
    background: #000000;
    border: 1px solid #004400;
    color: #00FF00;
    font-family: "Courier New", monospace;
    font-size: 12pt;
    padding: 4px 8px;
    width: 220px;
}

.auth-input:focus {
    outline: none;
    border-color: #00FF00;
}

.auth-submit {
    background: #000000;
    border: 1px solid #00FF00;
    color: #00FF00;
    font-family: "Courier New", monospace;
    font-size: 11pt;
    padding: 4px 12px;
    cursor: pointer;
}

.auth-submit:hover {
    background: #001100;
}

#auth-error {
    color: #FF4444;
    font-size: 10pt;
    margin-top: 10px;
    min-height: 18px;
}

/* Level-specific terminal themes */
.terminal-level-7 #terminal-output .output-response {
    color: #88FF88;
}

.terminal-level-8 #terminal-screen {
    background-color: #000008;
}

.terminal-level-9 #terminal-header {
    border-bottom-color: #440044;
}

.terminal-level-9 #terminal-prompt {
    color: #CC00FF;
}

.terminal-level-9 #terminal-input {
    color: #CC00FF;
    caret-color: #CC00FF;
}

/* Glitch for terminal at high levels */
@keyframes terminal-glitch {
    0%, 98%, 100% { transform: none; filter: none; }
    98.3% { transform: translateX(-2px); filter: hue-rotate(30deg); }
    98.6% { transform: translateX(2px); filter: hue-rotate(-30deg); }
    98.9% { transform: none; filter: none; }
    99.2% { transform: translateY(1px); filter: brightness(1.5); }
    99.5% { transform: none; filter: none; }
}

.terminal-level-7 {
    animation: terminal-glitch 20s infinite;
}

/* Screen flicker — very rare */
@keyframes screen-flicker {
    0%, 99.9%, 100% { opacity: 1; }
    99.95% { opacity: 0.7; }
}

#terminal-wrapper {
    animation: screen-flicker 60s infinite;
}
