:root {
  --paper: #edece3;
  --ink: #242820;
  --muted: #6c7166;
  --accent: #c4ec67;
  --line: #d1d4c5;
  --surface: #f9f9f1;
  font-family: "Avenir Next", "PingFang SC", "Trebuchet MS", sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; overflow: hidden; overscroll-behavior: none; }
body { position: fixed; inset: 0; margin: 0; background: radial-gradient(ellipse at 100% 0%, #dce8c7 0, transparent 48%), var(--paper); }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; touch-action: manipulation; }
button:disabled { opacity: .5; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid #708d38; outline-offset: 3px; }
.shell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(100%, 620px);
  height: 100svh;
  height: var(--viewport-height, 100dvh);
  padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  margin: auto;
}
.masthead { display: flex; align-items: center; justify-content: space-between; min-height: 40px; flex-shrink: 0; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; }
.brand-icon { display: block; object-fit: contain; flex-shrink: 0; }
.wordmark { font: bold 32px Georgia, "Times New Roman", serif; letter-spacing: -2px; }
.wordmark span { color: #7f9d43; }
.text-button { background: transparent; border: 0; padding: 10px 8px; min-height: 40px; font-size: 12px; }
.pair-view { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.pair-content { flex: 1; min-height: 0; display: flex; flex-direction: column; justify-content: center; padding-bottom: 24px; }
.pair-footer { display: flex; justify-content: space-between; flex-shrink: 0; min-height: 18px; font-size: 10px; color: var(--muted); font-variant-numeric: tabular-nums; }
h1 { font-size: 28px; font-weight: 600; letter-spacing: -1px; margin: 0 0 20px; }
.pair-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; }
.pair-card label { display: block; font-size: 13px; color: var(--muted); }
.code-row { display: flex; gap: 12px; }
#code { width: 100%; min-width: 0; border: none; border-bottom: 1px solid var(--line); border-radius: 0; background: transparent; font-size: 40px; letter-spacing: 12px; color: var(--ink); font-variant-numeric: tabular-nums; }
#code::placeholder { color: #c7cabc; }
.connect { border: 0; border-radius: 12px; background: var(--accent); font-size: 14px; width: 64px; height: 54px; flex-shrink: 0; }
.waiting-view { flex: 1; min-height: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding-bottom: 40px; }
.spinner { width: 28px; height: 28px; border: 2px solid var(--line); border-top-color: #739237; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }
.status { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 0; overflow-wrap: anywhere; }
#pair-status { margin-top: 16px; }
.status.error { color: #a13828; }
#remote-view { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.connection-status { display: flex; align-items: flex-start; gap: 7px; flex-shrink: 0; }
#remote-status { max-height: 36px; overflow: hidden; }
.dot { width: 6px; height: 6px; background: #739237; border-radius: 50%; flex-shrink: 0; margin-top: 6px; }
.dot.offline { background: #bc713a; }
.trackpad {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: radial-gradient(ellipse at 80% 10%, #3b4a32, transparent 85%), #272e24;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  overflow: hidden;
}
.trackpad.active { box-shadow: inset 0 0 0 2px var(--accent); }
.trackpad.disabled { opacity: .5; }
.pad-hint { color: #b6c1a7; font-size: 12px; pointer-events: none; }
.trackpad.active .pad-hint { visibility: hidden; }
.toolbar { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.zoom-controls { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); }
.zoom-controls button { min-height: 44px; min-width: 52px; border: 0; background: transparent; font-size: 23px; }
.zoom-controls #reset-zoom { flex: 1; font-size: 12px; border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.sensitivity { display: flex; align-items: center; gap: 16px; min-height: 32px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.sensitivity input { flex: 1; min-width: 0; margin: 0; accent-color: #6a843c; }
@media (max-height: 500px) {
  .shell { gap: 4px; padding-top: max(6px, env(safe-area-inset-top)); padding-bottom: max(6px, env(safe-area-inset-bottom)); }
  .masthead { min-height: 34px; }
  .brand-icon { width: 28px; height: 28px; }
  .wordmark { font-size: 28px; }
  .text-button { min-height: 34px; padding: 6px 8px; }
  .pair-content { padding-bottom: 0; }
  h1 { font-size: 22px; margin-bottom: 12px; }
  .pair-card { padding: 16px; }
  .code-row { margin-top: 8px; }
  #pair-status { margin-top: 10px; }
  #remote-view { gap: 6px; }
  .toolbar { flex-direction: row; align-items: center; gap: 16px; }
  .zoom-controls { flex: 1; }
  .sensitivity { flex: 1; gap: 12px; }
}
@media (max-width: 380px) and (max-height: 500px) {
  .toolbar { gap: 8px; }
  .sensitivity { flex: .8; font-size: 11px; gap: 6px; }
  .zoom-controls button { min-width: 38px; }
}
