@font-face {
  font-family: "Perfect DOS VGA 437";
  src: url("PerfectDOSVGA437.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

@font-face {
  font-family: "Symbols Nerd Font Mono";
  src: url("SymbolsNerdFontMono-Regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

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

:root {
  --bg: #050505;
  --bg-panel: #0a0a0a;
  --bg-titlebar: #111111;
  --fg: #c0caf5;
  --fg-dim: #565f89;
  --fg-muted: #333;
  --border: #2a2a2a;
  --cursor: #c0caf5;
  --accent: #33ff33;
  --glow: #33ff33;
  --terminal-font: "Perfect DOS VGA 437", "Cascadia Code", "JetBrains Mono", "Fira Code", "SF Mono", "Consolas", "Symbols Nerd Font Mono", monospace;
}

body {
  font-family: var(--terminal-font);
  font-size: 16px;
  line-height: 1.4;
  background: var(--bg);
  color: var(--fg);
  height: 100vh;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  -webkit-font-smoothing: none;
  -moz-osx-font-smoothing: unset;
  font-smooth: never;
}

/* ── Page layout ── */
.page {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 960px;
  height: 100vh;
  padding: 24px 24px 16px;
  gap: 0;
}

/* ── Command history (rendered in JS) ── */
.cmd-history {
  white-space: pre;
}

.cmd-output {
  white-space: pre;
  color: var(--fg-dim);
}

.cmd-link {
  color: #4a9a4a;
  text-decoration: none;
  transition: color 0.15s, text-shadow 0.15s;
}

.cmd-link:hover {
  color: var(--accent);
  text-shadow: 0 0 6px var(--glow);
}

.cmd-link-btn {
  background: transparent;
  border: none;
  color: #4a9a4a;
  font-family: var(--terminal-font);
  font-size: inherit;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, text-shadow 0.15s;
}

.cmd-link-btn:hover {
  color: var(--accent);
  text-shadow: 0 0 6px var(--glow);
}

/* ── Terminal window ── */
.terminal-window {
  flex: 1;
  min-height: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  border-radius: 12px / 14px;
  overflow: hidden;
  border: none;
  position: relative;
  box-shadow:
    0 0 30px rgba(0, 0, 0, 0.6),
    inset 0 0 60px rgba(0, 0, 0, 0.15);
}

/* CRT scanline overlay + vignette */
.terminal-window::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.15) 2px,
      rgba(0, 0, 0, 0.15) 4px
    ),
    radial-gradient(ellipse at center, transparent 60%, rgba(0, 0, 0, 0.35) 100%);
  pointer-events: none;
  z-index: 10;
  border-radius: inherit;
}


.cmd-history {
  white-space: pre;
  padding: 2px 0;
}

#terminal {
  flex: 1;
  min-height: 0;
  background: var(--bg-panel);
  color: var(--fg);
  font-family: var(--terminal-font);
  font-size: 16px;
  line-height: 1.2;
  padding: 0;
  margin: 0;
  overflow: hidden;
  white-space: pre;
  outline: none;
  cursor: text;
}

#terminal div {
  white-space: pre;
}

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

#terminal .cursor {
  animation: blink 1s step-end infinite;
}

#terminal span {
  white-space: pre;
}

/* ── YAML drawer (overlay) ── */
.yaml-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 420px;
  height: 100vh;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.4);
  transition: transform 0.2s ease;
}

.yaml-drawer.hidden {
  transform: translateX(100%);
  pointer-events: none;
}

.drawer-header {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-titlebar);
  border-bottom: 1px solid var(--border);
  gap: 8px;
  flex-shrink: 0;
}

.drawer-title {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.drawer-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}

.drawer-actions button {
  background: var(--bg);
  color: var(--fg-dim);
  border: 1px solid var(--border);
  padding: 2px 8px;
  font-family: inherit;
  font-size: 11px;
  cursor: pointer;
  border-radius: 2px;
}

.drawer-actions button:hover {
  color: var(--fg);
  border-color: var(--fg-dim);
}

.btn-close {
  font-size: 16px;
  line-height: 1;
  padding: 0 4px;
  border: none !important;
  background: transparent !important;
}

#yaml-editor {
  flex: 1;
  background: var(--bg-panel);
  color: var(--fg);
  border: none;
  padding: 12px;
  font-family: var(--terminal-font);
  font-size: 13px;
  line-height: 1.6;
  resize: none;
  outline: none;
  tab-size: 2;
}

/* ── Loading overlay ── */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--bg);
  color: var(--fg-dim);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  z-index: 100;
}

.loading.hidden {
  display: none;
}
