/* ==========================================================================
   Vecode — design system (v3 rebuild)
   Scientific humanism: precision + warmth. One signal blue, 3-role type,
   base-8 spacing, flat surfaces, token-remap dark mode.
   Rebuilt ground-up: layers, clearer tokens, reduced duplication.
   ========================================================================== */

/* ---------- Tokens (light) ---------- */
:root, [data-theme="light"] {
  --signal-deep: #002F5B;
  --signal: #007CFF;
  --signal-bright: #00A1FF;
  --signal-ice: #A0DAF7;
  --signal-cyan: #00F6FF;
  --ink: #121212;
  --gray-70: #707070;
  --gray-50: #8D9390;
  --gray-40: #C3C3C3;
  --surface-line: #E1E3E6;
  --paper: #FFFFFF;
  --paper-warm: #FCFCFA;
  --pastel-lilac: #DFC8F5;
  --pastel-pink: #FFD1D4;
  --pastel-green: #B3F4A8;
  --pastel-yellow: #F4F9A7;
  --surface-base: var(--paper-warm);
  --surface-raised: var(--paper);
  --surface-sunken: #F4F5F6;
  --text-primary: var(--ink);
  --text-secondary: var(--gray-70);
  --text-disabled: var(--gray-40);
  --border-default: var(--surface-line);
  --border-strong: var(--gray-40);
  --signal-action: var(--signal);
  --signal-action-hover: var(--signal-bright);
  --signal-wash: color-mix(in srgb, var(--signal-ice) 35%, transparent);
  --signal-text: var(--signal-deep);
  --accent-1: var(--pastel-lilac); --accent-2: var(--pastel-pink);
  --accent-3: var(--pastel-green); --accent-4: var(--pastel-yellow);
  --ok: #1a7f37; --err: #c0302b; --warn: #9a6700;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px;
  --space-5: 24px; --space-6: 32px; --space-7: 48px; --space-8: 64px;
  --font-ui: "Inter", "Public Sans", system-ui, -apple-system, sans-serif;
  --font-mono: "Geist Mono", "JetBrains Mono", ui-monospace, monospace;
  --font-editorial: "Source Serif 4", "Newsreader", Georgia, serif;
  --text-xs: 12px; --text-sm: 13.5px; --text-base: 15px; --text-lg: 18px;
  --text-xl: 24px; --text-2xl: 32px;
  --duration-fast: 120ms; --duration-base: 200ms;
  --ease-standard: cubic-bezier(0.2, 0, 0, 1);
  --radius-sm: 6px; --radius: 10px; --radius-lg: 14px;
  --shadow-1: 0 1px 2px rgba(18,18,18,0.06), 0 2px 8px rgba(18,18,18,0.05);
  --shadow-2: 0 4px 16px rgba(18,18,18,0.10), 0 12px 40px rgba(18,18,18,0.08);
  --topbar-h: 52px; --rail-w: 236px; --center-w: 400px;
  color-scheme: light;
}
[data-theme="dark"] {
  --surface-base: #0A1622; --surface-raised: #101F30; --surface-sunken: #060D16;
  --text-primary: #F2F4F6; --text-secondary: #9AA4AD; --text-disabled: #55606A;
  --border-default: #22303F; --border-strong: #3A4A5C;
  --signal-action: var(--signal-bright); --signal-action-hover: var(--signal);
  --signal-wash: rgba(0, 124, 255, 0.12); --signal-text: var(--signal-ice);
  --accent-1: #8A6FB0; --accent-2: #A0666B; --accent-3: #5E8F57; --accent-4: #8F9357;
  --ok: #3fb950; --err: #f85149; --warn: #d29922;
  --shadow-1: 0 1px 2px rgba(0,0,0,0.3), 0 2px 8px rgba(0,0,0,0.25);
  --shadow-2: 0 4px 16px rgba(0,0,0,0.4), 0 12px 40px rgba(0,0,0,0.3);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface-base: #0A1622; --surface-raised: #101F30; --surface-sunken: #060D16;
    --text-primary: #F2F4F6; --text-secondary: #9AA4AD; --text-disabled: #55606A;
    --border-default: #22303F; --border-strong: #3A4A5C;
    --signal-action: var(--signal-bright); --signal-action-hover: var(--signal);
    --signal-wash: rgba(0, 124, 255, 0.12); --signal-text: var(--signal-ice);
    --accent-1: #8A6FB0; --accent-2: #A0666B; --accent-3: #5E8F57; --accent-4: #8F9357;
    --ok: #3fb950; --err: #f85149; --warn: #d29922;
    color-scheme: dark;
  }
}

/* ---------- Reset & base ---------- */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font-ui); font-size: var(--text-base); line-height: 1.6;
  background: var(--surface-base); color: var(--text-primary);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
a { color: var(--signal-action); text-decoration: none; }
a:hover { color: var(--signal-action-hover); }
.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.serif { font-family: var(--font-editorial); }
.small { font-size: var(--text-sm); }
.muted { color: var(--text-secondary); }

/* ---------- Topbar ---------- */
#topbar {
  height: var(--topbar-h); display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; gap: 16px;
  background: var(--surface-raised); border-bottom: 1px solid var(--border-default);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: baseline; gap: 6px; }
.brand-mark { font-size: 22px; font-weight: 600; color: var(--signal-action); }
.brand-name { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.brand-sub { font-size: 12px; color: var(--text-secondary); margin-left: 6px; letter-spacing: 0.06em; text-transform: uppercase; }
.topbar-center { flex: 1; display: flex; justify-content: center; }
.project-name {
  background: none; border: 1px solid transparent; border-radius: var(--radius-sm);
  padding: 6px 12px; font-size: 14px; font-weight: 500; color: var(--text-primary); cursor: pointer;
}
.project-name:hover { border-color: var(--border-default); background: var(--surface-sunken); }
.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- Main layout ---------- */
#main { display: grid; grid-template-columns: var(--rail-w) var(--center-w) 1fr; min-height: calc(100vh - var(--topbar-h)); }
#rail {
  border-right: 1px solid var(--border-default); background: var(--surface-raised);
  padding: 16px 12px; display: flex; flex-direction: column; gap: 4px;
}
.rail-label { font-size: 11px; letter-spacing: 0.12em; color: var(--text-disabled); text-transform: uppercase; margin: 12px 8px 6px; font-weight: 600; }
.rail-item {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
  padding: 9px 10px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: none; color: var(--text-secondary); font-size: 14px; font-weight: 500; cursor: pointer; transition: all var(--duration-fast) var(--ease-standard);
}
.rail-item:hover { background: var(--surface-sunken); color: var(--text-primary); }
.rail-item.active { background: var(--signal-wash); color: var(--signal-text); border-color: color-mix(in srgb, var(--signal-action) 18%, transparent); }
.rail-ico { width: 16px; height: 16px; display: grid; place-items: center; opacity: 0.9; }
.rail-foot { margin-top: auto; padding-top: 16px; }
.conn-card { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-sunken); border: 1px solid var(--border-default); font-size: 12px; color: var(--text-secondary); }
.conn-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.conn-dot.idle { background: var(--gray-40); } .conn-dot.busy { background: var(--warn); animation: pulse 1.2s infinite; } .conn-dot.ok { background: var(--ok); } .conn-dot.err { background: var(--err); }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.45; } }

/* ---------- Center column ---------- */
#center { border-right: 1px solid var(--border-default); background: var(--surface-base); display: flex; flex-direction: column; min-width: 0; }
.view { display: none; flex: 1; min-height: 0; overflow: auto; } .view.active { display: flex; flex-direction: column; }
#view-build { flex: 1; min-height: 0; }
#chatScroll { flex: 1; overflow: auto; padding: 20px 16px; }
#chatLog { display: flex; flex-direction: column; gap: 16px; }
.msg { border: 1px solid var(--border-default); border-radius: var(--radius); background: var(--surface-raised); padding: 14px 16px; }
.msg.user { background: var(--surface-sunken); border-color: var(--border-default); }
.msg .msg-role { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 8px; }
.msg .msg-body { font-size: 14px; line-height: 1.6; overflow-wrap: break-word; word-break: break-word; }
.msg .msg-body p { margin: 0 0 10px; } .msg .msg-body p:last-child { margin-bottom: 0; }
.msg .msg-body pre { background: var(--surface-sunken); border: 1px solid var(--border-default); border-radius: var(--radius-sm); padding: 12px; overflow: auto; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; }
.msg .msg-body code { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-sunken); border: 1px solid var(--border-default); border-radius: 4px; padding: 1px 5px; }
.msg .msg-body pre code { background: none; border: none; padding: 0; }
.empty-hero { text-align: center; padding: 40px 16px 24px; border: 1px dashed var(--border-default); border-radius: var(--radius-lg); background: var(--surface-raised); position: relative; overflow: hidden; }
.big-glyph { font-size: 64px; line-height: 1; color: var(--signal-action); display: block; margin-bottom: 12px; }
.empty-hero h2 { font-family: var(--font-editorial); font-weight: 600; font-size: 26px; margin: 0 0 10px; letter-spacing: -0.02em; }
.empty-hero p { color: var(--text-secondary); margin: 0 auto 20px; max-width: 44ch; font-size: 14px; }
.template-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; margin-top: 16px; }
.template-tile { text-align: left; padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border-default); background: var(--surface-raised); cursor: pointer; transition: all var(--duration-fast) var(--ease-standard); }
.template-tile:hover { border-color: var(--signal-action); box-shadow: var(--shadow-1); transform: translateY(-1px); }
.template-tile .t-name { font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.template-tile .t-desc { font-size: 12px; color: var(--text-secondary); line-height: 1.4; }
#statusBar { display: flex; justify-content: space-between; align-items: center; padding: 8px 16px; border-top: 1px solid var(--border-default); border-bottom: 1px solid var(--border-default); background: var(--surface-sunken); font-size: 12px; color: var(--text-secondary); }
.status-spin { color: var(--signal-action); animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
#composer { padding: 12px 16px 16px; border-top: 1px solid var(--border-default); background: var(--surface-raised); }
#promptChips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.prompt-chip { font-size: 12px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--border-default); background: var(--surface-base); color: var(--text-secondary); cursor: pointer; transition: all var(--duration-fast) var(--ease-standard); }
.prompt-chip:hover { border-color: var(--signal-action); color: var(--signal-action); }
#composerBox { display: flex; gap: 10px; align-items: flex-end; }
#chatInput { flex: 1; min-height: 44px; max-height: 140px; resize: vertical; padding: 10px 12px; border-radius: var(--radius); border: 1px solid var(--border-default); background: var(--surface-base); color: var(--text-primary); font-family: var(--font-ui); font-size: 14px; line-height: 1.5; }
#chatInput:focus { outline: none; border-color: var(--signal-action); box-shadow: 0 0 0 3px var(--signal-wash); }
#composerHint { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: 11.5px; color: var(--text-secondary); }
.kbd { font-family: var(--font-mono); font-size: 11px; border: 1px solid var(--border-default); border-bottom-width: 2px; border-radius: 4px; padding: 1px 5px; background: var(--surface-base); }
.text-btn { background: none; border: none; color: var(--text-secondary); font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.text-btn:hover { color: var(--signal-action); }

/* ---------- Preview ---------- */
#previewPane { display: flex; flex-direction: column; min-width: 0; background: var(--surface-sunken); }
.preview-toolbar { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--border-default); background: var(--surface-raised); }
.device-seg { display: flex; gap: 4px; }
.device-seg button { padding: 6px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-default); background: var(--surface-base); font-size: 12px; font-weight: 500; color: var(--text-secondary); cursor: pointer; }
.device-seg button.active { background: var(--signal-action); border-color: var(--signal-action); color: #fff; }
.preview-url { flex: 1; font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#previewStage { flex: 1; padding: 16px; display: grid; place-items: start center; overflow: auto; }
#previewFrame { width: 100%; height: 640px; border: 1px solid var(--border-default); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-2); transition: width var(--duration-base) var(--ease-standard); }
#previewFrame[data-device="tablet"] { width: 780px; } #previewFrame[data-device="mobile"] { width: 390px; height: 780px; }
.err-badge { display: none; padding: 4px 8px; border-radius: 999px; border: 1px solid var(--err); background: color-mix(in srgb, var(--err) 12%, transparent); color: var(--err); font-size: 11px; font-weight: 600; cursor: pointer; }
.err-badge.show { display: inline-flex; }

/* ---------- Buttons & inputs ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-default); background: var(--surface-raised); color: var(--text-primary); font-size: 13.5px; font-weight: 600; cursor: pointer; transition: all var(--duration-fast) var(--ease-standard); text-decoration: none; }
.btn:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-1); }
.btn-sm { padding: 6px 10px; font-size: 12.5px; }
.btn-signal { background: var(--signal-action); border-color: var(--signal-action); color: #fff; }
.btn-signal:hover { background: var(--signal-action-hover); border-color: var(--signal-action-hover); color: #fff; }
.icon-btn { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius-sm); border: 1px solid var(--border-default); background: var(--surface-raised); color: var(--text-secondary); cursor: pointer; transition: all var(--duration-fast) var(--ease-standard); }
.icon-btn:hover { color: var(--text-primary); border-color: var(--border-strong); background: var(--surface-base); }
.icon-btn svg { width: 16px; height: 16px; }
.text-input { padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-default); background: var(--surface-base); color: var(--text-primary); font-size: 13.5px; font-family: var(--font-ui); }
.text-input:focus { outline: none; border-color: var(--signal-action); box-shadow: 0 0 0 3px var(--signal-wash); }
.input-row { display: flex; gap: 8px; align-items: center; }
.field { margin-bottom: 12px; } .field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.card { border: 1px solid var(--border-default); border-radius: var(--radius); background: var(--surface-raised); padding: 16px; }
.card-title { font-weight: 600; font-size: 14px; margin: 0 0 4px; }
.card-sub { font-size: 12.5px; color: var(--text-secondary); margin: 0; line-height: 1.5; }
.panel { padding: 20px 16px; display: flex; flex-direction: column; gap: 16px; }
.panel-narrow { max-width: 760px; margin: 0 auto; width: 100%; }
.panel-head .panel-title { font-family: var(--font-editorial); font-size: 28px; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.02em; }
.panel-head .panel-sub { color: var(--text-secondary); margin: 0; font-size: 14px; line-height: 1.6; }

/* ---------- Files ---------- */
.file-row { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid transparent; }
.file-row:hover { background: var(--surface-sunken); border-color: var(--border-default); }
.fname { flex: 1; background: none; border: none; text-align: left; font-family: var(--font-mono); font-size: 13px; color: var(--text-primary); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fname:hover { color: var(--signal-action); }
.fsize { font-size: 11px; color: var(--text-disabled); font-family: var(--font-mono); }
.file-editor { width: 100%; min-height: 360px; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.6; }
.dropzone { border: 1.5px dashed var(--border-default); border-radius: var(--radius); padding: 20px; text-align: center; background: var(--surface-sunken); transition: all var(--duration-fast) var(--ease-standard); }
.dropzone.drag { border-color: var(--signal-action); background: var(--signal-wash); }

/* ---------- Plugins ---------- */
.plugin-card { display: flex; gap: 14px; align-items: flex-start; }
.plugin-ico { width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--surface-sunken); border: 1px solid var(--border-default); color: var(--text-secondary); flex: none; }
.plugin-body { flex: 1; min-width: 0; }
.plugin-tag { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-disabled); border: 1px solid var(--border-default); border-radius: 999px; padding: 1px 6px; margin-left: 8px; }
.plugin-desc { font-size: 12.5px; color: var(--text-secondary); margin: 4px 0 10px; line-height: 1.5; }
.plugin-opt { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; font-size: 12.5px; }
.switch { position: relative; display: inline-block; width: 36px; height: 22px; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--border-default); transition: background var(--duration-fast) var(--ease-standard); }
.switch .track::after { content: ""; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.2); transition: transform var(--duration-fast) var(--ease-standard); }
.switch input:checked + .track { background: var(--signal-action); }
.switch input:checked + .track::after { transform: translateX(14px); }

/* ---------- Skill ---------- */
.skill-hero { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.swatch-row { display: flex; gap: 6px; flex-wrap: wrap; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--border-default); }
.step-card { display: flex; gap: 16px; padding: 14px 16px; border: 1px solid var(--border-default); border-radius: var(--radius); background: var(--surface-raised); }
.step-kicker { font-size: 11px; letter-spacing: 0.12em; color: var(--signal-action); font-weight: 600; white-space: nowrap; }
.markdown-body { font-size: 14px; line-height: 1.7; }
.markdown-body h2 { font-family: var(--font-editorial); font-size: 22px; margin: 24px 0 12px; }
.markdown-body table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 13px; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border-default); padding: 8px 10px; text-align: left; }
.markdown-body th { background: var(--surface-sunken); font-weight: 600; }

/* ---------- Deploy ---------- */
.deploy-step { display: flex; gap: 14px; padding: 16px; border: 1px solid var(--border-default); border-radius: var(--radius); background: var(--surface-raised); }
.deploy-num { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: var(--signal-action); color: #fff; font-weight: 700; font-size: 14px; flex: none; }
.cmd-block { display: flex; gap: 8px; align-items: center; background: var(--surface-sunken); border: 1px solid var(--border-default); border-radius: var(--radius-sm); padding: 10px 12px; font-family: var(--font-mono); font-size: 12px; overflow: auto; }
.cmd-block code { white-space: pre; }

/* ---------- Modal & toast ---------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(18,18,18,0.5); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; z-index: 50; }
.modal { width: min(720px, 100%); max-height: 90vh; overflow: auto; background: var(--surface-raised); border: 1px solid var(--border-default); border-radius: var(--radius-lg); box-shadow: var(--shadow-2); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--border-default); position: sticky; top: 0; background: var(--surface-raised); }
.modal-title { font-weight: 700; font-size: 16px; margin: 0; }
.modal-body { padding: 20px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--border-default); background: var(--surface-sunken); position: sticky; bottom: 0; }
.provider-card { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--border-default); border-radius: var(--radius); background: var(--surface-raised); cursor: pointer; transition: all var(--duration-fast) var(--ease-standard); margin-bottom: 10px; }
.provider-card:hover { border-color: var(--border-strong); }
.provider-card.active { border-color: var(--signal-action); box-shadow: 0 0 0 3px var(--signal-wash); }
.provider-logo { width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--radius-sm); background: var(--surface-sunken); border: 1px solid var(--border-default); font-weight: 700; font-size: 12px; flex: none; }
.provider-main { flex: 1; min-width: 0; }
.provider-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.provider-desc { font-size: 12.5px; color: var(--text-secondary); margin: 4px 0 0; line-height: 1.4; }
.oauth-badge, .free-badge { font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; border-radius: 999px; padding: 2px 7px; border: 1px solid var(--border-default); background: var(--surface-sunken); }
.free-badge { background: var(--ok); color: #fff; border-color: var(--ok); }
.provider-config { margin-top: 12px; padding: 12px; border: 1px solid var(--border-default); border-radius: var(--radius-sm); background: var(--surface-sunken); }
#toastRoot { position: fixed; bottom: 16px; right: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; pointer-events: none; }
.toast { padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--border-default); background: var(--surface-raised); box-shadow: var(--shadow-2); font-size: 13px; max-width: 360px; pointer-events: auto; }
.toast.ok { border-color: var(--ok); } .toast.err { border-color: var(--err); }

/* ---------- Agent working ---------- */
.agent-working { padding: 12px 0 4px; }
.working-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.working-dots { display: flex; gap: 4px; }
.working-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--signal-action); animation: wd 1.2s infinite; }
.working-dot:nth-child(2) { animation-delay: 0.15s; } .working-dot:nth-child(3) { animation-delay: 0.3s; }
@keyframes wd { 0%,80%,100% { opacity: 0.25; transform: scale(0.85); } 40% { opacity: 1; transform: scale(1); } }
.working-label { font-size: 12.5px; font-weight: 500; color: var(--text-secondary); }
.working-bar { height: 3px; border-radius: 999px; background: var(--border-default); overflow: hidden; }
.working-bar::after { content: ""; display: block; height: 100%; width: 40%; background: var(--signal-action); animation: wb 1.4s ease-in-out infinite; }
@keyframes wb { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }
.cursor-blink { display: inline-block; width: 7px; height: 14px; background: var(--signal-action); margin-left: 2px; vertical-align: text-bottom; animation: blink 1s step-end infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  #main { grid-template-columns: var(--rail-w) 1fr; }
  #previewPane { grid-column: 1 / -1; border-top: 1px solid var(--border-default); }
  #previewFrame { height: 520px; }
}
@media (max-width: 720px) {
  #main { grid-template-columns: 1fr; }
  #rail { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--border-default); }
  .rail-label, .rail-foot { display: none; }
  .rail-item { white-space: nowrap; }
  #topbar { flex-wrap: wrap; height: auto; padding: 10px 12px; }
  #previewFrame[data-device="tablet"], #previewFrame[data-device="mobile"] { width: 100%; }
}
