:root {
  --screen-w: 450px;
  --screen-h: 600px;
  --scale: 1;
  --bg: #050505;
  --panel: #111315;
  --text: #ffffff;
  --muted: #bdbdbd;
  --green: #22e36f;
  --blue: #7fb7ff;
  --red: #d62626;
  --orange: #ff9f2e;
}

* { box-sizing: border-box; }
html {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0b0d10;
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.app-shell {
  height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 18px;
  padding: 18px;
  overflow: hidden;
}
.sim-panel, .controls {
  min-width: 0;
  background: var(--panel);
  border: 1px solid #252a2f;
  border-radius: 10px;
}
.sim-panel { min-height: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.toolbar {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 14px 18px;
  border-bottom: 1px solid #252a2f;
}
h1, h2, p { margin: 0; }
h1 { font-size: 20px; font-weight: 750; }
p { color: #8d949c; font-size: 13px; margin-top: 4px; }
.toolbar-actions { display: flex; gap: 8px; }
.toolbar-actions button { white-space: nowrap; }
.toolbar-actions button, .controls button {
  color: var(--text);
  background: #1a1d20;
  border: 1px solid #333942;
  border-radius: 8px;
  padding: 9px 12px;
}
.sim-tabs {
  display: inline-flex;
  gap: 6px;
  margin-top: 10px;
  padding: 4px;
  border: 1px solid #2a3036;
  border-radius: 8px;
  background: #090b0d;
}
.sim-tab {
  min-height: 32px;
  color: #aeb5bd;
  background: transparent;
  border: 0;
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 800;
}
.sim-tab.is-active {
  color: #061008;
  background: var(--green);
}
.workspace {
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 22px;
  overflow: hidden;
}
.device-frame {
  width: calc(var(--screen-w) * var(--scale));
  height: calc(var(--screen-h) * var(--scale));
  position: relative;
  display: block;
  overflow: hidden;
  background: #000;
  border-radius: calc(28px * var(--scale));
  box-shadow: 0 20px 80px rgba(0,0,0,.55), inset 0 0 0 1px #242424;
}
.screen {
  position: relative;
  width: var(--screen-w);
  height: var(--screen-h);
  background: #000;
  overflow: hidden;
  transform: scale(var(--scale));
  transform-origin: top left;
  border-radius: 22px;
}
.screen::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: 22px;
  box-shadow: inset 0 0 0 1px #202020;
}
.page { position: absolute; inset: 0; display: none; background: #000; }
.page.active { display: block; }
.hit { border: 0; padding: 0; background: transparent; color: inherit; }
.tx-pill {
  position: absolute; left: 22px; top: 22px; width: 84px; height: 48px;
  border-radius: 16px; background: #a91515; color: white; font-size: 26px; font-weight: 800;
}
.tx-pill::before { content: attr(data-route); position: absolute; inset: 8px 0 0; text-align: center; }
.tx-pill.connected { background: #0c5f2a; }
.signal-hit { position: absolute; right: 174px; top: 22px; width: 86px; height: 48px; z-index: 4; }
.signal-bars .bar {
  position: absolute;
  width: 8px; height: calc(12px + var(--i) * 8px);
  border-radius: 3px; background: #242424;
}
.signal-bars .bar.on { background: var(--green); }
.wifi-icon { position: absolute; right: 106px; top: 33px; color: var(--blue); font-size: 22px; font-weight: 650; }
.wifi-icon.hidden { display: none; }
.battery-pill {
  position: absolute; right: 16px; top: 22px; width: 86px; height: 48px;
}
.battery-pill::before {
  content: attr(data-label); position: absolute; left: 0; top: 7px; width: 76px; height: 34px;
  display: grid; place-items: center; color: var(--blue); font-size: 22px; font-weight: 800;
  background: #111; border: 2px solid #303030; border-radius: 7px;
}
.battery-pill::after {
  content: ""; position: absolute; right: 0; top: 16px; width: 6px; height: 16px;
  background: #303030; border-radius: 3px;
}
.distance-readout {
  position: absolute;
  left: 0;
  top: 242px;
  width: var(--screen-w);
  height: 128px;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 12px;
  color: var(--text);
}
.distance-readout.green { color: var(--green); }
.distance-readout.blue { color: var(--blue); }
.distance-readout.red { color: #ff5757; }
.feet-number, .inch-number, .feet-marker, .inch-marker {
  position: static; font-weight: 800; line-height: .92; letter-spacing: 0;
  font-family: "Montserrat", "SF Pro Display", Arial, sans-serif;
}
.feet-number { width: 96px; text-align: right; font-size: 72px; padding-top: 12px; }
.feet-marker { font-size: 48px; }
.inch-number { width: 96px; text-align: right; font-size: 72px; padding-top: 12px; }
.inch-marker { font-size: 48px; }
.status-line { position: absolute; top: 380px; left: 0; width: var(--screen-w); text-align: center; color: var(--muted); font-size: 22px; font-weight: 550; }
.bottom-offset {
  position: absolute;
  left: 16px;
  bottom: 44px;
  width: 154px;
  height: 56px;
  color: var(--muted);
  font-size: 22px;
  font-weight: 750;
  text-align: left;
  padding-left: 8px;
}
.bottom-mode {
  position: absolute;
  left: 116px;
  bottom: 44px;
  width: 144px;
  height: 56px;
  text-align: center;
  color: var(--muted);
  font-size: 22px;
  font-weight: 750;
}
.bottom-offset:active,
.bottom-mode:active { color: var(--green); }
.settings-hotspot { position: absolute; right: 0; bottom: 0; width: 94px; height: 92px; }
.page-title { position: absolute; top: 30px; left: 0; width: var(--screen-w); text-align: center; color: #b0b0b0; font-size: 28px; font-weight: 750; }
.page-title.small { font-size: 22px; top: 34px; }
.back-hotspot { position: absolute; left: 10px; top: 10px; width: 82px; height: 58px; border: 0; color: white; background: #202020; border-radius: 18px; font-size: 16px; font-weight: 800; letter-spacing: 0; z-index: 3; }
.info-block, .diag-block, .center-info {
  position: absolute; left: 42px; top: 92px; width: 366px; margin: 0; white-space: pre-wrap;
  color: white; font-size: 28px; line-height: 1.28; font-family: inherit; font-weight: 650;
}
.offset-readout {
  position: absolute;
  top: 126px;
  left: 0;
  width: var(--screen-w);
  color: white;
  text-align: center;
  font-size: 34px;
  font-weight: 760;
}
.offset-adjust {
  position: absolute;
  top: 204px;
  width: 120px;
  height: 92px;
  border: 2px solid #303030;
  border-radius: 18px;
  background: #151515;
  color: white;
  font-size: 42px;
  font-weight: 800;
}
.offset-adjust:active,
.menu-close:active { background: #0c5f2a; }
.offset-minus { left: 34px; }
.offset-plus { left: 296px; }
.menu-close {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 92px;
  height: 62px;
  border: 2px solid #303030;
  border-radius: 18px;
  background: #151515;
  color: white;
  font-size: 18px;
  letter-spacing: 0;
  font-weight: 800;
}
.diag-block { left: 34px; top: 82px; width: 382px; font-size: 24px; line-height: 1.22; }
.menu-button {
  position: absolute; left: 75px; width: 300px; height: 66px; border: 2px solid #303030; border-radius: 18px;
  color: white; background: #151515; font-size: 28px; font-weight: 760;
}
.menu-button:nth-of-type(1) { top: 88px; }
.menu-button:nth-of-type(2) { top: 168px; }
.menu-button:nth-of-type(3) { top: 248px; }
.menu-button:nth-of-type(4) { top: 328px; }
.generic-title { position: absolute; top: 128px; left: 0; width: var(--screen-w); text-align: center; color: white; font-size: 28px; font-weight: 700; }
.wifi-large { position: absolute; top: 36px; left: 0; width: var(--screen-w); color: var(--blue); font-size: 48px; text-align: center; font-weight: 750; }
.center-info { top: 188px; left: 40px; width: 370px; text-align: center; color: var(--muted); }
.brightness-slider { position: absolute; top: 202px; left: 75px; width: 300px; accent-color: var(--green); }
.screen.is-mini .tx-pill {
  border-radius: 14px;
  font-size: 23px;
}
.screen.is-mini .tx-pill::before {
  inset: 6px 0 0;
}
.screen.is-mini .wifi-icon {
  font-size: 20px;
}
.screen.is-mini .battery-pill {
  width: 72px;
  height: 42px;
}
.screen.is-mini .battery-pill::before {
  top: 6px;
  width: 62px;
  height: 30px;
  font-size: 18px;
}
.screen.is-mini .battery-pill::after {
  top: 14px;
  height: 14px;
}
.screen.is-mini .feet-number,
.screen.is-mini .inch-number {
  font-size: 64px;
}
.screen.is-mini .feet-marker,
.screen.is-mini .inch-marker {
  font-size: 40px;
}
.screen.is-mini .bottom-offset,
.screen.is-mini .bottom-mode {
  font-size: 18px;
  padding-left: 4px;
}
.screen.is-mini .page-title {
  top: 26px;
  font-size: 23px;
}
.screen.is-mini .back-hotspot {
  width: 76px;
  height: 42px;
  border-radius: 14px;
  font-size: 13px;
}
.screen.is-mini .info-block,
.screen.is-mini .diag-block,
.screen.is-mini .center-info {
  left: 30px;
  width: 308px;
  font-size: 22px;
}
.screen.is-mini .menu-button {
  left: 46px;
  width: 276px;
  height: 56px;
  font-size: 23px;
}
.controls {
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 16px;
  overflow: hidden;
}
.controls h2 { font-size: 18px; margin-bottom: 2px; }
.controls label { display: grid; gap: 5px; color: #aeb5bd; font-size: 12px; margin: 0; }
.controls label span { color: var(--blue); font-weight: 800; justify-self: end; }
.controls input, .controls select {
  width: 100%; color: white; background: #080a0c; border: 1px solid #303640; border-radius: 8px; padding: 9px;
}
.controls input[type="range"] { padding: 0; }
.hint { margin-top: 14px; color: #8d949c; font-size: 13px; line-height: 1.35; }
@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(0, 1fr) auto;
  }
}

@media (max-width: 640px) {
  body {
    height: 100svh;
  }

  .app-shell {
    height: 100svh;
    gap: 10px;
    padding: 10px;
  }

  .sim-panel,
  .controls {
    border-radius: 8px;
  }

  .toolbar {
    min-height: 0;
    align-items: flex-start;
    gap: 10px;
    padding: 10px;
  }

  h1 {
    font-size: 17px;
  }

  p {
    font-size: 12px;
  }

  .toolbar-actions {
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    max-width: 142px;
    gap: 6px;
  }

  .toolbar-actions button,
  .controls button {
    min-height: 34px;
    padding: 7px 8px;
    border-radius: 7px;
    font-size: 12px;
  }

  .workspace {
    padding: 8px;
  }

  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
  }

  .controls h2 {
    grid-column: 1 / -1;
    font-size: 15px;
  }

  .controls label {
    font-size: 11px;
  }

  .controls input,
  .controls select {
    min-height: 34px;
    padding: 6px 8px;
    font-size: 12px;
  }
}
