/* ============================================================
   BLACKED OS™ — SHELL STYLESHEET
   Gold on black. Courier. Terminal. Nothing fancy.
   ============================================================ */

/* ---- ROOT TOKENS ---- */
:root {
    --bg: #000000;
    --bg-slightly: #0a0a0a;
    --gold: #d4af37;
    --gold-bright: #f0c850;
    --gold-dim: #8a7220;
    --gold-faint: #5a4a15;
    --red: #cc3333;
    --green: #33aa33;
    --gold-glow: rgba(212, 175, 55, 0.04);
    --scan-line: rgba(212, 175, 55, 0.015);
    --crt-flicker: 0.998;
}

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

html, body {
    height: 100%;
    width: 100%;
    overflow: hidden;
    background: var(--bg);
    color: var(--gold);
    font-family: 'Courier New', 'Courier', monospace;
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: none;
    -moz-osx-font-smoothing: none;
    font-smooth: never;
    text-rendering: optimizeLegibility;
    cursor: default;
    user-select: none;
    -webkit-user-select: none;
}

/* ---- CRT EFFECT OVERLAY ---- */
.crt-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 9999;
    background: repeating-linear-gradient(
        0deg,
        var(--scan-line),
        var(--scan-line) 1px,
        transparent 1px,
        transparent 3px
    );
}

.crt-overlay::after {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(
        ellipse at center,
        transparent 0%,
        transparent 60%,
        rgba(0, 0, 0, 0.4) 100%
    );
}

/* ---- SCREEN FLICKER ---- */
@keyframes flicker {
    0%, 100% { opacity: 1; }
    50% { opacity: var(--crt-flicker); }
}

#screen {
    animation: flicker 4s infinite;
    height: 100%;
    width: 100%;
    display: flex;
    flex-direction: column;
}

/* ---- TERMINAL OUTPUT AREA ---- */
#terminal {
    flex: 1;
    overflow-y: auto;
    padding: 1.5rem 1.5rem 0.5rem 1.5rem;
    white-space: pre-wrap;
    word-wrap: break-word;
    text-align: center;
}

/* Boot lines should be left-aligned for readability, but the
   overall block is centered via the container. We use a wrapper
   approach: the terminal is centered, but boot-line elements
   use text-align: left within a max-width centered block. */
.boot-line, .boot-line-dim, .boot-line-ok, .boot-line-warn {
    text-align: left;
    max-width: 640px;
    margin-left: auto;
    margin-right: auto;
}

/* Custom scrollbar — thin gold */
#terminal::-webkit-scrollbar {
    width: 6px;
}
#terminal::-webkit-scrollbar-track {
    background: var(--bg);
}
#terminal::-webkit-scrollbar-thumb {
    background: var(--gold-faint);
}
#terminal::-webkit-scrollbar-thumb:hover {
    background: var(--gold-dim);
}

/* ---- BOOT TEXT LINES ---- */
.boot-line {
    color: var(--gold);
    margin-bottom: 0.15rem;
    white-space: pre-wrap;
}

.boot-line-dim {
    color: var(--gold-dim);
}

.boot-line-ok {
    color: var(--gold);
}

.boot-line-warn {
    color: var(--gold-bright);
}

/* ---- BLINKING CURSOR ---- */
@keyframes blink {
    0%, 49% { opacity: 1; }
    50%, 100% { opacity: 0; }
}

.cursor {
    display: inline-block;
    width: 0.6em;
    height: 1.1em;
    background: var(--gold);
    vertical-align: text-bottom;
    margin-left: 2px;
    animation: blink 1s steps(2) infinite;
}

.cursor-block {
    display: inline-block;
    color: var(--bg);
    background: var(--gold);
    padding: 0 2px;
    animation: blink 1s steps(2) infinite;
}

/* ---- INPUT LINE ---- */
#input-line {
    display: none;
    padding: 0.5rem 1.5rem 2.5rem 1.5rem;
    flex-shrink: 0;
}

#input-line.visible {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 640px;
    margin: 0 auto;
    width: 100%;
}

#input-prompt {
    color: var(--gold);
    white-space: nowrap;
}

#input-field {
    background: transparent;
    border: none;
    outline: none;
    color: var(--gold);
    font-family: 'Courier New', 'Courier', monospace;
    font-size: 16px;
    caret-color: var(--gold);
    flex: 1;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    min-width: 0;
    /* Mask characters like a password field without triggering
       browser password managers / generators */
    -webkit-text-security: disc;
    -moz-text-security: disc;
    text-security: disc;
}

#input-field::placeholder {
    color: var(--gold-faint);
    letter-spacing: normal;
}

/* ---- STATUS BAR ---- */
#status-bar {
    display: none;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 1rem;
    border-top: 1px solid var(--gold-faint);
    background: var(--bg-slightly);
    font-size: 0.75rem;
    color: var(--gold-dim);
    flex-shrink: 0;
    white-space: nowrap;
    overflow: hidden;
}

#status-bar.visible {
    display: flex;
}

.status-left, .status-right {
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.status-dot {
    display: inline-block;
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background: var(--gold);
    animation: blink 2s steps(2) infinite;
}

/* ---- APP LAUNCHER ---- */
#app-launcher {
    display: none;
    flex: 1;
    flex-direction: column;
    padding: 2rem 1.5rem;
    overflow-y: auto;
}

#app-launcher.visible {
    display: flex;
}

.launcher-header {
    text-align: center;
    margin-bottom: 2.5rem;
}

.launcher-title {
    font-size: 1.5rem;
    color: var(--gold);
    letter-spacing: 0.3em;
    margin-bottom: 0.5rem;
}

.launcher-subtitle {
    color: var(--gold-dim);
    font-size: 0.85rem;
    letter-spacing: 0.15em;
}

.app-list {
    max-width: 520px;
    margin: 0 auto;
    width: 100%;
}

.app-item {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    margin-bottom: 0.75rem;
    border: 1px solid var(--gold-faint);
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    background: var(--bg-slightly);
}

.app-item:hover {
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.03);
}

.app-item:focus {
    outline: none;
    border-color: var(--gold);
    background: rgba(212, 175, 55, 0.05);
}

.app-icon {
    width: 2.5rem;
    height: 2.5rem;
    border: 2px solid var(--gold-dim);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    font-weight: bold;
    margin-right: 1rem;
    flex-shrink: 0;
    color: var(--gold);
}

.app-info {
    flex: 1;
    min-width: 0;
}

.app-name {
    color: var(--gold);
    font-size: 1rem;
    letter-spacing: 0.1em;
    margin-bottom: 0.15rem;
}

.app-desc {
    color: var(--gold-dim);
    font-size: 0.75rem;
}

.app-status {
    font-size: 0.7rem;
    color: var(--gold-faint);
    margin-left: 1rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.app-status.installed {
    color: var(--gold);
}

.app-status.locked {
    color: var(--gold-faint);
}

/* ---- MESSAGE / ERROR ---- */
.msg-error {
    color: var(--gold-bright);
    margin-top: 0.5rem;
}

.msg-success {
    color: var(--gold);
}

/* ---- DIVIDER ---- */
.divider {
    color: var(--gold-faint);
    letter-spacing: 0;
    margin: 1rem 0;
}

/* ---- RESPONSIVE — MOBILE ---- */
@media (max-width: 768px) {
    html, body {
        font-size: 14px;
    }
    
    #terminal {
        padding: 1.5rem 1rem 0.5rem 1rem;
    }
    
    #input-line {
        padding: 0.5rem 1rem 2.5rem 1rem;
    }
    
    #status-bar {
        font-size: 0.65rem;
        padding: 0.35rem 0.75rem;
    }
    
    .status-left, .status-right {
        gap: 0.75rem;
    }
    
    .launcher-title {
        font-size: 1.2rem;
    }
    
    .app-item {
        padding: 0.75rem 1rem;
    }
    
    .app-icon {
        width: 2rem;
        height: 2rem;
        font-size: 1rem;
    }
    
    .app-name {
        font-size: 0.9rem;
    }
    
    .app-desc {
        font-size: 0.7rem;
    }
    
    .app-status {
        font-size: 0.6rem;
        margin-left: 0.5rem;
    }
}

@media (max-width: 480px) {
    html, body {
        font-size: 13px;
    }
    
    .status-right {
        display: none;
    }
}

/* ---- HIDDEN UTIL ---- */
.hidden {
    display: none !important;
}

/* ---- NO FLICKER FOR REDUCED MOTION ---- */
@media (prefers-reduced-motion: reduce) {
    #screen {
        animation: none;
    }
    .cursor,
    .cursor-block,
    .status-dot {
        animation: none;
    }
}
