/* ==========================================================================
   WORM GPT PLUS - ELITE CYBER TERMINAL & NEURAL INTERFACE
   Ultra-Professional, High-Performance, Fully Responsive Cyberpunk System
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. DESIGN TOKENS & CYBER COLOR PALETTE
   -------------------------------------------------------------------------- */
:root {
  /* Background layers */
  --bg-deep: #030605;
  --bg-surface: #070d0a;
  --bg-surface-elevated: #0c1511;
  --bg-card: rgba(8, 17, 13, 0.85);
  --bg-glass: rgba(6, 14, 10, 0.72);
  --bg-glass-heavy: rgba(4, 9, 7, 0.92);

  /* Cyber Accents */
  --accent-green: #00ff66;
  --accent-green-glow: rgba(0, 255, 102, 0.35);
  --accent-green-faint: rgba(0, 255, 102, 0.08);
  --accent-green-border: rgba(0, 255, 102, 0.22);

  --accent-cyan: #00e5ff;
  --accent-cyan-glow: rgba(0, 229, 255, 0.35);
  --accent-cyan-faint: rgba(0, 229, 255, 0.08);

  --accent-crimson: #ff0055;
  --accent-crimson-glow: rgba(255, 0, 85, 0.38);

  --accent-amber: #ffb703;
  --accent-violet: #a855f7;

  /* Text & Typography */
  --text-primary: #e6fcf0;
  --text-secondary: #90b89e;
  --text-muted: #527961;
  --text-dim: #2f4b39;

  /* Typography Font Stacks */
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Share Tech Mono', monospace;
  --font-ui: 'Outfit', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;

  /* Borders & Radii */
  --border-subtle: rgba(0, 255, 102, 0.12);
  --border-neon: rgba(0, 255, 102, 0.3);
  --border-glow: 0 0 12px rgba(0, 255, 102, 0.2);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  /* Sidebar Dimensions */
  --sidebar-width: 290px;
  --header-height: 64px;

  /* Animation Timings */
  --ease-spring: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 0.18s;
  --duration-normal: 0.28s;
}

/* --------------------------------------------------------------------------
   2. GLOBAL BASE & RESET
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html, body {
  width: 100%;
  height: 100%;
  height: 100dvh;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.5;
  position: relative;
}

/* Subtle Animated Background Grid & Radial Ambience */
body {
  background-image: 
    radial-gradient(circle at 12% 15%, rgba(0, 255, 102, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 88% 85%, rgba(0, 229, 255, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 50% 50%, rgba(168, 85, 247, 0.03) 0%, transparent 60%),
    linear-gradient(rgba(0, 255, 102, 0.015) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 255, 102, 0.015) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 100% 100%, 32px 32px, 32px 32px;
  background-position: center;
  background-attachment: fixed;
}

/* Matrix Rain Canvas: Fixed layer that never pushes content */
#matrixCanvas {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  width: 100vw !important;
  height: 100vh !important;
  height: 100dvh !important;
  pointer-events: none !important;
  z-index: 1 !important;
  opacity: 0.38;
}

/* Subtle CRT Scanlines (Non-intrusive) */
body::after {
  content: "";
  position: fixed;
  top: 0; left: 0; width: 100vw; height: 100vh;
  background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.28) 50%);
  background-size: 100% 4px;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.45;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: rgba(3, 7, 5, 0.6);
}
::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 102, 0.22);
  border-radius: var(--radius-xs);
  transition: background var(--duration-fast);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
}

/* --------------------------------------------------------------------------
   3. APP CONTAINER LAYOUT
   -------------------------------------------------------------------------- */
.app-container {
  position: relative;
  z-index: 10;
  display: flex;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* --------------------------------------------------------------------------
   4. CYBER SIDEBAR
   -------------------------------------------------------------------------- */
.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-glass-heavy);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 100;
  transition: transform var(--duration-normal) var(--ease-spring);
  box-shadow: 12px 0 35px rgba(0, 0, 0, 0.6);
}

.sidebar-header {
  padding: 18px 18px 16px;
  border-bottom: 1px solid var(--border-subtle);
  background: linear-gradient(180deg, rgba(0, 255, 102, 0.04) 0%, transparent 100%);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  transition: transform var(--duration-fast);
}
.brand-badge:hover {
  transform: translateY(-1px);
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: #020503;
  border: 1px solid var(--accent-green);
  box-shadow: 0 0 14px var(--accent-green-glow), inset 0 0 10px rgba(0, 255, 102, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent-green);
  font-size: 20px;
  flex-shrink: 0;
}

.brand-info h2 {
  font-family: var(--font-ui);
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.8px;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 6px;
  line-height: 1.2;
}
.brand-info h2 span {
  color: var(--accent-crimson);
  font-size: 0.85rem;
  background: rgba(255, 0, 85, 0.12);
  border: 1px solid rgba(255, 0, 85, 0.35);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  text-shadow: 0 0 8px var(--accent-crimson-glow);
}

.sub-status {
  font-size: 0.72rem;
  color: var(--accent-green);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 3px;
  letter-spacing: 0.5px;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent-green);
  box-shadow: 0 0 10px var(--accent-green);
  animation: radarPulse 2s infinite ease-in-out;
}
@keyframes radarPulse {
  0% { transform: scale(0.9); opacity: 0.6; }
  50% { transform: scale(1.35); opacity: 1; box-shadow: 0 0 14px var(--accent-green); }
  100% { transform: scale(0.9); opacity: 0.6; }
}

.sidebar-actions {
  padding: 14px 16px;
}

.btn-new-chat {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, rgba(0, 255, 102, 0.12) 0%, rgba(0, 229, 255, 0.08) 100%);
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
  padding: 11px 16px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.85rem;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all var(--duration-fast) ease;
  box-shadow: 0 0 12px rgba(0, 255, 102, 0.15);
}
.btn-new-chat:hover {
  background: var(--accent-green);
  color: #030604;
  box-shadow: 0 0 20px var(--accent-green-glow);
  transform: translateY(-1px);
}
.btn-new-chat:active {
  transform: translateY(0);
}

.sidebar-sessions {
  flex: 1;
  overflow-y: auto;
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.session-section-title {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-weight: 700;
  letter-spacing: 1.2px;
  padding: 8px 8px 4px;
  text-transform: uppercase;
}

.session-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--duration-fast);
  font-size: 0.84rem;
  user-select: none;
}
.session-item:hover {
  background: rgba(0, 255, 102, 0.06);
  border-color: rgba(0, 255, 102, 0.18);
  color: var(--text-primary);
}
.session-item.active {
  background: linear-gradient(90deg, rgba(0, 255, 102, 0.14) 0%, rgba(0, 229, 255, 0.05) 100%);
  border-color: var(--accent-green);
  color: var(--accent-green);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent-green);
}

.session-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-del-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.85rem;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-xs);
  cursor: pointer;
  opacity: 0;
  transition: all var(--duration-fast);
}
.session-item:hover .session-del-btn,
.session-item.active .session-del-btn {
  opacity: 0.8;
}
.session-del-btn:hover {
  opacity: 1 !important;
  color: var(--accent-crimson);
  background: rgba(255, 0, 85, 0.15);
}

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sidebar-footer-info {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.72rem;
  letter-spacing: 0.8px;
}
.sidebar-footer-info i {
  color: var(--accent-cyan);
}

/* Sidebar Backdrop on Mobile */
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 95;
  opacity: 0;
  visibility: hidden;
  transition: all var(--duration-normal) ease;
}
.sidebar-backdrop.active {
  opacity: 1;
  visibility: visible;
}

/* --------------------------------------------------------------------------
   5. MAIN WORKSPACE & HEADER
   -------------------------------------------------------------------------- */
.chat-main {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: transparent;
}

/* Top Navbar Header */
.chat-header {
  height: var(--header-height);
  padding: 0 20px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 50;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.header-meta h1 {
  font-family: var(--font-ui);
  font-size: 1.15rem;
  font-weight: 800;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.5px;
}

.hacker-badge {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-green);
  background: rgba(0, 255, 102, 0.12);
  border: 1px solid rgba(0, 255, 102, 0.35);
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  text-shadow: 0 0 8px var(--accent-green-glow);
}

/* Persona Selector Dropdown */
.persona-selector-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 255, 102, 0.05);
  border: 1px solid var(--border-subtle);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  transition: border-color var(--duration-fast);
}
.persona-selector-wrap:hover {
  border-color: var(--accent-green);
}
.persona-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}
.persona-select {
  background: transparent;
  border: none;
  outline: none;
  color: var(--accent-green);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}
.persona-select option {
  background: #08110b;
  color: var(--text-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: rgba(0, 255, 102, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-fast);
}
.icon-btn:hover {
  background: rgba(0, 255, 102, 0.14);
  border-color: var(--accent-green);
  color: var(--accent-green);
  box-shadow: 0 0 10px rgba(0, 255, 102, 0.25);
  transform: translateY(-1px);
}
.mobile-sidebar-toggle {
  display: none;
}

.btn-matrix-toggle,
.btn-toolkit {
  height: 38px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  background: rgba(0, 255, 102, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
}
.btn-matrix-toggle:hover {
  background: rgba(0, 255, 102, 0.15);
  border-color: var(--accent-green);
  color: var(--accent-green);
  box-shadow: 0 0 12px rgba(0, 255, 102, 0.25);
}

.btn-toolkit {
  background: linear-gradient(135deg, rgba(0, 229, 255, 0.1) 0%, rgba(168, 85, 247, 0.08) 100%);
  border-color: rgba(0, 229, 255, 0.35);
  color: var(--accent-cyan);
}
.btn-toolkit:hover {
  background: var(--accent-cyan);
  color: #030604;
  box-shadow: 0 0 16px var(--accent-cyan-glow);
  border-color: var(--accent-cyan);
  transform: translateY(-1px);
}

/* --------------------------------------------------------------------------
   6. TERMINAL MESSAGES CONTAINER & STREAMING
   -------------------------------------------------------------------------- */
.messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 24px 28px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  scroll-behavior: smooth;
}

/* Welcome Hero Screen */
.welcome-hero {
  max-width: 860px;
  margin: 20px auto 40px;
  text-align: center;
  padding: 10px;
  animation: fadeIn 0.4s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.ascii-banner {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.15;
  color: var(--accent-green);
  text-shadow: 0 0 10px var(--accent-green-glow);
  white-space: pre;
  overflow-x: auto;
  margin-bottom: 16px;
  user-select: none;
}

.welcome-hero h3 {
  font-family: var(--font-ui);
  font-size: 1.85rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
  margin-bottom: 8px;
}
.welcome-hero h3 span {
  color: var(--accent-crimson);
  text-shadow: 0 0 14px var(--accent-crimson-glow);
}
.welcome-hero p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 18px;
  max-width: 620px;
  margin-left: auto;
  margin-right: auto;
}

.cyber-info-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 28px;
}
.cyber-info-strip span {
  font-size: 0.74rem;
  color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.07);
  border: 1px solid rgba(0, 229, 255, 0.25);
  padding: 3px 10px;
  border-radius: var(--radius-xs);
  letter-spacing: 0.5px;
}

/* Quick Prompts Grid */
.quick-prompts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  text-align: left;
}

.quick-prompt-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-spring);
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
  overflow: hidden;
}
.quick-prompt-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; width: 3px; height: 100%;
  background: var(--accent-green);
  opacity: 0;
  transition: opacity var(--duration-fast);
}
.quick-prompt-card:hover {
  background: rgba(12, 25, 18, 0.95);
  border-color: var(--accent-green);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 255, 102, 0.12);
}
.quick-prompt-card:hover::before {
  opacity: 1;
}

.quick-prompt-card .title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-green);
  display: flex;
  align-items: center;
  gap: 8px;
}
.quick-prompt-card .title i {
  color: var(--accent-cyan);
}
.quick-prompt-card .desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* --------------------------------------------------------------------------
   7. CHAT MESSAGE ROWS & BUBBLES
   -------------------------------------------------------------------------- */
.message-row {
  display: flex;
  gap: 14px;
  max-width: 900px;
  width: 100%;
  animation: fadeInBubble 0.25s ease-out;
}
@keyframes fadeInBubble {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.message-row.user {
  margin-left: auto;
  flex-direction: row-reverse;
}
.message-row.bot {
  margin-right: auto;
}

.msg-avatar {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 16px;
}
.user-avatar {
  background: rgba(0, 229, 255, 0.12);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  box-shadow: 0 0 12px var(--accent-cyan-glow);
}
.bot-avatar {
  background: rgba(0, 255, 102, 0.12);
  border: 1px solid var(--accent-green);
  color: var(--accent-green);
  box-shadow: 0 0 12px var(--accent-green-glow);
}

.msg-content-wrap {
  max-width: calc(100% - 52px);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.message-row.user .msg-content-wrap {
  align-items: flex-end;
}

.msg-header-tag {
  font-size: 0.68rem;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  font-weight: 700;
}
.message-row.user .msg-header-tag {
  color: var(--accent-cyan);
}
.message-row.bot .msg-header-tag {
  color: var(--accent-green);
}

.msg-bubble {
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 0.94rem;
  line-height: 1.65;
  word-break: break-word;
  position: relative;
}

/* User Message Styling */
.message-row.user .msg-bubble {
  background: linear-gradient(135deg, rgba(0, 48, 30, 0.9) 0%, rgba(4, 28, 38, 0.95) 100%);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: #f0fdf7;
  border-top-right-radius: var(--radius-xs);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.4);
}

/* Bot Message Styling */
.message-row.bot .msg-bubble {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-top-left-radius: var(--radius-xs);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

/* Streaming blinking cursor */
.streaming-cursor {
  display: inline-block;
  width: 8px;
  height: 15px;
  background: var(--accent-green);
  margin-left: 4px;
  vertical-align: middle;
  animation: cursorBlink 0.8s infinite;
  box-shadow: 0 0 8px var(--accent-green);
}
@keyframes cursorBlink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

/* Message Actions Bar (Copy, TTS) */
.msg-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}
.msg-action-btn {
  background: transparent;
  border: 1px solid rgba(0, 255, 102, 0.15);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all var(--duration-fast);
}
.msg-action-btn:hover {
  background: rgba(0, 255, 102, 0.08);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

/* Thinking Indicator Bubble */
.bot-thinking-bubble {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(0, 255, 102, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--accent-green);
  font-size: 0.82rem;
  letter-spacing: 0.5px;
  width: fit-content;
}
.thinking-spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 255, 102, 0.2);
  border-top-color: var(--accent-green);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Markdown Content Inside Messages */
.markdown-body {
  font-family: var(--font-mono);
}
.markdown-body p {
  margin-bottom: 0.85em;
}
.markdown-body p:last-child {
  margin-bottom: 0;
}
.markdown-body h1, .markdown-body h2, .markdown-body h3, .markdown-body h4 {
  font-family: var(--font-ui);
  color: #ffffff;
  margin-top: 1em;
  margin-bottom: 0.5em;
  font-weight: 700;
}
.markdown-body ul, .markdown-body ol {
  padding-left: 1.4em;
  margin-bottom: 0.85em;
}
.markdown-body li {
  margin-bottom: 0.3em;
}
.markdown-body a {
  color: var(--accent-cyan);
  text-decoration: underline;
}
.markdown-body blockquote {
  border-left: 3px solid var(--accent-green);
  padding-left: 12px;
  color: var(--text-secondary);
  margin: 10px 0;
  background: rgba(0, 255, 102, 0.04);
}
.markdown-body inline-code,
.markdown-body :not(pre) > code {
  background: rgba(0, 255, 102, 0.08);
  border: 1px solid rgba(0, 255, 102, 0.2);
  color: var(--accent-green);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
}

/* Code Container with Terminal Header & Copy */
.code-container {
  margin: 12px 0;
  border-radius: var(--radius-sm);
  background: #020503;
  border: 1px solid var(--border-neon);
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.6);
}

.code-header {
  padding: 8px 14px;
  background: #07100b;
  border-bottom: 1px solid rgba(0, 255, 102, 0.15);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.code-lang {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-cyan);
  letter-spacing: 0.8px;
}

.copy-code-btn {
  background: transparent;
  border: 1px solid rgba(0, 255, 102, 0.2);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: all var(--duration-fast);
}
.copy-code-btn:hover {
  background: rgba(0, 255, 102, 0.12);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.code-container pre {
  padding: 14px;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.5;
  background: transparent !important;
}

/* --------------------------------------------------------------------------
   8. CHAT INPUT CONSOLE
   -------------------------------------------------------------------------- */
.chat-input-area {
  padding: 10px 24px 20px;
  background: linear-gradient(180deg, transparent 0%, rgba(3, 7, 5, 0.95) 40%, #030605 100%);
  position: relative;
  z-index: 40;
}

.input-box-wrapper {
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Attachment tag chip */
.file-attachment-tag {
  display: none;
  align-items: center;
  gap: 8px;
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid var(--accent-cyan);
  color: var(--accent-cyan);
  padding: 4px 10px;
  border-radius: var(--radius-xs);
  font-size: 0.78rem;
  width: fit-content;
}
.file-attachment-tag.active {
  display: flex;
}
.remove-attach {
  cursor: pointer;
  opacity: 0.7;
}
.remove-attach:hover {
  opacity: 1;
  color: var(--accent-crimson);
}

/* Console Input Bar */
.input-box {
  background: var(--bg-surface-elevated);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-neon);
  border-radius: var(--radius-md);
  padding: 8px 12px 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(0, 255, 102, 0.03);
  transition: all var(--duration-fast);
}
.input-box:focus-within {
  border-color: var(--accent-green);
  box-shadow: 0 0 20px var(--accent-green-glow), inset 0 0 12px rgba(0, 255, 102, 0.05);
}

.prompt-prefix {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent-green);
  white-space: nowrap;
  user-select: none;
}

.chat-textarea {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  resize: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.92rem;
  line-height: 1.45;
  max-height: 180px;
  min-height: 24px;
}
.chat-textarea::placeholder {
  color: var(--text-muted);
}

.input-actions-end {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-attach, .btn-mic {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted);
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-fast);
}
.btn-attach:hover, .btn-mic:hover {
  background: rgba(0, 255, 102, 0.08);
  border-color: rgba(0, 255, 102, 0.2);
  color: var(--accent-green);
}

.btn-mic.recording {
  color: var(--accent-crimson) !important;
  border-color: var(--accent-crimson) !important;
  background: rgba(255, 0, 85, 0.15) !important;
  animation: pulseRecording 1s infinite;
}
@keyframes pulseRecording {
  0%, 100% { transform: scale(1); box-shadow: 0 0 10px var(--accent-crimson-glow); }
  50% { transform: scale(1.1); box-shadow: 0 0 18px var(--accent-crimson); }
}

.btn-send {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--accent-green) 0%, #00cc52 100%);
  border: none;
  color: #030604;
  font-size: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-fast);
  box-shadow: 0 0 14px var(--accent-green-glow);
}
.btn-send:hover {
  transform: scale(1.05);
  box-shadow: 0 0 22px var(--accent-green);
}
.btn-send:active {
  transform: scale(0.96);
}

.btn-stop {
  display: none;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--accent-crimson);
  border: none;
  color: #ffffff;
  font-size: 14px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--duration-fast);
  box-shadow: 0 0 14px var(--accent-crimson-glow);
}
.btn-stop.active {
  display: flex;
}
.btn-stop:hover {
  transform: scale(1.05);
}

/* Quick Commands & Live Telemetry Strip */
.input-hint-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 4px;
}

.quick-commands-row {
  display: flex;
  align-items: center;
  gap: 8px;
  overflow-x: auto;
  white-space: nowrap;
}

.quick-cmd-chip {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(0, 255, 102, 0.04);
  border: 1px solid var(--border-subtle);
  padding: 3px 8px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--duration-fast);
  user-select: none;
}
.quick-cmd-chip:hover {
  background: rgba(0, 255, 102, 0.12);
  border-color: var(--accent-green);
  color: var(--accent-green);
}

.telemetry-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.5px;
  white-space: nowrap;
}
.telemetry-item span {
  color: var(--accent-cyan);
  font-weight: 700;
}

/* --------------------------------------------------------------------------
   9. CYBER TOOLKIT MODAL
   -------------------------------------------------------------------------- */
.toolkit-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.toolkit-modal.active {
  display: flex;
}

.toolkit-window {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--accent-cyan);
  box-shadow: 0 0 35px var(--accent-cyan-glow), 0 20px 60px rgba(0, 0, 0, 0.8);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 820px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn 0.25s var(--ease-spring);
}
@keyframes modalIn {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.toolkit-header {
  padding: 16px 20px;
  background: rgba(0, 229, 255, 0.06);
  border-bottom: 1px solid rgba(0, 229, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.toolkit-header h3 {
  font-family: var(--font-ui);
  font-size: 1.05rem;
  font-weight: 700;
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.toolkit-header h3 i {
  color: var(--accent-cyan);
}

.toolkit-tabs-bar {
  display: flex;
  background: #030806;
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
}

.toolkit-tab-btn {
  padding: 12px 18px;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--duration-fast);
  white-space: nowrap;
}
.toolkit-tab-btn:hover {
  color: var(--text-primary);
  background: rgba(0, 255, 102, 0.03);
}
.toolkit-tab-btn.active {
  color: var(--accent-cyan);
  border-bottom-color: var(--accent-cyan);
  background: rgba(0, 229, 255, 0.08);
}

.toolkit-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.toolkit-pane {
  display: none;
  flex-direction: column;
  gap: 10px;
}
.toolkit-pane.active {
  display: flex;
}

.toolkit-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent-green);
  letter-spacing: 0.8px;
}

.toolkit-input,
.toolkit-textarea {
  width: 100%;
  background: #030705;
  border: 1px solid var(--border-neon);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.86rem;
  padding: 10px 12px;
  outline: none;
}
.toolkit-input:focus,
.toolkit-textarea:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 12px var(--accent-cyan-glow);
}

.toolkit-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 6px 0;
}

.cyber-btn-action {
  background: rgba(0, 255, 102, 0.08);
  border: 1px solid rgba(0, 255, 102, 0.25);
  color: var(--accent-green);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 7px 12px;
  border-radius: var(--radius-xs);
  cursor: pointer;
  transition: all var(--duration-fast);
}
.cyber-btn-action:hover {
  background: var(--accent-green);
  color: #030604;
  box-shadow: 0 0 12px var(--accent-green-glow);
}

.cyber-result-box {
  background: #020503;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  min-height: 50px;
  max-height: 220px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

/* --------------------------------------------------------------------------
   10. TOAST NOTIFICATIONS
   -------------------------------------------------------------------------- */
.toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--accent-green);
  box-shadow: 0 0 18px var(--accent-green-glow), 0 8px 24px rgba(0,0,0,0.6);
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: auto;
  animation: toastSlideIn 0.25s var(--ease-spring);
  transition: all 0.25s ease;
}
@keyframes toastSlideIn {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
.toast.error {
  border-color: var(--accent-crimson);
  box-shadow: 0 0 18px var(--accent-crimson-glow);
  color: #ffccd9;
}
.toast.error i {
  color: var(--accent-crimson);
}
.toast i {
  color: var(--accent-green);
}

/* --------------------------------------------------------------------------
   11. RESPONSIVE BREAKPOINTS (ALL SCREENS)
   -------------------------------------------------------------------------- */

/* Tablet & Smaller Laptops (<= 1024px) */
@media (max-width: 1024px) {
  :root {
    --sidebar-width: 260px;
  }
  .quick-prompts-grid {
    grid-template-columns: 1fr;
  }
  .ascii-banner {
    font-size: 9px;
  }
}

/* Tablets & Mobile (<= 868px) */
@media (max-width: 868px) {
  .mobile-sidebar-toggle {
    display: inline-flex;
  }

  /* Slide-out Drawer Sidebar */
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 290px;
    transform: translateX(-100%);
    box-shadow: 15px 0 40px rgba(0, 0, 0, 0.85);
  }
  .sidebar.active {
    transform: translateX(0);
  }

  .chat-header {
    padding: 0 14px;
  }

  .persona-selector-wrap {
    padding: 2px 6px;
  }
  .persona-label {
    display: none;
  }

  .btn-matrix-toggle span,
  .btn-toolkit span {
    display: none;
  }
  .btn-matrix-toggle,
  .btn-toolkit {
    padding: 0 10px;
    width: 36px;
    height: 36px;
    justify-content: center;
  }

  .messages-container {
    padding: 16px 14px 12px;
    gap: 16px;
  }

  .message-row {
    max-width: 100%;
  }

  .msg-avatar {
    width: 32px;
    height: 32px;
    font-size: 13px;
  }

  .msg-content-wrap {
    max-width: calc(100% - 44px);
  }

  .msg-bubble {
    padding: 11px 14px;
    font-size: 0.88rem;
  }

  /* Chat Input Console Mobile */
  .chat-input-area {
    padding: 6px 10px 14px;
  }

  .input-box {
    padding: 6px 8px 6px 12px;
    gap: 8px;
  }

  .prompt-prefix {
    display: none;
  }

  .chat-textarea {
    font-size: 0.88rem;
  }

  .btn-send, .btn-stop, .btn-mic, .btn-attach {
    width: 34px;
    height: 34px;
    font-size: 13px;
  }

  .input-hint-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }

  .quick-commands-row {
    width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  .telemetry-bar {
    width: 100%;
    justify-content: space-between;
    font-size: 0.65rem;
  }
}

/* Small Smartphone Devices (<= 480px) */
@media (max-width: 480px) {
  .header-meta h1 {
    font-size: 0.95rem;
  }
  .hacker-badge {
    font-size: 0.62rem;
    padding: 1px 4px;
  }

  .welcome-hero h3 {
    font-size: 1.4rem;
  }
  .welcome-hero p {
    font-size: 0.85rem;
  }

  .ascii-banner {
    display: none; /* Hide wide ASCII art on narrow mobile screens to avoid clipping */
  }

  .toolkit-window {
    max-height: 94vh;
  }
  .toolkit-tab-btn {
    padding: 9px 12px;
    font-size: 0.7rem;
  }
}
