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

/* ── Body ───────────────────────────────────────────────────────────────────── */
body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(ellipse at 20% 50%, #0d1117 0%, transparent 60%),
    radial-gradient(ellipse at 80% 20%, #0f1923 0%, transparent 55%),
    radial-gradient(ellipse at 60% 80%, #0a0f1a 0%, transparent 50%),
    #080c10;
  font-family: 'JetBrains Mono', 'Fira Code', monospace;
  overflow: hidden;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px 200px;
  z-index: 0;
}

/* ── Background logo ─────────────────────────────────────────────────────────── */
.bg-logo {
  position: fixed;
  inset: 0;
  background-image: var(--logo);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 520px auto;
  opacity: 0.04;
  filter: grayscale(1);
  pointer-events: none;
  z-index: 0;
}

/* ── Terminal window ─────────────────────────────────────────────────────────── */
.terminal {
  position: relative;
  z-index: 1;
  width: min(960px, 96vw);
  /* hauteur fixe — ne grandit ni ne rétrécit jamais */
  height: 680px;
  display: flex;
  flex-direction: column;
  background: rgba(13, 17, 23, 0.78);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 40px 100px rgba(0,0,0,0.75), 0 0 0 0.5px rgba(255,255,255,0.04) inset;
  cursor: text;
}

/* ── Titlebar ────────────────────────────────────────────────────────────────── */
.titlebar {
  display: flex;
  align-items: center;
  padding: 13px 16px;
  background: rgba(255,255,255,0.02);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  user-select: none;
  flex-shrink: 0;
}
.titlebar-dots { display: flex; gap: 8px; align-items: center; }
.dot { width: 13px; height: 13px; border-radius: 50%; display: inline-block; }
.dot-red    { background: #ff5f57; }
.dot-yellow { background: #febc2e; }
.dot-green  { background: #28c840; }
.titlebar-title {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: rgba(255,255,255,0.2);
  letter-spacing: 0.04em;
  font-weight: 300;
}
.titlebar-spacer { width: 50px; }

/* ── Screen — the whole scroll area ──────────────────────────────────────────── */
.screen {
  padding: 18px 24px 12px;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  position: relative;
}
.screen::-webkit-scrollbar { width: 3px; }
.screen::-webkit-scrollbar-track { background: transparent; }
.screen::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.07); border-radius: 2px; }

/* ── Hidden input — captures all keyboard events ─────────────────────────────── */
#cmd-input {
  position: fixed;
  opacity: 0;
  pointer-events: none;
  width: 1px; height: 1px;
  top: -9999px; left: -9999px;
}

/* ── Output lines ────────────────────────────────────────────────────────────── */
.ln {
  font-size: 14.5px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-all;
  min-height: 1.75em;
}

/* ── Live prompt line (last element in #screen) ───────────────────────────────── */
.prompt-line {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  font-size: 14.5px;
  line-height: 1.75;
  min-height: 1.75em;
  position: relative;   /* anchor for autocomplete dropdown */
  margin-top: 2px;
}

/* prompt segments — ohmyzsh style */
.p-user  { color: #cba6f7; font-weight: 500; white-space: nowrap; }
.p-at    { color: rgba(255,255,255,0.22); white-space: nowrap; }
.p-host  { color: #89b4fa; font-weight: 500; white-space: nowrap; }
.p-path  { color: #a6e3a1; font-weight: 500; white-space: nowrap; }
.p-git   { color: #f9e2af; font-size: 13px; white-space: nowrap; }
.p-arrow { color: #cba6f7; white-space: nowrap; margin-right: 8px; }

/* the text the user has typed (rendered inline in prompt-line) */
.prompt-typed { color: #cdd6f4; }

/* ghost suggestion text */
.prompt-ghost { color: rgba(255,255,255,0.18); pointer-events: none; }

/* blinking block cursor */
.prompt-cursor {
  display: inline-block;
  width: 8.5px;
  height: 1.1em;
  background: #cba6f7;
  vertical-align: text-bottom;
  margin-left: 1px;
  animation: blink 1.1s step-end infinite;
  border-radius: 1px;
}
@keyframes blink { 50% { opacity: 0; } }

/* ── Autocomplete dropdown ────────────────────────────────────────────────────── */
.ac-box {
  position: absolute;
  left: 0;
  bottom: calc(100% + 3px);
  background: rgba(16, 20, 30, 0.98);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 7px;
  overflow: hidden;
  min-width: 240px;
  max-width: 420px;
  z-index: 100;
  box-shadow: 0 8px 36px rgba(0,0,0,0.7);
}
.ac-item {
  padding: 5px 14px;
  font-size: 13.5px;
  color: rgba(255,255,255,0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
}
.ac-item + .ac-item { border-top: 1px solid rgba(255,255,255,0.04); }
.ac-item.selected,
.ac-item:hover { background: rgba(203,166,247,0.11); color: #cdd6f4; }
.ac-match { color: #cba6f7; font-weight: 500; }
.ac-desc  { color: rgba(255,255,255,0.22); font-size: 12px; margin-left: auto; padding-left: 20px; }

/* ── Output color classes ────────────────────────────────────────────────────── */
.col-white  { color: #cdd6f4; }
.col-dim    { color: rgba(255,255,255,0.18); }
.col-muted  { color: rgba(255,255,255,0.35); }
.col-green  { color: #a6e3a1; }
.col-cyan   { color: #89dceb; }
.col-blue   { color: #89b4fa; }
.col-yellow { color: #f9e2af; }
.col-red    { color: #f38ba8; }
.col-purple { color: #cba6f7; }
.col-peach  { color: #fab387; }

/* ── Shortcut bar ────────────────────────────────────────────────────────────── */
.shortcut-bar {
  display: flex;
  gap: 0;
  padding: 5px 24px;
  background: rgba(255,255,255,0.012);
  border-top: 1px solid rgba(255,255,255,0.04);
  flex-wrap: wrap;
  user-select: none;
  flex-shrink: 0;
}
.sc-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 12px 3px 0;
  font-size: 11px;
  color: rgba(255,255,255,0.18);
}
.sc-key {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 10.5px;
  color: rgba(255,255,255,0.35);
  font-family: inherit;
}

/* ── Animations ──────────────────────────────────────────────────────────────── */
@keyframes fadein {
  from { opacity: 0; transform: translateY(1px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ln { animation: fadein 0.055s ease; }
