/* LiveEdit — editor.css */
@import url('https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600&family=Geist+Mono:wght@400;500&display=swap');

*, *::before, *::after { box-sizing: border-box; }

:root {
  --bg-deep:    #0d0d14;
  --bg-base:    #13131f;
  --bg-surface: #1a1a2e;
  --bg-raised:  #21213a;
  --bg-hover:   rgba(255,255,255,.05);

  --border:     rgba(255,255,255,.07);
  --border-md:  rgba(255,255,255,.11);
  --border-hi:  rgba(99,102,241,.5);

  --text-1: #e8e8f0;
  --text-2: #9090b0;
  --text-3: #52526a;
  --text-4: #2e2e42;

  --accent:     #6366f1;
  --accent-dim: rgba(99,102,241,.18);
  --accent-hi:  #818cf8;

  --success: #34d399;
  --warn:    #fbbf24;
  --error:   #f87171;

  --r1: 4px;
  --r2: 7px;
  --r3: 10px;

  --font: 'Geist', system-ui, sans-serif;
  --mono: 'Geist Mono', 'Fira Mono', monospace;
  --toolbar-h: 44px;
  --bc-h: 25px;
}

html, body { margin:0; padding:0; height:100%; font-family:var(--font); -webkit-font-smoothing:antialiased; }

/* ── Login ─────────────────────────────────────────────────────────────── */
body.login-page {
  background: var(--bg-deep);
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
}
.login-box {
  width: 320px;
  background: var(--bg-surface);
  border: 1px solid var(--border-md);
  border-radius: var(--r3);
  padding: 32px 28px;
}
.login-logo {
  display: flex; align-items: center; gap: 9px;
  font-size: 16px; font-weight: 600; color: var(--text-1);
  margin-bottom: 5px; letter-spacing: -.2px;
}
.login-sub { font-size: 13px; color: var(--text-3); margin: 0 0 24px; line-height: 1.5; }
.login-error {
  background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.2);
  border-radius: var(--r1); color: var(--error); font-size: 12px;
  padding: 8px 10px; margin-bottom: 12px;
}
.login-box input[type="password"] {
  width: 100%; padding: 9px 12px;
  background: var(--bg-raised); border: 1px solid var(--border-md);
  border-radius: var(--r2); font-size: 14px; font-family: var(--font);
  color: var(--text-1); outline: none; display: block; margin-bottom: 10px;
  transition: border-color .12s;
}
.login-box input[type="password"]::placeholder { color: var(--text-4); }
.login-box input[type="password"]:focus { border-color: var(--accent); }
.login-box button {
  width: 100%; padding: 9px; background: var(--accent);
  color: #fff; border: none; border-radius: var(--r2);
  font-size: 13px; font-weight: 500; font-family: var(--font);
  cursor: pointer; letter-spacing: -.1px; transition: opacity .12s;
}
.login-box button:hover   { opacity: .87; }
.login-box button:disabled { opacity: .4; cursor: default; }

/* ── Editor layout ─────────────────────────────────────────────────────── */
body.editor-page {
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
  background: var(--bg-deep);
}

/* ── Toolbar ───────────────────────────────────────────────────────────── */
#toolbar {
  height: var(--toolbar-h); min-height: var(--toolbar-h);
  background: var(--bg-base);
  display: flex; align-items: center;
  padding: 0 8px; gap: 5px;
  border-bottom: 1px solid var(--border);
  position: relative; z-index: 100;
}
.tb-left  { display: flex; align-items: center; gap: 5px; flex: 1; min-width: 0; }
.tb-right { display: flex; align-items: center; gap: 5px; }
.tb-center{ display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.tb-logo  { display: flex; align-items: center; padding: 0 3px; flex-shrink: 0; }
.tb-divider { width: 1px; height: 18px; background: var(--border-md); flex-shrink: 0; margin: 0 2px; }

/* File picker */
.tb-file-picker { min-width: 0; max-width: 170px; }
.tb-file-picker select {
  background: var(--bg-raised); border: 1px solid var(--border-md);
  border-radius: var(--r1); color: var(--text-2);
  font-size: 12px; font-family: var(--mono);
  padding: 4px 7px; outline: none; cursor: pointer;
  max-width: 100%; text-overflow: ellipsis;
  transition: border-color .12s, color .12s;
}
.tb-file-picker select:hover { border-color: var(--border-hi); color: var(--text-1); }
.tb-file-picker select:focus { border-color: var(--accent); }

/* Buttons */
.tb-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px;
  background: transparent; border: 1px solid var(--border-md);
  border-radius: var(--r1);
  color: var(--text-2); font-size: 12px; font-weight: 500;
  font-family: var(--font); cursor: pointer;
  white-space: nowrap; letter-spacing: -.1px;
  transition: background .1s, border-color .1s, color .1s;
}
.tb-btn svg { opacity: .65; flex-shrink: 0; transition: opacity .1s; }
.tb-btn:hover    { background: var(--bg-hover); color: var(--text-1); }
.tb-btn:hover svg { opacity: 1; }
.tb-btn:active   { opacity: .7; }
.tb-btn:disabled { opacity: .28; cursor: default; pointer-events: none; }

.tb-btn-primary {
  background: var(--accent-dim); border-color: rgba(99,102,241,.4);
  color: var(--accent-hi);
}
.tb-btn-primary svg { opacity: 1; }
.tb-btn-primary:hover { background: rgba(99,102,241,.28); border-color: var(--border-hi); color: #c7d2fe; }
.tb-btn-primary.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.tb-btn-primary.active:hover { background: #4f52d4; }

.tb-btn-ghost { border-color: transparent; color: var(--text-3); }
.tb-btn-ghost:hover { background: var(--bg-hover); border-color: var(--border); color: var(--text-2); }

/* Status */
.tb-status { font-size: 12px; color: var(--text-3); white-space: nowrap; padding: 0 2px; }
.tb-status-info    { color: #60a5fa; }
.tb-status-warn    { color: var(--warn); }
.tb-status-success { color: var(--success); }
.tb-status-error   { color: var(--error); }

/* ── Badges ────────────────────────────────────────────────────────────── */
#link-badge, #placeholder-badge, #img-badge {
  display: flex; align-items: center; gap: 5px;
  background: rgba(99,102,241,.1); border: 1px solid rgba(99,102,241,.25);
  border-radius: var(--r1); padding: 3px 7px 3px 6px;
  animation: ye-pop .12s ease; flex-shrink: 0;
}
@keyframes ye-pop {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: scale(1); }
}
.link-badge-icon { display: flex; align-items: center; color: var(--accent-hi); flex-shrink: 0; }
.link-badge-url {
  font-size: 11px; font-family: var(--mono); color: var(--accent-hi);
  max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.link-badge-btn {
  background: rgba(99,102,241,.18); border: 1px solid rgba(99,102,241,.3);
  border-radius: 3px; color: #c7d2fe;
  font-size: 11px; font-weight: 500; font-family: var(--font);
  padding: 2px 7px; cursor: pointer; white-space: nowrap; transition: background .1s;
}
.link-badge-btn:hover { background: rgba(99,102,241,.35); color: #fff; }
.link-badge-btn-save { background: rgba(99,102,241,.28) !important; border-color: rgba(99,102,241,.5) !important; }
.link-badge-input {
  background: var(--bg-raised); border: 1px solid var(--border-hi);
  border-radius: 3px; color: var(--text-1); font-size: 11px;
  font-family: var(--mono); padding: 2px 7px; outline: none; width: 190px;
}
.link-badge-input:focus { border-color: var(--accent); }

/* ── PRO / Upgrade badges ─────────────────────────────────────────────── */
.tb-upgrade-btn {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; background: rgba(99,102,241,.08);
  border: 1px solid rgba(99,102,241,.25); border-radius: var(--r1);
  color: #7c7cf0; font-size: 11px; font-weight: 500;
  font-family: var(--font); cursor: pointer; white-space: nowrap;
  transition: background .1s, border-color .1s; flex-shrink: 0;
}
.tb-upgrade-btn:hover { background: var(--accent-dim); border-color: var(--border-hi); color: var(--accent-hi); }

.tb-pro-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; background: rgba(99,102,241,.12);
  border: 1px solid rgba(99,102,241,.3); border-radius: var(--r1);
  color: var(--accent-hi); font-size: 11px; font-weight: 600;
  font-family: var(--font); cursor: pointer;
  letter-spacing: .04em; white-space: nowrap; flex-shrink: 0;
  transition: background .1s;
}
.tb-pro-active { background: rgba(99,102,241,.2); border-color: rgba(99,102,241,.45); color: #c7d2fe; }
.tb-pro-badge:hover { background: rgba(99,102,241,.25); }

/* ── Breadcrumb ────────────────────────────────────────────────────────── */
#breadcrumb-bar {
  height: var(--bc-h); min-height: var(--bc-h);
  background: var(--bg-deep); border-bottom: 1px solid var(--border);
  padding: 0 10px; display: none; align-items: center;
  overflow: hidden; flex-shrink: 0;
}
body.ye-editing #breadcrumb-bar { display: flex; }

#breadcrumb-inner {
  display: flex; align-items: center;
  overflow-x: auto; overflow-y: hidden;
  scrollbar-width: none; height: 100%; width: 100%;
}
#breadcrumb-inner::-webkit-scrollbar { display: none; }

.bc-sep { color: var(--text-4); font-size: 10px; padding: 0 1px; user-select: none; flex-shrink: 0; }
.bc-tag {
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
  padding: 1px 5px; border-radius: 3px; cursor: pointer;
  white-space: nowrap; flex-shrink: 0; background: none;
  border: 1px solid transparent; line-height: 1.6;
  transition: background .1s, color .1s;
}
.bc-tag:hover { background: var(--bg-raised); color: var(--text-2); }
.bc-tag.bc-active { background: rgba(99,102,241,.14); color: #a5b4fc; border-color: rgba(99,102,241,.28); }
.bc-tag.bc-body { color: var(--text-4); font-size: 10px; }
.bc-tag.bc-body:hover { color: var(--text-3); }

/* ── Iframe ─────────────────────────────────────────────────────────────── */
#frame-wrap { flex: 1; position: relative; overflow: hidden; z-index: 1; }
#site-frame  { width: 100%; height: 100%; border: none; display: block; background: #fff; }

/* ── Settings panel ─────────────────────────────────────────────────────── */
.settings-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.55);
  z-index: 9000; backdrop-filter: blur(3px);
  opacity: 0; transition: opacity .22s ease;
}
.settings-overlay.is-open { opacity: 1; }
.settings-panel {
  position: fixed; top: 0; right: 0;
  width: 292px; height: 100vh;
  background: var(--bg-surface); border-left: 1px solid var(--border-md);
  z-index: 9001; display: flex; flex-direction: column;
}
.settings-panel.is-open    { animation: ye-slide-in  .24s cubic-bezier(.4,0,.2,1) forwards; }
.settings-panel.is-closing { animation: ye-slide-out .18s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes ye-slide-in {
  from { transform: translateX(100%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}
@keyframes ye-slide-out {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(100%); opacity: 0; }
}
.settings-inner { flex: 1; overflow-y: auto; padding-bottom: 32px; }
.settings-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 13px 16px; font-size: 13px; font-weight: 600;
  color: var(--text-1); border-bottom: 1px solid var(--border);
  letter-spacing: -.1px;
}
.settings-close {
  background: none; border: none; color: var(--text-3);
  cursor: pointer; font-size: 15px; line-height: 1;
  padding: 3px 5px; border-radius: var(--r1);
  transition: background .1s, color .1s;
}
.settings-close:hover { background: var(--bg-hover); color: var(--text-1); }
.settings-section { padding: 16px 16px 0; }
.settings-section-title {
  font-size: 10px; font-weight: 600; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-4); margin-bottom: 12px;
}

/* License */
.license-desc { font-size: 12px; color: var(--text-3); margin: 0 0 12px; line-height: 1.55; }
.license-features {
  margin: 0 0 14px; padding: 0; list-style: none;
  display: flex; flex-direction: column; gap: 5px;
}
.license-features li {
  font-size: 12px; color: var(--text-3);
  display: flex; align-items: center; gap: 7px;
}
.license-features li::before {
  content: ''; width: 3px; height: 3px; border-radius: 50%;
  background: var(--accent); flex-shrink: 0;
}
.license-input-row { display: flex; gap: 6px; margin-bottom: 8px; }
.license-input-row input {
  flex: 1; background: var(--bg-raised); border: 1px solid var(--border-md);
  border-radius: var(--r1); color: var(--text-1); font-size: 12px;
  font-family: var(--mono); padding: 6px 8px; outline: none;
  letter-spacing: .04em; transition: border-color .12s;
}
.license-input-row input:focus { border-color: var(--accent); }
.settings-btn {
  padding: 6px 12px; border-radius: var(--r1); font-size: 12px;
  font-weight: 500; font-family: var(--font); cursor: pointer;
  border: none; white-space: nowrap; letter-spacing: -.1px; transition: opacity .1s;
}
.settings-btn:disabled { opacity: .4; cursor: default; }
.settings-btn-primary { background: var(--accent); color: #fff; }
.settings-btn-primary:hover { background: #4f52d4; }
.settings-btn-danger {
  background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.2);
  color: var(--error); margin-top: 12px; width: 100%;
}
.settings-btn-danger:hover { background: rgba(248,113,113,.15); }
.license-msg { font-size: 12px; padding: 6px 9px; border-radius: var(--r1); margin-top: 6px; }
.license-msg-error { background: rgba(248,113,113,.08); border: 1px solid rgba(248,113,113,.18); color: var(--error); }
.license-msg-success { background: rgba(52,211,153,.08); border: 1px solid rgba(52,211,153,.18); color: var(--success); }
.license-test-hint { font-size: 11px; color: var(--text-4); margin: 10px 0 0; }
.license-test-hint code {
  color: var(--text-3); background: var(--bg-raised); padding: 1px 5px;
  border-radius: 3px; font-size: 11px; font-family: var(--mono);
}
.license-test-hint code:hover { color: #a5b4fc; cursor: pointer; }
.license-active-row { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.license-active-label { font-size: 13px; font-weight: 600; color: var(--success); }
.license-meta { font-size: 12px; color: var(--text-3); margin-bottom: 4px; }
.license-meta code { color: var(--text-2); font-family: var(--mono); font-size: 11px; }

/* ── Password ───────────────────────────────────────────────────────────── */
.password-section { display: flex; flex-direction: column; }
.pwd-field-row { margin-bottom: 8px; }
.pwd-label { display: block; font-size: 11px; color: var(--text-3); margin-bottom: 4px; }
.pwd-input {
  width: 100%; background: var(--bg-raised); border: 1px solid var(--border-md);
  border-radius: var(--r1); color: var(--text-1); font-size: 12px;
  font-family: var(--font); padding: 6px 8px; outline: none; transition: border-color .12s;
}
.pwd-input:focus { border-color: var(--accent); }

/* ── Buy link ───────────────────────────────────────────────────────────── */
.license-buy-link {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 10px;
  font-size: 12px; color: var(--accent-hi); text-decoration: none;
  opacity: .8; transition: opacity .15s;
}
.license-buy-link:hover { opacity: 1; text-decoration: underline; }

/* ── Appearance settings ─────────────────────────────────────────────────── */
.appearance-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 7px 0; border-bottom: 1px solid var(--border);
}
.appearance-row:last-child { border-bottom: none; }
.appearance-label { font-size: 12px; color: var(--text-2); }
.appearance-control { display: flex; align-items: center; gap: 6px; }
.appearance-color {
  width: 30px; height: 22px; padding: 0 2px;
  border: 1px solid var(--border-md); border-radius: var(--r1);
  background: var(--bg-raised); cursor: pointer;
}
.appearance-color::-webkit-color-swatch-wrapper { padding: 1px; }
.appearance-color::-webkit-color-swatch { border-radius: 2px; border: none; }
.appearance-reset {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  font-size: 13px; padding: 2px 4px; border-radius: var(--r1); line-height: 1;
  transition: color .12s;
}
.appearance-reset:hover { color: var(--text-1); }

/* ── Onboarding ─────────────────────────────────────────────────────────── */
.onboarding-overlay {
  position: fixed; inset: 0; background: rgba(5,5,15,.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 10000; backdrop-filter: blur(6px);
}
.onboarding-modal {
  background: var(--bg-surface); border: 1px solid var(--border-md);
  border-radius: var(--r3); padding: 28px 24px;
  width: 380px; max-width: calc(100vw - 32px);
}
.onboarding-logo { display: flex; align-items: center; gap: 9px; font-size: 15px; font-weight: 600; color: var(--text-1); margin-bottom: 18px; letter-spacing: -.2px; }
.onboarding-title { font-size: 17px; font-weight: 600; color: var(--text-1); margin: 0 0 7px; letter-spacing: -.2px; }
.onboarding-desc { font-size: 13px; color: var(--text-3); margin: 0 0 22px; line-height: 1.55; }
.onboarding-steps { display: flex; flex-direction: column; gap: 16px; margin-bottom: 18px; }
.onboarding-step { display: flex; gap: 11px; align-items: flex-start; }
.step-num {
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent-dim);
  border: 1px solid var(--border-hi); color: var(--accent-hi);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; flex-shrink: 0; margin-top: 1px; font-family: var(--mono);
}
.step-title { font-size: 13px; font-weight: 500; color: var(--text-1); margin-bottom: 2px; letter-spacing: -.1px; }
.step-optional { font-size: 11px; color: var(--text-4); font-weight: 400; }
.step-desc { font-size: 12px; color: var(--text-3); line-height: 1.5; }
.onboarding-skip {
  background: none; border: none; color: var(--text-4); font-size: 12px;
  cursor: pointer; padding: 4px 0; width: 100%; text-align: center;
  font-family: var(--font); transition: color .1s;
}
.onboarding-skip:hover { color: var(--text-3); }

/* ── Code editor panel ─────────────────────────────────────────────────── */
#code-panel {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 45vh;
  min-height: 260px;
  background: var(--bg-deep);
  border-top: 1px solid var(--border-md);
  z-index: 500;
  display: flex;
  flex-direction: column;
  animation: ye-panel-up .18s ease;
}
@keyframes ye-panel-up {
  from { transform: translateY(20px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.code-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px;
  height: 36px;
  min-height: 36px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.code-panel-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--text-3);
}
.code-panel-title svg { color: var(--text-3); }

.code-panel-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.code-hint {
  font-size: 11px;
  color: var(--text-4);
}

.code-btn {
  padding: 3px 10px;
  border-radius: var(--r1);
  font-size: 11px;
  font-weight: 500;
  font-family: var(--font);
  cursor: pointer;
  border: 1px solid var(--border-md);
  background: transparent;
  color: var(--text-2);
  transition: background .1s, color .1s;
}
.code-btn:hover { background: var(--bg-hover); color: var(--text-1); }

.code-btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.code-btn-primary:hover { background: #4f52d4; }

#code-editor-wrap {
  flex: 1;
  overflow: hidden;
  position: relative;
}

/* CodeMirror overrides */
#code-editor-wrap .cm-editor {
  height: 100%;
  font-size: 13px;
  font-family: var(--mono);
}
#code-editor-wrap .cm-editor.cm-focused { outline: none; }
#code-editor-wrap .cm-scroller { overflow: auto; }
#code-editor-wrap .cm-content { padding: 8px 0; }

/* CodeMirror line highlight when syncing from editor */
.ye-cm-highlight { background: rgba(99,102,241,.25) !important; }

/* ── File manager ──────────────────────────────────────────────────────────── */
#fm-panel {
  position: fixed;
  top: var(--toolbar-h);
  left: 0;
  width: 280px;
  max-height: calc(100vh - var(--toolbar-h) - 8px);
  background: var(--bg-base);
  border: 1px solid var(--border-md);
  border-top: none;
  border-left: none;
  border-radius: 0 0 var(--r2) 0;
  z-index: 1999;
  display: flex;
  flex-direction: column;
  box-shadow: 4px 4px 24px rgba(0,0,0,.35);
  animation: ye-pop .14s ease;
}

.fm-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  gap: 8px;
}
.fm-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.fm-header-actions { display: flex; align-items: center; gap: 5px; margin-left: auto; }

.fm-action-btn {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--accent-dim); border: 1px solid var(--border-hi);
  border-radius: var(--r1); color: var(--accent-hi);
  font-size: 11px; font-family: var(--font);
  padding: 3px 8px; cursor: pointer; transition: background .1s;
}
.fm-action-btn:hover { background: rgba(99,102,241,.3); }

.fm-close-btn {
  background: none; border: none; color: var(--text-3);
  cursor: pointer; padding: 3px; border-radius: var(--r1);
  display: flex; align-items: center; transition: color .1s;
}
.fm-close-btn:hover { color: var(--text-1); }

.fm-search-wrap {
  padding: 7px 8px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.fm-search {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--r1);
  color: var(--text-1);
  font-size: 12px; font-family: var(--font);
  padding: 5px 9px; outline: none;
  transition: border-color .12s;
}
.fm-search:focus { border-color: var(--accent); }
.fm-search::placeholder { color: var(--text-4); }

.fm-tree {
  flex: 1; overflow-y: auto;
  padding: 4px 0 8px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-md) transparent;
}

/* ── Dir nodes ── */
.fm-dir { display: flex; flex-direction: column; }

.fm-dir-toggle {
  display: flex; align-items: center; gap: 5px;
  padding: 3px 8px 3px 0;
  cursor: pointer; color: var(--text-2);
  font-size: 12px; font-family: var(--font);
  transition: background .08s; user-select: none;
  min-width: 0;
}
.fm-dir-toggle:hover { background: var(--bg-hover); }
.fm-dir-icon { flex-shrink: 0; color: var(--text-3); }
.fm-dir-chevron {
  flex-shrink: 0; color: var(--text-4);
  transition: transform .15s;
}
.fm-dir-toggle.open .fm-dir-chevron { transform: rotate(90deg); }
.fm-dir-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; color: var(--text-2);
}

.fm-dir-children { display: none; }
.fm-dir-children.open { display: block; }

/* ── File nodes ── */
.fm-file { display: flex; align-items: center; position: relative; }

.fm-file-row {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 8px 3px 0;
  cursor: pointer; flex: 1;
  transition: background .08s; min-width: 0;
}
.fm-file-row:hover { background: var(--bg-hover); }
.fm-file-row.active { background: var(--accent-dim); }
.fm-file-row.active .fm-file-name { color: #a5b4fc; }

.fm-file-name {
  flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: 12px; font-family: var(--mono); color: var(--text-2);
}
.fm-file-row:hover .fm-file-name { color: var(--text-1); }

.fm-file-size {
  font-size: 10px; color: var(--text-4); flex-shrink: 0;
  font-family: var(--mono); margin-right: 4px;
}

.fm-file-actions {
  display: none; align-items: center; gap: 1px;
  position: absolute; right: 0;
  background: var(--bg-base);
  padding: 0 6px 0 4px;
}
.fm-file:hover .fm-file-actions { display: flex; }

.fm-btn {
  background: none; border: none; color: var(--text-3);
  cursor: pointer; padding: 3px; border-radius: 3px;
  display: flex; align-items: center; transition: color .1s;
}
.fm-btn:hover { color: var(--text-1); }
.fm-btn.del:hover { color: var(--error); }

/* Ext badges */
.fm-ext {
  font-size: 9px; font-weight: 600; padding: 1px 4px;
  border-radius: 3px; flex-shrink: 0;
  letter-spacing: .02em; font-family: var(--mono);
  min-width: 28px; text-align: center;
}
.fm-ext-html { background: rgba(251,146,60,.15); color: #fb923c; }
.fm-ext-css  { background: rgba(96,165,250,.15);  color: #60a5fa; }
.fm-ext-js   { background: rgba(251,211,66,.15);  color: #e8c84a; }
.fm-ext-img  { background: rgba(52,211,153,.15);  color: #34d399; }
.fm-ext-other{ background: var(--bg-raised); color: var(--text-3); }

/* Inline rename */
.fm-rename-input {
  flex: 1; background: var(--bg-raised);
  border: 1px solid var(--accent); border-radius: 3px;
  color: var(--text-1); font-size: 12px; font-family: var(--mono);
  padding: 1px 6px; outline: none; min-width: 0;
}

/* Dir action buttons (new file / upload) */
.fm-dir-acts {
  display: none;
  align-items: center;
  gap: 1px;
  margin-left: auto;
  padding-right: 4px;
  flex-shrink: 0;
}
.fm-dir-toggle:hover .fm-dir-acts { display: flex; }


/* ── Mobile preview ────────────────────────────────────────────────────────── */
#frame-wrap.mobile-preview {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  background: var(--bg-deep);
  overflow-y: auto;
}

#mobile-shell {
  position: relative;
  width: 393px;
  flex-shrink: 0;
  margin: 16px 0;
  border-radius: 44px;
  border: 8px solid #2a2a3e;
  box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 24px 64px rgba(0,0,0,.6);
  overflow: hidden;
  background: #000;
}
#mobile-shell::before {
  content: '';
  position: absolute;
  top: 12px; left: 50%;
  transform: translateX(-50%);
  width: 100px; height: 6px;
  background: #1a1a2e;
  border-radius: 3px;
  z-index: 10;
}
#mobile-shell #site-frame {
  width: 378px;
  height: 852px;
  border: none;
  display: block;
  border-radius: 36px;
}
#btn-preview-mobile.active {
  background: var(--accent-dim);
  border-color: var(--border-hi);
  color: var(--accent-hi);
}

/* ── Mobile layout ──────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  :root { --toolbar-h: 52px; }

  #toolbar {
    padding: 0 6px;
    gap: 3px;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  #toolbar::-webkit-scrollbar { display: none; }

  /* Hide non-essential elements */
  .tb-logo,
  .tb-divider,
  #btn-files,
  #btn-code,
  #btn-preview-mobile,
  #btn-discard,
  #status-msg,
  #breadcrumb-bar { display: none !important; }

  .tb-left  { flex: 0 0 auto; gap: 3px; }
  .tb-right { flex: 0 0 auto; gap: 3px; }
  .tb-center{ flex: 0 0 auto; gap: 3px; }

  .tb-file-picker { max-width: 120px; }
  .tb-file-picker select { font-size: 11px; padding: 3px 6px; }

  .tb-btn { padding: 4px 7px; font-size: 11px; gap: 3px; }
  .tb-btn svg { width: 11px; height: 11px; }

  .tb-upgrade-btn,
  .tb-pro-badge { padding: 3px 6px; font-size: 10px; }

  /* Panels full-screen on mobile */
  .settings-panel,
  #pro-panel {
    width: 100% !important;
    max-width: 100% !important;
    right: 0 !important;
    left: 0 !important;
    top: var(--toolbar-h) !important;
    height: calc(100vh - var(--toolbar-h)) !important;
  }

  /* Touch targets — bigger hit area */
  .tb-btn { min-width: 32px; min-height: 32px; }
}

/* ── Section manager panel ───────────────────────────────────────────────── */
#sm-panel {
  position: fixed;
  top: 60px; right: 16px;
  width: 280px;
  max-height: calc(100vh - 80px);
  background: var(--bg-surface);
  border: 1px solid var(--border-md);
  border-radius: var(--r3);
  box-shadow: 0 8px 32px rgba(0,0,0,.45);
  z-index: 8500;
  display: flex;
  flex-direction: column;
  animation: sm-pop-in .2s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
@keyframes sm-pop-in {
  from { opacity: 0; transform: scale(.95) translateY(-6px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}
#sm-panel.is-closing {
  animation: sm-pop-out .15s cubic-bezier(.4,0,.2,1) forwards;
}
@keyframes sm-pop-out {
  from { opacity: 1; transform: scale(1)  translateY(0); }
  to   { opacity: 0; transform: scale(.95) translateY(-6px); }
}
#sm-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  cursor: default;
  flex-shrink: 0;
  user-select: none;
}
#sm-drag-handle {
  display: flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; color: var(--text-1);
  cursor: grab;
}
#sm-drag-handle:active { cursor: grabbing; }
#sm-drag-handle svg { color: var(--text-3); flex-shrink: 0; }
#sm-close {
  background: none; border: none; color: var(--text-3);
  cursor: pointer; font-size: 14px; padding: 2px 5px;
  border-radius: var(--r1); line-height: 1;
  transition: background .1s, color .1s;
}
#sm-close:hover { background: var(--bg-hover); color: var(--text-1); }
#sm-hint {
  font-size: 10px; color: var(--text-3);
  padding: 6px 12px; border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.sm-hint-kbd {
  background: var(--bg-raised); border-radius: 3px; padding: 0 4px;
  font-size: 11px; color: var(--text-2);
}
#sm-list {
  flex: 1; overflow-y: auto; padding: 6px 0;
}
/* Section item */
.sm-item {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px;
  border-radius: var(--r1); margin: 1px 6px;
  cursor: pointer;
  transition: background .1s;
  user-select: none;
  position: relative;
}
.sm-item:hover { background: var(--bg-hover); }
.sm-item.sm-dragging {
  opacity: .4;
}
.sm-item.sm-drop-above::before {
  content: ''; position: absolute; top: -1px; left: 8px; right: 8px;
  height: 2px; background: var(--accent); border-radius: 2px;
}
.sm-item.sm-drop-below::after {
  content: ''; position: absolute; bottom: -1px; left: 8px; right: 8px;
  height: 2px; background: var(--accent); border-radius: 2px;
}
.sm-item-handle {
  color: var(--text-3); cursor: grab; flex-shrink: 0;
  display: flex; align-items: center; padding: 2px;
}
.sm-item-handle:active { cursor: grabbing; }
.sm-item-handle svg { display: block; }
.sm-item-handle-locked { cursor: default !important; color: var(--text-4); opacity: .45; }
.sm-item-handle-locked:active { cursor: default !important; }
.sm-item-badge {
  font-size: 9px; font-weight: 600; letter-spacing: .05em;
  text-transform: uppercase; color: var(--text-3);
  background: var(--bg-raised); border-radius: 3px;
  padding: 1px 5px; flex-shrink: 0;
}
.sm-item-name {
  flex: 1; font-size: 12px; color: var(--text-1);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  min-width: 0;
}
.sm-item.sm-hidden .sm-item-name { color: var(--text-3); text-decoration: line-through; }
.sm-item-actions {
  display: flex; align-items: center; gap: 2px;
  opacity: 0; transition: opacity .1s;
  flex-shrink: 0;
}
.sm-item:hover .sm-item-actions { opacity: 1; }
.sm-item-btn {
  background: none; border: none; color: var(--text-3);
  cursor: pointer; padding: 3px 4px; border-radius: var(--r1);
  display: flex; align-items: center; justify-content: center;
  transition: background .1s, color .1s;
}
.sm-item-btn:hover { background: var(--bg-raised); color: var(--text-1); }
.sm-item-btn.sm-btn-danger:hover { color: var(--error); }
.sm-item-btn.sm-btn-active { color: var(--accent); }
.sm-item-btn:disabled { opacity: .25; cursor: not-allowed; pointer-events: none; }
.sm-group-divider {
  height: 1px; background: var(--border); margin: 4px 10px;
}
#sm-footer {
  border-top: 1px solid var(--border);
  padding: 8px 10px;
  flex-shrink: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.sm-footer-btn {
  background: var(--bg-raised); border: 1px solid var(--border-md);
  color: var(--text-2); font-size: 11px; padding: 6px 10px; border-radius: var(--r2);
  cursor: pointer; font-family: var(--font); transition: background .1s, color .1s;
}
.sm-footer-btn:hover { background: var(--bg-hover); color: var(--text-1); }
.sm-footer-btn-add { width: 100%; }
.sm-footer-actions { display: flex; gap: 6px; }
.sm-footer-btn-cancel { flex: 1; }
.sm-footer-btn-restore {
  background: rgba(251,191,36,.12); border-color: rgba(251,191,36,.35); color: #fbbf24; font-weight: 600;
}
.sm-footer-btn-restore:hover { background: rgba(251,191,36,.22); border-color: rgba(251,191,36,.55); color: #fcd34d; }
.sm-footer-btn-save {
  flex: 1; background: var(--accent); border-color: var(--accent);
  color: #fff; font-weight: 600;
}
.sm-footer-btn-save:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: #fff; }

/* ── Onboarding tour ─────────────────────────────────────────────────────────── */
#ye-tour-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 2147483640;
  pointer-events: none;
  animation: ye-tour-fade-in .2s ease;
}
@keyframes ye-tour-fade-in {
  from { opacity: 0; } to { opacity: 1; }
}
#ye-tour-tip {
  position: fixed;
  z-index: 2147483647;
  width: 272px;
  background: var(--panel-bg, #1e1e2e);
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
  padding: 15px 16px 13px;
  font-family: inherit;
  animation: ye-tour-pop .18s ease;
}
@keyframes ye-tour-pop {
  from { opacity: 0; transform: scale(.94) translateY(5px); }
  to   { opacity: 1; transform: scale(1)  translateY(0); }
}
.ye-tour-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 7px; gap: 8px;
}
.ye-tour-title {
  font-size: 13px; font-weight: 600; color: var(--text-1, #cdd6f4);
  line-height: 1.3;
}
.ye-tour-close {
  background: none; border: none; color: var(--text-3, #6c7086);
  cursor: pointer; padding: 2px; border-radius: 4px;
  display: flex; align-items: center; flex-shrink: 0; margin-top: 1px;
  transition: color .15s, background .15s;
}
.ye-tour-close:hover { color: var(--text-1, #cdd6f4); background: rgba(255,255,255,.08); }
.ye-tour-body {
  font-size: 12px; color: var(--text-2, #a6adc8);
  line-height: 1.6; margin-bottom: 13px;
}
.ye-tour-body b { color: var(--text-1, #cdd6f4); font-weight: 600; }
.ye-tour-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.ye-tour-dots { display: flex; gap: 5px; align-items: center; }
.ye-tour-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: rgba(255,255,255,.16); transition: background .2s, width .2s;
}
.ye-tour-dot.active { background: var(--accent, #6366f1); width: 14px; border-radius: 3px; }
.ye-tour-nav { display: flex; gap: 5px; }
.ye-tour-btn {
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.1);
  color: var(--text-2, #a6adc8); font-size: 12px; padding: 5px 11px;
  border-radius: 6px; cursor: pointer; transition: background .15s;
}
.ye-tour-btn:hover { background: rgba(255,255,255,.13); }
.ye-tour-btn-primary {
  background: var(--accent, #6366f1);
  border-color: var(--accent, #6366f1); color: #fff;
}
.ye-tour-btn-primary:hover { background: var(--accent-hi, #5457e0); border-color: var(--accent-hi, #5457e0); }
/* Arrow (rotated square) */
.ye-tour-arrow {
  position: absolute;
  width: 12px; height: 12px;
  background: var(--panel-bg, #1e1e2e);
  transform: rotate(45deg);
  pointer-events: none;
}
.ye-tour-arrow-top {
  top: -6px;
  border-top: 1px solid rgba(255,255,255,.13);
  border-left: 1px solid rgba(255,255,255,.13);
}
.ye-tour-arrow-bottom {
  bottom: -6px;
  border-bottom: 1px solid rgba(255,255,255,.13);
  border-right: 1px solid rgba(255,255,255,.13);
}
/* Highlight ring on targeted element */
#ye-tour-ring {
  position: fixed;
  pointer-events: none;
  z-index: 2147483645;
  border-radius: 8px;
  animation: ye-ring-pulse 1.8s ease-in-out infinite;
}
@keyframes ye-ring-pulse {
  0%, 100% { box-shadow: 0 0 0 2px rgba(99,102,241,.8), 0 0 0 5px rgba(99,102,241,.2); }
  50%       { box-shadow: 0 0 0 2px rgba(99,102,241,1),  0 0 0 7px rgba(99,102,241,.12); }
}


/* ── Update badge & modal ────────────────────────────────────────────────────── */
.tb-update-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 9px; border-radius: var(--r1); font-size: 12px; font-weight: 600;
  font-family: var(--font); cursor: pointer; white-space: nowrap;
  background: rgba(52,211,153,.15); border: 1px solid rgba(52,211,153,.35);
  color: #34d399; transition: background .15s, color .15s;
  animation: tb-update-pulse 2.5s ease-in-out infinite;
}
.tb-update-btn:hover { background: rgba(52,211,153,.25); color: #6ee7b7; animation: none; }
@keyframes tb-update-pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(52,211,153,0); }
  50%      { box-shadow: 0 0 0 4px rgba(52,211,153,.18); }
}

#update-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: 360px; z-index: 10002;
  background: var(--panel-bg); border: 1px solid var(--border-md);
  border-radius: 14px; padding: 22px 24px 20px;
  box-shadow: 0 16px 48px rgba(0,0,0,.6);
  animation: ye-tour-pop .18s ease;
}
.update-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 10px;
}
.update-modal-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 14px; font-weight: 700; color: var(--text-1);
}
.update-modal-notes {
  font-size: 13px; color: var(--text-2); line-height: 1.7;
  margin-bottom: 14px; padding: 12px 14px;
  background: rgba(255,255,255,.04); border-radius: 8px;
  border: 1px solid var(--border);
}
.update-modal-current {
  font-size: 11px; color: var(--text-3); margin-bottom: 14px;
}
.update-modal-btn {
  display: flex; align-items: center; justify-content: center; gap: 7px;
  width: 100%; padding: 10px; border-radius: 8px; text-decoration: none;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
  transition: background .15s;
}
.update-modal-btn:hover { background: var(--accent-hi); }
