:root {
  --bg: #050308;
  --text: #c563ff;          /* Lila statt Grün */
  --text-dim: #7b4aa8;
  --accent: #ff86ff;
  --error: #ff4f9a;
  --success: #a4ffda;
  --banner-font-size: 4px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Fira Code", "JetBrains Mono", Menlo, Consolas, monospace;
  height: 100vh;
  display: flex;
  justify-content: center;
  align-items: stretch;
}

.terminal-wrapper {
  width: 100%;
  padding: 16px 16px 36px 16px;
}

.terminal {
  background: #020105;
  border: 1px solid #3a244d;
  box-shadow: 0 0 24px #000;
  border-radius: 8px;
  height: calc(100vh - 32px);
  padding: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.terminal-watermark {
  position: absolute;
  inset: 32px 8px 32px 8px;
  pointer-events: none;
  opacity: 0.04;
  font-size: calc(var(--banner-font-size) * 0.9);  /* NEU */
  line-height: 1.1;
  white-space: pre;
  color: var(--text);
  filter: blur(0.2px);
}

.terminal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-dim);
}

.term-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #ff5f57;
}
.term-dot:nth-child(2) { background: #febc2e; }
.term-dot:nth-child(3) { background: #28c840; }

.term-title {
  margin-left: 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.terminal-output {
  flex: 1;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.5;
  padding-right: 4px;
  white-space: pre-wrap;
  position: relative;
  z-index: 1;
}
  
.banner-small {
  font-size: var(--banner-font-size);   /* NEU */
  line-height: 1.05;
  white-space: pre;
}

.line {
  margin: 0;
}

.prompt {
  color: var(--accent);
}

.accent {
  color: var(--accent);
}

.dim {
  color: var(--text-dim);
}

.success {
  color: var(--success);
}

.error {
  color: var(--error);
}

.terminal-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 14px;
}

#prompt-label {
  color: var(--accent);
  white-space: nowrap;
}

#cmd-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font: inherit;
}

#cmd-input::placeholder {
  color: #4a335f;
}

/* kleiner Cursor-Effekt */
.cursor::after {
  content: "█";
  margin-left: 2px;
  animation: blink 1s steps(1) infinite;
}

.adv-ui {
  border: 1px dashed #3a244d;
  border-radius: 4px;
  padding: 4px 6px;
  margin-bottom: 8px;
  font-size: 13px;
}

.adv-status {
  border-bottom: 1px dashed #3a244d;
  padding-bottom: 2px;
  margin-bottom: 4px;
  font-weight: 600;
  color: var(--accent);
  white-space: pre;
}

.adv-ascii {
  min-height: 6em;
  max-height: 16em;
  margin: 0;
  white-space: pre;
  font-family: "Fira Code", "JetBrains Mono", monospace;
  color: var(--text);
  opacity: 0.9;
}

.adv-room {
  border-top: 1px dashed #3a244d;
  border-bottom: 1px dashed #3a244d;
  padding: 4px 0;
  margin: 4px 0;
  white-space: pre-wrap;
}

.adv-log {
  padding-top: 2px;
  max-height: 10em;
  overflow-y: auto;
  font-size: 12px;
}

.adv-log .success { color: var(--success); }
.adv-log .error   { color: var(--error);   }


@keyframes blink {
  50% { opacity: 0; }
}

/* --------------------------------------------------- */
/* CRT-Ambiente (#3)                                    */
/* --------------------------------------------------- */
body {
  /* Sanfter Übergang beim Stimmungswechsel (mood) */
  transition: background-color .45s ease, color .45s ease;
}

.terminal-output,
#cmd-input,
#prompt-label {
  /* Dezenter Phosphor-Glow, passt sich der Stimmungsfarbe an */
  text-shadow: 0 0 1px currentColor;
}

.crt-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  border-radius: 8px;
  background:
    repeating-linear-gradient(
      to bottom,
      rgba(0, 0, 0, 0.14) 0px,
      rgba(0, 0, 0, 0.14) 1px,
      transparent 1px,
      transparent 3px
    ),
    radial-gradient(125% 125% at 50% 50%, transparent 58%, rgba(0, 0, 0, 0.5) 100%);
  animation: crt-flicker 6s ease-in-out infinite;
}

@keyframes crt-flicker {
  0%, 100% { opacity: 0.78; }
  45%      { opacity: 0.9; }
  50%      { opacity: 0.7; }
  55%      { opacity: 0.88; }
}

#watermark.terminal-watermark {
  animation: watermark-breathe 9s ease-in-out infinite;
}

@keyframes watermark-breathe {
  0%, 100% { opacity: 0.04; }
  50%      { opacity: 0.075; }
}

@media (prefers-reduced-motion: reduce) {
  .crt-overlay,
  #watermark.terminal-watermark { animation: none; }
}


/* --------------------------------------------------- */
/* NCURSED OVERLAY GRID                                */
/* --------------------------------------------------- */
.ncursed-overlay {
  position: absolute;
  inset: 38px 12px 12px 12px;
  background: var(--bg);
  z-index: 4;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}
.ncursed-grid {
  display: inline-block;
  font-family: "Fira Code", "JetBrains Mono", Menlo, Consolas, monospace;
  line-height: 1.15;
  font-size: 14px;
  text-shadow: 0 0 1px currentColor;
}
.ncursed-row {
  display: block;
  white-space: pre;
}
.ncursed-cell {
  display: inline-block;
  width: 0.6em;
  text-align: center;
  box-sizing: border-box;
  white-space: pre;
}
/* darkmatrix-Regen */
.ncursed-cell.mtx-head {
  color: var(--accent);
  text-shadow: 0 0 7px var(--accent);
}
.ncursed-cell.mtx-tail {
  color: var(--text);
}
/* NCURSED STYLE CLASSES */
.nc-color-accent { color: var(--accent); }
.nc-color-error { color: var(--error); }
.nc-color-success { color: var(--success); }
.nc-color-dim { color: var(--text-dim); }
.nc-bold { font-weight: bold; }
.nc-blink { animation: blink 1s steps(1) infinite; }

/* --------------------------------------------------- */
/* WITCHTAIL OVERLAY & MODAL                            */
/* --------------------------------------------------- */
.witchtail-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 6;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
}
.witchtail-box {
  background: var(--bg);
  border: 2px solid var(--accent);
  box-shadow: 0 0 20px var(--accent), 6px 6px 0px rgba(0,0,0,0.5);
  border-radius: 4px;
  padding: 16px;
  font-family: "Fira Code", "JetBrains Mono", Menlo, Consolas, monospace;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 85%;
  min-width: 320px;
  box-sizing: border-box;
}
.witchtail-title {
  font-weight: bold;
  color: var(--accent);
  border-bottom: 1px dashed var(--text-dim);
  padding-bottom: 4px;
  margin: 0;
  text-transform: uppercase;
  font-size: 14px;
  text-align: center;
}
.witchtail-text {
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  margin: 4px 0;
}
.witchtail-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}
.witchtail-input {
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--text-dim);
  color: var(--text);
  padding: 6px 8px;
  font-family: inherit;
  font-size: 13px;
  outline: none;
  border-radius: 2px;
  width: 100%;
  box-sizing: border-box;
}
.witchtail-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 4px var(--accent);
}
.witchtail-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 6px 14px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  border-radius: 2px;
  outline: none;
  transition: all 0.15s ease;
}
.witchtail-btn:focus, .witchtail-btn:hover {
  background: var(--accent);
  color: var(--bg);
  box-shadow: 0 0 8px var(--accent);
}
.witchtail-menu {
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--text-dim);
  background: rgba(0,0,0,0.3);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  border-radius: 2px;
}
.witchtail-menu-item {
  display: flex;
  justify-content: space-between;
  padding: 6px 8px;
  background: transparent;
  border: none;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  outline: none;
  border-radius: 2px;
}
.witchtail-menu-item:focus, .witchtail-menu-item:hover {
  background: var(--text-dim);
  color: var(--bg);
}
.witchtail-menu-tag {
  font-weight: bold;
  color: var(--accent);
  margin-right: 12px;
}
.witchtail-menu-item:focus .witchtail-menu-tag,
.witchtail-menu-item:hover .witchtail-menu-tag {
  color: var(--bg);
}
.legal-footer {
  position: absolute;
  bottom: 8px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 11px;
  color: var(--text-dim);
  z-index: 10;
  font-family: monospace;
}
.legal-footer a {
  color: var(--text-dim);
  text-decoration: none;
  margin: 0 8px;
}
.legal-footer a:hover {
  color: var(--accent);
  text-decoration: underline;
}
