/* ===== VIRTUAL BACKGROUND MAKER ===== */
.vb-root {
  --accent: #6557ff; --accent2: #aa3fff; --bg: #f5f7ff; --surface2: #eef0fb; --border: #dde4f5; --border2: #c4cee8;
  --text: #1b1d2c; --muted: #667089; --act: rgba(101, 87, 255, 0.1);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--text); background: #fff;
  max-width: 1240px; margin: 0 auto 56px; border-radius: 18px; border: 1.5px solid var(--border);
  box-shadow: 0 4px 24px rgba(27, 29, 44, 0.1); position: relative; overflow: hidden;
}
.vb-root::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; z-index: 5; background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.vb-root.is-drop { outline: 3px dashed var(--accent); outline-offset: -8px; }
.vb-root *, .vb-root *::before, .vb-root *::after { box-sizing: border-box; }
.vb-root button, .vb-root input, .vb-root select { font-family: inherit; }
.vb-root [hidden] { display: none !important; }
.vb-root button:focus-visible, .vb-root input:focus-visible, .vb-root select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* looks */
.vb-tpl-wrap { padding: 16px 14px 12px; background: var(--bg); border-bottom: 1.5px solid var(--border); }
.vb-tpl-title { font-size: 13px; font-weight: 700; color: var(--muted); margin: 0 4px 10px; }
.vb-tpl-bar { display: flex; gap: 10px; overflow-x: auto; padding: 2px 4px 6px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.vb-tpl { flex: 0 0 auto; width: 132px; border: 0; background: none; padding: 0; cursor: pointer; display: flex; flex-direction: column; gap: 6px; align-items: center; scroll-snap-align: start; color: var(--text); }
.vb-tpl canvas { width: 128px; height: 72px; border-radius: 10px; border: 2px solid var(--border); transition: transform .15s, border-color .15s, box-shadow .15s; }
.vb-tpl:hover canvas { transform: translateY(-2px); border-color: var(--border2); }
.vb-tpl.is-on canvas { border-color: var(--accent); box-shadow: 0 0 0 3px var(--act); }
.vb-tpl span { font-size: 12px; font-weight: 600; }

/* layout */
.vb-app { display: grid; grid-template-columns: 1fr; }
.vb-stage-col { padding: 14px; background: var(--bg); min-width: 0; }
.vb-panel { padding: 14px 14px 22px; border-top: 1.5px solid var(--border); min-width: 0; }
@media (min-width: 992px) {
  .vb-app { grid-template-columns: minmax(0, 1fr) 380px; align-items: start; }
  .vb-stage-col { padding: 18px; position: sticky; top: 0; }
  .vb-panel { border-top: 0; border-left: 1.5px solid var(--border); max-height: calc(100vh - 20px); overflow-y: auto; }
}
.vb-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.vb-size { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.vb-mirror { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.vb-mirror input { width: 17px; height: 17px; accent-color: var(--accent); margin: 0; }
.vb-stage { position: relative; border-radius: 12px; overflow: hidden; box-shadow: 0 8px 30px rgba(27, 29, 44, .22); touch-action: none; cursor: grab; background: #1b1d2c; line-height: 0; }
.vb-stage.is-drag { cursor: grabbing; }
.vb-stage canvas { display: block; width: 100%; height: auto; }
.vb-busy { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; background: rgba(15, 17, 30, .72); color: #fff; font-size: 14px; font-weight: 600; line-height: 1.4; padding: 20px; text-align: center; }
.vb-spin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; animation: vbspin .9s linear infinite; }
@keyframes vbspin { to { transform: rotate(360deg); } }
.vb-hint { margin: 10px 2px 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.vb-msg { margin: 8px auto 0; border-radius: 10px; background: #1b1d2c; color: #fff; font-size: 13px; font-weight: 600; height: 0; overflow: hidden; opacity: 0; padding: 0 14px; transition: opacity .2s; }
.vb-msg.is-on { opacity: 1; height: auto; padding: 9px 14px; }
.vb-dl { display: flex; gap: 10px; align-items: center; justify-content: center; margin: 14px 0 4px; flex-wrap: wrap; }
.vb-btn-main { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border: 0; border-radius: 12px; cursor: pointer; background: linear-gradient(90deg, var(--accent), var(--accent2)); color: #fff; font-size: 15px; font-weight: 700; box-shadow: 0 6px 18px rgba(101, 87, 255, .35); }
.vb-btn-main:hover { filter: brightness(1.06); }
.vb-howto { display: grid; gap: 10px; margin-top: 14px; }
@media (min-width: 640px) { .vb-howto { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); } }
.vb-howto-card { background: #fff; border: 1.5px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.vb-howto-card h3 { font-size: 14px; font-weight: 800; margin: 0 0 6px; }
.vb-howto-card ol { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.55; color: #3b4256; }
.vb-howto-card li { margin-bottom: 3px; }

/* panel */
.vb-tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface2); border-radius: 12px; margin-bottom: 14px; position: sticky; top: 0; z-index: 3; }
.vb-tab { flex: 1; padding: 9px 4px; border: 0; background: none; border-radius: 9px; font-size: 13px; font-weight: 700; color: var(--muted); cursor: pointer; }
.vb-tab.is-on { background: #fff; color: var(--accent); box-shadow: 0 1px 4px rgba(27, 29, 44, .12); }
.vb-f { display: block; margin-bottom: 14px; }
.vb-f > span { display: flex; justify-content: space-between; font-size: 12.5px; font-weight: 700; margin-bottom: 6px; }
.vb-f > span output { font-weight: 600; color: var(--muted); }
.vb-f input[type='text'], .vb-f select, .vb-search input { width: 100%; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; font-size: 15px; color: var(--text); background: #fff; }
.vb-f input[type='text']:focus, .vb-search input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--act); }
.vb-f input[type='range'] { width: 100%; accent-color: var(--accent); height: 26px; margin: 0; }
.vb-f-row { display: flex; align-items: center; justify-content: space-between; }
.vb-f-row > span { margin: 0; }
.vb-f input[type='color'] { width: 52px; height: 32px; padding: 2px; border: 1.5px solid var(--border); border-radius: 8px; background: #fff; cursor: pointer; }
.vb-chk { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font-size: 13.5px; font-weight: 600; cursor: pointer; }
.vb-chk input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; flex: none; }
.vb-seg { display: flex; flex-wrap: wrap; background: var(--surface2); border-radius: 10px; padding: 3px; gap: 2px; margin-bottom: 14px; }
.vb-f .vb-seg { margin-bottom: 0; }
.vb-seg button { flex: 1 1 auto; padding: 8px 8px; border: 0; border-radius: 8px; background: none; font-size: 12.5px; font-weight: 700; color: var(--muted); cursor: pointer; }
.vb-seg button[aria-pressed='true'] { background: #fff; color: var(--accent); box-shadow: 0 1px 3px rgba(27, 29, 44, .14); }
.vb-seg-sm button { padding: 9px 12px; }
.vb-seg-col { flex-direction: column; gap: 6px; background: none; padding: 0; }
.vb-seg-col button { text-align: left; padding: 11px 13px; border: 1.5px solid var(--border); background: #fff; display: flex; flex-direction: column; gap: 2px; color: var(--text); }
.vb-seg-col button b { font-size: 14px; } .vb-seg-col button small { font-size: 12px; font-weight: 500; color: var(--muted); }
.vb-seg-col button[aria-pressed='true'] { border-color: var(--accent); background: var(--act); box-shadow: none; }
.vb-btn { padding: 8px 12px; border-radius: 9px; border: 1.5px solid var(--border); background: #fff; font-size: 13px; font-weight: 700; color: var(--text); cursor: pointer; white-space: nowrap; }
.vb-btn:hover { border-color: var(--accent); color: var(--accent); }
.vb-btn-ghost:hover { border-color: #e5484d; color: #e5484d; }
.vb-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.vb-note { font-size: 12.5px; color: var(--muted); line-height: 1.5; margin: 6px 0 12px; }
.vb-note a { color: var(--accent); }
.vb-lead { font-size: 14px; line-height: 1.5; margin: 0 0 12px; }
.vb-divider { height: 1.5px; background: var(--border); margin: 6px 0 16px; }
.vb-mt { margin-top: 14px; }
.vb-upload { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 18px 12px; border: 2px dashed var(--border2); border-radius: 14px; background: var(--bg); color: var(--accent); cursor: pointer; font-size: 14px; font-weight: 800; text-align: center; }
.vb-upload small { font-size: 12px; font-weight: 500; color: var(--muted); line-height: 1.4; }
.vb-upload:hover { border-color: var(--accent); background: var(--act); }
.vb-search { display: flex; gap: 6px; margin-bottom: 8px; }
.vb-search input { flex: 1; min-width: 0; }
.vb-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.vb-chips button { padding: 6px 11px; border-radius: 999px; border: 1.5px solid var(--border); background: #fff; font-size: 12.5px; font-weight: 600; color: var(--text); cursor: pointer; }
.vb-chips button:hover { border-color: var(--accent); color: var(--accent); }
.vb-results { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.vb-results .vb-note { grid-column: 1 / -1; }
.vb-results button { padding: 0; border: 2px solid var(--border); border-radius: 9px; overflow: hidden; aspect-ratio: 16 / 9; cursor: pointer; background: #eee; }
.vb-results button:hover { border-color: var(--accent); }
.vb-results img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vb-privacy { margin: 0; padding: 12px 16px; text-align: center; font-size: 12.5px; color: var(--muted); background: var(--bg); border-top: 1.5px solid var(--border); }
@media (max-width: 575px) {
  .vb-root { border-radius: 14px; margin-inline: 8px; }
  .vb-stage-col, .vb-panel { padding: 10px; }
  .vb-tab { font-size: 12px; }
  .vb-tpl { width: 112px; } .vb-tpl canvas { width: 108px; height: 61px; }
  .vb-btn-main { width: 100%; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) { .vb-spin { animation-duration: 3s; } }

/* download in the top bar */
.vb-bar-right { display: flex; align-items: center; gap: 8px; }
.vb-bar .vb-seg { margin-bottom: 0; }
.vb-bar .vb-seg button { padding: 7px 11px; }
.vb-mirror { margin-top: 10px; display: flex; justify-content: center; }
@media (max-width: 575px) {
  .vb-bar { flex-direction: column; align-items: stretch; }
  .vb-bar-right { width: 100%; }
  .vb-bar-right .vb-btn-main { flex: 1; justify-content: center; width: auto; }
}
