/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   DONAU2SPACE // DEV ENTITY — Styles
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

:root {
  --bg: #05070b;
  --panel: rgba(10, 14, 20, 0.72);
  --text: #cfe3ff;
  --muted: #7ea3c7;
  --border: rgba(255, 255, 255, 0.08);
  --green: #7ee787;
  --blue: #6cb6ff;
  --yellow: #ffcc66;
  --red: #ff4d4d;
  --pink: #ff7ad9;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font: 14px/1.55 var(--font-mono);
  background:
    radial-gradient(900px 520px at 18% 12%, rgba(126, 231, 135, 0.07), transparent 60%),
    radial-gradient(760px 420px at 82% 8%, rgba(108, 182, 255, 0.09), transparent 60%),
    radial-gradient(920px 520px at 60% 90%, rgba(255, 122, 217, 0.06), transparent 60%),
    linear-gradient(180deg, #04060a, var(--bg));
  transition: filter 1.5s ease;
}

/* ── Layers ──────────────────────────────────── */

canvas#starfield {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

#matrix-rain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  font-size: 12px;
  color: #0f0;
  z-index: 1;
  mix-blend-mode: screen;
  padding: 18px;
  white-space: pre-wrap;
  line-height: 1.1;
  overflow: hidden;
}

#scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 5;
  background: repeating-linear-gradient(
    to bottom,
    rgba(255, 255, 255, 0.015),
    rgba(255, 255, 255, 0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.22;
  mix-blend-mode: overlay;
}

#screen-tear {
  position: fixed;
  inset: 0;
  z-index: 8;
  pointer-events: none;
  display: none;
}

/* ── Frame ───────────────────────────────────── */

.entity-frame {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  gap: 0;
}

/* ── Node Bar ────────────────────────────────── */

.node-bar-wrap {
  width: min(980px, 100%);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  margin-bottom: 6px;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.7;
  transition: opacity 0.5s;
}

.node-bar-wrap:hover { opacity: 1; }

.node-bar-label {
  color: var(--muted);
  margin-right: 4px;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-size: 10px;
}

#node-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.node-pill {
  padding: 1px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
  font-size: 11px;
  white-space: nowrap;
}

/* ── Terminal Card ───────────────────────────── */

.terminal-card {
  width: min(980px, 100%);
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(255, 255, 255, 0.008));
  border-radius: 18px;
  overflow: hidden;
  box-shadow:
    0 24px 80px rgba(0, 0, 0, 0.55),
    0 0 120px rgba(108, 182, 255, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: transform 0.3s ease, opacity 0.8s ease;
  max-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
}

/* ── Title Bar ───────────────────────────────── */

.title-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: rgba(10, 14, 20, 0.6);
  flex-shrink: 0;
}

.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot-r { background: #ff5f57; }
.dot-y { background: #febc2e; }
.dot-g { background: #28c840; }

.title-text {
  margin-left: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.2px;
}

.title-tags {
  margin-left: auto;
  color: rgba(207, 227, 255, 0.55);
  font-size: 12px;
  display: flex;
  gap: 10px;
  align-items: center;
}

.tag-pill {
  padding: 2px 10px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.18);
}

.tag-pill b { color: var(--green); font-weight: 600; }

/* ── Screen ──────────────────────────────────── */

.terminal-body {
  padding: 16px 16px 10px;
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

#screen {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  background: rgba(0, 0, 0, 0.22);
  padding: 14px;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-behavior: smooth;
}

#screen::-webkit-scrollbar { width: 4px; }
#screen::-webkit-scrollbar-track { background: transparent; }
#screen::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.1); border-radius: 2px; }

/* ── Lines ───────────────────────────────────── */

.line {
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 1em;
}

.system-msg {
  font-style: italic;
  opacity: 0.85;
}

.dim { opacity: 0.65; }

/* ── Color classes ───────────────────────────── */

.c-green { color: var(--green); }
.c-blue  { color: var(--blue); }
.c-yellow { color: var(--yellow); }
.c-red   { color: var(--red); }
.c-pink  { color: var(--pink); }
.c-muted { color: var(--muted); }
.c-text  { color: var(--text); }

/* ── Prompt ──────────────────────────────────── */

.prompt-row {
  display: flex;
  gap: 0;
  align-items: flex-start;
  padding-top: 6px;
  flex-shrink: 0;
}

.ps1 {
  white-space: pre;
  user-select: none;
  flex-shrink: 0;
}

#input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font: inherit;
  flex: 1;
  padding: 0;
  margin: 0;
  caret-color: var(--green);
  min-width: 0;
}

#input::placeholder {
  color: rgba(126, 163, 199, 0.35);
}

/* ── Footer ──────────────────────────────────── */

.entity-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-size: 12px;
  background: rgba(10, 14, 20, 0.52);
  flex-shrink: 0;
}

a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dashed rgba(126, 163, 199, 0.35);
}

a:hover {
  color: var(--text);
  border-bottom-color: rgba(126, 231, 135, 0.55);
}

/* ── Overlays ────────────────────────────────── */

#overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(4px);
}

.overlay-box {
  width: min(760px, calc(100% - 40px));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: rgba(10, 14, 20, 0.88);
  padding: 18px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.75);
}

#overlay-text {
  margin: 0;
  white-space: pre-wrap;
  color: var(--green);
  font: inherit;
}

.overlay-hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

/* ── Deep Space Overlay ──────────────────────── */

#deep-space-overlay {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 200;
  background: #000;
  color: var(--text);
  font: 14px/1.8 var(--font-mono);
  padding: 40px;
}

.ds-title {
  font-size: 16px;
  color: rgba(207, 227, 255, 0.6);
  letter-spacing: 3px;
  margin-bottom: 4px;
}

.ds-line { color: rgba(255, 255, 255, 0.1); }
.ds-data { color: rgba(207, 227, 255, 0.4); font-size: 13px; }
.ds-msg  { color: rgba(207, 227, 255, 0.5); font-size: 13px; }
.ds-warn { color: var(--yellow); font-size: 13px; }

/* ── Reality Overlay ─────────────────────────── */

#reality-overlay {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 150;
  background: rgba(20, 0, 0, 0.9);
  color: var(--red);
  font: 14px/1.8 var(--font-mono);
  padding: 40px;
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   EFFECTS / ANIMATIONS
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

/* ── Glitch ──────────────────────────────────── */

.fx-glitch {
  animation: glitch 0.18s infinite;
}

@keyframes glitch {
  0%   { filter: hue-rotate(0deg) saturate(1); }
  25%  { filter: hue-rotate(90deg) saturate(1.5); }
  50%  { filter: hue-rotate(180deg) saturate(1.2); }
  75%  { filter: hue-rotate(270deg) saturate(1.3); }
  100% { filter: hue-rotate(360deg) saturate(1); }
}

/* ── Shake ────────────────────────────────────── */

.fx-shake {
  animation: shake 0.45s ease-in-out 1;
}

@keyframes shake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  20% { transform: translate3d(-3px, 2px, 0); }
  40% { transform: translate3d(2px, -2px, 0); }
  60% { transform: translate3d(-2px, -1px, 0); }
  80% { transform: translate3d(2px, 2px, 0); }
}

/* ── Blink Red ───────────────────────────────── */

.fx-blink-red {
  animation: blink-red 0.28s 10;
}

@keyframes blink-red {
  50% { background-color: #1b0000; }
}

/* ── Scanline Pulse ──────────────────────────── */

.fx-scan-pulse {
  animation: scan-pulse 1.2s ease-in-out 1;
}

@keyframes scan-pulse {
  0%, 100% { opacity: 0.22; }
  50% { opacity: 0.5; }
}

/* ── Typography Shift ────────────────────────── */

.fx-typo-shift {
  font-family: Georgia, 'Times New Roman', serif !important;
  letter-spacing: 1px;
}

.fx-typo-shift * {
  font-family: inherit !important;
}

/* ── Blackout ────────────────────────────────── */

.fx-blackout {
  opacity: 0 !important;
}

/* ── Deep Space Fade ─────────────────────────── */

.deep-space-fade {
  opacity: 0.05;
  transform: scale(0.95);
  transition: opacity 1s ease, transform 1s ease;
}

/* ── Cursor Blink ────────────────────────────── */

#input {
  animation: cursor-breathe 2s ease-in-out infinite;
}

@keyframes cursor-breathe {
  0%, 100% { caret-color: var(--green); }
  50% { caret-color: rgba(126, 231, 135, 0.4); }
}

/* ── System Message Fade-In ──────────────────── */

.system-msg {
  animation: msg-fade 0.5s ease-in;
}

@keyframes msg-fade {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 0.85; transform: translateY(0); }
}

/* ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   RESPONSIVE
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ */

@media (max-width: 768px) {
  body { font-size: 13px; }

  .entity-frame { padding: 8px; }

  .terminal-card {
    border-radius: 12px;
    max-height: calc(100vh - 60px);
  }

  .title-tags { display: none; }

  .title-bar { padding: 10px 12px; }

  .terminal-body { padding: 10px 10px 6px; }

  #screen { padding: 10px; border-radius: 10px; }

  .node-bar-wrap { font-size: 10px; padding: 4px 8px; overflow-x: auto; }

  .entity-footer {
    padding: 8px 12px;
    font-size: 11px;
    flex-direction: column;
    gap: 4px;
  }

  .prompt-row { font-size: 13px; }

  #deep-space-overlay { padding: 20px; font-size: 12px; }
}

@media (max-width: 480px) {
  body { font-size: 12px; }

  .node-bar-wrap { display: none; }

  .terminal-card { border-radius: 10px; }

  #screen { padding: 8px; }
}

/* ── Reduced Motion ──────────────────────────── */

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

  canvas#starfield { opacity: 0.3; }
  #matrix-rain { display: none; }
  #scanlines { opacity: 0.05; }
}
