@font-face {
  font-family: "Instrument Serif";
  src: url("instrument-serif-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
:root {
  color-scheme: light;
  --paper: #f6f4ed;
  --ink: #252b26;
  --muted: #64695e;
  --line: #d9d8cb;
  --accent: #994b32;
  --wash: #f0e4d8;
  --night: #282e2b;
  --edge: clamp(16px, 2.4vw, 40px);
  font-family: Inter, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 280px; }
button, select { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button { padding: 0; border: 0; background: none; }
button:disabled { opacity: .47; cursor: default; }
button:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button, select { touch-action: manipulation; }
[hidden] { display: none !important; }
.symbols { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.icon, .mark { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linejoin: round; stroke-linecap: round; }
.icon { width: 18px; height: 18px; flex: none; }
#world {
  display: grid;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-height: 278px;
  grid-template-rows: auto minmax(0,1fr) auto;
  margin: 0;
  background: var(--paper);
}
#world:fullscreen, #world.expanded { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 10; }
#world:is(:fullscreen,.expanded) { grid-template-rows: minmax(0,1fr); }
#world:is(:fullscreen,.expanded) .masthead { position: absolute; top: max(var(--edge),env(safe-area-inset-top)); right: calc(max(var(--edge),env(safe-area-inset-right)) + 48px); z-index: 2; padding: 0; min-height: 0; }
#world:is(:fullscreen,.expanded) .header-action { color: #fcf7e8; padding: 0 10px; background: #252b26dc; border: 1px solid #ffffff36; border-radius: 5px; }
#world:is(:fullscreen,.expanded) .identity, #world:is(:fullscreen,.expanded) .viewbar { display: none; }
.masthead, .viewbar { display: flex; align-items: center; padding-inline: max(var(--edge), env(safe-area-inset-left)) max(var(--edge), env(safe-area-inset-right)); }
.masthead { min-height: clamp(52px, 7.25vh, 76px); justify-content: space-between; gap: 16px; padding-top: env(safe-area-inset-top); }
.identity, h1, .header-action, .gesture, .layer-toggle, .camera-tools, .presets { display: flex; align-items: center; }
.identity { gap: 13px; min-width: 0; }
.mark { color: var(--accent); width: 34px; height: 33px; flex: none; stroke-width: 1.95; stroke-linecap: square; }
h1 { margin: 0; gap: 15px; align-items: baseline; font-size: clamp(21px, 1.85vw, 29px); letter-spacing: -.075em; line-height: 1.15; white-space: nowrap; }
h1 em { font: italic 400 clamp(20px, 1.8vw, 27px)/1 "Instrument Serif", Georgia, serif; color: #77786a; letter-spacing: -.035em; }
.header-action { gap: 7px; color: #454d44; min-height: 36px; white-space: nowrap; font-size: 13px; font-weight: 650; }
.header-action:hover { color: var(--accent); }
#stage { position: relative; isolation: isolate; overflow: hidden; background: var(--night); color: #f7f6eb; }
#stage::before { content: ""; position: absolute; inset: 0; opacity: .24; pointer-events: none; background: radial-gradient(#929b90 .63px, transparent .8px) 0 0 / 16px 16px; }
#frame, #frame > * { position: absolute; inset: 0; width: 100%; height: 100%; }
#fallback { object-fit: contain; pointer-events: none; user-select: none; }
canvas { touch-action: none; cursor: grab; outline: none; }
canvas:focus-visible { outline: 2px solid #ecba92; outline-offset: -3px; }
canvas:active { cursor: grabbing; }
.caption { position: absolute; top: var(--edge); left: var(--edge); display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 5px; border: 1px solid #ffffff29; background: #252c26d1; pointer-events: none; }
.caption span { width: 6px; height: 6px; border-radius: 50%; background: #edaf76; }
.caption strong { font-size: 12px; font-weight: 660; }
.compass { position: absolute; top: var(--edge); right: var(--edge); width: 33px; display: grid; justify-items: center; gap: 3px; color: #eeeede; pointer-events: none; }
.compass b { font: 600 10px/1 ui-monospace, monospace; }
.compass svg { display: block; width: 31px; }
.compass circle { stroke: #dce3d48a; stroke-width: .8; fill: #252b265e; }
#north-arrow { transform-origin: 16px 16px; }
.north { fill: #f0ac72; }
.south { fill: #dde2d3; }
.glass { position: absolute; bottom: var(--edge); color: #fff8e8; background: #252b26e6; border: 1px solid #ffffff39; box-shadow: 0 2px 9px #15201739; border-radius: 6px; backdrop-filter: blur(10px); }
.layer-toggle { left: var(--edge); gap: 7px; padding: 0 12px; min-height: 38px; font-size: 12px; font-weight: 660; }
.layer-toggle[aria-expanded="true"] { color: #ffc695; }
.camera-tools { right: var(--edge); padding: 1px; }
.camera-tools button { display: grid; place-items: center; width: 38px; height: 36px; border-radius: 4px; }
.camera-tools #reset { border-left: 1px solid #ffffff25; border-radius: 0 4px 4px 0; }
.layer-toggle:hover, .camera-tools button:enabled:hover { background-color: #414a40; }
#stage button:focus-visible { outline-color: #efbc93; }
.layer-panel { position: absolute; bottom: calc(var(--edge) + 47px); left: var(--edge); max-width: calc(100% - var(--edge)*2); width: 240px; border-radius: 8px; border: 1px solid #dad9ca; padding: 14px; background: #fcfbf4; color: var(--ink); box-shadow: 0 6px 24px #1720164d; }
.layer-panel h2 { font-size: 14px; margin: 0 0 9px; padding-bottom: 7px; border-bottom: 1px solid var(--line); }
#layer-list { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 5px; }
#layer-list label { display: flex; align-items: center; gap: 7px; min-height: 28px; cursor: pointer; font-size: 12px; }
#layer-list input { accent-color: var(--accent); margin: 0; }
#status { position: absolute; bottom: calc(var(--edge) + 8px); left: 50%; transform: translateX(-50%); background: #252b26d9; border-radius: 4px; padding: 4px 9px; color: #fff7e8; white-space: nowrap; font-size: 12px; }
.viewbar { gap: 14px; padding-top: 9px; padding-bottom: max(9px, env(safe-area-inset-bottom)); min-height: 59px; }
.presets { gap: 3px; }
.presets button { padding: 0 12px; min-height: 34px; border-radius: 5px; color: #4b5349; font-size: 13px; font-weight: 670; white-space: nowrap; }
.presets button[aria-pressed="true"] { color: #843c26; background: var(--wash); }
.presets button:hover { color: var(--accent); }
.place-select { position: relative; padding-left: 15px; border-left: 1px solid var(--line); }
.place-select select { appearance: none; border: 1px solid var(--line); border-radius: 5px; background: #fcfbf6; padding: 6px 27px 6px 10px; font-size: 13px; font-weight: 630; min-height: 34px; }
.place-select svg { position: absolute; right: 7px; top: 50%; transform: translateY(-50%); pointer-events: none; width: 14px; }
.gesture { gap: 7px; color: var(--muted); margin-left: auto; font-size: 12px; white-space: nowrap; }
.gesture .icon { width: 16px; }
.touch-help { display: none; }
@media (hover: none) { .touch-help { display: inline; } .pointer-help { display: none; } }
@media (max-width: 780px) { .gesture { display: none; } .viewbar { justify-content: space-between; } }
@media (max-width: 540px) {
  :root { --edge: 13px; }
  .identity { gap: 8px; }
  .mark { width: 26px; height: 26px; }
  h1 { gap: 9px; font-size: 21px; }
  h1 em { font-size: 20px; }
  .header-action span { display: none; }
  .header-action { justify-content: center; width: 36px; }
  .viewbar { min-height: 54px; padding-inline: 7px; flex-wrap: wrap; gap: 3px 6px; }
  .presets { gap: 0; }
  .presets button { font-size: 11px; padding: 0 7px; }
  .place-select { border: 0; padding-left: 0; }
  .place-select select { max-width: 106px; font-size: 11px; padding-left: 7px; padding-right: 18px; }
  .place-select svg { right: 3px; }
  .compass { width: 27px; } .compass svg { width: 25px; }
  #status { bottom: calc(var(--edge) + 49px); }
}
@media (max-height: 490px) { .masthead { min-height: 39px; } .viewbar { min-height: 38px; padding-block: 2px; } .mark { height: 25px; } }

.head-tools { display: flex; align-items: center; gap: 20px; }
#plan-toggle { gap: 6px; padding: 0 9px; width: auto; border: 1px solid var(--line); border-radius: 5px; letter-spacing: .02em; }
#plan-toggle[aria-expanded="true"] { color: #713922; background: var(--wash); border-color: #cba88d; }
#world[data-planning] { grid-template: auto minmax(0,1fr) auto / minmax(0,1fr) clamp(265px, 23.5vw, 350px); }
#world[data-planning] .masthead, #world[data-planning] .viewbar { grid-column: 1 / -1; }
#camera-panel { --cam: #41dbbf; min-width: 0; min-height: 0; overflow: auto; padding: 17px clamp(15px,1.5vw,23px) 12px; background: #fbfaf4; border-left: 1px solid var(--line); scrollbar-width: thin; }
.plan-head, .coverage-control, #lens-settings summary, #lens-fields label { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.plan-head h2 { margin: 0; font-size: 20px; letter-spacing: -.055em; }
#plan-close { width: 31px; height: 31px; display: grid; place-items: center; color: #5a6259; border-radius: 4px; }
#plan-close:hover, #plan-home:hover { background: var(--wash); }
#plan-status, #lens-note, .plan-method p { font-size: 12px; line-height: 1.55; color: #555d50; }
#plan-status:empty { display: none; }
#plan-list { list-style: none; display: flex; gap: 4px; flex-wrap: wrap; margin: 10px 0 14px; padding: 0; }
#plan-list li { flex: 1 1 max-content; }
#plan-list button { width: 100%; min-height: 34px; padding: 4px 8px; background: #efece2; border: 1px solid #d7d5c7; border-radius: 5px; color: #4d554a; font-size: 12px; font-weight: 650; }
#plan-list button[aria-pressed="true"] { background: #34483e; border-color: #34483e; color: #fffaf0; }
.camera-count { margin: 0; color: var(--muted); font-size: 11px; font-weight: 620; }
#camera-list { display: grid; gap: 4px; margin: 5px 0 12px; }
#camera-samples { color: #315749; font-size: 11px; margin: 6px 0; font-variant-numeric: tabular-nums; }
.target-views { display: flex; gap: 4px; }
.camera-choice { display: flex; align-items: center; text-align: left; gap: 10px; border: 1px solid transparent; border-radius: 6px; padding: 7px 9px; min-height: 42px; }
.camera-choice:hover { background: #f1f1e8; }
.camera-choice[aria-pressed="true"] { background: color-mix(in srgb, var(--cam) 13%, #f9faf5); border-color: color-mix(in srgb, var(--cam) 42%, #9ca69a); }
.camera-number { display: grid; place-items: center; flex: none; width: 23px; height: 23px; border-radius: 50%; color: #192c28; background: var(--cam); font: 750 12px/1 ui-monospace, monospace; }
.camera-choice strong, .camera-choice small { display: block; }
.camera-choice strong { font-size: 13px; letter-spacing: -.025em; }
.camera-choice small { margin-top: 3px; font-size: 11px; color: var(--muted); }
.camera-short { display: none; }
#selected-camera { border-top: 1px solid var(--line); padding-top: 13px; }
#camera-title { font-size: 16px; letter-spacing: -.045em; margin: 0; }
#camera-mount, #camera-purpose { font-size: 12px; line-height: 1.5; color: #4c5348; margin: 4px 0; overflow-wrap: anywhere; }
#camera-mount { font-variant-numeric: tabular-nums; }
.coverage-control { margin: 11px 0; gap: 4px; }
.coverage-control label { display: flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 660; cursor: pointer; }
.coverage-control input { accent-color: #43564b; margin: 0; width: 15px; height: 15px; }
.coverage-control i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--cam); border: 1px solid #0003; }
#plan-home, #camera-focus, #lens-reset { border: 1px solid var(--line); border-radius: 4px; color: #525a4e; padding: 4px 7px; min-height: 27px; font-size: 11px; font-weight: 650; white-space: nowrap; }
#lens-figure { margin: 12px 0; }
#lens-figure figcaption { margin: 0 0 5px; font-size: 11px; font-weight: 620; color: var(--muted); }
#lens-image { display: block; cursor: auto; touch-action: auto; width: 100%; height: clamp(90px,14vh,155px); object-fit: contain; background: #29302d; border-radius: 4px; }
#camera-panel details { border-top: 1px solid var(--line); }
#camera-panel summary { cursor: pointer; padding: 10px 0; font-size: 12px; font-weight: 650; line-height: 1.35; }
#lens-settings summary { display: list-item; }
#lens-values { font-size: 11px; margin-left: 5px; color: var(--muted); white-space: nowrap; font-weight: 500; }
#lens-note, .plan-method p { margin: 0 0 10px; }
#lens-fields { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
#lens-fields label { flex-wrap: wrap; gap: 2px 10px; font-size: 12px; }
#lens-fields input { flex: 0 0 100%; width: 100%; margin: 0; accent-color: #486358; cursor: pointer; }
#lens-fields output { color: #435b4f; font-variant-numeric: tabular-nums; }
#lens-reset { justify-self: start; }
#camera-product { color: #714129; font-size: 12px; display: inline-block; margin: 10px 0; }
#sample-count { color: #36473f; font-size: 12px; margin: 10px 0 0; }
#world[data-fixed-plan] .viewbar { display: none; }
#camera-pins { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.pin-lines { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
.pin-lines line { stroke: #fcf7e8; stroke-width: 1.5; filter: drop-shadow(0 1px 1px #141c19); }
.pin-lines circle { stroke: #22302b; stroke-width: 1.1; }
.camera-pin { position: absolute; left: 0; top: 0; pointer-events: auto; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; touch-action: manipulation; }
.camera-pin span { display: grid; place-items: center; height: 29px; width: 29px; border-radius: 50%; font: 750 14px/1 ui-monospace, monospace; background: #263a34; color: #fffdf3; border: 2px solid var(--cam); box-shadow: 0 1px 5px #091a16a8; }
.camera-pin[aria-pressed="true"] { z-index: 1; }
.camera-pin[aria-pressed="true"] span, .camera-pin:hover span { background: var(--cam); color: #162c25; border-color: #fff9e9; }
#world[data-planning]:is(:fullscreen,.expanded) { grid-template-rows: minmax(0,1fr); }
#world[data-planning]:is(:fullscreen,.expanded) .masthead { right: calc(clamp(265px, 23.5vw, 350px) + var(--edge) + 40px); }
@media (max-width: 780px) {
  #world[data-planning] { grid-template: auto minmax(0,1fr) auto auto / minmax(0,1fr); }
  #camera-panel { border-left: 0; border-top: 1px solid var(--line); padding: 5px max(12px,env(safe-area-inset-right)) 5px max(12px,env(safe-area-inset-left)); max-height: 32vh; max-height: 32dvh; }
  .plan-head h2 { font-size: 15px; }
  #plan-list { margin: 2px 0 5px; }
  #plan-list button { min-height: 31px; }
  .camera-count { display: none; }
  #plan-close { width: 30px; height: 27px; }
  #camera-list { display: flex; flex-wrap: wrap; gap: 4px; margin: 2px 0 5px; }
  .camera-choice { gap: 5px; padding: 3px 7px; min-height: 33px; }
  .camera-number { width: 19px; height: 19px; font-size: 11px; }
  .camera-choice .camera-long, .camera-choice small { display: none; }
  .camera-short { display: inline; font-size: 12px; font-weight: 650; }
  #selected-camera { border: 0; padding: 0; }
  #camera-title { font-size: 13px; }
  #camera-mount, #camera-purpose { font-size: 11px; margin: 2px 0; }
  .coverage-control { margin: 4px 0; }
  #lens-figure { float: right; width: min(36%,200px); margin: 5px 0 6px 10px; }
  #lens-image { height: 66px; }
  #lens-figure figcaption { font-size: 10px; margin: 0 0 2px; }
  #lens-settings[open], .plan-method[open] { clear: both; }
  #camera-panel summary { padding: 8px 0; }
  #world[data-planning]:is(:fullscreen,.expanded) { grid-template-rows: minmax(0,1fr) auto; }
  #world[data-planning]:is(:fullscreen,.expanded) .masthead { right: calc(var(--edge) + 38px); }
}
@media (max-width: 540px) {
  .head-tools { gap: 6px; }
  #plan-toggle { font-size: 11px; padding: 0 6px; }
  .masthead { gap: 4px; }
}
@media (max-width: 370px) { h1 em { display: none; } }
@media (max-height: 480px) and (orientation: landscape) {
  #world[data-planning] { grid-template: auto minmax(0,1fr) auto / minmax(0,1fr) 238px; }
  #camera-panel { max-height: none; }
  #world[data-planning]:is(:fullscreen,.expanded) { grid-template-rows: minmax(0,1fr); }
  #world[data-planning]:is(:fullscreen,.expanded) .masthead { right: calc(238px + var(--edge) + 40px); }
}
