:root {
  --bg: #f4f5f7; --panel: #ffffff; --ink: #1d1f23; --muted: #6b7280; --line: #d8dbe0;
  --ok: #16a34a; --maybe: #eab308; --unsure: #9ca3af; --bad: #dc2626; --accent: #2563eb;
  /* 기존 지도 색상 에셋 */
  --free-ok: #23ce49; --free-maybe: #f1c40f;
  --t-handicap: #20BEF0; --t-ev: #AFDE28; --t-wash: #AB75F1; --t-op: #19CBA0;
  --gA: #16a34a; --gB: #65a30d; --gC: #eab308; --gD: #f97316; --gE: #dc2626; --gX: #7c3aed;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink);
  font-family: "Noto Sans KR", system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

#stage { position: fixed; inset: 0; overflow: hidden; touch-action: none; background: #e9ebee; }
#world { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#world img { display: block; user-select: none; -webkit-user-drag: none; pointer-events: none; }
#rects { position: absolute; left: 0; top: 0; }
.slot { position: absolute; width: 32px; height: 64px; border-radius: 4px; transform-origin: top left; }
.slot.handicap { width: 52px; }
/* 기존 index.php와 같은 방식: overlay로 칠해 지도의 흰 아이콘(장애인·전기차 표시 등)이 비쳐 보이게 */
.blend .slot { mix-blend-mode: overlay; }
/* 카메라 표시: 원 + 바라보는 방향 화살표 + 이름 */
.cam { position: absolute; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%;
  background: hsl(var(--hue, 210), 70%, 30%); color: #fff; display: grid; place-items: center; font-size: 26px;
  border: 4px solid #fff; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.cam > span { position: relative; z-index: 1; }
.cam-dir { position: absolute; inset: 0; pointer-events: none; }
.cam-dir i { position: absolute; left: 100%; top: 50%; margin-top: -16px; border-top: 16px solid transparent;
  border-bottom: 16px solid transparent; border-left: 34px solid hsl(var(--hue, 210), 85%, 55%); }
.cam b { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 4px; font-size: 16px;
  background: #111827; color: #fff; padding: 1px 8px; border-radius: 6px; white-space: nowrap; }
.cam.noaim, .cam.aim { animation: campulse 1s infinite alternate; }
@keyframes campulse { from { box-shadow: 0 0 0 0 rgba(245,158,11,.9); } to { box-shadow: 0 0 0 16px rgba(245,158,11,0); } }

/* 상단 바 */
.bar { position: fixed; left: 8px; right: 8px; top: 8px; z-index: 10; display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  background: var(--panel); border-radius: 12px; padding: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.12); }
.bar h1 { font-size: 15px; margin: 0 6px 0 2px; white-space: nowrap; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: 0; background: #fff; padding: 6px 10px; cursor: pointer; }
.seg button.on { background: var(--ink); color: #fff; }
.btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 10px; cursor: pointer; }
.btn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.bar input { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; width: 150px; min-width: 0; }
.meta { font-size: 12px; color: var(--muted); }
.grow { flex: 1; }

/* 범례 */
.legend { position: fixed; left: 8px; bottom: 8px; z-index: 10; background: var(--panel); border-radius: 12px; padding: 8px 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,.12); font-size: 12px; display: flex; flex-wrap: wrap; gap: 4px 12px; max-width: calc(100% - 16px); }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; vertical-align: -2px; margin-right: 4px; }

/* 정보 카드 / 하단 시트 */
.sheet { position: fixed; left: 8px; right: 8px; bottom: 8px; z-index: 20; background: var(--panel); border-radius: 16px;
  box-shadow: 0 -2px 16px rgba(0,0,0,.18); padding: 14px; display: none; max-width: 520px; margin: 0 auto; }
.sheet.show { display: block; }
.sheet h2 { margin: 0 0 4px; font-size: 18px; }
.sheet .row { font-size: 14px; margin: 3px 0; color: #374151; }
.sheet .close { position: absolute; right: 10px; top: 8px; border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); }
.chip { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; color: #fff; vertical-align: 2px; }
.answers { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 10px; }
.answers button { padding: 16px 8px; border-radius: 12px; border: 0; font-size: 17px; font-weight: 700; cursor: pointer; }
.a-occ { background: #1f2937; color: #fff; }
.a-empty { background: #e5f6ea; color: #14532d; border: 2px solid #16a34a !important; }
.a-unk { background: #f3f4f6; color: #374151; grid-column: span 2; padding: 10px !important; font-size: 14px !important; }
.sub { display: flex; gap: 8px; margin-top: 8px; }
.sub button { flex: 1; }
.toast { position: fixed; left: 50%; top: 70px; transform: translateX(-50%); z-index: 30; padding: 10px 18px; border-radius: 999px;
  color: #fff; font-weight: 700; display: none; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.panel { position: fixed; right: 8px; top: 64px; z-index: 15; background: var(--panel); border-radius: 12px; padding: 12px;
  box-shadow: 0 2px 10px rgba(0,0,0,.15); max-width: min(420px, calc(100% - 16px)); max-height: 70vh; overflow: auto; display: none; font-size: 13px; }
.panel.show { display: block; }
.panel table { border-collapse: collapse; width: 100%; }
.panel td, .panel th { border-bottom: 1px solid var(--line); padding: 4px 6px; text-align: right; }
.panel td:first-child, .panel th:first-child { text-align: left; }

@media (max-width: 640px) {
  .bar h1 { display: none; }
  .bar input { width: 110px; }
}
