/* ============================================================
   BAOJI Builder — chrome only (preview content uses base.css)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@400;500;600;700;800&display=swap');

:root {
  --bg: #0d0d0f;
  --panel: #15151a;
  --panel-2: #1d1d24;
  --edge: #2a2a33;
  --txt: #e9e9ee;
  --txt-dim: #9a9aa6;
  --txt-faint: #6b6b78;
  --brand: #ff3b30;
  --accent: #4f8cff;
  --rad: 10px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: 'Archivo', system-ui, sans-serif;
  background: var(--bg); color: var(--txt);
  display: grid; grid-template-columns: 340px 1fr; height: 100vh; overflow: hidden;
}
/* panel on the right */
body.side-right { grid-template-columns: 1fr 340px; }
body.side-right .side { order: 2; border-right: none; border-left: 1px solid var(--edge); }
body.side-right .main { order: 1; }
button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #303039; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---- Sidebar ---- */
.side { background: var(--panel); border-right: 1px solid var(--edge); display: flex; flex-direction: column; min-height: 0; }
.side__head { padding: 20px 22px 16px; border-bottom: 1px solid var(--edge); }
.side__brand { display: flex; align-items: center; gap: 10px; }
.side__brand b { font-size: 16px; font-weight: 800; letter-spacing: -0.02em; }
.side__brand span { font-size: 10px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--brand); border: 1px solid var(--brand); padding: 2px 7px; border-radius: 20px; }
.side__sub { margin-top: 6px; font-size: 12px; color: var(--txt-faint); }

.slots { flex: 1; overflow-y: auto; padding: 12px 14px 20px; }
.slot { background: var(--panel-2); border: 1px solid var(--edge); border-radius: var(--rad); margin-bottom: 10px; overflow: hidden; transition: border-color .25s var(--ease); }
.slot.is-off { opacity: .5; }
.slot.dragging { opacity: .55; outline: 1px dashed var(--accent); }
.slot__top { display: flex; align-items: center; gap: 9px; padding: 12px 14px; cursor: grab; user-select: none; }
.slot__top:active { cursor: grabbing; }
.slot__grip { width: 16px; height: 16px; color: var(--txt-faint); flex-shrink: 0; }
.slot__top:hover .slot__grip { color: var(--txt-dim); }
.slot__num { font-size: 11px; font-weight: 700; color: var(--txt-faint); }
.slot__name { font-size: 13px; font-weight: 700; flex: 1; letter-spacing: -0.01em; }
.slot__count { font-size: 10px; font-weight: 600; color: var(--txt-faint); background: #25252e; padding: 3px 7px; border-radius: 20px; white-space: nowrap; }
.slot__toggle { width: 34px; height: 19px; border-radius: 20px; background: #34343f; position: relative; transition: background .25s var(--ease); flex-shrink: 0; }
.slot__toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); }
.slot__toggle.is-on { background: var(--accent); }
.slot__toggle.is-on::after { transform: translateX(15px); }
.slot__variants { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 14px; }
.vbtn {
  font-size: 12px; font-weight: 500; color: var(--txt-dim);
  padding: 8px 12px; border-radius: 7px; background: #25252e; border: 1px solid transparent;
  transition: all .2s var(--ease); line-height: 1.2;
}
.vbtn:hover { color: var(--txt); background: #2d2d38; }
.vbtn.is-active { color: #fff; background: var(--accent); border-color: var(--accent); }

/* ---- Select picker + next/back ---- */
.slot__nav { display: flex; align-items: center; gap: 8px; padding: 0 14px 14px; }
.navbtn { width: 32px; height: 36px; flex-shrink: 0; border-radius: 7px; background: #25252e; color: var(--txt-dim); display: grid; place-items: center; font-size: 11px; transition: all .2s var(--ease); }
.navbtn:hover:not(:disabled) { background: var(--accent); color: #fff; }
.navbtn:disabled { opacity: .3; cursor: not-allowed; }
.slot__select { flex: 1; min-width: 0; height: 36px; padding: 4px 8px; font: inherit; font-size: 13px; cursor: pointer; }

/* ---- Main ---- */
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: #0a0a0c; }
.bar { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--edge); background: var(--panel); }
.bar__title { font-size: 13px; font-weight: 600; color: var(--txt-dim); margin-right: auto; }
.seg { display: flex; background: var(--panel-2); border: 1px solid var(--edge); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { font-size: 12px; font-weight: 600; color: var(--txt-dim); padding: 7px 14px; border-radius: 6px; transition: all .2s var(--ease); }
.seg button.is-active { background: var(--accent); color: #fff; }
.act { display: flex; gap: 8px; }
.act button { font-size: 13px; font-weight: 600; padding: 9px 16px; border-radius: 8px; transition: all .2s var(--ease); display: inline-flex; align-items: center; gap: 7px; }
.act svg { width: 15px; height: 15px; }
.btn-ghost { color: var(--txt-dim); border: 1px solid var(--edge); }
.btn-ghost:hover { color: var(--txt); border-color: #3a3a45; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { filter: brightness(1.08); }

.stage { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: start center; padding: 22px; background:
  radial-gradient(circle at 1px 1px, #18181d 1px, transparent 0) 0 0 / 22px 22px; }
.frame-wrap { width: 100%; max-width: 100%; transition: max-width .35s var(--ease); }
.frame-wrap.mobile { max-width: 414px; }
.frame {
  width: 100%; height: calc(100vh - 110px); border: 0; border-radius: 8px; background: #fff;
  box-shadow: 0 18px 50px rgba(0,0,0,.5); display: block;
}
.frame-wrap.mobile .frame { height: calc(100vh - 110px); }

/* toast */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px); background: #fff; color: #111; font-size: 13px; font-weight: 600; padding: 12px 20px; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.4); opacity: 0; pointer-events: none; transition: opacity .3s var(--ease), transform .3s var(--ease); z-index: 50; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 860px) {
  body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .side { max-height: 42vh; }
}
