@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@300;400;500;700&display=swap');

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

::selection {
  background: #22c55e33;
  color: #4ade80;
}

body {
  font-family: 'JetBrains Mono', monospace;
  background: #050505;
  color: #a1a1aa;
  height: 100vh;
  overflow: hidden;
  position: relative;
}

#bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.4;
}

#scanline {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255,255,255,0.008) 2px,
    rgba(255,255,255,0.008) 4px
  );
}

#scanline::after {
  content: '';
  position: absolute;
  left: 0; right: 0;
  height: 2px;
  background: rgba(255,255,255,0.03);
  animation: scanMove 8s linear infinite;
}

@keyframes scanMove {
  0% { top: -2px; }
  100% { top: 100%; }
}

#term {
  position: relative;
  z-index: 2;
  height: calc(100vh - 28px);
  display: flex;
  flex-direction: column;
  padding: 16px 20px 8px;
  max-width: 860px;
  margin: 0 auto;
}

#output {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding-bottom: 4px;
  scrollbar-width: thin;
  scrollbar-color: #1a1a1a transparent;
}

#output::-webkit-scrollbar { width: 3px; }
#output::-webkit-scrollbar-thumb { background: #1a1a1a; border-radius: 2px; }

.l {
  line-height: 1.65;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 1.65em;
}

.l.blank { min-height: 1.65em; }

.d  { color: #52525b; }
.dd { color: #3f3f46; }
.g  { color: #4ade80; text-shadow: 0 0 8px rgba(74,222,128,0.15); }
.gg { color: #22c55e; }
.r  { color: #fb7185; }
.rr { color: #f43f5e; }
.y  { color: #fbbf24; }
.yy { color: #f59e0b; }
.b  { color: #60a5fa; }
.c  { color: #22d3ee; }
.w  { color: #fafafa; }
.ww { color: #e4e4e7; }
.m  { color: #c084fc; }
.dim { color: #71717a; }
.bold { font-weight: 700; }
.glow { text-shadow: 0 0 12px rgba(74,222,128,0.25), 0 0 30px rgba(74,222,128,0.08); }
.glow-r { text-shadow: 0 0 12px rgba(251,113,133,0.25); }

#input-line {
  display: flex;
  align-items: center;
  min-height: 28px;
  flex-shrink: 0;
  padding-top: 4px;
  border-top: 1px solid #111;
}

#prompt {
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  flex-shrink: 0;
}

.p-user { color: #4ade80; }
.p-at { color: #3f3f46; }
.p-host { color: #22d3ee; }
.p-sep { color: #52525b; margin: 0 2px; }

#cmd {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: #fafafa;
  font-family: 'JetBrains Mono', monospace;
  font-size: 13px;
  caret-color: #4ade80;
  padding: 0;
  text-shadow: 0 0 6px rgba(250,250,250,0.05);
}

/* ── status bar ── */

#statusbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 10;
  height: 28px;
  background: #0a0a0a;
  border-top: 1px solid #151515;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 20px;
  font-size: 11px;
  color: #52525b;
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: none;
}

#statusbar::-webkit-scrollbar { display: none; }

.sb-item {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.sb-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 6px #4ade80;
  animation: sbPulse 2s ease infinite;
}

@keyframes sbPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.sb-right {
  margin-left: auto;
  color: #3f3f46;
}

/* ── state: paused (toggled via JS) ── */
.sb-item.state-pause .sb-dot {
  background: #fbbf24;
  box-shadow: 0 0 6px #fbbf24;
  animation: sbPulse 1.2s ease infinite;
}
#sb-mode-text.state-pause { color: #fbbf24; }

/* ── line entrance animation ── */
@keyframes lineIn {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}
.l { animation: lineIn 80ms ease-out; }

/* ── boot progress bar ── */

.boot-bar {
  display: inline-block;
  font-size: 13px;
}

.boot-bar .filled { color: #4ade80; }
.boot-bar .empty { color: #1a1a1a; }

/* ── table ── */

.t-row {
  display: flex;
  gap: 0;
}

.t-col {
  flex-shrink: 0;
}

@media (max-width: 600px) {
  #term { padding: 10px 12px 6px; }
  .l { font-size: 11px; line-height: 1.55; }
  #prompt { font-size: 11px; }
  #cmd { font-size: 11px; }
  #statusbar { font-size: 10px; gap: 14px; padding: 0 10px; }
}

/* ── cursor blink (only when idle) ── */
@keyframes caretBlink {
  0%, 49%   { caret-color: #4ade80; }
  50%, 100% { caret-color: transparent; }
}
#cmd:not(:focus) { caret-color: transparent; }
#cmd:focus { animation: caretBlink 1.1s steps(1) infinite; }

/* ── prompt focus glow ── */
#input-line:focus-within {
  border-top-color: #1f2937;
  box-shadow: 0 -1px 12px -8px rgba(74, 222, 128, 0.4);
  transition: border-color 200ms ease, box-shadow 200ms ease;
}
#input-line { transition: border-color 200ms ease, box-shadow 200ms ease; }

/* ── extra color helpers ── */
.o  { color: #fb923c; }
.oo { color: #f97316; }
.p  { color: #f472b6; }

/* ── status bar: wrap on narrow screens ── */
@media (max-width: 480px) {
  #statusbar { gap: 10px; flex-wrap: wrap; height: auto; min-height: 28px; padding: 4px 10px; }
  .sb-right { margin-left: 0; width: 100%; }
}

/* ── medium screens: tighter padding ── */
@media (min-width: 601px) and (max-width: 900px) {
  #term { padding: 14px 16px 8px; }
}

/* ── accessibility: respect reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
