* { box-sizing: border-box; }
body {
  margin: 0;
  background: #111;
  color: #eee;
  font-family: "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}
#panel {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 10;
  background: rgba(20, 20, 20, 0.92);
  border: 1px solid #333;
  border-radius: 10px;
  padding: 12px 14px;
  width: min(320px, calc(100vw - 24px));
  backdrop-filter: blur(8px);
}
#panel-toggle {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 30;
  width: auto;
  min-width: 56px;
  padding: 7px 10px;
  font-size: 12px;
  background: #374151;
}
#panel h1 { margin: 0 0 6px; font-size: 18px; }
.hint { margin: 0 0 10px; font-size: 12px; color: #aaa; line-height: 1.4; }
.tip { margin: -4px 0 8px; font-size: 11px; color: #6b7280; }
label { display: block; margin-bottom: 8px; font-size: 12px; color: #bbb; }
label.inline {
  display: flex;
  align-items: center;
  gap: 6px;
}
label.inline input {
  width: auto;
  margin: 0;
}
input, select {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #444;
  background: #1a1a1a;
  color: #fff;
}
button {
  width: 100%;
  padding: 9px;
  border: none;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
button:hover { background: #1d4ed8; }
#status { display: block; margin-top: 8px; font-size: 12px; color: #9ca3af; }
#quickbar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: max(8px, env(safe-area-inset-bottom));
  z-index: 11;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  padding: 8px;
  background: rgba(20, 20, 20, 0.92);
  border: 1px solid #333;
  border-radius: 10px;
  backdrop-filter: blur(8px);
}
#quickbar.collapsed {
  display: none !important;
}
#zoom-tools {
  position: fixed;
  right: 10px;
  top: max(8px, env(safe-area-inset-top));
  z-index: 12;
  display: grid;
  grid-template-columns: repeat(2, 46px);
  gap: 6px;
  padding: 6px;
  background: rgba(20, 20, 20, 0.72);
  border: 1px solid #333;
  border-radius: 10px;
}
#zoom-tools button {
  width: 46px;
  min-height: 42px;
  padding: 6px;
  border-radius: 8px;
  background: #374151;
  font-size: 13px;
}
#zoom-tools button.active {
  background: #2563eb;
}
#keypad {
  position: fixed;
  left: 10px;
  right: auto;
  bottom: 78px;
  z-index: 12;
  display: grid;
  grid-template-columns: 64px;
  gap: 8px;
  padding: 6px;
  background: rgba(20, 20, 20, 0.66);
  border: 1px solid #333;
  border-radius: 10px;
}
#keypad button {
  width: 64px;
  min-height: 58px;
  padding: 6px;
  border-radius: 8px;
  background: #374151;
  font-size: 18px;
  line-height: 1.05;
}
#text-send {
  width: 100%;
  min-height: 66px;
  max-height: 28vh;
  resize: vertical;
  border-radius: 6px;
  border: 1px solid #444;
  background: #1a1a1a;
  color: #fff;
  padding: 8px;
}
.quick-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.quick-actions button {
  padding: 8px;
  min-height: 42px;
  font-size: 14px;
}
#screen {
  display: block;
  position: fixed;
  left: 0;
  top: 0;
  width: auto;
  height: auto;
  max-width: none;
  max-height: none;
  transform-origin: 0 0;
  background: #000;
  cursor: crosshair;
  touch-action: none;
}
body.connected #panel {
  width: auto;
  padding: 8px;
  opacity: 1;
  background: transparent;
  border: none;
  backdrop-filter: none;
}
body.connected #panel > :not(#panel-toggle) {
  display: none;
}
body.connected.panel-open #panel {
  width: min(320px, calc(100vw - 24px));
  padding: 12px 14px;
  opacity: 1;
}
body.connected.panel-open #panel > :not(#panel-toggle) {
  display: block;
}
body.connected #quickbar { display: grid; }
body.connected #zoom-tools { display: grid; }
body.connected #keypad { display: grid; }
.hidden { display: none !important; }
