/* DCA Field — DCA 화면 규격(ui.css)과 같은 글꼴 · 색 기준값. 장갑을 끼고 누르기 쉽게 단추는 44 px 이상 */
:root {
  --font: "Segoe UI Variable Text", "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  --text-1: #1B2430; --text-2: #4E5A68; --line: #D5DBE2; --bg: #F4F6F8; --panel: rgba(255, 255, 255, .94);
  --accent: #3D6288; --accent-2: #2E4E70; --ok: #3B7A57; --warn: #A86B1F; --err: #B3403A; --field: #E0322B;
  --r-1: 1px; --r-2: 2px; --r-3: 3px; --sh: 0 2px 10px rgba(20, 30, 45, .18);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text-1); font: 400 14px/1.45 var(--font); overflow: hidden; overscroll-behavior: none; touch-action: none }
button { font: 600 14px var(--font); color: var(--text-1); background: #fff; border: 1px solid var(--line); border-radius: var(--r-3); min-height: 44px; padding: 0 14px; cursor: pointer; touch-action: manipulation }
button.p { background: var(--accent); color: #fff; border-color: var(--accent) }
button:active { filter: brightness(.94) }
button:disabled { opacity: .5 }
input, textarea { font: 400 16px var(--font); color: var(--text-1); border: 1px solid var(--line); border-radius: var(--r-3); padding: 10px 12px; background: #fff; width: 100%; touch-action: manipulation }
.hide { display: none !important }

/* 로그인 · 불러오기 */
.screen { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(160deg, #E9EEF3, #D9E1EA) }
.card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: var(--r-3); padding: 24px; box-shadow: var(--sh); display: flex; flex-direction: column; gap: 14px }
.card label { display: flex; flex-direction: column; gap: 6px; font-weight: 600; font-size: 14px }
.brand { display: flex; gap: 12px; align-items: center }
.brand b { display: block; font-size: 16px; font-weight: 600 }
.brand span { display: block; font-size: 12px; color: var(--text-2) }
.msg { margin: 0; min-height: 18px; font-size: 13px; color: var(--err) }
.hint { margin: 0; font-size: 12px; color: var(--text-2) }
.bar { height: 6px; background: #E6EAEE; border-radius: var(--r-2); overflow: hidden }
.bar i { display: block; height: 100%; width: 30%; background: var(--accent); animation: slide 1.2s ease-in-out infinite }
@keyframes slide { 0% { transform: translateX(-100%) } 100% { transform: translateX(340%) } }

/* 걷기 화면 */
#ws { position: fixed; inset: 0 }
#stage { position: absolute; inset: 0; background: #C9D3DD }
#stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block }
#cv { z-index: 2; touch-action: none }
#reticle { position: absolute; left: 50%; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border: 2px solid rgba(255, 255, 255, .9); border-radius: 50%; box-shadow: 0 0 0 1px rgba(0, 0, 0, .35); pointer-events: none; z-index: 3 }
#top { position: absolute; left: 0; right: 0; top: 0; display: flex; gap: 8px; align-items: center; padding: max(10px, env(safe-area-inset-top)) 12px 0; z-index: 5; pointer-events: none }
#top > * { pointer-events: auto }
#top .sp { flex: 1 }
.pill { display: flex; gap: 8px; align-items: center; min-height: 36px; padding: 0 12px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--sh); font-size: 13px; white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis }
.pill b { font-weight: 600; overflow: hidden; text-overflow: ellipsis }
.pill span { color: var(--text-2) }
#compass svg { transition: transform .15s linear; color: var(--field) }
#conn .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok) }
#conn.off .dot { background: var(--err) }
.ib { min-width: 44px; padding: 0 10px; background: var(--panel); box-shadow: var(--sh); display: inline-flex; align-items: center; justify-content: center; gap: 6px }
.ib.on { background: var(--accent); color: #fff; border-color: var(--accent) }
.ib.big { min-width: 76px; min-height: 52px; font-size: 13px }

#joy { position: absolute; left: max(18px, env(safe-area-inset-left)); bottom: max(18px, env(safe-area-inset-bottom)); width: 150px; height: 150px; border-radius: 50%; background: rgba(255, 255, 255, .35); border: 2px solid rgba(255, 255, 255, .8); box-shadow: var(--sh); z-index: 5; touch-action: none }
#joy.act { background: rgba(255, 255, 255, .5) }
#joy .knob { position: absolute; left: 50%; top: 50%; width: 62px; height: 62px; margin: -31px 0 0 -31px; border-radius: 50%; background: rgba(61, 98, 136, .85); border: 2px solid #fff; pointer-events: none }
#rb { position: absolute; right: max(18px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); display: grid; grid-template-columns: repeat(2, auto); gap: 8px; z-index: 5 }
#chat:not(.hide) ~ #rb, body.chat-open #rb { right: calc(min(380px, 92vw) + 18px) }

#eqcard { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(18px, env(safe-area-inset-bottom)); width: min(440px, calc(100vw - 380px)); min-width: 280px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--sh); z-index: 6; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px }
.eh { display: flex; gap: 8px; align-items: baseline }
.eh b { font-size: 16px }
.eh span { color: var(--text-2); font-size: 13px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.x { min-width: 40px; min-height: 40px; padding: 0; border: none; background: transparent; font-size: 16px; color: var(--text-2) }
.eb { display: flex; gap: 8px }
.eb button { flex: 1 }

.fab { position: absolute; right: max(18px, env(safe-area-inset-right)); top: calc(max(10px, env(safe-area-inset-top)) + 52px); width: 56px; height: 56px; border-radius: 50%; padding: 0; background: var(--accent); color: #fff; border: none; box-shadow: var(--sh); z-index: 6 }
.fab i { position: absolute; right: -2px; top: -2px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--field); color: #fff; font: 600 12px/20px var(--font); font-style: normal; padding: 0 5px }
#chat { position: absolute; right: 0; top: 0; bottom: 0; width: min(380px, 92vw); background: var(--panel); border-left: 1px solid var(--line); box-shadow: var(--sh); z-index: 7; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top) }
.ch { display: flex; align-items: center; gap: 8px; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--line) }
.ch b { font-size: 16px }
.ch span { flex: 1; color: var(--text-2); font-size: 12px }
#msgs { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; touch-action: pan-y }
.m { max-width: 88%; padding: 8px 11px; border-radius: var(--r-3); font-size: 14px; white-space: pre-wrap; word-break: keep-all; overflow-wrap: anywhere }
.m.me { align-self: flex-end; background: var(--accent); color: #fff }
.m.ai { align-self: flex-start; background: #fff; border: 1px solid var(--line) }
.m.designer { align-self: flex-start; background: #FFF4E5; border: 1px solid #F0C98E }
.m.system { align-self: center; background: #EEF3EE; border: 1px solid #C9DCC9; font-size: 13px; max-width: 96% }
.m .who { display: block; font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 2px }
.m.me .who { color: rgba(255, 255, 255, .8) }
.m.pending { opacity: .6 }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; margin-top: 6px; font-size: 13px }
.kv dt { color: var(--text-2) }
.kv dd { margin: 0; font-weight: 600 }
.acts { display: flex; gap: 8px; margin-top: 8px }
.acts button { flex: 1; min-height: 40px }
.chip { display: inline-flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-2); margin-top: 4px }
#sel-chip { margin: 0 12px 6px; padding: 6px 10px; border: 1px solid #F0D27A; background: #FFF8DC; border-radius: var(--r-3); font-size: 13px; display: flex; gap: 8px; align-items: center }
#sel-chip b { font-weight: 600 }
#sel-chip button { min-height: 28px; padding: 0 8px; margin-left: auto; font-size: 12px }
.ci { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); align-items: flex-end; padding-bottom: max(8px, env(safe-area-inset-bottom)) }
.ci textarea { resize: none; max-height: 120px; min-height: 44px; flex: 1 }
#b-mic.on { background: var(--field); color: #fff; border-color: var(--field) }

.pop { position: absolute; right: 12px; top: calc(max(10px, env(safe-area-inset-top)) + 46px); width: min(340px, 92vw); background: #fff; border: 1px solid var(--line); border-radius: var(--r-3); box-shadow: var(--sh); padding: 12px; z-index: 9; display: flex; flex-direction: column; gap: 10px }
.pop .row { display: flex; gap: 10px; align-items: center; font-size: 13px }
.pop .row > span { width: 92px; color: var(--text-2) }
.pop .row b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.pop .row button { flex: 1 }
.seg { display: flex; flex: 1 }
.seg button { flex: 1; border-radius: 0; min-height: 36px; font-size: 13px; padding: 0 6px }
.seg button:first-child { border-radius: var(--r-3) 0 0 var(--r-3) }
.seg button:last-child { border-radius: 0 var(--r-3) var(--r-3) 0 }
.seg button.on { background: var(--accent); color: #fff; border-color: var(--accent) }
.pop input[type=range] { flex: 1; padding: 0 }

#mic-ov { position: absolute; inset: 0; background: rgba(20, 28, 38, .55); z-index: 20; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; color: #fff }
#mic-ov .ring { width: 96px; height: 96px; border-radius: 50%; border: 4px solid #fff; background: var(--field); animation: pulse 1.1s ease-in-out infinite }
@keyframes pulse { 50% { transform: scale(1.12); opacity: .8 } }
#mic-ov p { margin: 0; font-size: 18px; max-width: 80vw; text-align: center }
#toast { position: absolute; left: 50%; transform: translateX(-50%); top: calc(max(10px, env(safe-area-inset-top)) + 52px); background: rgba(27, 36, 48, .92); color: #fff; padding: 10px 16px; border-radius: var(--r-3); font-size: 14px; z-index: 30; max-width: 80vw; text-align: center }
#toast.bad { background: rgba(179, 64, 58, .95) }

/* DCA 3D 의 '실내 상세는 설계안' 표시(real3d interior.js) — 조이스틱과 겹치지 않게 위치 표시 밑으로 */
#interior-proposal-note { left: max(12px, env(safe-area-inset-left)) !important; bottom: auto !important; top: calc(max(10px, env(safe-area-inset-top)) + 44px) !important; opacity: .9; font-size: 12px !important }

/* 고른 전로 · 케이블 카드 */
#waycard { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(18px, env(safe-area-inset-bottom)); width: min(460px, calc(100vw - 380px)); min-width: 300px; max-height: 58vh; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid #E0A400; border-radius: var(--r-3); box-shadow: var(--sh); padding: 10px 12px; z-index: 6; display: flex; flex-direction: column; gap: 8px }
#waycard .kv { margin-top: 0 }
.fill { height: 8px; background: #E6EAEE; border-radius: var(--r-2); overflow: hidden }
.fill i { display: block; height: 100%; width: 0; background: var(--ok) }
.fill.hi i { background: var(--warn) } .fill.over i { background: var(--err) }
.clist { overflow-y: auto; min-height: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; touch-action: pan-y }
.clist button { min-height: 40px; display: grid; grid-template-columns: 8px auto 1fr auto; gap: 8px; align-items: center; text-align: left; font-weight: 400; font-size: 13px; padding: 0 10px }
.clist button i { width: 8px; height: 8px; border-radius: 50% }
.clist button b { font-weight: 600 }
.clist button span { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap }
.clist button em { font-style: normal; color: var(--text-2); font-size: 12px }
.clist .more { color: var(--text-2); font-size: 12px; padding: 4px 10px }
/* 옮기기 막대 */
#movebar { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(18px, env(safe-area-inset-bottom)); width: min(520px, calc(100vw - 380px)); min-width: 300px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid #E0A400; border-radius: var(--r-3); box-shadow: var(--sh); padding: 10px 12px; z-index: 6; display: flex; flex-direction: column; gap: 8px }
.mh { display: flex; flex-direction: column; gap: 2px }
#movebar .eb button:first-child { flex: 1.7 }
.mh b { font-size: 15px }
.mh span { color: var(--text-2); font-size: 13px }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px }
.chips button { min-height: 36px; font-size: 13px; font-weight: 400; padding: 0 10px }

@media (max-width: 760px) {
  #waycard, #movebar { width: calc(100vw - 32px); bottom: 180px }
  #eqcard { width: calc(100vw - 32px); bottom: 180px }
  .ib.big { min-width: 64px }
}
