:root {
  --bg-deep: #05070d;
  --bg-dark: #0b0f19;
  --bg-card: rgba(14, 20, 34, 0.85);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-cyan: rgba(0, 245, 212, 0.4);

  --neon-cyan: #00f5d4;
  --neon-blue: #0070f3;
  --neon-purple: #9d4edd;
  --neon-green: #10b981;
  --neon-gold: #f59e0b;
  --neon-red: #ef4444;

  --text-primary: #f8fafc;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --font-main: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-deep);
  background-image: 
    radial-gradient(circle at 10% 20%, rgba(0, 245, 212, 0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(157, 78, 221, 0.08) 0%, transparent 40%);
  color: var(--text-primary);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 950px;
  margin: 0 auto;
  width: 100%;
  position: relative;
}

/* Header */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: rgba(11, 15, 25, 0.9);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  flex-shrink: 0;
}

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

.brand-logo {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
  color: #05070d;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.brand-titles h1 {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.neon-text { color: var(--neon-cyan); }

.connection-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.7rem;
  color: var(--text-secondary);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px var(--neon-cyan);
}

.pill-badge {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  background: rgba(0, 245, 212, 0.15);
  color: var(--neon-cyan);
  padding: 1px 6px;
  border-radius: 99px;
  border: 1px solid rgba(0, 245, 212, 0.3);
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.header-btns {
  display: flex;
  gap: 6px;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.btn-icon:hover, .btn-icon:active {
  background: rgba(0, 245, 212, 0.15);
  color: var(--neon-cyan);
  border-color: var(--neon-cyan);
}

/* Nav Bar */
.nav-bar {
  display: flex;
  background: rgba(14, 20, 34, 0.8);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
  padding: 4px;
  gap: 4px;
}

.nav-bar::-webkit-scrollbar { display: none; }

.nav-tab {
  flex: 1;
  min-width: 60px;
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 6px 2px;
  font-size: 0.68rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border-radius: 8px;
  transition: all 0.2s;
}

.nav-tab i { font-size: 1.05rem; }

.nav-tab.active {
  background: linear-gradient(135deg, var(--neon-cyan), #38bdf8);
  color: #05070d;
  box-shadow: 0 4px 12px rgba(0, 245, 212, 0.25);
}

/* Views Wrapper */
.views-wrapper {
  flex: 1;
  overflow-y: auto;
  position: relative;
  display: flex;
  flex-direction: column;
}

.view-panel {
  display: none;
  flex-direction: column;
  height: 100%;
  padding: 10px;
  gap: 10px;
}

.view-panel.active { display: flex; }

/* 1. SCREEN VIEW WITH INTEGRATED MOUSE & KEYBOARD */
.screen-main-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.fps-selector-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.fps-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--neon-cyan);
}

.fps-chip {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.68rem;
  font-family: var(--font-mono);
  font-weight: 700;
  cursor: pointer;
}

.fps-chip.active {
  background: var(--neon-cyan);
  color: #05070d;
  border-color: var(--neon-cyan);
}

.fps-chip.ultra.active {
  background: linear-gradient(135deg, var(--neon-purple), #ec4899);
  color: #fff;
  border-color: #ec4899;
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.4);
}

.visual-viewport {
  flex: 1;
  min-height: 200px;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: crosshair;
}

#liveGpuVideo, #visualFeedImg {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.visual-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-align: center;
}

.visual-empty i { font-size: 2rem; color: var(--neon-cyan); }

.click-ripple {
  position: absolute;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--neon-cyan);
  background: rgba(0, 245, 212, 0.4);
  transform: translate(-50%, -50%) scale(0);
  pointer-events: none;
  transition: transform 0.25s ease-out, opacity 0.25s ease-out;
}

.click-ripple.animate {
  transform: translate(-50%, -50%) scale(1.6);
  opacity: 0;
}

/* Integrated Controls Dock under Screen */
.integrated-controls-dock {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(9, 13, 22, 0.95);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 8px;
  flex-shrink: 0;
}

.dock-type-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 4px 8px;
  border: 1px solid var(--border-subtle);
}

.dock-type-bar input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.82rem;
}

.btn-dock-send {
  background: var(--neon-cyan);
  border: none;
  color: #05070d;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  cursor: pointer;
}

.btn-dock-send.enter {
  background: #38bdf8;
}

.btn-dock-mic {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--neon-cyan);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dock-buttons-strip {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.dock-btn {
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.dock-btn.mouse-left {
  background: rgba(0, 112, 243, 0.2);
  border-color: rgba(0, 112, 243, 0.5);
  color: #38bdf8;
}

.dock-btn.mouse-right {
  background: rgba(157, 78, 221, 0.2);
  border-color: rgba(157, 78, 221, 0.5);
  color: #c084fc;
}

.dock-btn.scroll {
  color: var(--neon-gold);
}

.dock-btn:active {
  transform: scale(0.94);
}

/* 2. TOUCHPAD */
.type-deck { flex-shrink: 0; }
.type-input-box {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 6px 10px;
  gap: 8px;
  backdrop-filter: blur(10px);
}

.type-input-box input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.85rem;
}

.voice-btn, .send-btn, .enter-btn {
  background: rgba(0, 245, 212, 0.15);
  border: 1px solid var(--neon-cyan);
  color: var(--neon-cyan);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-weight: 700;
  font-size: 0.8rem;
}

.keys-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.key-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.touch-container {
  flex: 1;
  display: flex;
  gap: 8px;
  min-height: 220px;
}

.touch-pad {
  flex: 1;
  background: radial-gradient(circle at center, rgba(14, 20, 34, 0.95), rgba(7, 10, 18, 0.98));
  border: 1px solid var(--border-cyan);
  border-radius: 16px;
  position: relative;
  overflow: hidden;
  touch-action: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pad-grid {
  position: absolute;
  inset: 0;
  background-image: 
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 20px 20px;
  pointer-events: none;
}

.pad-msg {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 0.75rem;
  pointer-events: none;
}

.pad-msg i { font-size: 2rem; color: rgba(0, 245, 212, 0.3); }

.cursor-blob {
  position: absolute;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 2px solid var(--neon-cyan);
  background: rgba(0, 245, 212, 0.2);
  pointer-events: none;
  transform: translate(-50%, -50%);
  display: none;
}

.scroll-slider {
  width: 44px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  touch-action: none;
  color: var(--text-muted);
  font-size: 0.8rem;
  cursor: ns-resize;
  flex-shrink: 0;
}

.scroll-slider span {
  writing-mode: vertical-rl;
  font-size: 0.65rem;
  letter-spacing: 2px;
  font-weight: 700;
}

.mouse-btns-row {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.m-btn {
  flex: 1;
  padding: 14px 6px;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.m-btn.left { background: rgba(0, 112, 243, 0.15); border-color: rgba(0, 112, 243, 0.4); color: #38bdf8; }
.m-btn.right { background: rgba(157, 78, 221, 0.15); border-color: rgba(157, 78, 221, 0.4); color: #c084fc; }
.m-btn.drag { background: rgba(255, 255, 255, 0.05); color: var(--text-secondary); }
.m-btn.drag.active { background: #f59e0b; color: #000; border-color: #f59e0b; }

/* 3. FULL PROCESSES VIEW */
.processes-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.head-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-total {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: rgba(0, 245, 212, 0.15);
  color: var(--neon-cyan);
  padding: 2px 8px;
  border-radius: 99px;
  border: 1px solid var(--border-cyan);
}

.proc-filter-bar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.search-input-wrap {
  flex: 1;
  min-width: 180px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 6px 10px;
}

.search-input-wrap input {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-size: 0.8rem;
}

.sort-selector {
  display: flex;
  gap: 4px;
}

.sort-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.sort-chip.active {
  background: rgba(0, 245, 212, 0.15);
  border-color: var(--neon-cyan);
  color: var(--neon-cyan);
}

.table-container.full-height {
  flex: 1;
  max-height: 480px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.74rem;
  font-family: var(--font-mono);
}

.data-table th {
  background: rgba(14, 20, 34, 0.98);
  color: var(--text-muted);
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 10;
}

.data-table td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.btn-kill-proc {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: var(--neon-red);
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
}

.btn-kill-proc:active { background: var(--neon-red); color: white; }

/* 4. CARDS & GENERAL */
.card-glass {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  backdrop-filter: blur(14px);
}

.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.card-head h3 {
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tool-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
}

.tts-input-row {
  display: flex;
  gap: 8px;
}

.tts-input-row input {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 12px;
  color: #fff;
  font-size: 0.82rem;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--neon-cyan), var(--neon-blue));
  border: none;
  border-radius: 8px;
  color: #05070d;
  font-weight: 700;
  padding: 8px 14px;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* 5. APPS VIEW */
.apps-grid-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 10px;
}

.app-box {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: var(--text-primary);
}

.app-box-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: rgba(0, 245, 212, 0.15);
  color: var(--neon-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.custom-launch-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
}

.custom-input-group { display: flex; gap: 8px; }
.custom-input-group input {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 8px 12px;
  color: #fff;
  font-size: 0.8rem;
  outline: none;
}

/* 6. SHELL VIEW */
.shell-card { height: 100%; }
.term-tags { display: flex; gap: 6px; }
.shell-tab {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}

.shell-tab.active { background: var(--neon-cyan); color: #05070d; border-color: var(--neon-cyan); }
.terminal-screen {
  flex: 1;
  background: #04060a;
  border-radius: 8px;
  padding: 10px;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.45;
  color: #38bdf8;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.quick-commands-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 4px 0;
}

.q-cmd {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 3px 8px;
  border-radius: 99px;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  cursor: pointer;
  white-space: nowrap;
}

.shell-input-form {
  display: flex;
  align-items: center;
  background: #080c14;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 6px 10px;
  gap: 8px;
}

.shell-prompt { font-family: var(--font-mono); color: var(--neon-cyan); font-weight: 700; }
.shell-input-form input { flex: 1; background: transparent; border: none; outline: none; color: #fff; font-family: var(--font-mono); font-size: 0.8rem; }
.shell-send-btn { background: var(--neon-cyan); border: none; border-radius: 6px; width: 28px; height: 28px; color: #05070d; cursor: pointer; }

/* 7. POWER */
.power-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
}

.p-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #fff;
  cursor: pointer;
  text-align: left;
}

.p-card i { font-size: 1.3rem; color: var(--neon-cyan); }
.p-card.danger i { color: var(--neon-red); }
.vol-control-row { display: flex; gap: 8px; }
.btn-sm {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  cursor: pointer;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 999;
}

.modal-overlay.open { display: flex; }
.modal-box {
  background: #0d121f;
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  max-width: 380px;
  width: 100%;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.modal-header { display: flex; justify-content: space-between; align-items: center; }
.btn-close { background: none; border: none; color: #fff; font-size: 1.2rem; cursor: pointer; }
.modal-content { display: flex; flex-direction: column; gap: 8px; }
.modal-content label { font-size: 0.72rem; color: var(--text-secondary); }
.modal-content input {
  background: #070a12;
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 8px 10px;
  color: #fff;
  font-size: 0.8rem;
  outline: none;
}
.modal-actions-btns { display: flex; gap: 8px; margin-top: 8px; }
.btn-secondary {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: #fff;
  padding: 8px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
}

/* TOAST */
.toast-popup {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: rgba(14, 20, 34, 0.95);
  border: 1px solid var(--neon-cyan);
  padding: 8px 16px;
  border-radius: 99px;
  font-size: 0.78rem;
  color: #fff;
  box-shadow: 0 0 15px rgba(0, 245, 212, 0.3);
  transition: transform 0.25s ease;
  z-index: 1000;
  pointer-events: none;
}

.toast-popup.visible { transform: translateX(-50%) translateY(0); }
