/* MOCA 디자인뷰 체험 페이지 — 실제 VS Code(Dark+) 화면과 같은 구도·색.
   목업(MocaPlayground.CSS)과 캔버스 CSS 는 스크립트가 주입한다. 여기는 껍데기와 테마 변수. */
:root {
	/* 목업 렌더러가 읽는 VS Code 테마 변수 — Dark+ 값 */
	--vscode-foreground: #cccccc;
	--vscode-input-background: #3c3c3c;
	--vscode-input-foreground: #d4d4d4;
	--vscode-input-border: #3c3c3c;
	--vscode-button-background: #0e639c;
	--vscode-button-foreground: #ffffff;
	--vscode-button-secondaryBackground: #3a3d41;
	--vscode-button-secondaryForeground: #cccccc;
	--vscode-focusBorder: #007fd4;
	--vscode-errorForeground: #f48771;
	--vscode-descriptionForeground: #9d9d9d;
	--vscode-editor-font-family: Consolas, "D2Coding", "Malgun Gothic", monospace;
	--vs-bg: #1e1e1e;
	--vs-side: #252526;
	--vs-panel: #252526;
	--vs-line: #3c3c3c;
	--vs-title: #3c3c3c;
	--vs-tab: #2d2d2d;
	--vs-fg: #cccccc;
	--vs-dim: #8b8b8b;
	--vs-accent: #007fd4;
	--vs-status: #16825d;
	--vs-sel: #e8a33d;
}
html, body { margin: 0; height: 100%; background: var(--vs-bg); color: var(--vs-fg);
	font: 12.5px/1.5 "Segoe UI", Pretendard, "Malgun Gothic", sans-serif; }
* { box-sizing: border-box; }
.pg { display: flex; flex-direction: column; height: 100%; min-height: 600px; position: relative; overflow: hidden; background: var(--vs-bg); }
.vs-dim { color: var(--vs-dim); font-weight: 400; }
.grow { flex: 1; }
/* 제목줄 */
.vs-title { display: flex; align-items: center; gap: 12px; height: 34px; padding: 0 12px; background: var(--vs-title); color: var(--vs-fg); font-size: 12px; flex: 0 0 auto; }
.vs-menu { white-space: nowrap; opacity: .9; }
.vs-search { flex: 1; max-width: 520px; margin: 0 auto; text-align: center; background: #2a2a2a; border: 1px solid #4a4a4a; border-radius: 6px; padding: 2px 10px; color: #bbb; }
.vs-actions { display: flex; gap: 6px; margin-left: auto; }
.vs-btn { font: inherit; font-size: 12px; padding: 4px 12px; border-radius: 3px; cursor: pointer; border: 1px solid #5a5a5a; background: #3a3d41; color: #ddd; }
.vs-btn.pri { background: var(--vscode-button-background); border-color: var(--vscode-button-background); color: #fff; font-weight: 600; }
.vs-btn:hover { filter: brightness(1.15); }
/* 본문 4열 */
.vs-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 236px minmax(300px, 1fr) minmax(320px, 1.15fr) 250px; }
.vs-side { display: flex; flex-direction: column; min-height: 0; background: var(--vs-side); border-right: 1px solid var(--vs-line); }
.vs-side.right { border-right: none; border-left: 1px solid var(--vs-line); }
.vs-panel { display: flex; flex-direction: column; min-height: 0; border-bottom: 1px solid var(--vs-line); max-height: 46%; }
.vs-panel.grow { flex: 1; max-height: none; }
.vs-ph { padding: 5px 10px; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #ddd; flex: 0 0 auto; }
.vs-ph .vs-dim { text-transform: none; font-weight: 400; letter-spacing: 0; margin-left: 6px; }
/* Outline 트리 */
.vs-tree { list-style: none; margin: 0; padding: 0 0 6px; overflow: auto; font-size: 12.5px; }
.vs-tree li { padding: 2px 8px; white-space: nowrap; cursor: pointer; display: flex; align-items: center; gap: 5px; }
.vs-tree li:hover { background: #2a2d2e; }
.vs-tree li.sel { background: #094771; color: #fff; }
.vs-tree .ic { width: 14px; text-align: center; font-family: var(--vscode-editor-font-family); font-size: 11px; color: #75beff; }
.vs-tree .lbl { overflow: hidden; text-overflow: ellipsis; }
.vs-tree .lbl .d { color: var(--vs-dim); margin-left: 4px; }
/* 속성 표 */
.vs-props { overflow: auto; padding: 4px 8px 8px; font-size: 12px; }
.vs-props .grp-h { font-size: 11px; font-weight: 700; text-transform: uppercase; opacity: .8; padding: 6px 0 3px; letter-spacing: .03em; }
.vs-prow { display: grid; grid-template-columns: minmax(84px, 42%) 1fr; align-items: center; gap: 4px; padding: 1px 0; min-height: 22px; }
.vs-prow:hover { background: #2a2d2e; }
.vs-prow .k { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-left: 2px; }
.vs-prow .k .pre { opacity: .45; }
.vs-prow.present .k { font-weight: 600; }
.vs-prow.present .k::before { content: '●'; font-size: 7px; vertical-align: 2px; margin-right: 4px; color: #4a8fd6; }
.vs-prow input, .vs-input { width: 100%; font: inherit; font-size: 12px; padding: 2px 5px; height: 22px; background: var(--vscode-input-background); color: var(--vscode-input-foreground); border: 1px solid transparent; border-radius: 2px; outline: none; }
.vs-prow input:focus, .vs-input:focus { border-color: var(--vs-accent); }
.vs-prow input[readonly] { opacity: .6; }
.vs-prow input::placeholder, .vs-input::placeholder { color: #7a7a7a; }
.vs-input { margin: 2px 8px 4px; width: calc(100% - 16px); }
/* 편집기 */
.vs-editor, .vs-design { display: flex; flex-direction: column; min-height: 0; min-width: 0; background: var(--vs-bg); }
.vs-design { border-left: 1px solid var(--vs-line); }
.vs-tabs { display: flex; height: 35px; background: var(--vs-tab); flex: 0 0 auto; }
.vs-tab { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; font-size: 12.5px; color: #969696; border-right: 1px solid var(--vs-line); }
.vs-tab.on { background: var(--vs-bg); color: #fff; border-top: 1px solid var(--vs-accent); }
.vs-tab-ic { color: #e37933; font-family: var(--vscode-editor-font-family); font-weight: 700; font-size: 11px; }
.vs-dot { width: 8px; height: 8px; border-radius: 50%; background: #ddd; margin-left: 4px; }
.vs-crumb { padding: 3px 12px; font-size: 11.5px; color: #a0a0a0; flex: 0 0 auto; }
.vs-crumb b { color: #ccc; font-weight: 500; }
.vs-code { flex: 1; min-height: 0; display: flex; position: relative; }
.vs-gutter { width: 44px; padding: 8px 8px 8px 0; text-align: right; color: #6e7681; font: 12.5px/1.55 var(--vscode-editor-font-family); white-space: pre; overflow: hidden; user-select: none; flex: 0 0 auto; }
/* 소스 편집칸 — textarea 뒤에 같은 글꼴의 배경층(#hl)을 두고 선택 요소의 여는 태그 구간을 색칠한다(포커스 없어도 남는다).
   textarea 배경은 투명, 스크롤은 스크립트가 배경층과 맞춘다. */
.vs-srcwrap { flex: 1; min-width: 0; position: relative; overflow: hidden; }
#src, .vs-hl { margin: 0; padding: 8px 10px; font: 12.5px/1.55 var(--vscode-editor-font-family); tab-size: 4; white-space: pre; box-sizing: border-box; }
.vs-hl { position: absolute; inset: 0; overflow: hidden; color: transparent; pointer-events: none; background: var(--vs-bg); }
.vs-hl .hl-sel { background: #264f78; box-shadow: 0 0 0 1px #264f78; border-radius: 2px; }
.vs-hl .hl-line { display: inline-block; width: 100%; }
#src { position: absolute; inset: 0; width: 100%; height: 100%; resize: none; border: none; outline: none; color: #d4d4d4; background: transparent; overflow: auto; caret-color: #fff; }
#src::selection { background: rgba(38, 79, 120, .9); }
/* 디자인뷰 */
.dv-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; flex: 0 0 auto; flex-wrap: wrap; }
.dv-bar b { font-size: 13px; }
.dv-modes { display: inline-flex; border: 1px solid #5a5a5a; border-radius: 4px; overflow: hidden; }
.dv-mode { font: inherit; font-size: 11px; padding: 2.5px 9px; border: none; background: transparent; color: var(--vs-fg); cursor: pointer; }
.dv-mode.on { background: var(--vscode-button-background); color: #fff; }
.dv-mode:disabled { opacity: .45; cursor: not-allowed; }
.dv-hint { font-size: 11.5px; }
#stage { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 8px 10px 10px; overflow: auto; outline: none; }
#stage:focus-visible { box-shadow: inset 0 0 0 1px var(--vs-accent); }
.rootbox { flex: 1; min-height: 0; display: flex; }
.cell { display: flex; border: 1px dashed #6b7280; border-radius: 4px; padding: 5px; min-height: 34px; min-width: 46px; cursor: pointer; position: relative; }
.cell:hover { border-color: var(--vs-accent); }
.cell.sel { border: 2px solid var(--vs-accent); border-style: solid; background: color-mix(in srgb, var(--vs-accent) 12%, transparent); }
.cell.leaf { align-items: center; justify-content: center; font-size: 11.5px; opacity: .92; text-align: center; overflow: hidden; }
.cell.leaf.design { display: block; overflow: auto; padding: 6px; text-align: left; font-size: 11.5px; opacity: 1; cursor: default; line-height: 1.5; }
.tag { position: absolute; top: 1px; left: 5px; font-size: 9.5px; opacity: .5; pointer-events: none; }
.leaf.t-grid   { border-style: solid; border-color: color-mix(in srgb, #2aa3a3 55%, transparent); }
.leaf.t-form   { border-style: solid; border-color: color-mix(in srgb, #9a6ee8 55%, transparent); }
.leaf.t-frame  { border-style: solid; border-color: color-mix(in srgb, #4a8fd6 55%, transparent); }
.gutter { background: transparent; }
.gutter:hover { background: color-mix(in srgb, var(--vs-accent) 35%, transparent); }
/* 팔레트 */
.vs-phint { padding: 0 10px 6px; font-size: 11px; line-height: 1.5; }
.vs-plist { overflow: auto; padding: 0 6px 8px; }
.pitem { display: grid; grid-template-columns: 20px 1fr; gap: 1px 6px; align-items: center; padding: 4px 6px; border-radius: 3px; cursor: grab; user-select: none; border: 1px solid transparent; }
.pitem:hover, .pitem.active { background: #2a2d2e; border-color: color-mix(in srgb, var(--vs-accent) 45%, transparent); }
.pitem:active { cursor: grabbing; }
.pitem .g { text-align: center; font-size: 13px; opacity: .8; }
.pitem .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; }
.pitem .n .t { font-weight: 400; color: var(--vs-dim); font-family: var(--vscode-editor-font-family); font-size: 11px; margin-left: 6px; }
.pitem .d { grid-column: 2; font-size: 11px; color: var(--vs-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pitem.dragging { opacity: .5; }
/* 출력 */
.vs-log { margin: 0; padding: 4px 10px 8px; font: 11.5px/1.5 var(--vscode-editor-font-family); color: #cfcfcf; overflow: auto; max-height: 120px; min-height: 60px; white-space: pre-wrap; }
/* 상태줄 */
.vs-status { display: flex; align-items: center; gap: 14px; height: 22px; padding: 0 10px; background: var(--vs-status); color: #fff; font-size: 11.5px; flex: 0 0 auto; }
.vs-status .vs-dim { color: rgba(255,255,255,.75); }
/* 수정 모달 */
.pg-modal { position: absolute; inset: 0; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; z-index: 50; }
.pg-modal[hidden] { display: none; }
.pg-dlg { width: min(560px, 90%); background: #252526; color: var(--vs-fg); border: 1px solid #454545; border-radius: 6px; box-shadow: 0 10px 36px rgba(0,0,0,.55); overflow: hidden; }
.pg-dlg-h { padding: 10px 16px; font-weight: 600; font-size: 14px; border-bottom: 1px solid #454545; display: flex; gap: 10px; align-items: baseline; }
.pg-dlg-b { padding: 14px 16px; display: grid; grid-template-columns: auto 1fr; gap: 10px 12px; align-items: center; }
.pg-old { font-size: 15px; padding: 5px 9px; background: #1e1e1e; border-radius: 3px; }
#editInput { font: inherit; font-size: 18px; padding: 8px 10px; background: var(--vscode-input-background); color: #fff; border: 1px solid #454545; border-radius: 3px; outline: none; }
#editInput:focus { border-color: var(--vs-accent); box-shadow: 0 0 0 1px var(--vs-accent); }
.pg-dlg-f { display: flex; align-items: center; gap: 6px; padding: 10px 16px; border-top: 1px solid #454545; }
.pg-dlg-f .vs-dim { flex: 1; }
/* 자동 시연 커서·유령 칩·토스트 */
.pg-cursor { position: absolute; z-index: 60; width: 18px; height: 18px; pointer-events: none; transition: left .55s cubic-bezier(.4,.1,.2,1), top .55s cubic-bezier(.4,.1,.2,1); }
.pg-cursor[hidden] { display: none; }
.pg-cursor::before { content: ''; position: absolute; left: 0; top: 0; width: 0; height: 0; border-left: 9px solid #fff; border-right: 9px solid transparent; border-bottom: 9px solid transparent; border-top: 9px solid #fff; transform: rotate(-15deg); filter: drop-shadow(0 1px 2px rgba(0,0,0,.7)); }
.pg-cursor.press::after { content: ''; position: absolute; left: -8px; top: -8px; width: 30px; height: 30px; border-radius: 50%; background: color-mix(in srgb, var(--vs-accent) 45%, transparent); animation: pgpulse .5s ease-out; }
@keyframes pgpulse { from { transform: scale(.3); opacity: 1; } to { transform: scale(1.4); opacity: 0; } }
.pg-ghost { position: absolute; left: 14px; top: 12px; display: none; padding: 3px 10px; border: 1px solid var(--vs-accent); border-radius: 3px; background: #2a2d2e; color: #fff; font-size: 12px; white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.5); }
.pg-cursor.drag .pg-ghost { display: inline-block; }
.pg-toast { position: absolute; left: 50%; bottom: 40px; transform: translateX(-50%); z-index: 55; background: #0e639c; color: #fff; padding: 8px 16px; border-radius: 4px; font-size: 13px; box-shadow: 0 6px 20px rgba(0,0,0,.5); max-width: 90%; text-align: center; }
.pg-toast[hidden] { display: none; }
.pg-toast b { color: #ffd27a; }
@media (max-width: 1100px) {
	.vs-body { grid-template-columns: 200px 1fr 1fr; }
	.vs-side.right { display: none; }
	.vs-menu { display: none; }
}
@media (max-width: 760px) {
	.vs-body { grid-template-columns: 1fr; grid-template-rows: auto 220px 1fr; }
	.vs-side { max-height: 200px; }
	.vs-search { display: none; }
}
@media (prefers-reduced-motion: reduce) { .pg-cursor { transition: none; } }
