:root {
  --bg: #f6f5f1; --card: #fff; --ink: #1d1d1b; --mute: #6b6a64; --line: #e3e1da;
  --accent: #d8572a; --accent-ink: #fff;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif; color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; height: 100vh; display: flex; background: var(--bg); overflow: hidden; }
h1 { font-size: 20px; margin: 0 0 4px; }
h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); margin: 0 0 8px; }
h3 { font-size: 12px; color: var(--mute); margin: 14px 0 6px; font-weight: 600; }
.note { color: var(--mute); font-size: 12.5px; margin: 6px 0; }

.side { width: 330px; flex: none; overflow-y: auto; padding: 18px; border-right: 1px solid var(--line); background: var(--card); }
.side section { margin-top: 22px; }
.row { display: flex; gap: 8px; align-items: center; margin: 8px 0; }

.sets { display: flex; flex-direction: column; gap: 2px; }
.set { text-align: left; border: 0; background: none; padding: 6px 8px; border-radius: 6px; cursor: pointer; font: inherit; display: flex; justify-content: space-between; gap: 8px; }
.set:hover { background: var(--bg); }
.set.on { background: var(--ink); color: #fff; }
.set small { color: inherit; opacity: .6; }
.set-group { font-size: 11px; color: var(--mute); margin: 8px 8px 2px; }

.btn { border: 0; background: var(--accent); color: var(--accent-ink); padding: 7px 12px; border-radius: 6px; font: inherit; font-weight: 600; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.ghost { background: none; color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; }
.btn.small { padding: 4px 9px; font-size: 12.5px; }
.btn.danger { color: #b3261e; }
.link { border: 0; background: none; color: var(--accent); cursor: pointer; font: inherit; padding: 0; font-size: 12.5px; }

.drop { display: block; border: 1.5px dashed var(--line); border-radius: 8px; padding: 22px 12px; text-align: center; cursor: pointer; color: var(--mute); }
.drop:hover, .drop.over { border-color: var(--accent); background: #fdf3ee; color: var(--ink); }
input[type=text] { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 6px; font: inherit; }
.status { margin-top: 8px; }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }

.deg-ends { display: flex; align-items: center; gap: 8px; }
.deg-end { flex: 1; }
.deg-end small { color: var(--mute); }
.pick { aspect-ratio: 1; border-radius: 8px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; display: grid; place-items: center; color: var(--mute); font-size: 12px; text-align: center; padding: 4px; }
.pick:has(img) { padding: 0; }
.pick img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slider { display: flex; flex-wrap: wrap; justify-content: space-between; margin-top: 10px; font-size: 12.5px; }
.slider input { width: 100%; accent-color: var(--accent); }

main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.map-wrap { flex: 1; position: relative; min-height: 0; }
#map { width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#map.dragging { cursor: grabbing; }
.map-head { position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; gap: 12px; padding: 10px 14px; pointer-events: none; }
.map-head > * { pointer-events: auto; }
.map-head h2 { font-size: 16px; text-transform: none; letter-spacing: 0; color: var(--ink); margin: 0; }
.spacer { flex: 1; }
.seg { display: flex; background: var(--card); border-radius: 6px; box-shadow: inset 0 0 0 1px var(--line); padding: 2px; }
.seg button { border: 0; background: none; font: inherit; font-size: 12.5px; padding: 3px 10px; border-radius: 4px; cursor: pointer; color: var(--mute); }
.seg button.on { background: var(--ink); color: #fff; }
.legend { position: absolute; left: 14px; bottom: 12px; display: flex; flex-wrap: wrap; gap: 4px; max-width: 70%; }
.legend button { border: 0; font: inherit; font-size: 12px; padding: 3px 8px; border-radius: 12px; background: rgba(255,255,255,.9); box-shadow: 0 0 0 1px var(--line); cursor: pointer; display: flex; gap: 5px; align-items: center; }
.legend button i { width: 9px; height: 9px; border-radius: 50%; }
.legend button.off { opacity: .35; }
.tip { position: absolute; pointer-events: none; display: none; background: var(--card); padding: 5px; border-radius: 6px; box-shadow: 0 4px 16px rgba(0,0,0,.18); font-size: 12px; max-width: 200px; }
.tip img { display: block; width: 180px; height: 180px; object-fit: cover; border-radius: 4px; margin-bottom: 3px; }
.overlay { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(246,245,241,.6); pointer-events: none; }
.overlay > div { width: 280px; background: var(--card); padding: 14px; border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,.12); }
.overlay p { margin: 8px 0 0; font-size: 13px; color: var(--mute); }

.chain { flex: none; display: flex; gap: 6px; padding: 12px 14px; border-top: 1px solid var(--line); background: var(--card); overflow-x: auto; align-items: flex-start; }
.chain .step { flex: none; width: 120px; animation: pop .35s both; cursor: pointer; }
.chain .step img { width: 120px; height: 120px; object-fit: cover; border-radius: 6px; display: block; }
.chain .step.end img { outline: 3px solid var(--accent); outline-offset: -3px; }
.chain .step small { display: block; color: var(--mute); font-size: 11px; margin-top: 3px; }
.chain .step span { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chain .arrow { align-self: center; color: var(--mute); margin-top: -24px; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

.panel { position: fixed; right: 14px; top: 54px; width: 280px; max-height: calc(100vh - 70px); overflow-y: auto; background: var(--card); border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.2); padding: 12px; }
.panel img#panelImg { width: 100%; border-radius: 6px; display: block; }
.panel-name { font-size: 12.5px; margin: 6px 0; word-break: break-all; }
.close { position: absolute; right: 6px; top: 2px; border: 0; background: none; font-size: 22px; cursor: pointer; color: #fff; text-shadow: 0 0 4px #000; }
.nn { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; }
.nn img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; cursor: pointer; display: block; }
