:root {
  color-scheme: dark;
  --bg: #0b1017;
  --surface: #111923;
  --surface-2: #17222f;
  --surface-3: #1d2a39;
  --line: #273646;
  --text: #edf3f8;
  --muted: #8d9bab;
  --faint: #5e6e7f;
  --accent: #70a9ff;
  --success: #79dbb0;
  --warning: #f4c76e;
  --danger: #ee7788;
  --shadow: 0 18px 50px rgba(0, 0, 0, .26);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--text); overflow: hidden; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
code { font-family: "SFMono-Regular", Consolas, monospace; color: #c5ddff; }

.app-shell { height: 100%; display: flex; flex-direction: column; background: radial-gradient(circle at 70% -30%, rgba(62, 108, 172, .15), transparent 38%), var(--bg); }
.topbar { min-height: 70px; display: flex; align-items: center; gap: 20px; padding: 12px 18px; border-bottom: 1px solid var(--line); background: rgba(14, 20, 28, .94); z-index: 10; }
.brand-block { display: flex; align-items: center; gap: 10px; min-width: 186px; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: #2f6fc5; color: white; font-weight: 800; box-shadow: 0 5px 18px rgba(49, 116, 210, .34); }
.brand-name { font-size: 15px; font-weight: 760; letter-spacing: -.01em; }
.brand-subtitle { color: var(--muted); font-size: 10px; letter-spacing: .07em; text-transform: uppercase; margin-top: 2px; }
#docs-version { color: #91bfff; }
.mode-tabs { display: flex; align-items: center; gap: 3px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: #0c141d; }
.mode-tab { border: 0; border-radius: 7px; padding: 8px 11px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; white-space: nowrap; transition: .16s ease; }
.mode-tab:hover { color: var(--text); background: var(--surface-3); }
.mode-tab.active { color: #e7f1ff; background: #245188; box-shadow: 0 4px 12px rgba(38, 91, 155, .26); }
.toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 1; }
.plugin-toolbar { min-width: 0; }
.tool-button, .canvas-action, .small-icon-button { border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 650; padding: 8px 9px; transition: .16s ease; white-space: nowrap; }
.tool-button span { color: var(--faint); margin-right: 4px; font-size: 14px; }
.tool-button:hover, .canvas-action:hover, .small-icon-button:hover { background: var(--surface-3); border-color: var(--line); color: var(--text); }
.tool-button.primary { color: #dceaff; background: #244f88; border-color: #376eaf; }
.tool-button.primary:hover { background: #2e66a8; }
.tool-button.sync { color: #bbd3f8; }
.tool-button.danger:hover { color: #ffabb8; border-color: rgba(238, 119, 136, .45); background: rgba(238, 119, 136, .08); }
.tool-divider { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.icon-only { font-size: 17px; padding-inline: 8px; }
.status-cluster { min-width: 170px; display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.saved-indicator { color: var(--success); font-size: 10px; white-space: nowrap; }
.saved-indicator i { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 5px; background: currentColor; box-shadow: 0 0 10px currentColor; }
.saved-indicator.unsaved { color: var(--warning); }
.project-title { max-width: 170px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; color: var(--muted); }

.editor-grid { min-height: 0; flex: 1; display: grid; grid-template-columns: 270px minmax(420px, 1fr) minmax(300px, 420px); gap: 10px; padding: 10px; }
.editor-grid.library-collapsed { grid-template-columns: 52px minmax(420px, 1fr) minmax(300px, 420px); }.editor-grid.library-collapsed .library-panel > *:not(.panel-heading) { display: none; }.editor-grid.library-collapsed .panel-heading { padding-inline: 11px; }.editor-grid.library-collapsed .panel-heading h1, .editor-grid.library-collapsed .panel-heading .eyebrow { display: none; }
.panel, .workspace-panel { min-width: 0; min-height: 0; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(17, 25, 35, .86); box-shadow: var(--shadow); overflow: hidden; }
.library-panel, .code-panel { display: flex; flex-direction: column; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; padding: 18px 17px 14px; border-bottom: 1px solid var(--line); }
.eyebrow { color: var(--faint); font-size: 9px; font-weight: 800; letter-spacing: .16em; margin-bottom: 4px; }
h1, h2, p { margin: 0; }
.panel-heading h1 { font-size: 16px; letter-spacing: -.025em; }
.small-icon-button, .modal-close { display: grid; place-items: center; width: 29px; height: 29px; padding: 0; border-color: var(--line); color: var(--muted); font-size: 16px; }
.library-search-wrap, .global-search-wrap { display: flex; align-items: center; gap: 8px; margin: 14px 14px 8px; padding: 0 10px; border: 1px solid var(--line); border-radius: 9px; background: #0d151e; color: var(--faint); }
.library-search-wrap input, .global-search-wrap input { width: 100%; padding: 9px 0; border: 0; outline: 0; color: var(--text); background: transparent; font-size: 12px; }
.library-hint { padding: 0 16px 12px; color: var(--faint); font-size: 10px; }
.hint-dot, .live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px rgba(121, 219, 176, .6); margin-right: 5px; }
.library-body { min-height: 0; flex: 1; display: grid; grid-template-columns: 72px minmax(0, 1fr); overflow: hidden; border-top: 1px solid rgba(48, 66, 84, .48); }
.category-rail { min-width: 0; overflow-y: auto; overflow-x: hidden; padding: 9px 6px 14px; border-right: 1px solid var(--line); background: rgba(11, 18, 26, .52); scrollbar-width: thin; }
.category-rail-button { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; min-height: 48px; margin: 3px 0; padding: 5px 2px; border: 1px solid transparent; border-radius: 8px; color: var(--muted); background: transparent; font-size: 8px; font-weight: 700; line-height: 1.15; text-align: center; transition: .16s ease; }
.category-rail-button:hover { color: var(--text); background: var(--surface-3); }
.category-rail-button.active { border-color: var(--category-color); color: var(--text); background: color-mix(in srgb, var(--category-color) 16%, transparent); box-shadow: inset 3px 0 0 var(--category-color); }
.category-rail-icon { display: grid; place-items: center; width: 22px; height: 22px; margin-bottom: 4px; border-radius: 6px; color: #09111a; background: var(--category-color); font-size: 10px; font-weight: 900; }
.category-rail-button small { max-width: 62px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 8px; }
.block-library { min-width: 0; min-height: 0; overflow: auto; padding: 0 10px 16px; scrollbar-width: thin; }
.library-category { margin-top: 12px; }
.library-category-title { display: flex; align-items: center; gap: 7px; padding: 5px 6px 6px; color: var(--muted); font-size: 10px; font-weight: 760; letter-spacing: .08em; text-transform: uppercase; }
.category-chip { width: 7px; height: 7px; border-radius: 2px; background: var(--category-color); }
.library-card { display: flex; align-items: flex-start; gap: 9px; width: 100%; margin: 4px 0; padding: 10px 10px; border: 1px solid transparent; border-radius: 10px; background: rgba(27, 40, 54, .6); color: var(--text); text-align: left; transition: .16s ease; }
.library-card:hover { transform: translateX(2px); border-color: var(--category-color); background: rgba(35, 54, 74, .86); }
.library-card:active { cursor: grabbing; transform: scale(.985); }
.card-icon { width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center; border-radius: 6px; background: var(--category-color); color: #09111a; font-size: 11px; font-weight: 900; }
.card-copy { min-width: 0; }
.card-title { font-size: 11px; font-weight: 690; line-height: 1.25; }
.card-pattern { display: block; margin-top: 3px; color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-badge { display: inline-block; margin-top: 5px; color: var(--faint); font-size: 9px; }
.no-results { padding: 25px 12px; color: var(--muted); text-align: center; font-size: 11px; }
.target-badge { padding: 5px 7px; border: 1px solid rgba(121, 219, 176, .34); border-radius: 6px; color: var(--success); background: rgba(121, 219, 176, .08); font: 700 9px "SFMono-Regular", Consolas, monospace; }
.plugin-settings { margin: 0 12px 12px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: rgba(11, 18, 26, .56); }
.settings-title { margin-bottom: 9px; color: var(--faint); font-size: 9px; font-weight: 800; letter-spacing: .13em; }
.plugin-settings label, .plugin-file-editor label { display: block; margin-top: 7px; color: var(--muted); font-size: 9px; }
.plugin-settings input, .plugin-file-editor input { display: block; width: 100%; margin-top: 4px; padding: 7px 8px; border: 1px solid #2b3c4e; border-radius: 6px; outline: none; background: #0b131c; color: var(--text); font-size: 10px; }
.plugin-settings input:focus, .plugin-file-editor input:focus { border-color: #4d82c5; box-shadow: 0 0 0 2px rgba(79, 140, 215, .14); }
.target-lock { display: flex; gap: 6px; align-items: center; margin-top: 10px; padding-top: 8px; border-top: 1px solid #253443; color: var(--success); font-size: 9px; }
.target-lock span { font-size: 12px; }
.plugin-file-list { display: flex; gap: 5px; overflow-x: auto; padding: 9px 10px 7px; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.plugin-file-tab { display: flex; align-items: center; gap: 5px; flex: 0 0 auto; padding: 7px 9px; border: 1px solid transparent; border-radius: 7px; background: transparent; color: var(--muted); font-size: 10px; text-align: left; }
.plugin-file-tab:hover { color: var(--text); background: var(--surface-3); }
.plugin-file-tab.active { border-color: #3b6593; color: #e6f0ff; background: #20354b; }
.file-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--file-color, var(--accent)); }
.plugin-file-editor { padding: 0 12px 8px; }
.plugin-file-warning { margin-top: 6px; color: var(--warning); font-size: 9px; line-height: 1.35; }
.plugin-code-panel .code-output { min-height: 260px; }

.workspace-panel { position: relative; display: flex; flex-direction: column; }
.workspace-toolbar { height: 45px; display: flex; justify-content: space-between; align-items: center; padding: 0 13px 0 16px; border-bottom: 1px solid var(--line); background: rgba(22, 33, 46, .74); }
.workspace-heading { display: flex; align-items: center; font-size: 12px; font-weight: 750; }
.workspace-count { margin-left: 9px; color: var(--faint); font-size: 10px; font-weight: 500; }
.workspace-actions { display: flex; gap: 4px; }
.canvas-action { padding: 4px 8px; border-color: var(--line); font-size: 15px; line-height: 1; }
#zoom-reset { min-width: 42px; font-size: 10px; }
.blockly-host { position: relative; min-height: 0; flex: 1; touch-action: none; }
.blocklySvg { background: #111a24 !important; }
.blocklyMainBackground { stroke: #1f3040 !important; }
.blocklyToolboxDiv, .blocklyFlyout { display: none !important; }
.workspace-empty { position: absolute; z-index: 2; top: 50%; left: 50%; width: min(330px, 85%); transform: translate(-50%, -50%); color: var(--muted); text-align: center; pointer-events: none; transition: opacity .2s; }
.workspace-empty.is-hidden { opacity: 0; }
.empty-illustration { display: flex; justify-content: center; gap: 8px; margin-bottom: 18px; color: #4773a7; font-size: 32px; opacity: .85; }
.empty-illustration span:nth-child(2) { color: #79b6a5; transform: translateY(9px); }
.workspace-empty h2 { color: var(--text); font-size: 16px; margin-bottom: 8px; }
.workspace-empty p { font-size: 11px; line-height: 1.55; }
.code-heading { padding-bottom: 13px; }
.code-actions { display: flex; gap: 5px; }
.code-meta { padding: 11px 17px; color: var(--muted); font-size: 10px; border-bottom: 1px solid var(--line); }
.code-meta #code-line-count { float: right; color: var(--faint); }
.code-output { min-height: 0; flex: 1; overflow: auto; padding: 18px 10px 22px 0; background: #0e151e; outline: none; counter-reset: line; font: 12px/1.72 "SFMono-Regular", Consolas, "Liberation Mono", monospace; tab-size: 4; }
.code-line { display: flex; min-height: 20px; white-space: pre; }
.line-number { width: 38px; flex: 0 0 38px; padding-right: 10px; color: #435265; text-align: right; user-select: none; }
.line-code { padding-left: 10px; color: #d5e5f4; }
.syntax-keyword { color: #83b7ff; }.syntax-string { color: #a4d68e; }.syntax-variable { color: #f1c778; }.syntax-comment { color: #68778a; }.syntax-number { color: #e6a8e8; }.syntax-punctuation { color: #8fa4bc; }
.code-empty { padding: 30px 20px 30px 48px; color: var(--faint); font: 11px/1.6 Inter, sans-serif; }

.info-drawer { position: fixed; right: 18px; bottom: 18px; z-index: 8; width: min(370px, calc(100vw - 36px)); max-height: min(370px, 46vh); overflow: auto; border: 1px solid #35485d; border-radius: 14px; background: rgba(17, 26, 37, .97); box-shadow: 0 22px 70px rgba(0,0,0,.45); transform: translateY(calc(100% + 30px)); transition: transform .22s ease; }
.info-drawer.open { transform: translateY(0); }
.drawer-top { position: relative; min-height: 38px; }.drawer-handle { position: absolute; top: 10px; left: 50%; height: 3px; width: 36px; transform: translateX(-50%); border-radius: 9px; background: #55708e; }.drawer-top .small-icon-button { position: absolute; top: 6px; right: 10px; width: 27px; height: 27px; }
.block-info { padding: 10px 17px 18px; font-size: 11px; line-height: 1.5; }
.empty-info { color: var(--muted); }
.info-title { display: flex; justify-content: space-between; align-items: start; gap: 12px; margin-bottom: 3px; }.info-title h2 { font-size: 15px; }.info-category { color: var(--accent); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }.info-description { color: var(--muted); margin: 10px 0; }.info-label { margin: 10px 0 4px; color: var(--faint); font-size: 9px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; }.info-code { padding: 7px 8px; border-radius: 7px; background: #0b1118; color: #bfd8fa; font: 10px/1.45 "SFMono-Regular", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }.info-list { margin: 0; padding-left: 17px; color: var(--muted); }.info-source { display: inline-block; margin-top: 12px; font-size: 10px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 30; display: grid; place-items: center; padding: 20px; background: rgba(4, 8, 12, .76); backdrop-filter: blur(5px); }.modal-backdrop[hidden] { display: none; }.modal { width: min(780px, 100%); max-height: min(750px, 90vh); overflow: hidden; border: 1px solid #3b5068; border-radius: 16px; background: #141e2a; box-shadow: 0 30px 90px rgba(0,0,0,.5); }.compact-modal { width: min(520px, 100%); }.modal-top { display: flex; align-items: start; justify-content: space-between; padding: 22px 23px 11px; }.modal h2 { font-size: 19px; letter-spacing: -.025em; }.modal > p { padding: 0 23px 12px; color: var(--muted); font-size: 12px; line-height: 1.55; }.modal-close { border-radius: 8px; font-size: 22px; }.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 23px 20px; border-top: 1px solid var(--line); }.modal textarea { display: block; width: calc(100% - 46px); height: 250px; margin: 4px 23px 16px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; padding: 13px; outline: none; background: #0c131b; color: #d7e7f5; font: 12px/1.6 "SFMono-Regular", Consolas, monospace; }.modal textarea:focus, .global-search-wrap:focus-within, .library-search-wrap:focus-within { border-color: #4d82c5; box-shadow: 0 0 0 3px rgba(79, 140, 215, .14); }
.global-search-wrap { margin: 3px 23px 14px; }.search-layout { min-height: 330px; display: grid; grid-template-columns: 42% 58%; border-top: 1px solid var(--line); }.search-results { max-height: 55vh; overflow: auto; padding: 10px 8px 12px 17px; border-right: 1px solid var(--line); }.search-result { display: block; width: 100%; padding: 10px; margin: 3px 0; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--text); text-align: left; }.search-result:hover, .search-result.selected { border-color: #3a638f; background: #1c2c3d; }.search-result-name { font-size: 11px; font-weight: 700; }.search-result-meta { margin-top: 4px; color: var(--muted); font-size: 9px; }.search-detail { max-height: 55vh; overflow: auto; padding: 17px 20px; }.search-detail-empty { color: var(--faint); font-size: 11px; }.detail-add { margin-top: 15px; }.sync-status { display: flex; gap: 9px; align-items: center; margin: 8px 23px; padding: 11px; border: 1px solid rgba(121,219,176,.24); border-radius: 9px; color: var(--muted); font-size: 11px; background: rgba(121,219,176,.06); }.status-check { color: var(--success); }.drop-overlay { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: rgba(24, 74, 121, .36); border: 3px dashed #79b6ff; pointer-events: none; }.drop-overlay[hidden] { display: none; }.drop-overlay > div { padding: 20px 28px; border-radius: 13px; background: #172b42; box-shadow: var(--shadow); text-align: center; }.drop-overlay strong { display: block; font-size: 16px; }.drop-overlay span { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; }.toast-region { position: fixed; right: 20px; top: 82px; z-index: 50; display: flex; flex-direction: column; gap: 8px; width: min(320px, calc(100vw - 40px)); }.toast { padding: 12px 14px; border: 1px solid #3a5068; border-left: 3px solid var(--accent); border-radius: 10px; background: #182432; box-shadow: var(--shadow); color: var(--text); font-size: 11px; animation: toast-in .18s ease both; }.toast.success { border-left-color: var(--success); }.toast.error { border-left-color: var(--danger); }.toast.fade { opacity: 0; transform: translateX(10px); transition: .22s ease; } @keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

@media (max-width: 1180px) { .topbar { flex-wrap: wrap; padding-bottom: 8px; }.brand-block { min-width: 160px; }.mode-tabs { order: 2; }.toolbar { order: 3; width: 100%; }.editor-grid { grid-template-columns: 235px minmax(360px, 1fr) 315px; } .status-cluster { margin-left: auto; } }
@media (min-width: 1181px) { .editor-grid { grid-template-columns: 330px minmax(480px, 1fr) minmax(340px, 400px); } .editor-grid.library-collapsed { grid-template-columns: 58px minmax(480px, 1fr) minmax(340px, 400px); } }
@media (max-width: 900px) { html, body { overflow: auto; }.app-shell { min-height: 100%; height: auto; }.editor-grid { grid-template-columns: 220px minmax(0, 1fr); grid-template-rows: minmax(480px, 62vh) minmax(380px, auto); }.code-panel { grid-column: 1 / -1; min-height: 380px; }.info-drawer { right: 12px; bottom: 12px; }.topbar { position: sticky; top: 0; } }
@media (max-width: 650px) {
  html, body { overflow-x: hidden; }
  .topbar { position: sticky; top: 0; gap: 8px; min-height: 0; padding: 10px 12px; align-items: stretch; }
  .brand-block { width: auto; min-width: 0; }
  .brand-mark { width: 32px; height: 32px; }
  .status-cluster { order: 2; min-width: 0; flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; padding-left: 42px; }
  .mode-tabs { order: 2; width: 100%; }.mode-tab { flex: 1; text-align: center; }
  .project-title { max-width: 54vw; }
  .toolbar { order: 3; width: calc(100vw - 24px); flex: none; flex-wrap: nowrap; gap: 5px; overflow-x: auto; padding-bottom: 3px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
  .tool-button { flex: 0 0 auto; min-height: 36px; padding: 8px 8px; font-size: 10px; }
  .tool-divider { display: none; }
  .editor-grid { display: flex; flex: none; flex-direction: column; min-height: 0; padding: 7px; gap: 7px; }
  .library-panel { min-height: 300px; max-height: 42vh; }
  .library-panel .panel-heading { padding: 13px 14px 10px; }
  .library-search-wrap { margin: 10px 11px 7px; }
  .library-hint { padding-bottom: 9px; }
  .workspace-panel { min-height: 58vh; height: 58vh; }
  .workspace-toolbar { height: 42px; padding-inline: 12px; }
  .workspace-actions { gap: 3px; }
  .canvas-action { min-width: 34px; min-height: 30px; }
  .code-panel { min-height: 380px; height: 48vh; }
  .plugin-settings { max-height: 235px; overflow: auto; }
  .code-output { font-size: 11px; }
  .code-empty { padding-left: 43px; }
  .search-layout { grid-template-columns: 1fr; }
  .search-results { max-height: 210px; border-right: 0; border-bottom: 1px solid var(--line); }
  .search-detail { max-height: 300px; }
  .modal-backdrop { padding: 10px; }
  .modal-top { padding: 17px 16px 9px; }
  .modal > p { padding-inline: 16px; }
  .modal textarea { width: calc(100% - 32px); margin-inline: 16px; }
  .modal-footer { padding-inline: 16px; }
  .info-drawer { right: 10px; bottom: 10px; width: calc(100vw - 20px); max-height: 42vh; }
}

@media (pointer: coarse) {
  .library-card { min-height: 48px; padding-block: 11px; }
  .small-icon-button, .modal-close { min-width: 38px; min-height: 38px; }
  .canvas-action { min-width: 38px; min-height: 36px; }
  .workspace-empty { width: min(300px, 78%); }
}

.product-nav .mode-tab { text-decoration: none; }
.mobile-tools-toggle, .mobile-tools-close, .mobile-dock, .mobile-open-library { display: none; }

@media (max-width: 700px) {
  html, body { min-height: 100%; }
  body { padding-bottom: calc(66px + env(safe-area-inset-bottom)); }
  .topbar { position: sticky; top: 0; align-items: center; padding: 9px 10px; }
  .brand-block { flex: 1 1 auto; }
  .brand-subtitle { white-space: nowrap; }
  .product-nav { order: 2; flex: 0 1 auto; max-width: 48vw; overflow-x: auto; }
  .product-nav .mode-tab { padding: 8px 9px; font-size: 10px; }
  .mobile-tools-toggle { display: grid; place-items: center; flex: 0 0 40px; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: #172536; font-size: 20px; }
  .mobile-tools-toggle[aria-expanded="true"] { border-color: #5d8ec5; color: #dceaff; background: #244f88; }
  .topbar > .toolbar { display: none; }
  body.mobile-tools-open .topbar > .toolbar { position: fixed; z-index: 45; top: 9px; right: 9px; left: 9px; display: flex; flex-direction: column; align-items: stretch; gap: 5px; max-height: calc(100svh - 18px); overflow-y: auto; padding: 10px; border: 1px solid #40566e; border-radius: 14px; background: rgba(14, 23, 33, .98); box-shadow: 0 25px 80px rgba(0,0,0,.56); }
  body.mobile-tools-open .topbar > .toolbar .tool-button { width: 100%; min-height: 42px; text-align: left; }
  body.mobile-tools-open .topbar > .toolbar .mobile-tools-close { display: block; color: #c7d8ed; background: #1d3248; }
  body.mobile-tools-open .topbar > .toolbar .tool-divider { display: none; }
  .status-cluster { order: 3; width: 100%; padding-left: 0; }
  .mobile-dock { position: fixed; z-index: 40; right: 0; bottom: 0; left: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 7px 8px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid #2a3b4d; background: rgba(12, 19, 28, .97); box-shadow: 0 -12px 35px rgba(0,0,0,.28); }
  .mobile-dock-button { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 48px; gap: 3px; border: 1px solid transparent; border-radius: 10px; color: var(--muted); background: transparent; }
  .mobile-dock-button span { font-size: 17px; line-height: 1; }
  .mobile-dock-button small { font-size: 9px; font-weight: 700; }
  .mobile-dock-button.active { border-color: #31577e; color: #e5f0ff; background: #1b3147; }
  .editor-grid { display: block; padding: 7px 7px calc(7px + env(safe-area-inset-bottom)); }
  .editor-grid > .library-panel, .editor-grid > .workspace-panel, .editor-grid > .code-panel { width: 100%; min-height: calc(100svh - 155px); height: calc(100svh - 155px); max-height: none; }
  .library-body { display: flex; flex-direction: column; }
  .category-rail { display: flex; flex: 0 0 auto; gap: 4px; max-height: 62px; padding: 6px 8px; overflow-x: auto; overflow-y: hidden; border-right: 0; border-bottom: 1px solid var(--line); }
  .category-rail-button { flex: 0 0 58px; min-height: 45px; margin: 0; }
  .category-rail-button.active { box-shadow: inset 0 -3px 0 var(--category-color); }
  .category-rail-icon { width: 19px; height: 19px; margin-bottom: 2px; font-size: 9px; }
  body[data-mobile-panel="library"] .editor-grid > .workspace-panel, body[data-mobile-panel="library"] .editor-grid > .code-panel { display: none; }
  body[data-mobile-panel="workspace"] .editor-grid > .library-panel, body[data-mobile-panel="workspace"] .editor-grid > .code-panel { display: none; }
  body[data-mobile-panel="code"] .editor-grid > .library-panel, body[data-mobile-panel="code"] .editor-grid > .workspace-panel { display: none; }
  .editor-grid > .library-panel, .editor-grid > .workspace-panel, .editor-grid > .code-panel { margin-bottom: 0; }
  .workspace-panel .blockly-host { min-height: 0; }
  .code-panel .code-output { min-height: 0; height: auto; }
  .info-drawer { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

@media (max-width: 700px) {
  body { -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
  .brand-name { font-size: 14px; }
  .product-nav { scrollbar-width: none; }
  .product-nav::-webkit-scrollbar, .category-rail::-webkit-scrollbar, .mobile-dock::-webkit-scrollbar { display: none; }
  .mobile-open-library { display: grid; color: #dceaff; border-color: #355c85; background: #1d3c5d; }
  .workspace-toolbar { padding-left: 10px; }
  .workspace-heading { min-width: 0; }
  .workspace-heading > span:not(.live-dot):not(.workspace-count) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .workspace-count { margin-left: 6px; }
  .workspace-actions { flex: 0 0 auto; overflow-x: auto; scrollbar-width: none; }
  .workspace-actions::-webkit-scrollbar { display: none; }
  .canvas-action { flex: 0 0 auto; }
  .library-body { border-top-color: #2b4054; }
  .category-rail { scroll-snap-type: x proximity; }
  .category-rail-button { scroll-snap-align: start; }
  .category-rail-button small { font-size: 8px; }
  .block-library { padding: 5px 10px calc(18px + env(safe-area-inset-bottom)); }
  .library-category { margin-top: 7px; }
  .library-category-title { position: sticky; top: -5px; z-index: 2; padding: 8px 7px; background: rgba(17, 25, 35, .94); backdrop-filter: blur(7px); }
  .library-card { min-height: 54px; margin: 5px 0; padding: 12px; touch-action: manipulation; }
  .library-card:hover { transform: none; }
  .card-title { font-size: 12px; }
  .card-pattern { font-size: 10px; }
  .plugin-settings { margin-inline: 9px; padding: 10px; }
  .plugin-settings input, .plugin-file-editor input { min-height: 38px; padding: 9px 10px; font-size: 12px; }
  .plugin-settings label, .plugin-file-editor label { font-size: 10px; }
  .plugin-file-list { padding: 8px; scroll-snap-type: x proximity; }
  .plugin-file-tab { min-height: 38px; scroll-snap-align: start; }
  .code-output { padding-top: 14px; padding-bottom: calc(28px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
  .code-line { min-height: 22px; }
  .line-number { width: 34px; flex-basis: 34px; padding-right: 7px; }
  .line-code { padding-left: 8px; }
  .modal { max-height: calc(100dvh - 20px); }
  .modal textarea { min-height: 190px; }
  .toast-region { right: 10px; top: auto; bottom: calc(78px + env(safe-area-inset-bottom)); }
}
