/* Course Map Ruler — styles */
:root {
  --paper: #f2f5f8; --surface: #ffffff; --sunken: #e7ecf1; --ink: #14202c; --muted: #586674;
  --line: #d3dbe3; --accent: #1461cc; --accent-soft: #e2ecfa; --on-accent: #ffffff;
  --ok: #1b7a43; --warn: #955f00; --bad: #b3301f;
  --display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --body: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --paper: #0e141a; --surface: #151d26; --sunken: #1c2630; --ink: #e3e9ef; --muted: #93a1ae;
    --line: #29353f; --accent: #5c9dff; --accent-soft: #172a42; --on-accent: #0b1117;
    --ok: #4cc27f; --warn: #e3a73c; --bad: #ff7b6c;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #0e141a; --surface: #151d26; --sunken: #1c2630; --ink: #e3e9ef; --muted: #93a1ae;
  --line: #29353f; --accent: #5c9dff; --accent-soft: #172a42; --on-accent: #0b1117;
  --ok: #4cc27f; --warn: #e3a73c; --bad: #ff7b6c;
}

[hidden] { display: none !important; }
img { max-width: 100%; }
html { color-scheme: light; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 15px/1.5 var(--body); padding-inline: 16px; padding-block: 18px 28px; }
.wrap { max-width: 1280px; margin: 0 auto; display: grid; gap: 18px; }
h1, h2 { font-family: var(--display); text-wrap: balance; margin: 0; }
h1 { font-size: 32px; font-weight: 700; letter-spacing: .01em; line-height: 1.05; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
p { margin: 0; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; }
.brand { display: flex; align-items: center; gap: 10px; }
.brand svg { width: 34px; height: 34px; flex: none; }
.lede { color: var(--muted); max-width: 64ch; }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) 372px; gap: 20px; align-items: start; }
@media (max-width: 920px) { .grid { grid-template-columns: minmax(0, 1fr); } }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 10px; }
.hint { color: var(--muted); font-size: 14px; }
.toggles { margin-left: auto; display: flex; gap: 6px; }
@media (max-width: 560px) { .toggles { margin-left: 0; } }
.btn { font: 600 14px/1 var(--body); padding: 10px 14px; border-radius: 6px; border: 1px solid var(--line);
       background: var(--surface); color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.chip { font: 500 13px/1 var(--body); padding: 8px 11px; border-radius: 999px; border: 1px solid var(--line);
        background: var(--surface); color: var(--muted); cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
:is(.btn, .chip, .stage, input, summary, .hist button):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.stage { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; min-height: 240px; }
.stage canvas { display: block; width: 100%; height: auto; }
.stage #overlayCanvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.veil { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px;
        font: 600 20px/1.3 var(--display); letter-spacing: .02em; color: #14202c; background: rgba(226, 236, 250, .9);
        border: 2px dashed #1461cc; border-radius: 8px; }
.veil.busy { background: rgba(255, 255, 255, .72); border: 0; }
.empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; color: #586674; }
.stage.picking, .stage.coords { cursor: crosshair; }
.banner { position: absolute; left: 12px; right: 12px; top: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px;
          padding: 12px 14px; border-radius: 8px; background: rgba(255, 255, 255, .97); color: #14202c;
          border: 1px solid #b3301f; box-shadow: 0 2px 12px rgba(20, 32, 44, .15); }
.banner p { flex: 1 1 260px; font-weight: 500; }
.guide { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 12px; margin-bottom: 10px;
         border: 1px solid var(--accent); background: var(--accent-soft); border-radius: 8px; }
.guide select, .guide input { font: 500 14px var(--body); padding: 7px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); max-width: 100%; }
.guide input { width: 76px; font-family: var(--mono); text-align: right; }
.guide .step { font-weight: 600; flex: 1 1 200px; }
.linkbtn { font: 500 13px var(--body); color: var(--accent); background: none; border: 0; padding: 4px 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.caption { color: var(--muted); font-size: 13px; margin-top: 8px; overflow-wrap: anywhere; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 18px; height: 4px; border-radius: 2px; display: inline-block; }

.result { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px 20px; display: grid; gap: 12px; }
.eyebrow { font: 600 13px/1 var(--body); letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.size { font: 700 clamp(52px, 8vw, 76px)/0.95 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.size .x { color: var(--muted); font-weight: 500; margin: 0 .1em; }
.size .unit { font-size: .42em; font-weight: 600; color: var(--muted); margin-left: .18em; }
.size.pending { color: var(--muted); }
.dims { width: 100%; max-width: 330px; height: auto; }
.dims .ring { fill: var(--accent-soft); stroke: var(--ink); stroke-width: 1.5; }
.dims .grid5 { stroke: var(--accent); stroke-opacity: .35; stroke-width: .75; }
.dims .dim { stroke: var(--muted); stroke-width: 1; fill: none; }
.dims text { fill: var(--ink); font: 600 13px var(--mono); }
.basis { color: var(--ink); }
.raw { font-family: var(--mono); font-size: 13px; color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 10px; border-radius: 999px; background: var(--sunken); }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.error { color: var(--bad); font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.copied { color: var(--ok); font-size: 13px; }

.panel { padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.note { color: var(--muted); font-size: 14px; }
.tablewrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th { text-align: left; font: 600 12px/1.2 var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 4px 8px 6px 0; }
td { padding: 7px 8px 7px 0; border-top: 1px solid var(--line); vertical-align: top; }
td.num { font-family: var(--mono); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .sub { display: block; color: var(--muted); font-size: 12.5px; }
.used { font: 600 11px/1 var(--body); letter-spacing: .06em; text-transform: uppercase; padding: 3px 6px; border-radius: 4px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }
.unused { font: 600 11px/1 var(--body); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.tunnels { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; }
.tunnels li { font: 500 13px/1.2 var(--mono); padding: 6px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); }
.tunnels li small { font-family: var(--body); color: var(--muted); }
.tunnels li.hid { color: var(--muted); border-style: dashed; }

details.panel summary { cursor: pointer; list-style: none; display: flex; align-items: center; gap: 8px; }
details.panel summary::-webkit-details-marker { display: none; }
details.panel summary::after { content: "+"; font: 600 18px/1 var(--mono); color: var(--muted); margin-left: auto; }
details[open].panel summary::after { content: "−"; }
.refs { display: grid; grid-template-columns: 1fr auto; gap: 8px 12px; align-items: center; margin-top: 6px; }
.refs label { font-size: 14px; }
.refs label small { display: block; color: var(--muted); font-size: 12.5px; }
.refs input { width: 88px; font: 500 14px var(--mono); padding: 7px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-align: right; }

.hist { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.hist button { width: 100%; display: flex; gap: 10px; justify-content: space-between; align-items: baseline; text-align: left;
               font: 500 14px/1.3 var(--body); color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: 6px; padding: 7px 8px; cursor: pointer; }
.hist button:hover { background: var(--sunken); }
.hist button[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent); }
.hist .fn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.hist .rs { font: 500 13px var(--mono); color: var(--muted); white-space: nowrap; }

footer { color: var(--muted); font-size: 13px; max-width: 90ch; display: grid; gap: 4px; }
@media (prefers-reduced-motion: no-preference) { .btn, .chip, .hist button { transition: background .15s, border-color .15s, filter .15s; } }
#cursorPos { font-family: var(--mono); font-size: 12.5px; }
.rm { font: 600 13px/1 var(--body); color: var(--muted); background: none; border: 0; padding: 2px 6px; cursor: pointer; }
.rm:hover { color: var(--bad); }

/* the course drawn with the equipment; left-out finds in Positions */
.coursebox img { display: block; width: 100%; height: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
tr.off td { color: var(--muted); }
tr.off td:first-child { text-decoration: line-through; }
.panel .toggles { margin-left: 0; }
input.no { width: 4.2em; font: 500 13px/1.2 var(--mono); padding: 3px 5px; border: 1px solid var(--line); border-radius: 5px; background: transparent; color: inherit; }
.dogrow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 14px; }
.dogrow select { font: 500 14px var(--body); padding: 7px 8px; border-radius: 6px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.dogmodel summary { cursor: pointer; font-size: 14px; color: var(--accent); }
.dogmodel .refs { max-width: 620px; }
.dogmodel .refs input { width: 110px; }
.dogmodel .refs input.changed { border-color: var(--accent); background: var(--accent-soft); }
