/* ═══════════════════════════════════════════
   TERMINAL — BASE
═══════════════════════════════════════════ */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --green:       #00ff41;
    --green-dim:   #00c032;
    --green-dark:  #007a1f;
    --green-glow:  rgba(0, 255, 65, 0.18);
    --bg:          #000000;
    --scanline:    rgba(0, 0, 0, 0.55);
}

html, body {
    width: 100%;
    height: 100%;
    background: var(--bg);
    color: var(--green);
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    font-size: clamp(14px, 1.5vw, 17px);
    line-height: 1.9;
    overflow: hidden;   /* no scrollbar — everything fits in viewport */
    cursor: default;
}

/* ═══════════════════════════════════════════
   SCANLINES CANVAS
═══════════════════════════════════════════ */
#scanlines {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 100;
    opacity: 0.45;
}

/* ═══════════════════════════════════════════
   SCREEN FLICKER
═══════════════════════════════════════════ */
body.flicker {
    animation: screen-flicker 0.7s ease forwards;
}

@keyframes screen-flicker {
    0%   { filter: brightness(1); }
    15%  { filter: brightness(0.25); }
    30%  { filter: brightness(0.8); }
    45%  { filter: brightness(0.15); }
    60%  { filter: brightness(0.7); }
    75%  { filter: brightness(0.35); }
    100% { filter: brightness(1); }
}

/* ═══════════════════════════════════════════
   TERMINAL WRAPPER
═══════════════════════════════════════════ */
.terminal-wrap {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 8vh 7vw;
    z-index: 10;
}

/* ═══════════════════════════════════════════
   OUTPUT LINES
═══════════════════════════════════════════ */
.terminal-output {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.t-line {
    display: block;
    color: var(--green);
    text-shadow: 0 0 8px var(--green-glow);
    min-height: 1.9em;
    white-space: pre-wrap;
}

/* Glitch effect on individual characters */
.t-line.glitch {
    animation: glitch-line 0.12s steps(1) forwards;
}

@keyframes glitch-line {
    0%   { transform: translateX(0);    opacity: 1; }
    25%  { transform: translateX(-3px); opacity: 0.6; filter: hue-rotate(90deg); }
    50%  { transform: translateX(3px);  opacity: 0.9; }
    75%  { transform: translateX(-1px); opacity: 0.7; filter: hue-rotate(-60deg); }
    100% { transform: translateX(0);    opacity: 1; filter: none; }
}

/* Blinking cursor line at the start */
.t-cursor {
    display: inline-block;
    width: 10px;
    height: 1.1em;
    background: var(--green);
    vertical-align: text-bottom;
    animation: blink 1.1s step-end infinite;
    box-shadow: 0 0 6px var(--green);
}

@keyframes blink {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0; }
}

/* Deletion animation — text reddens before vanishing */
.t-line.deleting {
    color: #ff3333;
    text-shadow: 0 0 8px rgba(255,50,50,0.5);
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

/* ═══════════════════════════════════════════
   YES / NO CHOICE
═══════════════════════════════════════════ */
.terminal-choice {
    margin-top: 28px;
    display: none;   /* shown by JS */
    gap: 18px;
    align-items: center;
    opacity: 0;
    transform: translateY(20px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.terminal-choice.visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.choice-btn {
    color: var(--green);
    text-shadow: 0 0 8px var(--green-glow);
    cursor: pointer;
    letter-spacing: 3px;
    text-transform: uppercase;
    font-size: 1.05em;
    transition: color 0.2s, text-shadow 0.2s;
    user-select: none;
}

.choice-btn:hover {
    color: #ffffff;
    text-shadow: 0 0 14px rgba(255,255,255,0.6);
}

.choice-sep {
    color: var(--green-dark);
    user-select: none;
}

/* ═══════════════════════════════════════════
   PATH PHRASE INPUT
═══════════════════════════════════════════ */
.terminal-input-wrap {
    margin-top: 32px;
    display: none;   /* shown by JS after yes */
    flex-direction: column;
    gap: 8px;
    opacity: 0;
    transform: translateY(16px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.terminal-input-wrap.visible {
    display: flex;
    opacity: 1;
    transform: translateY(0);
}

.input-prompt {
    color: var(--green-dark);
    font-size: 0.85em;
    letter-spacing: 1px;
}

.input-line {
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--green-dark);
    padding-bottom: 4px;
    max-width: 480px;
}

.input-prefix {
    color: var(--green-dim);
}

#pathInput {
    background: transparent;
    border: none;
    outline: none;
    color: var(--green);
    font-family: 'Share Tech Mono', 'Courier New', monospace;
    font-size: 1em;
    caret-color: var(--green);
    width: 400px;
    text-shadow: 0 0 6px var(--green-glow);
    letter-spacing: 1px;
}

/* Terminal response line below input */
.input-response {
    color: var(--green-dim);
    font-size: 0.9em;
    margin-top: 6px;
    min-height: 1.5em;
    text-shadow: 0 0 6px var(--green-glow);
    opacity: 0;
    transition: opacity 0.4s ease;
}

.input-response.visible {
    opacity: 1;
}
/* ═══════════════════════════════════════════
   SCREEN FLICKER — brightness only, keeps black bg
═══════════════════════════════════════════ */
body.flicker {
    animation: screen-flicker 0.7s ease forwards;
}

@keyframes screen-flicker {
    0%   { filter: brightness(1); }
    15%  { filter: brightness(0.25); }
    30%  { filter: brightness(0.8); }
    45%  { filter: brightness(0.15); }
    60%  { filter: brightness(0.7); }
    75%  { filter: brightness(0.35); }
    100% { filter: brightness(1); }
}

/* ═══════════════════════════════════════════
   FLASH OVERLAY — sits above everything,
   used for all color flashes so the black
   background is also tinted
═══════════════════════════════════════════ */
#flashOverlay {
    position: fixed;
    inset: 0;
    z-index: 800;
    pointer-events: none;
    opacity: 0;
}

/* ═══════════════════════════════════════════
   ORANGE GLOW
═══════════════════════════════════════════ */
#flashOverlay.orange-glow {
    background: rgba(255, 120, 0, 0.22);
    animation: overlay-orange 1.5s ease forwards;
}
@keyframes overlay-orange {
    0%   { opacity: 0; }
    18%  { opacity: 1; }
    55%  { opacity: 0.7; }
    85%  { opacity: 0.3; }
    100% { opacity: 0; }
}

/* ═══════════════════════════════════════════
   BLUE FLASH
═══════════════════════════════════════════ */
#flashOverlay.blue-flash {
    background: rgba(30, 120, 255, 0.30);
    animation: overlay-blue 1.4s ease forwards;
}
@keyframes overlay-blue {
    0%   { opacity: 0; }
    15%  { opacity: 1; }
    50%  { opacity: 0.75; }
    80%  { opacity: 0.35; }
    100% { opacity: 0; }
}

/* ═══════════════════════════════════════════
   RED FLASH
═══════════════════════════════════════════ */
#flashOverlay.red-flash {
    background: rgba(220, 20, 20, 0.35);
    animation: overlay-red 1.4s ease forwards;
}
@keyframes overlay-red {
    0%   { opacity: 0; }
    15%  { opacity: 1; }
    50%  { opacity: 0.8; }
    80%  { opacity: 0.35; }
    100% { opacity: 0; }
}

/* ═══════════════════════════════════════════
   YELLOW HUE — power save mode
   Uses a persistent overlay div instead
═══════════════════════════════════════════ */
#powerSaveOverlay {
    position: fixed;
    inset: 0;
    z-index: 799;
    pointer-events: none;
    background: rgba(200, 160, 0, 0.18);
    opacity: 0;
    transition: opacity 3s ease;
}
#powerSaveOverlay.visible {
    opacity: 1;
}