:root {
  --green:      #ff79c6;
  --green-dim:  #bd93f9;
  --green-faint:#3a1f4d;
  --bg:         #14001f;
  --cursor-col: #ff79c6;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--green);
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  font-size: 15px;
  line-height: 1.6;
  overflow-x: hidden;
}

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

body::after {
  content: '';
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 99;
  animation: flicker 8s infinite;
  background: transparent;
}

@keyframes flicker {
  0%,100% { opacity:1 }
  92%      { opacity:1 }
  92.5%    { opacity:0.85 }
  93%      { opacity:1 }
  95%      { opacity:0.9 }
  95.5%    { opacity:1 }
}

.vignette {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 98;
  background: radial-gradient(ellipse at center,
    transparent 55%,
    rgba(0,0,0,0.65) 100%
  );
}

/* ══════════════════════════════════════
   BOOT SCREEN
══════════════════════════════════════ */
#boot-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #000;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 12px 16px;
  font-family: 'Share Tech Mono', 'Courier New', monospace;
  font-size: 13px;
  line-height: 1.5;
  color: #ccc;
  transition: opacity 0.6s ease;
}

#boot-overlay.fade-out {
  opacity: 0;
  pointer-events: none;
}

#boot-log {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.boot-msg {
  display: block;
  white-space: pre-wrap;
  word-break: break-all;
  opacity: 0;
  animation: bappear 0s forwards;
}

@keyframes bappear { to { opacity: 1; } }

.boot-ok   { color: #50fa7b; }
.boot-info { color: #8be9fd; }
.boot-warn { color: #f1fa8c; }
.boot-dim  { color: #555; }
.boot-kern { color: #aaa; }
.boot-bright { color: #fff; }

.bstatus-ok     { color: #50fa7b; }
.bstatus-failed { color: #ff5555; }

#boot-progress-wrap {
  margin-top: 8px;
  height: 2px;
  background: #111;
  width: 100%;
}
#boot-progress-bar {
  height: 100%;
  background: #50fa7b;
  width: 0%;
  transition: width 0.15s linear;
}

/* ══════════════════════════════════════
   MAIN TERMINAL
══════════════════════════════════════ */
#terminal {
  position: relative;
  z-index: 1;
  max-width: 860px;
  margin: 0 auto;
  min-height: 100vh;
  padding: 24px 20px 80px;
  overflow-x: hidden;
  opacity: 0;
  transition: opacity 0.6s ease 0.1s;
}

#terminal.visible { opacity: 1; }

.topbar {
  display: flex;
  justify-content: space-between;
  color: var(--green-dim);
  font-size: 12px;
  margin-bottom: 2px;
  border-bottom: 1px solid var(--green-faint);
  padding-bottom: 4px;
}

.motd {
  margin: 18px 0 24px;
  white-space: pre;
  color: var(--green);
  font-size: 13px;
  line-height: 1.25;
  text-shadow: 0 0 8px var(--green);
}

.motd-sub {
  margin-top: 8px;
  font-size: 14px;
  color: var(--green-dim);
  white-space: normal;
}

.sysinfo {
  margin-bottom: 20px;
  color: var(--green-dim);
  font-size: 13px;
}

.sysinfo span { color: var(--green); }

.divider {
  border: none;
  border-top: 1px solid var(--green-faint);
  margin: 16px 0;
}

.output { margin-bottom: 20px; }

.line {
  display: block;
  padding: 1px 0;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
}
.line.dim    { color: var(--green-dim); }
.line.bright { color: var(--green); text-shadow: 0 0 6px var(--green); }
.line.warn   { color: #ffaa00; }
.line.error  { color: #ff4444; }
.line.comment{ color: #005515; }

.prompt-line {
  display: flex;
  align-items: flex-start;
  gap: 0;
  flex-wrap: wrap;
}

.prompt {
  color: var(--green);
  text-shadow: 0 0 6px var(--green);
  white-space: nowrap;
  user-select: none;
}

#cmd-input {
  outline: none;
  color: var(--green);
  font-family: inherit;
  font-size: inherit;
  flex: 1;
  min-width: 0;
  caret-color: var(--cursor-col);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: break-word;
}

#cmd-input:empty::before {
  content: attr(data-placeholder);
  color: var(--green-dim);
  pointer-events: none;
}

#cmd-input::selection { background: var(--green); color: var(--bg); }

#history { margin-bottom: 8px; }

.hist-entry { margin-bottom: 12px; }
.hist-prompt { color: var(--green-dim); }
.hist-prompt .prompt { color: var(--green-dim); }
.hist-output { padding-left: 0; margin-top: 2px; }

.cmd-table { border-collapse: collapse; width:100%; margin-top:4px; }
.cmd-table td { padding: 2px 16px 2px 0; vertical-align: top; }
.cmd-table td:first-child { color: var(--green); white-space:nowrap; min-width:120px; }
.cmd-table td:last-child  { color: var(--green-dim); }

.inline-code {
  color: var(--bg);
  background: var(--green-dim);
  padding: 0 4px;
  border-radius: 2px;
}

.mobile-hist-btns {
  display: none;
  gap: 8px;
  margin-bottom: 8px;
}

.mobile-hist-btns button {
  background: var(--green-faint);
  border: 1px solid var(--green-dim);
  color: var(--green);
  font-family: inherit;
  font-size: 13px;
  padding: 6px 14px;
  cursor: pointer;
  border-radius: 2px;
  -webkit-tap-highlight-color: transparent;
}

.mobile-hist-btns button:active {
  background: var(--green-dim);
  color: var(--bg);
}

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--green-faint); }

@media (max-width: 600px) {
  html, body { font-size: 13px; }
  #terminal { padding: 12px 12px 100px; }
  .motd { font-size: 8.5px; line-height: 1.15; }
  .motd-sub { font-size: 12px; }
  #cmd-input { font-size: 16px; }
  .mobile-hist-btns { display: flex; }
  .topbar { font-size: 11px; }
  .sysinfo { font-size: 12px; }
}