/* prodgen v1 웹 화면 — 차분하고 깔끔하게. 외부 주소 없음 — 글꼴(Pretendard)도 web/fonts 에서 받는다. */
@font-face {
  font-family: "Pretendard Variable";
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
  src: url("fonts/PretendardVariable.woff2") format("woff2-variations");
}
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --ink: #1f2933;
  --ink-soft: #52606d;
  --line: #dde3ea;
  --accent: #3d6a99;
  --accent-ink: #ffffff;
  --accent-soft: #e8eff7;
  --ok: #2f855a;
  --warn: #b7791f;
  --warn-soft: #fdf6e7;
  --danger: #b83232;
  --danger-soft: #fdeeee;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(31, 41, 51, 0.06), 0 4px 16px rgba(31, 41, 51, 0.05);
  --font: system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

h1 { font-size: 1.6rem; line-height: 1.3; margin: 0.4rem 0 0.4rem; letter-spacing: -0.01em; }
h2 { font-size: 1.1rem; line-height: 1.35; margin: 0; }
p { margin: 0.3rem 0; }
img, video { max-width: 100%; display: block; }

.muted { color: var(--ink-soft); }
.help { color: var(--ink-soft); font-size: 0.875rem; }
.req { color: var(--ink-soft); font-weight: 400; font-size: 0.85em; }

/* ---- 상단 ---- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.brand { font-weight: 700; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; margin-right: auto; }

.status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.875rem;
  background: var(--accent-soft);
}
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.status .mode { color: var(--ink-soft); border-left: 1px solid var(--line); padding-left: 8px; }
.status-team { background: var(--warn-soft); }
.status-team .dot { background: var(--warn); }
.status-maintenance, .status-offline { background: var(--danger-soft); }
.status-maintenance .dot, .status-offline .dot { background: var(--danger); }

.notice-bar {
  max-width: 960px;
  margin: 12px auto 0;
  padding: 10px 16px;
  background: var(--warn-soft);
  border: 1px solid #f1dfb6;
  border-radius: var(--radius);
  font-size: 0.9rem;
}

/* ---- 본문 ---- */
.page { max-width: 960px; margin: 0 auto; padding: 20px 16px 96px; }

.card, .block-card, .step-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.narrow { max-width: 460px; margin: 40px auto; }

.callout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 16px 0;
  padding: 12px 16px;
  background: var(--accent-soft);
  border-radius: var(--radius);
}

/* ---- 버튼·입력 ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 8px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { border-color: #c3ccd6; background: #fafbfc; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #335b85; }
.btn.big { min-height: 48px; padding: 10px 28px; font-size: 1.05rem; }
.btn.small { min-height: 32px; padding: 4px 12px; font-size: 0.875rem; }
.btn.link { border: none; background: none; padding: 4px 0; color: var(--accent); font-weight: 500; min-height: 0; }
.btn:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible, .template-card:focus-visible {
  outline: 3px solid rgba(61, 106, 153, 0.35);
  outline-offset: 2px;
}

input[type="text"], input[type="number"], input:not([type]), textarea, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
}
textarea { resize: vertical; min-height: 84px; }
label { display: block; font-weight: 600; font-size: 0.925rem; margin-bottom: 6px; }

.enroll-form { display: grid; gap: 10px; margin-top: 16px; }
.enroll-form label { margin-bottom: 0; }
.code-input { font-size: 1.25rem; letter-spacing: 0.08em; text-transform: uppercase; text-align: center; }

.error {
  margin-top: 10px;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--danger-soft);
  border: 1px solid #f3c9c9;
}
.error strong { color: var(--danger); }
.error p { color: var(--ink); font-size: 0.9rem; }
.error .report-id { color: var(--ink-soft); font-size: 0.85rem; font-variant-numeric: tabular-nums; user-select: all; }
.error .btn { margin-top: 8px; }

/* ---- 추천 레시피 ---- */
.template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 20px;
}
.template-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 0 18px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font: inherit;
  color: inherit;
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.template-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(31, 41, 51, 0.06), 0 10px 24px rgba(31, 41, 51, 0.08); }
.template-card img { width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; background: #edf1f5; }
.template-title { font-weight: 700; font-size: 1.05rem; padding: 8px 18px 0; }
.template-desc { color: var(--ink-soft); font-size: 0.925rem; padding: 0 18px; }

/* ---- 최근 결과 ---- */
.recent { margin-top: 32px; }
.recent-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 8px; }
.recent-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 12px 16px;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.recent-item:hover { border-color: #c3ccd6; background: #fafbfc; }
.recent-item:focus-visible { outline: 3px solid rgba(61, 106, 153, 0.35); outline-offset: 2px; }
.recent-name { font-weight: 600; }
.recent-meta { color: var(--ink-soft); font-size: 0.875rem; white-space: nowrap; }

.nav-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; }

/* ---- 블록 ---- */
.blocks { display: grid; gap: 16px; margin-top: 20px; }
.block-head { display: flex; gap: 12px; align-items: flex-start; margin-bottom: 12px; }
.block-head .icon { font-size: 1.6rem; line-height: 1.2; }
.block-card.has-error { border-color: var(--danger); }
.field { margin-top: 14px; }
.model-area { border-top: 1px solid var(--line); padding-top: 2px; }
.model-card { margin-top: 10px; padding: 12px 14px; border-radius: 10px; background: var(--accent-soft); font-size: 0.925rem; }
.model-head { margin-top: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { padding: 1px 10px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: 0.8rem; }
.estimate { margin-top: 10px; font-weight: 600; }

/* ---- 품질 슬라이더(점 슬라이더 + 선택 시트) ---- */
.quality { display: grid; gap: 10px; }
.q-label { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 600; }
.q-head {
  display: inline-flex; align-items: baseline; gap: 8px; min-height: 44px; padding: 0 4px 0 12px;
  border: 0; border-radius: 12px; background: none; color: var(--ink); font: inherit; cursor: pointer;
}
.q-head:hover { background: var(--accent-soft); }
.q-name { font-size: 1.125rem; font-weight: 700; }
.q-time { color: var(--ink-soft); font-weight: 500; }
.q-chev { font-size: 1.3rem; line-height: 1; color: var(--ink); }
.q-track {
  position: relative; height: 64px; border-radius: 32px; background: var(--surface);
  border: 1px solid var(--line); box-shadow: 0 6px 20px rgba(31, 41, 51, 0.08);
}
.q-fill {
  position: absolute; left: 8px; top: 7px; height: 48px; border-radius: 24px; background: var(--ink);
  transition: width 0.2s ease;
}
.q-stops { position: absolute; left: 8px; right: 8px; top: 7px; height: 48px; display: grid; }
.q-stop {
  display: flex; align-items: center; justify-content: center; padding: 0;
  border: 0; border-radius: 24px; background: none; cursor: pointer;
}
.q-stop:focus-visible { outline: 3px solid rgba(61, 106, 153, 0.45); outline-offset: 2px; }
.q-knob { display: block; width: 48px; height: 48px; border-radius: 24px; background: var(--surface);
  box-shadow: 0 1px 4px rgba(31, 41, 51, 0.3); }
.q-dot { display: block; width: 10px; height: 10px; border-radius: 5px; background: #c3ccd6; }
.q-dot.passed { background: rgba(255, 255, 255, 0.4); }
.q-captions { display: grid; padding: 0 8px; text-align: center; font-size: 0.8rem; color: var(--ink-soft); font-weight: 500; }
.q-captions .on { color: var(--ink); font-weight: 700; }
.q-note { color: var(--ink-soft); font-size: 0.925rem; text-align: center; }
@media (prefers-reduced-motion: reduce) { .q-fill { transition: none; } }

.modal.sheet { width: min(440px, 100%); padding: 10px 16px 20px; background: var(--bg); display: grid; gap: 14px; }
.sheet-body { display: grid; gap: 14px; }
.sheet-head { display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; }
.sheet-head h2 { margin: 0; text-align: center; font-size: 1.05rem; }
.sheet-icon {
  width: 44px; height: 44px; border-radius: 22px; border: 0; background: var(--surface);
  font-size: 1.1rem; color: var(--ink); cursor: pointer;
}
.sheet-group { background: var(--surface); border-radius: 18px; padding: 0 18px; }
.sheet-row {
  width: 100%; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 0; border: 0; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer;
}
.sheet-row + .sheet-row, .sheet-term + .sheet-term, .sheet-recipe + .sheet-recipe { border-top: 1px solid var(--line); }
.sheet-row:focus-visible { outline: 3px solid rgba(61, 106, 153, 0.45); outline-offset: -3px; border-radius: 8px; }
.sheet-row-text { display: grid; gap: 2px; flex: 1; }
.sheet-row-label { font-weight: 600; }
.sheet-row-note { color: var(--ink-soft); font-size: 0.875rem; }
.sheet-row-time { color: var(--ink-soft); font-size: 0.875rem; white-space: nowrap; }
.sheet-check { width: 22px; text-align: center; color: var(--accent); font-weight: 700; }
.sheet-more {
  display: flex; justify-content: space-between; align-items: center; min-height: 56px; padding: 0 18px;
  border: 0; border-radius: 18px; background: var(--surface); font: inherit; color: var(--ink); cursor: pointer;
}
.sheet-term { padding: 14px 0; }
.sheet-term-name { margin: 0; font-weight: 600; }
.sheet-recipe { display: flex; align-items: center; gap: 12px; min-height: 50px; }
.sheet-recipe .sheet-row-label { width: 76px; flex: none; }
@media (max-width: 640px) {
  .overlay.sheet-overlay { place-items: end center; padding: 0; }
  .modal.sheet { border-radius: 24px 24px 0 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
}

.slot { display: flex; flex-wrap: wrap; gap: 8px; }
.slot-ref { padding: 6px 12px; border-radius: 10px; background: var(--bg); border: 1px dashed #c3ccd6; font-size: 0.925rem; }

.upload { display: grid; gap: 6px; justify-items: start; }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.upload label.btn { margin: 0; font-size: 0.95rem; }
.upload-preview img { max-height: 220px; border-radius: 10px; border: 1px solid var(--line); }
.field-msg { font-size: 0.9rem; color: var(--ink-soft); }

.run-bar {
  position: sticky;
  bottom: 0;
  margin-top: 24px;
  padding: 14px 0 16px;
  background: linear-gradient(to bottom, rgba(245, 247, 250, 0), var(--bg) 30%);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.run-bar .form-msg { flex-basis: 100%; }

/* ---- 진행 ---- */
.run-status { font-weight: 600; font-size: 1.05rem; }
.run-status[data-status="done"] { color: var(--ok); }
.run-status[data-status="failed"] { color: var(--danger); }
.run-status[data-status="paused"] { color: var(--warn); }
.step-card[data-status="done"] { border-color: #b9dcc7; }
.step-card[data-status="failed"] { border-color: #f3c9c9; }
.step-card[data-status="paused"] { border-color: #f1dfb6; }
.step-status { color: var(--ink-soft); }
.bar { height: 8px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; margin: 8px 0; }
.fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width 0.4s ease; }
.step-media:not(:empty) { margin-top: 12px; }
.step-media img, .step-media video { max-height: 420px; border-radius: 10px; border: 1px solid var(--line); background: #0f1720; }
.step-media img { background: repeating-conic-gradient(#eef1f5 0 25%, #ffffff 0 50%) 0 0 / 16px 16px; }
.step-actions { display: flex; gap: 8px; margin-top: 10px; }
.step-actions:empty { display: none; }

/* ---- 안내 창·알림 ---- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(31, 41, 51, 0.4);
}
.modal {
  width: min(480px, 100%);
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 20px 48px rgba(31, 41, 51, 0.2);
}
.modal h2 { margin-bottom: 8px; }
.modal.wide { width: min(720px, 100%); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.copy-text {
  margin-top: 10px;
  min-height: 220px;
  font: 0.8rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: pre;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  z-index: 30;
  transform: translateX(-50%);
  width: min(520px, calc(100% - 32px));
  display: grid;
  gap: 2px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--ink);
  color: #ffffff;
  box-shadow: 0 12px 32px rgba(31, 41, 51, 0.25);
  font-size: 0.925rem;
}
.toast span { color: #d3dae2; }

@media (max-width: 600px) {
  h1 { font-size: 1.35rem; }
  .card, .block-card, .step-card { padding: 16px; }
  .topbar-inner { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---- 블록 편집기(editor.js) ------------------------------------------------------------------
   위계는 Material Design 3 토큰을 따른다(색 역할 · 글자 크기 · 모양 · 높이). 색은 둘 + 무채색 하나:
   영상 = primary 컨테이너, 이미지 = tertiary 컨테이너, 사진(재료) = 무채색 surface. 글자는 늘 on-컨테이너 색이라
   대비가 7:1 안팎이다. 모양으로도 나눈다 — 재료(사진·이미지)는 둥글게, 영상은 네모(쌓인다). */
.ed, .ed-sheet, .ed-pop {
  --md-primary: #36618e; --md-on-primary: #ffffff;
  --md-primary-container: #d1e4ff; --md-on-primary-container: #194975;
  --md-secondary-container: #d7e3f7; --md-on-secondary-container: #3b4858;
  --md-tertiary-container: #efdbff; --md-on-tertiary-container: #5a3e78;
  --md-surface: #f8f9ff; --md-surface-lowest: #ffffff; --md-surface-low: #f2f3fa; --md-surface-container: #ecedf4;
  --md-surface-high: #e7e8ee; --md-surface-highest: #e1e2e9;
  --md-on-surface: #191c20; --md-on-surface-variant: #43474e;
  --md-outline: #73777f; --md-outline-variant: #c3c6cf;
  --md-inverse-surface: #2e3135; --md-inverse-on-surface: #eff0f7;
  --md-error: #ba1a1a; --md-error-container: #ffdad6; --md-on-error-container: #93000a;
  --md-elev-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 1px 3px 1px rgba(0, 0, 0, 0.15);
  --md-elev-2: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px 2px rgba(0, 0, 0, 0.15);
  --md-elev-3: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15);
  --md-shape-xs: 4px; --md-shape-sm: 8px; --md-shape-md: 12px; --md-shape-lg: 16px; --md-shape-xl: 28px;
  --md-focus: 0 0 0 3px color-mix(in srgb, var(--md-primary) 45%, transparent);
  color: var(--md-on-surface);
}
/* 글자 크기(MD3 type scale) */
.ed { font-size: 14px; line-height: 20px; }
.ed-title { margin: 0; font-size: 22px; line-height: 28px; font-weight: 500; letter-spacing: 0; }
.ed-block-name, .nd-side-title { font-size: 16px; line-height: 24px; font-weight: 600; letter-spacing: 0.15px; }
.ed-pal-title { margin: 0; font-size: 16px; line-height: 24px; font-weight: 600; }
.ed-pal-label { font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0.5px; color: var(--md-on-surface-variant); }
.ed-label { font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0.5px; }
.ed-support, .ed-total, .ed-pal-help { font-size: 12px; line-height: 16px; color: var(--md-on-surface-variant); }

.template-card.blank { justify-content: center; border-style: dashed; }
.template-blank { display: grid; place-items: center; height: 120px; font-size: 2.4rem; color: var(--ink-soft); }

/* 단추(MD3 common buttons) */
.ed-filled, .ed-tonal, .ed-outlined, .ed-text-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 24px;
  border: 0; border-radius: 999px; font: inherit; font-size: 14px; line-height: 20px; font-weight: 500;
  letter-spacing: 0.1px; cursor: pointer; white-space: nowrap; }
.ed-filled { background: var(--md-primary); color: var(--md-on-primary); }
.ed-filled:hover { box-shadow: var(--md-elev-1); background: color-mix(in srgb, var(--md-primary) 92%, var(--md-on-primary)); }
.ed-filled:disabled { background: color-mix(in srgb, var(--md-on-surface) 12%, transparent); color: color-mix(in srgb, var(--md-on-surface) 38%, transparent); box-shadow: none; cursor: default; }
.ed-tonal { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.ed-tonal:hover { background: color-mix(in srgb, var(--md-secondary-container) 92%, var(--md-on-secondary-container)); }
.ed-outlined { background: transparent; color: var(--md-primary); box-shadow: inset 0 0 0 1px var(--md-outline); }
.ed-outlined:hover, .ed-text-btn:hover { background: color-mix(in srgb, var(--md-primary) 8%, transparent); }
.ed-text-btn { padding: 0 12px; background: transparent; color: var(--md-primary); }
.ed-text-btn.small { min-height: 32px; padding: 0 10px; color: inherit; }
.ed-text-btn.danger { color: var(--md-error); align-self: flex-start; }
.ed-icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 999px;
  background: transparent; color: inherit; font: inherit; font-size: 18px; cursor: pointer; }
.ed-icon-btn:hover { background: color-mix(in srgb, currentColor 8%, transparent); }
.ed :focus-visible, .ed-sheet :focus-visible, .ed-pop :focus-visible { outline: none; box-shadow: var(--md-focus); }

/* 위쪽 줄 */
.ed-head { display: grid; gap: 8px; margin-bottom: 16px; }
.ed-nav { display: flex; flex-wrap: wrap; gap: 4px; margin-left: -12px; }
.ed-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; }
.ed-spacer { flex: 1; }
.ed-segs { display: inline-flex; }
.ed-seg { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1px solid var(--md-outline);
  background: transparent; color: var(--md-on-surface); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.ed-seg:first-child { border-radius: 999px 0 0 999px; }
.ed-seg:last-child { border-radius: 0 999px 999px 0; border-left: 0; }
.ed-seg.on { background: var(--md-secondary-container); color: var(--md-on-secondary-container); }
.ed-seg-check { font-size: 14px; }
.ed-run-msg { margin-top: 12px; }

/* 몸통: 꾸러미 + 캔버스 */
.ed-body, .nd-body { display: flex; flex-wrap: wrap; align-items: stretch; border-radius: var(--md-shape-lg); overflow: hidden;
  background: var(--md-surface-low); box-shadow: inset 0 0 0 1px var(--md-outline-variant); }
.ed-palette { flex: 1 1 200px; max-width: 240px; height: var(--cv-h); overflow-y: auto; box-sizing: border-box; padding: 16px; display: flex; flex-direction: column; gap: 14px;
  background: var(--md-surface); border-right: 1px solid var(--md-outline-variant); }
.ed-pal-group { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.ed-pal-item { min-height: 40px; padding: 0 16px; border: 0; border-radius: 999px; background: var(--c); color: var(--on-c);
  font: inherit; font-size: 14px; font-weight: 500; cursor: grab; box-shadow: var(--md-elev-1); }
.ed-pal-item.cat-photo { box-shadow: inset 0 0 0 1px var(--md-outline-variant), var(--md-elev-1); }
.ed-pal-item.cat-video { border-radius: var(--md-shape-sm); }
.ed-pal-item:hover { background: color-mix(in srgb, var(--c) 92%, var(--on-c)); }
.ed-pal-help { margin-top: auto; display: grid; gap: 6px; }
.ed-pal-help p { margin: 0; }
.ed-pal-help strong { color: var(--md-on-surface); font-weight: 600; }

.cat-video { --c: var(--md-primary-container); --on-c: var(--md-on-primary-container); }
.cat-image { --c: var(--md-tertiary-container); --on-c: var(--md-on-tertiary-container); }
.cat-photo { --c: var(--md-surface-lowest); --on-c: var(--md-on-surface); }
.ed-chip { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border-radius: 999px; background: var(--c);
  color: var(--on-c); font-size: 14px; font-weight: 500; white-space: nowrap; flex: none; }
.ed-chip.cat-photo { box-shadow: inset 0 0 0 1px var(--md-outline-variant); }

/* Figma 식 캔버스 */
.ed, .ed-sheet { --cv-h: clamp(520px, calc(100vh - 230px), 960px); }
.cv-frame { position: relative; flex: 999 1 560px; min-width: 0; height: var(--cv-h); }
.cv-viewport { position: absolute; inset: 0; overflow: hidden; touch-action: none; cursor: default; outline: none;
  background-color: var(--md-surface-low);
  background-image: radial-gradient(var(--md-outline-variant) 1.2px, transparent 1.2px); }
.cv-viewport:focus-visible { box-shadow: inset var(--md-focus); }
.cv-viewport.panning { cursor: grabbing; }
.cv-viewport.drop-ok { box-shadow: inset 0 0 0 3px var(--md-primary); }
.cv-world { position: absolute; left: 0; top: 0; width: 1px; height: 1px; transform-origin: 0 0; }
.cv-item { position: absolute; }
.cv-overlay { position: absolute; z-index: 2; margin: 0; }
.cv-hint { left: 16px; top: 16px; display: inline-flex; align-items: center; min-height: 32px; padding: 0 14px;
  border-radius: var(--md-shape-sm); background: var(--md-inverse-surface); color: var(--md-inverse-on-surface);
  font-size: 12px; font-weight: 500; letter-spacing: 0.4px; pointer-events: none; }
.cv-empty { left: 50%; top: 45%; transform: translate(-50%, -50%); color: var(--md-on-surface-variant); pointer-events: none; }
.cv-tools { left: 16px; bottom: 16px; display: flex; gap: 8px; }
.nd-body .cv-hint { max-width: calc(100% - 32px); }
.cv-controls { position: absolute; z-index: 2; right: 16px; bottom: 16px; display: flex; align-items: center; gap: 2px; padding: 4px;
  border-radius: 999px; background: var(--md-surface-container); box-shadow: var(--md-elev-2); }
.cv-icon { width: 40px; height: 40px; border: 0; border-radius: 999px; background: transparent; color: var(--md-on-surface-variant);
  font: inherit; font-size: 20px; cursor: pointer; }
.cv-icon:hover, .cv-fit:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); }
.cv-zoom-text { min-width: 48px; text-align: center; font-size: 12px; font-weight: 500; color: var(--md-on-surface); font-variant-numeric: tabular-nums; }
.cv-divider { width: 1px; height: 24px; background: var(--md-outline-variant); margin: 0 4px; }
.cv-fit { min-height: 40px; padding: 0 14px; border: 0; border-radius: 999px; background: transparent; color: var(--md-primary);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }

/* 블록 */
.ed-script { display: flex; flex-direction: column; align-items: flex-start; }
.ed-shared-note { margin: 0 0 8px; font-size: 12px; font-weight: 500; color: var(--md-on-surface-variant); }
.ed-block { display: flex; flex-direction: column; gap: 12px; box-sizing: border-box; padding: 12px 16px 16px; width: 560px; max-width: 100%;
  border-radius: var(--md-shape-md); background: var(--c); color: var(--on-c); box-shadow: var(--md-elev-1); }
.ed-block.nested { width: auto; min-width: 280px; border-radius: 20px; padding: 10px 14px 14px; box-shadow: var(--md-elev-1); }
.ed-block.cat-missing { background: var(--md-surface-high); color: var(--md-on-surface); }
.ed-block.has-error, .ed-photo.has-error, .nd-node.has-error { box-shadow: 0 0 0 2px var(--md-error), var(--md-elev-1); }
.ed-err { margin: 0; padding: 8px 12px; border-radius: var(--md-shape-sm); background: var(--md-error-container);
  color: var(--md-on-error-container); font-size: 14px; }
.ed-block-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-right: -8px; }
.ed-grip { cursor: grab; color: color-mix(in srgb, var(--on-c) 70%, transparent); font-size: 16px; user-select: none; padding: 0 2px; }
.ed .ed-model { width: auto; min-height: 32px; padding: 0 8px; border: 1px solid color-mix(in srgb, var(--on-c) 40%, transparent);
  border-radius: var(--md-shape-sm); background: transparent; color: var(--on-c); font: inherit; font-size: 14px; font-weight: 500; }
.ed-model option { color: var(--md-on-surface); }
.ed-model-name { font-size: 12px; font-weight: 500; color: color-mix(in srgb, var(--on-c) 80%, transparent); }
/* 품질 칩(MD3 assist chip, elevated) */
.ed-quality { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 8px 0 12px; border: 0;
  border-radius: var(--md-shape-sm); background: var(--md-surface-lowest); color: var(--md-on-surface); box-shadow: var(--md-elev-1);
  font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.ed-quality:hover { background: color-mix(in srgb, var(--md-surface-lowest) 92%, var(--md-on-surface)); }
.ed-quality-time { font-weight: 400; color: var(--md-on-surface-variant); }
.ed-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.ed .ed-label { display: inline-block; min-width: 64px; margin: 0; }
.ed-slot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
/* 입력(MD3 outlined text field, 촘촘한 판) — 전역 입력 규칙을 편집기 안에서 되돌린다 */
.ed .ed-input { width: auto; min-height: 40px; padding: 0 12px; border: 1px solid var(--md-outline); border-radius: var(--md-shape-xs);
  background: var(--md-surface-lowest); color: var(--md-on-surface); font: inherit; font-size: 14px; line-height: 20px; }
.ed .ed-input:focus { border-color: var(--md-primary); box-shadow: inset 0 0 0 1px var(--md-primary); outline: none; }
.ed textarea.ed-input { min-height: 40px; padding: 9px 12px; resize: vertical; }
.ed .ed-row.grow .ed-input { flex: 1; min-width: min(320px, 100%); }
.ed .ed-input.num { width: 72px; }
.ed-num { display: inline-flex; align-items: center; gap: 6px; }
/* 구멍 */
.ed-hole { min-height: 40px; padding: 0 16px; border: 1.5px dashed color-mix(in srgb, var(--on-c) 55%, transparent); border-radius: 999px;
  background: transparent; color: var(--on-c); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.ed-hole:hover { background: color-mix(in srgb, var(--on-c) 8%, transparent); }
.ed-hole.need { border-style: solid; border-color: var(--on-c); }
.ed-hole.drop-ok, .ed-stack-end.drop-ok, .ed-gap.drop-ok { background: color-mix(in srgb, var(--md-primary) 16%, transparent);
  border-color: var(--md-primary); border-style: solid; }
.ed-ref { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; padding: 0 4px 0 12px; border-radius: var(--md-shape-sm);
  background: var(--md-surface-lowest); color: var(--md-on-surface); box-shadow: inset 0 0 0 1px var(--md-outline-variant);
  font-size: 14px; font-weight: 500; }
.ed-ref-x, .ed-photo-x { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 999px;
  background: transparent; color: var(--md-on-surface-variant); cursor: pointer; font-size: 18px; line-height: 1; }
.ed-ref-x:hover, .ed-photo-x:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); }
.ed-prev { font-size: 14px; color: color-mix(in srgb, var(--on-c) 85%, transparent); }
/* 사진(무채색 재료) */
.ed-photo { display: inline-flex; align-items: center; gap: 2px; min-height: 40px; padding: 0 4px; border-radius: 999px;
  background: var(--md-surface-lowest); color: var(--md-on-surface); box-shadow: inset 0 0 0 1px var(--md-outline-variant), var(--md-elev-1); }
.ed-photo-pick { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 8px 0 2px; border: 0;
  background: none; color: inherit; font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.ed-photo .ed-grip { color: var(--md-outline); }
.ed-thumb { display: inline-block; width: 32px; height: 32px; border-radius: 999px; overflow: hidden; flex: none;
  background: var(--md-surface-highest); }
.ed-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ed-thumb.small { width: 32px; height: 32px; box-shadow: 0 0 0 2px var(--c, var(--md-surface-lowest)); }
.ed-stack-thumbs { display: flex; }
.ed-stack-thumbs .ed-thumb + .ed-thumb { margin-left: -10px; }
.ed-gap { height: 6px; width: 560px; max-width: 100%; border-radius: 4px; }
.dragging .ed-gap { height: 20px; border: 1.5px dashed var(--md-outline); }
.ed-stack-end { margin-top: 6px; min-height: 48px; width: 560px; max-width: 100%; padding: 0 16px; border: 1.5px dashed var(--md-outline);
  border-radius: var(--md-shape-md); background: transparent; color: var(--md-on-surface-variant); font: inherit; font-size: 14px;
  font-weight: 500; text-align: left; cursor: pointer; }
.ed-stack-end:hover { background: color-mix(in srgb, var(--md-on-surface) 6%, transparent); }
.ed-collapsed { display: flex; align-items: center; gap: 12px; min-height: 56px; width: 100%; padding: 0 16px 0 8px; border: 0;
  border-radius: 28px; background: var(--c); color: var(--on-c); font: inherit; text-align: left; cursor: pointer; box-shadow: var(--md-elev-1); }
.ed-collapsed-text { display: grid; flex: 1; }
.ed-collapsed .ed-block-name { font-size: 14px; line-height: 20px; }
.ed-collapsed-sub { font-size: 12px; line-height: 16px; color: color-mix(in srgb, var(--on-c) 80%, transparent); }

/* 메뉴(MD3 menu) */
.ed-pop { position: absolute; z-index: 40; min-width: 200px; padding: 8px 0; border-radius: var(--md-shape-xs);
  background: var(--md-surface-container); box-shadow: var(--md-elev-2); display: grid; }
.ed-pop button { min-height: 48px; padding: 0 16px; border: 0; background: none; font: inherit; font-size: 14px; font-weight: 500;
  text-align: left; cursor: pointer; color: var(--md-on-surface); }
.ed-pop button:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, transparent); }
.ed-pop .danger { color: var(--md-error); }
/* 넣을 것 고르기 시트 */
.ed-sheet .ed-photo-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ed-photo-btn { min-height: 56px; border: 0; border-radius: var(--md-shape-lg); background: var(--md-surface-lowest);
  box-shadow: inset 0 0 0 1px var(--md-outline-variant); font: inherit; font-size: 14px; font-weight: 500; color: var(--md-on-surface); cursor: pointer; }
.sheet-row .ed-chip + .sheet-row-note { flex: 1; text-align: left; }

/* 노드 */
.nd-body .cv-frame { flex: 999 1 560px; }
.nd-edges { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: visible; }
.nd-edge { fill: none; stroke: var(--md-outline); stroke-width: 2; }
.nd-edge.temp { stroke: var(--md-primary); stroke-dasharray: 6 4; }
.nd-hit { fill: none; stroke: transparent; stroke-width: 16; pointer-events: stroke; cursor: pointer; }
.nd-node { width: 240px; border-radius: var(--md-shape-md); background: var(--md-surface-lowest); box-shadow: var(--md-elev-1);
  cursor: grab; touch-action: none; user-select: none; }
.nd-node.selected { box-shadow: 0 0 0 2px var(--md-primary), var(--md-elev-2); }
.nd-head { position: relative; display: flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border-radius: var(--md-shape-md) var(--md-shape-md) 0 0; background: var(--c); color: var(--on-c); }
.nd-node.cat-photo .nd-head { box-shadow: inset 0 -1px 0 var(--md-outline-variant); background: var(--md-surface-low); }
.nd-name { font-size: 14px; line-height: 20px; font-weight: 600; }
.nd-model { font-size: 12px; font-weight: 500; color: color-mix(in srgb, var(--on-c) 80%, transparent); }
.nd-row { position: relative; display: flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 16px; font-size: 14px;
  color: var(--md-on-surface); border-top: 1px solid var(--md-surface-high); }
.nd-sub { font-size: 12px; color: var(--md-on-surface-variant); }
.nd-text { display: block; line-height: 36px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nd-port { position: absolute; width: 14px; height: 14px; border-radius: 999px; box-sizing: border-box; background: var(--md-surface-lowest);
  border: 2px solid var(--md-outline); }
.nd-port.in { left: -7px; top: 11px; }
.nd-port.in.on { background: var(--on-c); border-color: var(--md-surface-lowest); box-shadow: 0 0 0 1px var(--on-c); }
.nd-port.in.can { box-shadow: 0 0 0 5px color-mix(in srgb, var(--md-primary) 35%, transparent); border-color: var(--md-primary); }
.nd-port.out { right: -7px; top: 15px; background: var(--on-c); border-color: var(--md-surface-lowest); box-shadow: 0 0 0 1px var(--on-c); cursor: crosshair; }
.nd-node .nd-row .nd-port.in { --on-c: var(--md-on-surface-variant); }
.nd-side { flex: 1 1 280px; max-width: 360px; padding: 20px; display: flex; flex-direction: column; gap: 16px;
  background: var(--md-surface); border-left: 1px solid var(--md-outline-variant); }
.nd-side-title { margin: 0; display: flex; align-items: center; gap: 10px; }
.nd-side-dot { width: 12px; height: 12px; border-radius: 999px; background: var(--c, var(--md-outline-variant));
  box-shadow: inset 0 0 0 1px var(--on-c, var(--md-outline)); }
.nd-side-chips { display: flex; flex-wrap: wrap; gap: 8px; --on-c: var(--md-on-surface); }
.nd-side .ed-row { --on-c: var(--md-on-surface); }

/* 좁은 화면(휴대폰): 캔버스 대신 세로 목록 */
.ed-body.ed-phone { display: block; margin: 0 -16px; border-radius: 0; box-shadow: none; }
.ed-list { display: flex; flex-direction: column; gap: 16px; padding: 16px; }
.ed-hint { align-self: flex-start; margin: 0; display: inline-flex; align-items: center; min-height: 32px; padding: 0 14px;
  border-radius: var(--md-shape-sm); background: var(--md-inverse-surface); color: var(--md-inverse-on-surface); font-size: 12px; font-weight: 500; }
.ed-add { min-height: 56px; border: 1.5px dashed var(--md-outline); border-radius: var(--md-shape-lg); background: transparent;
  color: var(--md-on-surface-variant); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
@media (max-width: 720px) {
  .ed-list .ed-block-head { margin-right: 0; }
  .ed-list .ed-quality { order: 5; }
  .ed-list .ed-block, .ed-list .ed-stack-end, .ed-list .ed-gap { width: 100%; }
  .ed-list .ed-script { width: 100%; }
  .ed-list .ed-block.nested { min-width: 0; }
  .ed .ed-row.grow .ed-input { min-width: 0; width: 100%; }
  .ed-title { font-size: 18px; line-height: 24px; }
}

/* ---- 첫 화면(넓게) · 상단 상태 띠 · 영문 작업 이름 ---- */
.page.wide { max-width: 1440px; padding-left: 24px; padding-right: 24px; }
.wide-page .topbar-inner, .wide-page .notice-bar { max-width: 1440px; padding-left: 24px; padding-right: 24px; }
.home-head h1 { margin-bottom: 4px; }
.home-section { display: flex; align-items: center; gap: 8px; margin: 28px 0 0; font-size: 1rem; }
.home-count { min-width: 22px; padding: 0 7px; border-radius: 999px; background: #e3e8ef; color: var(--ink-soft);
  font-size: 0.75rem; line-height: 20px; text-align: center; font-weight: 600; }
.home .template-grid { grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); margin-top: 12px; }
.template-card { gap: 4px; }
.template-kicker { padding: 12px 18px 0; color: #36618e; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase; line-height: 1.4; }
.template-card .template-title { padding-top: 0; }
.template-card.blank .template-kicker { padding-top: 0; }
.template-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: auto; padding: 10px 18px 0; }
.template-tag { padding: 1px 8px; border-radius: 6px; background: #eef1f6; color: var(--ink-soft); font-size: 0.75rem; font-weight: 500; }
.template-time { margin-left: auto; color: var(--ink-soft); font-size: 0.75rem; font-variant-numeric: tabular-nums; white-space: nowrap; }

.status { gap: 0; padding: 3px 4px 3px 3px; font-size: 0.8rem; }
.status > * + * { border-left: 1px solid var(--line); padding: 0 10px; }
.status .mode { color: var(--ink-soft); }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; margin-right: 6px;
  border-radius: 999px; background: #dff3e6; color: #1d6b3a; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; }
.status .status-badge + * { border-left: 0; padding-left: 4px; }
.status-gpu { font-weight: 600; font-variant-numeric: tabular-nums; }
.status-load { color: var(--ink); }
.status-open .dot { box-shadow: 0 0 0 0 rgba(47, 133, 90, 0.5); animation: live-pulse 2s ease-out infinite; }
.status-team .status-badge { background: #fbeccc; color: #7a4f06; }
.status-maintenance .status-badge, .status-offline .status-badge { background: #f9dede; color: #8c1d1d; }
@keyframes live-pulse { 0% { box-shadow: 0 0 0 0 rgba(47, 133, 90, 0.5); } 70%, 100% { box-shadow: 0 0 0 6px rgba(47, 133, 90, 0); } }
@media (max-width: 640px) {
  .status-gpu, .status .mode { display: none; }
}

.ed-title-box { display: grid; gap: 2px; }
.ed-kicker { margin: 0; color: var(--md-primary); font-size: 12px; line-height: 16px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
.ed-tech { font-size: 11px; line-height: 16px; font-weight: 500; letter-spacing: 0.5px; color: color-mix(in srgb, var(--on-c) 72%, transparent); }
.ed-tech.dark { display: block; color: var(--md-on-surface-variant); text-transform: uppercase; letter-spacing: 0.06em; }

.home-body { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 24px; }
.home-main { flex: 999 1 640px; min-width: 0; }
.home-side { flex: 1 1 280px; max-width: 360px; display: grid; gap: 16px; margin-top: 28px; }
.side-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.side-card h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 0.9rem; }
.side-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 0; }
.side-stats dt { color: var(--ink-soft); font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em; }
.side-stats dd { margin: 2px 0 0; font-size: 1.6rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; }
.side-stats small { margin-left: 2px; font-size: 0.8rem; font-weight: 500; color: var(--ink-soft); }
.side-models { list-style: none; margin: 0; padding: 0; display: grid; }
.side-model { padding: 10px 0; border-top: 1px solid var(--line); }
.side-model:first-child { border-top: 0; padding-top: 0; }
.side-model-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 0.9rem; }
.side-model-head .muted { font-size: 0.75rem; }
.side-model-tasks { margin: 2px 0 0; color: #36618e; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.side-model-tiers { margin: 2px 0 0; color: var(--ink-soft); font-size: 0.75rem; }
@media (max-width: 720px) { .home-side { max-width: none; margin-top: 0; } }

/* 지우기(휴지통) · 되돌리기 스낵바(MD3 snackbar) */
.ed-del { color: color-mix(in srgb, var(--on-c, var(--md-on-surface)) 78%, transparent); }
.ed-del:hover { color: var(--md-error); background: color-mix(in srgb, var(--md-error) 10%, transparent); }
.ed-del.small { width: 32px; height: 32px; }
.ed-photo .ed-del { color: var(--md-on-surface-variant); }
.nd-head .ed-del { margin-left: auto; margin-right: 4px; }
.nd-head .ed-del:hover { background: color-mix(in srgb, var(--md-error) 12%, transparent); }
.ed-outlined.danger { align-self: flex-start; color: var(--md-error); box-shadow: inset 0 0 0 1px var(--md-outline-variant); }
.ed-outlined.danger:hover { background: color-mix(in srgb, var(--md-error) 8%, transparent); }
.ed-snack { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; display: flex; align-items: center;
  gap: 8px; min-height: 48px; max-width: calc(100% - 32px); padding: 0 8px 0 16px; border-radius: 4px; background: #2e3135;
  color: #eff0f7; font-size: 14px; line-height: 20px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3), 0 4px 8px 3px rgba(0, 0, 0, 0.15); }
.ed-snack-btn { min-height: 40px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: #a0cafd;
  font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.ed-snack-btn:hover { background: rgba(160, 202, 253, 0.12); }
.ed-snack-btn:focus-visible { outline: 2px solid #a0cafd; outline-offset: 2px; }

/* ---- 상단 상태(누르면 풀이) ---- */
.status { padding: 0; background: none; }
.status-btn { display: inline-flex; align-items: center; gap: 0; min-height: 36px; padding: 2px 10px 2px 3px; border: 1px solid var(--line);
  border-radius: 999px; background: var(--accent-soft); color: var(--ink); font: inherit; font-size: 0.8rem; cursor: pointer; }
.status-btn:hover { border-color: #b8c3cf; background: #dfe8f2; }
.status-btn.static { cursor: default; }
.status-btn > * + * { border-left: 1px solid var(--line); padding: 0 10px; }
.status-btn .status-badge + * { border-left: 0; padding-left: 4px; }
.status-btn .status-caret { border-left: 0; padding: 0 0 0 2px; color: var(--ink-soft); font-size: 0.7rem; }
.status-class { font-weight: 600; color: #7a4f06; }
.status-team .status-btn { background: var(--warn-soft); }
.status-maintenance .status-btn, .status-offline .status-btn { background: var(--danger-soft); }
.status-pop { position: absolute; z-index: 40; width: min(360px, calc(100vw - 16px)); padding: 8px 18px; border-radius: 12px;
  background: var(--surface); box-shadow: 0 12px 32px rgba(31, 41, 51, 0.2); font-size: 0.85rem; }
.status-pop dl { margin: 0; }
.status-row { display: grid; grid-template-columns: 88px 1fr; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.status-row:first-child { border-top: 0; }
.status-row dt { color: var(--ink-soft); font-weight: 600; }
.status-row dd { margin: 0; display: grid; gap: 2px; }
.status-row dd span { color: var(--ink-soft); font-size: 0.8rem; line-height: 1.5; }
@media (max-width: 640px) { .status-btn .status-gpu { display: none; } }

/* ---- 편집기 상단 앱 바 ---- */
.ed-appbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 16px; }
.ed-back { width: 48px; height: 48px; font-size: 22px; color: var(--md-on-surface); background: var(--md-surface-lowest);
  box-shadow: inset 0 0 0 1px var(--md-outline-variant); align-self: flex-start; }
.ed-back:hover { background: color-mix(in srgb, var(--md-on-surface) 8%, var(--md-surface-lowest)); }
.ed-title-box { display: grid; gap: 2px; min-width: 0; }
.ed-overline { margin: 0; font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0.5px; color: var(--md-on-surface-variant); }
.ed .ed-title { font-size: 24px; line-height: 32px; font-weight: 600; color: var(--md-on-surface); }
.ed-flow { margin: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; font-size: 13px; line-height: 18px;
  color: var(--md-on-surface-variant); }
.ed-flow-label { font-size: 11px; font-weight: 600; letter-spacing: 0.5px; padding: 1px 8px; border-radius: 4px;
  background: var(--md-surface-high); color: var(--md-on-surface-variant); }
.ed-more { width: 48px; height: 48px; font-size: 22px; color: var(--md-on-surface-variant); }
.ed-pop .ed-pop-title { display: block; font-size: 14px; font-weight: 500; color: var(--md-on-surface); }
.ed-pop .ed-pop-sub { display: block; font-size: 12px; font-weight: 400; color: var(--md-on-surface-variant); }
.ed-pop button { min-height: 56px; padding: 6px 16px; }
.ed-pop { min-width: 260px; }

/* ---- 편집기 아래 실행 바(MD3 bottom app bar) ---- */
.ed { --cv-h: clamp(460px, calc(100vh - 330px), 900px); }
.ed-runbar { position: sticky; bottom: 0; z-index: 5; margin-top: 16px; padding: 14px 20px; border-radius: var(--md-shape-lg);
  background: var(--md-surface-container); box-shadow: var(--md-elev-2); }
.ed-runbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; }
.ed-stat { display: grid; gap: 2px; }
.ed-stat.grow { flex: 1; min-width: 260px; }
.ed-stat-label { font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0.4px; color: var(--md-on-surface-variant); }
.ed-stat-value { font-size: 24px; line-height: 32px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--md-on-surface); }
.ed-stat-note { font-size: 12px; line-height: 16px; color: var(--md-on-surface-variant); }
.ed-order { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 14px; line-height: 20px; color: var(--md-on-surface); }
.ed-order-item { font-weight: 500; }
.ed-order-time { font-weight: 400; color: var(--md-on-surface-variant); font-variant-numeric: tabular-nums; }
.ed-order-sep { color: var(--md-outline); }
.ed-run { display: inline-flex; align-items: center; gap: 12px; min-height: 56px; padding: 0 32px 0 24px; border: 0; border-radius: var(--md-shape-lg);
  background: var(--md-primary); color: var(--md-on-primary); font: inherit; font-size: 16px; line-height: 24px; font-weight: 600;
  letter-spacing: 0.15px; cursor: pointer; box-shadow: var(--md-elev-1); }
.ed-run:hover { box-shadow: var(--md-elev-2); background: color-mix(in srgb, var(--md-primary) 90%, var(--md-on-primary)); }
.ed-run:disabled { background: color-mix(in srgb, var(--md-on-surface) 12%, transparent); color: color-mix(in srgb, var(--md-on-surface) 38%, transparent); box-shadow: none; cursor: default; }
.ed-run-icon { width: 0; height: 0; border-left: 12px solid currentColor; border-top: 8px solid transparent; border-bottom: 8px solid transparent; }
.ed-runbar .ed-run-msg:empty { display: none; }
@media (max-width: 720px) {
  .ed-runbar { margin: 12px -16px 0; border-radius: var(--md-shape-lg) var(--md-shape-lg) 0 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .ed-run { width: 100%; justify-content: center; }
  .ed-stat-note { display: none; }
  .ed .ed-title { font-size: 20px; line-height: 28px; }
}

/* ---- 놓인 블록 옮기기 · 머리 오른쪽 위 고정 동작 · 구멍 이름표 · 촬영/불러오기 ---- */
.cv-world > .cv-item { width: max-content; }
.ed-block { position: relative; }
.ed-block-head { padding-right: 44px; margin-right: 0; cursor: grab; }
.ed-block-head.two { padding-right: 88px; }
.ed-list .ed-block-head { cursor: default; }
.ed-head-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 0; }
.ed-block.nested .ed-head-actions { top: 6px; right: 6px; }
.cv-item .ed-block-head, .cv-item .ed-grip { touch-action: none; }
.ed-grip { cursor: grab; touch-action: none; }
.ed-lifted { opacity: 0.55; }
.cv-item.ed-lifted { opacity: 0.85; pointer-events: none; z-index: 3; filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.18)); }
.ed-ghost { position: absolute; left: 0; top: 0; z-index: 6; margin: 0; pointer-events: none; transform-origin: 0 0; opacity: 0.92;
  box-shadow: var(--md-elev-3); }
.dragging, .dragging * { cursor: grabbing !important; }
.ed-hole { display: inline-flex; align-items: center; gap: 8px; }
.ed-hole-tag { padding: 0 6px; border-radius: 4px; font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: 0.3px;
  background: color-mix(in srgb, var(--on-c) 10%, transparent); color: var(--on-c); }
.ed-hole-tag.req { background: var(--on-c); color: var(--c); }
.ed-photo-row.one { grid-template-columns: 1fr; }
.ed-photo-btn { display: grid; gap: 2px; place-content: center; padding: 10px 12px; }
.ed-photo-btn-title { font-size: 16px; font-weight: 600; }
.ed-photo-btn-sub { font-size: 12px; font-weight: 400; color: var(--md-on-surface-variant); }
.cv-world .ed-block:not(.nested) { width: max-content; min-width: 600px; max-width: 1100px; }
.cv-world .ed-block.nested { max-width: 760px; }

/* 품질 칩: [품질 | Standard · 예상 약 24초 ▾] — 단계가 하나뿐이면 단추가 아닌 '예상 약 12초' 글자 */
.ed-quality { gap: 6px; padding: 0 10px 0 4px; }
.ed-quality-key { padding: 2px 8px; border-radius: 6px; background: var(--md-surface-high); color: var(--md-on-surface-variant);
  font-size: 11px; line-height: 16px; font-weight: 600; letter-spacing: 0.3px; }
.ed-quality-caret { font-size: 10px; color: var(--md-on-surface-variant); }
.ed-estimate { display: inline-flex; align-items: center; min-height: 32px; padding: 0 4px; font-size: 13px;
  color: color-mix(in srgb, var(--on-c, var(--md-on-surface)) 80%, transparent); font-variant-numeric: tabular-nums; }
.ed-estimate .ed-quality-time { color: inherit; }
.sheet-title-box { display: grid; gap: 2px; text-align: center; }
.sheet-title-box h2 { margin: 0; }
.sheet-sub { margin: 0; font-size: 0.8rem; color: var(--ink-soft); }
.sheet-explain { margin: 0; padding: 0 4px; font-size: 0.85rem; line-height: 1.5; color: var(--ink-soft); }

/* ---- 끌어 놓기 표시: 놓을 수 있는 자리 = 움직이는 점선, 놓을 곳 위 = 커지고 빛남 + '여기에 놓기', 놓은 뒤 = 튀어 들어옴 ---- */
.ed-hole, .ed-stack-end, .ed-gap { position: relative; transition: transform 0.15s ease, background-color 0.15s ease,
  border-color 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease; }
.dragging .ed-hole:not(.drop-can), .dragging .ed-stack-end:not(.drop-can) { opacity: 0.35; }
.dragging .ed-gap:not(.drop-can) { height: 6px; border: 0; }
.drop-can.ed-hole, .drop-can.ed-stack-end, .drop-can.ed-gap {
  border: 2px solid transparent;
  background:
    linear-gradient(color-mix(in srgb, var(--md-primary) 8%, var(--md-surface-lowest)), color-mix(in srgb, var(--md-primary) 8%, var(--md-surface-lowest))) padding-box,
    repeating-linear-gradient(90deg, var(--md-primary) 0 8px, transparent 8px 14px) border-box;
  background-size: auto, 28px 100%;
  color: var(--md-primary);
  animation: drop-march 0.7s linear infinite;
}
.drop-can.ed-gap { height: 24px; }
.drop-ok.ed-hole, .drop-ok.ed-stack-end, .drop-ok.ed-gap, .ed-hole.drop-ok, .ed-stack-end.drop-ok, .ed-gap.drop-ok {
  transform: scale(1.06);
  border: 2px solid var(--md-primary);
  background: color-mix(in srgb, var(--md-primary) 22%, var(--md-surface-lowest));
  color: var(--md-on-primary-container);
  font-weight: 600;
  animation: drop-pulse 0.9s ease-out infinite;
}
.drop-ok.ed-gap { height: 44px; }
.drop-ok::after { content: '여기에 놓기'; position: absolute; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  padding: 2px 10px; border-radius: 999px; background: var(--md-primary); color: var(--md-on-primary); font-size: 12px; line-height: 18px;
  font-weight: 600; white-space: nowrap; pointer-events: none; box-shadow: var(--md-elev-1); }
.ed-landed { animation: drop-land 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3); }
@keyframes drop-march { to { background-position: 0 0, 28px 0; } }
@keyframes drop-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--md-primary) 45%, transparent); }
  100% { box-shadow: 0 0 0 12px color-mix(in srgb, var(--md-primary) 0%, transparent); }
}
@keyframes drop-land {
  0% { transform: scale(0.9); box-shadow: 0 0 0 6px color-mix(in srgb, var(--md-primary) 50%, transparent); }
  60% { transform: scale(1.02); }
  100% { transform: scale(1); }
}
@media (prefers-reduced-motion: reduce) {
  .drop-can.ed-hole, .drop-can.ed-stack-end, .drop-can.ed-gap, .drop-ok.ed-hole, .drop-ok.ed-stack-end, .drop-ok.ed-gap { animation: none; }
  .drop-ok.ed-hole, .drop-ok.ed-stack-end, .drop-ok.ed-gap { transform: none; }
  .ed-landed { animation: none; }
}
/* 끄는 블록이 놓을 자리를 가리지 않게: 자리는 끄는 블록 위로, 끄는 블록은 더 투명하게 */
.drop-can.ed-hole, .drop-can.ed-stack-end, .drop-can.ed-gap { z-index: 4; }
.drop-ok.ed-hole, .drop-ok.ed-stack-end, .drop-ok.ed-gap { z-index: 5; }
.cv-item.ed-lifted { opacity: 0.5; }
.ed-ghost { opacity: 0.6; }

/* ==== 글자 · 간격 체계: Pretendard · 8의 배수 · 자간 −3% ==========================================
   글꼴은 web/fonts 에 함께 둔다(외부 주소 없음 — SIL OFL 1.1, fonts/LICENSE-Pretendard.txt).
   줄 높이와 간격은 8 의 배수(16·24·32·40·48·56), 아주 작은 글자만 16. 자간은 기본 −0.03em,
   영문 대문자 이름표(작업 흐름·상태 배지)만 +0.04em(대문자는 좁히면 붙어 보인다). */
:root {
  --font: "Pretendard Variable", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, "Apple SD Gothic Neo",
    "Malgun Gothic", "Noto Sans KR", "Segoe UI", sans-serif;
  --track: -0.03em;
  --track-caps: 0.04em;
  /* 글자 단계: 크기 / 줄 높이 / 굵기 */
  --t-display: 600 32px/40px var(--font);
  --t-title: 600 24px/32px var(--font);
  --t-title-s: 600 18px/24px var(--font);
  --t-body-l: 400 16px/24px var(--font);
  --t-body: 400 14px/24px var(--font);
  --t-label: 500 14px/24px var(--font);
  --t-caption: 500 12px/16px var(--font);
}
body { letter-spacing: var(--track); font-size: 16px; line-height: 24px; }
button, input, select, textarea { letter-spacing: inherit; }
h1 { font: var(--t-display); letter-spacing: var(--track); margin: 0; }
h2 { font: var(--t-title-s); letter-spacing: var(--track); margin: 0; }
p { margin: 0; }

/* 첫 화면 */
.home-head { display: grid; gap: 8px; padding: 8px 0 0; }
.home-head .muted { font: var(--t-body-l); letter-spacing: var(--track); }
.home-section { margin: 32px 0 0; font: var(--t-title-s); letter-spacing: var(--track); gap: 8px; }
.home-count { line-height: 24px; min-width: 24px; padding: 0 8px; font-size: 12px; }
.home .template-grid { gap: 16px; margin-top: 16px; }
.template-card { gap: 8px; padding: 0 0 16px; }
.template-kicker { padding: 16px 16px 0; font: 600 12px/16px var(--font); letter-spacing: var(--track-caps); }
.template-card .template-title, .template-title { padding: 0 16px; font: var(--t-title-s); letter-spacing: var(--track); }
.template-desc { padding: 0 16px; font: var(--t-body); letter-spacing: var(--track); }
.template-meta { padding: 8px 16px 0; gap: 8px; }
.template-tag, .template-time { font: var(--t-caption); letter-spacing: var(--track); }
.template-tag { padding: 0 8px; line-height: 24px; }
.home-body { gap: 24px; }
.home-side { margin-top: 32px; gap: 16px; }
.side-card { padding: 16px 24px 24px; }
.side-card h2 { margin: 0 0 8px; font: 600 16px/24px var(--font); letter-spacing: var(--track); }
.side-stats { gap: 16px; }
.side-stats dt { font: var(--t-caption); letter-spacing: var(--track); }
.side-stats dd { margin: 0; font: 700 32px/40px var(--font); letter-spacing: var(--track); }
.side-model { padding: 8px 0; }
.side-model-head { font: 600 14px/24px var(--font); letter-spacing: var(--track); }
.side-model-tasks { margin: 0; font: 600 12px/16px var(--font); letter-spacing: var(--track-caps); }
.side-model-tiers { margin: 0; font: var(--t-caption); letter-spacing: var(--track); }

/* 상단 상태 */
.status-btn { min-height: 40px; padding: 4px 16px 4px 4px; font: var(--t-caption); letter-spacing: var(--track); }
.status-btn > * + * { padding: 0 8px; }
.status-badge { padding: 0 8px; line-height: 24px; font: 700 11px/24px var(--font); letter-spacing: var(--track-caps); }
.status-pop { padding: 8px 24px; font: var(--t-body); letter-spacing: var(--track); }
.status-row { grid-template-columns: 96px 1fr; gap: 8px 16px; padding: 16px 0; }
.status-row dd span { font: 400 12px/16px var(--font); letter-spacing: var(--track); }

/* 편집기 상단 앱 바: 이름표 12/16 → 제목 24/32 → (8) → 작업 흐름 14/24  = 80px, 뒤로 단추 48px 와 위 기준선 맞춤 */
.ed-appbar { align-items: flex-start; gap: 16px; margin-bottom: 24px; }
.ed-back { margin-top: 8px; }
.ed-title-box { gap: 0; }
.ed-overline { font: var(--t-caption); letter-spacing: var(--track); }
.ed .ed-title { font: var(--t-title); letter-spacing: var(--track); }
.ed-flow { margin-top: 8px; gap: 8px; align-items: center; font: var(--t-body); letter-spacing: var(--track); }
.ed-flow-label { padding: 0 8px; border-radius: 4px; font: 600 12px/24px var(--font); letter-spacing: var(--track); }
.ed-appbar .ed-segs, .ed-appbar .ed-more { margin-top: 8px; }
.ed-seg { min-height: 48px; padding: 0 16px; font: var(--t-label); letter-spacing: var(--track); }

/* 편집기 몸통 · 블록 */
.ed { font: var(--t-body); letter-spacing: var(--track); }
.ed-palette { padding: 16px; gap: 16px; }
.ed-pal-title { font: var(--t-title-s); letter-spacing: var(--track); }
.ed-pal-label { font: var(--t-caption); letter-spacing: var(--track); }
.ed-pal-item { min-height: 40px; padding: 0 16px; font: var(--t-label); letter-spacing: var(--track); }
.ed-pal-help { gap: 8px; font: var(--t-caption); letter-spacing: var(--track); }
.ed-block { gap: 8px; padding: 16px; }
.ed-block.nested { padding: 8px 16px 16px; }
.ed-block-head { gap: 8px; min-height: 40px; }
.ed-block-name { font: 600 16px/24px var(--font); letter-spacing: var(--track); }
.ed-tech { font: 500 12px/16px var(--font); letter-spacing: var(--track); }
.ed-head-actions { top: 12px; right: 8px; }
.ed-block.nested .ed-head-actions { top: 4px; right: 8px; }
.ed-row { gap: 8px 16px; min-height: 40px; }
.ed .ed-label { min-width: 64px; font: var(--t-caption); letter-spacing: var(--track); }
.ed .ed-input { min-height: 40px; padding: 8px 16px; font: var(--t-body); letter-spacing: var(--track); }
.ed textarea.ed-input { padding: 8px 16px; }
.ed .ed-model { min-height: 32px; font: var(--t-caption); letter-spacing: var(--track); }
.ed-model-name, .ed-estimate { font: var(--t-caption); letter-spacing: var(--track); }
.ed-quality { min-height: 32px; font: 500 12px/16px var(--font); letter-spacing: var(--track); }
.ed-quality-label { font-weight: 600; }
.ed-hole { min-height: 40px; padding: 0 16px; font: var(--t-label); letter-spacing: var(--track); }
.ed-hole-tag { font: 600 11px/16px var(--font); letter-spacing: var(--track); }
.ed-ref, .ed-photo-pick { font: var(--t-label); letter-spacing: var(--track); }
.ed-stack-end { min-height: 48px; padding: 0 16px; margin-top: 8px; font: var(--t-label); letter-spacing: var(--track); }
.ed-collapsed .ed-block-name { font: 600 14px/24px var(--font); }
.ed-collapsed-sub { font: var(--t-caption); letter-spacing: var(--track); }
.cv-zoom-text, .cv-fit { font: var(--t-caption); letter-spacing: var(--track); }
.cv-fit { font-size: 14px; }
.cv-controls { padding: 4px 8px; }

/* 아래 실행 바: 이름표 12/16 · 값 24/32 · 안내 12/16 = 64px, 실행 단추 56px */
.ed-runbar { padding: 16px 24px; margin-top: 16px; }
.ed-runbar-row { gap: 16px 32px; }
.ed-stat { gap: 0; }
.ed-stat-label, .ed-stat-note { font: var(--t-caption); letter-spacing: var(--track); }
.ed-stat-value { font: 700 24px/32px var(--font); letter-spacing: var(--track); }
.ed-order { gap: 0 8px; font: 500 14px/32px var(--font); letter-spacing: var(--track); }
.ed-run { min-height: 56px; padding: 0 32px 0 24px; gap: 16px; font: 600 16px/24px var(--font); letter-spacing: var(--track); }

/* 시트 · 메뉴 · 스낵바 */
.sheet-title-box h2 { font: var(--t-title-s); letter-spacing: var(--track); }
.sheet-sub, .sheet-explain, .sheet-row-note, .sheet-row-time { font: 400 12px/16px var(--font); letter-spacing: var(--track); }
.sheet-explain { font-size: 14px; line-height: 24px; }
.sheet-row-label, .ed-pop .ed-pop-title { font: 600 16px/24px var(--font); letter-spacing: var(--track); }
.ed-pop .ed-pop-sub { font: var(--t-caption); letter-spacing: var(--track); }
.ed-pop button { min-height: 56px; padding: 8px 16px; }
.ed-snack { min-height: 48px; padding: 0 8px 0 16px; font: var(--t-body); letter-spacing: var(--track); }
@media (max-width: 720px) {
  .ed .ed-title { font: 600 20px/32px var(--font); letter-spacing: var(--track); }
  h1 { font: 600 24px/32px var(--font); letter-spacing: var(--track); }
}

/* ---- GPU 사용 현황(상태 풀이 · 첫 화면) ---- */
.status-pop-title { margin: 8px 0 0; padding-top: 16px; border-top: 1px solid var(--line); font: 600 14px/24px var(--font); letter-spacing: var(--track); }
.status-gpu-box { padding: 8px 0 16px; }
.side-live { margin-left: auto; font: 500 12px/16px var(--font); color: var(--ink-soft); }
.gpu-panel { display: grid; gap: 8px; }
.gpu-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.gpu-name { font: 600 14px/24px var(--font); letter-spacing: var(--track); }
.gpu-meta { font: 500 12px/16px var(--font); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.gpu-vram-label { display: flex; align-items: baseline; gap: 8px; font: 500 12px/16px var(--font); color: var(--ink-soft); }
.gpu-vram-label strong { color: var(--ink); font: 700 16px/24px var(--font); letter-spacing: var(--track); font-variant-numeric: tabular-nums; }
.gpu-free { margin-left: auto; font-variant-numeric: tabular-nums; }
.gpu-bar { display: flex; height: 16px; border-radius: 8px; overflow: hidden; background: #e3e8ef; }
.gpu-seg { height: 100%; }
.gpu-seg + .gpu-seg { box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.7); }
.kind-student { background: #36618e; }
.kind-team { background: #c58a1a; }
.kind-idle { background: #9aa5b1; }
.gpu-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.gpu-list li { display: grid; grid-template-columns: 8px 32px 1fr auto; align-items: center; gap: 8px; min-height: 32px;
  border-top: 1px solid var(--line); font: 400 12px/16px var(--font); letter-spacing: var(--track); }
.gpu-list li:first-child { border-top: 0; }
.gpu-dot { width: 8px; height: 8px; border-radius: 4px; }
.gpu-kind { font-weight: 600; color: var(--ink-soft); }
.gpu-gib { font-weight: 600; font-variant-numeric: tabular-nums; }
.gpu-note, .gpu-unknown { margin: 0; font: 400 12px/16px var(--font); color: var(--ink-soft); letter-spacing: var(--track); }

/* ---- 크기 조절 손잡이(스크립트·노드 오른쪽 가장자리) ---- */
.ed-script { position: absolute; }
.ed-list .ed-script { position: static; }
.ed-resize { position: absolute; top: 8px; bottom: 8px; right: -8px; width: 16px; cursor: ew-resize; touch-action: none; z-index: 2; }
.ed-resize::after { content: ''; position: absolute; left: 6px; top: 50%; width: 4px; height: 40px; transform: translateY(-50%);
  border-radius: 2px; background: var(--md-outline-variant); opacity: 0; transition: opacity 0.15s ease; }
.ed-script:hover > .ed-resize::after, .nd-node:hover > .ed-resize::after, .resizing .ed-resize::after { opacity: 1; }
.ed-resize:hover::after { background: var(--md-primary); }
.resizing, .resizing * { cursor: ew-resize !important; user-select: none; }
.ed-script.sized > .ed-block, .ed-script.sized > .ed-stack-end, .ed-script.sized > .ed-gap { width: 100%; min-width: 0; max-width: none; }
.ed-block.nested { flex: 1 1 auto; }
.nd-node.sized { max-width: none; }
.ed-list .ed-resize { display: none; }
.cv-world > .nd-node { width: 240px; }   /* 노드 기본 폭(손잡이로 200–560) — '내용만큼' 규칙보다 앞선다 */

/* ---- 첫 화면: 빠른 시작 | 빈 레시피 두 칸(오른쪽 열과 높이를 맞춰 아래가 비지 않게) · 추천 레시피 창 ---- */
.home-body { align-items: stretch; margin-top: 32px; }
.home-main { display: flex; flex-direction: column; gap: 32px; }
.home-side { margin-top: 0; align-content: start; }
.start-grid { flex: 1; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; min-height: 480px; }
.start-tile { display: flex; flex-direction: column; min-height: 0; padding: 0; overflow: hidden; text-align: left;
  border: 1px solid var(--line); border-radius: 24px; background: var(--surface); color: inherit; font: inherit;
  cursor: pointer; box-shadow: var(--shadow); transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease; }
.start-tile:hover { transform: translateY(-2px); border-color: #c3ccd6;
  box-shadow: 0 2px 4px rgba(31, 41, 51, 0.06), 0 12px 32px rgba(31, 41, 51, 0.10); }
.start-tile:focus-visible { outline: 3px solid rgba(61, 106, 153, 0.35); outline-offset: 2px; }
.start-art { position: relative; flex: 1; min-height: 200px; display: grid; place-items: center; overflow: hidden; }
.start-text { display: grid; gap: 8px; padding: 24px; border-top: 1px solid var(--line); }
.start-kicker { margin: 0; color: #36618e; font: 600 12px/16px var(--font); letter-spacing: var(--track-caps); text-transform: uppercase; }
.start-title { font: var(--t-title); letter-spacing: var(--track); }
.start-desc { color: var(--ink-soft); font: var(--t-body-l); letter-spacing: var(--track); }
.start-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.start-meta { color: var(--ink-soft); font: var(--t-caption); letter-spacing: var(--track); font-variant-numeric: tabular-nums; }
.start-cta { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px 0 24px; border-radius: 999px;
  font: 600 14px/24px var(--font); letter-spacing: var(--track); }
.start-cta span { font-size: 20px; line-height: 1; transition: transform 0.15s ease; }
.start-tile:hover .start-cta span { transform: translateX(3px); }

/* 빠른 시작: 강조(채운 단추) · 추천 레시피 썸네일 세 장을 부채꼴로 */
.start-quick .start-art { background: var(--accent-soft); }
.start-quick .start-art img { position: absolute; width: 36%; max-width: 260px; aspect-ratio: 16 / 10; object-fit: cover;
  border-radius: 16px; background: #fff; border: 1px solid rgba(31, 41, 51, 0.08);
  box-shadow: 0 8px 24px rgba(31, 41, 51, 0.14); transition: transform 0.25s ease; }
.start-quick .start-art img:nth-child(1) { transform: translateX(-72%) rotate(-7deg); }
.start-quick .start-art img:nth-child(2) { transform: translateX(72%) rotate(7deg); }
.start-quick .start-art img:nth-child(3) { z-index: 1; transform: translateY(-4%); }
.start-quick:hover .start-art img:nth-child(1) { transform: translateX(-80%) rotate(-9deg); }
.start-quick:hover .start-art img:nth-child(2) { transform: translateX(80%) rotate(9deg); }
.start-quick:hover .start-art img:nth-child(3) { transform: translateY(-8%); }
.start-quick .start-cta { background: var(--accent); color: var(--accent-ink); }

/* 빈 레시피: 무채색 · 점 격자 캔버스 위 빈 블록 자리 */
.start-blank .start-art { background-color: #f7f9fb;
  background-image: radial-gradient(circle, #cfd7e0 1px, transparent 1.5px); background-size: 16px 16px; }
.start-blank .ghost { position: absolute; height: 48px; border: 2px dashed #c3ccd6; border-radius: 12px; background: rgba(255, 255, 255, 0.6); }
.start-blank .g1 { width: 38%; top: 18%; left: 10%; }
.start-blank .g2 { width: 26%; top: calc(50% - 24px); left: 8%; }
.start-blank .g3 { width: 36%; bottom: 16%; right: 10%; }
.start-plus { z-index: 1; display: grid; place-items: center; width: 64px; height: 64px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow);
  color: var(--ink); font: 300 32px/1 var(--font); transition: transform 0.15s ease; }
.start-blank:hover .start-plus { transform: scale(1.06); }
.start-blank .start-cta { border: 1px solid #c3ccd6; color: var(--ink); }

/* 추천 레시피 창 */
.overlay.picker-overlay { z-index: 30; }
.modal.picker { width: min(1040px, 100%); max-height: calc(100dvh - 32px); overflow: auto; padding: 24px; border-radius: 28px;
  display: grid; gap: 24px; background: var(--bg); }
.picker-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.picker-head > div { display: grid; gap: 8px; }
.picker-head h2 { margin: 0; font: var(--t-title); letter-spacing: var(--track); }
.picker-head .muted { font: var(--t-body); letter-spacing: var(--track); }
.picker-grid { margin: 0; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.picker-grid .template-card { padding-bottom: 16px; }

@media (max-width: 720px) {
  .start-grid { grid-template-columns: 1fr; min-height: 0; }
  .start-art { min-height: 160px; flex: none; height: 160px; }
  .start-text { padding: 16px; }
  .overlay.picker-overlay { place-items: end center; padding: 0; }
  .modal.picker { border-radius: 24px 24px 0 0; max-height: 88dvh; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
  .picker-grid { grid-template-columns: 1fr; gap: 8px; }
  .start-quick .start-art img { width: 30%; }
  .start-blank .g2 { display: none; }
  /* 폰: 추천 레시피는 썸네일 왼쪽 · 글 오른쪽의 짧은 목록 */
  .picker-grid .template-card { display: grid; grid-template-columns: 88px minmax(0, 1fr); column-gap: 16px; row-gap: 4px;
    align-items: start; padding: 16px; }
  .picker-grid .template-card img { grid-row: 1 / span 4; width: 88px; height: 88px; aspect-ratio: 1; border-radius: 12px; object-fit: contain; }
  .picker-grid .template-card > span { padding: 0; }
  .picker-grid .template-card .template-title { font: 600 16px/24px var(--font); letter-spacing: var(--track); }
  .picker-grid .template-desc { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .picker-grid .template-meta { margin-top: 4px; }
}

/* ---- 잡기 · 들어 올리기 · 내려놓기(블록 빈 곳 어디든 잡는다) ----
   올려 두면 살짝 떠오르고(그림자 + 손잡이 진하게), 누르면 눌리고, 끌면 들려서 기울고, 놓으면 내려앉는다.
   transform 은 캔버스 확대·복제본 위치에 쓰이므로 움직임은 따로 쓰는 scale·rotate·translate 속성으로만. */
.cv-world .ed-block, .cv-world .ed-photo { cursor: grab; touch-action: none;
  transition: box-shadow 0.18s ease, scale 0.12s ease, translate 0.18s ease; }
.cv-world .ed-block :is(input, textarea) { cursor: text; }
.cv-world .ed-block :is(button, select), .cv-world .ed-photo button:not([data-grab]) { cursor: pointer; }
.cv-world .ed-photo .ed-photo-pick { cursor: grab; }
.cv-world .ed-block .ed-resize { cursor: ew-resize; }
.cv-world .ed-block:hover:not(:has(.ed-block:hover, .ed-photo:hover)):not(.ed-lifted),
.cv-world .ed-photo:hover:not(.ed-lifted) {
  translate: 0 -1px; box-shadow: 0 0 0 1px color-mix(in srgb, var(--md-primary) 28%, transparent), var(--md-elev-2); }
.cv-world .ed-block:hover:not(:has(.ed-block:hover, .ed-photo:hover)) > .ed-block-head .ed-grip,
.cv-world .ed-photo:hover > .ed-grip { color: var(--md-primary); }
.ed-grip { transition: color 0.15s ease; }
.nd-node { transition: box-shadow 0.18s ease, scale 0.12s ease; }
.nd-node:hover:not(.nd-moving) { box-shadow: 0 0 0 1px color-mix(in srgb, var(--md-primary) 28%, transparent), var(--md-elev-2); }
.nd-node.selected:hover { box-shadow: 0 0 0 2px var(--md-primary), var(--md-elev-2); }

/* 누른 순간: 손가락에 눌린 듯 살짝 작아진다 */
.ed-pressed { scale: 0.985; box-shadow: 0 0 0 2px color-mix(in srgb, var(--md-primary) 45%, transparent), var(--md-elev-1) !important; }
.cv-item.ed-script.ed-pressed .ed-block:not(.nested) { box-shadow: 0 0 0 2px color-mix(in srgb, var(--md-primary) 45%, transparent), var(--md-elev-1); }
.cv-item.ed-script.ed-pressed { box-shadow: none !important; }

/* 끄는 중: 들려서 기울고 그림자가 깊어진다(맨 위 스크립트 · 끼운 블록 복제본 · 노드) */
.cv-item.ed-lifted { scale: 1.02; rotate: -0.8deg; filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.22));
  animation: grab-lift 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.4); }
.cv-item.ed-lifted .ed-block:not(.nested) { box-shadow: 0 0 0 2px var(--md-primary); }
.ed-ghost { opacity: 0.78; rotate: -1.5deg; box-shadow: 0 0 0 2px var(--md-primary), 0 16px 32px rgba(0, 0, 0, 0.24);
  animation: grab-pop 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.4); }
.nd-node.nd-moving { z-index: 3; scale: 1.03; rotate: -0.6deg; cursor: grabbing;
  box-shadow: 0 0 0 2px var(--md-primary), 0 16px 32px rgba(0, 0, 0, 0.22); animation: grab-lift 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.4); }

/* 내려놓은 뒤: 살짝 튀었다가 제자리(구멍에 들어갈 때의 .ed-landed 보다 약하게) */
.ed-settled { animation: grab-settle 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2); }

@keyframes grab-lift { 0% { scale: 0.985; rotate: 0deg; } 60% { scale: 1.035; } 100% { scale: 1.02; rotate: -0.8deg; } }
@keyframes grab-pop { 0% { scale: 0.96; opacity: 0.3; } 100% { scale: 1; } }
@keyframes grab-settle { 0% { scale: 1.025; } 55% { scale: 0.992; } 100% { scale: 1; } }
@media (prefers-reduced-motion: reduce) {
  .cv-item.ed-lifted, .ed-ghost, .nd-node.nd-moving { rotate: none; animation: none; }
  .ed-settled { animation: none; }
  .cv-world .ed-block, .cv-world .ed-photo, .nd-node { transition: none; }
}

/* ---- 크기 조절: 오른쪽 가장자리(폭) · 아래 가장자리(높이) · 오른쪽 아래 모서리(둘 다) ----
   높이는 최소 높이 — 늘린 만큼 긴 글 칸(블록)·글 미리보기(노드)가 커진다. */
.ed-resize.x { top: 8px; bottom: 16px; right: -8px; width: 16px; height: auto; }
.ed-resize.y { top: auto; left: 8px; right: 16px; bottom: -8px; width: auto; height: 16px; cursor: ns-resize; }
.ed-resize.y::after { left: 50%; top: 6px; width: 40px; height: 4px; transform: translateX(-50%); }
.ed-resize.xy { top: auto; right: -8px; bottom: -8px; width: 24px; height: 24px; cursor: nwse-resize; z-index: 3; }
.ed-resize.xy::after { left: auto; top: auto; right: 8px; bottom: 8px; width: 10px; height: 10px; transform: none;
  border-radius: 0 0 4px 0; background: none; border-right: 3px solid var(--md-outline-variant); border-bottom: 3px solid var(--md-outline-variant); }
.ed-resize.xy:hover::after { background: none; border-color: var(--md-primary); }
.resizing.resize-ns, .resizing.resize-ns * { cursor: ns-resize !important; }
.resizing.resize-nwse, .resizing.resize-nwse * { cursor: nwse-resize !important; }

/* 블록 보기: 늘린 높이를 스크립트 안 블록들이 나눠 갖고, 블록 안에서는 긴 글 칸이 차지한다 */
.ed-script.tall { display: flex; flex-direction: column; align-items: flex-start; }
.ed-script.tall.sized { align-items: stretch; }
.ed-script.tall > .ed-block { flex: 1 1 auto; }
.ed-script.tall > .ed-block > .ed-row.grow:has(> textarea) { flex: 1 1 auto; align-items: stretch; }
.ed-script.tall > .ed-block > .ed-row.grow:has(> textarea) > .ed-label { align-self: flex-start; padding-top: 8px; }
.ed-script.tall > .ed-block > .ed-row.grow > textarea { min-height: 80px; resize: none; }

/* 노드 보기: 늘린 만큼 글 미리보기가 여러 줄로 */
.nd-node.tall { display: flex; flex-direction: column; }
.nd-node.tall .nd-text { flex: 1 1 auto; min-height: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 24px;
  padding-top: 6px; padding-bottom: 8px; overflow: hidden; text-overflow: clip; }

/* 노드: 오른쪽 폭 손잡이가 머리의 결과 점(출력 포트)을 덮지 않게 — 손잡이는 머리 아래부터, 포트는 손잡이보다 위 */
.nd-node > .ed-resize.x { top: 48px; }
.nd-node .nd-port { z-index: 4; }

/* ---- 넓은 화면: 브라우저 폭을 다 쓴다(첫 화면·편집기·실행 화면). 가입·안내 같은 글 화면은 읽기 좋은 폭 그대로 ---- */
.page.wide { max-width: none; padding-left: clamp(16px, 2.4vw, 48px); padding-right: clamp(16px, 2.4vw, 48px); }
.wide-page .topbar-inner, .wide-page .notice-bar { max-width: none; padding-left: clamp(16px, 2.4vw, 48px); padding-right: clamp(16px, 2.4vw, 48px); }
.page.wide .blocks { grid-template-columns: repeat(auto-fill, minmax(min(520px, 100%), 1fr)); align-items: start; }

/* ---- 오른쪽 사이드바(블록 꾸러미 · 노드 설정): 자리 · 폭 통일, 왼쪽 가장자리로 폭 조절 ---- */
.ed-palette, .nd-side { position: relative; flex: 0 0 var(--side-w, 300px); width: var(--side-w, 300px); max-width: none; min-width: 0;
  height: var(--cv-h); box-sizing: border-box; border-left: 1px solid var(--md-outline-variant); border-right: 0; }
.ed-side-resize { position: absolute; left: -6px; top: 0; bottom: 0; width: 12px; cursor: ew-resize; z-index: 6; touch-action: none; }
.ed-side-resize::after { content: ''; position: absolute; left: 4px; top: 50%; width: 4px; height: 48px; transform: translateY(-50%);
  border-radius: 2px; background: var(--md-outline-variant); opacity: 0; transition: opacity 0.15s ease, background-color 0.15s ease; }
.ed-palette:hover > .ed-side-resize::after, .nd-side:hover > .ed-side-resize::after, .side-resizing .ed-side-resize::after { opacity: 1; }
.ed-side-resize:hover::after, .side-resizing .ed-side-resize::after { background: var(--md-primary); }
.side-resizing, .side-resizing * { cursor: ew-resize !important; user-select: none; }

/* 노드 설정: 위 = 스크롤되는 내용(긴 글 칸이 남는 높이를 채운다), 아래 = 노드 지우기(늘 같은 자리) */
.nd-side { padding: 0; gap: 0; display: flex; flex-direction: column; }
.nd-side-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.nd-side-foot { flex: none; display: flex; padding: 16px 24px; border-top: 1px solid var(--md-outline-variant); background: var(--md-surface); }
.nd-side-foot .ed-outlined { flex: 1; }
.nd-side-scroll > * { flex-shrink: 0; }   /* 내용이 길면 줄이지 않고 스크롤 — 지우기 단추는 아래 그대로 */
.nd-side-scroll > .ed-row.grow:has(> textarea) { flex: 1 0 auto; flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
.nd-side-scroll > .ed-row.grow > textarea { flex: 1 1 auto; min-height: 120px; resize: none; }
.nd-side-section { display: grid; gap: 8px; padding-top: 16px; border-top: 1px solid var(--md-outline-variant); }
.nd-side-sub { margin: 0; font: 600 12px/16px var(--font); letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--md-on-surface-variant); }
.nd-side-dl { margin: 0; display: grid; gap: 8px; }
.nd-side-dl > div { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.nd-side-dl dt { font: 500 12px/16px var(--font); letter-spacing: var(--track); color: var(--md-on-surface-variant); }
.nd-side-dl dd { margin: 0; font: 400 14px/24px var(--font); letter-spacing: var(--track); color: var(--md-on-surface); overflow-wrap: anywhere; }
.nd-side-links { display: grid; gap: 4px; justify-items: start; }
.nd-side-link { padding: 0; border: 0; background: none; font: 500 14px/24px var(--font); letter-spacing: var(--track);
  color: var(--md-primary); cursor: pointer; text-align: left; }
.nd-side-link:hover { text-decoration: underline; }
.nd-side-list { display: grid; gap: 4px; }
.nd-side-item { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: 8px 12px; min-height: 48px;
  padding: 0 12px; border: 0; border-radius: var(--md-shape-sm); background: transparent; font: inherit; text-align: left; cursor: pointer; }
.nd-side-item:hover { background: color-mix(in srgb, var(--md-on-surface) 6%, transparent); }
.nd-side-item-name { font: 600 14px/24px var(--font); letter-spacing: var(--track); color: var(--md-on-surface); }
.nd-side-tips ul { margin: 0; padding-left: 18px; display: grid; gap: 8px; font: 400 13px/20px var(--font); letter-spacing: var(--track);
  color: var(--md-on-surface-variant); }

/* ---- 넣을 수 없는 곳: 끄는 동안 빨간 테두리 + '여기에는 넣을 수 없어요', 놓으면 대상은 흔들리고 끈 블록은 튕겨 돌아간다 ---- */
.ed-photo { position: relative; }
.cv-world .ed-block.drop-no, .cv-world .ed-photo.drop-no {
  box-shadow: 0 0 0 2px var(--md-error), 0 0 0 6px color-mix(in srgb, var(--md-error) 16%, transparent) !important;
  background-image: linear-gradient(color-mix(in srgb, var(--md-error) 6%, transparent), color-mix(in srgb, var(--md-error) 6%, transparent)); }
.cv-world .ed-block.drop-no::after, .cv-world .ed-photo.drop-no::after {
  content: '여기에는 넣을 수 없어요'; position: absolute; left: 50%; top: 0; transform: translate(-50%, -50%); z-index: 7;
  padding: 0 12px; border-radius: 999px; background: var(--md-error); color: var(--md-on-error, #fff);
  font: 600 12px/24px var(--font); letter-spacing: var(--track); white-space: nowrap; pointer-events: none; box-shadow: var(--md-elev-1); }
.dragging.drag-no, .dragging.drag-no * { cursor: not-allowed !important; }
.ed-refuse { animation: refuse-shake 0.42s cubic-bezier(0.36, 0.07, 0.19, 0.97); }
.ed-refuse.ed-block, .ed-refuse.ed-photo { box-shadow: 0 0 0 2px var(--md-error), var(--md-elev-1); }
.ed-bounce { transition: left 0.46s cubic-bezier(0.34, 1.56, 0.64, 1), top 0.46s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.2s ease; }
@keyframes refuse-shake {
  0%, 100% { translate: 0 0; }
  15% { translate: -7px 0; } 30% { translate: 6px 0; } 45% { translate: -5px 0; } 60% { translate: 4px 0; } 75% { translate: -2px 0; }
}

/* 경고 스낵바: 실행 바 위에 떠서 3.5 초 뒤 아래로 사라진다 */
.ed-snack { bottom: 128px; animation: snack-in 0.24s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
.ed-snack.out { animation: snack-out 0.22s ease forwards; }
.ed-snack.warn { gap: 12px; padding: 12px 20px 12px 16px; border-radius: 12px; max-width: min(640px, calc(100% - 32px)); }
.ed-snack-text { display: grid; gap: 2px; }
.ed-snack-text > span:first-child { font-weight: 600; }
.ed-snack-sub { font: 400 13px/20px var(--font); letter-spacing: var(--track); color: #c9ccd6; }
.ed-snack-icon { flex: none; display: grid; place-items: center; width: 24px; height: 24px; border-radius: 999px;
  background: #ffb4ab; color: #690005; font: 800 14px/1 var(--font); }
@keyframes snack-in { from { opacity: 0; translate: 0 16px; } to { opacity: 1; translate: 0 0; } }
@keyframes snack-out { to { opacity: 0; translate: 0 16px; } }
@media (max-width: 720px) { .ed-snack { bottom: 112px; } }
@media (prefers-reduced-motion: reduce) {
  .ed-refuse, .ed-snack, .ed-snack.out { animation: none; }
  .ed-snack.out { opacity: 0; }
  .ed-bounce { transition: none; }
}

/* ---- 지난 결과 미리보기(블록 · 노드 · 노드 설정 칸) — 크기가 정해진 칸이라 불러와도 자리가 밀리지 않는다 ---- */
.ed-preview { display: grid; grid-template-columns: 160px minmax(0, 1fr); align-items: center; gap: 16px; padding: 8px; margin: 0;
  border: 0; border-radius: var(--md-shape-sm); background: color-mix(in srgb, var(--md-surface-lowest) 70%, transparent);
  font: inherit; text-align: left; color: var(--md-on-surface); cursor: zoom-in; transition: opacity 0.15s ease, box-shadow 0.15s ease; }
.ed-preview:hover { box-shadow: 0 0 0 2px color-mix(in srgb, var(--md-primary) 40%, transparent); }
.ed-pv-media { position: relative; display: grid; place-items: center; aspect-ratio: 16 / 9; overflow: hidden; border-radius: 8px;
  background: repeating-conic-gradient(#eef1f5 0 25%, #ffffff 0 50%) 0 0 / 12px 12px; }
.ed-pv-media img, .ed-pv-media video { width: 100%; height: 100%; object-fit: contain; display: block; background: #0f1720; }
.ed-pv-media img { background: transparent; }
.ed-pv-play { position: absolute; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 999px;
  background: rgba(0, 0, 0, 0.55); color: #fff; font-size: 12px; padding-left: 2px; pointer-events: none; }
.ed-pv-wait { font: 400 12px/16px var(--font); color: var(--md-on-surface-variant); }
.ed-pv-cap { display: grid; gap: 2px; }
.ed-pv-label { font: 600 12px/16px var(--font); letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--md-on-surface-variant); }
.ed-pv-stale { display: none; font: 500 12px/16px var(--font); letter-spacing: var(--track); color: #8a5300; }
.ed-preview.stale .ed-pv-media { opacity: 0.45; filter: grayscale(0.6); }
.ed-preview.stale .ed-pv-stale { display: block; }
.ed-preview.nd { grid-template-columns: 1fr; gap: 4px; padding: 8px 12px; border-radius: 0; border-top: 1px solid var(--md-surface-high);
  background: var(--md-surface-lowest); }
.ed-preview.nd .ed-pv-cap { grid-auto-flow: column; justify-content: space-between; }
.ed-preview.side { grid-template-columns: 1fr; gap: 8px; padding: 0; background: none; }
.ed-preview.side .ed-pv-media { border-radius: 12px; }

/* 크게 보기 */
.overlay.ed-lightbox { z-index: 40; background: rgba(15, 23, 32, 0.72); }
.ed-lb { width: min(1200px, 100%); max-height: calc(100dvh - 32px); display: grid; grid-template-rows: auto minmax(0, 1fr); gap: 16px;
  padding: 16px 16px 16px 24px; border-radius: 24px; background: var(--surface); box-shadow: 0 20px 48px rgba(0, 0, 0, 0.3); }
.ed-lb-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.ed-lb-head h2 { margin: 0 0 4px; font: var(--t-title-s); letter-spacing: var(--track); }
.ed-lb-head .ed-support { font: 400 14px/20px var(--font); color: var(--ink-soft); }
.ed-lb-media { display: grid; place-items: center; min-height: 240px; border-radius: 12px; overflow: hidden;
  background: repeating-conic-gradient(#eef1f5 0 25%, #ffffff 0 50%) 0 0 / 16px 16px; }
.ed-lb-media img, .ed-lb-media video { max-width: 100%; max-height: calc(100dvh - 160px); display: block; }
.ed-lb-media video { background: #0f1720; }
@media (max-width: 720px) {
  .ed-preview { grid-template-columns: 112px minmax(0, 1fr); gap: 12px; }
  .ed-lb { padding: 12px; border-radius: 16px; }
}

/* ---- 휴대폰: 목록(기본) · 블록 · 노드 — 캔버스는 손가락으로(한 손가락 = 블록 옮기기·빈 곳 끌어 이동, 두 손가락 = 확대) ---- */
.nd-side-close { display: none; margin-left: auto; }
@media (max-width: 720px) {
  .ed { --cv-h: 62dvh; }
  .ed-segs .ed-seg { padding: 0 12px; }
  .ed-body:not(.ed-phone), .nd-body { flex-direction: column; flex-wrap: nowrap; margin: 0 -16px; border-radius: 0; }
  .ed-body .cv-frame, .nd-body .cv-frame { flex: none; width: 100%; }
  /* 블록 꾸러미 = 캔버스 위 가로 줄(누르면 캔버스 가운데에 들어간다) */
  .ed-palette { order: -1; flex: none; width: auto; height: auto; flex-direction: row; align-items: center; gap: 8px;
    padding: 8px 16px; overflow-x: auto; overflow-y: hidden; border-left: 0; border-bottom: 1px solid var(--md-outline-variant);
    scrollbar-width: none; }
  .ed-palette::-webkit-scrollbar { display: none; }
  .ed-palette .ed-pal-title, .ed-palette .ed-pal-label, .ed-palette .ed-pal-help { display: none; }
  .ed-pal-group { flex-direction: row; flex: none; }
  .ed-pal-item { white-space: nowrap; }
  .ed-side-resize, .cv-world .ed-resize { display: none; }
  .cv-hint { display: none; }
  /* 노드 설정 = 노드를 고르면 아래에서 올라오는 시트 */
  .nd-side:not(.has-sel) { display: none; }
  .nd-side.has-sel { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; width: auto; height: auto; max-height: 64dvh;
    border-left: 0; border-radius: 24px 24px 0 0; box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18); animation: snack-in 0.22s ease; }
  .nd-side.has-sel .nd-side-scroll { padding: 16px 16px 8px; }
  .nd-side.has-sel .nd-side-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
  .nd-side-close { display: inline-grid; }
}
/* 손가락: 잇는 점을 누르기 쉽게(보이는 크기는 그대로, 누르는 자리만 넓게) */
@media (pointer: coarse) {
  .nd-port::after { content: ''; position: absolute; inset: -14px; border-radius: 999px; }
}

/* 휴대폰: 실행 바는 한 줄(전체 시간 + 실행하기) — 캔버스를 가리지 않게. 순서는 목록·블록에서 보인다 */
@media (max-width: 720px) {
  .ed-runbar { margin: 8px -16px 0; padding: 8px 16px calc(8px + env(safe-area-inset-bottom)); border-radius: 16px 16px 0 0; }
  .ed-runbar-row { flex-wrap: nowrap; gap: 16px; }
  .ed-runbar .ed-stat.grow { display: none; }
  .ed-runbar .ed-stat-value { font-size: 20px; line-height: 28px; }
  .ed-runbar .ed-run { flex: 1; min-height: 48px; }
}
