:root {
  --terminal-bg: linear-gradient(180deg, rgba(10, 14, 22, 0.92), rgba(7, 10, 17, 0.96));
  --terminal-border: rgba(255, 255, 255, 0.10);
  --terminal-line: rgba(255, 255, 255, 0.06);
  --terminal-shadow: 0 22px 54px rgba(0, 0, 0, 0.32);
  --terminal-text: #e5eefc;
  --terminal-muted: #91a0ba;
  --terminal-prompt: #ff8ca0;
  --terminal-command: #f8fbff;
  --terminal-output: #c7d6ef;
  --terminal-cursor: #ffd7df;
  --terminal-headline: #ffe6ec;
  --terminal-chip: rgba(242, 75, 100, 0.14);
}

html[data-theme="light"] {
  --terminal-bg: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 245, 248, 0.96));
  --terminal-border: rgba(15, 23, 42, 0.10);
  --terminal-line: rgba(15, 23, 42, 0.05);
  --terminal-shadow: 0 26px 56px rgba(148, 163, 184, 0.18);
  --terminal-text: #122033;
  --terminal-muted: #5e6b83;
  --terminal-prompt: #c0264c;
  --terminal-command: #0f172a;
  --terminal-output: #334155;
  --terminal-cursor: #d02d51;
  --terminal-headline: #8e1b3e;
  --terminal-chip: rgba(208, 45, 81, 0.10);
}

.terminal {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 220px;
  max-height: 340px;
  overflow: auto;
  padding: 0 18px 18px;
  border-radius: 18px;
  border: 1px solid var(--terminal-border);
  background: var(--terminal-bg);
  box-shadow: var(--terminal-shadow);
  color: var(--terminal-text);
  font: 500 0.95rem/1.65 "Fira Code", "JetBrains Mono", Consolas, monospace;
  scrollbar-width: thin;
  backdrop-filter: blur(14px) saturate(1.12);
}

.terminal::-webkit-scrollbar {
  width: 10px;
}

.terminal::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
}

html[data-theme="light"] .terminal::-webkit-scrollbar-thumb {
  background: rgba(15, 23, 42, 0.12);
}

.terminal::after {
  content: attr(data-hint);
  position: sticky;
  bottom: 0;
  display: block;
  margin: 8px 0 0 auto;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(10, 14, 22, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--terminal-muted);
  font-size: 0.73rem;
  letter-spacing: 0.02em;
}

html[data-theme="light"] .terminal::after {
  background: rgba(255, 255, 255, 0.88);
  border-color: rgba(15, 23, 42, 0.08);
}

.terminal[data-paused="true"]::after {
  content: 'Animation en pause';
}

.terminal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 0 14px;
  margin-bottom: 10px;
  background: inherit;
  border-bottom: 1px solid var(--terminal-line);
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  box-shadow: 0 0 10px currentColor;
}

.terminal-dot--red { color: #ff5c7a; background: currentColor; }
.terminal-dot--yellow { color: #fbbf24; background: currentColor; }
.terminal-dot--green { color: #22c55e; background: currentColor; }

.terminal-heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  margin-right: auto;
}

.terminal-title {
  color: var(--terminal-headline);
  font-size: 0.84rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.terminal-subtitle {
  color: var(--terminal-muted);
  font-size: 0.72rem;
}

.terminal-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--terminal-line);
  background: var(--terminal-chip);
  color: var(--terminal-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.terminal-line,
.terminal-output,
.terminal-note {
  width: 100%;
}

.terminal-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  margin-top: 6px;
}

.terminal-prompt {
  color: var(--terminal-prompt);
  font-weight: 700;
}

.terminal-command {
  color: var(--terminal-command);
}

.terminal-badge {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.06);
  color: var(--terminal-muted);
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

html[data-theme="light"] .terminal-badge {
  background: rgba(15, 23, 42, 0.05);
}

.terminal-output {
  margin-top: 4px;
  padding-left: 15px;
  color: var(--terminal-output);
  white-space: pre-wrap;
}

.terminal-note {
  margin: 5px 0 2px 15px;
  color: var(--terminal-muted);
  font-size: 0.78rem;
  font-style: italic;
}

.terminal-line[data-category="linux"] .terminal-badge { background: rgba(99, 102, 241, 0.14); color: #c7d2fe; }
.terminal-line[data-category="network"] .terminal-badge { background: rgba(6, 182, 212, 0.14); color: #bae6fd; }
.terminal-line[data-category="services"] .terminal-badge { background: rgba(34, 197, 94, 0.14); color: #bbf7d0; }
.terminal-line[data-category="web"] .terminal-badge { background: rgba(249, 115, 22, 0.14); color: #fed7aa; }
.terminal-line[data-category="dhcp"] .terminal-badge { background: rgba(168, 85, 247, 0.14); color: #e9d5ff; }
.terminal-line[data-category="dns"] .terminal-badge { background: rgba(236, 72, 153, 0.14); color: #fbcfe8; }
.terminal-line[data-category="ad"] .terminal-badge { background: rgba(59, 130, 246, 0.14); color: #bfdbfe; }
.terminal-line[data-category="vm"] .terminal-badge { background: rgba(245, 158, 11, 0.14); color: #fde68a; }
.terminal-line[data-category="automation"] .terminal-badge { background: rgba(16, 185, 129, 0.14); color: #a7f3d0; }
.terminal-line[data-category="portfolio"] .terminal-badge { background: rgba(242, 75, 100, 0.14); color: #ffe4ea; }
.terminal-line[data-category="backup"] .terminal-badge { background: rgba(120, 113, 108, 0.16); color: #e7e5e4; }
.terminal-line[data-category="security"] .terminal-badge { background: rgba(239, 68, 68, 0.14); color: #fecaca; }

html[data-theme="light"] .terminal-line[data-category="linux"] .terminal-badge { color: #4338ca; }
html[data-theme="light"] .terminal-line[data-category="network"] .terminal-badge { color: #0369a1; }
html[data-theme="light"] .terminal-line[data-category="services"] .terminal-badge { color: #15803d; }
html[data-theme="light"] .terminal-line[data-category="web"] .terminal-badge { color: #c2410c; }
html[data-theme="light"] .terminal-line[data-category="dhcp"] .terminal-badge { color: #7e22ce; }
html[data-theme="light"] .terminal-line[data-category="dns"] .terminal-badge { color: #be185d; }
html[data-theme="light"] .terminal-line[data-category="ad"] .terminal-badge { color: #1d4ed8; }
html[data-theme="light"] .terminal-line[data-category="vm"] .terminal-badge { color: #b45309; }
html[data-theme="light"] .terminal-line[data-category="automation"] .terminal-badge { color: #047857; }
html[data-theme="light"] .terminal-line[data-category="portfolio"] .terminal-badge { color: #9f1239; }
html[data-theme="light"] .terminal-line[data-category="backup"] .terminal-badge { color: #57534e; }
html[data-theme="light"] .terminal-line[data-category="security"] .terminal-badge { color: #b91c1c; }

.terminal-cursor {
  display: inline-block;
  width: 0.62ch;
  height: 1.08em;
  margin-left: 4px;
  vertical-align: -0.12em;
  background: var(--terminal-cursor);
  border-radius: 1px;
  animation: terminal-blink 1s steps(2, start) infinite;
  box-shadow: 0 0 10px color-mix(in srgb, var(--terminal-cursor) 55%, transparent);
}

@keyframes terminal-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}

@media (max-width: 720px) {
  .terminal {
    font-size: 0.86rem;
    min-height: 190px;
    max-height: 300px;
    padding: 0 14px 16px;
  }

  .terminal-header {
    gap: 8px;
    padding: 14px 0 12px;
  }

  .terminal-status {
    font-size: 0.68rem;
  }

  .terminal-output,
  .terminal-note {
    padding-left: 12px;
    margin-left: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .terminal-cursor {
    animation: none;
    opacity: 1;
  }
}

@media print {
  .terminal {
    display: none;
  }
}

/* Annexe BTS discrète : éléments tableau/croix regroupés et masqués par défaut */
.annexe-bts details{
  border:1px solid var(--border, rgba(148,163,184,.28));
  border-radius:18px;
  padding:18px 20px;
  background:rgba(255,255,255,.04);
}
.annexe-bts summary{
  cursor:pointer;
  font-weight:700;
  color:var(--text, inherit);
}
.annexe-bts details[open]{
  box-shadow:0 14px 34px rgba(15,23,42,.08);
}
