:root {
  color-scheme: light;
  font-family: "Inter", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #202e29;
  background: #f6f7f3;
  --ink: #203d34;
  --sage: #d9e6cf;
  --border: #d8ded6;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input { font: inherit; }
button, summary { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:focus-visible, summary:focus-visible, input:focus-visible {
  outline: 3px solid #57873c;
  outline-offset: 3px;
}
button:disabled { cursor: wait; opacity: .57; }
.app { max-width: 1112px; margin: 0 auto; padding: 0 clamp(18px,5vw,68px); }
.topbar {
  height: 78px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 23px; font-weight: 700; letter-spacing: -1.2px; }
.brand-icon {
  position: relative; display: block; width: 31px; height: 31px;
  background: var(--ink); border-radius: 8px;
}
.brand-icon::before {
  content: ""; position: absolute; left: 6px; top: 7px; width: 15px; height: 11px;
  border: 2px solid #d9efb6; border-radius: 2px;
}
.brand-icon::after {
  content: ""; position: absolute; right: 5px; bottom: 5px; width: 7px; height: 12px;
  background: var(--ink); border: 2px solid #d9efb6; border-radius: 2px;
}
.state { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #58665f; }
.state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #8e9a92; }
.state[data-tone="live"]::before { background: #448437; }
.state[data-tone="busy"]::before { background: #c78d38; }
.state[data-tone="error"]::before { background: #b5533a; }
.welcome { max-width: 748px; padding: max(5vh,28px) 0 36px; margin: auto; }
.welcome-card {
  display: grid; grid-template-columns: .88fr 1.12fr; overflow: hidden;
  background: #fff; border: 1px solid var(--border); border-radius: 21px;
  box-shadow: 0 11px 32px #263d2d09;
}
.illustration {
  position: relative; min-height: 290px; isolation: isolate; overflow: hidden;
  background: radial-gradient(ellipse at 27% 22%,#edf4ca 0%,#d8e7cb 40%,#aec5b3 100%);
}
.illustration::before {
  content: ""; position: absolute; inset: 13px;
  background: radial-gradient(#48695039 .85px, transparent 1px) 0 0/13px 13px;
}
.monitor-art {
  width: 57%; aspect-ratio: 1.53; position: absolute; top: 43%; left: 48%;
  transform: translate(-50%,-50%) rotate(-6deg); border: 5px solid #29493c;
  border-radius: 8px; background: #dce9ca; box-shadow: 4px 6px 0 #63826b35;
}
.monitor-art::before, .monitor-art::after { content: ""; position: absolute; background: #29493c; left: 50%; transform: translateX(-50%); }
.monitor-art::before { top: 100%; width: 8%; height: 14%; }
.monitor-art::after { top: 113%; width: 33%; height: 4px; border-radius: 50px; }
.screen-art { position: absolute; inset: 0; overflow: hidden; border-radius: 2px; background: #dce9c6; }
.screen-art i { position: absolute; width: 132%; height: 132%; left: -22%; top: 48%; border-radius: 47%; background: #adc59d; transform: rotate(-13deg); }
.screen-art i:nth-child(2) { top: 63%; left: -3%; background: #6d927a; }
.screen-art i:nth-child(3) { top: 79%; left: 11%; background: #3a6353; }
.phone-art {
  width: 15%; aspect-ratio: .54; border-radius: 8px; border: 4px solid #29493c;
  background: linear-gradient(155deg,#c8deae 46%,#83a586 47%,#577e69 81%);
  position: absolute; top: 46%; left: 67%; transform: rotate(7deg);
  box-shadow: 3px 4px 0 #63826b40;
}
.phone-art::after { content: ""; width: 32%; height: 2px; position: absolute; bottom: 3px; left: 34%; background: #e2edce; border-radius: 3px; }
.intro { align-self: center; padding: 34px clamp(23px,4vw,44px); }
h1 { margin: 0; color: var(--ink); font-size: clamp(29px,4vw,39px); line-height: 1.2; letter-spacing: -.055em; }
.intro p, .setup-help p { line-height: 1.7; font-size: 15px; }
.intro p { margin: 14px 0 24px; color: #56665d; }
.primary, .small-primary {
  color: #fff; border: 1px solid var(--ink); background: var(--ink); font-weight: 650; border-radius: 9px;
}
.primary:hover:not(:disabled), .small-primary:hover:not(:disabled) { background: #335444; }
.main-action { display: flex; width: 100%; min-height: 49px; align-items: center; justify-content: space-between; padding: 10px 17px; }
.main-action span { font-size: 20px; line-height: 1; }
.intro .message { margin: 15px 0 0; color: #355c45; font-size: 14px; }
.message:empty, .feedback:empty { display: none; }
.intro .message.error, .feedback.error { color: #9b402e; }
.setup-help { margin: 18px 4px 0; color: #526158; font-size: 14px; }
.setup-help summary { cursor: pointer; width: fit-content; padding: 8px 0; }
.setup-help p { margin: 4px 0; }
body.connected { background: #101a16; }
body.connected .app {
  display: flex; flex-direction: column; height: 100vh; height: 100dvh;
  width: 100%; max-width: none; padding: 0; overflow: hidden;
}
body.connected .topbar {
  flex: none; height: 46px; border: 0; padding: 0 max(14px,env(safe-area-inset-right)) 0 max(14px,env(safe-area-inset-left));
  background: var(--ink); color: white;
}
body.connected .brand { font-size: 18px; gap: 7px; }
body.connected .brand-icon { transform: scale(.83); }
body.connected .state { color: #e0ebdb; }
body.connected .state[data-tone="live"]::before { background: #b7d994; }
.session { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.desktop { flex: 1; min-height: 0; min-width: 0; overflow: hidden; background: #101a16; }
.desktop canvas { touch-action: none; }
.controls {
  flex: none; max-height: 52%; overflow-y: auto; overscroll-behavior: contain; background: #f6f7f3;
  padding: 5px max(8px,env(safe-area-inset-right)) max(5px,env(safe-area-inset-bottom)) max(8px,env(safe-area-inset-left));
}
.tool-row, .key-row { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.tool-row button, .key-row button {
  min-height: 44px; padding: 7px 12px; border-radius: 7px; border: 1px solid var(--border);
  color: var(--ink); background: #fff; font-size: 14px; font-weight: 600;
}
.tool-row button[aria-expanded="true"], .tool-row button[aria-pressed="true"] { background: var(--sage); border-color: #a4bda6; }
.tool-row .leave { margin-left: auto; color: #933f33; }
.panel { max-width: 760px; padding: 12px 5px 6px; }
.panel-heading, .entry-row { display: flex; align-items: center; gap: 8px; }
.panel-heading { justify-content: space-between; margin: 0 0 6px; font-weight: 650; font-size: 14px; }
.sensitive { display: flex; align-items: center; gap: 4px; min-height: 30px; font-size: 13px; font-weight: 400; }
.entry-row input { flex: 1; min-width: 0; min-height: 44px; padding: 8px 11px; font-size: 16px; color: var(--ink); background: white; border: 1px solid #a8b5a9; border-radius: 7px; }
.small-primary { min-height: 44px; padding: 8px 16px; }
.helper, .feedback { color: #516158; font-size: 13px; line-height: 1.6; }
.helper { margin: 7px 0; }
.feedback { padding: 3px 5px; }
.gestures-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; margin: 0; }
.gestures-list div { border-left: 2px solid #a1b897; padding-left: 8px; }
.gestures-list dt { color: #536257; font-size: 12px; }
.gestures-list dd { font-size: 14px; font-weight: 600; margin: 2px 0 0; }
@media (max-width: 620px) {
  .topbar { height: 66px; }
  .welcome { padding-top: 24px; }
  .welcome-card { display: block; }
  .illustration { min-height: 0; height: clamp(104px,21vh,180px); }
  .monitor-art { width: min(35%,147px); top: 46%; left: 48%; }
  .phone-art { width: min(9%,38px); top: 48%; left: 61%; }
  .intro { padding: 26px 23px; }
  .tool-row, .key-row { gap: 4px; }
  .tool-row button, .key-row button { padding: 6px 9px; }
}
@media (max-height: 480px) and (orientation: landscape) {
  body.connected .topbar { height: 31px; }
  .controls { max-height: 56%; }
  .tool-row button, .key-row button { min-height: 36px; }
}
