/* MaXTerm 원격 조종 웹 (시안 docs/mockups/1111/G-remote.html의 휴대폰 화면) */
:root {
  --bg: #0e1016; --panel: #161925; --card: #1c2030; --field: #10121a; --line: #2a3044;
  --text: #eceef6; --muted: #8f98b0; --violet: #8b5cf6; --pink: #ec4899; --cyan: #38bdf8;
  --ok: #34d399; --warn: #fbbf24; --run: #60a5fa; --bad: #f87171;
  --mono: 'JetBrains Mono', D2Coding, Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, 'Apple SD Gothic Neo', Pretendard, 'Noto Sans KR', sans-serif; -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
#app { display: flex; flex-direction: column; max-width: 560px; height: 100dvh; margin: 0 auto; padding-top: env(safe-area-inset-top); }
svg.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.logo { font-size: 19px; font-weight: 800; letter-spacing: -0.02em; }
.logo .x { color: var(--pink); }
.logo .t { background: linear-gradient(90deg, var(--cyan), var(--violet), var(--pink)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.top { flex: none; display: flex; align-items: center; gap: 10px; padding: 18px 18px 12px; }
.top .sp { flex: 1; }
.ib { display: grid; place-items: center; width: 40px; height: 40px; margin: -8px; border: 0; border-radius: 12px; background: none; color: #c5cae0; }
.body { flex: 1; min-height: 0; overflow-y: auto; padding: 0 16px calc(16px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
h1 { margin: 4px 0 8px; font-size: 19px; }
.btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 48px; padding: 0 14px; border: 0; border-radius: 14px; background: linear-gradient(135deg, #8b5cf6, #c264ff); color: #fff; font-weight: 600; font-size: 15.5px; }
.btn.sub { min-height: 44px; border: 1px solid var(--line); background: none; color: #dfe3ee; font-weight: 500; }
.btn:disabled { opacity: 0.55; }
.btn + .btn { margin-top: 10px; }
.hint { margin: 12px 2px; color: var(--muted); font-size: 13px; line-height: 1.55; }
.hint b { color: #dfe3ee; font-weight: 600; }
.err { margin: 12px 0; padding: 10px 12px; border: 1px solid rgba(248, 113, 113, 0.4); border-radius: 12px; background: rgba(248, 113, 113, 0.08); color: #fecaca; font-size: 13.5px; }
.pill { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 0 11px; border: 0; border-radius: 99px; background: rgba(255, 255, 255, 0.07); color: #d5d9e6; font-size: 12.5px; white-space: nowrap; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.pill.on { background: rgba(139, 92, 246, 0.22); color: #fff; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.d-attention { background: var(--warn); } .d-running { background: var(--run); } .d-done { background: var(--ok); } .d-idle { background: #4b5368; }

/* 기기 등록 */
.steps { display: grid; gap: 10px; margin: 6px 0 14px; }
.stp { display: flex; gap: 11px; align-items: flex-start; font-size: 13.5px; color: #d5d9e6; }
.stp > b { flex: none; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 8px; background: rgba(139, 92, 246, 0.25); color: #d9c9ff; font: 700 12px var(--mono); }
.stp span b { color: #fff; font-weight: 600; }
.cam { position: relative; height: 252px; border-radius: 20px; background: radial-gradient(160px 120px at 30% 30%, #2a2f44, #14161f 70%); overflow: hidden; }
.cam video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cam .fr { position: absolute; inset: 42px 62px; border-radius: 18px; box-shadow: 0 0 0 999px rgba(0, 0, 0, 0.45); pointer-events: none; }
.cam .fr::before, .cam .fr::after { content: ''; position: absolute; width: 30px; height: 30px; border: 3px solid #fff; }
.cam .fr::before { left: -2px; top: -2px; border-right: 0; border-bottom: 0; border-radius: 14px 0 0 0; }
.cam .fr::after { right: -2px; bottom: -2px; border-left: 0; border-top: 0; border-radius: 0 0 14px 0; }
.cam p { position: absolute; left: 0; right: 0; bottom: 12px; margin: 0; text-align: center; color: #fff; font-size: 13px; pointer-events: none; }
.cam .btn { position: absolute; left: 50%; top: 50%; width: auto; padding: 0 20px; transform: translate(-50%, -50%); }
textarea { display: block; width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--field); color: var(--text); font: inherit; font-size: 16px; resize: none; }
.code { display: flex; justify-content: center; gap: 8px; margin: 18px 0; font: 700 34px var(--mono); letter-spacing: 2px; }
.code span { padding: 8px 16px; border-radius: 12px; background: var(--field); }

/* 잠금 · 안내 */
.lock { display: grid; justify-items: center; gap: 14px; padding: 56px 10px 0; text-align: center; }
.lock .btn { margin-top: 0; }
.face { display: grid; place-items: center; width: 92px; height: 92px; border-radius: 28px; background: rgba(139, 92, 246, 0.16); color: #c9b8ff; }
.face svg { width: 46px; height: 46px; }
.lock h1 { margin: 4px 0 0; }
.lock .hint { max-width: 280px; margin: 0; }

/* 세션 목록 */
.mac { display: flex; align-items: center; gap: 9px; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-size: 13.5px; }
.mac b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mac small { margin-left: auto; color: var(--ok); font-size: 12px; white-space: nowrap; }
.mac.off small { color: var(--warn); }
.sum { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 4px; }
.proj { display: flex; align-items: center; gap: 7px; margin: 14px 2px 6px; color: #c5cae0; font-size: 12.5px; font-weight: 600; }
.proj small { margin-left: auto; color: var(--muted); font-weight: 400; }
.ses { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; border: 0; border-radius: 14px; background: var(--card); margin-bottom: 6px; text-align: left; }
.ses .w { flex: 1; min-width: 0; }
.ses .n { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; }
.ses .n span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ses .n em { flex: none; font: 500 11px var(--mono); font-style: normal; color: var(--muted); }
.ses .s { margin-top: 2px; overflow: hidden; color: var(--muted); font-size: 12.5px; text-overflow: ellipsis; white-space: nowrap; }
.ses.attention .s { color: #fde68a; }
.ses .ch { color: #6b7488; }
.empty { margin: 40px 0; color: var(--muted); text-align: center; font-size: 13.5px; }

/* 세션 하나 */
.dh { flex: none; display: flex; align-items: center; gap: 10px; padding: 16px 16px 10px; }
.dh .w { flex: 1; min-width: 0; }
.dh b { display: block; overflow: hidden; font-size: 15.5px; text-overflow: ellipsis; white-space: nowrap; }
.dh small { color: var(--muted); font-size: 12.5px; }
.dh small.attention { color: #fde68a; }
.dh .ib svg { width: 22px; height: 22px; }
.msg { max-width: 88%; width: fit-content; margin-bottom: 9px; padding: 9px 12px; border-radius: 16px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me { margin-left: auto; background: #3b2f78; border-bottom-right-radius: 5px; }
.msg.ai { background: var(--card); border-bottom-left-radius: 5px; color: #dfe3ee; }
.ask { margin: 2px 0 10px; padding: 11px 12px; border: 1px solid rgba(251, 191, 36, 0.35); border-radius: 14px; background: rgba(251, 191, 36, 0.07); font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ask b { display: block; margin-bottom: 4px; color: #fde68a; font-size: 12.5px; }
.ask code { display: block; max-height: 240px; overflow: auto; font: 12.5px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }
.sug { display: block; width: 100%; margin-bottom: 6px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 11px; background: #1b1f2e; color: #e6e9f2; font-size: 13px; text-align: left; }
.sug.on { border-color: var(--violet); background: rgba(139, 92, 246, 0.18); }
.two { display: flex; gap: 8px; margin-bottom: 10px; }
.two .btn { margin: 0; min-height: 42px; font-size: 14px; }
.comp { flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 8px 14px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--panel); }
.comp textarea { flex: 1; min-height: 42px; max-height: 132px; padding: 9px 13px; }
.comp .go { flex: none; width: 64px; height: 42px; border: 0; border-radius: 13px; background: var(--violet); color: #fff; font-size: 14px; font-weight: 600; }
.comp .go:disabled { opacity: 0.5; }
.comp .stop { flex: none; width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 13px; background: none; color: var(--bad); }
.note { margin: 0 0 10px; color: var(--muted); font-size: 12.5px; }

/* 아래에서 올라오는 창 · 알림 */
.sheet { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; background: rgba(0, 0, 0, 0.55); }
.sheet > div { width: 100%; max-width: 560px; max-height: 86dvh; overflow-y: auto; padding: 20px 16px calc(20px + env(safe-area-inset-bottom)); border: 1px solid var(--line); border-bottom: 0; border-radius: 22px 22px 0 0; background: var(--panel); }
.sheet h2 { margin: 0 0 6px; font-size: 17px; }
.sheet .hint { margin: 0 0 14px; }
.opt { display: block; width: 100%; min-height: 46px; margin-bottom: 8px; padding: 0 13px; border: 1px solid var(--line); border-radius: 13px; background: var(--field); text-align: left; font-size: 14.5px; }
.opt.on { border-color: var(--violet); background: rgba(139, 92, 246, 0.18); }
.opt.danger { color: #fca5a5; }
.seg { display: flex; gap: 8px; margin: 4px 0 14px; }
.seg .opt { margin: 0; text-align: center; }
#toast { position: fixed; left: 50%; bottom: calc(92px + env(safe-area-inset-bottom)); z-index: 20; max-width: 86vw; padding: 10px 14px; transform: translateX(-50%); border: 1px solid var(--line); border-radius: 12px; background: #23283a; color: var(--text); font-size: 13.5px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
@media (prefers-reduced-motion: no-preference) {
  .sheet > div { animation: up 0.18s ease-out; }
  @keyframes up { from { transform: translateY(24px); opacity: 0; } }
}
