:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  font-synthesis: none;
  background: #060a07;
  color: #edf5ee;
  --epson: #82b1f4;
  --canon: #f0af80;
  --accent: #90dda5;
  --muted: #809488;
}
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; -webkit-text-size-adjust: 100%; }
button, input { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 1px solid #9ee4af; outline-offset: 2px; }
[hidden] { display: none !important; }
.workspace {
  display: grid;
  grid-template-rows: minmax(0,1fr) auto;
  width: min(100%, 720px);
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  margin: 0 auto;
}
.diagram-zone { position: relative; min-height: 0; overflow: hidden; background: #060a07; }
.diagram-zone > svg { display: block; width: 100%; height: 100%; overflow: hidden; }
.back {
  position: absolute; top: calc(7px + env(safe-area-inset-top)); left: 7px;
  z-index: 2; display: grid; place-items: center;
  width: 39px; height: 39px; border-radius: 7px;
  color: #adc1b2; text-decoration: none; background: #060a07cf;
}
.back svg { width: 21px; height: 21px; }
.back:active { background: #1b2a20; }
.screen-shape {
  fill: url(#screen-hatch);
  fill-opacity: 1;
  stroke: #759782;
  stroke-width: 1.8;
  stroke-dasharray: .5 7.2;
  stroke-linecap: round;
}
.canon-shape { fill: var(--canon); fill-opacity: .12; stroke: var(--canon); stroke-width: 1.8; }
.epson-shape { fill: var(--epson); fill-opacity: .13; stroke: var(--epson); stroke-width: 1.8; }
.center-mark { fill: none; stroke: #cedbd0; stroke-width: 1.15; opacity: .68; }
.screen-dimensions text {
  fill: #8da294; opacity: .72;
  stroke: #060a07; stroke-width: 2.5; stroke-linejoin: round; paint-order: stroke fill;
  font: 500 14px "Segoe UI", system-ui, sans-serif;
  font-variant-numeric: tabular-nums; dominant-baseline: middle;
}
.distance-footer text {
  font-variant-numeric: tabular-nums; dominant-baseline: middle;
  stroke: #060a07; stroke-width: 3; stroke-linejoin: round; paint-order: stroke fill;
}
.distance-footer .distance-caption {
  font: 600 11px "Segoe UI", system-ui, sans-serif;
  font-variant: all-small-caps;
  letter-spacing: .12em; opacity: .63;
}
.distance-footer .distance-number { font: 650 25px "Segoe UI", system-ui, sans-serif; }
.distance-footer .epson-distance { fill: var(--epson); }
.distance-footer .canon-distance { fill: var(--canon); }
.e-dimensions { color: #b0caff; fill: currentColor; }
.c-dimensions { color: #ffd0aa; fill: currentColor; }
.e-dimensions text, .c-dimensions text {
  fill: currentColor;
  stroke: #060a07; stroke-width: 5; stroke-linejoin: round; paint-order: stroke fill;
  font-size: 22px; font-weight: 650; font-family: "Segoe UI",system-ui,sans-serif;
  font-variant-numeric: tabular-nums; letter-spacing: .005em; dominant-baseline: middle;
}
.control-deck {
  display: grid; gap: 10px;
  padding: 10px 13px calc(10px + env(safe-area-inset-bottom));
  min-width: 0;
  max-height: 68dvh;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  border-top: 1px solid #213427;
  background: #0c130e;
}
.control-deck::-webkit-scrollbar { display: none; }
.deck-switches { display: flex; gap: 10px; min-width: 0; align-items: center; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; flex: 1; padding: 2px; gap: 2px; min-width: 0; background: #162119; border-radius: 8px; }
.mode-switch button, .fit-switch button {
  min-height: 33px; border: 0; border-radius: 6px; background: transparent;
  font-size: 12px; font-weight: 650; letter-spacing: .12em; color: #899b8e;
}
.mode-switch button[aria-pressed="true"] { background: #2c4d37; color: #d8f5e0; }
.screen-lock {
  display: grid; place-items: center; width: 37px; height: 37px; flex: none;
  padding: 0; border: 0; border-radius: 8px; color: #a5b9aa; background: #162119;
}
.screen-lock svg { width: 18px; height: 18px; }
.screen-lock .locked-shackle { display: none; }
.screen-lock[aria-pressed="true"] { color: #d5f0da; background: #2b4b35; }
.screen-lock[aria-pressed="true"] .locked-shackle { display: initial; }
.screen-lock[aria-pressed="true"] .unlocked-shackle { display: none; }
.fit-switch { display: grid; grid-template-columns: 1fr 1fr; width: 126px; flex: none; gap: 2px; padding: 2px; background: #162119; border-radius: 8px; }
.fit-switch button { min-height: 33px; font-size: 11px; }
.fit-switch button[aria-pressed="true"] { background: #273e2f; color: #d2e4d5; }
.measure-control { padding: 2px 3px 0; }
.value-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 34px; }
.value-row > label { color: #93a999; font-size: 12px; font-weight: 600; letter-spacing: .055em; }
.value-group { display: flex; align-items: baseline; justify-content: flex-end; min-width: 0; white-space: nowrap; }
.value-group input {
  width: 3ch; padding: 0; margin: 0;
  text-align: right; border: 0; outline: 0; background: transparent;
  color: #ecf6ef; font-size: 23px; font-weight: 650;
  font-variant-numeric: tabular-nums; appearance: textfield;
}
.value-group input:focus { color: #b6f1c6; outline: none; }
.value-group input::-webkit-inner-spin-button, .value-group input::-webkit-outer-spin-button { appearance: none; }
.value-group span { font-size: 21px; color: #c6d5c9; font-weight: 560; font-variant-numeric: tabular-nums; }
.range-track { position: relative; display: flex; align-items: center; height: 29px; }
.range-track::before, .range-fill {
  content: ""; position: absolute; left: 0; top: 12px; height: 4px; border-radius: 8px; pointer-events: none;
}
.range-track::before { right: 0; background: #2a4030; }
.range-fill { width: 0; background: var(--accent); }
.range-track input {
  position: relative; width: 100%; height: 29px; margin: 0; padding: 0;
  appearance: none; background: transparent; touch-action: pan-y;
}
.range-track input::-webkit-slider-runnable-track { height: 4px; background: transparent; }
.range-track input::-webkit-slider-thumb {
  appearance: none; width: 25px; height: 29px; margin-top: -13px; border: 0; background: transparent;
}
.range-track input::-moz-range-track { height: 4px; background: transparent; }
.range-track input::-moz-range-thumb { width: 25px; height: 29px; border: 0; background: transparent; }
.projectors { display: grid; gap: 0; min-width: 0; border-top: 1px solid #23372a; }
.projector { min-width: 0; border-bottom: 1px solid #23372a; padding: 10px 0 8px; }
.projector-top { display: flex; align-items: flex-start; gap: 8px; min-width: 0; }
.projector-main { flex: 1; min-width: 0; border: 0; padding: 0; text-align: left; background: transparent; color: inherit; display: grid; gap: 5px; }
.projector-name {
  display: flex; align-items: center; gap: 8px; min-width: 0;
  font-size: 13px; font-weight: 650; font-variant: small-caps; letter-spacing: .115em;
  color: #b9cbbd; white-space: nowrap;
}
.color-mark {
  display: inline-block; flex: none; width: 9px; height: 9px;
  border-radius: 3px; background: var(--epson); box-shadow: 0 0 5px #83b4ff70;
}
.canon .color-mark { background: var(--canon); box-shadow: 0 0 5px #f0af8070; }
.projector-primary { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 9px; row-gap: 2px; min-width: 0; }
.projector-primary output { white-space: nowrap; font-size: 19px; font-weight: 600; letter-spacing: -.025em; color: #eff5f0; font-variant-numeric: tabular-nums; }
.projector-primary small { font-size: 11px; color: #8fa999; white-space: nowrap; font-weight: 500; }
.projector-actions { display: flex; align-items: center; gap: 5px; flex: none; }
.aspect-action, .zoom-action {
  width: 54px; height: 32px; border-radius: 7px; border: 1px solid #34503d;
  background: transparent; color: #99b29f; font-size: 12px; font-weight: 700; letter-spacing: .02em;
}
.aspect-action[aria-pressed="true"] { color: #ccf1d6; border-color: #548766; background: #203b29; }
.zoom-action {
  width: 32px; padding: 0; display: grid; place-items: center;
  color: var(--epson); border-color: #334861;
}
.zoom-action svg { width: 18px; height: 18px; }
.zoom-action[aria-expanded="true"] { background: #1b2d43; border-color: #6d95c7; }
.distance-line { display: flex; gap: 9px; align-items: baseline; padding: 4px 0 0 17px; }
.distance-line span { font-size: 11px; letter-spacing: .03em; color: #799283; }
.distance-line output { color: #bdcfc1; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }
.alert-tag {
  display: grid; place-items: center; width: 20px; height: 24px;
  color: #f19b98; background: #432323; border: 1px solid #75423f; border-radius: 5px; font-size: 14px; font-weight: 800;
}
.zoom-panel { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin: 5px 65px 0 auto; }
.zoom-track { width: 175px; max-width: 42vw; flex: none; }
.zoom-panel output { font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 700; color: #c8e9d0; width: 47px; text-align: right; }
.angle-panel { margin: 5px 0 0 17px; color: #9eb6a4; }
.angle-panel summary {
  list-style: none; cursor: pointer; display: flex; align-items: center;
  justify-content: space-between; gap: 10px; min-height: 26px; user-select: none; -webkit-tap-highlight-color: transparent;
}
.angle-panel summary::-webkit-details-marker { display: none; }
.angle-panel summary output { font-size: 11px; color: #91a799; font-variant-numeric: tabular-nums; }
.angle-panel summary svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .7; transition: transform .15s; }
.angle-panel[open] summary svg { transform: rotate(180deg); }
.angle-controls { display: grid; gap: 7px; padding: 6px 2px 3px 0; }
.angle-row { display: grid; grid-template-columns: 95px minmax(0, 1fr) 43px; align-items: center; gap: 9px; min-width: 0; }
.angle-row > span { color: #879d8e; font-size: 11px; }
.angle-row output { text-align: right; font-size: 12px; color: #d3e6d7; font-variant-numeric: tabular-nums; }
.angle-track { position: relative; display: block; min-width: 0; height: 24px; }
.angle-track::before, .angle-fill {
  content: ""; position: absolute; top: 10px; left: 0; height: 3px;
  border-radius: 5px; pointer-events: none;
}
.angle-track::before { right: 0; background: #395241; }
.angle-fill { width: 0; background: var(--accent); }
.angle-zero { position: absolute; top: 7px; left: calc(50% - 1px); width: 2px; height: 9px; border-radius: 2px; background: #779c81; pointer-events: none; }
.angle-track input {
  position: relative; width: 100%; height: 24px; margin: 0; appearance: none;
  background: transparent; cursor: pointer; touch-action: pan-y;
}
.angle-track input::-webkit-slider-runnable-track { height: 3px; background: transparent; }
.angle-track input::-moz-range-track { height: 3px; background: transparent; }
.angle-track input::-webkit-slider-thumb { appearance: none; width: 24px; height: 24px; margin-top: -10px; border: 0; background: transparent; }
.angle-track input::-moz-range-thumb { width: 24px; height: 24px; border: 0; background: transparent; }
.projector.is-hidden .projector-main, .projector.is-hidden .distance-line { opacity: .3; }
.projector.is-hidden .color-mark { background: transparent; box-shadow: none; border: 1px solid #74877a; }
@media (max-width: 390px) {
  .control-deck { padding-inline: 10px; gap: 8px; }
  .projector-name { font-size: 12px; letter-spacing: .095em; }
  .projector-primary output { font-size: 17px; }
  .projector-primary small { font-size: 10px; }
  .projector-top { gap: 5px; }
  .projector-actions { gap: 4px; }
  .aspect-action { width: 52px; }
}
@media (max-height: 700px) {
  .control-deck { gap: 5px; padding-top: 6px; padding-bottom: calc(5px + env(safe-area-inset-bottom)); }
  .mode-switch button, .fit-switch button { min-height: 29px; }
  .measure-control { padding-top: 0; }
  .value-row { min-height: 29px; }
  .value-group input { font-size: 21px; }
  .value-group span { font-size: 19px; }
  .range-track { height: 22px; }
  .range-track::before, .range-fill { top: 9px; }
  .projector { padding: 6px 0 5px; }
  .projector-main { gap: 3px; }
  .projector-primary output { font-size: 17px; }
  .distance-line { padding-top: 2px; }
  .zoom-panel { margin-top: 2px; }
}
