/* Reset */
* { margin: 0; padding: 0; box-sizing: border-box; }

/* Theme Variables */
:root, [data-theme="konsole"] {
  --bg-body: #1a1a2e;
  --bg-window: #1b1e28;
  --bg-titlebar: #2d2d3f;
  --border-color: #3a3a52;
  --text-primary: #c9d1d9;
  --text-secondary: #8b8fa3;
  --text-muted: #5a5e73;
  --accent: #1793d1;
  --accent-green: #50fa7b;
  --accent-hover: #58a6ff;
  --ascii-color: #1793d1;
}

[data-theme="dracula"] {
  --bg-body: #1e1f29;
  --bg-window: #282a36;
  --bg-titlebar: #44475a;
  --border-color: #6272a4;
  --text-primary: #f8f8f2;
  --text-secondary: #6272a4;
  --text-muted: #44475a;
  --accent: #bd93f9;
  --accent-green: #50fa7b;
  --accent-hover: #ff79c6;
  --ascii-color: #bd93f9;
}

[data-theme="nord"] {
  --bg-body: #2e3440;
  --bg-window: #3b4252;
  --bg-titlebar: #434c5e;
  --border-color: #4c566a;
  --text-primary: #eceff4;
  --text-secondary: #d8dee9;
  --text-muted: #4c566a;
  --accent: #88c0d0;
  --accent-green: #a3be8c;
  --accent-hover: #81a1c1;
  --ascii-color: #88c0d0;
}

[data-theme="gruvbox"] {
  --bg-body: #1d2021;
  --bg-window: #282828;
  --bg-titlebar: #3c3836;
  --border-color: #504945;
  --text-primary: #ebdbb2;
  --text-secondary: #a89984;
  --text-muted: #665c54;
  --accent: #fabd2f;
  --accent-green: #b8bb26;
  --accent-hover: #fe8019;
  --ascii-color: #fabd2f;
}

/* Body */
body {
  background: var(--bg-body);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  font-family: 'Fira Code', monospace;
  font-size: 14px;
  color: var(--text-primary);
  overflow: hidden;
  transition: background 0.4s ease;
}

/* Window */
.window {
  width: 96vw;
  max-width: 1100px;
  height: 92vh;
  background: var(--bg-window);
  transition: background 0.4s ease;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05);
  position: relative;
}

/* CRT Overlay */
.crt-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0.12) 0px, rgba(0,0,0,0.12) 1px, transparent 1px, transparent 3px);
}

.crt-overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.25) 100%);
}

/* Title Bar */
.titlebar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-titlebar);
  padding: 6px 12px;
  font-size: 12px;
  color: var(--text-secondary);
  user-select: none;
  border-bottom: 1px solid var(--border-color);
  transition: background 0.4s ease, color 0.4s ease;
}

.titlebar-left { display: flex; align-items: center; gap: 12px; }

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 4px;
  cursor: pointer;
}

.tab.active { background: var(--bg-window); color: var(--text-primary); }
.tab-icon { font-size: 8px; color: var(--accent-green); }
.tab-action { color: var(--text-muted); font-size: 11px; cursor: pointer; }

.titlebar-center {
  color: var(--text-secondary);
  font-size: 12px;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.titlebar-right { display: flex; gap: 10px; }

.titlebar-btn {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  transition: background 0.2s;
}

.titlebar-btn:hover { background: rgba(255,255,255,0.1); }
.titlebar-btn.close:hover { background: #e74c3c; color: white; }

/* Terminal Area */
.terminal {
  flex: 1;
  padding: 16px 20px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--border-color) transparent;
}

.terminal::-webkit-scrollbar { width: 6px; }
.terminal::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }

/* Command Line */
.command-line { margin-bottom: 10px; font-size: 14px; }
.prompt-arrow { color: var(--accent-green); font-weight: bold; }
.cmd-text { color: var(--text-primary); }

/* Neofetch */
.neofetch {
  display: flex;
  gap: 150px;
  padding: 8px 0;
  justify-content: center;
  align-items: center;
}

.ascii {
  color: var(--ascii-color);
  transition: color 0.4s ease;
  font-size: 12px;
  line-height: 1.3;
  flex-shrink: 0;
  white-space: pre;
}

.info { line-height: 1.7; font-size: 13px; }
.info-header { color: var(--accent); font-weight: 600; }
.info-separator { color: var(--text-muted); }
.key { color: var(--accent); font-weight: 600; }
.value { color: var(--text-primary); }
.link { text-decoration: none; transition: color 0.2s; }
.link:hover { color: var(--accent-hover); text-decoration: underline; }

.colors { display: flex; margin-top: 10px; }
.colors span { display: inline-block; width: 28px; height: 14px; }

/* Dividers & Welcome */
.divider { border: none; border-top: 1px solid var(--bg-titlebar); margin: 12px 0; }
.welcome { color: var(--text-secondary); font-size: 13px; padding: 4px 0; }
.help { font-weight: 600; color: var(--accent); }

/* Command Output */
#output { margin-top: 8px; }
#output .line { white-space: pre-wrap; line-height: 1.6; font-size: 13px; }

/* Input Line */
.input-line { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.prompt-icons { display: flex; align-items: center; gap: 6px; white-space: nowrap; }

.arch-icon {
  background: var(--accent);
  color: var(--bg-window);
  padding: 0 5px;
  border-radius: 3px;
  font-weight: 700;
  font-size: 13px;
}

.home-icon {
  font-size: 12px;
  background: var(--accent-green);
  color: var(--bg-window);
  padding: 1px 5px;
  border-radius: 3px;
}

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

#input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-family: 'Fira Code', monospace;
  font-size: 14px;
  flex: 1;
  caret-color: var(--accent-green);
}

/* Status Bar */
.statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-titlebar);
  padding: 4px 16px;
  font-size: 11px;
  color: var(--text-muted);
  border-top: 1px solid var(--border-color);
  transition: background 0.4s ease;
}

.status-check { color: var(--accent-green); }
.status-right { color: var(--text-secondary); }

/* Responsive */
@media (max-width: 768px) {
  .window { width: 100vw; height: 100vh; border-radius: 0; }
  .neofetch { flex-direction: column; gap: 16px; }
  .ascii { font-size: 10px; }
  .titlebar-center { display: none; }
  .tab-action { display: none; }
}