/* Hallmark · shape: app screen · genre: modern-minimal · theme: Leafrium bento (brand) · redesign: full
 * nav: floating card panels on a cream ground, rail on the left opening the block shelf, inspector on the right · signature: the live page sits in its own rounded card between two card panels, like tiles in a bento box · states: empty, editing, publishing, error · ink: one green, black pill actions
 * axes: light/system-sans/brand-green · posture: friendly · contrast: pass · v3.0.0 */
/* Hallmark · pre-emit critique: P4 H4 E4 S4 R4 V4 · weakest: E, bento cards add gutter space the narrow inspector has to give back; gutters stay at 8px so the panels keep their width */
/* Hallmark · waive 39b · block shelf rows in Leafrium Builder (블록 추가) carry a name and a one-line description · first-time builders choose a block by what it does, so each shelf row keeps its description under the name */
/* Hallmark · answered F7 · buttons and fields share one control recipe on purpose so every editor control lines up at 36px with the same edge */

:root {
  color-scheme: light;
  --ui-ground: #efece4;
  --ui-paper: #f7f5ef;
  --ui-paper-2: #f0ede5;
  --ui-paper-3: #e6e2d8;
  --ui-panel: #fffdf9;
  --ui-ink: #151513;
  --ui-ink-2: #3b3a35;
  --ui-muted: #67645b;
  --ui-rule: #e4e0d6;
  --ui-rule-2: #cfcabe;
  --ui-field: #8a857a;
  --ui-accent: #1d7a48;
  --ui-accent-deep: #145c35;
  --ui-accent-soft: #dcf2e3;
  --ui-accent-ink: #fbfdfb;
  --ui-lime: #d8f5a2;
  --ui-black: #151513;
  --ui-black-2: #2c2b27;
  --ui-focus: #1d7a48;
  --ui-danger: #b3361f;
  --ui-guide: #c2255c;
  --ui-danger-soft: #fbe9e5;
  --ui-code: #151a1f;
  --ui-code-2: #222a32;
  --ui-code-ink: #d8e0e8;
  --ui-code-muted: #93a1ae;
  --ui-tk-tag: #8cc8ff;
  --ui-tk-attr: #ffd27f;
  --ui-tk-str: #a9e2a5;
  --ui-tk-sel: #f3a8ca;
  --ui-mark: #6c4fd1;
  --ui-mark-ink: #fbfaff;
  --ui-scrim: rgb(16 21 18 / 0.48);
  --ui-accent-wash: rgb(29 122 72 / 0.09);
  --ui-shadow: 0 1px 2px rgb(40 36 26 / 0.05), 0 16px 40px rgb(40 36 26 / 0.1);
  --ui-shadow-card: 0 1px 2px rgb(40 36 26 / 0.04), 0 4px 14px rgb(40 36 26 / 0.05);
  --ui-shadow-sm: 0 1px 2px rgb(40 36 26 / 0.1);
  --ui-font: 'Pretendard', 'Apple SD Gothic Neo', 'Malgun Gothic', system-ui, sans-serif;
  --ui-mono: 'JetBrains Mono', 'SFMono-Regular', Menlo, Consolas, monospace;
  --ui-space-3xs: 2px; --ui-space-2xs: 4px; --ui-space-xs: 8px; --ui-space-sm: 12px; --ui-space-md: 16px;
  --ui-space-lg: 24px; --ui-space-xl: 40px; --ui-space-2xl: 64px;
  --ui-text-xs: 0.75rem; --ui-text-sm: 0.8125rem; --ui-text-md: 0.9375rem; --ui-text-lg: 1.0625rem; --ui-text-xl: 1.25rem; --ui-text-2xl: 1.625rem; --ui-text-3xl: 2.375rem;
  --ui-radius: 12px; --ui-radius-sm: 8px; --ui-radius-lg: 20px; --ui-radius-card: 22px; --ui-radius-pill: 999px; --ui-radius-device: 34px; --ui-gutter: 8px;
  --control: 36px; --control-sm: 32px;
  --top-h: 60px; --bar-h: 60px;
  --dur-micro: 120ms; --dur-short: 220ms; --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --z-tools: 10; --z-sheet: 40; --z-bar: 45; --z-menu: 300; --z-modal: 400; --z-toast: 500; --z-tag: 600;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow-x: clip; }
body {
  overflow-y: hidden;
  background: var(--ui-ground);
  color: var(--ui-ink);
  font-family: var(--ui-font);
  font-size: var(--ui-text-md);
  line-height: 1.5;
  word-break: keep-all;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--ui-accent); text-underline-offset: 0.16em; }
a:hover { color: var(--ui-accent-deep); }
:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 2px; }
code, kbd, pre, .mono { font-family: var(--ui-mono); }
.ic { display: block; flex-shrink: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
h1, h2, h3 { text-wrap: balance; overflow-wrap: break-word; min-width: 0; }

/* ---------- controls ---------- */
.btn {
  min-height: var(--control);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--ui-space-xs);
  padding: 0 var(--ui-space-sm);
  border: 1px solid var(--ui-rule);
  border-radius: var(--ui-radius-pill);
  background: var(--ui-panel);
  font-size: var(--ui-text-md);
  font-weight: 650;
  white-space: nowrap;
  text-decoration: none;
  color: var(--ui-ink);
  transition: background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out);
}
.btn:hover { background: var(--ui-paper-2); color: var(--ui-ink); }
.btn:active { background: var(--ui-paper-3); }
.btn:disabled, .btn[aria-disabled='true'] { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--ui-black); border-color: var(--ui-black); color: var(--ui-accent-ink); padding: 0 var(--ui-space-md); }
.btn.primary:hover { background: var(--ui-black-2); border-color: var(--ui-black-2); color: var(--ui-accent-ink); }
.btn.primary:active { background: var(--ui-ink-2); }
.btn.primary .ic { color: var(--ui-lime); }
.btn.quiet { border-color: transparent; background: transparent; }
.btn.quiet:hover { background: var(--ui-paper-2); }
.btn.quiet[aria-pressed='true'] { background: var(--ui-accent-soft); color: var(--ui-accent-deep); }
.btn.danger { color: var(--ui-danger); }
.btn.danger:hover { background: var(--ui-danger-soft); color: var(--ui-danger); }
.btn.block { width: 100%; }
.btn.small { min-height: var(--control-sm); font-size: var(--ui-text-sm); padding: 0 var(--ui-space-sm); }
.icon-btn { width: var(--control); padding: 0; }

.fld { display: grid; gap: var(--ui-space-2xs); margin-bottom: var(--ui-space-md); font-size: var(--ui-text-sm); font-weight: 600; color: var(--ui-ink-2); }
.fld small { font-weight: 400; color: var(--ui-muted); }
.input, .fld input, .fld select, textarea {
  width: 100%;
  min-height: var(--control);
  padding: var(--ui-space-xs) var(--ui-space-sm);
  border: 1px solid var(--ui-field);
  border-radius: var(--ui-radius);
  background: var(--ui-paper);
  color: var(--ui-ink);
  font-size: var(--ui-text-md);
  font-weight: 400;
}
.input:focus-visible, .fld input:focus-visible, .fld select:focus-visible, textarea:focus-visible { outline: 2px solid var(--ui-focus); outline-offset: 0; }
.input:disabled { background: var(--ui-paper-2); color: var(--ui-muted); cursor: not-allowed; }
.check { display: flex; gap: var(--ui-space-xs); align-items: flex-start; font-size: var(--ui-text-sm); line-height: 1.5; color: var(--ui-ink-2); }
.check input { width: 18px; height: 18px; margin: var(--ui-space-3xs) 0 0; accent-color: var(--ui-accent); flex-shrink: 0; }
.seg { display: inline-flex; padding: var(--ui-space-3xs); background: var(--ui-paper-2); border-radius: var(--ui-radius-pill); }
.seg button { min-height: var(--control-sm); display: inline-flex; align-items: center; gap: var(--ui-space-2xs); padding: 0 var(--ui-space-sm); border: 0; border-radius: var(--ui-radius-pill); background: transparent; color: var(--ui-muted); font-size: var(--ui-text-sm); font-weight: 600; }
.seg button:hover { color: var(--ui-ink); }
.seg button:active { background: var(--ui-paper-3); }
.seg button[aria-pressed='true'] { background: var(--ui-panel); color: var(--ui-ink); box-shadow: var(--ui-shadow-sm); }
.seg.full { display: flex; }
.seg.full button { flex: 1; justify-content: center; }
.hint { margin: 0 0 var(--ui-space-sm); font-size: var(--ui-text-sm); color: var(--ui-muted); }
.error { margin: var(--ui-space-xs) 0 0; font-size: var(--ui-text-sm); color: var(--ui-danger); }

/* ---------- top bar ---------- */
.topbar {
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: var(--ui-space-xs);
  padding: 0 calc(var(--ui-gutter) + var(--ui-space-xs));
  background: transparent;
  position: relative;
  z-index: var(--z-bar);
}
.brand { display: flex; align-items: center; gap: var(--ui-space-xs); color: var(--ui-ink); text-decoration: none; font-weight: 800; font-size: var(--ui-text-lg); letter-spacing: -0.02em; white-space: nowrap; margin-right: var(--ui-space-xs); }
.brand:hover { color: var(--ui-ink); }
.brand img { width: 30px; height: 30px; }
.title-input { width: 240px; min-height: var(--control); border-color: var(--ui-field); border-radius: var(--ui-radius-pill); background: var(--ui-panel); box-shadow: var(--ui-shadow-card); font-weight: 650; padding: 0 var(--ui-space-md); }
.title-input:hover { border-color: var(--ui-ink-2); }
.top-group { display: flex; align-items: center; gap: var(--ui-space-2xs); }
.top-group.right { margin-left: auto; }
.divider { width: 1px; height: 20px; background: var(--ui-rule-2); margin: 0 var(--ui-space-2xs); }
.topbar .seg { background: var(--ui-panel); box-shadow: var(--ui-shadow-card); }
.topbar .seg button[aria-pressed='true'] { background: var(--ui-black); color: var(--ui-accent-ink); box-shadow: none; }

/* ---------- workspace ---------- */
.workspace { display: grid; grid-template-columns: var(--left-w, 296px) var(--ui-gutter) minmax(0, 1fr) var(--ui-gutter) var(--right-w, 320px); height: calc(100% - var(--top-h)); padding: 0 var(--ui-gutter) var(--ui-gutter); }
.resizer { position: relative; z-index: 3; cursor: col-resize; background: transparent; touch-action: none; }
.resizer::after { content: ''; position: absolute; inset: 30% 3px; border-radius: var(--ui-radius-pill); background: transparent; transition: background-color var(--dur-micro) var(--ease-out); }
.resizer:hover::after, .resizer:focus-visible::after, body.is-resizing .resizer:active::after { background: var(--ui-accent); }
.resizer:focus-visible { outline: none; }
body.is-resizing, body.is-resizing * { cursor: col-resize !important; user-select: none; }
.panel { display: flex; flex-direction: column; overflow-y: auto; border-radius: var(--ui-radius-card); background: var(--ui-panel); box-shadow: var(--ui-shadow-card); }
.tabs { display: flex; gap: var(--ui-space-2xs); margin: var(--ui-space-sm) var(--ui-space-sm) 0; padding: var(--ui-space-3xs); border-radius: var(--ui-radius-pill); background: var(--ui-paper-2); }
.tabs button { flex: 1; min-height: var(--control-sm); display: inline-flex; align-items: center; justify-content: center; gap: var(--ui-space-2xs); padding: 0 var(--ui-space-sm); border: 0; border-radius: var(--ui-radius-pill); background: none; color: var(--ui-muted); font-weight: 650; font-size: var(--ui-text-md); }
.tabs button:hover { color: var(--ui-ink); }
.tabs button:active { background: var(--ui-paper-3); }
.tabs button[aria-selected='true'] { background: var(--ui-panel); color: var(--ui-ink); box-shadow: var(--ui-shadow-sm); }
.pane { padding: var(--ui-space-md); }
.pane h3 { margin: var(--ui-space-lg) 0 var(--ui-space-xs); font-size: var(--ui-text-md); font-weight: 800; letter-spacing: -0.01em; color: var(--ui-ink); }
.pane h3:first-child { margin-top: 0; }
.sheet-head { display: none; }

/* left rail (Canva-style categories) */
.panel.left { display: grid; grid-template-columns: 72px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.panel.left .sheet-head { grid-column: 1 / -1; }
.panel.left > .pane { grid-column: 2; grid-row: 2; overflow-y: auto; min-height: 0; }
.rail { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; gap: var(--ui-space-2xs); padding: var(--ui-space-sm) var(--ui-space-2xs); background: var(--ui-paper); overflow-y: auto; }
.rail button { display: grid; justify-items: center; align-content: center; gap: var(--ui-space-2xs); min-height: 60px; padding: var(--ui-space-2xs) 0; border: 0; border-radius: var(--ui-radius); background: transparent; color: var(--ui-muted); font-size: var(--ui-text-xs); font-weight: 650; }
.rail button .ic { box-sizing: content-box; padding: var(--ui-space-xs); border-radius: var(--ui-radius); transition: background-color var(--dur-micro) var(--ease-out); }
.rail button:hover { color: var(--ui-ink); }
.rail button:hover .ic { background: var(--ui-paper-3); }
.rail button:active .ic { background: var(--ui-rule); }
.rail button[aria-selected='true'] { color: var(--ui-ink); }
.rail button[aria-selected='true'] .ic { background: var(--ui-black); color: var(--ui-lime); }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--ui-space-xs); }
.tile { transition: transform var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out); }
.tile { display: grid; gap: var(--ui-space-2xs); justify-items: center; padding: var(--ui-space-sm) var(--ui-space-2xs) var(--ui-space-xs); border: 1px solid transparent; border-radius: var(--ui-radius-lg); background: var(--ui-paper-2); color: var(--ui-ink-2); font-size: var(--ui-text-xs); cursor: grab; }
.tile:hover { border-color: var(--ui-rule-2); background: var(--ui-paper); transform: translateY(-1px); }
.tile:active { cursor: grabbing; background: var(--ui-paper-2); }
.pv.lf-site { display: grid; place-items: center; width: 100%; height: 48px; min-height: 0; padding: 0; background: transparent; container-type: normal; pointer-events: none; }
.pv .lf-obj { position: static; height: 36px; width: auto; max-width: 80%; }
.text-presets { display: grid; gap: var(--ui-space-xs); margin-bottom: var(--ui-space-md); }
.text-preset { display: flex; align-items: center; min-height: 60px; padding: var(--ui-space-sm) var(--ui-space-md); border: 1px solid transparent; border-radius: var(--ui-radius-lg); background: var(--ui-paper-2); text-align: left; cursor: grab; }
.text-preset:hover { border-color: var(--ui-rule-2); background: var(--ui-paper); }
.text-preset:active { cursor: grabbing; background: var(--ui-paper-2); }
.text-preset .pv.lf-site { height: auto; place-items: center start; }
.text-preset .tile-label { display: none; }
.pv-text { color: var(--ui-ink); }
.pv-text--h { font-size: 1.5rem; font-weight: 800; letter-spacing: -0.01em; }
.pv-text--s { font-size: 1.125rem; font-weight: 650; }
.pv-text--b { font-size: var(--ui-text-md); }
.dropzone { display: grid; justify-items: center; gap: var(--ui-space-2xs); padding: var(--ui-space-xl) var(--ui-space-md); border: 1.5px dashed var(--ui-rule-2); border-radius: var(--ui-radius-lg); background: var(--ui-paper); text-align: center; color: var(--ui-ink-2); cursor: pointer; }
.dropzone:hover, .dropzone.is-over { border-color: var(--ui-accent); background: var(--ui-accent-wash); }
.dropzone:focus-within { outline: 2px solid var(--ui-accent); outline-offset: 2px; }
.dropzone small { color: var(--ui-muted); font-size: var(--ui-text-sm); }
.photo-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--ui-space-2xs); }
.photo { aspect-ratio: 1; padding: 0; overflow: hidden; border: 1px solid var(--ui-rule); border-radius: var(--ui-radius); background: var(--ui-paper-2); cursor: grab; }
.photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo:hover { border-color: var(--ui-accent); }
#canvas.is-drop { outline: 2px dashed var(--ui-accent); outline-offset: -2px; }

/* block shelf */
.shelf { display: grid; gap: var(--ui-space-xs); }
.shelf button { display: grid; grid-template-columns: 40px minmax(0, 1fr); align-items: center; gap: var(--ui-space-sm); min-height: 60px; padding: var(--ui-space-xs) var(--ui-space-sm) var(--ui-space-xs) var(--ui-space-xs); border: 1px solid transparent; border-radius: var(--ui-radius-lg); background: var(--ui-paper-2); text-align: left; color: var(--ui-ink); transition: transform var(--dur-micro) var(--ease-out), background-color var(--dur-micro) var(--ease-out); }
.shelf button:hover { background: var(--ui-paper); border-color: var(--ui-rule-2); transform: translateY(-1px); }
.shelf button:active { background: var(--ui-paper-3); transform: none; }
.shelf .ic { box-sizing: content-box; padding: var(--ui-space-xs); border-radius: var(--ui-radius); background: var(--ui-panel); color: var(--ui-ink-2); margin: 0 auto; }
.shelf button:hover .ic { background: var(--ui-lime); color: var(--ui-ink); }
.shelf b { display: block; font-size: var(--ui-text-md); font-weight: 750; }
.shelf small { display: block; color: var(--ui-muted); font-size: var(--ui-text-sm); }

/* design pane */
.themes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ui-space-xs); }
.theme-opt { display: grid; gap: var(--ui-space-xs); padding: var(--ui-space-xs) var(--ui-space-xs) var(--ui-space-sm); border: 1px solid transparent; border-radius: var(--ui-radius-lg); background: var(--ui-paper-2); text-align: left; }
.theme-opt:hover { border-color: var(--ui-rule-2); }
.theme-opt:active { background: var(--ui-paper-2); }
.theme-opt[aria-pressed='true'] { border-color: var(--ui-black); box-shadow: inset 0 0 0 1px var(--ui-black); background: var(--ui-panel); }
.theme-opt .chips { display: flex; height: 40px; border-radius: var(--ui-radius); overflow: hidden; }
.theme-opt .chips span { flex: 1; }
.theme-opt b { font-size: var(--ui-text-sm); }
.theme-opt small { font-size: var(--ui-text-xs); color: var(--ui-muted); }
.color-row { display: flex; align-items: center; justify-content: space-between; min-height: 40px; font-size: var(--ui-text-md); }
.color-row input { width: 44px; height: var(--control-sm); padding: var(--ui-space-3xs); border: 1px solid var(--ui-field); border-radius: var(--ui-radius-sm); background: var(--ui-panel); }
.font-list { display: grid; gap: var(--ui-space-2xs); }
.font-opt { display: flex; justify-content: space-between; align-items: center; min-height: 52px; padding: 0 var(--ui-space-md); border: 1px solid transparent; border-radius: var(--ui-radius-lg); background: var(--ui-paper-2); font-size: var(--ui-text-lg); }
.font-opt:hover { border-color: var(--ui-rule-2); }
.font-opt:active { background: var(--ui-paper-2); }
.font-opt small { font-family: var(--ui-font); font-size: var(--ui-text-sm); color: var(--ui-muted); }
.font-opt[aria-pressed='true'] { border-color: var(--ui-black); background: var(--ui-panel); box-shadow: inset 0 0 0 1px var(--ui-black); }

/* inspector */
.empty { padding: var(--ui-space-xl) var(--ui-space-sm); text-align: center; color: var(--ui-muted); }
.empty .ic { box-sizing: content-box; margin: 0 auto var(--ui-space-md); padding: var(--ui-space-md); border-radius: var(--ui-radius-card); background: var(--ui-paper-2); color: var(--ui-ink-2); }
.empty p { margin: 0 0 var(--ui-space-xs); }
.inspect-head { display: flex; align-items: center; gap: var(--ui-space-xs); margin-bottom: var(--ui-space-xs); }
.inspect-head h2 { margin: 0; font-size: var(--ui-text-2xl); font-weight: 800; letter-spacing: -0.025em; }
.inspect-head .ic { box-sizing: content-box; padding: var(--ui-space-xs); border-radius: var(--ui-radius); background: var(--ui-lime); color: var(--ui-ink); }
.note { margin: 0 0 var(--ui-space-md); padding: var(--ui-space-sm) var(--ui-space-md); border-radius: var(--ui-radius-lg); background: var(--ui-paper-2); color: var(--ui-ink-2); font-size: var(--ui-text-sm); }
.note.warn { background: var(--ui-danger-soft); color: var(--ui-ink); }
.img-field { display: flex; align-items: center; gap: var(--ui-space-xs); flex-wrap: wrap; }
.img-thumb { width: 64px; height: 48px; display: grid; place-items: center; border: 1px solid var(--ui-rule); border-radius: var(--ui-radius-sm); background: var(--ui-paper-2) center / cover no-repeat; color: var(--ui-muted); font-size: var(--ui-text-xs); font-weight: 400; }
.items { display: grid; margin-bottom: var(--ui-space-sm); border-top: 1px solid var(--ui-rule); }
.item { padding: var(--ui-space-xs) 0; border-bottom: 1px solid var(--ui-rule); }
.item-head { display: flex; align-items: center; gap: var(--ui-space-2xs); min-height: var(--control); font-size: var(--ui-text-md); }
.item-head span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .fld { margin: var(--ui-space-xs) 0 0; }
.block-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ui-space-xs); margin-top: var(--ui-space-lg); padding-top: var(--ui-space-md); border-top: 1px solid var(--ui-rule); }

/* ---------- stage ---------- */
.stage-area { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; overflow: hidden; }
.stage { position: relative; height: 100%; overflow: auto; padding: var(--ui-space-md) var(--ui-space-md) 112px; }
.frame { position: relative; max-width: 1200px; min-height: 320px; margin: 0 auto; overflow: hidden; border-radius: var(--ui-radius-card); background: var(--ui-panel); box-shadow: var(--ui-shadow); }
body.device-mobile .frame { max-width: 390px; border: var(--ui-space-xs) solid var(--ui-ink); border-radius: var(--ui-radius-device); }
.lfb-block { position: relative; }
.lfb-block > .lf-tile { transition: box-shadow var(--dur-micro) var(--ease-out); }
.lfb-block:hover > .lf-tile { box-shadow: 0 0 0 2px var(--ui-rule-2); }
.lfb-block.lfb-selected > .lf-tile { box-shadow: 0 0 0 2px var(--ui-accent); }
.lfb-tools { position: absolute; top: var(--ui-space-lg); right: var(--ui-space-lg); z-index: var(--z-tools); display: flex; align-items: center; gap: var(--ui-space-3xs); padding: var(--ui-space-2xs) var(--ui-space-2xs) var(--ui-space-2xs) var(--ui-space-xs); border-radius: var(--ui-radius-pill); background: var(--ui-ink); color: var(--ui-accent-ink); font-family: var(--ui-font); box-shadow: var(--ui-shadow); }
.lfb-tools .name { padding: 0 var(--ui-space-xs); font-size: var(--ui-text-sm); font-weight: 700; color: var(--ui-lime); }
.lfb-tools button { width: var(--control-sm); height: var(--control-sm); display: grid; place-items: center; border: 0; border-radius: var(--ui-radius-pill); background: transparent; color: inherit; }
.lfb-tools button:hover { background: var(--ui-ink-2); }
.lfb-tools button:active { background: var(--ui-muted); }
#canvas [data-field] { cursor: pointer; outline: none; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
#canvas [data-field].is-editing { cursor: text; -webkit-user-select: text; user-select: text; }
#canvas [data-field]:not(.lf-btn) { border-radius: var(--ui-space-2xs); }
#canvas [data-field]:hover { box-shadow: 0 0 0 1px var(--ui-rule-2); }
#canvas [data-field]:focus-visible, #canvas [data-field].is-editing { box-shadow: 0 0 0 2px var(--ui-focus); }
#canvas .lfb-field-sel:not(.is-editing), #canvas .lfb-field-sel:hover { box-shadow: none; cursor: move; }
#canvas [data-field]:empty::before { content: '여기에 입력'; color: var(--ui-muted); }
.lfb-add-end { display: flex; align-items: center; justify-content: center; gap: var(--ui-space-xs); width: 100%; min-height: 72px; border: 0; border-top: 1px dashed var(--ui-rule-2); background: var(--ui-paper); color: var(--ui-ink-2); font-family: var(--ui-font); font-size: var(--ui-text-md); font-weight: 600; }
.lfb-add-end:hover { background: var(--ui-accent-soft); color: var(--ui-accent-deep); }
.lfb-add-end:active { background: var(--ui-paper-3); }

/* dock: 하단 도구 막대 */
.dock { position: absolute; left: 50%; bottom: var(--ui-space-md); z-index: var(--z-bar); display: flex; align-items: center; overflow-x: auto; scrollbar-width: none; gap: var(--ui-space-xs); max-width: calc(100% - var(--ui-space-lg)); padding: var(--ui-space-2xs); border-radius: var(--ui-radius-card); background: var(--ui-panel); box-shadow: var(--ui-shadow); transform: translateX(-50%); }
.dock-tools, .dock-opts { display: flex; flex-shrink: 0; align-items: center; gap: var(--ui-space-3xs); }
.dock .swatches { flex-wrap: nowrap; }
.dock .tool { min-width: 56px; height: 52px; display: grid; place-items: center; align-content: center; gap: var(--ui-space-3xs); padding: 0 var(--ui-space-2xs); border: 0; border-radius: var(--ui-radius-lg); background: transparent; color: var(--ui-ink-2); font-size: var(--ui-text-xs); font-weight: 600; white-space: nowrap; }
.dock .tool:hover { background: var(--ui-paper-2); }
.dock .tool:active { background: var(--ui-paper-3); }
.dock .tool[aria-pressed='true'] { background: var(--ui-black); color: var(--ui-lime); }
.dock-sep { width: 1px; height: 28px; margin: 0 var(--ui-space-2xs); background: var(--ui-rule); }
.dock-label { font-size: var(--ui-text-xs); font-weight: 600; color: var(--ui-muted); white-space: nowrap; }
.swatches { display: flex; flex-wrap: wrap; gap: var(--ui-space-2xs); }
.sw { width: 28px; height: 28px; display: grid; place-items: center; padding: 0; border: 1px solid var(--ui-rule-2); border-radius: 50%; background: var(--ui-panel); }
.sw span { width: 18px; height: 18px; border-radius: 50%; }
.sw.is-none span { border: 1.5px dashed var(--ui-muted); }
.sw:hover { border-color: var(--ui-field); }
.sw:active { background: var(--ui-paper-2); }
.sw[aria-pressed='true'] { border-color: var(--ui-accent); box-shadow: 0 0 0 2px var(--ui-accent-soft); }
.range { width: 100%; accent-color: var(--ui-accent); }
.hint-inline { font-weight: 400; color: var(--ui-muted); }
.btn[aria-pressed='true'] { border-color: var(--ui-black); background: var(--ui-black); color: var(--ui-accent-ink); }

/* 자유 도형과 그리기 */
#canvas .lf-obj { pointer-events: auto; cursor: move; touch-action: none; }
#canvas .lf-path { pointer-events: none; }
#canvas .lf-path path { pointer-events: visibleStroke; }
#canvas .lf-path:not(.lf-fill-none) path { pointer-events: visiblePainted; }
body:not([data-tool='select']):not([data-tool='eraser']) #canvas .lf-obj, body:not([data-tool='select']):not([data-tool='eraser']) #canvas .lf-path path { pointer-events: none; }
body[data-tool]:not([data-tool='select']) #canvas [data-field] { pointer-events: none; user-select: none; }
body[data-tool]:not([data-tool='select']) #canvas { touch-action: none; user-select: none; }
body[data-tool='rect'] #canvas, body[data-tool='ellipse'] #canvas, body[data-tool='pen'] #canvas, body[data-tool='marquee'] #canvas { cursor: crosshair; }
body[data-tool='eraser'] #canvas, body[data-tool='eraser'] #canvas .lf-obj { cursor: cell; }
#canvas [data-moved] { cursor: move; }
body.is-dragging, body.is-dragging * { cursor: grabbing !important; user-select: none; }
.lfb-selbox { position: absolute; z-index: 6; border: 1.5px solid var(--ui-accent); pointer-events: auto; cursor: move; touch-action: none; }
.lfb-handle { position: absolute; width: 12px; height: 12px; border: 1.5px solid var(--ui-accent); border-radius: 2px; background: var(--ui-panel); }
.lfb-handle[data-h='nw'] { left: -7px; top: -7px; cursor: nwse-resize; }
.lfb-handle[data-h='ne'] { right: -7px; top: -7px; cursor: nesw-resize; }
.lfb-handle[data-h='sw'] { left: -7px; bottom: -7px; cursor: nesw-resize; }
.lfb-handle[data-h='se'] { right: -7px; bottom: -7px; cursor: nwse-resize; }
.lfb-ghost { position: absolute; z-index: 6; border: 1.5px dashed var(--ui-accent); background: var(--ui-accent-wash); pointer-events: none; }
.lfb-ghost--ellipse { border-radius: 50%; }
.lfb-ink { position: absolute; inset: 0; z-index: 6; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.lfb-ink path { fill: none; stroke: var(--obj-stroke); stroke-linecap: round; stroke-linejoin: round; }
.lfb-snap-label { position: absolute; z-index: 7; padding: var(--ui-space-3xs) var(--ui-space-xs); border-radius: 999px; background: var(--ui-ink); color: var(--ui-accent-ink); font-family: var(--ui-font); font-size: var(--ui-text-xs); font-weight: 600; white-space: nowrap; pointer-events: none; }
.lfb-marquee { position: absolute; z-index: 8; border: 1px dashed var(--ui-accent); background: var(--ui-accent-wash); pointer-events: none; }

/* contextual toolbar, floating toolbar, menu, guides, layers */
.ctxbar { position: relative; z-index: var(--z-bar); min-height: 52px; display: flex; align-items: center; margin-bottom: var(--ui-gutter); border-radius: var(--ui-radius-card); background: var(--ui-panel); box-shadow: var(--ui-shadow-card); }
.ctx-inner { flex: 1; min-width: 0; }
.ctx-empty { padding: 0 var(--ui-space-sm); font-size: var(--ui-text-sm); color: var(--ui-muted); }
.ctx-inner { display: flex; align-items: center; gap: var(--ui-space-2xs); padding: var(--ui-space-2xs) var(--ui-space-xs); overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.ctx-name { padding: var(--ui-space-2xs) var(--ui-space-sm); border-radius: var(--ui-radius-pill); background: var(--ui-lime); font-size: var(--ui-text-sm); font-weight: 750; color: var(--ui-ink); }
.ctx-label { font-size: var(--ui-text-xs); font-weight: 600; color: var(--ui-muted); }
.ctx-sep { flex-shrink: 0; width: 1px; height: 24px; margin: 0 var(--ui-space-3xs); background: var(--ui-rule); }
.ctxbar .swatches { flex-wrap: nowrap; }
.ctxbar .seg { flex-shrink: 0; }
.ctx-btn { flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; gap: var(--ui-space-3xs); min-width: var(--control-sm); height: var(--control-sm); padding: 0 var(--ui-space-2xs); border: 0; border-radius: var(--ui-radius-pill); background: transparent; color: var(--ui-ink-2); font-size: var(--ui-text-sm); font-weight: 600; }
.ctx-btn.wide { padding: 0 var(--ui-space-xs); }
.ctx-btn:hover { background: var(--ui-paper-2); }
.ctx-btn:active { background: var(--ui-paper-3); }
.ctx-btn[aria-pressed='true'] { background: var(--ui-black); color: var(--ui-accent-ink); }
.ctx-range { flex-shrink: 0; display: inline-flex; align-items: center; gap: var(--ui-space-2xs); }
.ctx-range input { width: 88px; accent-color: var(--ui-accent); }
.ctx-range output { min-width: 3.2em; font-size: var(--ui-text-xs); font-variant-numeric: tabular-nums; color: var(--ui-ink-2); }
.lfb-float { position: absolute; z-index: 9; display: flex; gap: var(--ui-space-3xs); padding: var(--ui-space-3xs); border-radius: var(--ui-radius-pill); background: var(--ui-panel); box-shadow: var(--ui-shadow); font-family: var(--ui-font); }
.lfb-float button { width: 32px; height: 32px; display: grid; place-items: center; padding: 0; border: 0; border-radius: var(--ui-radius-pill); background: transparent; color: var(--ui-ink-2); }
.lfb-float button:hover { background: var(--ui-paper-2); color: var(--ui-ink); }
.lfb-float button:active { background: var(--ui-paper-3); }
.lfb-float button[data-fa='del']:hover { color: var(--ui-danger); }
.lfb-float button[aria-pressed='true'] { color: var(--ui-accent-deep); }
.lfb-selbox.is-locked { border-style: dashed; cursor: default; }
.lfb-selbox--field { pointer-events: none; border-style: solid; }
.lfb-selbox--field .lfb-handle, .lfb-selbox--field .lfb-rot { pointer-events: auto; }
.lfb-handle { touch-action: none; }
.lfb-handle::after, .lfb-rot::after { content: ''; position: absolute; inset: -8px; }
.lfb-rot { position: absolute; left: calc(50% - 11px); top: calc(100% + 14px); width: 22px; height: 22px; display: grid; place-items: center; border: 1.5px solid var(--ui-accent); border-radius: 50%; background: var(--ui-panel); color: var(--ui-accent); cursor: grab; touch-action: none; }
.lfb-rot::before { content: ''; position: absolute; left: 50%; bottom: 100%; width: 1.5px; height: 14px; background: var(--ui-accent); }
.lfb-rot:active { cursor: grabbing; }
#canvas .lfb-field-sel { touch-action: none; }
.lfb-lock { position: absolute; top: -10px; right: -10px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--ui-ink); color: var(--ui-accent-ink); }
.lfb-handle[data-h='n'] { left: calc(50% - 6px); top: -7px; cursor: ns-resize; }
.lfb-handle[data-h='s'] { left: calc(50% - 6px); bottom: -7px; cursor: ns-resize; }
.lfb-handle[data-h='e'] { top: calc(50% - 6px); right: -7px; cursor: ew-resize; }
.lfb-handle[data-h='w'] { top: calc(50% - 6px); left: -7px; cursor: ew-resize; }
.lfb-guide { position: absolute; z-index: 7; background: var(--ui-guide); pointer-events: none; }
.lfb-guide--v { top: 0; bottom: 0; width: 1px; }
.lfb-guide--h { left: 0; right: 0; height: 1px; }
#canvas .lf-text { cursor: move; }
#canvas .lf-text.is-editing { cursor: text; outline: 1.5px solid var(--ui-accent); outline-offset: 2px; user-select: text; }
#canvas .lf-text:empty::before { content: '글자 입력'; color: var(--color-muted); }
#canvas [data-locked] { cursor: default; }
.lfb-menu { position: fixed; z-index: var(--z-menu); min-width: 232px; padding: var(--ui-space-xs); border-radius: var(--ui-radius-lg); background: var(--ui-panel); box-shadow: var(--ui-shadow); font-size: var(--ui-text-sm); }
.lfb-menu button { display: flex; align-items: center; justify-content: space-between; gap: var(--ui-space-md); width: 100%; min-height: 34px; padding: 0 var(--ui-space-xs); border: 0; border-radius: var(--ui-radius-sm); background: transparent; color: var(--ui-ink); text-align: left; }
.lfb-menu button:hover, .lfb-menu button:focus-visible { background: var(--ui-paper-2); outline: none; }
.lfb-menu button:active { background: var(--ui-paper-3); }
.lfb-menu button[disabled] { color: var(--ui-muted); background: none; }
.lfb-menu kbd { font-family: var(--ui-mono); font-size: var(--ui-text-xs); color: var(--ui-muted); }
.lfb-menu hr { margin: var(--ui-space-2xs) 0; border: 0; border-top: 1px solid var(--ui-rule); }
.lfb-menu .menu-label { margin: var(--ui-space-2xs) var(--ui-space-xs); font-size: var(--ui-text-xs); font-weight: 600; color: var(--ui-muted); }
.menu-grid, .align-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--ui-space-3xs); }
.menu-grid button { justify-content: center; }
.layers { display: grid; gap: var(--ui-space-3xs); margin: 0; padding: 0; list-style: none; }
.layer { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: var(--ui-space-3xs); border: 1px solid transparent; border-radius: var(--ui-radius-sm); }
.layer:hover { background: var(--ui-paper); }
.layer.is-on { border-color: var(--ui-accent); background: var(--ui-accent-wash); }
.layer-pick { display: flex; align-items: center; gap: var(--ui-space-xs); min-height: 36px; padding: 0 var(--ui-space-xs); border: 0; background: none; color: var(--ui-ink); text-align: left; overflow: hidden; }
.layer-pick small { margin-left: auto; color: var(--ui-muted); font-size: var(--ui-text-xs); }
.layer-ic { color: var(--ui-muted); display: grid; }
.layer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pane h3 .ic { display: inline-block; vertical-align: -3px; }
.row.wrap { flex-wrap: wrap; }
.tips { margin-top: var(--ui-space-lg); font-size: var(--ui-text-sm); color: var(--ui-ink-2); }
.tips summary { cursor: pointer; font-weight: 600; }
.tips ul { margin: var(--ui-space-xs) 0 0; padding-left: var(--ui-space-md); display: grid; gap: var(--ui-space-3xs); }

/* code mode */
body.code-mode #canvas .lfb-block * { outline: 1px dashed var(--ui-rule-2); outline-offset: 1px; }
body.code-mode #canvas .lfb-tools, body.code-mode #canvas .lfb-tools * { outline: none; }
.hover-tag { position: fixed; z-index: var(--z-tag); pointer-events: none; padding: var(--ui-space-3xs) var(--ui-space-xs); border-radius: var(--ui-space-2xs); background: var(--ui-mark); color: var(--ui-mark-ink); font-size: var(--ui-text-xs); white-space: nowrap; }
.hover-tag code { font-weight: 700; }
.code-head { display: flex; align-items: center; justify-content: space-between; min-height: 40px; padding: 0 var(--ui-space-2xs) 0 var(--ui-space-sm); border-radius: var(--ui-radius) var(--ui-radius) 0 0; background: var(--ui-code-2); color: var(--ui-code-muted); font-size: var(--ui-text-sm); }
.code-head .btn { min-height: var(--control-sm); border-color: transparent; background: transparent; color: var(--ui-code-ink); }
.code-head .btn:hover { background: var(--ui-code); color: var(--ui-code-ink); }
.code { margin: 0 0 var(--ui-space-md); max-height: 340px; overflow: auto; padding: var(--ui-space-sm); border-radius: 0 0 var(--ui-radius) var(--ui-radius); background: var(--ui-code); color: var(--ui-code-ink); font-size: var(--ui-text-sm); line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; word-break: normal; }
.code.tall { max-height: 60dvh; }
.tk-tag, .tk-prop { color: var(--ui-tk-tag); }
.tk-attr { color: var(--ui-tk-attr); }
.tk-str, .tk-val { color: var(--ui-tk-str); }
.tk-sel { color: var(--ui-tk-sel); }
.glossary { margin: 0 0 var(--ui-space-lg); display: grid; border-top: 1px solid var(--ui-rule); }
.glossary div { display: grid; grid-template-columns: minmax(0, 7.5rem) minmax(0, 1fr); gap: var(--ui-space-xs); padding: var(--ui-space-xs) 0; border-bottom: 1px solid var(--ui-rule); font-size: var(--ui-text-sm); }
.glossary dt { font-family: var(--ui-mono); font-weight: 700; color: var(--ui-mark); overflow-wrap: anywhere; }
.glossary dd { margin: 0; color: var(--ui-ink-2); }
.glossary dd b { display: block; color: var(--ui-ink); }

/* ---------- modals ---------- */
.modal { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; overflow-y: auto; padding: var(--ui-space-md); background: var(--ui-scrim); }
.modal-card { position: relative; width: min(560px, 100%); max-height: calc(100dvh - var(--ui-space-xl)); overflow-y: auto; padding: var(--ui-space-xl); border-radius: var(--ui-radius-card); background: var(--ui-panel); box-shadow: var(--ui-shadow); }
.modal-card.wide { width: min(980px, 100%); }
.modal-card h1 { margin: 0 0 var(--ui-space-xs); font-size: var(--ui-text-3xl); font-weight: 850; line-height: 1.15; letter-spacing: -0.035em; }
.modal-card h2 { margin: 0 0 var(--ui-space-md); font-size: var(--ui-text-2xl); font-weight: 800; letter-spacing: -0.025em; }
.modal-card .lead { margin: 0 0 var(--ui-space-lg); color: var(--ui-ink-2); max-width: 46ch; }
.modal-x { position: absolute; top: var(--ui-space-sm); right: var(--ui-space-sm); }
.modal-card.start { width: min(1040px, 100%); padding: var(--ui-space-md); background: var(--ui-ground); }
.start-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: var(--ui-space-md); }
.start-main { padding: var(--ui-space-xl); border-radius: var(--ui-radius-card); background: var(--ui-panel); box-shadow: var(--ui-shadow-card); }
.start-main textarea { min-height: 120px; padding: var(--ui-space-md); border-color: var(--ui-field); border-radius: var(--ui-radius-lg); background: var(--ui-paper-2); font-size: var(--ui-text-lg); resize: vertical; }
.start-main textarea:hover { border-color: var(--ui-ink-2); }
.start-side { display: grid; grid-template-rows: auto minmax(0, 1fr); padding: var(--ui-space-lg) var(--ui-space-md) var(--ui-space-md); }
.start-side h2 { margin: 0 0 var(--ui-space-sm) var(--ui-space-2xs); font-size: var(--ui-text-lg); }
.examples { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-auto-rows: minmax(132px, auto); gap: var(--ui-space-sm); }
.ex-tile { display: grid; grid-template-rows: auto auto 1fr; align-content: start; gap: var(--ui-space-xs); padding: var(--ui-space-md); border: 0; border-radius: var(--ui-radius-card); background: var(--ex-bg); color: var(--ex-ink); text-align: left; transition: transform var(--dur-short) var(--ease-out), box-shadow var(--dur-short) var(--ease-out); }
.ex-tile:first-child { grid-column: 1 / -1; grid-template-columns: auto 1fr; grid-template-rows: auto 1fr; }
.ex-tile:first-child .ex-text { grid-column: 1 / -1; font-size: var(--ui-text-xl); }
.ex-tile:hover { transform: translateY(-2px); box-shadow: var(--ui-shadow); }
.ex-tile:active { transform: none; }
.ex-tile[aria-pressed='true'] { box-shadow: 0 0 0 3px var(--ui-black); }
.ex-ic { width: 40px; height: 40px; display: grid; place-items: center; border-radius: var(--ui-radius); background: var(--ex-accent); color: var(--ex-accent-ink); }
.ex-tag { align-self: center; font-size: var(--ui-text-sm); font-weight: 750; }
.ex-text { align-self: end; font-size: var(--ui-text-md); font-weight: 650; line-height: 1.4; letter-spacing: -0.01em; }
.modal-actions { display: flex; justify-content: flex-end; gap: var(--ui-space-xs); margin-top: var(--ui-space-lg); }
.fineprint { margin: var(--ui-space-md) 0 0; font-size: var(--ui-text-sm); color: var(--ui-muted); }
.gen-steps { display: grid; gap: var(--ui-space-2xs); margin: var(--ui-space-md) 0 0; padding: 0; list-style: none; font-size: var(--ui-text-sm); color: var(--ui-muted); }
.gen-steps li { display: flex; gap: var(--ui-space-xs); align-items: center; }
.gen-steps li[data-state='done'] { color: var(--ui-accent-deep); }

.publish { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: var(--ui-space-lg); }
.publish section { min-width: 0; }
.publish .main-col { padding-right: var(--ui-space-lg); border-right: 1px solid var(--ui-rule); }
.publish h3 { margin: 0 0 var(--ui-space-xs); font-size: var(--ui-text-lg); }
.publish p { margin: 0 0 var(--ui-space-sm); font-size: var(--ui-text-md); color: var(--ui-ink-2); }
.addr { display: flex; align-items: stretch; border: 1px solid var(--ui-field); border-radius: var(--ui-radius); background: var(--ui-panel); overflow: hidden; }
.addr:focus-within { outline: 2px solid var(--ui-focus); outline-offset: 0; }
.addr input { flex: 1; min-width: 0; min-height: 40px; padding: 0 var(--ui-space-sm); border: 0; background: transparent; font-weight: 600; outline: none; }
.addr span { display: flex; align-items: center; padding: 0 var(--ui-space-sm); background: var(--ui-paper-2); color: var(--ui-muted); font-size: var(--ui-text-sm); white-space: nowrap; }
.status { min-height: 20px; margin: var(--ui-space-xs) 0 var(--ui-space-md); font-size: var(--ui-text-sm); color: var(--ui-muted); }
.status[data-state='ok'] { color: var(--ui-accent-deep); }
.status[data-state='bad'] { color: var(--ui-danger); }
.live { display: grid; gap: var(--ui-space-sm); padding: var(--ui-space-md); margin-bottom: var(--ui-space-md); border: 1px solid var(--ui-accent); border-radius: var(--ui-radius); background: var(--ui-accent-soft); }
.live a { font-weight: 700; overflow-wrap: anywhere; }
.keybox { display: grid; gap: var(--ui-space-xs); padding: var(--ui-space-md); margin: var(--ui-space-md) 0; border: 1px solid var(--ui-danger); border-radius: var(--ui-radius); background: var(--ui-danger-soft); }
.keybox p { margin: 0; color: var(--ui-ink); }
.keybox code { padding: var(--ui-space-xs); border-radius: var(--ui-radius-sm); background: var(--ui-panel); overflow-wrap: anywhere; font-size: var(--ui-text-sm); }
.row { display: flex; flex-wrap: wrap; gap: var(--ui-space-xs); }
.side-col hr { margin: var(--ui-space-lg) 0; border: 0; border-top: 1px solid var(--ui-rule); }
.panel details, .modal-card details { border-top: 1px solid var(--ui-rule); padding-top: var(--ui-space-sm); margin-top: var(--ui-space-lg); }
.panel details summary, .modal-card details summary { min-height: var(--control); display: flex; align-items: center; cursor: pointer; font-weight: 600; color: var(--ui-ink-2); }
.panel details[open] summary, .modal-card details[open] summary { margin-bottom: var(--ui-space-sm); }
.steps { display: grid; gap: var(--ui-space-2xs); margin: var(--ui-space-sm) 0 0; padding: 0; list-style: none; font-size: var(--ui-text-sm); }
.steps li[data-state='done'] { color: var(--ui-accent-deep); }
.steps li[data-state='err'] { color: var(--ui-danger); }
.turnstile { margin: 0 0 var(--ui-space-md); }

/* ---------- toast ---------- */
#toasts { position: fixed; left: 50%; bottom: var(--ui-space-lg); z-index: var(--z-toast); display: grid; gap: var(--ui-space-xs); transform: translateX(-50%); pointer-events: none; }
.toast { padding: var(--ui-space-xs) var(--ui-space-lg); border-radius: var(--ui-radius-pill); background: var(--ui-ink); color: var(--ui-accent-ink); font-size: var(--ui-text-md); box-shadow: var(--ui-shadow); text-align: center; transition: opacity var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out); }
.toast.err { background: var(--ui-danger); }
.toast.out { opacity: 0; transform: translateY(6px); }

/* ---------- small screens ---------- */
.mobilebar { display: none; }
@media (max-width: 1100px) {
  .workspace { grid-template-columns: 256px var(--ui-gutter) minmax(0, 1fr) var(--ui-gutter) 288px; }
  .hide-md { display: none; }
  .title-input { width: 150px; }
}
@media (max-width: 860px) {
  .brand span, .lbl, .title-input, .hide-sm { display: none; }
  .workspace { display: block; height: calc(100% - var(--top-h) - var(--bar-h)); padding: 0; }
  .ctxbar { margin: 0 var(--ui-gutter) var(--ui-space-2xs); }
  .resizer { display: none; }
  .stage-area { height: 100%; }
  .stage { height: 100%; padding: var(--ui-space-sm) var(--ui-space-sm) 96px; }
  .dock { bottom: var(--ui-space-xs); gap: var(--ui-space-3xs); }
  .dock .tool { min-width: 40px; height: 40px; }
  .dock .tool span, .dock-label { display: none; }
  .dock-opts .seg { display: none; }
  body.device-mobile .frame { border-width: var(--ui-space-2xs); }
  .panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--bar-h);
    z-index: var(--z-sheet);
    max-height: 64dvh;
    border: 0;
    border-radius: var(--ui-radius-card) var(--ui-radius-card) 0 0;
    box-shadow: var(--ui-shadow);
    transform: translateY(110%);
    transition: transform var(--dur-short) var(--ease-out);
  }
  body[data-sheet='add'] .panel.left, body[data-sheet='theme'] .panel.left, body[data-sheet='shapes'] .panel.left, body[data-sheet='text'] .panel.left, body[data-sheet='photo'] .panel.left,
  body[data-sheet='edit'] .panel.right, body[data-sheet='code'] .panel.right { transform: none; }
  .sheet-head { display: flex; justify-content: flex-end; padding: var(--ui-space-xs) var(--ui-space-xs) 0; }
  .tabs { position: static; }
  .panel.left { display: flex; overflow-y: auto; }
  .rail { display: none; }
  /* 휴대폰: 막대 높이가 상태마다 달라지면 사이트 화면이 위아래로 밀려서, 누른 자리와 고른 요소가 어긋난다. 높이를 고정한다. */
  .ctxbar { min-height: 0; height: 48px; overflow: hidden; }
  .ctx-empty { overflow-x: auto; white-space: nowrap; scrollbar-width: none; line-height: 48px; }
  .ctx-range input { width: 64px; }
  .mobilebar { position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-bar); display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); height: var(--bar-h); padding-bottom: env(safe-area-inset-bottom); border-top: 0; background: var(--ui-panel); box-shadow: 0 -1px 0 var(--ui-rule); }
  .mobilebar button { display: grid; place-items: center; align-content: center; gap: var(--ui-space-3xs); border: 0; background: none; color: var(--ui-muted); font-size: var(--ui-text-xs); font-weight: 600; }
  .mobilebar button:active { background: var(--ui-paper-2); }
  .mobilebar button .ic { box-sizing: content-box; padding: var(--ui-space-2xs) var(--ui-space-sm); border-radius: var(--ui-radius-pill); }
  .mobilebar button[aria-pressed='true'] { color: var(--ui-ink); }
  .mobilebar button[aria-pressed='true'] .ic { background: var(--ui-black); color: var(--ui-lime); }
  .lfb-tools .name { display: none; }
  .modal-card { padding: var(--ui-space-lg) var(--ui-space-md); }
  .modal-card.start { padding: var(--ui-space-xs); }
  .start-grid { grid-template-columns: minmax(0, 1fr); gap: var(--ui-space-xs); }
  .start-main { padding: var(--ui-space-lg) var(--ui-space-md); }
  .start-side { padding: var(--ui-space-sm) var(--ui-space-2xs) var(--ui-space-2xs); }
  .examples { grid-auto-rows: minmax(108px, auto); gap: var(--ui-space-xs); }
  .publish { grid-template-columns: minmax(0, 1fr); }
  .publish .main-col { padding-right: 0; border-right: 0; }
  #toasts { bottom: 76px; width: calc(100% - var(--ui-space-xl)); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

/* motion controls and frozen motion in the editor canvas */
#canvas .lf-marquee-track { animation: none; }
.lfb-band { pointer-events: none; }
.motion-list { display: grid; gap: var(--ui-space-2xs); margin-bottom: var(--ui-space-sm); }
.motion-opt { padding: var(--ui-space-xs) var(--ui-space-sm); border-radius: var(--ui-radius); background: var(--ui-paper-2); }
.motion-opt span { display: grid; gap: var(--ui-space-3xs); }
.motion-opt b { color: var(--ui-ink); font-weight: 700; }
.motion-opt small { color: var(--ui-muted); }
/* 편집 화면 안에서는 휴대폰 메뉴 서랍을 화면 전체가 아니라 머리글 아래에 펼친다. */
#canvas .lf-mnav[open] > summary::before { content: none; }
#canvas .lf-mnav-panel { position: absolute; top: calc(100% + 8px); bottom: auto; right: 0; max-height: 60vh; animation: none; border-radius: var(--ui-radius); }
#canvas .lf-header { position: relative; }

/* 편집기 안 미리보기 창 */
.motion-acts { display: flex; flex-wrap: wrap; gap: var(--ui-space-2xs); margin-bottom: var(--ui-space-xs); }
.preview-modal { padding: var(--ui-space-sm); }
.preview-card { display: flex; flex-direction: column; width: min(1440px, 100%); height: calc(100dvh - var(--ui-space-md)); border-radius: var(--ui-radius-card); background: var(--ui-ground); box-shadow: var(--ui-shadow); overflow: hidden; }
.preview-bar { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ui-space-xs); padding: var(--ui-space-xs) var(--ui-space-sm); background: var(--ui-panel); }
.preview-bar h2 { margin: 0 auto 0 var(--ui-space-2xs); font-size: var(--ui-text-lg); font-weight: 800; }
/* 미리보기 화면 높이는 실제 방문자처럼 기기 화면 높이로 둔다(대표 배너 높이가 화면 높이를 따르기 때문). 넘치는 만큼은 창 안에서 스크롤한다. */
.preview-stage { flex: 1; min-height: 0; display: grid; justify-items: center; align-items: start; padding: var(--ui-space-sm); overflow: auto; }
.preview-stage iframe { width: 100%; height: 100svh; border: 0; border-radius: var(--ui-radius); background: var(--ui-panel); box-shadow: var(--ui-shadow-card); }
.preview-stage[data-mode='mobile'] iframe { width: 390px; max-width: 100%; }
.preview-note { margin: 0; padding: var(--ui-space-xs) var(--ui-space-sm); font-size: var(--ui-text-sm); color: var(--ui-muted); background: var(--ui-panel); }
@media (max-width: 860px) {
  .preview-modal { padding: 0; }
  .preview-card { width: 100%; height: 100dvh; border-radius: 0; }
  .preview-bar { flex-wrap: nowrap; gap: var(--ui-space-2xs); padding: var(--ui-space-xs); }
  .preview-bar h2, .preview-bar .seg-btn { font-size: 0; gap: 0; }
  .preview-bar h2 { display: none; }
  .preview-bar .btn.small { font-size: 0; gap: 0; padding-inline: var(--ui-space-xs); }
  .preview-bar .seg { margin-right: auto; }
  .preview-stage { padding: 0; }
  .preview-stage iframe { border-radius: 0; box-shadow: none; }
}
@media (pointer: coarse) {
  .lfb-handle { width: 16px; height: 16px; border-radius: 50%; }
  .lfb-handle[data-h='nw'], .lfb-handle[data-h='sw'], .lfb-handle[data-h='w'] { left: -9px; }
  .lfb-handle[data-h='ne'], .lfb-handle[data-h='se'], .lfb-handle[data-h='e'] { right: -9px; }
  .lfb-handle[data-h='nw'], .lfb-handle[data-h='ne'], .lfb-handle[data-h='n'] { top: -9px; }
  .lfb-handle[data-h='sw'], .lfb-handle[data-h='se'], .lfb-handle[data-h='s'] { bottom: -9px; }
  .lfb-handle[data-h='n'], .lfb-handle[data-h='s'] { left: calc(50% - 8px); }
  .lfb-handle[data-h='e'], .lfb-handle[data-h='w'] { top: calc(50% - 8px); }
  .lfb-rot { width: 28px; height: 28px; left: calc(50% - 14px); }
}
/* 블록 글자를 고른 동안에는 블록 도구 막대가 글자를 가리지 않게 숨긴다. 빈 곳을 누르면 다시 나온다. */
#canvas:has(.lfb-selbox--field) .lfb-tools { display: none; }
.lfb-selbox.is-short .lfb-handle[data-h='n'], .lfb-selbox.is-short .lfb-handle[data-h='s'], .lfb-selbox.is-narrow .lfb-handle[data-h='e'], .lfb-selbox.is-narrow .lfb-handle[data-h='w'] { display: none; }
/* 휴대폰에서는 두 손가락으로 돌리므로, 아래 요소를 가리는 회전 손잡이를 숨긴다. */
@media (pointer: coarse) { .lfb-rot { display: none; } }
/* 장식(원, 아치, 점, 큰 글자)도 눌러서 고를 수 있다 */
#canvas [data-deco] { cursor: pointer; touch-action: manipulation; }
#canvas [data-deco]:hover { outline: 1px dashed var(--ui-rule-2); outline-offset: 2px; }
#canvas .lfb-field-sel[data-deco] { touch-action: none; cursor: move; outline: none; }
#canvas .lf-art-hint { pointer-events: none; }
