/* ==========================================================================
   24XX ARCHIVE — Starship Terminal Aesthetic
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Major+Mono+Display&family=VT323&family=IBM+Plex+Sans:wght@300;400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
    --ink: #07091a;
    --ink-2: #0d1228;
    --panel: #11172e;
    --panel-line: rgba(230, 210, 170, 0.12);
    --amber: #ffb560;
    --amber-deep: #d97a2a;
    --signal: #ff5a4a;
    --phosphor: #9dffc7;
    --phosphor-dim: #56b085;
    --cream: #ede2c2;
    --cream-muted: #a89e85;
    --vacuum: #030514;

    --f-display: "Major Mono Display", "Courier New", monospace;
    --f-term: "VT323", "Courier New", monospace;
    --f-body: "IBM Plex Sans", system-ui, sans-serif;
    --f-mono: "IBM Plex Mono", ui-monospace, monospace;
}

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

html, body {
    background: var(--ink);
    color: var(--cream);
    font-family: var(--f-body);
    font-weight: 400;
    font-size: 16px;
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* Starfield + subtle scanlines on everything --------------------------- */
body {
    background:
        radial-gradient(1200px 700px at 20% 10%, rgba(255, 181, 96, 0.06), transparent 55%),
        radial-gradient(900px 500px at 85% 30%, rgba(157, 255, 199, 0.04), transparent 60%),
        radial-gradient(circle at 10% 90%, rgba(255, 90, 74, 0.05), transparent 45%),
        var(--ink);
}
body::before {
    /* starfield */
    content: "";
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 1;
    background-image:
        radial-gradient(1.2px 1.2px at 12% 22%, var(--cream), transparent 50%),
        radial-gradient(1px 1px at 34% 64%, var(--cream), transparent 50%),
        radial-gradient(1.5px 1.5px at 71% 18%, var(--amber), transparent 50%),
        radial-gradient(1px 1px at 52% 84%, var(--cream), transparent 50%),
        radial-gradient(1px 1px at 88% 52%, var(--cream), transparent 50%),
        radial-gradient(1.3px 1.3px at 24% 48%, var(--phosphor), transparent 50%),
        radial-gradient(1px 1px at 63% 34%, var(--cream), transparent 50%),
        radial-gradient(1px 1px at 93% 78%, var(--cream), transparent 50%);
    opacity: 0.7;
    animation: twinkle 8s ease-in-out infinite;
}
body::after {
    /* scanline overlay */
    content: "";
    position: fixed; inset: 0;
    pointer-events: none;
    z-index: 2;
    background: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 2px,
        rgba(0, 0, 0, 0.15) 3px,
        transparent 4px
    );
    mix-blend-mode: multiply;
    opacity: 0.35;
}
@keyframes twinkle {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.35; }
}

main, header, footer { position: relative; z-index: 3; }

/* --- Status bar ------------------------------------------------------- */
.status-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 24px;
    padding: 14px 32px;
    border-bottom: 1px solid var(--panel-line);
    background: linear-gradient(180deg, rgba(7, 9, 26, 0.92), rgba(7, 9, 26, 0.72));
    backdrop-filter: blur(6px);
    font-family: var(--f-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--cream-muted);
    position: sticky;
    top: 0;
    z-index: 50;
}
.status-bar .blink {
    display: inline-block;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--phosphor);
    box-shadow: 0 0 10px var(--phosphor);
    margin-right: 10px;
    animation: blink 1.4s steps(2) infinite;
    vertical-align: baseline;
}
@keyframes blink {
    50% { opacity: 0.25; }
}
.status-bar .segment { display: flex; align-items: center; white-space: nowrap; }
.status-bar .sep { color: var(--panel-line); margin: 0 18px; }
.status-bar .lobby-link {
    color: var(--amber);
    text-decoration: none;
    transition: color 0.2s;
}
.status-bar .lobby-link:hover { color: var(--cream); }

/* --- Hero ------------------------------------------------------------- */
.hero {
    max-width: 1300px;
    margin: 0 auto;
    padding: 80px 40px 40px;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 48px;
    align-items: center;
}
.hero-mono {
    font-family: var(--f-display);
    font-size: clamp(6rem, 18vw, 18rem);
    line-height: 0.9;
    color: var(--amber);
    letter-spacing: -0.04em;
    text-shadow:
        0 0 40px rgba(255, 181, 96, 0.45),
        0 0 80px rgba(255, 181, 96, 0.22);
    position: relative;
}
.hero-mono::after {
    content: "";
    position: absolute;
    left: 0; right: 0; bottom: -12px;
    height: 3px;
    background: linear-gradient(90deg, var(--amber), transparent);
}

.hero-meta {
    display: flex;
    flex-direction: column;
    gap: 18px;
}
.hero-kicker {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.4em;
    text-transform: uppercase;
    color: var(--phosphor-dim);
}
.hero-title {
    font-family: var(--f-display);
    font-size: clamp(1.3rem, 2.6vw, 2.4rem);
    line-height: 1.25;
    color: var(--cream);
    letter-spacing: -0.01em;
}
.hero-title .accent { color: var(--signal); }
.hero-desc {
    font-family: var(--f-body);
    font-weight: 300;
    font-size: 0.98rem;
    color: var(--cream-muted);
    max-width: 60ch;
    line-height: 1.55;
}

/* --- Launch bays ----------------------------------------------------- */
.bays {
    max-width: 1300px;
    margin: 30px auto 60px;
    padding: 0 40px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 28px;
}
.bay {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--panel-line);
    border-radius: 4px;
    padding: 0;
    overflow: hidden;
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 0;
    transition: border-color 0.3s, transform 0.3s, box-shadow 0.3s;
}
.bay::before {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(140deg, transparent 60%, rgba(255, 181, 96, 0.06));
}
.bay:hover {
    border-color: var(--amber);
    transform: translateY(-3px);
    box-shadow: 0 10px 40px rgba(255, 181, 96, 0.18), inset 0 0 0 1px rgba(255, 181, 96, 0.3);
}
.bay-art {
    position: relative;
    overflow: hidden;
    background: var(--vacuum);
    border-right: 1px solid var(--panel-line);
}
.bay-art img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    filter: contrast(1.05) saturate(1.1);
}
.bay-art::after {
    content: "";
    position: absolute; inset: 0;
    background: linear-gradient(180deg, transparent 60%, rgba(7, 9, 26, 0.55));
    pointer-events: none;
}

.bay-body {
    padding: 22px 24px 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-width: 0;
}
.bay-slot {
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.32em;
    text-transform: uppercase;
    color: var(--phosphor-dim);
    display: flex;
    align-items: center;
    gap: 10px;
}
.bay-slot .code {
    color: var(--amber);
    background: rgba(255, 181, 96, 0.1);
    border: 1px solid rgba(255, 181, 96, 0.3);
    padding: 2px 8px;
    border-radius: 2px;
}
.bay-title {
    font-family: var(--f-display);
    font-size: 1.25rem;
    line-height: 1.2;
    color: var(--cream);
    letter-spacing: -0.01em;
}
.bay-title small {
    display: block;
    font-family: var(--f-body);
    font-weight: 400;
    font-size: 0.78rem;
    color: var(--cream-muted);
    text-transform: none;
    margin-top: 6px;
    letter-spacing: 0;
}
.bay-actions {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: auto;
    flex-wrap: wrap;
}
.btn-initiate {
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--ink);
    background: var(--amber);
    border: none;
    padding: 11px 18px;
    border-radius: 2px;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 10px;
}
.btn-initiate:hover {
    background: var(--cream);
    box-shadow: 0 0 18px rgba(255, 181, 96, 0.5);
}
.btn-initiate:active { transform: translateY(1px); }
.btn-initiate .arrow { transition: transform 0.2s; }
.btn-initiate:hover .arrow { transform: translateX(4px); }
.btn-initiate:disabled,
.btn-initiate.disabled {
    background: rgba(255, 255, 255, 0.08);
    color: var(--cream-muted);
    cursor: not-allowed;
    box-shadow: none;
}
.acquire {
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--phosphor);
    text-decoration: none;
    border-bottom: 1px dashed var(--phosphor-dim);
    padding-bottom: 1px;
    transition: color 0.2s, border-color 0.2s;
}
.acquire:hover {
    color: var(--cream);
    border-bottom-color: var(--cream);
}

/* --- Terminal -------------------------------------------------------- */
.terminal {
    max-width: 1300px;
    margin: 0 auto 80px;
    padding: 0 40px;
}
.term-frame {
    background: var(--vacuum);
    border: 1px solid var(--panel-line);
    border-radius: 4px;
    overflow: hidden;
    position: relative;
}
.term-frame::before {
    /* CRT scanlines inside the terminal */
    content: "";
    position: absolute; inset: 0;
    pointer-events: none;
    background: repeating-linear-gradient(
        to bottom,
        rgba(157, 255, 199, 0.04) 0,
        rgba(157, 255, 199, 0.04) 1px,
        transparent 1px,
        transparent 3px
    );
    z-index: 1;
}
.term-frame::after {
    /* subtle vignette */
    content: "";
    position: absolute; inset: 0;
    pointer-events: none;
    background: radial-gradient(ellipse at center, transparent 50%, rgba(0,0,0,0.55));
    z-index: 1;
}
.term-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    padding: 12px 20px;
    border-bottom: 1px solid rgba(157, 255, 199, 0.15);
    background: linear-gradient(180deg, rgba(17, 23, 46, 0.6), transparent);
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.3em;
    text-transform: uppercase;
    color: var(--phosphor-dim);
    position: relative;
    z-index: 2;
}
.term-head .lights {
    display: flex;
    gap: 6px;
}
.term-head .lights span {
    width: 9px; height: 9px;
    border-radius: 50%;
    background: rgba(157, 255, 199, 0.2);
    border: 1px solid rgba(157, 255, 199, 0.3);
}
.term-head .lights span.on {
    background: var(--phosphor);
    box-shadow: 0 0 8px var(--phosphor);
}
.term-head .channel { color: var(--phosphor); }

.term-body {
    padding: 28px 32px 40px;
    min-height: 220px;
    font-family: var(--f-term);
    font-size: 1.45rem;
    line-height: 1.35;
    color: var(--phosphor);
    text-shadow: 0 0 8px rgba(157, 255, 199, 0.35);
    position: relative;
    z-index: 2;
}
.term-empty {
    color: var(--phosphor-dim);
    font-style: normal;
    letter-spacing: 0.05em;
}
.term-empty::before { content: "> "; color: var(--amber); }
.term-empty::after {
    content: "_";
    animation: cursor 1s steps(2) infinite;
    margin-left: 4px;
}
@keyframes cursor { 50% { opacity: 0; } }

.loading-indicator {
    display: none;
    align-items: center;
    gap: 14px;
    padding-bottom: 18px;
    margin-bottom: 18px;
    border-bottom: 1px dashed rgba(157, 255, 199, 0.18);
    font-family: var(--f-mono);
    font-size: 11px;
    letter-spacing: 0.25em;
    text-transform: uppercase;
    color: var(--amber);
}
.loading-indicator.visible { display: flex; }
.loading-indicator::before {
    content: "";
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--signal);
    box-shadow: 0 0 10px var(--signal);
    animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

#ai_content pre,
#ai_content code {
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    font-family: var(--f-term);
    font-size: inherit;
    color: inherit;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* --- Footer ---------------------------------------------------------- */
.footer {
    max-width: 1300px;
    margin: 0 auto;
    padding: 30px 40px 50px;
    border-top: 1px solid var(--panel-line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    font-family: var(--f-mono);
    font-size: 10px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--cream-muted);
}
.footer a {
    color: var(--amber);
    text-decoration: none;
}
.footer a:hover { color: var(--cream); }

/* --- Responsive ------------------------------------------------------ */
@media (max-width: 900px) {
    .status-bar { padding: 10px 16px; flex-wrap: wrap; font-size: 10px; gap: 8px; letter-spacing: 0.15em; }
    .status-bar .sep { display: none; }
    .hero { padding: 40px 20px 24px; grid-template-columns: 1fr; gap: 20px; }
    .hero-mono { font-size: clamp(5rem, 28vw, 9rem); }
    .bays { grid-template-columns: 1fr; padding: 0 20px; gap: 18px; margin-bottom: 40px; }
    .bay { grid-template-columns: 120px 1fr; }
    .terminal { padding: 0 20px; margin-bottom: 50px; }
    .term-body { padding: 22px 20px 30px; font-size: 1.2rem; }
    .footer { padding: 24px 20px 40px; letter-spacing: 0.18em; }
}

@media (max-width: 520px) {
    .bay { grid-template-columns: 1fr; }
    .bay-art { aspect-ratio: 16 / 9; border-right: none; border-bottom: 1px solid var(--panel-line); }
    .bay-actions { flex-direction: column; align-items: flex-start; }
    .term-head { flex-direction: column; align-items: flex-start; gap: 8px; }
}
