*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: #1a1a2e;
  color: #e0e0e0;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #16213e;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid #0f3460;
}

header h1 {
  font-size: 1.3rem;
  color: #e94560;
  white-space: nowrap;
}

#status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

.status {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status.online { background: #1a472a; color: #4ade80; }
.status.offline { background: #3b0f0f; color: #f87171; }
.status.connecting { background: #3b2f0f; color: #fbbf24; }

select, input[type="text"], input[type="range"] {
  background: #0f3460;
  border: 1px solid #e94560;
  color: #e0e0e0;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 0.85rem;
}

select { cursor: pointer; }

button {
  background: #e94560;
  color: white;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s;
}

button:hover { background: #c73652; }
button:disabled { background: #444; cursor: not-allowed; }

main {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
}

#screen-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px;
  background: #16213e;
  border-right: 1px solid #0f3460;
  min-width: 280px;
}

#screen-container {
  position: relative;
  border: 2px solid #0f3460;
  border-radius: 8px;
  overflow: hidden;
  background: #0d0d1a;
}

#screen-canvas {
  display: block;
  cursor: crosshair;
  max-width: 360px;
}

#screen-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: 0.9rem;
  pointer-events: none;
}

#screen-controls {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

#control-section {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

#control-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #e94560;
  margin-bottom: 8px;
}

#key-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

#text-input {
  display: flex;
  gap: 8px;
  align-items: center;
}

#text-to-type { flex: 1; }

#app-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#app-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
}

.app-item {
  background: #0f3460;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.app-item:hover { background: #1a4a80; }

#ui-tree-output {
  background: #0d0d1a;
  border: 1px solid #0f3460;
  border-radius: 6px;
  padding: 8px;
  font-family: monospace;
  font-size: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre;
}

.ui-node {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 3px;
}

.ui-node:hover { background: #1a4a80; }
.ui-node.clickable { color: #4ade80; }

#command-log {
  flex: 1;
}

#log-output {
  background: #0d0d1a;
  border: 1px solid #0f3460;
  border-radius: 6px;
  padding: 8px;
  font-family: monospace;
  font-size: 0.75rem;
  max-height: 200px;
  overflow-y: auto;
}

.log-entry { padding: 2px 0; border-bottom: 1px solid #111; }
.log-entry.success { color: #4ade80; }
.log-entry.error { color: #f87171; }
