/* /v2 신규 자리 안내 — 원본: USB "code/x2/template.html" (자리 안내판: 왼쪽 내 자리 찾기·명단, 오른쪽 큰 배치 지도) */
:root {
  --bg: #e9ece6; --panel: #f6f7f3; --ink: #1b231e; --muted: #5a665e; --line: #cdd5ca;
  --accent: #94600f; --accent-ink: #fffaf0; --ok: #2f7a4a; --bad: #b4322b; --focus: #2f6fb0;
  --m-void: #d6dbd1; --m-ground: #e1e6d9; --m-fertile: #cddfbd; --m-mount: #8d887d; --m-lake: #8db2cb; --m-node: #b4c08f; --m-struct: #7b5a8f;
  --m-foreign: #cbbcdc; --m-grid: rgba(27,35,30,.10); --m-edge: #1b231e;
  --c-hq: #b07d1a; --c-t2: #b4322b; --c-t1: #c96f1c; --c-banner: #2f5fa8; --c-city2: #2f8277; --c-city1: #8a6d2f;
  --c-res: #2d5a36; --c-spare: #7d8a80; --c-terr: #3d7fd1; --c-real: #0e8f80; --c-pick: #e0a400; --on-obj: #ffffff; --shadow: rgba(27,35,30,.18);
  --c-fflag: #8a3f9e; --c-fterr: #9b4fb0;
  --f-display: "Gowun Batang", "Nanum Myeongjo", "Batang", serif;
  --f-body: "IBM Plex Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  --r: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111513; --panel: #181d1a; --ink: #e2e7df; --muted: #97a39a; --line: #2b332e;
    --accent: #d6a24a; --accent-ink: #1a1408; --ok: #5cb87d; --bad: #e2675f; --focus: #7fb0ec;
    --m-void: #0b0e0c; --m-ground: #1c231e; --m-fertile: #223220; --m-mount: #4f4b45; --m-lake: #26465c; --m-node: #3d4830; --m-struct: #5c406d;
    --m-foreign: #352b45; --m-grid: rgba(226,231,223,.08); --m-edge: #e2e7df;
    --c-hq: #e0b04a; --c-t2: #e5574e; --c-t1: #e8913e; --c-banner: #5f95e6; --c-city2: #3aa594; --c-city1: #b8954a;
    --c-res: #4f8a5a; --c-spare: #6c776f; --c-terr: #4f8fe6; --c-real: #3fd9c4; --c-pick: #ffd24a; --on-obj: #ffffff; --shadow: rgba(0,0,0,.5);
    --c-fflag: #d08fe0; --c-fterr: #c276d4;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111513; --panel: #181d1a; --ink: #e2e7df; --muted: #97a39a; --line: #2b332e;
  --accent: #d6a24a; --accent-ink: #1a1408; --ok: #5cb87d; --bad: #e2675f; --focus: #7fb0ec;
  --m-void: #0b0e0c; --m-ground: #1c231e; --m-fertile: #223220; --m-mount: #4f4b45; --m-lake: #26465c; --m-node: #3d4830; --m-struct: #5c406d;
  --m-foreign: #352b45; --m-grid: rgba(226,231,223,.08); --m-edge: #e2e7df;
  --c-hq: #e0b04a; --c-t2: #e5574e; --c-t1: #e8913e; --c-banner: #5f95e6; --c-city2: #3aa594; --c-city1: #b8954a;
  --c-res: #4f8a5a; --c-spare: #6c776f; --c-terr: #4f8fe6; --c-real: #3fd9c4; --c-pick: #ffd24a; --on-obj: #ffffff; --shadow: rgba(0,0,0,.5);
  --c-fflag: #d08fe0; --c-fterr: #c276d4;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--f-body); font-size: 14px; line-height: 1.55; word-break: keep-all; overflow-wrap: break-word; }
.page { max-width: 1880px; margin: 0 auto; padding-block: 20px 40px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: 18px; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
h1, h2 { margin: 0; text-wrap: balance; }
h1 { font-family: var(--f-display); font-size: 1.9rem; line-height: 1.2; }
a { color: inherit; }
.top { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px 24px; border-bottom: 1px solid var(--line); padding-bottom: 14px; }
.eyebrow { margin: 0 0 4px; font-family: var(--f-mono); font-size: .75rem; letter-spacing: .12em; color: var(--accent); }
.stamp { margin: 4px 0 0; font-family: var(--f-mono); font-size: .74rem; color: var(--muted); }
.stamp:empty { display: none; }
.facts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; }
.facts div { border: 1px solid var(--line); background: var(--panel); border-radius: var(--r); padding: 6px 10px; display: flex; flex-direction: column; }
.facts dt { font-size: .72rem; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.facts dt i { width: 9px; height: 9px; border-radius: 2px; display: inline-block; }
.facts dd { margin: 0; font-family: var(--f-mono); font-weight: 600; font-size: .95rem; }
.notice { margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); color: var(--muted); }
.notice.err { color: var(--bad); border-color: var(--bad); }

.grid { display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 18px; align-items: start; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.finder label { font-family: var(--f-display); font-size: 1.15rem; }
.finder { display: flex; flex-direction: column; gap: 6px; }
input[type=search] { width: 100%; font: inherit; font-size: 1rem; padding: 9px 12px; border: 1px solid var(--line); border-radius: 4px; background: var(--bg); color: var(--ink); }
.hint { margin: 0; font-size: .76rem; color: var(--muted); }
.hint:empty { display: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.card { border: 2px solid var(--c-pick); border-radius: var(--r); padding: 10px 12px; background: var(--bg); display: flex; flex-direction: column; gap: 4px; }
.card .nm { font-weight: 600; font-size: 1.05rem; }
.card .co { font-family: var(--f-mono); font-size: 1.5rem; font-weight: 600; letter-spacing: .01em; }
.card .meta { font-size: .8rem; color: var(--muted); }
.badge { display: inline-block; font-size: .72rem; font-weight: 600; padding: 1px 8px; border-radius: 999px; border: 1px solid currentColor; }
.badge.same { color: var(--ok); } .badge.mv { color: var(--accent); } .badge.new { color: var(--focus); }

.tbl { overflow: auto; max-height: 62vh; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th { position: sticky; top: 0; z-index: 1; background: var(--panel); text-align: left; font-weight: 600; font-size: .72rem; color: var(--muted); padding: 6px; border-bottom: 1px solid var(--line); }
td { padding: 5px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td.nm { white-space: normal; min-width: 6em; }
tr.grp td { background: var(--bg); font-size: .74rem; font-weight: 600; color: var(--muted); letter-spacing: .03em; }
tr.row { cursor: pointer; }
tr.row:hover, tr.row.on { background: var(--bg); }
tr.row.on td:first-child { box-shadow: inset 3px 0 0 var(--c-pick); }
.tag { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.mvd { color: var(--accent); font-size: .72rem; }
.nw { color: var(--focus); font-size: .72rem; }
details { border-top: 1px solid var(--line); padding-top: 10px; }
summary { cursor: pointer; font-size: .85rem; font-weight: 600; }
ol.bn { margin: 8px 0 0; padding-left: 2.2em; font-family: var(--f-mono); font-size: .82rem; columns: 2; column-gap: 18px; }
.sumx { font-weight: 400; font-size: .76rem; color: var(--muted); }
#real .hint, #unplaced .hint, #excluded .hint { margin-top: 8px; }
ul.real { list-style: none; margin: 8px 0 0; padding: 0; font-size: .82rem; columns: 2; column-gap: 18px; }
ul.real li { break-inside: avoid; padding: 1px 0; }
ul.real li.grp { column-span: all; font-size: .74rem; font-weight: 600; color: var(--muted); margin-top: 6px; }
ul.real .lnk { font: inherit; background: none; border: 0; padding: 0; color: var(--c-real); font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
ol.ord { margin: 8px 0 0; padding-left: 0; list-style: none; font-size: .8rem; counter-reset: st; max-height: 50vh; overflow: auto; }
ol.ord li { padding: 2px 0; }
ol.ord li:not(.grp)::before { counter-increment: st; content: counter(st) ". "; font-family: var(--f-mono); color: var(--muted); }
ol.ord li.grp { font-size: .74rem; font-weight: 600; color: var(--muted); margin-top: 8px; }
ol.ord .lnk { font: inherit; background: none; border: 0; padding: 0; color: var(--ink); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
ol.ord .bd { color: var(--ok); } ol.ord .rm { color: var(--bad); }
ol.ord .why { color: var(--muted); font-size: .74rem; }
.btn { font: inherit; font-weight: 600; border-radius: 4px; cursor: pointer; border: 1px solid var(--line); background: var(--bg); color: var(--ink); padding: 6px 10px; font-size: .82rem; touch-action: manipulation; }
.btn:hover { border-color: var(--muted); }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.copy { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); padding: 9px 12px; font-size: .9rem; }
textarea { width: 100%; min-height: 140px; font-family: var(--f-mono); font-size: .76rem; background: var(--bg); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; }

.mapcol { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.mapbar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.mapwrap { position: relative; height: clamp(520px, calc(100vh - 110px), 1300px); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; background: var(--m-void); }
canvas { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }
canvas.drag { cursor: grabbing; }
.tip { position: absolute; left: 0; top: 0; pointer-events: none; background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: 4px; padding: 5px 9px; box-shadow: 0 3px 10px var(--shadow); font-size: .74rem; line-height: 1.4; max-width: 280px; }
.tip b { display: block; font-family: var(--f-mono); font-size: 1rem; font-weight: 600; }
/* 지도 위에 띄운 확대·축소·전체 보기 */
.zoom { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; }
.zoom .btn { width: 40px; height: 40px; padding: 0; font-size: 1.15rem; line-height: 1; background: var(--panel); box-shadow: 0 1px 4px var(--shadow); }
.zoom #fit { font-size: .72rem; }
/* 지도 위 안내 줄: 누르거나 마우스를 올린 칸 (내용이 있을 때만). 휴대폰에서 지도 아래가 화면 밖이어도 보이게 위쪽에 */
.readout { position: absolute; left: 8px; top: 8px; max-width: calc(100% - 70px); pointer-events: none; padding: 4px 9px; border: 1px solid var(--line); border-radius: 4px;
  background: color-mix(in srgb, var(--panel) 92%, transparent); box-shadow: 0 1px 4px var(--shadow); font-family: var(--f-mono); font-size: .76rem; color: var(--ink); overflow-wrap: anywhere; }
.readout:empty { display: none; }
details.legend { border-top: 0; padding-top: 0; }
.legend summary { font-size: .78rem; color: var(--muted); }
.legend .keys { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; font-size: .76rem; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend i { width: 11px; height: 11px; border-radius: 2px; display: inline-block; }
.legend i.todo { background: transparent; outline: 2px solid var(--c-banner); outline-offset: -2px; }
.legend i.spare { background: transparent; outline: 1.5px dashed var(--c-spare); outline-offset: -1.5px; }
.legend i.take { background: var(--bad); }
.legend i.terr { background: color-mix(in srgb, var(--c-terr) 25%, transparent); outline: 1.5px solid var(--c-terr); outline-offset: -1.5px; }
.legend i.line { height: 0; width: 14px; border-radius: 0; border-top: 1.5px dashed var(--c-t2); }
footer { display: flex; flex-wrap: wrap; gap: 6px 18px; border-top: 1px solid var(--line); padding-top: 12px; font-size: .8rem; }
footer a { color: var(--muted); text-underline-offset: 3px; }

/* 휴대폰: 검색 → 내 자리 카드 → 지도 → 명단 순 (패널을 풀어 각 항목을 한 줄씩).
   지도는 화면을 다 덮지 않게(위아래를 잡고 페이지를 넘길 수 있게) 낮추고, 누르기 쉬운 크기로 */
@media (max-width: 900px) {
  .page { padding-block: 12px 28px; gap: 12px; }
  .top { flex-direction: column; align-items: stretch; gap: 10px; padding-bottom: 10px; }
  .eyebrow { font-size: .68rem; margin-bottom: 2px; }
  h1 { font-size: 1.45rem; }
  /* 요약은 guide.js가 지도 아래(범례 위)로 옮김 */
  .facts { gap: 6px; }
  .facts div { flex: 1 1 auto; padding: 4px 9px; }
  .facts dd { font-size: .86rem; }
  .grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .grid > .panel { display: contents; }
  .finder { order: 1; } .card { order: 2; } .mapcol { order: 3; } .tbl { order: 4; } details { order: 5; } #copy { order: 6; } #copytext { order: 7; } .panel > .hint { order: 5; }
  .finder label { font-size: 1.05rem; }
  input[type=search] { padding: 11px 12px; }
  .card .co { font-size: 1.35rem; }
  .btn { min-height: 38px; padding: 8px 12px; }
  .mapwrap { height: 62vh; height: 62svh; min-height: 340px; max-height: 640px; }
  .tbl { max-height: 60vh; max-height: 60svh; }
  table { font-size: .88rem; }
  td { padding: 8px 6px; }
  td.mono { font-size: .8rem; }
  th { padding: 7px 6px; }
  summary { padding: 4px 0; }
  ul.real, ol.ord { font-size: .86rem; }
}
