/* Topo Trail Planner: a trail crew's planning table. Map drawn by art.js (colors from the --tt-* properties below). */
html {
  --tt-wood1: #a77b52; --tt-wood2: #85603f; --tt-wood-line: rgba(60,35,15,.18);
  --tt-paper: #f6f0de; --tt-paper-dot: #e6dcc0; --tt-sheet-edge: #c9b88f;
  --tt-b0: #b9d9a4; --tt-b1: #c8dfa4; --tt-b2: #d7e3a6; --tt-b3: #e3e1a5; --tt-b4: #e8d59c; --tt-b5: #e3c28d; --tt-b6: #d9ae7c; --tt-b7: #cd9c6f;
  --tt-floor: #9fc98d; --tt-contour: #7a4a1f; --tt-contour-i: #5a3210; --tt-clabel: #5a3412;
  --tt-tree1: #5f9b54; --tt-tree2: #2f6b3a; --tt-tree-sh: rgba(30,40,20,.22);
  --tt-creek: #2b7bbf; --tt-creek-hi: #a5d5f7;
  --tt-trail: #c8372d; --tt-cand: #4a4038; --tt-marker: #2f6b3a; --tt-halo: #f6f0de;
  --tt-ok: #137a3e; --tt-bad: #b3261e; --tt-ink: #1f2a22; --tt-text: #2b2116;
  --tt-panel1: #fbf8ef; --tt-panel2: #f1ead8; --tt-panel-line: #2f6b3a; --tt-accent: #2f6b3a; --tt-rule: rgba(47,107,58,.14);
  --tt-clip: #fffdf7; --tt-clip-metal: #9aa3a8;
}
html[data-theme="dark"] {
  --tt-wood1: #4a3627; --tt-wood2: #36271c; --tt-wood-line: rgba(0,0,0,.28);
  --tt-paper: #2a2620; --tt-paper-dot: #332e26; --tt-sheet-edge: #5a4f3c;
  --tt-b0: #2c4a2c; --tt-b1: #34502e; --tt-b2: #3e5630; --tt-b3: #4a5832; --tt-b4: #565434; --tt-b5: #5e4d33; --tt-b6: #634732; --tt-b7: #664231;
  --tt-floor: #36603a; --tt-contour: #e6b37c; --tt-contour-i: #f3cc9c; --tt-clabel: #ffe2bd;
  --tt-tree1: #4f8a46; --tt-tree2: #1f4a28; --tt-tree-sh: rgba(0,0,0,.35);
  --tt-creek: #4aa3e8; --tt-creek-hi: #c6e7ff;
  --tt-trail: #ff7a6b; --tt-cand: #d9cfc0; --tt-marker: #5fb36b; --tt-halo: #2a2620;
  --tt-ok: #5fd38f; --tt-bad: #ff8a80; --tt-ink: #eef2ea; --tt-text: #f1e8d8;
  --tt-panel1: #252a24; --tt-panel2: #1e221d; --tt-panel-line: #6fbf7c; --tt-accent: #8fd49a; --tt-rule: rgba(143,212,154,.12);
  --tt-clip: #23262a; --tt-clip-metal: #6c757b;
}

/* ── layout ── */
.tt { position: absolute; inset: 0; display: grid; grid-template-columns: 290px minmax(0, 1fr); gap: 12px; padding: 10px;
  color: var(--tlg-text); font-size: 16px; }
.tt input, .tt button { font: inherit; }
.tt-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* field notebook */
.tt-controls { display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow: auto; padding: 8px 12px 10px 16px;
  background: repeating-linear-gradient(transparent 0 27px, var(--tt-rule) 27px 28px), linear-gradient(var(--tt-panel1), var(--tt-panel2));
  color: var(--tt-ink); border: 3px solid var(--tt-panel-line); border-left-width: 9px; border-radius: 12px; box-shadow: 0 3px 8px rgba(0,0,0,.18); }
.tt-kicker { margin: 0; font-size: 16px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--tt-accent); }
.tt-step { display: grid; gap: 3px; }
.tt-step-h { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 8px; margin: 0; font-size: 17px; line-height: 1.2; }
.tt-n { flex: none; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--tt-accent); color: #fff; font-size: 16px; font-weight: 800; }
html[data-theme="dark"] .tt-n { color: #10240f; }
.tt-step.is-done .tt-n { background: var(--tt-ok); }
.tt-step.is-wrong .tt-n { background: var(--tt-bad); }
.tt-mark { font-weight: 800; font-size: 16px; white-space: nowrap; }
.tt-mark.is-ok { color: var(--tt-ok); } .tt-mark.is-bad { color: var(--tt-bad); }
.tt-note { margin: 0; font-size: 16px; opacity: .85; }

.tt-num { display: flex; align-items: center; gap: 6px; }
.tt-num input { width: 130px; font-size: 17px; min-height: 42px; padding: 5px 9px; border: 2px solid #9a8f78; border-radius: 8px; background: #fff; color: #1f2a22; }
html[data-theme="dark"] .tt-num input { background: #171a16; color: #f1f4ee; border-color: #6f7a68; }
.tt-num input:focus-visible { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 2px; }
.tt-num input:disabled { opacity: 1; }
.tt-unit { font-weight: 700; }

/* radio cards and pills */
.tt-group { margin: 0; padding: 0; border: 0; min-width: 0; display: grid; gap: 6px; }
.tt-pills { grid-template-columns: repeat(3, 1fr); }
.tt-opt { position: relative; display: flex; align-items: center; border: 2px solid #b4a88c; border-radius: 10px; background: #fffdf8; cursor: pointer; min-height: 44px; color: var(--tt-ink); }
html[data-theme="dark"] .tt-opt { background: #2c312b; border-color: #66705f; }
.tt-opt input { position: absolute; z-index: 2; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.tt-opt:has(input:checked) { border-color: var(--tt-accent); background: var(--tt-accent); color: #fff; box-shadow: inset 0 0 0 2px #fff; }
html[data-theme="dark"] .tt-opt:has(input:checked) { color: #10240f; box-shadow: inset 0 0 0 2px #10240f; }
.tt-opt:has(input:focus-visible) { outline: 3px solid var(--tlg-focus, #1a73e8); outline-offset: 2px; }
.tt-opt:hover:not(:has(input:disabled)) { border-color: var(--tt-accent); }
.tt-opt:has(input:disabled) { cursor: default; }
.tt.is-locked .tt-opt:not(:has(input:checked)) { opacity: .55; }
.tt-pill-in { display: flex; align-items: center; justify-content: center; gap: 4px; width: 100%; padding: 2px 4px; font-size: 16px; }
.tt-card-in { display: flex; align-items: center; gap: 8px; padding: 3px 8px; }
.tt-card-t { display: grid; line-height: 1.15; }
.tt-card-t b { font-size: 16px; }
.tt-card-t small { font-size: 16px; opacity: .8; }
.tt-ic { display: grid; place-items: center; flex: none; }
.tt-pills .tt-ic svg { width: 26px; height: 22px; }
.tt-routes .tt-ic svg { width: 34px; height: 36px; }
.tt-ic-bg { fill: var(--tt-b2); stroke: rgba(0,0,0,.2); }
.tt-ic-creek { stroke: var(--tt-creek); stroke-width: 3; }
.tt-ic-route { fill: none; stroke: currentColor; stroke-width: 3; stroke-linejoin: round; stroke-linecap: round; }
.tt-routes .tt-ic-route { stroke: var(--tt-trail); }
.tt-opt:has(input:checked) .tt-routes .tt-ic-route, .tt-routes .tt-opt:has(input:checked) .tt-ic-route { stroke: #c8372d; }
.tt-ic-dot { fill: #2f6b3a; }
.tt-ic-axis { fill: none; stroke: currentColor; stroke-width: 1.6; opacity: .6; }
.tt-ic-arrow { fill: currentColor; }

/* right side */
.tt-right { display: flex; flex-direction: column; gap: 7px; min-width: 0; min-height: 0; }
.tt-spec { display: flex; flex-wrap: wrap; gap: 6px; }
.tt-chip { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; padding: 3px 10px; border-radius: 12px; background: var(--tlg-surface, #fff);
  border: 2px solid var(--tlg-border, #ccd); font-size: 16px; line-height: 1.25; }
.tt-chip-k { opacity: .85; }
.tt-chip--limit { border-color: var(--tt-trail); }
.tt-chip--limit b { color: var(--tt-bad); }
html[data-theme="dark"] .tt-chip--limit b { color: var(--tt-trail); }

/* the wooden table with the map sheet and the clipboard */
.tt-table { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 316px); justify-content: center; align-items: start; gap: 10px;
  padding: 8px; border-radius: 12px;
  background: repeating-linear-gradient(92deg, transparent 0 22px, var(--tt-wood-line) 22px 23px, transparent 23px 61px), linear-gradient(170deg, var(--tt-wood1), var(--tt-wood2));
  box-shadow: inset 0 0 0 2px rgba(0,0,0,.12); overflow: hidden; }
.tt-mapbox { min-width: 0; width: 100%; max-width: max(400px, calc((100vh - 290px) * .94)); justify-self: center; filter: drop-shadow(0 4px 6px rgba(0,0,0,.3)); }
.tt-map { display: block; width: 100%; height: auto; max-height: 100%; }
.tt-clip { position: relative; min-width: 0; padding: 18px 8px 8px; background: var(--tt-clip); color: var(--tt-text); border-radius: 8px; box-shadow: 0 4px 8px rgba(0,0,0,.3); }
.tt-clip::before { content: ''; position: absolute; top: -6px; left: 50%; width: 92px; height: 18px; transform: translateX(-50%); border-radius: 5px;
  background: linear-gradient(#c3cbd0, var(--tt-clip-metal)); box-shadow: 0 2px 3px rgba(0,0,0,.35); }
.tt-clip-h { margin: 0 0 2px; font-size: 17px; }
.tt-prof { display: block; width: 100%; height: auto; }
.tt-cap { margin: 0 0 4px; font-size: 16px; line-height: 1.25; }
.tt-wps { width: 100%; border-collapse: collapse; font-size: 16px; font-variant-numeric: tabular-nums; }
.tt-wps caption { text-align: left; font-size: 16px; opacity: .85; padding: 4px 0; }
.tt-wps th, .tt-wps td { padding: 2px 4px; text-align: right; border-bottom: 1px solid rgba(127,127,127,.3); white-space: nowrap; }
.tt-wps thead th { font-size: 16px; border-bottom: 2px solid currentColor; }
.tt-wps tbody th { text-align: center; }
.tt-wps.has-grades th, .tt-wps.has-grades td { padding: 2px 2px; letter-spacing: -.01em; }
.tt-wps td.is-ok { color: var(--tt-ok); font-weight: 700; } .tt-wps td.is-bad { color: var(--tt-bad); font-weight: 800; }
.tt-readout { margin: 0; font-size: 16px; line-height: 1.3; min-height: 21px; }
.tt-about { font-size: 16px; }
.tt-about summary { cursor: pointer; font-weight: 700; min-height: 26px; display: inline-block; }
.tt-about p { margin: 6px 0 0; max-height: 150px; overflow: auto; }

/* map art */
.tt-t { font-family: var(--tlg-font, sans-serif); font-size: 17px; fill: var(--tt-text); }
.tt-t-b { font-weight: 700; }
.tt-sheet { fill: url(#tt-p-paper); stroke: var(--tt-sheet-edge); stroke-width: 2; }
.tt-b0 { fill: var(--tt-b0); } .tt-b1 { fill: var(--tt-b1); } .tt-b2 { fill: var(--tt-b2); } .tt-b3 { fill: var(--tt-b3); }
.tt-b4 { fill: var(--tt-b4); } .tt-b5 { fill: var(--tt-b5); } .tt-b6 { fill: var(--tt-b6); } .tt-b7 { fill: var(--tt-b7); }
.tt-floor { stroke: var(--tt-floor); stroke-width: 26; opacity: .55; }
.tt-tree-sh { fill: var(--tt-tree-sh); }
.tt-contour { fill: none; stroke: var(--tt-contour); stroke-width: 1.6; stroke-linejoin: round; }
.tt-contour.tt-index { stroke: var(--tt-contour-i); stroke-width: 2.8; }
.tt-clabel { fill: var(--tt-clabel); font-weight: 800; paint-order: stroke; stroke: var(--tt-halo); stroke-width: 5px; stroke-linejoin: round; }
.tt-stream { stroke: var(--tt-creek); stroke-width: 6; stroke-linecap: round; }
.tt-stream-hi { stroke: var(--tt-creek-hi); stroke-width: 1.6; opacity: .8; }
.tt-chev { fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
html[data-theme="dark"] .tt-chev { stroke: #0b2a44; }
.tt-frame { fill: none; stroke: var(--tt-contour-i); stroke-width: 2.5; }
.tt-north circle { fill: var(--tt-paper); stroke: var(--tt-contour-i); stroke-width: 2; }
.tt-north path { fill: var(--tt-trail); }
.tt-north text { font-size: 17px; }
.tt-scale path { fill: none; stroke: var(--tt-text); stroke-width: 2.5; }
.tt-model { font-style: italic; }
.tt-halo { paint-order: stroke; stroke: var(--tt-halo); stroke-width: 5px; stroke-linejoin: round; }
.tt-marker circle { fill: var(--tt-marker); stroke: #fff; stroke-width: 2.5; }
.tt-marker-l { fill: #fff; font-size: 17px; }
html[data-theme="dark"] .tt-marker-l { fill: #10240f; }
.tt-cand-l { fill: none; stroke: var(--tt-cand); stroke-width: 2.4; stroke-dasharray: 7 6; opacity: .6; stroke-linejoin: round; }
.tt-hit { fill: none; stroke: transparent; stroke-width: 22; stroke-linejoin: round; pointer-events: stroke; }
.tt:not(.is-locked) .tt-cand { cursor: pointer; }
.tt:not(.is-locked) .tt-cand:hover .tt-cand-l { opacity: 1; stroke-width: 3.4; }
.tt-cand.is-sel .tt-cand-l { opacity: 0; }
.tt-trail-case { fill: none; stroke: #fff; stroke-width: 9; stroke-linejoin: round; stroke-linecap: round; opacity: .9; }
html[data-theme="dark"] .tt-trail-case { stroke: #1a1a1a; }
.tt-trail { fill: none; stroke: var(--tt-trail); stroke-width: 4.5; stroke-dasharray: 12 5; stroke-linejoin: round; stroke-linecap: round; }
.tt.is-revealed .tt-trail, .tt.is-revealed .tt-trail-case { display: none; }
.tt-wp circle { fill: var(--tt-paper); stroke: var(--tt-trail); stroke-width: 2.5; }
.tt-wp-n { font-size: 17px; font-weight: 800; fill: var(--tt-text); }
.tt-seg { stroke-width: 6; stroke-linecap: round; }
.tt-seg.is-ok { stroke: var(--tt-ok); }
.tt-seg.is-bad { stroke: var(--tt-bad); stroke-dasharray: 4 6; stroke-width: 7; }
.tt-glabel.is-ok, .tt-ok { fill: var(--tt-ok); } .tt-glabel.is-bad, .tt-bad, .tt-warn { fill: var(--tt-bad); }
.tt-hiker-body { fill: #f39237; stroke: #5a2e0c; stroke-width: 2; }
.tt-hiker-head { fill: #f6d2b0; stroke: #5a2e0c; stroke-width: 1.5; }
.tt-hiker-legs { stroke: #5a2e0c; stroke-width: 2.4; stroke-linecap: round; }
.tt-hiker.is-done .tt-hiker-body { fill: var(--tt-ok); }
.tt-hiker.is-stuck { animation: tt-wobble .5s ease-in-out 3; }
@keyframes tt-wobble { 25% { translate: -2px 0; } 75% { translate: 2px 0; } }

/* profile */
.tt-prof .tt-t { font-size: 16.8px; }
.tt-axis { fill: none; stroke: currentColor; stroke-width: 2; }
.tt-grid { stroke: currentColor; stroke-width: 1; opacity: .18; }
.tt-prof-other { fill: none; stroke: var(--tt-cand); stroke-width: 2; stroke-dasharray: 5 5; opacity: .55; }
.tt-prof-line { fill: none; stroke: var(--tt-trail); stroke-width: 3.5; stroke-linejoin: round; }
.tt-prof-dot { fill: var(--tt-clip); stroke: var(--tt-trail); stroke-width: 2.5; }
.tt-prof .tt-seg { stroke-width: 5; }

/* briefing example */
.tt-ex-svg { display: block; width: 100%; height: auto; }
.tt-ex-axis { fill: none; stroke: var(--tlg-text, #222); stroke-width: 2; }
.tt-ex-dot { fill: var(--tlg-surface, #fff); stroke: var(--tlg-text, #222); stroke-width: 2; }
.ps-brief .tt-t { fill: var(--tlg-text, #222); font-size: 18px; }

/* narrow: stack, the page scrolls */
@media (max-width: 900px) {
  .tt { position: static; grid-template-columns: 1fr; }
  .tt-right { order: -1; }
  .tt-controls { overflow: visible; }
  .tt-table { grid-template-columns: minmax(0, 1fr); justify-items: center; }
  .tt-mapbox, .tt-clip { width: 100%; max-width: 440px; }
}
@media (prefers-reduced-motion: reduce) {
  .tt *, .tt *::before { animation: none !important; transition: none !important; }
}
.ps-brief .tt-t.tt-ok { fill: var(--tt-ok); } .ps-brief .tt-t.tt-bad { fill: var(--tt-bad); }
