@import url('/vendor/inter/index.css');

:root {
  --bg: #0b0c0f;
  --panel: #131418;
  --panel-2: #1a1b20;
  --panel-3: #23252c;
  --line: #24262d;
  --line-2: #30333b;
  --text: #ececf1;
  --text-2: #b3b6c0;
  --muted: #7b7f8b;
  --accent: #6c5cff;
  --accent-hover: #7b6dff;
  --accent-soft: rgba(108, 92, 255, .15);
  --accent-line: rgba(108, 92, 255, .45);
  --blue: #3d8bff;
  --green: #2fc77a;
  --orange: #ff9f1c;
  --danger: #f2545f;
  --r-sm: 6px;
  --r: 8px;
  --r-lg: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45), 0 1px 0 rgba(255, 255, 255, .03) inset;
  --font: 'Inter Variable', Inter, 'Segoe UI', system-ui, sans-serif;
  --mono: 'Cascadia Code', Consolas, 'SFMono-Regular', monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font: 13px/1.45 var(--font);
  letter-spacing: -.003em; -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--accent-soft); }

.i { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.i.sm { width: 14px; height: 14px; }
.i.lg { width: 20px; height: 20px; }
.i.xl { width: 28px; height: 28px; stroke-width: 1.6; }

/* ============ buttons & inputs ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 32px; padding: 0 12px; border-radius: var(--r); border: 1px solid var(--line-2);
  background: var(--panel-2); cursor: pointer; white-space: nowrap; text-decoration: none; font-weight: 500;
  transition: background .12s, border-color .12s, color .12s, transform .06s;
}
.btn:hover { background: var(--panel-3); border-color: #3b3f49; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: default; transform: none; }
.btn:disabled:hover { background: var(--panel-2); border-color: var(--line-2); }
.btn.primary { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 4px 14px rgba(108, 92, 255, .35); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: #ff9aa2; }
.btn.danger:hover { background: rgba(242, 84, 95, .12); border-color: rgba(242, 84, 95, .5); color: #ffc2c7; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--panel-3); color: var(--text); }
.btn.icon { width: 32px; padding: 0; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: var(--r-sm); }
.btn.sm.icon { width: 28px; padding: 0; }
.btn.xs { height: 24px; padding: 0 7px; font-size: 12px; border-radius: 5px; gap: 5px; }
.btn.xs.icon { width: 24px; padding: 0; }
.btn.block { width: 100%; }
.btn.lg { height: 40px; padding: 0 18px; font-size: 14px; border-radius: 10px; }

.input, .select, .textarea {
  width: 100%; height: 32px; padding: 0 10px; border-radius: var(--r-sm);
  border: 1px solid var(--line-2); background: #0f1013; outline: none; transition: border-color .12s, box-shadow .12s;
}
.input::placeholder, .textarea::placeholder { color: #5b5f6a; }
.textarea { height: auto; min-height: 80px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
.textarea.code { font-family: var(--mono); font-size: 12px; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.select {
  appearance: none; padding-right: 26px; cursor: pointer;
  background: #0f1013 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237b7f8b' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 8px center;
}
.select option { background: var(--panel); }
.field { display: block; margin-bottom: 12px; }
.field > .lbl { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12px; margin-bottom: 6px; font-weight: 500; }
.field > .lbl .opt { color: var(--muted); font-weight: 400; }
.check { display: flex; align-items: center; gap: 9px; margin: 10px 0; cursor: pointer; color: var(--text-2); }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: 12px; line-height: 1.5; margin: 6px 0 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
kbd { font-family: var(--font); font-size: 11px; background: var(--panel-3); border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; color: var(--text-2); }

.seg { display: inline-flex; padding: 3px; gap: 2px; background: #0f1013; border: 1px solid var(--line); border-radius: 9px; }
.seg button {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: transparent; height: 26px; padding: 0 11px;
  border-radius: 6px; cursor: pointer; color: var(--muted); font-weight: 500; transition: background .12s, color .12s;
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--panel-3); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .4); }
.seg.accent button.active { background: var(--accent); color: #fff; }
.seg.icons button { padding: 0 8px; }
.seg.full { display: flex; }
.seg.full button { flex: 1; justify-content: center; padding: 0 4px; }

.color-field { display: flex; gap: 6px; }
.swatch {
  position: relative; width: 32px; height: 32px; border-radius: var(--r-sm); border: 1px solid var(--line-2); flex: none; overflow: hidden;
  background: repeating-conic-gradient(#2a2c33 0% 25%, #1b1c21 0% 50%) 50% / 10px 10px;
}
.swatch span { position: absolute; inset: 0; }
.swatch input { position: absolute; inset: -6px; width: calc(100% + 12px); height: calc(100% + 12px); opacity: 0; cursor: pointer; }

/* ============ modal / toast / menu ============ */
.modal-back {
  position: fixed; inset: 0; background: rgba(5, 6, 8, .62); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 1000; animation: fade .14s ease-out;
}
.modal {
  width: min(500px, 92vw); max-height: 88vh; overflow: auto; background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 16px; padding: 22px 22px 18px; box-shadow: 0 30px 80px rgba(0, 0, 0, .6); animation: pop .16s ease-out;
}
.modal.wide { width: min(880px, 94vw); }
.modal h3 { margin: 0 0 6px; font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.modal .sub { color: var(--muted); margin: 0 0 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }

.toast-wrap { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 9px; background: #1f2127; border: 1px solid var(--line-2); padding: 10px 14px 10px 12px;
  border-radius: 10px; box-shadow: var(--shadow); animation: pop .16s ease-out; max-width: 520px;
}
.toast .i { color: var(--green); }
.toast.error .i { color: var(--danger); }

.menu {
  position: fixed; z-index: 1500; min-width: 190px; background: #1d1f25; border: 1px solid var(--line-2); border-radius: 10px;
  padding: 5px; box-shadow: var(--shadow); animation: pop .12s ease-out;
}
.menu button {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 32px; padding: 0 10px; border: 0; background: none;
  border-radius: 6px; cursor: pointer; text-align: left; color: var(--text-2);
}
.menu button:hover { background: var(--panel-3); color: var(--text); }
.menu button.danger { color: #ff9aa2; }
.menu button.danger:hover { background: rgba(242, 84, 95, .12); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 2px; }

/* ============ dashboard ============ */
.dash-top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between;
  height: 64px; padding: 0 max(28px, calc((100% - 1240px) / 2)); background: rgba(11, 12, 15, .82); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; letter-spacing: -.01em; text-decoration: none; }
.logo-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #7d6bff, #c24dff 60%, #ff5c9a); box-shadow: 0 4px 14px rgba(140, 90, 255, .4);
}
.dash { padding: 40px max(28px, calc((100% - 1240px) / 2)) 80px; }
.dash-hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 28px; flex-wrap: wrap; }
.dash-hero h1 { margin: 0 0 6px; font-size: 30px; font-weight: 700; letter-spacing: -.025em; }
.dash-hero p { margin: 0; color: var(--muted); font-size: 14px; }
.search { position: relative; width: 280px; }
.search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 34px; height: 38px; border-radius: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 22px; }
.card {
  position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
  transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card:hover { border-color: var(--line-2); transform: translateY(-2px); box-shadow: 0 16px 40px rgba(0, 0, 0, .45); }
.thumb { position: relative; aspect-ratio: 16 / 10; overflow: hidden; background: #fff; cursor: pointer; border-bottom: 1px solid var(--line); }
.thumb iframe { position: absolute; top: 0; left: 0; width: 1280px; height: 800px; border: 0; transform-origin: 0 0; pointer-events: none; }
.thumb-hover {
  position: absolute; inset: 0; display: grid; place-items: center; background: rgba(10, 10, 14, .55);
  opacity: 0; transition: opacity .15s;
}
.card:hover .thumb-hover { opacity: 1; }
.card-body { display: flex; align-items: center; gap: 10px; padding: 14px 14px 14px 16px; }
.card-info { flex: 1; min-width: 0; }
.card-title { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-meta { color: var(--muted); font-size: 12px; margin-top: 2px; }
.new-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; min-height: 250px;
  border: 1.5px dashed var(--line-2); border-radius: 16px; color: var(--muted); cursor: pointer; background: transparent;
  transition: border-color .15s, color .15s, background .15s;
}
.new-card:hover { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.new-card .plus { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--panel-2); border: 1px solid var(--line-2); }
.empty { grid-column: 1 / -1; padding: 70px 20px; text-align: center; border: 1.5px dashed var(--line-2); border-radius: 18px; }
.empty h2 { margin: 16px 0 6px; font-size: 20px; }
.empty p { color: var(--muted); margin: 0 0 22px; }
.empty .big-icon { width: 64px; height: 64px; border-radius: 18px; margin: 0 auto; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-hover); }

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.tpl { position: relative; border: 1.5px solid var(--line-2); border-radius: 12px; overflow: hidden; cursor: pointer; transition: border-color .12s; }
.tpl:hover { border-color: #444857; }
.tpl:has(input:checked) { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tpl input { position: absolute; opacity: 0; }
.tpl .thumb { cursor: pointer; }
.tpl .tpl-info { padding: 10px 12px; }
.tpl .tpl-info b { display: block; font-size: 13px; }
.tpl .tpl-info small { color: var(--muted); }

/* ============ editor layout ============ */
.editor { display: grid; grid-template-rows: 52px 1fr; height: 100vh; overflow: hidden; }
.topbar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 0 10px;
  background: var(--panel); border-bottom: 1px solid var(--line); min-width: 0;
}
.tb-left, .tb-right { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tb-right { justify-content: flex-end; }
.tb-center { display: flex; align-items: center; gap: 10px; }
.project-name { font-weight: 600; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-sep { width: 1px; height: 22px; background: var(--line-2); flex: none; }
.page-pick { position: relative; display: flex; align-items: center; }
.page-pick .i { position: absolute; left: 9px; color: var(--muted); pointer-events: none; }
.page-pick .select { width: 200px; padding-left: 30px; height: 32px; }
.status { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; padding: 0 4px; }
.status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(47, 199, 122, .15); }
.status.saving .dot, .status.unsaved .dot { background: var(--orange); box-shadow: 0 0 0 3px rgba(255, 159, 28, .15); }
.status.error .dot { background: var(--danger); }

/* Hidden panels drop out of the grid, so each mode lists only the columns it actually shows. */
.workspace { display: grid; grid-template-columns: 52px 272px minmax(0, 1fr) 304px; min-height: 0; }
.workspace.code { grid-template-columns: 250px minmax(0, 1fr) var(--preview-w, 42%); }
.workspace.code.no-preview { grid-template-columns: 250px minmax(0, 1fr); }
.workspace.code.no-preview .code-preview { display: none; }
.workspace.preview { grid-template-columns: minmax(0, 1fr); }
.workspace.preview .rail, .workspace.preview .left, .workspace.preview .right, .workspace.code .rail { display: none; }

.rail {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0; background: var(--panel);
  border-right: 1px solid var(--line);
}
.rail button {
  position: relative; width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 10px;
  background: transparent; color: var(--muted); cursor: pointer; transition: background .12s, color .12s;
}
.rail button:hover { background: var(--panel-3); color: var(--text); }
.rail button.active { background: var(--accent-soft); color: #b9b0ff; }
.rail button .i { width: 19px; height: 19px; }
.rail .spacer { flex: 1; }
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; z-index: 50; white-space: nowrap; pointer-events: none;
  background: #26282f; color: var(--text); border: 1px solid var(--line-2); padding: 5px 9px; border-radius: 6px; font-size: 12px;
  font-weight: 500; box-shadow: var(--shadow);
  bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%);
}
.rail [data-tip]:hover::after { bottom: auto; }
.topbar [data-tip]:hover::after, .ov-tools [data-tip]:hover::after { bottom: auto; }
.rail [data-tip]:hover::after { left: calc(100% + 8px); top: 50%; transform: translateY(-50%); }
.topbar [data-tip]:hover::after, .ov-tools [data-tip]:hover::after { top: calc(100% + 8px); left: 50%; transform: translateX(-50%); }

.left, .right { background: var(--panel); min-height: 0; display: flex; flex-direction: column; min-width: 0; }
.left { border-right: 1px solid var(--line); }
.right { border-left: 1px solid var(--line); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 48px; padding: 0 14px; border-bottom: 1px solid var(--line); flex: none; }
.panel-head h2 { margin: 0; font-size: 13px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.panel-body { flex: 1; overflow: auto; padding: 14px; min-height: 0; }
.panel-body.flush { padding: 0; }
.group-title {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 20px 0 10px;
}
.group-title:first-child { margin-top: 0; }

/* ============ canvas ============ */
.canvas-wrap {
  position: relative; min-width: 0; min-height: 0; overflow: hidden; display: flex; flex-direction: column; align-items: center;
  background-color: #0d0e11; background-image: radial-gradient(#22242b 1px, transparent 1px); background-size: 18px 18px;
  padding: 14px;
}
.device-label { flex: none; height: 0; overflow: visible; color: var(--muted); font-size: 11px; }
.frame {
  position: relative; flex: 1; width: 100%; min-height: 0; border-radius: 10px; overflow: hidden; background: #fff;
  box-shadow: 0 0 0 1px #2a2c33, 0 20px 50px rgba(0, 0, 0, .5); transition: width .25s ease;
}
.canvas-wrap.tablet .frame { width: 768px; max-width: 100%; }
.canvas-wrap.mobile .frame { width: 390px; max-width: 100%; border-radius: 22px; box-shadow: 0 0 0 1px #2a2c33, 0 0 0 8px #18191d, 0 0 0 9px #2a2c33, 0 20px 50px rgba(0, 0, 0, .5); margin: 8px 0; }
.frame iframe { border: 0; width: 100%; height: 100%; display: block; background: #fff; }
.overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.ov-box { position: absolute; pointer-events: none; display: none; border-radius: 2px; }
.ov-hover { outline: 1.5px solid var(--blue); background: rgba(61, 139, 255, .06); }
.ov-select { outline: 2px solid var(--accent); }
.ov-select.editing { outline-color: var(--green); background: rgba(47, 199, 122, .04); }
.ov-target { outline: 2px dashed var(--orange); background: rgba(255, 159, 28, .07); }
.ov-target .ov-label { background: var(--orange); color: #241400; }
.ov-flash { outline: 3px solid var(--orange); background: rgba(255, 159, 28, .18); animation: flash 1.6s ease-out forwards; }
@keyframes flash { 0%, 60% { opacity: 1; } 100% { opacity: 0; } }
.ov-label {
  position: absolute; left: -2px; top: -24px; height: 22px; padding: 0 8px; font-size: 11px; font-weight: 600; line-height: 22px;
  background: var(--accent); color: #fff; border-radius: 6px 6px 6px 0; white-space: nowrap; display: flex; align-items: center; gap: 6px;
}
.ov-label em { font-style: normal; opacity: .7; font-weight: 500; font-family: var(--mono); font-size: 10px; }
.ov-hover .ov-label { background: var(--blue); }
.ov-box.below .ov-label { top: auto; bottom: -24px; border-radius: 0 6px 6px 6px; }
.ov-select.editing .ov-label { background: var(--green); color: #032312; }
.ov-tools {
  position: absolute; right: -2px; top: -38px; display: flex; gap: 2px; padding: 3px; background: #1d1f25; border: 1px solid var(--line-2);
  border-radius: 9px; pointer-events: auto; box-shadow: var(--shadow);
}
.ov-select.below .ov-tools { top: auto; bottom: -38px; }
.ov-tools button {
  display: grid; place-items: center; width: 28px; height: 26px; border: 0; border-radius: 6px; background: transparent;
  color: var(--text-2); cursor: pointer; padding: 0; font-weight: 700; font-size: 13px;
}
.ov-tools button:hover { background: var(--panel-3); color: var(--text); }
.ov-tools button.danger:hover { background: rgba(242, 84, 95, .15); color: #ff9aa2; }
.ov-tools button.go { background: var(--accent); color: #fff; width: auto; padding: 0 9px; gap: 5px; display: flex; align-items: center; font-weight: 600; font-size: 12px; }
.ov-tools button.go:hover { background: var(--accent-hover); }
.ov-tools .sep { width: 1px; background: var(--line-2); margin: 3px 2px; }

/* ============ code mode ============ */
.code-wrap { position: relative; min-width: 0; min-height: 0; display: flex; flex-direction: column; border-right: 1px solid var(--line); }
.code-tabs { display: flex; height: 40px; background: var(--panel); border-bottom: 1px solid var(--line); overflow-x: auto; flex: none; }
.code-tab {
  display: flex; align-items: center; gap: 7px; padding: 0 8px 0 12px; border-right: 1px solid var(--line); cursor: pointer;
  color: var(--muted); white-space: nowrap; font-size: 12px; position: relative;
}
.code-tab:hover { color: var(--text-2); }
.code-tab.active { background: #1e1e1e; color: var(--text); }
.code-tab.active::before { content: ''; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--accent); }
.code-tab .x { display: grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 4px; background: none; cursor: pointer; color: inherit; opacity: .6; }
.code-tab .x:hover { opacity: 1; background: var(--panel-3); }
.code-tab.dirty .x::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--orange); }
.code-tab.dirty .x .i { display: none; }
.code-tab.dirty .x:hover::before { display: none; }
.code-tab.dirty .x:hover .i { display: block; }
.monaco-host { flex: 1; min-height: 0; }
.code-empty { flex: 1; display: grid; place-items: center; color: var(--muted); text-align: center; }
.media-view {
  flex: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 12px; padding: 24px;
  background: repeating-conic-gradient(#17181c 0% 25%, #111215 0% 50%) 50% / 20px 20px;
}
.media-view img { max-width: 100%; max-height: 80%; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); border-radius: 6px; }
.code-preview { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #0d0e11; }
.splitter { position: absolute; left: -4px; top: 0; bottom: 0; width: 8px; cursor: col-resize; z-index: 5; }
.splitter::after { content: ''; position: absolute; left: 3px; top: 0; bottom: 0; width: 2px; background: transparent; transition: background .12s; }
.splitter:hover::after, .splitter.drag::after { background: var(--accent); }
.dragging-split iframe { pointer-events: none; }
.dragging-split { cursor: col-resize; user-select: none; }
.code-bar { display: flex; align-items: stretch; height: 40px; background: var(--panel); border-bottom: 1px solid var(--line); flex: none; }
.code-bar .code-tabs { flex: 1; border-bottom: 0; min-width: 0; }
.code-bar .code-actions { display: flex; align-items: center; gap: 4px; padding: 0 8px; border-left: 1px solid var(--line); }
.code-preview .bar { height: 40px; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 14px; background: var(--panel); border-bottom: 1px solid var(--line); color: var(--text-2); font-size: 12px; font-weight: 500; flex: none; }
.code-preview iframe { flex: 1; border: 0; background: #fff; width: 100%; }
.tree-toolbar { display: flex; gap: 6px; padding: 10px; border-bottom: 1px solid var(--line); }

/* ============ lists (layers, pages, files, versions) ============ */
.layers { padding: 6px; }
.layer {
  display: flex; align-items: center; gap: 6px; height: 28px; padding-right: 8px; cursor: pointer; white-space: nowrap; overflow: hidden;
  border-radius: 6px; color: var(--text-2); border: 1px solid transparent;
}
.layer:hover { background: var(--panel-3); color: var(--text); }
.layer.selected { background: var(--accent-soft); color: #fff; border-color: var(--accent-line); }
.layer .tw { width: 16px; height: 16px; flex: none; display: grid; place-items: center; color: var(--muted); border-radius: 4px; }
.layer .tw:hover { background: var(--line-2); }
.layer .tw .i { width: 12px; height: 12px; transition: transform .12s; }
.layer .tw.open .i { transform: rotate(90deg); }
.layer > .i { color: var(--muted); width: 14px; height: 14px; }
.layer.selected > .i { color: #b9b0ff; }
.layer .nm { font-weight: 500; }
.layer .txt { color: var(--muted); overflow: hidden; text-overflow: ellipsis; font-size: 12px; }
.layer .anchor { display: inline-flex; align-items: center; gap: 3px; color: var(--orange); font-size: 11px; font-family: var(--mono); }
.layer .anchor .i { width: 11px; height: 11px; }
.layer.drop-before { box-shadow: inset 0 2px 0 var(--accent); }
.layer.drop-after { box-shadow: inset 0 -2px 0 var(--accent); }
.layer.drop-inside { background: var(--accent-soft); border-color: var(--accent); }

.list-item {
  display: flex; align-items: center; gap: 10px; padding: 0 8px 0 10px; height: 38px; border-radius: 8px; cursor: pointer;
  color: var(--text-2); border: 1px solid transparent;
}
.list-item:hover { background: var(--panel-3); color: var(--text); }
.list-item.active { background: var(--accent-soft); border-color: var(--accent-line); color: #fff; }
.list-item > .i { color: var(--muted); }
.list-item.active > .i { color: #b9b0ff; }
.list-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .grow small { display: block; color: var(--muted); font-size: 11px; margin-top: -1px; }
.list-item .acts { display: none; gap: 2px; }
.list-item:hover .acts { display: flex; }
.list-item.tall { height: auto; min-height: 44px; padding-top: 6px; padding-bottom: 6px; }
.tree-item { height: 30px; font-size: 12.5px; gap: 7px; }
.tree-item > .i { width: 15px; height: 15px; }

.menu-item {
  display: grid; grid-template-columns: 20px 1fr auto; align-items: center; gap: 8px; padding: 8px 8px 8px 6px; border: 1px solid var(--line);
  background: var(--panel-2); border-radius: 9px; margin-bottom: 6px; cursor: pointer;
}
.menu-item:hover { border-color: var(--line-2); background: var(--panel-3); }
.menu-item .grip { color: var(--muted); }
.menu-item b { font-weight: 600; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item small { display: flex; align-items: center; gap: 4px; color: var(--muted); font-size: 11.5px; overflow: hidden; white-space: nowrap; }
.menu-item small .i { width: 12px; height: 12px; }
.menu-item .acts { display: flex; gap: 2px; opacity: 0; }
.menu-item:hover .acts { opacity: 1; }

.version { position: relative; padding: 10px 10px 10px 30px; border-radius: 9px; cursor: default; }
.version::before { content: ''; position: absolute; left: 13px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.version::after { content: ''; position: absolute; left: 9px; top: 15px; width: 10px; height: 10px; border-radius: 50%; background: var(--panel); border: 2px solid var(--line-2); }
.version.manual::after { border-color: var(--accent); background: var(--accent); }
.version.restored::after { border-color: var(--green); }
.version.current::after { border-color: var(--green); background: var(--green); }
.version:hover { background: var(--panel-2); }
.version .v-top { display: flex; align-items: center; gap: 8px; }
.version .v-time { font-weight: 600; }
.version .v-label { color: var(--text-2); margin-top: 2px; }
.version .v-files { color: var(--muted); font-size: 11.5px; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.version .acts { display: flex; gap: 4px; margin-top: 8px; }
.version:not(:hover) .acts { display: none; }
.badge { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 5px; font-size: 10.5px; font-weight: 600; background: var(--panel-3); color: var(--text-2); }
.badge.accent { background: var(--accent-soft); color: #c3bbff; }
.badge.green { background: rgba(47, 199, 122, .14); color: #7ee2ad; }
.day-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 16px 0 4px 2px; }

/* ============ block library ============ */
.blocks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.block-item {
  display: flex; flex-direction: column; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--panel-2);
  border-radius: 10px; padding: 14px 6px 11px; cursor: pointer; text-align: center; font-size: 12px; font-weight: 500; color: var(--text-2);
  transition: border-color .12s, background .12s, color .12s;
}
.block-item:hover { border-color: var(--accent-line); background: var(--accent-soft); color: var(--text); }
.block-item .bi { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--panel-3); color: #b9b0ff; }
.block-item:hover .bi { background: rgba(108, 92, 255, .25); }

/* ============ inspector ============ */
.welcome { padding: 6px 2px; }
.welcome h3 { margin: 4px 0 4px; font-size: 15px; }
.welcome > p { color: var(--muted); margin: 0 0 16px; }
.step { display: flex; gap: 12px; padding: 12px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--line); margin-bottom: 8px; }
.step .num { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: #c3bbff; flex: none; }
.step b { display: block; font-weight: 600; margin-bottom: 2px; }
.step span { color: var(--muted); font-size: 12px; line-height: 1.45; }
.keys { display: grid; grid-template-columns: auto 1fr; gap: 7px 10px; align-items: center; margin-top: 16px; color: var(--muted); font-size: 12px; }

.el-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.el-icon { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: #c3bbff; flex: none; }
.el-name { font-weight: 650; font-size: 14px; }
.el-tag { color: var(--muted); font-family: var(--mono); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin-bottom: 12px; font-size: 11.5px; }
.crumbs button { border: 0; background: none; padding: 2px 5px; border-radius: 4px; cursor: pointer; color: var(--muted); }
.crumbs button:hover { background: var(--panel-3); color: var(--text); }
.crumbs button:last-child { color: var(--text); font-weight: 600; }
.crumbs .i { width: 11px; height: 11px; color: #4a4e59; }
.el-actions { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 4px; }
.el-actions .btn { height: 34px; padding: 0; }
.big-action { margin-bottom: 8px; }

.sect { border-top: 1px solid var(--line); margin: 0 -14px; padding: 0 14px; }
.sect > summary {
  display: flex; align-items: center; gap: 8px; list-style: none; cursor: pointer; padding: 13px 0; font-weight: 600; font-size: 12.5px;
  user-select: none; color: var(--text);
}
.sect > summary::-webkit-details-marker { display: none; }
.sect > summary .i { color: var(--muted); }
.sect > summary .chev { margin-left: auto; transition: transform .15s; }
.sect[open] > summary .chev { transform: rotate(180deg); }
.sect > .sect-body { padding-bottom: 14px; }

.info-card {
  display: flex; gap: 10px; padding: 11px 12px; border-radius: 10px; background: rgba(255, 159, 28, .08);
  border: 1px solid rgba(255, 159, 28, .3); margin-bottom: 12px; line-height: 1.45;
}
.info-card > .i { color: var(--orange); margin-top: 1px; }
.info-card.blue { background: rgba(61, 139, 255, .08); border-color: rgba(61, 139, 255, .3); }
.info-card.blue > .i { color: var(--blue); }
.info-card b { color: var(--text); font-weight: 600; }
.info-card .acts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.dest-btn {
  display: flex; align-items: center; gap: 9px; width: 100%; height: 42px; padding: 0 12px; border-radius: 9px; cursor: pointer;
  border: 1.5px solid var(--accent-line); background: var(--accent-soft); color: var(--text); font-weight: 600; text-align: left;
  transition: border-color .12s, background .12s;
}
.dest-btn:hover, .dest-btn.open { border-color: var(--accent); background: rgba(108, 92, 255, .24); }
.dest-btn > .i { color: #c3bbff; }
.dest-btn .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dest-btn .chev { transition: transform .15s; color: var(--text-2); }
.dest-btn.open .chev { transform: rotate(180deg); }
.dest-btn.warn { border-color: rgba(255, 159, 28, .5); background: rgba(255, 159, 28, .1); }
.dest-btn.warn > .i { color: var(--orange); }
.dest-pop {
  position: fixed; z-index: 1600; display: flex; flex-direction: column; gap: 6px; padding: 8px; background: #1d1f25;
  border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); animation: pop .12s ease-out; min-height: 0;
}
.dest-list { overflow: auto; min-height: 0; flex: 1; }
.dest-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 10px 8px 4px; }
.dest-item {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: 34px; padding: 6px 8px; border: 0; border-radius: 7px;
  background: none; cursor: pointer; text-align: left; color: var(--text-2); line-height: 1.3;
}
.dest-item:hover { background: var(--panel-3); color: var(--text); }
.dest-item > .i { color: var(--muted); }
.dest-item .grow { flex: 1; min-width: 0; }
.dest-item.current { background: var(--accent-soft); color: #fff; }
.dest-item.current > .i { color: #c3bbff; }

.img-preview {
  width: 100%; height: 140px; object-fit: contain; border-radius: 10px; border: 1px solid var(--line-2); margin-bottom: 8px; display: block;
  background: repeating-conic-gradient(#202227 0% 25%, #17181c 0% 50%) 50% / 16px 16px;
}

.boxmodel { position: relative; border: 1px dashed #4a4e59; border-radius: 10px; padding: 26px 46px; background: rgba(255, 159, 28, .04); margin-bottom: 4px; }
.boxmodel .bm-inner { position: relative; border: 1px solid #4a4e59; border-radius: 7px; padding: 26px 46px; background: rgba(47, 199, 122, .05); }
.boxmodel .bm-core { height: 22px; border-radius: 4px; background: var(--panel-3); display: grid; place-items: center; color: var(--muted); font-size: 10px; }
.boxmodel .bm-label { position: absolute; left: 8px; top: 5px; font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.boxmodel input {
  position: absolute; width: 40px; height: 20px; padding: 0 2px; text-align: center; font-size: 11px; border: 1px solid transparent;
  border-radius: 4px; background: transparent; outline: none; color: var(--text-2);
}
.boxmodel input:hover { border-color: var(--line-2); }
.boxmodel input:focus { border-color: var(--accent); background: #0f1013; color: var(--text); }
.boxmodel input::placeholder { color: #5f6370; }
.boxmodel .t { top: 3px; left: 50%; transform: translateX(-50%); }
.boxmodel .b { bottom: 3px; left: 50%; transform: translateX(-50%); }
.boxmodel .l { left: 3px; top: 50%; transform: translateY(-50%); }
.boxmodel .r { right: 3px; top: 50%; transform: translateY(-50%); }

.attr-row { display: grid; grid-template-columns: 92px 1fr 28px; gap: 5px; margin-bottom: 5px; }
.attr-row .input { height: 28px; font-size: 12px; }
.attr-row .input:disabled { color: var(--muted); font-family: var(--mono); font-size: 11px; }

/* ============ image library ============ */
.img-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.img-tile { border: 1.5px solid var(--line-2); border-radius: 10px; overflow: hidden; cursor: pointer; background: var(--panel-2); transition: border-color .12s, transform .12s; }
.img-tile:hover { border-color: var(--accent); transform: translateY(-2px); }
.img-tile img { width: 100%; height: 104px; object-fit: cover; display: block; background: #fff; }
.img-tile div { padding: 6px 8px; font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drop-zone {
  display: flex; align-items: center; justify-content: center; gap: 10px; padding: 18px; border: 1.5px dashed var(--line-2); border-radius: 12px;
  color: var(--muted); margin-bottom: 16px; cursor: pointer; transition: border-color .12s, background .12s, color .12s;
}
.drop-zone:hover, .drop-zone.over { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.help-card { padding: 14px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }
.help-card .i { color: #b9b0ff; margin-bottom: 8px; }
.help-card b { display: block; margin-bottom: 4px; }
.help-card span { color: var(--muted); font-size: 12.5px; line-height: 1.5; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2a2d35; border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #383b45; }
::-webkit-scrollbar-track { background: transparent; }
