:root {
  --bg: #090a12;
  --panel: #121420;
  --panel-2: #171a29;
  --panel-3: #1e2233;
  --line: #2a2e42;
  --line-strong: #3b4059;
  --text: #f3f4ff;
  --muted: #9da2bc;
  --faint: #6f748c;
  --accent: #8d78ff;
  --accent-2: #57d8ff;
  --accent-soft: rgba(141, 120, 255, .16);
  --danger: #ff6b8a;
  --success: #61e6a8;
  --shadow: 0 14px 40px rgba(0, 0, 0, .34);
  --radius: 12px;
  --topbar-h: 58px;
  --status-h: 27px;
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; background: var(--bg); color: var(--text); }
body { font-size: 13px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { border: 0; }
button:not(:disabled) { cursor: pointer; }
button:disabled { opacity: .38; cursor: not-allowed; }
input, select, textarea {
  border: 1px solid var(--line);
  background: #0e101a;
  border-radius: 7px;
  outline: none;
  min-height: 30px;
  padding: 5px 8px;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(141, 120, 255, .14); }
input[type="number"] { width: 84px; }
input[type="range"] { min-height: 0; padding: 0; accent-color: var(--accent); }
input[type="checkbox"] { width: 15px; height: 15px; min-height: 0; padding: 0; accent-color: var(--accent); }
textarea { resize: vertical; }
small { color: var(--muted); }

.app-shell { height: 100%; display: grid; grid-template-rows: var(--topbar-h) minmax(0, 1fr) var(--status-h); }
.topbar {
  position: relative;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(16, 18, 29, .96);
  box-shadow: 0 3px 20px rgba(0, 0, 0, .22);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 210px; }
.brand-mark {
  width: 34px; height: 34px; display: grid; place-items: center;
  border-radius: 10px; color: white; font-size: 18px;
  background: radial-gradient(circle at 35% 30%, #9ae9ff, #806eff 55%, #3d2f86);
  box-shadow: 0 0 22px rgba(116, 111, 255, .45);
}
.brand strong, .brand span { display: block; }
.brand strong { font-size: 14px; letter-spacing: .01em; }
.brand span { font-size: 10px; color: var(--muted); margin-top: 1px; }
.top-actions { display: flex; align-items: center; gap: 6px; min-width: 0; }
.divider { width: 1px; height: 22px; background: var(--line); margin: 0 3px; }

.ui-btn, .icon-btn, .zoom-label {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 32px; padding: 0 11px; border: 1px solid var(--line);
  border-radius: 8px; background: #191c2b; color: #e9eaff;
  transition: background .15s, border-color .15s, transform .08s;
}
.ui-btn:hover, .icon-btn:hover, .zoom-label:hover { background: #22263a; border-color: var(--line-strong); }
.ui-btn:focus-visible, .icon-btn:focus-visible, .zoom-label:focus-visible, button:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.ui-btn:active, .icon-btn:active, .zoom-label:active { transform: translateY(1px); }
.ui-btn.compact { min-height: 30px; padding: 0 9px; font-size: 12px; }
.ui-btn.tiny { min-height: 27px; padding: 0 8px; font-size: 11px; }
.ui-btn.accent { border-color: #8c7cff; background: linear-gradient(135deg, #7d68ee, #9d77ff); color: white; box-shadow: 0 4px 16px rgba(125, 104, 238, .22); }
.ui-btn.accent:hover { background: linear-gradient(135deg, #8975f5, #ac86ff); }
.ui-btn.fill { width: 100%; }
.icon-btn { width: 32px; min-width: 32px; padding: 0; font-size: 17px; }
.icon-btn.danger:hover { color: white; background: rgba(255, 91, 124, .2); border-color: rgba(255, 91, 124, .45); }
.icon-btn.toggle-on { color: var(--accent-2); background: rgba(87, 216, 255, .1); border-color: rgba(87, 216, 255, .32); }
.zoom-label { min-width: 55px; padding: 0 7px; font-size: 11px; }

.workspace { min-height: 0; display: grid; grid-template-columns: 66px minmax(360px, 1fr) 318px; }
.tool-rail {
  position: relative; z-index: 10;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 8px 6px; border-right: 1px solid var(--line); background: var(--panel);
  overflow-y: auto; overflow-x: hidden;
}
.tool-btn {
  width: 52px; min-height: 49px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border-radius: 9px; color: var(--muted); background: transparent; border: 1px solid transparent;
  transition: .15s;
}
.tool-btn span { font-size: 21px; line-height: 20px; font-family: Georgia, serif; }
.tool-btn small { font-size: 10px; margin-top: 4px; color: inherit; }
.tool-btn:hover { background: var(--panel-3); color: white; }
.tool-btn.active { color: #fff; border-color: rgba(141, 120, 255, .42); background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.tool-spacer { flex: 1; }

.stage-column { min-width: 0; min-height: 0; display: grid; grid-template-rows: 43px minmax(160px, 1fr) auto; background: #080910; }
.context-bar {
  position: relative; z-index: 9;
  display: grid; grid-template-columns: minmax(170px, .7fr) minmax(180px, 1.3fr) auto;
  align-items: center; gap: 10px; padding: 5px 9px;
  border-bottom: 1px solid var(--line); background: #11131e;
}
.context-left { min-width: 0; display: flex; align-items: baseline; gap: 8px; overflow: hidden; }
.context-left strong { white-space: nowrap; }
.context-left span { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 11px; }
.tool-options { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tool-options label { display: flex; align-items: center; gap: 5px; color: var(--muted); white-space: nowrap; font-size: 11px; }
.tool-options input[type="number"] { width: 61px; min-height: 27px; }
.tool-options input[type="range"] { width: 90px; }
.view-actions { display: flex; align-items: center; gap: 4px; }

.canvas-wrap {
  min-width: 0; min-height: 0; position: relative; overflow: hidden;
  contain: layout paint;
  background-color: #090a11;
  background-image: radial-gradient(circle at center, rgba(92, 99, 145, .08), transparent 56%);
  touch-action: none; user-select: none;
}
.canvas-wrap::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .26;
  background-image: linear-gradient(45deg, rgba(255,255,255,.025) 25%, transparent 25%), linear-gradient(-45deg, rgba(255,255,255,.025) 25%, transparent 25%), linear-gradient(45deg, transparent 75%, rgba(255,255,255,.025) 75%), linear-gradient(-45deg, transparent 75%, rgba(255,255,255,.025) 75%);
  background-size: 24px 24px; background-position: 0 0, 0 12px, 12px -12px, -12px 0;
}
#editorCanvas { display: block; width: 100%; height: 100%; position: relative; z-index: 1; outline: none; }
.snap-badge {
  position: absolute; z-index: 4; transform: translate(12px, 12px); pointer-events: none;
  background: rgba(87, 216, 255, .92); color: #071018; padding: 3px 6px; border-radius: 5px; font-size: 10px; font-weight: 700;
}
.empty-hint { position: absolute; inset: 0; z-index: 2; pointer-events: none; display: grid; place-content: center; text-align: center; gap: 5px; color: var(--muted); }
.empty-hint strong { color: #d4d7eb; font-size: 16px; }

.timeline-panel { height: 226px; min-height: 44px; border-top: 1px solid var(--line); background: #10121c; display: grid; grid-template-rows: 42px minmax(0, 1fr); }
.timeline-panel.collapsed { height: 43px; }
.timeline-panel.collapsed .timeline-scroll { display: none; }
.timeline-panel.collapsed #collapseTimelineBtn { transform: rotate(180deg); }
.timeline-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 8px; border-bottom: 1px solid var(--line); }
.play-controls, .timeline-global-controls { display: flex; align-items: center; gap: 5px; }
.timeline-global-controls label { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11px; }
.timeline-global-controls input[type="number"] { width: 55px; min-height: 27px; padding: 3px 5px; }
.time-readout { min-width: 92px; color: #d5d8ea; font-variant-numeric: tabular-nums; font-size: 11px; }
.timeline-scroll { overflow: auto; min-height: 0; }
.timeline-ruler-row, .timeline-row { min-width: 620px; display: grid; grid-template-columns: 145px minmax(475px, 1fr); }
.timeline-ruler-row { position: sticky; top: 0; z-index: 5; height: 25px; background: #141725; border-bottom: 1px solid var(--line); }
.timeline-name-cell { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 0 8px; border-right: 1px solid var(--line); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 11px; }
.timeline-row { height: 31px; border-bottom: 1px solid rgba(42, 46, 66, .68); }
.timeline-row.selected { background: rgba(141, 120, 255, .08); box-shadow: inset 3px 0 var(--accent); }
.timeline-row.primary { background: rgba(255, 211, 106, .07); box-shadow: inset 3px 0 #ffd36a; }
.timeline-row .timeline-name-cell { color: var(--muted); }
.timeline-row.selected .timeline-name-cell { color: white; }
.timeline-row.primary .timeline-name-cell::before { content: "◆"; color: #ffd36a; font-size: 7px; }
.timeline-track { position: relative; min-width: 475px; background-image: linear-gradient(to right, rgba(255,255,255,.035) 1px, transparent 1px); background-size: 10% 100%; }
.ruler-track { background-color: #141725; }
.ruler-tick { position: absolute; top: 0; height: 100%; border-left: 1px solid #3a3e55; color: var(--faint); padding: 5px 0 0 4px; font-size: 9px; }
.timeline-bar { position: absolute; top: 5px; height: 21px; min-width: 8px; border: 1px solid rgba(164, 153, 255, .8); border-radius: 5px; background: linear-gradient(90deg, rgba(110, 92, 225, .88), rgba(96, 174, 241, .72)); box-shadow: 0 2px 8px rgba(66, 55, 160, .24); }
.timeline-bar.mode-none { background: #373b50; border-color: #555a73; }
.timeline-bar span { position: absolute; inset: 0 7px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; font-size: 9px; color: white; pointer-events: none; }
.timeline-handle { position: absolute; top: -1px; width: 7px; height: 21px; background: rgba(255,255,255,.18); cursor: ew-resize; }
.timeline-handle.left { left: 0; border-radius: 4px 0 0 4px; }
.timeline-handle.right { right: 0; border-radius: 0 4px 4px 0; }
.timeline-playhead { position: absolute; z-index: 4; top: 0; bottom: 0; width: 1px; background: #ff7698; pointer-events: none; }
.timeline-playhead::before { content: ""; position: absolute; left: -4px; top: -1px; width: 9px; height: 6px; border-radius: 2px; background: #ff7698; }
.timeline-empty { padding: 18px; color: var(--faint); text-align: center; }

.right-panel { min-width: 0; min-height: 0; display: grid; grid-template-rows: 42px minmax(0, 1fr); border-left: 1px solid var(--line); background: var(--panel); }
.panel-tabs { display: grid; grid-template-columns: repeat(5, 1fr); border-bottom: 1px solid var(--line); background: #10121c; }
.panel-tab { position: relative; background: transparent; color: var(--muted); font-size: 11px; }
.panel-tab:hover { color: white; background: rgba(255,255,255,.025); }
.panel-tab.active { color: white; }
.panel-tab.active::after { content: ""; position: absolute; left: 20%; right: 20%; bottom: 0; height: 2px; background: var(--accent); border-radius: 2px 2px 0 0; }
.panel-content { overflow: auto; min-height: 0; }
.panel-page { display: none; padding: 12px; }
.panel-page.active { display: block; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.panel-heading strong, .panel-heading small { display: block; }
.panel-heading small { margin-top: 2px; font-size: 10px; }
.button-cluster { display: flex; gap: 4px; }
.selection-placeholder { padding: 28px 14px; color: var(--faint); text-align: center; border: 1px dashed var(--line); border-radius: 10px; }
.inspector-grid { display: grid; gap: 11px; }
.control-group { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(22, 25, 39, .72); display: grid; gap: 8px; }
.alignment-panel { margin-bottom: 10px; padding: 0; gap: 0; overflow: clip; }
.alignment-panel > summary { min-height: 38px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; color: white; cursor: pointer; font-size: 12px; font-weight: 700; list-style: none; user-select: none; }
.alignment-panel > summary::-webkit-details-marker { display: none; }
.alignment-panel > summary::before { content: "▸"; color: var(--accent-2); font-size: 10px; transition: transform .14s; }
.alignment-panel[open] > summary::before { transform: rotate(90deg); }
.alignment-panel > summary > span { margin-right: auto; }
.alignment-panel > summary output { padding: 2px 6px; border-radius: 999px; background: rgba(141, 120, 255, .16); color: #dcd7ff; font-size: 9px; font-weight: 600; }
.alignment-panel-body { display: grid; gap: 8px; padding: 9px 10px 10px; border-top: 1px solid rgba(42, 46, 66, .72); }
.alignment-panel:not([open]) > .alignment-panel-body { display: none; }
.alignment-selection-actions, .alignment-distribute-grid, .symmetry-alignment-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; }
.alignment-selection-actions .ui-btn { min-height: 29px; padding: 0 7px; font-size: 10px; }
.alignment-reference-row { display: flex; align-items: center; justify-content: space-between; gap: 7px; color: var(--muted); font-size: 10px; }
.alignment-reference-row select { width: 190px; min-width: 0; min-height: 29px; padding: 3px 6px; font-size: 10px; }
.alignment-button-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 4px; }
.alignment-button-grid button, .alignment-distribute-grid button, .symmetry-alignment-grid button { min-width: 0; min-height: 34px; padding: 4px; border: 1px solid var(--line); border-radius: 7px; background: #191c2b; color: #dfe2f3; font-size: 10px; }
.alignment-button-grid button { display: grid; place-items: center; align-content: center; gap: 1px; }
.alignment-button-grid button span { color: var(--accent-2); font-size: 16px; line-height: 1; }
.alignment-button-grid button small { max-width: 100%; overflow: hidden; color: var(--muted); font-size: 7px; line-height: 1.05; white-space: nowrap; text-overflow: ellipsis; }
.alignment-distribute-grid button span { margin-right: 4px; color: var(--accent-2); }
.alignment-button-grid button:not(:disabled):hover, .alignment-distribute-grid button:not(:disabled):hover, .symmetry-alignment-grid button:not(:disabled):hover { border-color: var(--accent); background: var(--accent-soft); color: white; }
.alignment-section-title { padding-top: 2px; color: var(--faint); font-size: 9px; font-weight: 700; letter-spacing: .03em; }
.symmetry-alignment-grid button { min-height: 31px; line-height: 1.15; }
.group-title { min-height: 21px; display: flex; align-items: center; justify-content: space-between; color: white; font-weight: 700; font-size: 12px; padding-bottom: 4px; border-bottom: 1px solid rgba(42, 46, 66, .72); }
.control-group > label { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 11px; }
.control-group > label > input:not([type="checkbox"]):not([type="range"]), .control-group > label > select, .control-group > label > textarea { width: 157px; }
.control-group > label > textarea { min-height: 58px; }
.check-label { justify-content: flex-start !important; gap: 7px !important; }
.check-label.wide { width: 100%; }
.color-control { display: grid; grid-template-columns: 35px 112px; gap: 5px; }
.color-control input[type="color"] { width: 35px !important; padding: 2px; }
.color-control input[type="text"] { width: 112px !important; text-transform: uppercase; font-family: ui-monospace, monospace; }
.number-with-unit { display: flex; align-items: center; }
.number-with-unit input { border-radius: 7px 0 0 7px; }
.number-with-unit em { height: 30px; min-width: 27px; display: grid; place-items: center; border: 1px solid var(--line); border-left: 0; border-radius: 0 7px 7px 0; color: var(--faint); background: #151827; font-style: normal; font-size: 9px; }
.range-pair { display: flex; align-items: center; gap: 7px; width: 157px; }
.range-pair input { width: 118px !important; }
.range-pair output { width: 32px; text-align: right; color: #d9dcf0; font-size: 10px; font-variant-numeric: tabular-nums; }
.switch { display: inline-flex !important; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: relative; width: 34px; height: 18px; border-radius: 10px; background: #34384c; border: 1px solid #454a61; transition: .15s; }
.switch span::after { content: ""; position: absolute; width: 12px; height: 12px; border-radius: 50%; left: 2px; top: 2px; background: #a9aec4; transition: .15s; }
.switch input:checked + span { background: rgba(141, 120, 255, .45); border-color: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); background: white; }
.help-text { display: block; font-size: 10px; line-height: 1.5; }
.rune-assistant { border: 1px solid rgba(141, 120, 255, .24); border-radius: 8px; background: rgba(10, 12, 21, .4); }
.rune-assistant > summary { padding: 8px; color: #ddd9ff; cursor: pointer; font-size: 11px; font-weight: 700; user-select: none; }
.rune-assistant[open] > summary { border-bottom: 1px solid rgba(42, 46, 66, .72); }
.rune-assistant-body { display: grid; gap: 8px; padding: 8px; }
.rune-option-row { display: flex; align-items: center; justify-content: space-between; gap: 7px; color: var(--muted); font-size: 10px; }
.rune-option-row select, .rune-option-row input { width: 174px; min-height: 29px; }
.rune-palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(38px, 1fr)); gap: 4px; max-height: 176px; overflow: auto; padding: 1px; }
.rune-button { min-width: 0; min-height: 50px; display: grid; place-items: center; align-content: center; gap: 2px; padding: 3px 1px; border: 1px solid var(--line); border-radius: 7px; background: #191c2b; color: #f4f1ff; }
.rune-button:hover, .rune-button:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.rune-button .rune-glyph { font: 23px/1 "Segoe UI Historic", "Noto Sans Runic", "Noto Sans Symbols 2", serif; }
.rune-button small { max-width: 100%; overflow: hidden; color: var(--muted); font-size: 8px; line-height: 1; text-overflow: ellipsis; }
.rune-empty { grid-column: 1 / -1; padding: 12px 5px; color: var(--faint); text-align: center; font-size: 10px; }
.rune-converter { display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid rgba(42, 46, 66, .72); }
.rune-converter > label { color: #d9dced; font-size: 10px; font-weight: 700; }
.rune-converter textarea { width: 100%; min-height: 48px; }
.rune-conversion-preview { min-height: 48px; display: grid; gap: 3px; padding: 6px 7px; border: 1px solid var(--line); border-radius: 7px; background: #0d0f18; }
.rune-conversion-preview span { color: var(--faint); font-size: 9px; }
.rune-conversion-preview output { overflow-wrap: anywhere; color: #f5f1ff; font: 20px/1.35 "Segoe UI Historic", "Noto Sans Runic", "Noto Sans Symbols 2", serif; }
.two-buttons, .layer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.style-presets, .animation-presets { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.style-presets button, .animation-presets button { min-height: 35px; border: 1px solid var(--line); border-radius: 8px; background: #191c2b; color: #d9dced; font-size: 11px; }
.style-presets button:hover, .animation-presets button:hover { border-color: var(--accent); background: var(--accent-soft); }
.nudge-grid { width: 126px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, 38px); gap: 4px; }
.nudge-grid button { height: 32px; border: 1px solid var(--line); border-radius: 7px; background: #1c2030; }
.nudge-grid button:hover { background: var(--accent-soft); border-color: var(--accent); }
.template-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.template-grid button { min-height: 83px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 1px solid var(--line); border-radius: 9px; background: #171a28; color: var(--text); }
.template-grid button:hover { border-color: var(--accent); background: var(--accent-soft); }
.template-grid .template-icon { font-family: Georgia, serif; font-size: 23px; color: var(--accent-2); }
.template-grid strong { font-size: 11px; }
.template-grid small { font-size: 9px; }

.layer-list { display: grid; gap: 4px; margin-bottom: 9px; }
.layer-row { display: grid; grid-template-columns: 25px 27px 27px minmax(0, 1fr) 25px; align-items: center; min-height: 42px; border: 1px solid var(--line); border-radius: 8px; background: #171a28; overflow: hidden; }
.layer-row:hover { border-color: var(--line-strong); }
.layer-row.selected { border-color: rgba(141, 120, 255, .62); background: rgba(141, 120, 255, .1); box-shadow: inset 3px 0 var(--accent); }
.layer-row.primary { border-color: #ffd36a; background: rgba(255, 211, 106, .09); box-shadow: inset 3px 0 #ffd36a; }
.layer-row button { height: 100%; background: transparent; color: var(--faint); }
.layer-row button:hover { color: white; background: rgba(255,255,255,.04); }
.layer-select-check { justify-self: center; }
.layer-main { min-width: 0; padding: 5px 4px; }
.layer-main strong, .layer-main small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.layer-main strong { font-size: 11px; }
.layer-main small { font-size: 9px; margin-top: 2px; }
.layer-swatch { width: 6px; height: 22px; border-radius: 4px; justify-self: center; box-shadow: 0 0 8px currentColor; }

.statusbar { display: flex; align-items: center; gap: 13px; padding: 0 9px; border-top: 1px solid var(--line); background: #0e1019; color: var(--faint); font-size: 10px; }
.status-spacer { flex: 1; }
.status-link { background: transparent; color: var(--muted); padding: 0; text-decoration: underline; text-underline-offset: 2px; }

.modal-backdrop { position: fixed; z-index: 90; inset: 0; background: rgba(2, 3, 9, .72); backdrop-filter: blur(4px); }
dialog.modal { z-index: 100; width: min(780px, calc(100vw - 30px)); max-height: calc(100vh - 30px); padding: 0; border: 1px solid var(--line-strong); border-radius: 14px; background: #11131f; color: var(--text); box-shadow: 0 28px 80px rgba(0,0,0,.6); overflow: hidden; }
dialog::backdrop { background: transparent; }
.modal form { display: grid; max-height: calc(100vh - 32px); grid-template-rows: auto minmax(0, 1fr) auto auto; }
.modal-header { min-height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); background: #151827; }
.modal-header strong, .modal-header span { display: block; }
.modal-header strong { font-size: 15px; }
.modal-header span { color: var(--muted); font-size: 10px; margin-top: 2px; }
.modal-body { overflow: auto; padding: 14px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 7px; padding: 10px 14px; border-top: 1px solid var(--line); background: #12141f; }
.export-layout { display: grid; grid-template-columns: minmax(270px, 1.2fr) minmax(250px, .8fr); gap: 14px; }
.export-preview-wrap { position: relative; min-height: 330px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; background-color: #0a0b12; background-image: linear-gradient(45deg,#171925 25%,transparent 25%),linear-gradient(-45deg,#171925 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#171925 75%),linear-gradient(-45deg,transparent 75%,#171925 75%); background-size: 18px 18px; background-position: 0 0,0 9px,9px -9px,-9px 0; }
#exportPreview { max-width: calc(100% - 24px); max-height: 306px; box-shadow: 0 7px 28px rgba(0,0,0,.55); }
#exportPreviewLabel { position: absolute; bottom: 7px; right: 8px; border-radius: 5px; background: rgba(5,6,12,.75); padding: 3px 6px; color: var(--muted); font-size: 9px; }
.export-settings { display: grid; align-content: start; gap: 10px; }
.export-size-readout { padding: 7px; border-radius: 7px; background: #0d0f18; color: #d9dced; text-align: center; font-family: ui-monospace, monospace; }
.export-buttons { display: grid; grid-template-columns: repeat(5, 1fr); }
.format-btn { min-height: 54px; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: #191c2b; color: white; }
.format-btn:hover { border-color: var(--accent); background: var(--accent-soft); }
.format-btn strong, .format-btn span { display: block; }
.format-btn strong { font-size: 12px; }
.format-btn span { margin-top: 2px; color: var(--muted); font-size: 8px; }
.format-btn.animated strong::after { content: "●"; color: var(--accent-2); font-size: 6px; margin-left: 4px; vertical-align: middle; }
.export-progress-area { display: grid; grid-template-columns: 1fr auto; gap: 7px 10px; padding: 10px 14px; border-top: 1px solid var(--line); background: #0e101a; }
.progress-copy { display: flex; justify-content: space-between; font-size: 10px; }
.export-progress-area progress { width: 100%; height: 8px; grid-column: 1; accent-color: var(--accent); }
.export-progress-area button { grid-column: 2; grid-row: 1 / span 2; }
.help-content { display: grid; gap: 10px; }
.help-content article { display: grid; grid-template-columns: 31px 1fr; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #171a28; }
.help-content article > b { width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: #beb4ff; }
.help-content article strong { font-size: 12px; }
.help-content article p { margin: 4px 0 0; color: var(--muted); line-height: 1.55; font-size: 11px; }
.shortcut-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; color: var(--muted); font-size: 10px; }
kbd { display: inline-grid; min-width: 24px; height: 22px; place-items: center; margin-right: 4px; padding: 0 5px; border: 1px solid #454a61; border-bottom-width: 2px; border-radius: 5px; background: #202437; color: white; font-size: 9px; }
.license-content { display: grid; gap: 9px; }
.license-content section { padding: 10px; border: 1px solid var(--line); border-radius: 8px; background: #171a28; }
.license-content p { margin: 4px 0 0; color: var(--muted); line-height: 1.5; font-size: 11px; }
.license-note { padding: 10px; border-radius: 8px; background: rgba(87, 216, 255, .07); border: 1px solid rgba(87, 216, 255, .18); }
.toast-region { position: fixed; z-index: 130; right: 14px; bottom: 38px; display: grid; gap: 7px; pointer-events: none; }
.toast { min-width: 220px; max-width: 360px; padding: 9px 11px; border: 1px solid var(--line-strong); border-radius: 9px; background: rgba(25, 28, 43, .96); color: white; box-shadow: var(--shadow); animation: toast-in .18s ease-out; }
.toast.error { border-color: rgba(255, 107, 138, .5); }
.toast.success { border-color: rgba(97, 230, 168, .42); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1100px) {
  .workspace { grid-template-columns: 58px minmax(330px, 1fr) 286px; }
  .tool-btn { width: 46px; }
  .brand span { display: none; }
  .top-actions .compact { font-size: 0; width: 32px; padding: 0; }
  #newProjectBtn::before { content: "+"; font-size: 17px; }
  #saveProjectBtn::before { content: "⇩"; font-size: 16px; }
  #loadProjectBtn::before { content: "⇧"; font-size: 16px; }
  #helpBtn::before { content: "?"; font-size: 14px; }
  .timeline-global-controls .ui-btn { font-size: 0; width: 28px; padding: 0; }
  #autoSequenceBtn::before { content: "1→"; font-size: 10px; }
  #centerSequenceBtn::before { content: "◎→"; font-size: 10px; }
  #reverseSequenceBtn::before { content: "↔"; font-size: 13px; }
}

@media (max-width: 820px) {
  html, body { overflow: auto; min-width: 620px; }
  .app-shell { min-width: 620px; min-height: 760px; }
  .workspace { grid-template-columns: 58px minmax(420px, 1fr); grid-template-rows: minmax(500px, 1fr) 380px; }
  .right-panel { grid-column: 1 / -1; grid-row: 2; border-left: 0; border-top: 1px solid var(--line); }
  .panel-content { max-height: 338px; }
  .panel-page { max-width: 900px; margin: 0 auto; }
  .inspector-grid { grid-template-columns: repeat(2, minmax(250px, 1fr)); }
  .style-presets, .animation-presets { align-content: start; }
  .export-layout { grid-template-columns: 1fr; }
  .export-preview-wrap { min-height: 250px; }
  .export-buttons { grid-template-columns: repeat(3, 1fr); }
}
