/* ── RETRO TERMINAL & STATUS TICKER (TypeSafe.ai aesthetic) ────────────
   Colors: Hollands oranje (#FF6600), obsidian (#0A0A0F), ink (#111118), white (#FFFFFF).
   ───────────────────────────────────────────────────────────────────────── */

/* ── Header integration ──────────────────────────────────────────────── */
.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ── Monospace Status Ticker Pill ────────────────────────────────────── */
.terminal-ticker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(17, 17, 24, 0.04);
  border: 1px solid var(--c-rule, rgba(17, 17, 24, 0.14));
  border-radius: 50px;
  padding: 5px 12px 5px 10px;
  font-family: var(--f-mono, ui-monospace, 'Cascadia Mono', 'Roboto Mono', Menlo, monospace);
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  color: var(--c-muted, #66665E);
  cursor: pointer;
  user-select: none;
  transition: border-color 0.18s, color 0.18s, background-color 0.18s, box-shadow 0.18s;
  white-space: nowrap;
}

.terminal-ticker:hover {
  border-color: #FF6600;
  color: #111118;
  background: rgba(255, 102, 0, 0.06);
  box-shadow: 0 0 10px rgba(255, 102, 0, 0.15);
}

.ticker-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #03AA5C;
  box-shadow: 0 0 6px #03AA5C;
  display: inline-block;
  animation: ticker-pulse 2s infinite ease-in-out;
}

@keyframes ticker-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

.ticker-text {
  font-weight: 500;
}

.ticker-cursor {
  color: #FF6600;
  animation: blink-cursor 1s infinite steps(2, start);
  margin-left: -2px;
}

@keyframes blink-cursor {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0; }
}

/* ── Terminal Toggle Button in Header ─────────────────────────────────── */
.terminal-btn {
  font-family: var(--f-mono, ui-monospace, 'Cascadia Mono', 'Roboto Mono', monospace);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  background: #111118;
  color: #FFFFFF;
  border: 1px solid #111118;
  border-radius: 50px;
  padding: 6px 14px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: background-color 0.18s, border-color 0.18s, transform 0.12s, box-shadow 0.18s;
  flex-shrink: 0;
}

.terminal-btn .term-prompt {
  color: #FF6600;
}

.terminal-btn:hover {
  background: #1E1E24;
  border-color: #FF6600;
  box-shadow: 0 0 12px rgba(255, 102, 0, 0.28);
  transform: translateY(-1px);
}

.terminal-btn:active {
  transform: scale(0.96);
}

/* Hide ticker on mobile screens to save header space */
@media (max-width: 860px) {
  .terminal-ticker {
    display: none;
  }
}

/* ── Terminal Overlay & Window ───────────────────────────────────────── */
.term-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(10, 10, 15, 0.75);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.24s cubic-bezier(0.16, 1, 0.3, 1),
              visibility 0.24s cubic-bezier(0.16, 1, 0.3, 1);
}

.term-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.term-window {
  --term-accent: #FF6600;
  --term-accent-rgb: 255, 102, 0;
  width: 100%;
  max-width: 860px;
  height: 640px;
  max-height: 90vh;
  background-color: #0A0A0F;
  border: 1px solid rgba(var(--term-accent-rgb), 0.35);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.8),
              0 0 40px rgba(var(--term-accent-rgb), 0.12);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  font-family: var(--f-mono, ui-monospace, 'Cascadia Mono', 'Roboto Mono', monospace);
  color: #E2E2E8;
  transform: scale(0.95) translateY(12px);
  transition: transform 0.24s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease;
}

/* ── Dynamic Terminal Themes ─────────────────────────────────────────── */
.term-window[data-theme="green"] {
  --term-accent: #03AA5C;
  --term-accent-rgb: 3, 170, 92;
}
.term-window[data-theme="amber"] {
  --term-accent: #FFB000;
  --term-accent-rgb: 255, 176, 0;
}
.term-window[data-theme="cyan"] {
  --term-accent: #00D4B2;
  --term-accent-rgb: 0, 212, 178;
}
.term-window[data-theme="matrix"] {
  --term-accent: #00FF66;
  --term-accent-rgb: 0, 255, 102;
}

.term-overlay.is-open .term-window {
  transform: scale(1) translateY(0);
}

.term-window.is-resizing {
  transition: none !important;
  user-select: none;
}

/* ── Corner Drag Resize Handle ───────────────────────────────────────── */
.term-resize-handle {
  position: absolute;
  right: 2px;
  bottom: 2px;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: nwse-resize;
  color: rgba(255, 255, 255, 0.25);
  z-index: 30;
  user-select: none;
  touch-action: none;
  transition: color 0.15s ease;
}

.term-resize-handle:hover,
.term-window.is-resizing .term-resize-handle {
  color: var(--term-accent, #FF6600);
}

/* ── CRT Scanlines Overlay ───────────────────────────────────────────── */
.term-window::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.22) 50%);
  background-size: 100% 3px;
  pointer-events: none;
  z-index: 10;
  opacity: 0.65;
}

/* ── Window Titlebar ─────────────────────────────────────────────────── */
.term-titlebar {
  height: 38px;
  background: #13131A;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  user-select: none;
  flex-shrink: 0;
}

.term-dots {
  display: flex;
  align-items: center;
  gap: 7px;
}

.term-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.12s;
}

.term-dot:hover {
  transform: scale(1.15);
}

.term-dot.close { background: #FF5F56; }
.term-dot.min { background: #FFBD2E; }
.term-dot.max { background: #27C93F; }

.term-title {
  font-size: 0.73rem;
  color: #8C8C9A;
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: 0.04em;
}

.term-title .accent {
  color: var(--term-accent);
  font-weight: 600;
}

.term-quick-bar {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
}

.term-badge-btn {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 4px;
  color: #D2D2DC;
  font-family: inherit;
  font-size: 0.65rem;
  padding: 3px 7px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.term-badge-btn:hover {
  background: var(--term-accent);
  border-color: var(--term-accent);
  color: #111118;
  font-weight: 600;
}

.term-badge-btn.active {
  background: var(--term-accent);
  color: #111118;
  font-weight: 700;
}

/* ── Terminal Body ───────────────────────────────────────────────────── */
.term-body {
  flex: 1;
  padding: 18px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 0.82rem;
  line-height: 1.5;
  scrollbar-width: thin;
  scrollbar-color: rgba(var(--term-accent-rgb), 0.3) transparent;
  position: relative;
}

.term-body::-webkit-scrollbar {
  width: 6px;
}

.term-body::-webkit-scrollbar-thumb {
  background: rgba(var(--term-accent-rgb), 0.3);
  border-radius: 3px;
}

/* ── Matrix Canvas Overlay ───────────────────────────────────────────── */
#matrix-canvas {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  background: #06060A;
}

#matrix-canvas.is-active {
  display: block;
}

/* ── Terminal Text Styles ────────────────────────────────────────────── */
.term-ascii {
  color: var(--term-accent);
  font-size: 0.65rem;
  line-height: 1.15;
  white-space: pre;
  margin: 0 0 6px 0;
  user-select: none;
}

.term-muted {
  color: #7A7A8C;
}

.term-highlight {
  color: var(--term-accent);
  font-weight: 600;
}

.term-cyan {
  color: #00D4B2;
}

.term-green {
  color: #03AA5C;
}

.term-link {
  color: var(--term-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.term-link:hover {
  color: #FFA366;
}

/* ── Command Input Line ──────────────────────────────────────────────── */
.term-prompt-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.prompt-prefix {
  color: #03AA5C;
  font-weight: 600;
  white-space: nowrap;
}

.prompt-prefix .path {
  color: #00D4B2;
}

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

.term-input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  font-family: inherit;
  font-size: 0.85rem;
  color: #FFFFFF;
  padding: 0;
  caret-color: var(--term-accent);
}

/* ── ARCADE GAMES COMMON CONTAINER ───────────────────────────────────── */
.game-panel {
  display: none;
  flex-direction: column;
  align-items: center;
  background: #06060A;
  border: 1px solid rgba(var(--term-accent-rgb), 0.35);
  border-radius: 6px;
  padding: 12px;
  margin: 6px 0;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.8);
}

.game-panel.is-active {
  display: flex;
}

.arcade-scoreboard {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 12px;
  background: #111118;
  border-bottom: 1px solid rgba(var(--term-accent-rgb), 0.25);
  margin-bottom: 10px;
  font-size: 0.72rem;
  border-radius: 4px;
}

.arcade-stat {
  display: flex;
  gap: 6px;
}

.arcade-stat .val {
  color: var(--term-accent);
  font-weight: 700;
}

.arcade-canvas-wrap {
  position: relative;
  border: 2px solid #1E1E24;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 0 15px rgba(0, 0, 0, 0.5);
}

.arcade-instructions {
  margin-top: 8px;
  font-size: 0.68rem;
  color: #7A7A8C;
  text-align: center;
}

/* ── SNAKE GAME ──────────────────────────────────────────────────────── */
#snake-canvas {
  display: block;
  background-color: #0E0E14;
  image-rendering: pixelated;
}

.snake-unlock-log {
  width: 100%;
  margin-top: 10px;
  padding: 8px 12px;
  background: rgba(var(--term-accent-rgb), 0.08);
  border: 1px solid rgba(var(--term-accent-rgb), 0.25);
  border-radius: 4px;
  font-size: 0.72rem;
  color: #E2E2E8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.snake-unlock-log .star {
  color: var(--term-accent);
}

.snake-touch-dpad {
  display: none;
  margin-top: 10px;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(2, 44px);
  gap: 6px;
  justify-content: center;
}

@media (pointer: coarse) {
  .snake-touch-dpad {
    display: grid;
  }
}

.dpad-btn {
  background: #181822;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #FFF;
  font-size: 1.1rem;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.dpad-btn:active {
  background: var(--term-accent);
  color: #111118;
}

/* ── LINGO / WORDLE (Architect & Venture Edition) ─────────────────────── */
.lingo-board {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
}

.lingo-row {
  display: flex;
  gap: 6px;
}

.lingo-cell {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: #111118;
  color: #FFF;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  font-weight: 700;
  text-transform: uppercase;
  border-radius: 4px;
  user-select: none;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.lingo-cell.correct {
  background: #03AA5C;
  border-color: #03AA5C;
  color: #FFF;
  transform: scale(1.04);
}

.lingo-cell.present {
  background: var(--term-accent);
  border-color: var(--term-accent);
  color: #111118;
  transform: scale(1.04);
}

.lingo-cell.absent {
  background: #181822;
  border-color: #242432;
  color: #6C6C7E;
}

.lingo-input-bar {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  width: 100%;
  max-width: 320px;
}

.lingo-text-input {
  flex: 1;
  background: #111118;
  border: 1px solid rgba(var(--term-accent-rgb), 0.35);
  border-radius: 4px;
  color: #FFF;
  font-family: inherit;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  padding: 6px 10px;
  text-align: center;
  outline: none;
}

.lingo-submit-btn {
  background: var(--term-accent);
  color: #111118;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.75rem;
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

.lingo-hint-box {
  margin-top: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
  font-size: 0.72rem;
  color: #A4A4B4;
  max-width: 420px;
  text-align: center;
}

/* ── PONG VS JIM-AI ─────────────────────────────────────────────────── */
#pong-canvas {
  display: block;
  background-color: #0A0A10;
  image-rendering: pixelated;
}

/* ── TETRIS / ARCHITECT BLOCK STACK ──────────────────────────────────── */
.tetris-wrap {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  justify-content: center;
}

#tetris-canvas {
  display: block;
  background-color: #090910;
  image-rendering: pixelated;
}

.tetris-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 110px;
}

.tetris-preview-box {
  background: #111118;
  border: 1px solid rgba(var(--term-accent-rgb), 0.3);
  border-radius: 4px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.tetris-preview-title {
  font-size: 0.65rem;
  color: var(--term-accent);
  font-weight: 700;
  margin-bottom: 4px;
}

#tetris-next-canvas {
  display: block;
  background: transparent;
}

/* ── SPACE INVADERS ──────────────────────────────────────────────────── */
#invaders-canvas {
  display: block;
  background-color: #06060E;
  image-rendering: pixelated;
}

/* ── NEOFETCH SYSTEM INFO ────────────────────────────────────────────── */
.neofetch-container {
  display: flex;
  gap: 22px;
  align-items: center;
  padding: 10px 4px;
  flex-wrap: wrap;
}

.neofetch-logo {
  color: var(--term-accent);
  font-size: 0.68rem;
  line-height: 1.15;
  white-space: pre;
  user-select: none;
}

.neofetch-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.76rem;
}

.neofetch-line {
  display: flex;
  gap: 8px;
}

.neofetch-label {
  color: var(--term-accent);
  font-weight: 700;
  min-width: 90px;
}

.neofetch-val {
  color: #E2E2E8;
}

.neofetch-colors {
  display: flex;
  gap: 4px;
  margin-top: 6px;
}

.neofetch-color-block {
  width: 14px;
  height: 14px;
  border-radius: 2px;
}

/* ── AI STREAMING OUTPUT ─────────────────────────────────────────────── */
.ai-response-box {
  background: rgba(var(--term-accent-rgb), 0.06);
  border-left: 3px solid var(--term-accent);
  padding: 10px 14px;
  margin: 6px 0;
  border-radius: 0 4px 4px 0;
  font-size: 0.8rem;
  line-height: 1.5;
}

.ai-badge {
  display: inline-block;
  background: var(--term-accent);
  color: #111118;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 2px;
  margin-bottom: 6px;
  text-transform: uppercase;
}
