:root {
  --bg: #07081a; --bg2: #0d0c2a; --panel: #14123a; --panel2: #1a1745; --head: #110f33; --bar: #0b0a24; --stage: #15134a;
  --text: #e4e3f5; --title: #f2f1ff; --soft: #cfcde8; --muted: #9a98bf; --faint: #6d6a96; --by: #cfe8ff;
  --accent: #8fd3ff; --accent-rgb: 143,211,255; --on-accent: #07081a; --line: rgba(var(--accent-rgb),0.18);
  --red: #e0566a; --danger: #7a2534; --danger-bg: #2a1230; --gold: #f0c36a; --warn-text: #ffd9a0;
  --ok: #6fd3a0; --bad: #ff8b9a; --whisper: #b39cff; --roll: #2a2560; --roll-line: #6b62c8; --roll-text: #fff;
  --btn-hi: #2c2468; --tok1: #3b3590; --tok2: #16133d; --tint: rgba(255,255,255,0.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: 'Gowun Batang', serif; font-size: 13px; overflow: hidden; }
button { font-family: inherit; }
.boot { display: flex; align-items: center; justify-content: center; height: 100vh; color: var(--muted); font-size: 15px; letter-spacing: 2px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.pad { padding: 10px; }
code { background: var(--tint); padding: 0 4px; border-radius: 2px; }

#app { display: flex; flex-direction: column; height: 100vh; }
.top { display: flex; align-items: center; gap: 16px; height: 40px; padding: 0 12px; background: linear-gradient(180deg, var(--bar), var(--head)); border-bottom: 1px solid var(--line); flex: none; }
.brand b { font-family: 'Nanum Brush Script', cursive; font-size: 24px; font-weight: normal; color: var(--title); text-shadow: 0 0 10px rgba(var(--accent-rgb),0.4); }
.brand span { font-size: 11px; letter-spacing: 4px; color: var(--accent); }
.status { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: 12px; }
.status .who { cursor: pointer; }
.status .who em { font-style: normal; font-size: 10px; color: var(--gold); border: 1px solid var(--gold); border-radius: 2px; padding: 0 4px; margin-left: 4px; }
.status .online i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-left: 3px; box-shadow: 0 0 6px currentColor; }
.status .api { padding: 2px 8px; border-radius: 10px; border: 1px solid var(--line); }
.status .api i { font-style: normal; }
.status .api.ok { color: var(--ok); border-color: var(--ok); }
.status .api.off { color: var(--bad); border-color: var(--bad); }
.status .mode { color: var(--gold); }

.main { flex: 1; display: flex; min-height: 0; }
.rail { width: 46px; flex: none; background: var(--bar); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 6px 0; gap: 4px; }
.tool { width: 36px; height: 36px; border-radius: 4px; border: 1px solid transparent; background: transparent; color: var(--text); font-size: 17px; cursor: pointer; }
.tool:hover { background: var(--panel2); border-color: var(--line); }
.rail-sep { width: 26px; height: 1px; background: var(--line); margin: 4px 0; }

.viewport { flex: 1; position: relative; overflow: hidden; background: radial-gradient(ellipse at 30% 20%, var(--stage) 0%, var(--bg) 70%); outline: none; touch-action: none; cursor: grab; }
.viewport:active { cursor: grabbing; }
.board { position: absolute; left: 0; top: 0; transform-origin: 0 0; box-shadow: 0 0 0 1px var(--line), 0 10px 40px rgba(0,0,0,0.6); }
.layer { position: absolute; inset: 0; }
.layer.bg { background-size: 100% 100%; background-repeat: no-repeat; }
.layer.grid { background-size: 70px 70px; pointer-events: none; }
.layer.fx { pointer-events: none; }
.lgm .tok { opacity: 0.55; }
.map-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); line-height: 1.8; }
.tok { position: absolute; cursor: pointer; user-select: none; }
.tok.is-map { cursor: default; }
.tok-img { width: 100%; height: 100%; }
.tok-img img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; display: block; }
.tok-ph { width: 100%; height: 100%; border-radius: 50%; background: radial-gradient(circle at 35% 30%, var(--tok1), var(--tok2)); border: 2px solid rgba(var(--accent-rgb),0.6); display: flex; align-items: center; justify-content: center; font-size: 20px; color: #fff; }
.tok-tint { position: absolute; inset: 0; mix-blend-mode: multiply; opacity: .5; pointer-events: none; }
.tok.sel { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 14px rgba(var(--accent-rgb),0.6); }
.tok.is-map.sel { outline-style: dashed; }
.bars { position: absolute; left: 0; right: 0; bottom: 100%; margin-bottom: 2px; display: flex; flex-direction: column; gap: 1px; pointer-events: none; }
.bar { position: relative; height: 9px; background: rgba(5,6,22,0.85); border: 1px solid rgba(255,255,255,0.25); border-radius: 2px; overflow: hidden; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; opacity: .85; }
.bar span { position: relative; display: block; text-align: center; font-size: 8px; line-height: 8px; color: #fff; text-shadow: 0 0 2px #000; font-family: sans-serif; }
.markers { position: absolute; right: -6px; top: -4px; display: flex; flex-direction: column; flex-wrap: wrap-reverse; max-height: 110%; gap: 0; pointer-events: auto; }
.mk { font-size: 13px; line-height: 15px; text-shadow: 0 0 3px #000, 0 0 2px #000; position: relative; }
.mk b { position: absolute; right: -3px; bottom: -3px; font-size: 9px; color: #fff; background: var(--red); border-radius: 6px; padding: 0 2px; line-height: 10px; font-family: sans-serif; }
.tok-dead { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 60px; color: rgba(255,60,80,0.85); text-shadow: 0 0 6px #000; pointer-events: none; line-height: 1; }
.nm { position: absolute; top: 100%; left: 50%; transform: translateX(-50%); margin-top: 2px; white-space: nowrap; padding: 1px 6px; background: rgba(7,8,26,0.85); border: 1px solid var(--line); border-radius: 8px; font-size: 11px; color: #fff; pointer-events: none; }
.gm-tag { position: absolute; left: -4px; top: -4px; font-size: 8px; background: var(--gold); color: #000; padding: 0 3px; border-radius: 2px; font-family: sans-serif; }
.ping:not(.tab):not(.mtab) { position: absolute; width: 20px; height: 20px; margin: -10px 0 0 -10px; border: 3px solid; border-radius: 50%; animation: ping 1.6s ease-out forwards; }
@keyframes ping { from { transform: scale(0.5); opacity: 1; } to { transform: scale(6); opacity: 0; } }
.target-banner { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 50; padding: 8px 14px; background: var(--danger-bg); border: 1px solid var(--red); border-radius: 4px; box-shadow: 0 6px 20px rgba(0,0,0,0.6); }
.tok-bubble { position: absolute; z-index: 40; padding: 5px 6px; background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 6px 18px rgba(0,0,0,0.5); display: flex; flex-direction: column; gap: 3px; }
.tok-bubble .bb { display: flex; align-items: center; gap: 3px; }
.tok-bubble .bb i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.tok-bubble input { width: 46px; height: 20px; padding: 0 4px; background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 2px; text-align: center; font-family: inherit; }
.tok-bubble em { color: var(--muted); font-style: normal; }
.tok-bubble small { color: var(--muted); font-size: 9px; max-width: 70px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.side { width: 400px; flex: none; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--bg2); min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.tab { flex: 1; padding: 8px 4px; background: transparent; border: none; border-bottom: 2px solid transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.tab.ping { color: var(--gold); }
.panes { flex: 1; min-height: 0; position: relative; }
.pane { position: absolute; inset: 0; display: none; overflow-y: auto; }
.pane.on { display: block; }
.pane.chat-pane.on { display: flex; flex-direction: column; overflow: hidden; }
.chat-host { flex: 1; min-height: 0; }
.chat-input { flex: none; padding: 6px; border-top: 1px solid var(--line); background: var(--bar); }
.chat-input .speak { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; font-size: 11px; color: var(--muted); }
.chat-input .speak select { flex: 1; }
.chat-input textarea { width: 100%; resize: none; }
.pane-head { display: flex; gap: 6px; align-items: center; padding: 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg2); z-index: 2; }
.pane-head .inp { flex: 1; }

.inp { background: var(--bg); border: 1px solid var(--line); color: var(--text); padding: 5px 8px; border-radius: 3px; font-family: inherit; font-size: 13px; width: 100%; }
.inp.sm { padding: 3px 6px; font-size: 12px; width: auto; }
.inp:focus { outline: none; border-color: var(--accent); }
.inp.mono, .mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
select.inp option { background: var(--bg2); }
.btn { padding: 5px 12px; background: var(--panel2); border: 1px solid rgba(var(--accent-rgb),0.35); color: var(--text); border-radius: 3px; cursor: pointer; font-size: 12px; white-space: nowrap; }
.btn:hover { border-color: var(--accent); }
.btn.sm { padding: 3px 8px; font-size: 11px; }
.btn.primary { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }
.btn.danger { background: var(--danger); border-color: var(--red); color: #fff; }
.btn:disabled { opacity: .45; cursor: default; }
.btnrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.x { background: transparent; border: none; color: var(--muted); cursor: pointer; font-size: 12px; padding: 2px 4px; }
.x:hover { color: var(--red); }

.jlist { padding: 4px 0; }
.jgroup { padding: 8px 10px 3px; font-size: 10px; letter-spacing: 2px; color: var(--accent); }
.jitem { display: flex; align-items: center; gap: 8px; padding: 6px 10px; cursor: pointer; border-bottom: 1px solid rgba(var(--accent-rgb),0.06); }
.jitem:hover { background: var(--panel); }
.jitem img, .jitem .ph { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; background: var(--panel2); display: flex; align-items: center; justify-content: center; }
.jitem .nm { flex: 1; position: static; transform: none; background: none; border: none; padding: 0; font-size: 13px; margin: 0; white-space: normal; pointer-events: auto; }
.jitem .ctl { font-size: 10px; color: var(--muted); }
.jitem.arch { opacity: .5; }

.mlist { padding: 4px 8px; }
.mitem { display: flex; align-items: center; gap: 6px; padding: 4px 0; border-bottom: 1px solid rgba(var(--accent-rgb),0.06); }
.mitem .run { max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.star { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 15px; }
.star.on { color: var(--gold); }
.macrobar { flex: none; min-height: 36px; display: flex; align-items: center; flex-wrap: wrap; gap: 5px; padding: 4px 10px 4px 56px; background: var(--bar); border-top: 1px solid var(--line); }
.mbtn { padding: 4px 12px; background: linear-gradient(180deg, var(--btn-hi), var(--panel2)); border: 1px solid var(--accent); color: var(--text); border-radius: 3px; cursor: pointer; font-family: inherit; font-size: 12px; }
.mbtn.ta { border-color: var(--gold); }
.mb-sep { font-size: 10px; color: var(--gold); margin-left: 6px; }

.gsec { padding: 10px; border-bottom: 1px solid var(--line); }
.gtitle { font-size: 11px; letter-spacing: 2px; color: var(--accent); margin-bottom: 6px; }
.prow, .pgrow, .imgrow { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.prow .nm, .pgrow .nm { flex: 1; position: static; transform: none; background: none; border: none; padding: 0; margin: 0; font-size: 13px; pointer-events: auto; white-space: normal; }
.pgrow.on .nm { color: var(--accent); }
.dot { width: 8px; height: 8px; border-radius: 50%; opacity: .35; }
.dot.on { opacity: 1; box-shadow: 0 0 6px currentColor; }
.imgrow img, .imgrow .ph { width: 48px; height: 28px; object-fit: cover; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; }
.imgrow .url { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }

.win { position: fixed; background: var(--bg2); border: 1px solid rgba(var(--accent-rgb),0.35); border-radius: 4px; box-shadow: 0 14px 40px rgba(0,0,0,0.7); display: flex; flex-direction: column; max-height: calc(100vh - 20px); min-width: 240px; resize: both; overflow: hidden; }
.win-head { display: flex; align-items: center; padding: 6px 8px 6px 12px; background: linear-gradient(180deg, var(--panel2), var(--head)); border-bottom: 1px solid var(--line); cursor: move; user-select: none; flex: none; }
.win-title { flex: 1; font-weight: 700; }
.win-x { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; }
.win-x:hover { color: var(--red); }
.win-body { flex: 1; overflow: auto; padding: 8px; min-height: 0; }
.sheet-win .win-body { padding: 0; display: flex; flex-direction: column; }
.stabs { display: flex; gap: 2px; padding: 4px 8px 0; border-bottom: 1px solid var(--line); flex: none; }
.stab { padding: 5px 12px; background: transparent; border: none; border-bottom: 2px solid transparent; color: var(--muted); cursor: pointer; }
.stab.on { color: var(--text); border-bottom-color: var(--accent); }
.spanes { flex: 1; min-height: 0; overflow: auto; }
.spane { display: none; padding: 0; }
.spane.on { display: block; }
.spane .form, .spane .btnrow { padding: 10px; }
.sheet-host { min-width: 760px; }

.turns { display: flex; flex-direction: column; gap: 2px; }
.turn { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 3px; background: var(--tint); cursor: pointer; }
.turn.now { background: rgba(var(--accent-rgb),0.16); border-left: 3px solid var(--accent); }
.turn.hid { opacity: .55; }
.turn img, .turn .ph { width: 24px; height: 24px; object-fit: contain; flex: none; text-align: center; }
.turn .nm { flex: 1; position: static; transform: none; background: none; border: none; padding: 0; margin: 0; white-space: normal; pointer-events: auto; font-size: 12px; }
.turn .pr { width: 48px; text-align: center; background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 2px; font-family: inherit; }
.turn-bar { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }

.form { display: flex; flex-direction: column; gap: 8px; }
.frow { display: flex; gap: 10px; align-items: flex-start; }
.frow > span:first-child { width: 120px; flex: none; color: var(--muted); font-size: 12px; padding-top: 5px; }
.frow > .inp, .frow > textarea, .frow > div { flex: 1; }
.inline { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.inline .inp { width: auto; flex: 1; min-width: 50px; }
.checks { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.checks label { font-size: 12px; }
.av-prev { width: 48px; height: 48px; object-fit: cover; border-radius: 4px; }
.attr-table { padding: 6px 10px; }
.arow { display: flex; gap: 4px; align-items: center; padding: 1px 0; }
.arow .an { width: 220px; flex: none; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: ui-monospace, monospace; }
.arow .inp { flex: 1; }
.arow .mx { flex: 0 0 70px; }

.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,0.55); z-index: 10000; display: flex; align-items: center; justify-content: center; }
.modal { width: min(560px, 94vw); max-height: 90vh; display: flex; flex-direction: column; background: var(--bg2); border: 1px solid rgba(var(--accent-rgb),0.4); border-radius: 5px; box-shadow: 0 20px 60px rgba(0,0,0,0.7); }
.modal-title { padding: 10px 14px; font-weight: 700; border-bottom: 1px solid var(--line); }
.modal-body { padding: 12px 14px; overflow: auto; line-height: 1.6; }
.modal-btns { display: flex; justify-content: flex-end; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--line); }
.mk-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.mk-cell { display: flex; align-items: center; gap: 6px; padding: 3px 6px; border: 1px solid transparent; border-radius: 3px; font-size: 12px; }
.mk-cell.on { border-color: var(--accent); background: rgba(var(--accent-rgb),0.08); }
.mk-ic { width: 20px; text-align: center; }
.mk-lb { flex: 1; }
.mk-num { width: 38px; background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 2px; }
.help li { margin-bottom: 6px; }

.ctx { position: fixed; z-index: 9000; min-width: 180px; background: var(--head); border: 1px solid rgba(var(--accent-rgb),0.35); border-radius: 4px; box-shadow: 0 10px 30px rgba(0,0,0,0.6); padding: 4px 0; }
.ctx-item { padding: 6px 14px; cursor: pointer; font-size: 12px; }
.ctx-item:hover { background: var(--panel2); }
.ctx-item.on::before { content: '✓ '; color: var(--accent); }
.ctx-sep { height: 1px; background: var(--line); margin: 3px 0; }

pre.log { margin: 0; white-space: pre-wrap; font-size: 11px; color: var(--soft); font-family: ui-monospace, monospace; }
#toasts { position: fixed; bottom: 50px; left: 50%; transform: translateX(-50%); z-index: 20000; display: flex; flex-direction: column; gap: 6px; align-items: center; pointer-events: none; }
.toast { padding: 8px 14px; background: var(--panel2); border: 1px solid var(--accent); border-radius: 4px; box-shadow: 0 6px 20px rgba(0,0,0,0.6); transition: opacity .4s; max-width: 80vw; }
.toast.err { border-color: var(--red); background: var(--danger-bg); }
.toast.out { opacity: 0; }
@media (max-width: 900px) { .side { width: 320px; } }

/* 로비 */
.lobby .entry-brand { margin-bottom: 6px; }
.lobby { max-width: 640px; margin: 6vh auto; padding: 24px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; max-height: 100vh; }
.lobby-brand b { font-family: 'Nanum Brush Script', cursive; font-size: 34px; font-weight: normal; color: var(--title); }
.lobby-brand span { font-size: 12px; letter-spacing: 4px; color: var(--accent); }
.lobby h2 { margin: 8px 0 0; font-weight: 700; font-size: 18px; }
.btn.big { padding: 10px 16px; font-size: 14px; }
.room-list { display: flex; flex-direction: column; gap: 6px; }
.room-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.room-row .rn { flex: 1; min-width: 200px; }
.lobby-more summary { cursor: pointer; color: var(--muted); }

.log-view { padding: 6px 8px; }
.log-msg { padding: 4px 0; border-bottom: 1px solid rgba(var(--accent-rgb),0.06); font-size: 12px; line-height: 1.5; }
.log-msg .inlinerollresult { display: inline-block; padding: 0 3px; background: var(--roll); border: 1px solid var(--roll-line); border-radius: 3px; font-weight: 700; }
.usage { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.usage > div { padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; }
.usage b { display: block; font-size: 18px; }
.meter { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--accent); }
.meter.full i { background: var(--red); }
.room-row.arch { opacity: .7; }
a.btn { text-decoration: none; display: inline-block; }

.brand-pack { font-size: 11px; letter-spacing: 0; color: var(--muted); }
.ps-badge { margin-left: 8px; font-size: 10px; padding: 1px 6px; border: 1px solid var(--gold); color: var(--gold); border-radius: 8px; }
.ps-panes .spane { padding: 10px 12px; }
.ps-sec { margin-bottom: 14px; }
.ps-packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 8px; }
.ps-pack { padding: 10px; border: 1px solid var(--line); border-radius: 4px; background: var(--panel); display: flex; flex-direction: column; gap: 6px; }
.ps-pack.on { border-color: var(--accent); }
.ps-pack-top { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.ps-tier { font-size: 10px; padding: 1px 6px; border-radius: 8px; border: 1px solid var(--line); }
.ps-tier.free { color: var(--soft); } .ps-tier.paid { color: var(--gold); border-color: var(--gold); }
.ps-sel { margin: 4px 0; } .ps-sel summary { cursor: pointer; font-size: 12px; } .ps-sel.changed summary { color: var(--gold); }
.ps-sel textarea { margin-top: 4px; }
.ps-fields { max-height: 120px; overflow: auto; padding: 6px; background: var(--bg); border-radius: 3px; word-break: break-all; }
.ps-warn { padding: 8px 10px; margin-bottom: 10px; font-size: 12px; line-height: 1.6; color: var(--warn-text); background: rgba(240,195,106,0.10); border-left: 3px solid var(--gold); }
.ps-code { height: 320px; font-size: 12px; white-space: pre; }
.ps-changed { color: var(--gold); }
details.ps-sec > summary { cursor: pointer; padding: 6px 0; }
.brand .brand-pack, .brand .ps-badge { letter-spacing: 0; }

/* 사이트 색 설정 */
.ps-swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; }
.ps-sw { display: flex; align-items: center; gap: 8px; padding: 6px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; color: var(--text); cursor: pointer; font-family: inherit; font-size: 12px; text-align: left; }
.ps-sw i { width: 30px; height: 22px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgba(128,128,128,0.4); }
.ps-sw.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ps-sw.locked { opacity: 0.5; }
.ps-colrow { margin-top: 8px; gap: 8px; }
.ps-colrow input[type=color] { width: 46px; height: 28px; padding: 1px; flex: none; }

/* 주크박스 */
.jb-head { flex-wrap: wrap; }
.jb-myvol { width: 90px; accent-color: var(--accent); }
.jb-nowbox { padding: 8px; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid var(--line); }
.jb-empty { padding: 4px 2px; }
.jb-now { padding: 7px 9px; background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 3px; }
.jb-now-top { display: flex; align-items: center; gap: 6px; }
.jb-now-top b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jb-x { margin-left: auto; }
.jb-prog { height: 4px; margin-top: 6px; background: var(--bg); border-radius: 2px; overflow: hidden; }
.jb-prog span { display: block; height: 100%; background: var(--accent); transition: width 1s linear; }
.jb-time { margin-top: 3px; }
.jb-err { color: var(--bad); margin-top: 4px; }
.jb-eq { display: inline-flex; align-items: flex-end; gap: 2px; width: 14px; height: 12px; flex: none; }
.jb-eq i { width: 3px; height: 3px; background: var(--muted); }
.jb-eq.on i { background: var(--accent); animation: jbq 0.9s ease-in-out infinite alternate; }
.jb-eq.on i:nth-child(2) { animation-delay: -0.3s; } .jb-eq.on i:nth-child(3) { animation-delay: -0.6s; }
@keyframes jbq { from { height: 2px; } to { height: 12px; } }
.jb-add { padding: 8px; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid var(--line); }
.jb-add .inline { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.jb-add .inline .inp { flex: 1; min-width: 0; }
.jb-group { display: flex; align-items: center; gap: 8px; padding: 8px 8px 4px; position: sticky; top: 0; background: var(--bg2); }
.jb-gbtn { margin-left: auto; display: flex; gap: 4px; }
.jb-track { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-bottom: 1px solid rgba(var(--accent-rgb),0.06); }
.jb-track.on { background: rgba(var(--accent-rgb),0.10); }
.jb-play { width: 30px; height: 30px; flex: none; border-radius: 50%; border: 1px solid var(--accent); background: transparent; color: var(--accent); cursor: pointer; font-size: 12px; }
.jb-track.on .jb-play { background: var(--accent); color: var(--on-accent); }
.jb-tt { flex: 1; min-width: 0; }
.jb-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jb-ic { width: 24px; height: 24px; flex: none; padding: 0; border: 1px solid transparent; border-radius: 3px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.jb-ic:hover { border-color: var(--line); color: var(--text); }
.jb-ic.on { color: var(--accent); border-color: var(--accent); }
.jb-vol { width: 56px; accent-color: var(--accent); }
.jb-stage { position: fixed; left: 54px; bottom: 44px; z-index: 900; display: none; flex-direction: column; gap: 4px; padding: 4px; background: var(--bg2); border: 1px solid var(--line); border-radius: 4px; box-shadow: 0 6px 20px rgba(0,0,0,0.5); transition: transform .2s; }
.jb-stage.on { display: flex; }
.jb-stage.mini { transform: translateX(calc(-100% + 28px)); }
.jb-stage-t { position: absolute; right: -1px; top: -1px; width: 22px; height: 22px; padding: 0; border: 1px solid var(--line); border-radius: 0 4px 0 4px; background: var(--panel2); color: var(--accent); cursor: pointer; font-size: 11px; z-index: 2; }
.jb-frame iframe { display: block; width: 200px; height: 113px; border: 0; }

/* ===================== 휴대폰 · 터치 ===================== */
#app { height: 100vh; height: 100dvh; }
.mnav { display: none; }
@media (pointer: coarse) {
  .btn { min-height: 32px; padding: 6px 12px; }
  .btn.sm { min-height: 30px; }
  .tool { width: 40px; height: 40px; }
  .ctx-item { padding: 11px 16px; font-size: 14px; }
  .jb-ic { width: 32px; height: 32px; }
  .win-x { font-size: 18px; padding: 4px 8px; }
  .inp { font-size: 16px; }   /* iOS 확대 막기 */
}
@media (max-width: 760px) {
  .top { height: 44px; gap: 8px; padding: 0 8px; }
  .brand b { font-size: 20px; }
  .brand > span:not(.brand-pack), .brand .brand-pack { display: none; }
  .status { gap: 8px; font-size: 11px; }
  .status .online, .status .mode { display: none; }
  .brand { display: flex; align-items: center; white-space: nowrap; min-width: 0; flex: 0 1 auto; overflow: hidden; }
  .brand .ps-badge { display: none; }
  .room-chip { margin-left: 6px; padding: 1px 7px; font-size: 11px; }
  .status { white-space: nowrap; flex: none; }
  .status .who em { padding: 0 3px; }
  .status .api { padding: 1px 6px; font-size: 10px; }
  .status .api .api-here { display: none; }
  .brand b { flex: none; }
  .room-chip { flex: none; }
  .rail { display: none; }
  .main { position: relative; }
  .side { position: absolute; inset: 0; width: auto; border-left: 0; z-index: 20; }
  .side > .tabs { display: none; }
  body[data-mv="map"] .side { display: none; }
  body[data-mv="pane"] .macrobar { display: none; }
  .macrobar { padding: 4px 8px; flex-wrap: nowrap; overflow-x: auto; min-height: 42px; }
  .mbtn { flex: none; padding: 7px 12px; }
  .mnav { display: flex; flex: none; height: 56px; padding-bottom: env(safe-area-inset-bottom); background: var(--bar); border-top: 1px solid var(--line); }
  .mtab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; background: transparent; border: 0; color: var(--muted); font-family: inherit; font-size: 10px; cursor: pointer; position: relative; padding: 0; }
  .mtab i { font-style: normal; font-size: 19px; line-height: 1; filter: grayscale(0.4); }
  .mtab.on { color: var(--accent); }
  .mtab.on i { filter: none; }
  .mtab.on::before { content: ''; position: absolute; top: 0; left: 25%; right: 25%; height: 2px; background: var(--accent); }
  .mtab.ping::after { content: ''; position: absolute; top: 8px; right: calc(50% - 16px); width: 7px; height: 7px; border-radius: 50%; background: var(--gold); }
  .win { left: 0 !important; top: 0 !important; width: 100vw !important; height: 100% !important; max-height: none; border-radius: 0; border: 0; resize: none; min-width: 0; }
  .win-head { padding: 8px 6px 8px 12px; cursor: default; min-height: 44px; }
  .sheet-host { min-width: 0; }
  body[data-mv="pane"] .tok-bubble { display: none; }
  .modal { width: 96vw; max-height: 86dvh; }
  .ctx { max-width: 92vw; max-height: 70dvh; overflow-y: auto; }
  .jb-stage { left: 6px; bottom: 108px; }
  .jb-frame iframe { width: 160px; height: 90px; }
  .tok-bubble input { width: 54px; height: 28px; font-size: 14px; }
  .target-banner { top: 6px; width: 92vw; text-align: center; }
  .chat-input textarea { font-size: 16px; }
  #toasts, .toasts { bottom: 112px !important; }
}

/* 방 비밀번호 */
.pw-dlg { display: flex; flex-direction: column; gap: 14px; min-width: min(420px, 86vw); }
.pw-row { display: flex; flex-direction: column; gap: 6px; }
.pw-row .inline { display: flex; gap: 6px; align-items: center; }
.pw-row .inline .inp { flex: 1; }
.pw-label { display: flex; justify-content: space-between; align-items: center; }
.pw-state { font-size: 11px; color: var(--muted); }
.pw-state.on { color: var(--gold); }
.pw-err { color: var(--bad); font-size: 12px; min-height: 1em; }

/* ===================== 첫 화면 (방 입장) ===================== */
.entry { min-height: 100%; overflow-y: auto; display: flex; flex-direction: column; align-items: center; padding: max(6vh, 28px) 16px 40px; gap: 18px;
  background: radial-gradient(ellipse at 50% -10%, rgba(var(--accent-rgb),0.10), transparent 60%), var(--bg); }
.entry-brand { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.entry-brand b { font-family: 'Nanum Brush Script', 'Noto Serif KR', serif; font-weight: normal; font-size: 58px; line-height: 1; color: var(--title); letter-spacing: 1px; white-space: nowrap; text-shadow: 0 2px 0 rgba(var(--accent-rgb),0.25); }
.entry-brand span { font-size: 13px; letter-spacing: 3px; color: var(--muted); }
.entry-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 14px; padding: 22px 20px 20px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,0.18); }
.entry-card h2 { margin: 0; font-size: 17px; font-weight: 700; color: var(--title); }
.entry-note { margin-top: -6px; font-size: 12px; color: var(--gold); }
.entry-field { display: flex; flex-direction: column; gap: 6px; }
.entry-field > span { font-size: 12px; color: var(--soft); }
.entry-field > small { font-size: 11px; color: var(--faint); line-height: 1.4; }
.entry-field.hidden { display: none; }
.entry-inp { height: 40px; padding: 0 12px; border-radius: 9px; font-size: 15px; background: var(--bg2); border: 1px solid var(--line); color: var(--text); }
.entry-inp:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),0.18); }
.entry-inp::placeholder { color: var(--faint); }
.entry-go { align-self: flex-start; height: 38px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--accent); color: var(--on-accent); font-family: inherit; font-size: 14px; font-weight: 700; cursor: pointer; transition: transform .08s, filter .15s; }
.entry-go:hover { filter: brightness(1.06); }
.entry-go:active { transform: translateY(1px); }
.entry-go:disabled { opacity: .6; cursor: default; }
.entry-msg { font-size: 12px; color: var(--muted); min-height: 1em; margin-top: -4px; }
.entry-msg.err { color: var(--bad); }
.entry-links { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: center; }
.entry-link { background: none; border: 0; padding: 4px 2px; color: var(--muted); font-family: inherit; font-size: 12px; cursor: pointer; }
.entry-link:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
.entry-links .dot { color: var(--faint); font-size: 12px; }
.entry-set { display: flex; flex-direction: column; gap: 12px; min-width: min(320px, 80vw); }
@media (max-width: 760px) { .entry-brand b { font-size: 44px; } .entry-card { padding: 18px 16px; } .entry-go { align-self: stretch; height: 44px; } }

/* 방 목록 (GM 화면) */
.entry-card.wide { width: min(640px, 100%); }
.room-cards { display: flex; flex-direction: column; gap: 10px; }
.room-card { display: flex; flex-direction: column; gap: 8px; padding: 14px; background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; }
.room-card-top { display: flex; align-items: center; gap: 8px; }
.room-card-top b { font-size: 15px; color: var(--title); }
.room-tag { font-size: 10px; padding: 1px 6px; border-radius: 8px; border: 1px solid var(--line); color: var(--muted); }
.room-card-code { display: flex; align-items: center; gap: 10px; }
.room-code { font-family: ui-monospace, 'SFMono-Regular', Menlo, monospace; font-size: 22px; letter-spacing: 4px; font-weight: 700; padding: 4px 12px; border-radius: 8px; border: 1px dashed var(--accent); background: rgba(var(--accent-rgb),0.08); color: var(--accent); cursor: pointer; }
.room-card-btns { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.room-card-btns .entry-go { height: 34px; }
.btn.danger { color: var(--bad); border-color: var(--bad); }
.room-chip { margin-left: 8px; padding: 2px 9px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--accent); font-family: ui-monospace, Menlo, monospace; font-size: 12px; letter-spacing: 1px; cursor: pointer; vertical-align: middle; }

/* 핸드아웃 */
.jg-add { float: right; margin-top: -3px; }
.ho-win .win-body { padding: 14px 16px; overflow-y: auto; }
.ho-img { display: block; max-width: 100%; margin: 0 auto 12px; border-radius: 4px; }
.ho-notes { line-height: 1.7; font-size: 14px; color: var(--text); word-break: keep-all; overflow-wrap: anywhere; }
.ho-notes img { max-width: 100%; }
.ho-notes a { color: var(--accent); }
.ho-gm { margin-top: 14px; padding: 10px; border: 1px dashed var(--gold); border-radius: 4px; font-size: 13px; }
.jb-mix.on { color: var(--accent); border-color: var(--accent); }
.jb-nowmix { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.jb-nowmix .jb-nowvol { flex: 1; width: auto; max-width: 180px; }
/* GM 아이디 */
.acc-add { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: stretch; }
.acc-add .entry-go { margin: 0; white-space: nowrap; }
.acc-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.acc-row { padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); display: flex; flex-direction: column; gap: 4px; }
.acc-row.off { opacity: .6; }
.acc-main { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.acc-id { font-size: 12px; color: var(--accent); }
.mono { font-family: ui-monospace, Menlo, monospace; letter-spacing: .5px; }
.acc-st { font-size: 11px; padding: 1px 7px; border-radius: 9px; border: 1px solid var(--ok); color: var(--ok); }
.acc-st.must { border-color: var(--gold); color: var(--gold); }
.acc-st.off { border-color: var(--bad); color: var(--bad); }
.acc-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; font-size: 13px; color: var(--soft); }
.acc-temp-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; margin: 10px 0; border: 1px dashed var(--accent); border-radius: 6px; background: var(--panel2); }
.acc-temp-box div { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.acc-temp-box b { font-size: 16px; color: var(--title); user-select: all; }
@media (max-width: 760px) { .acc-add { grid-template-columns: 1fr; } }
