/* ═══════════════════════════════════════════════════════════════
   BRIDGEWORKS RAIL OS — Terminal Stylesheet
   STJERNSFORS VDU-12  |  Green phosphor
   ═══════════════════════════════════════════════════════════════ */

:root {
  --fg:      #33ff33;
  --accent:  #ffcc00;
  --bg:      #000000;
  --glow:    #33ff33;
  --grid:    #0d0d0d;
  --dim:     rgba(51,255,51,0.55);
}

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

html, body {
  height: 100%;
  background: #000;
  font-family: "Fixedsys", "Terminal", "Lucida Console", "Courier New", monospace;
  font-size: 15px;
  line-height: 1.25;
  color: var(--fg);
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px 16px;
}

/* ── CRT effects ─────────────────────────────────────────────── */
@keyframes flicker {
  0%,19%,21%,23%,25%,54%,56%,100% { opacity: 1;   }
  20%,22%,24%,55%                  { opacity: .88; }
}
body { animation: flicker .14s infinite; text-shadow: 0 0 2px var(--glow), 0 0 6px rgba(51,255,51,.3); }
@media (prefers-reduced-motion: reduce) { body { animation: none; } }

body::before {
  content: "";
  position: fixed; inset: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0,0,0,.15) 0px, rgba(0,0,0,.15) 1px,
    transparent 1px, transparent 3px
  );
  pointer-events: none;
  z-index: 100;
}

/* ── Centered terminal wrapper ───────────────────────────────── */
.terminal-wrap {
  width: min(100%, 860px);
  height: min(90vh, 640px);
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(51,255,51,.35);
  background:
    linear-gradient(0deg, rgba(255,255,255,.015), transparent),
    repeating-linear-gradient(90deg, var(--grid) 0 2px, transparent 2px 4px);
}

.term-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
  border-bottom: 1px solid rgba(51,255,51,.25);
  flex-shrink: 0;
  font-size: .75em;
  opacity: .7;
  letter-spacing: 1px;
}
.back-btn {
  background: none; border: none; cursor: pointer;
  font-family: inherit; font-size: inherit;
  color: var(--fg); opacity: .6;
  text-shadow: 0 0 2px var(--glow);
  padding: 0; letter-spacing: 1px;
  transition: opacity .15s;
}
.back-btn:hover { opacity: 1; }

/* ── Splash ─────────────────────────────────────────────────── */
#splash {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 12px; padding: 24px;
}
#splash.hidden { display: none; }

#splash-logo {
  max-width: 260px;
  max-height: 160px;
  object-fit: contain;
  opacity: .85;
  filter: drop-shadow(0 0 6px rgba(51,255,51,0.5)) brightness(1.1);
}
#splash-logo.no-image { display: none; }

#splash-title { color: var(--fg); font-size: 1.05em; letter-spacing: 4px; text-align: center; }
#splash-sub   { color: var(--dim); font-size: .78em; letter-spacing: 2px; text-align: center; }

.boot-log {
  font-size: .78em; color: var(--dim);
  text-align: left; width: 100%; max-width: 500px;
  line-height: 1.65; margin-top: 8px;
}
.boot-log .ok   { color: var(--fg); }
.boot-log .warn { color: var(--accent); }

/* ── Terminal ───────────────────────────────────────────────── */
#terminal { flex: 1; display: flex; flex-direction: column; overflow: hidden; padding: 10px 14px 8px; }
#terminal.hidden { display: none; }

#output {
  flex: 1; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
  font-size: .85em; line-height: 1.3;
  scrollbar-width: thin; scrollbar-color: rgba(51,255,51,.4) transparent;
}
#output::-webkit-scrollbar { width: 5px; }
#output::-webkit-scrollbar-thumb { background: rgba(51,255,51,.3); }

#input-row {
  display: flex; align-items: center; gap: 6px;
  margin-top: 6px; border-top: 1px solid rgba(51,255,51,.2); padding-top: 6px; flex-shrink: 0;
}
#prompt {
  color: var(--accent); white-space: nowrap; font-size: .85em; flex-shrink: 0;
  text-shadow: 0 0 3px rgba(255,204,0,.5);
}
#cmd-input {
  flex: 1; background: transparent; border: none; outline: none;
  color: var(--fg); font-family: inherit; font-size: .85em;
  caret-color: var(--fg); text-shadow: 0 0 2px var(--glow); min-width: 0;
}

@media (max-width: 600px) {
  body { padding: 0; align-items: flex-start; }
  .terminal-wrap { width: 100%; height: 100vh; border: none; }
  #output, #cmd-input, #prompt { font-size: .8em; }
}
