:root {
  --bg: #0d0f13;
  --panel: #151920;
  --panel2: #1b2029;
  --line: #2a313c;
  --line2: #3a4350;
  --text: #e3e7ee;
  --muted: #8e98a7;
  --accent: #d9a84a;
  --accent2: #f2c879;
  --ok: #4cc38a;
  --warn: #e3a33c;
  --bad: #e5574a;
  --blue: #5aa2f0;
  --gap: 10px;
  --side-w: 220px;
  font-family: "Malgun Gothic", "맑은 고딕", "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-size: 13px; }
button, input, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ---------------- layout: 실제 뷰포트 높이 기준, 페이지 스크롤 없음 */
.app { height: 100vh; height: 100dvh; display: grid; grid-template-rows: minmax(0, 1fr) 24px; }
.top { display: flex; align-items: center; gap: 10px; padding: 8px 12px; min-height: 56px; background: #11141a;
  border-bottom: 1px solid var(--line); flex-wrap: wrap; row-gap: 6px; }
.brand { font-weight: 700; letter-spacing: .2px; color: var(--accent2); white-space: nowrap; margin-right: 4px; }
.bar { display: flex; align-items: center; gap: 6px; flex: 1 1 auto; flex-wrap: wrap; row-gap: 6px; min-width: 0; }
.who { display: flex; align-items: center; gap: 10px; margin-left: auto; position: relative; white-space: nowrap; }
.sep { width: 1px; height: 22px; background: var(--line2); margin: 0 4px; }
.fld { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); }
.fld select, .fld input { background: var(--panel2); border: 1px solid var(--line2); border-radius: 6px; padding: 5px 6px; color: var(--text); max-width: 170px; }
.fld--build select { width: 170px; }
.main { display: grid; grid-template-columns: minmax(0, 1fr) var(--side-w); gap: var(--gap); padding: var(--gap); min-height: 0; }
.main.side-left { grid-template-columns: var(--side-w) minmax(0, 1fr); }
.main.side-left .tree { order: 2; }
.main.side-left .side { order: 1; }
.main.no-side { grid-template-columns: minmax(0, 1fr); }
.main.no-side .side { display: none; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; min-height: 0; min-width: 0; overflow: hidden; }
.foot { display: flex; gap: 0; align-items: center; padding: 0 12px; background: #0f1216; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; }
.foot span { padding: 0 12px; border-right: 1px solid var(--line); overflow: hidden; text-overflow: ellipsis; }
.foot span:first-child { padding-left: 0; }
.foot span:last-child { border-right: 0; }
.foot .ok { color: var(--ok); } .foot .warn { color: var(--warn); } .foot .bad { color: var(--bad); }

/* ---------------- buttons */
.btn { background: var(--panel2); border: 1px solid var(--line2); border-radius: 6px; padding: 5px 11px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #56606e; background: #222833; }
.btn:disabled { opacity: .45; cursor: default; }
.btn--primary { background: #6b4d17; border-color: #a47b2c; color: #fff3da; }
.btn--primary:hover { background: #7d5a1b; border-color: var(--accent); }
.btn--ghost { background: transparent; }
.btn--danger { background: #4a1e1b; border-color: #8a3a33; }
.btn[aria-pressed="true"] { background: #23384f; border-color: var(--blue); }
.ibtn { background: rgba(21,25,32,.9); border: 1px solid var(--line2); border-radius: 6px; padding: 4px 9px; cursor: pointer; min-width: 30px; }
.ibtn:hover { border-color: #56606e; }
.linkbtn { background: none; border: 0; color: var(--text); cursor: pointer; padding: 4px 2px; }
.linkbtn:hover { color: var(--accent2); }
.split { position: relative; display: inline-flex; }
.split > .btn:first-child:not(:only-of-type) { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.split__more { border-top-left-radius: 0; border-bottom-left-radius: 0; border-left: 0; padding: 5px 7px; }
.menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 50; background: #1d222b; border: 1px solid var(--line2);
  border-radius: 8px; padding: 4px; min-width: 210px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
.menu--right { left: auto; right: 0; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.menu button:hover { background: #2a313c; }
.seg { display: inline-flex; border: 1px solid var(--line2); border-radius: 7px; overflow: hidden; }
.seg button { background: var(--panel2); border: 0; padding: 5px 11px; cursor: pointer; border-right: 1px solid var(--line2); }
.seg button:last-child { border-right: 0; }
.seg button.is-on { background: #3a2b10; color: var(--accent2); }
.seg button:disabled { opacity: .4; cursor: not-allowed; }
.seg--sm button { padding: 3px 10px; }
.tree__hint { color: var(--muted); font-size: 12px; align-self: center; margin-right: 4px; white-space: nowrap; }
.tree__hint b { color: var(--text); font-weight: 600; }
.points { display: inline-flex; align-items: center; gap: 5px; background: var(--panel2); border: 1px solid var(--line2);
  border-radius: 6px; padding: 2px 8px; color: var(--muted); }
.points b { color: var(--accent2); font-size: 15px; min-width: 22px; text-align: right; }
.points.over b { color: var(--bad); }
.points input { width: 76px; background: transparent; border: 0; border-bottom: 1px dashed var(--line2); color: var(--text); padding: 3px 2px; }
.conn { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.conn i { width: 9px; height: 9px; border-radius: 50%; background: var(--warn); display: inline-block; }
.conn.ok i { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.conn.bad i { background: var(--bad); }

/* ---------------- tree */
.tree { display: grid; grid-template-rows: 38px minmax(0, 1fr); }
.tree__head { display: flex; align-items: center; justify-content: space-between; padding: 0 10px; border-bottom: 1px solid var(--line); }
.tree__head h2 { font-size: 14px; margin: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.tree__head { gap: 10px; }
.tree__tools { flex: 0 0 auto; align-items: center; }
.tree__tools .ibtn, .tree__tools .seg button { white-space: nowrap; }
@media (max-width: 1500px) { .tree__hint { display: none; } }
.hc { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 3px 0 0; vertical-align: -1px; font-style: normal; }
.hc--avail { border: 2px solid #4ade80; background: #0f2a1a; box-shadow: 0 0 5px rgba(74, 222, 128,.7); }
.hc--rel { border: 2px solid #fff; background: #2a2f37; box-shadow: 0 0 5px rgba(255,255,255,.8); }
.hc--vid { width: 13px; height: 13px; border-radius: 50%; background: #c0392b; color: #fff; font-size: 7px; line-height: 13px; text-align: center; vertical-align: 0; }
.tree__tools { display: flex; gap: 6px; }
.tree__view { position: relative; min-height: 0; overflow: hidden; background:
  radial-gradient(circle at 50% 30%, #161b23 0, #0f1217 70%); }
.tsvg { width: 100%; height: 100%; display: block; touch-action: none; user-select: none; cursor: grab; }
.tsvg.is-panning { cursor: grabbing; }
.tsvg.is-locked { cursor: default; }
.ibtn[aria-pressed="true"] { background: #3a2b10; border-color: #a47b2c; color: var(--accent2); }
.empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 15px; text-align: center; padding: 20px; }

.edge { fill: none; stroke: #39414d; stroke-width: 4; stroke-linejoin: round; stroke-linecap: round; }
.edge.is-open { stroke: #4ade80; stroke-dasharray: 10 6; }
.edge.is-on { stroke: var(--accent); }
.edge.is-dim { stroke: #2a2f37; stroke-dasharray: 8 8; }
.edge-hit { fill: none; stroke: transparent; stroke-width: 18; }
.edge.is-sel { stroke: var(--blue); stroke-width: 6; }

.node { cursor: pointer; }
.node .nf { fill: #13161b; stroke: #353b45; stroke-width: 3; }
.node .nf2 { fill: none; stroke: #353b45; stroke-width: 1.5; opacity: .7; }
.node image { opacity: .22; pointer-events: none; }
/* 습득 가능: 녹색 테두리 + 은은한 빛 (습득=금색, 선행·후속=흰색, 선택=파랑과 구분) */
.node.is-available .nf { fill: #0f2a1a; stroke: #4ade80; stroke-width: 3.5; filter: drop-shadow(0 0 6px rgba(74, 222, 128, .55)); }
.node.is-available .nf2 { stroke: #4ade80; opacity: .9; }
.node.is-available image { opacity: 1; }
.node.is-learned .nf { fill: #4f3610; stroke: var(--accent2); }
.node.is-learned .nf2 { stroke: var(--accent); }
.node.is-learned image { opacity: 1; }
.node.is-default .nf { fill: #3a3f48; stroke: #e9edf2; }
.node.is-default .nf2 { stroke: #c9cfd8; }
.node.is-excluded .nf { stroke: #7c3a34; stroke-dasharray: 6 5; }
.node.is-excluded image { opacity: .18; }
.node.is-invalid .nf { stroke: var(--bad); }
.node:hover .nf { filter: brightness(1.25); }
.node .ring { fill: none; stroke: transparent; stroke-width: 4; }
/* 선택: 굵은 파란 테두리 + 은은한 파란 빛 + 모서리 꺾쇠 (깜빡임 없음 — 흰 빛의 선행/후속과 구분) */
.node.is-focus .ring { stroke: #5aa2f0; stroke-width: 7; filter: drop-shadow(0 0 8px rgba(90, 162, 240, .85)); }
.selc { fill: none; stroke: #8cc4ff; stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; display: none; pointer-events: none; }
.node.is-focus .selc { display: inline; filter: drop-shadow(0 0 4px rgba(90, 162, 240, .9)); }
.tip-novid { margin: -8px -11px 8px; padding: 9px 11px; background: #2a1414; color: #ffb4ad; font-size: 11.5px; border-radius: 6px 6px 0 0; }
.node.is-flash .ring { stroke: #fff; animation: flash 1.2s ease-out 2; }
@keyframes flash { 0% { stroke-opacity: 1; stroke-width: 10; } 100% { stroke-opacity: 0; stroke-width: 2; } }
/* 선택 노드의 선행·후속: 흰색으로 빛남 (녹색 = 습득 가능과 구분) */
.node.is-rel .ring { stroke: #ffffff; stroke-width: 5; animation: relGlow 1.4s ease-in-out infinite; }
.node.is-rel .nf { stroke: #ffffff; }
.edge.is-rel { stroke: #ffffff; stroke-width: 6; stroke-dasharray: none; animation: relEdge 1.4s ease-in-out infinite; }
@keyframes relGlow { 0%, 100% { stroke-opacity: .35; filter: drop-shadow(0 0 2px #fff); } 50% { stroke-opacity: 1; filter: drop-shadow(0 0 10px #fff); } }
@keyframes relEdge { 0%, 100% { stroke-opacity: .5; filter: drop-shadow(0 0 1px #fff); } 50% { stroke-opacity: 1; filter: drop-shadow(0 0 6px #fff); } }
.nbadge--rel { display: none; }
.node.is-rel .nbadge--rel { display: inline; }
.nrel { fill: #f4f6f9; stroke: #fff; filter: drop-shadow(0 0 4px rgba(255,255,255,.8)); }
.nrel-t { fill: #11141a; font-size: 10.5px; font-weight: 800; text-anchor: middle; dominant-baseline: central; }
/* 목록에서 누른 노드: 더 강하게 */
.node.is-ping .ring { stroke: #ffffff; animation: ping .6s ease-out 4; }
@keyframes ping { 0% { stroke-width: 16; stroke-opacity: 1; filter: drop-shadow(0 0 16px #fff); } 100% { stroke-width: 4; stroke-opacity: .3; } }
.node .cost { fill: #0d0f13; stroke: #a47b2c; stroke-width: 1.5; }
.node .costt { fill: var(--accent2); font-size: 16px; font-weight: 700; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.node.is-learned .cost { fill: #6b4d17; }
.node .lockby { fill: var(--blue); font-size: 15px; text-anchor: middle; pointer-events: none; }
.node.is-locked-other .nf { stroke: var(--blue); stroke-dasharray: 4 4; }
.node.is-pending .nf { stroke-dasharray: 3 4; }
/* 노드 배지: 유형(아래) · 영상(왼쪽 위) */
.nbadge { pointer-events: none; }
.ntype { stroke-width: 1; }
.ntype--active { fill: #4a2c10; stroke: #d98a3a; }
.ntype--passive { fill: #16304d; stroke: #5aa2f0; }
.ntype--stats { fill: #183d2c; stroke: #4cc38a; }
.ntype-t { fill: #f1f4f8; font-size: 10.5px; font-weight: 700; text-anchor: middle; dominant-baseline: central; }
/* 습득 상태 표시: 습득=금색 / 미습득=회색 / 지금 습득 가능=녹색 글자 */
.nst { fill: #1d2129; stroke: #4a525e; stroke-width: 1; }
.nst-t { fill: #8e98a7; font-size: 10.5px; font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.node.is-learned .nst { fill: #5a3d0e; stroke: #f2c879; }
.node.is-learned .nst-t { fill: #ffe7b0; }
.node.is-available .nst { fill: #0f2a1a; stroke: #4ade80; }
.node.is-default .nst { fill: #3a3f48; stroke: #e9edf2; }
.node.is-default .nst-t { fill: #fff; }
.node.is-available .nst-t { fill: #b6f5c9; }
.nvid { fill: #c0392b; stroke: #ffd2cc; stroke-width: 1.2; }
.nvid-i { fill: #fff; }
.nbadge--vid { pointer-events: auto; }
.app.is-edit .pending-box { fill: rgba(227,163,60,.05); stroke: var(--warn); stroke-dasharray: 10 8; stroke-width: 2; }
.pending-label { fill: var(--warn); font-size: 22px; }
.ghost { fill: none; stroke: #6fb1ff; stroke-dasharray: 6 6; stroke-width: 2; opacity: .8; pointer-events: none; }
.ghost-line { stroke: #6fb1ff; stroke-width: 1.5; stroke-dasharray: 3 5; opacity: .7; pointer-events: none; }
.wp { fill: #0d0f13; stroke: var(--blue); stroke-width: 3; cursor: move; }
.wp:hover { fill: var(--blue); }

.tip { position: absolute; pointer-events: none; background: rgba(12,14,18,.96); border: 1px solid var(--line2); border-radius: 6px;
  padding: 8px 11px; max-width: 380px; font-size: 12px; z-index: 5; box-shadow: 0 8px 24px rgba(0,0,0,.5); }
.tip b { display: block; color: var(--accent2); margin-bottom: 2px; font-size: 13px; }
.tip-meta { color: var(--muted); font-size: 11.5px; }
.tip { width: 380px; max-height: calc(100% - 12px); overflow: hidden; }
.tip-video { margin: -8px -11px 8px; aspect-ratio: 16 / 9; background: #000; display: grid; place-items: center; color: var(--muted); font-size: 11.5px; border-radius: 6px 6px 0 0; overflow: hidden; }
.tip-video video { width: 100%; height: 100%; object-fit: contain; display: block; }
.tip-head { display: flex; gap: 8px; align-items: center; }
.tip-head img { width: 34px; height: 34px; background: #2a2f37; border-radius: 5px; padding: 3px; flex: 0 0 auto; }
.tip-head b { margin: 0; }
.tip-stage { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.tip-stage .tag { font-size: 11px; padding: 0 6px; }
.tip-hint { color: var(--accent2); margin-left: 4px; }
.tip-sec { margin-top: 7px; padding-top: 6px; border-top: 1px solid var(--line); }
.tip-sec h5 { margin: 0 0 3px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.tip-eff, .tip-links { list-style: none; margin: 0; padding: 0; font-size: 12px; line-height: 1.5; }
.tip-eff b { color: #ffd27a; font-weight: 600; }
.tip-links li { display: flex; justify-content: space-between; gap: 8px; }
.tip-links .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tip-links .tag { font-size: 10.5px; padding: 0 6px; flex: 0 0 auto; }
.tip-desc { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); line-height: 1.55; font-size: 12.5px; color: var(--text); }
.tip-desc .st { display: inline-flex; align-items: center; gap: 2px; color: #ffd27a; font-weight: 700; white-space: nowrap; }
.tip-desc .st img { width: 14px; height: 14px; }
.tip-desc .ref { color: #8fc1ff; }
.tip-none { color: var(--muted); }
.tip-en { margin-top: 6px; font-size: 12.5px; line-height: 1.55; color: #c9d1dc; }
.tip-alt { margin-top: 6px; font-size: 12.5px; line-height: 1.55; color: #c9d1dc; }
.tip-alt .st { display: inline-flex; align-items: center; gap: 2px; color: #ffd27a; font-weight: 700; white-space: nowrap; }
.tip-alt .st img { width: 14px; height: 14px; }
.tip-lab { display: inline-block; font-size: 10px; padding: 0 5px; border: 1px solid var(--line2); border-radius: 6px; color: var(--muted); margin-right: 3px; vertical-align: 1px; }
.tip-lab--tr { color: #b6f5c9; border-color: #2b7a4b; }
.tip-en .st { display: inline-flex; align-items: center; gap: 2px; color: #ffd27a; font-weight: 700; white-space: nowrap; }
.tip-en .st img { width: 14px; height: 14px; }
.tip-en .ref, .tip-alt .ref { color: #8fc1ff; font-weight: 600; }
.tip-en > span:first-child { display: inline-block; font-size: 10px; padding: 0 5px; border: 1px solid var(--line2); border-radius: 6px; color: var(--muted); margin-right: 3px; }
.tip-combo { margin-top: 5px; color: var(--muted); font-size: 11.5px; }
.tip .kbd { display: inline-block; border: 1px solid var(--line2); border-radius: 4px; padding: 0 4px; background: #222833; font-size: 11px; color: var(--text); }
/* 팝업 큰 글자 (읽기 쉽게) */
.tip { width: 820px; max-width: calc(100% - 12px); padding: 12px 14px; font-size: 14px; }
.tip-cols { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 16px; }
.tip-l { min-width: 0; }
.tip-r { min-width: 0; border-left: 1px solid var(--line); padding-left: 16px; }
.tip-r > .tip-desc:first-child, .tip-r > .tip-alt:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.tip-video, .tip-novid { margin: 0 0 10px; border-radius: 6px; }
.tip-novid--none { background: #1a1e25; color: var(--muted); text-align: center; }
.tip-hint { margin: 4px 0 0; }
.tip b { font-size: 16px; }
.tip-head img { width: 40px; height: 40px; }
.tip-meta { font-size: 13px; }
.tip-stage { font-size: 13px; margin-top: 8px; }
.tip-stage .tag { font-size: 12.5px; padding: 1px 7px; }
.tip-desc { font-size: 15px; line-height: 1.6; margin-top: 8px; padding-top: 8px; }
.tip-alt { font-size: 14px; line-height: 1.6; margin-top: 8px; color: #d3dae4; }
.tip-en { font-size: 13.5px; line-height: 1.55; margin-top: 8px; color: #c2cad6; }
.tip-desc .st img, .tip-alt .st img, .tip-en .st img { width: 16px; height: 16px; }
.tip-lab { font-size: 11.5px; padding: 1px 6px; }
.tip-combo { font-size: 13px; margin-top: 7px; }
.tip .kbd { font-size: 12.5px; padding: 0 5px; }
.tip-sec { margin-top: 9px; padding-top: 8px; }
.tip-sec h5 { font-size: 13px; margin-bottom: 4px; }
.tip-eff, .tip-links { font-size: 13.5px; line-height: 1.6; }
.tip-links .tag { font-size: 12px; }
/* 원문: 기본 접힘, 트리 도구줄 [원문 보기]로 펼침 */
.tip .tip-en { display: none; }
body.show-orig .tip .tip-en { display: block; }
.toast { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: rgba(20,24,31,.97); border: 1px solid var(--line2);
  border-radius: 8px; padding: 8px 14px; z-index: 6; max-width: 80%; text-align: center; }
.toast.bad { border-color: var(--bad); }
/* 마우스 옆 말풍선 */
.cbubble { position: absolute; z-index: 8; pointer-events: none; max-width: 360px; padding: 7px 11px; border-radius: 8px;
  background: rgba(20, 24, 31, .97); border: 1px solid var(--line2); color: var(--text); font-size: 13.5px; line-height: 1.45;
  box-shadow: 0 6px 18px rgba(0, 0, 0, .55); }
.cbubble.bad { border-color: #e5574a; color: #ffd9d4; }
.cbubble.is-in { animation: bubbleIn .16s ease-out; }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
/* 습득 불가 노드 흔들림 (노드 그룹의 위치 변환은 건드리지 않고 모양만) */
.node.is-shake .nf, .node.is-shake .nf2, .node.is-shake image, .node.is-shake .ring { animation: nodeShake .42s ease-in-out; }
@keyframes nodeShake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }

/* ---------------- side / detail */
.side { position: relative; display: flex; flex-direction: column; overflow: visible; }
/* 우측 창 상단 메뉴 (예전 상단 메뉴 줄) — 세로 배치 */
.side > .top { flex: 0 0 auto; display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 10px; min-height: 0;
  border-bottom: 1px solid var(--line); border-radius: 10px 10px 0 0; flex-wrap: nowrap; }
.side > .top .brand { order: 0; margin: 0; }
.side > .top .who { order: 1; margin: 0; justify-content: space-between; flex-wrap: wrap; row-gap: 4px; }
.side > .top .bar { order: 2; display: grid; grid-template-columns: 1fr; gap: 6px; align-items: stretch; }
.side > .top .bar[hidden] { display: none !important; }
.side > .top .sep { display: none; }
.side > .top .fld, .side > .top .points, .side > .top .seg { grid-column: 1 / -1; }
.side > .top .fld { display: grid; grid-template-columns: 1fr; gap: 3px; font-size: 12px; }
.side > .top .fld select, .side > .top .fld--build select { width: 100%; max-width: none; }
.side > .top .points { justify-content: flex-start; padding: 4px 8px; }
.side > .top .points input { flex: 1; width: auto; }
.side > .top .btn { width: 100%; }
.side > .top .split { width: 100%; }
.side > .top .split > .btn:first-child { flex: 1; }
.side > .top .split__more { width: auto; flex: 0 0 auto; }
.side > .top .seg { display: grid; grid-template-columns: 1fr; }
.side > .top .seg button { border-right: 0; border-bottom: 1px solid var(--line2); }
.side > .top .seg button:last-child { border-bottom: 0; }
.side > .top .menu { left: auto; right: 0; }
.side > .editside { flex: 1 1 auto; min-height: 0; }
/* 내 빌드 요약 카드 */
.sumcard { display: block; width: 100%; text-align: left; margin: 0; padding: 10px; border: 0; border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #1b2029, #161a21); border-radius: 0 0 10px 10px; cursor: pointer; font-size: 12.5px; }
.sumcard:hover { background: linear-gradient(180deg, #232a35, #1b2029); }
.app.is-edit .sumcard { display: none; }
.sum-h { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sum-h b { color: var(--accent2); font-size: 13.5px; }
.sum-h span { color: var(--muted); font-size: 11.5px; }
.sum-total { margin-bottom: 6px; }
.sum-total b { color: var(--accent2); }
.sum-row { display: flex; justify-content: space-between; gap: 10px; color: var(--muted); padding: 2px 0; }
.sum-empty { color: var(--muted); margin-top: 4px; }
/* 요약 창 */
.dlg--sum { width: min(980px, 96vw); max-height: 90vh; }
.dlg--sum .dlg__body { overflow-y: auto; }
.sum-w { margin-bottom: 18px; }
.sum-w h4 { margin: 6px 0 8px; color: var(--accent2); font-size: 15px; }
.sum-w h4 small { color: var(--muted); font-weight: 400; font-size: 12.5px; }
/* 배운 정보: 액티브 + 연계 패시브 연속 텍스트 */
.lr-a { padding: 4px 2px; }
.lr-a h4 { margin: 4px 0 8px; font-size: 17px; color: var(--accent2); }
.lr-a h4 small { color: var(--muted); font-weight: 400; font-size: 12.5px; margin-left: 6px; }
.lr-a--rest h4 { color: var(--muted); font-size: 15px; }
.lr-vid { cursor: help; border-bottom: 1px dashed currentColor; }
.lr-vid::after { content: " ▶"; font-size: .72em; color: #8fc1ff; vertical-align: 1px; }
.lr-vid:hover { color: #fff; }
.lr-vbox { position: fixed; z-index: 20; width: 480px; aspect-ratio: 16 / 9; background: #000; border: 1px solid var(--line2); border-radius: 8px;
  overflow: hidden; display: grid; place-items: center; color: var(--muted); font-size: 12px; pointer-events: none; box-shadow: 0 12px 30px rgba(0,0,0,.6); }
.lr-vbox[hidden] { display: none; }
.lr-vbox video { width: 100%; height: 100%; object-fit: contain; display: block; grid-area: 1 / 1; }
.lr-vbox span { grid-area: 1 / 1; }
.lr-d { font-size: 15px; line-height: 1.7; color: var(--text); white-space: pre-line; }
.lr-d .st { color: #ffd27a; font-weight: 700; white-space: nowrap; }
.lr-d .st img { width: 16px; height: 16px; vertical-align: -3px; }
.lr-d .ref { color: #8fc1ff; font-weight: 600; }
.lr-p { margin: 12px 0 0 14px; padding-left: 12px; border-left: 2px solid #7a5a22; }
.lr-pn { color: #e9c27a; font-size: 14px; margin-bottom: 2px; }
.lr-pn b { color: #ffd27a; }
.lr-tabs { margin: 0 16px; }
.lr-badge { display: inline-block; margin-left: 8px; padding: 0 7px; border: 1px solid #7a5a22; border-radius: 9px; font-size: 12px; font-weight: 600;
  color: #ffd27a; vertical-align: 2px; }
.lr-tabs button { font-size: 14.5px; font-weight: 600; }
.lr-none { margin: 8px 0 0 14px; color: var(--muted); font-size: 13.5px; }
.lr-tag { display: inline-block; font-size: 11.5px; padding: 0 6px; border: 1px solid var(--line2); border-radius: 6px; color: var(--muted); margin-right: 2px; vertical-align: 2px; font-weight: 400; }
.lr-tag--ai { border-color: #2b7a4b; color: #b6f5c9; }
.lr-alt { margin: 4px 0 0; font-size: 13.5px; color: #b9c2ce; }
.lr-alt summary { cursor: pointer; color: var(--muted); font-size: 12.5px; width: max-content; }
.lr-alt summary:hover { color: var(--text); }
.lr-alt-r { margin: 4px 0 0 4px; line-height: 1.6; }
.lr-alt-r .st { color: #ffd27a; font-weight: 600; }
.lr-alt-r .st img { width: 14px; height: 14px; vertical-align: -2px; }
.lr-alt-r .ref { color: #8fc1ff; }
.lr-sep { border: 0; border-top: 1px solid var(--line2); margin: 16px 0; }
/* 일반 모드: 우측 창은 메뉴만 — 너비는 가장 긴 글자에 맞춤(최대 320px), 높이는 메뉴만큼 (상세는 노드 팝업) */
.app:not(.is-edit) .main { grid-template-columns: minmax(0, 1fr) auto; }
.app:not(.is-edit) .main.side-left { grid-template-columns: auto minmax(0, 1fr); }
.app:not(.is-edit) .side { align-self: start; width: max-content; min-width: 170px; max-width: 320px; }
.app:not(.is-edit) .side .fld select { max-width: 296px; }
.detail { display: flex; flex-direction: column; min-height: 0; height: 100%; }
.video { position: relative; background: #000; aspect-ratio: 16 / 9; flex: 0 0 auto; border-bottom: 1px solid var(--line); }
.video video { width: 100%; height: 100%; object-fit: contain; display: block; background: #000; }
.video__none { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); background: #0b0d10; }
.detail__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 12px 14px; }
.d-empty { color: var(--muted); padding: 20px 4px; line-height: 1.6; }
.d-title { display: flex; gap: 10px; align-items: center; margin-bottom: 8px; }
.d-title img { width: 44px; height: 44px; background: #2a2f37; border-radius: 6px; padding: 4px; flex: 0 0 auto; }
.d-title h3 { margin: 0 0 3px; font-size: 17px; color: var(--accent2); }
.d-meta { color: var(--muted); font-size: 12px; }
.d-sec { border-top: 1px solid var(--line); padding: 9px 0 6px; }
.d-sec h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 600; }
.d-sec h4 small { font-weight: 400; margin-left: 6px; }
.d-desc { line-height: 1.65; }
.d-desc .st { display: inline-flex; align-items: center; gap: 3px; color: #ffd27a; white-space: nowrap; }
.d-desc .st img { width: 16px; height: 16px; }
.d-desc .ref { color: #8fc1ff; cursor: pointer; text-decoration: underline dotted; }
.d-desc .kbd, .d-combo .kbd { display: inline-block; border: 1px solid var(--line2); border-radius: 4px; padding: 0 5px; background: #222833; font-size: 12px; }
.d-combo { margin-top: 6px; color: var(--muted); font-size: 12px; }
.d-eff { list-style: none; margin: 0; padding: 0; }
.d-eff li { display: flex; gap: 8px; padding: 4px 0; }
.d-eff img { width: 22px; height: 22px; flex: 0 0 auto; }
.d-eff b { color: #ffd27a; font-weight: 600; }
.d-eff span { color: var(--muted); font-size: 12px; }
.d-stage { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px; border: 1px solid var(--line2); background: var(--panel2); font-size: 12px; }
.tag--ok { color: var(--ok); border-color: #2b6b4d; }
.tag--avail { color: #4ade80; border-color: #2b7a4b; }
.tag--warn { color: var(--warn); border-color: #7a5a22; }
.tag--bad { color: var(--bad); border-color: #7a2e27; }
.tag--gold { color: var(--accent2); border-color: #7a5a22; }
.d-excl { margin-top: 8px; font-size: 12px; color: var(--muted); }
.d-excl button { margin: 4px 4px 0 0; }
.links { list-style: none; margin: 0; padding: 0; }
.links li { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.links li:hover { background: #222833; }
.links li img { width: 26px; height: 26px; background: #2a2f37; border-radius: 4px; padding: 2px; }
.links li .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.links .none { color: var(--muted); cursor: default; }
.links .none:hover { background: none; }
.d-actions { display: flex; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.d-actions .btn { flex: 1; }

/* ---------------- edit side */
.editside { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: 10px; gap: 10px; }
.wgt { border: 1px dashed var(--blue); border-radius: 8px; overflow: hidden; flex: 0 0 auto; }
.wgt__handle { background: #1d2a3a; padding: 6px 10px; cursor: grab; color: #bcd7ff; user-select: none; }
.wgt__video { aspect-ratio: 16/9; background: #000; display: grid; place-items: center; color: var(--muted); max-height: 150px; }
.wgt__info { padding: 6px 10px; color: var(--muted); font-size: 12px; }
.es-sec h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); }
.es-sec--grow { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.es-node { background: var(--panel2); border-radius: 8px; padding: 8px 10px; line-height: 1.6; font-size: 12px; }
.es-node .btn { margin-top: 6px; padding: 3px 8px; font-size: 12px; }
.review { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 0; }
.review li { display: flex; gap: 6px; align-items: center; padding: 5px 6px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 12px; }
.review li:hover { background: #222833; }
.review li .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.review li .btn { padding: 2px 7px; font-size: 11px; }
.es-help { color: var(--muted); font-size: 12px; line-height: 1.5; border-top: 1px solid var(--line); padding-top: 8px; }
.side__resize { position: absolute; top: 0; bottom: 0; left: -7px; width: 10px; cursor: ew-resize; z-index: 4; }
.side__resize::after { content: ""; position: absolute; top: 45%; left: 3px; width: 4px; height: 50px; border-radius: 2px; background: var(--blue); }
.main.side-left .side__resize { left: auto; right: -7px; }
.app.is-edit .top { background: #101722; }
.app.is-edit .brand::after { content: " · 배치 편집"; color: var(--blue); }

/* ---------------- dialogs */
.dlg { background: var(--panel); color: var(--text); border: 1px solid var(--line2); border-radius: 12px; padding: 0; width: min(520px, 94vw);
  max-height: 86vh; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.dlg[open] { display: flex; flex-direction: column; }
.dlg form { display: flex; flex-direction: column; min-height: 0; }
.dlg--wide { width: min(1100px, 94vw); }
.dlg::backdrop { background: rgba(0,0,0,.55); }
.dlg header, .dlg footer { display: flex; align-items: center; gap: 8px; padding: 11px 16px; }
.dlg header { border-bottom: 1px solid var(--line); justify-content: space-between; }
.dlg header h3 { margin: 0; font-size: 15px; }
.dlg footer { border-top: 1px solid var(--line); }
.dlg .x { background: none; border: 1px solid var(--line2); border-radius: 6px; padding: 3px 9px; cursor: pointer; }
.dlg__body { padding: 12px 16px; overflow: auto; min-height: 0; flex: 1 1 auto; }
.dlg__body--table { padding-top: 0; min-height: 200px; }
.dlg__filters { display: flex; gap: 8px; padding: 10px 16px; flex-wrap: wrap; }
.dlg__filters input, .dlg__filters select, .lbl input { background: var(--panel2); border: 1px solid var(--line2); border-radius: 6px; padding: 6px 8px; }
.dlg__filters input { flex: 1 1 220px; }
.grow { flex: 1; color: var(--muted); }
.lbl { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }
.chk { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.err { color: var(--bad); min-height: 18px; }
.none { color: var(--muted); padding: 16px 4px; text-align: center; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { position: sticky; top: 0; background: var(--panel); text-align: left; color: var(--muted); font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line2); z-index: 1; }
.tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.tbl tbody tr { cursor: pointer; }
.tbl tbody tr:hover { background: #1e242e; }
.tbl tbody tr.is-sel { background: #2b2414; }
.tbl tr.grp td { background: #1a1f27; color: var(--accent2); font-weight: 600; cursor: default; }
.tbl tfoot td { font-weight: 600; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 10px; margin: 0 0 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.up-ctl { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 8px 0 4px; }
.up-held { margin-top: 10px; padding: 9px 12px; border: 1px solid var(--warn); border-radius: 8px; background: rgba(227,163,60,.07); line-height: 1.6; }
.up-h { margin: 14px 0 6px; font-size: 13px; color: var(--muted); }
.up-table { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }

/* ---------------- gate (login) */
.gate { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(circle at 50% 30%, #1a1f28, #0b0d10); }
.gate__box { width: 360px; background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; padding: 22px; display: flex; flex-direction: column; gap: 10px; }
.gate__box h1 { font-size: 18px; margin: 0 0 4px; color: var(--accent2); text-align: center; }
.gate__box label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.gate__box input { background: var(--panel2); border: 1px solid var(--line2); border-radius: 6px; padding: 8px; color: var(--text); }
.gate__box .reg { display: none; }
.gate__box.is-register .reg { display: flex; }
.gate__err { color: var(--bad); min-height: 18px; }
.gate__sub { margin: -4px 0 4px; color: var(--muted); font-size: 12.5px; line-height: 1.55; text-align: center; word-break: keep-all; }
.gate__sub b { color: var(--text); }
.gate__warn { word-break: keep-all; margin: 0; padding: 7px 9px; border: 1px solid #7a5a22; border-radius: 6px; background: rgba(122, 90, 34, .15); color: #e9c27a; font-size: 12.5px; line-height: 1.5; }
.gate__warn b { color: #ffd27a; }
.tabs { display: flex; border-bottom: 1px solid var(--line2); }
.tabs button { flex: 1; background: none; border: 0; padding: 8px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button.is-on { color: var(--accent2); border-bottom-color: var(--accent); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2c333e; border-radius: 6px; border: 2px solid var(--panel); }
::-webkit-scrollbar-track { background: transparent; }
.lr-wait { color: var(--muted); font-size: 12px; }
.tip .lr-d { font-size: 15px; }
.tip .lr-alt { font-size: 13.5px; }
.lr-alt summary i { font-style: normal; opacity: .75; }
/* 노드 팝업 고정(Shift) */
.tip-pin { font-size: 11.5px; color: var(--muted); text-align: right; margin: -2px 0 4px; }
.tip-pin .pin-on { display: none; color: var(--accent2); font-weight: 600; }
.tip.is-pinned { pointer-events: auto; overflow-y: auto; border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 14px 40px rgba(0,0,0,.6); }
.tip.is-pinned .pin-on { display: inline; }
.tip.is-pinned .pin-off { display: none; }
/* 데이터 갱신 비밀번호 */
.uppw { display: flex; flex-direction: column; gap: 8px; }
.uppw label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); }
.uppw input { background: var(--panel2); border: 1px solid var(--line2); border-radius: 6px; padding: 8px; color: var(--text); font-size: 15px; letter-spacing: 2px; }
.uppw__err { color: var(--bad); min-height: 18px; }
.uppw__note { margin: 0; color: var(--muted); font-size: 12px; }
