@import url("./shared.css");
:root {
  --paper: #eef2f2;
  --ink: #203540;
  --muted: #60747d;
  --line: #c5d3d8;
  --accent: #295b72;
  --green: #326b59;
  --warm: #bf8553;
  color-scheme: light;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button,
a,
input {
  font: inherit;
}
button,
.button {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f9fbfa;
  color: var(--ink);
  padding: 9px 13px;
  cursor: pointer;
  text-decoration: none;
}
button:hover,
.button:hover {
  background: #e0e9eb;
  border-color: #8ca6b2;
}
button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}
button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid #ba824e;
  outline-offset: 3px;
}
header {
  min-height: 80px;
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid var(--line);
  padding: 0 4vw;
  background: #e2eaec;
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  color: var(--ink);
  text-decoration: none;
  font-weight: 650;
  font-size: 23px;
  letter-spacing: -0.7px;
}
.spider-mark {
  font-size: 38px;
  font-weight: 300;
  line-height: 1;
  color: #295b72;
}
.header-actions {
  margin-left: auto;
  display: flex;
  gap: 9px;
}
.status-pill {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
}
.status-pill:before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #3d8166;
}
.status-pill.offline:before {
  background: #b17d4b;
}
.icon-button {
  font-family: ui-monospace, monospace;
  min-width: 40px;
}
main {
  max-width: 1680px;
  margin: auto;
  padding: 30px 4vw;
}
.work-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}
.quiet {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
}
h1 {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(27px, 3vw, 42px);
  font-weight: 400;
  letter-spacing: -1.2px;
  margin: 0;
}
h2 {
  font-family: Georgia, serif;
  font-weight: 400;
  font-size: 28px;
  letter-spacing: -0.5px;
  margin: 8px 0 20px;
}
.app-launcher {
  display: flex;
  gap: 7px;
}
.app-launcher button {
  display: flex;
  gap: 9px;
  align-items: center;
  white-space: nowrap;
  background: transparent;
}
.app-launcher button span {
  font-size: 20px;
  color: var(--accent);
}
.mounts {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  overflow: clip;
  isolation: isolate;
  border: 0;
  border-radius: 0;
  background: #e0e8eb;
}
.desktop-background { position:absolute; inset:0; touch-action:none; cursor:grab; background-image:radial-gradient(#9aafb955 1px,transparent 1px); background-size:40px 40px; }
.desktop-world { position:absolute; left:0; top:0; width:0; height:0; transform-origin:0 0; pointer-events:none; }
.desktop-tools { position:absolute; right:14px; bottom:14px; z-index:1000; display:flex; align-items:center; gap:3px; padding:4px; max-width:calc(100% - 24px); box-sizing:border-box; border:1px solid #b8cbd3; border-radius:12px; background:#f5f8f8; box-shadow:0 4px 18px #27435118; }
.desktop-tools button,.desktop-tools select { font:12px -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; border:0; padding:8px; background:transparent; border-radius:7px; color:var(--ink); min-height:36px; min-width:34px; }
.desktop-tools select { width:150px; min-width:0; }
.desktop-tools [data-actual] { width:55px; font-variant-numeric:tabular-nums; }
.desktop-tools [aria-pressed=true] { background:#295b72; color:white; }
.desktop-tools button:hover { background:#dbe6ea; }
.is-navigating .app-frame { pointer-events:none; }
.pan-mode .app-window { touch-action:none; cursor:grab; }
.is-navigating,.is-navigating * { cursor:grabbing !important; user-select:none !important; }
.mounts:focus-visible { outline:3px solid #ba824e; outline-offset:-3px; }
.app-window {
  pointer-events: auto;
  position: absolute;
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  border: 1px solid #bbcbd1;
  border-radius: 12px;
  background: white;
  overflow: hidden;
  box-shadow: 0 5px 15px #27435116;
  min-width: 0;
}
.app-window.is-active {
  border-color: #7896a5;
  box-shadow: 0 16px 40px #27435130;
}
.window-bar {
  flex: 0 0 44px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border-bottom: 1px solid #d4dfe3;
  background: #f5f8f8;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.window-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.window-tag {
  font-size: 10px;
  color: var(--muted);
}
.window-controls {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  gap: 6px;
  margin-right: 5px;
}
.window-control {
  width: 23px;
  height: 23px;
  min-height: 23px;
  padding: 0;
  border-radius: 50%;
  border: 1px solid #0002;
  color: #26353e;
  font: 16px/1 -apple-system, sans-serif;
}
.window-control.red { background: #f47b73; }
.window-control.yellow { background: #efc35e; }
.window-control.green { background: #76bc8a; }
.window-control:hover { filter: brightness(.94); border-color:#0005; }
.window-control:focus-visible { outline-offset:2px; }
.is-active .window-bar { background: #e9f0f3; }
.window-edge { position: absolute; touch-action: none; z-index: 2; }
.edge-n,.edge-s { left:12px; right:12px; height:6px; cursor:ns-resize; }
.edge-n { top:0; } .edge-s { bottom:0; }
.edge-e,.edge-w { top:12px; bottom:12px; width:6px; cursor:ew-resize; }
.edge-e { right:0; } .edge-w { left:0; }
.edge-ne,.edge-se,.edge-sw,.edge-nw { width:15px; height:15px; }
.edge-ne,.edge-se { right:0; } .edge-nw,.edge-sw { left:0; }
.edge-ne,.edge-nw { top:0; } .edge-se,.edge-sw { bottom:0; }
.edge-ne,.edge-sw { cursor:nesw-resize; } .edge-nw,.edge-se { cursor:nwse-resize; }
.edge-se:after { content:""; position:absolute; width:6px; height:6px; right:4px; bottom:4px; border-right:2px solid #7896a5; border-bottom:2px solid #7896a5; }
.window-gesture,.window-gesture * { cursor:grabbing !important; user-select:none !important; }
.window-gesture .app-frame { pointer-events:none; }
.app-window.is-fullscreen {
  position: fixed;
  inset: 0 !important;
  width: 100% !important;
  height: 100dvh !important;
  z-index: 10000 !important;
  border: 0;
  border-radius: 0;
}
.is-fullscreen .window-edge { display:none; }
.desktop-fullscreen { overflow:hidden; }
.desktop-fullscreen .mounts { isolation:auto; }
.desktop-fullscreen .desktop-world { transform:none !important; }
.desktop-fullscreen .desktop-tools { visibility:hidden; }
.desktop-fullscreen .app-window:not(.is-fullscreen) { visibility:hidden; }
.app-frame {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
  height: 0;
  border: 0;
  background: white;
}
.notice {
  background: #f4e5cd;
  color: #674d32;
  padding: 10px 4vw;
  font-size: 13px;
}
footer {
  display: flex;
  gap: 16px;
  justify-content: space-between;
  padding: 18px 4vw;
  color: var(--muted);
  font-size: 11px;
  border-top: 1px solid var(--line);
  margin-top: 30px;
}
.empty {
  text-align: center;
  padding: 70px 20px;
  color: var(--muted);
}
dialog {
  border: 1px solid #b7cbd2;
  border-radius: 16px;
  padding: 30px;
  max-width: 650px;
  width: calc(100% - 50px);
  color: var(--ink);
  max-height: 85vh;
  overflow: auto;
  background: #f6f9f8;
}
dialog::backdrop {
  background: #16303f70;
  backdrop-filter: blur(4px);
}
.dialog-close {
  float: right;
  border: 0;
  background: none;
  font-size: 28px;
  padding: 0 5px;
}
#qr-image {
  text-align: center;
  padding: 10px;
  background: white;
  border-radius: 10px;
}
#qr-image svg {
  max-width: 100%;
  width: 260px;
  height: 260px;
}
.pairing-code {
  font-family: ui-monospace, monospace;
  font-size: 24px;
  letter-spacing: 3px;
  text-align: center;
}
dialog p {
  line-height: 1.6;
}
dialog a {
  color: var(--accent);
}
small {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}
.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 20px 0;
}
pre {
  font:
    11px/1.6 ui-monospace,
    monospace;
  max-height: 45vh;
  overflow: auto;
  background: #e6edef;
  padding: 16px;
  border-radius: 7px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.pair-screen {
  min-height: 100svh;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  max-width: 1100px;
  margin: auto;
  padding: 40px;
  box-sizing: border-box;
  gap: 100px;
}
.pair-panel h1 {
  font-size: 58px;
  line-height: 1.05;
  margin: 52px 0 20px;
}
.pair-panel > p {
  color: var(--muted);
  line-height: 1.6;
}
.pair-panel form {
  display: grid;
  gap: 17px;
  margin: 28px 0;
}
.pair-panel label {
  display: grid;
  gap: 8px;
  font-size: 13px;
}
.pair-panel input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f9fbfa;
  color: var(--ink);
}
.pair-art {
  position: relative;
  height: 440px;
  border-radius: 45% 45% 15% 15%;
  background: #d5e3e8;
}
.orb {
  position: absolute;
  background: #f5f9f7;
  border: 1px solid #a0bac5;
  border-radius: 24px;
  padding: 25px;
  z-index: 1;
  box-shadow: 0 10px 30px #234d6310;
}
.orb.center {
  top: 100px;
  left: 42%;
  background: #2e5c71;
  color: white;
  padding: 35px;
}
.orb.phone {
  top: 220px;
  left: 16%;
}
.orb.ipad {
  top: 250px;
  right: 10%;
}
.web-line {
  position: absolute;
  height: 1px;
  background: #91b2c0;
  transform-origin: left;
}
.web-line.one {
  left: 32%;
  top: 250px;
  width: 145px;
  transform: rotate(-50deg);
}
.web-line.two {
  left: 55%;
  top: 165px;
  width: 135px;
  transform: rotate(58deg);
}
.pair-art p {
  position: absolute;
  bottom: 22px;
  left: 30px;
  line-height: 1.6;
  font-family: Georgia, serif;
  font-size: 22px;
  color: #567988;
}
#pair-error {
  color: #a3433b;
}
code {
  font-family: ui-monospace, monospace;
}
[hidden] {
  display: none !important;
}
@media (max-width: 800px) {
  header {
    min-height: 65px;
    gap: 15px;
  }
  .work-heading {
    align-items: start;
    flex-direction: column;
    gap: 20px;
  }
  .app-launcher {
    width: 100%;
  }
  .app-launcher button {
    flex: 1;
    justify-content: center;
    padding: 9px;
  }
  .pair-screen {
    grid-template-columns: 1fr;
    max-width: 520px;
    gap: 0;
    padding: 30px;
  }
  .pair-art {
    display: none;
  }
  .pair-panel h1 {
    font-size: 48px;
    margin-top: 45px;
  }
  main {
    padding-top: 25px;
  }
  .status-pill {
    font-size: 10px;
  }
  footer span:last-child {
    display: none;
  }
}
@media (pointer: coarse) {
  button,
  .button,
  input {
    min-height: 44px;
  }
  input,
  textarea,
  select {
    font-size: 16px !important;
  }
  .window-bar {
    height: 48px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}

.session-picker {
  margin-left: auto;
  font:
    11px -apple-system,
    sans-serif;
  color: #5d7783;
  border: 0;
  background: transparent;
  max-width: 150px;
  padding: 4px;
}
@media (max-width: 500px) {
  .window-tag {
    display: none;
  }
  .session-picker {
    max-width: 130px;
  }
}

.standalone-link {
  color: #5d7783;
  text-decoration: none;
  font-size: 14px;
  padding: 4px;
}
.connection-help-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f9f8;
  padding: 11px 15px;
  font-size: 13px;
}
#connection-check-address {
  display: block;
  overflow-wrap: anywhere;
  margin-top: 6px;
  font-size: 13px;
}
#connection-check-summary {
  font-size: 14px;
  font-weight: 500;
}
.connection-check-results {
  list-style: none;
  padding: 0;
  margin: 20px 0;
}
.connection-check-results li {
  padding: 12px 14px;
  border-left: 3px solid #99a7af;
  background: #edf2f3;
  margin: 8px 0;
  border-radius: 0 7px 7px 0;
}
.connection-check-results li[data-result="pass"] {
  border-left-color: #4b8a6d;
}
.connection-check-results li[data-result="fail"] {
  border-left-color: #a3433b;
}
.connection-check-results strong,
.connection-check-results span {
  display: block;
}
.connection-check-results strong {
  font-size: 13px;
  margin-bottom: 5px;
}
.connection-check-results span,
.check-note {
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}
.connection-guide {
  border-top: 1px solid var(--line);
  padding: 14px 0;
  font-size: 13px;
  line-height: 1.65;
}
.connection-guide summary {
  cursor: pointer;
  font-weight: 500;
}
.connection-guide ol {
  padding-left: 20px;
}
.connection-guide li {
  margin: 9px 0;
}
@media (max-width: 500px) {
  #connection-dialog {
    padding: 20px;
    width: calc(100% - 24px);
  }
  #connection-dialog .toolbar button {
    flex: 1;
    min-height: 44px;
  }
}

body:has(#workspace:not([hidden])) { overflow:hidden; }
#workspace:not([hidden]) { display:flex; flex-direction:column; height:100dvh; overflow:hidden; overflow:clip; }
#workspace > header { min-height:62px; flex-shrink:0; padding:0 22px; gap:16px; }
#workspace > .notice { position:absolute; top:66px; right:12px; z-index:5000; max-width:min(560px,calc(100vw - 24px)); box-sizing:border-box; padding:10px 14px; border:1px solid #d5b887; border-radius:8px; box-shadow:0 4px 16px #27435118; }
#workspace > main { width:100%; max-width:none; box-sizing:border-box; padding:0; display:flex; flex-direction:column; flex:1; min-height:0; }
#workspace .work-heading { gap:20px; margin:0; padding:10px 20px; align-items:center; border-bottom:1px solid var(--line); }
#workspace .work-heading > div:first-child { flex-shrink:0; }
#workspace .work-heading h1 { font:600 18px/1.2 -apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif; letter-spacing:-.3px; }
#workspace .quiet { margin-bottom:3px; font-size:11px; }
#workspace .app-launcher { overflow-x:auto; padding:3px; min-width:0; }
#workspace .app-launcher button { font-size:12px; padding:7px 10px; flex:none; }
#workspace > footer { position:absolute; left:12px; bottom:12px; z-index:50; padding:5px 8px; border:0; margin:0; border-radius:5px; background:#e0e8ebde; pointer-events:none; font-size:10px; }
#workspace > footer span:last-child { display:none; }
#empty { position:absolute; pointer-events:none; inset:38% 0 auto; text-align:center; padding:0 20px; }
@media (max-width:850px) {
  #workspace .work-heading { flex-direction:column; align-items:stretch; gap:8px; }
  #workspace .work-heading > div:first-child { display:flex; align-items:baseline; gap:10px; }
  #workspace > header { padding:8px 12px; gap:10px; flex-wrap:wrap; }
  #workspace .work-heading { padding:8px 12px; }
  #workspace .header-actions { gap:5px; }
  #workspace .header-actions button { font-size:11px; padding:7px; }
  .window-bar { padding:0 7px; gap:5px; }
  .window-tag { display:none; }
  .session-picker { max-width:95px; }
}
@media(max-width:600px) {
  .desktop-tools { right:10px; bottom:30px; gap:1px; }
  .desktop-tools select { width:87px; font-size:12px !important; }
  .desktop-tools button { padding:8px 6px; }
  #workspace > footer { bottom:3px; left:7px; }
}
@media (pointer:coarse) {
  .window-bar { flex-basis:50px; }
  .window-control { width:29px; height:29px; min-height:29px; }
  .window-edge { min-width:10px; min-height:10px; }
  .edge-se,.edge-sw,.edge-ne,.edge-nw { width:22px; height:22px; }
}

/* Desktop chrome stays small; the app library appears only when requested. */
#workspace .work-heading { flex-direction:row; justify-content:space-between; gap:12px; }
#workspace .header-actions button { width:40px; height:40px; padding:0; display:grid; place-items:center; }
.app-menu-toggle span { font-size:14px; color:var(--accent); }
.settings-toggle span { font-size:23px; }
#workspace .search-apps { border:0; background:transparent; color:var(--muted); padding:7px 0 7px 12px; font-size:12px; white-space:nowrap; }
kbd { font:inherit; font-size:11px; border:1px solid var(--line); border-radius:4px; padding:2px 5px; color:var(--muted); }
.search-apps kbd { margin-left:12px; }
dialog.launcher-dialog { padding:0; width:min(560px,calc(100vw - 28px)); max-height:70dvh; margin:12dvh auto auto; border:1px solid #a8bec7; border-radius:16px; background:#f5f8f8; box-shadow:0 24px 90px #16354340; overflow:hidden; }
.launcher-dialog::backdrop { background:#28424b35; backdrop-filter:blur(4px); }
.launcher-search { display:flex; align-items:center; gap:12px; padding:16px 18px; border-bottom:1px solid var(--line); }
.launcher-search > span { font-size:30px; line-height:1; color:var(--accent); }
.launcher-search input { border:0; outline:none; background:transparent; font-size:21px; width:100%; min-width:0; padding:4px 0; }
.launcher-search input:focus-visible { outline:0; }
.launcher-search:focus-within { box-shadow:inset 0 -2px var(--accent); }
.launcher-search .launcher-close { border:0; background:transparent; padding:4px 8px; font-size:24px; color:var(--muted); }
.app-results { max-height:calc(70dvh - 118px); overflow:auto; overscroll-behavior:contain; padding:8px; }
.app-results details { margin:0; }
.app-results summary { padding:10px 12px 5px; font-size:12px; font-weight:600; color:var(--muted); cursor:pointer; }
.app-results button { display:flex; gap:13px; align-items:center; width:100%; text-align:left; border:0; border-radius:7px; background:transparent; padding:9px 12px; min-height:46px; }
.app-results button:hover, .app-results button[aria-selected="true"] { background:#dce9ec; }
.launcher-icon { flex:0 0 30px; height:30px; display:grid; place-items:center; color:var(--accent); background:#e3ecee; border-radius:7px; font-size:18px; }
.launcher-category { font-size:11px; color:var(--muted); margin-left:auto; }
.app-results details .launcher-category { display:none; }
.launcher-footer { padding:10px 18px; display:flex; justify-content:space-between; align-items:center; gap:10px; font-size:11px; color:var(--muted); border-top:1px solid var(--line); }
.launcher-empty { padding:20px 12px; color:var(--muted); }
#settings-dialog { width:min(520px,calc(100vw - 28px)); max-height:85dvh; overflow:auto; }
.settings-section { padding:16px 0; border-top:1px solid var(--line); }
.settings-section h3 { margin:0 0 8px; font-size:14px; }
.settings-section p { font-size:13px; line-height:1.6; margin:8px 0; }
.settings-section button { margin:4px 5px 0 0; }
.settings-address { overflow-wrap:anywhere; color:var(--muted); }
@media(max-width:500px) {
  #workspace > header { flex-wrap:nowrap; gap:8px; }
  #workspace .brand { font-size:19px; gap:5px; }
  #workspace .status-pill { font-size:10px; }
  .search-apps kbd { margin-left:5px; }
  .launcher-category { display:none; }
}
