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

:root {
  --toolbar-h: 38px;
  --bg: #111;
  --surface: #222;
  --border: #383838;
  --accent: #1976d2;
  --text: #e0e0e0;
  --muted: #888;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 11px/1 system-ui, sans-serif;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

#toolbar {
  height: var(--toolbar-h);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

#status-area { display: flex; align-items: center; gap: 6px; min-width: 160px; }

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: background .3s;
}
.dot.online { background: #4caf50; }
.dot.loading { background: #ff9800; }
.dot.offline { background: #f44336; }

#nav-btns { display: flex; gap: 3px; }

#nav-btns button,
#audio-btn,
#keyboard-btn {
  background: var(--border);
  border: none;
  color: var(--text);
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  transition: background .15s;
}

#nav-btns button:hover,
#audio-btn:hover,
#keyboard-btn:hover { background: #4a4a4a; }

#audio-btn.active,
#keyboard-btn.active { background: #2e7d32; }

#apk-btn {
  background: var(--accent);
  color: #fff;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 10px;
  white-space: nowrap;
  transition: background .15s;
}

#apk-btn:hover { background: #1565c0; }
#apk-btn input { display: none; }

#install-msg {
  font-size: 10px;
  color: var(--muted);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#install-msg.ok { color: #4caf50; }
#install-msg.err { color: #f44336; }

#screen-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none;
  user-select: none;
  outline: none;
}

#screen {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
  cursor: crosshair;
  outline: none;
}

.tap-indicator {
  position: absolute;
  width: 34px;
  height: 34px;
  margin-left: -17px;
  margin-top: -17px;
  border: 2px solid rgba(255, 255, 255, 0.95);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  animation: tap-pop .28s ease-out forwards;
}

@keyframes tap-pop {
  from {
    transform: scale(0.55);
    opacity: 0.95;
  }
  to {
    transform: scale(1.45);
    opacity: 0;
  }
}

#screen-wrap.drag-over::after {
  content: 'Drop APK to install';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  color: #fff;
  background: rgba(25, 118, 210, .55);
  border: 3px dashed var(--accent);
  pointer-events: none;
}

#overlay-msg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
  background: rgba(0, 0, 0, 0.35);
}

#overlay-msg.hidden { display: none; }
