/* Coverforge: one dark theme (the editor's chrome stays neutral so the colours of the design read true). */
:root {
  --bg: #121314;
  --panel: #1a1b1d;
  --panel2: #212225;
  --line: #2c2d31;
  --line2: #3a3b40;
  --text: #ececed;
  --muted: #9a9ba1;
  --dim: #6c6d73;
  --accent: #ff7a1a;
  --accent2: #ffb46b;
  --onaccent: #1a0d02;
  --good: #36c46b;
  --bad: #ff5a52;
  --stage: #0c0d0e;
  --r: 10px;
  --top: 52px;
  --rail: 76px;
  --drawer: 320px;
  --insp: 312px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 "Anek Bangla", "Noto Sans Bengali", system-ui, -apple-system, "Segoe UI", sans-serif;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.hidden { display: none !important; }
.grow { flex: 1; }
.mono { font-family: ui-monospace, "JetBrains Mono", Consolas, monospace; font-size: 12px; }

/* ── top bar ─────────────────────────────────────────── */
.top {
  height: var(--top); display: flex; align-items: center; gap: 8px; padding: 0 10px;
  background: var(--panel); border-bottom: 1px solid var(--line); position: relative; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 700; font-size: 16px; margin-right: 4px; }
.logo { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: var(--onaccent); display: grid; place-items: center; }
.logo svg { width: 18px; height: 18px; stroke-width: 2.4; }
.projname {
  background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 5px 8px; width: 210px; min-width: 80px;
  color: var(--text); font-weight: 600;
}
.projname:hover { border-color: var(--line2); }
.projname:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.btngroup { display: flex; align-items: center; gap: 2px; background: var(--panel2); border-radius: 9px; padding: 2px; }
.iconbtn {
  width: 34px; height: 34px; border-radius: 8px; border: 0; background: transparent; color: var(--text);
  display: inline-grid; place-items: center; padding: 0;
}
.iconbtn:hover { background: var(--line); }
.iconbtn:disabled { opacity: .35; cursor: default; background: transparent; }
.iconbtn.on { background: var(--accent); color: var(--onaccent); }
.iconbtn.sm { width: 28px; height: 28px; }
.iconbtn.sm svg { width: 15px; height: 15px; }
.chip {
  height: 30px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line2); background: transparent; color: var(--text);
  white-space: nowrap; font-size: 13px;
}
.chip:hover { border-color: var(--muted); }
.btngroup .chip { border: 0; }
.btn {
  height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font-weight: 600; white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--onaccent); }
.btn.primary:hover { background: var(--accent2); border-color: var(--accent2); }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .45; cursor: default; }
#cloudBtn.signed { color: var(--good); }

/* ── layout ──────────────────────────────────────────── */
.main { display: grid; grid-template-columns: var(--rail) var(--drawer) 1fr var(--insp); height: calc(100% - var(--top)); }
.rail { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 6px 0; gap: 2px; overflow-y: auto; }
.rail button {
  border: 0; background: transparent; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 9px 2px; font-size: 11.5px; border-left: 3px solid transparent;
}
.rail button svg { width: 22px; height: 22px; stroke-width: 1.8; }
.rail button:hover { color: var(--text); }
.rail button.on { color: var(--text); border-left-color: var(--accent); background: var(--panel2); }
.drawer { background: var(--panel); border-right: 1px solid var(--line); overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.main.no-drawer { grid-template-columns: var(--rail) 0 1fr var(--insp); }
.main.no-drawer .drawer { border: 0; }
.drawer-in { overflow-y: auto; padding: 12px; flex: 1; }
.stage { position: relative; background: var(--stage); overflow: hidden; min-width: 0; }
.stage-in { position: absolute; inset: 0; overflow: auto; display: grid; place-items: center; padding: 32px; }
.artboard {
  position: relative; box-shadow: 0 0 0 1px rgba(255,255,255,.08), 0 18px 60px rgba(0,0,0,.55);
  background-color: #fff;
  background-image: linear-gradient(45deg, #d9d9d9 25%, transparent 25%), linear-gradient(-45deg, #d9d9d9 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #d9d9d9 75%), linear-gradient(-45deg, transparent 75%, #d9d9d9 75%);
  background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}
.artboard .canvas-container { display: block; }
.inspector { background: var(--panel); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-width: 0; overflow: hidden; }
.tabs { display: flex; border-bottom: 1px solid var(--line); flex: none; }
.tabs button { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 12px 8px 10px; font-weight: 600; border-bottom: 2px solid transparent; }
.tabs button.on { color: var(--text); border-bottom-color: var(--accent); }
.count { display: inline-block; min-width: 18px; padding: 0 5px; border-radius: 9px; background: var(--line); font-size: 11px; color: var(--text); }
.insp-body { flex: 1; overflow-y: auto; padding: 12px; }

.dropzone { position: absolute; inset: 12px; border: 2px dashed var(--accent); border-radius: 16px; background: rgba(255,122,26,.08); display: grid; place-items: center; font-size: 20px; font-weight: 700; color: var(--accent2); z-index: 5; pointer-events: none; }
.ctxbar {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); display: flex; gap: 2px; padding: 4px; background: var(--panel);
  border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.5); z-index: 6; max-width: calc(100% - 20px); overflow-x: auto;
}
.ctxbar .btn { height: 32px; padding: 0 10px; border: 0; background: transparent; font-weight: 500; font-size: 13px; }
.ctxbar .btn:hover { background: var(--line); }
.ctxbar .sep { width: 1px; background: var(--line2); margin: 4px 2px; }

/* ── panels ──────────────────────────────────────────── */
h3.ph { margin: 2px 0 10px; font-size: 15px; display: flex; align-items: center; gap: 8px; }
h4.sh { margin: 16px 0 8px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 6px; }
h4.sh:first-child { margin-top: 2px; }
.note { color: var(--muted); font-size: 12.5px; margin: 6px 0; }
.note b { color: var(--text); font-weight: 600; }
.search { width: 100%; height: 36px; border-radius: 9px; border: 1px solid var(--line2); background: var(--bg); padding: 0 12px; margin-bottom: 10px; }
.search:focus { outline: none; border-color: var(--accent); }
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.pill { border: 1px solid var(--line2); background: transparent; color: var(--muted); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; }
.pill.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.grid.g2 { grid-template-columns: repeat(2, 1fr); }
.grid.g4 { grid-template-columns: repeat(4, 1fr); }
.tile {
  border: 1px solid var(--line); background: var(--panel2); border-radius: 9px; aspect-ratio: 1; display: grid; place-items: center; padding: 8px;
  position: relative; overflow: hidden;
}
.tile:hover { border-color: var(--accent); }
.tile img { max-width: 100%; max-height: 100%; object-fit: contain; pointer-events: none; }
.tile.checker { background-color: #2a2b2f; background-image: linear-gradient(45deg, #323338 25%, transparent 25%), linear-gradient(-45deg, #323338 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #323338 75%), linear-gradient(-45deg, transparent 75%, #323338 75%); background-size: 14px 14px; background-position: 0 0, 0 7px, 7px -7px, -7px 0; }
.tile .x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 6px; border: 0; background: rgba(0,0,0,.65); color: #fff; display: none; place-items: center; padding: 0; }
.tile .x svg { width: 13px; height: 13px; }
.tile:hover .x { display: grid; }
.tile .cap { position: absolute; left: 0; right: 0; bottom: 0; font-size: 11px; padding: 2px 4px; background: rgba(0,0,0,.6); color: #ddd; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.wide { aspect-ratio: 16/9; padding: 0; }
.tile.wide img { width: 100%; height: 100%; object-fit: cover; }
.tstyle {
  border: 1px solid var(--line); background: #3b3d44; border-radius: 9px; height: 74px; display: grid; place-items: center; overflow: hidden; padding: 4px;
}
.tstyle:hover { border-color: var(--accent); }
.tstyle canvas { max-width: 100%; max-height: 100%; }
.combo { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; background: var(--panel2); padding: 0; display: block; width: 100%; }
.combo:hover { border-color: var(--accent); }
.combo canvas { display: block; width: 100%; height: auto; }
.combo .cap { display: block; text-align: left; font-size: 12px; padding: 5px 8px; color: var(--muted); }
.phrases { display: flex; flex-wrap: wrap; gap: 6px; }
.phrase { border: 1px solid var(--line2); background: var(--panel2); border-radius: 8px; padding: 4px 9px; font-size: 14px; font-weight: 600; }
.phrase:hover { border-color: var(--accent); }
.addtext { display: grid; gap: 8px; }
.addtext button { text-align: left; border: 1px solid var(--line2); background: var(--panel2); border-radius: 9px; padding: 10px 12px; }
.addtext button:hover { border-color: var(--accent); }
.channel-select { width: 100%; height: 36px; border-radius: 9px; border: 1px solid var(--line2); background: var(--bg); padding: 0 10px; margin-bottom: 10px; }
.drop-area { border: 1.5px dashed var(--line2); border-radius: 12px; padding: 18px 12px; text-align: center; color: var(--muted); margin-bottom: 12px; }
.drop-area .btn { margin-top: 8px; }
.list { display: grid; gap: 8px; }
.proj { display: grid; grid-template-columns: 96px 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--line); border-radius: 10px; padding: 6px; background: var(--panel2); }
.proj:hover { border-color: var(--line2); }
.proj img, .proj .ph-img { width: 96px; height: 54px; object-fit: cover; border-radius: 6px; background: #000; display: block; cursor: pointer; }
.proj .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.proj .s { font-size: 12px; color: var(--muted); }
.swatches { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.bgsw { aspect-ratio: 1; border-radius: 8px; border: 1px solid var(--line2); }
.bgsw:hover { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ── inspector controls ─────────────────────────────── */
.sec { border-bottom: 1px solid var(--line); padding: 2px 0 12px; margin-bottom: 10px; }
.sec:last-child { border-bottom: 0; }
.sec > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 6px 0; }
.sec > summary::-webkit-details-marker { display: none; }
.sec > summary::after { content: "▾"; margin-left: auto; font-size: 11px; transition: transform .15s; }
.sec:not([open]) > summary::after { transform: rotate(-90deg); }
.sec:not([open]) { padding-bottom: 2px; }
.row { display: flex; align-items: center; gap: 8px; margin: 7px 0; min-height: 30px; }
.row > label { width: 82px; flex: none; color: var(--muted); font-size: 12.5px; }
.row > .ctl { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; }
.row input[type=number], .row input[type=text], .row select {
  height: 30px; border-radius: 7px; border: 1px solid var(--line2); background: var(--bg); padding: 0 8px; min-width: 0; width: 100%;
}
.row input[type=number] { width: 64px; flex: none; padding: 0 4px 0 8px; }
.row select:focus, .row input:focus, textarea:focus { outline: none; border-color: var(--accent); }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.duo .row > label { width: 22px; }
input[type=range] { flex: 1; min-width: 0; accent-color: var(--accent); height: 22px; }
textarea.textedit {
  width: 100%; min-height: 84px; resize: vertical; border-radius: 9px; border: 1px solid var(--line2); background: var(--bg); padding: 8px 10px;
  font-size: 17px; line-height: 1.35; font-weight: 600;
}
.seg { display: flex; background: var(--bg); border: 1px solid var(--line2); border-radius: 8px; padding: 2px; gap: 2px; flex-wrap: wrap; }
.seg button { flex: 1; border: 0; background: transparent; color: var(--muted); border-radius: 6px; height: 26px; padding: 0 6px; font-size: 12.5px; display: grid; place-items: center; min-width: 28px; }
.seg button.on { background: var(--line2); color: var(--text); }
.seg button svg { width: 15px; height: 15px; }
.colorbtn { width: 30px; height: 30px; border-radius: 8px; border: 1px solid var(--line2); padding: 3px; background: var(--bg); flex: none; }
.colorbtn span { display: block; width: 100%; height: 100%; border-radius: 5px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.colorbtn span.none { background: linear-gradient(135deg, transparent 45%, var(--bad) 45%, var(--bad) 55%, transparent 55%) !important; }
.btnrow { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.btnrow .btn { flex: 1; min-width: 0; }
.aligns { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin: 6px 0 4px; }
.aligns .iconbtn { width: 100%; background: var(--panel2); }
.empty-insp { color: var(--muted); text-align: center; padding: 22px 8px; }
.toggle { position: relative; width: 36px; height: 20px; flex: none; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; border-radius: 99px; background: var(--line2); transition: .15s; cursor: pointer; }
.toggle span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: .15s; }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { left: 19px; }
.fontpick { width: 100%; height: 34px; border-radius: 8px; border: 1px solid var(--line2); background: var(--bg); text-align: left; padding: 0 10px; display: flex; align-items: center; justify-content: space-between; font-size: 15px; }

/* layers */
.layers { display: grid; gap: 4px; }
.layer {
  display: grid; grid-template-columns: 34px 1fr auto auto; align-items: center; gap: 8px; padding: 4px 4px 4px 6px; border-radius: 9px;
  border: 1px solid transparent; background: var(--panel2); cursor: pointer; user-select: none;
}
.layer:hover { border-color: var(--line2); }
.layer.sel { border-color: var(--accent); background: #2a2016; }
.layer.off { opacity: .5; }
.layer.drag-over { box-shadow: 0 -2px 0 var(--accent); }
.layer .thumb { width: 34px; height: 34px; border-radius: 6px; background: #3a3b40; display: grid; place-items: center; overflow: hidden; font-weight: 800; font-size: 13px; color: #fff; }
.layer .thumb img { width: 100%; height: 100%; object-fit: contain; }
.layer .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 13px; }
.layer .nm input { width: 100%; height: 26px; border-radius: 6px; border: 1px solid var(--accent); background: var(--bg); padding: 0 6px; }
.layer .iconbtn { width: 26px; height: 26px; color: var(--muted); }
.layer .iconbtn svg { width: 15px; height: 15px; }
.layer .iconbtn.lit { color: var(--accent2); }

/* popovers & modals */
.pop {
  position: fixed; z-index: 80; background: var(--panel); border: 1px solid var(--line2); border-radius: 12px; box-shadow: 0 16px 50px rgba(0,0,0,.6);
  padding: 10px; width: 248px; max-height: 70vh; overflow-y: auto;
}
.pop .swatches { grid-template-columns: repeat(8, 1fr); gap: 5px; }
.pop .sw { aspect-ratio: 1; border-radius: 6px; border: 1px solid rgba(255,255,255,.15); padding: 0; }
.pop .sw:hover { transform: scale(1.12); }
.pop .sw.none { background: linear-gradient(135deg, #fff 45%, var(--bad) 45%, var(--bad) 55%, #fff 55%); }
.pop .hexrow { display: flex; gap: 6px; margin-top: 8px; align-items: center; }
.pop .hexrow input[type=text] { flex: 1; height: 30px; border-radius: 7px; border: 1px solid var(--line2); background: var(--bg); padding: 0 8px; font-family: ui-monospace, Consolas, monospace; }
.pop input[type=color] { width: 34px; height: 30px; padding: 0; border: 1px solid var(--line2); border-radius: 7px; background: none; }
.pop .alpha { display: flex; gap: 8px; align-items: center; margin-top: 8px; font-size: 12px; color: var(--muted); }
.fontlist { display: grid; gap: 2px; }
.fontlist button { border: 0; background: transparent; text-align: left; padding: 7px 8px; border-radius: 7px; font-size: 17px; display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.fontlist button:hover, .fontlist button.on { background: var(--panel2); }
.fontlist button small { font: 11px system-ui, sans-serif; color: var(--muted); }

.modal-back { position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 60; display: grid; place-items: center; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; width: min(560px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.modal.big { width: min(1180px, 100%); height: calc(100vh - 32px); }
.modal-h { display: flex; align-items: center; gap: 10px; padding: 12px 14px 12px 18px; border-bottom: 1px solid var(--line); }
.modal-h h2 { margin: 0; font-size: 17px; flex: 1; }
.modal-b { padding: 16px 18px; overflow-y: auto; }
.modal-f { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--line); flex-wrap: wrap; }
.sizes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.size {
  border: 1px solid var(--line2); background: var(--panel2); border-radius: 10px; padding: 10px; text-align: left; display: flex; gap: 10px; align-items: center;
}
.size:hover, .size.on { border-color: var(--accent); }
.size .shape { width: 40px; height: 40px; display: grid; place-items: center; flex: none; }
.size .shape i { display: block; border: 2px solid var(--muted); border-radius: 3px; }
.size b { display: block; font-size: 13.5px; }
.size small { color: var(--muted); font-size: 12px; }
.field { display: grid; gap: 6px; margin: 12px 0; }
.field > span { color: var(--muted); font-size: 12.5px; }
.field input[type=text], .field input[type=password], .field input[type=number], .field select {
  height: 38px; border-radius: 9px; border: 1px solid var(--line2); background: var(--bg); padding: 0 12px; width: 100%;
}
.field input:focus { outline: none; border-color: var(--accent); }
.inline { display: flex; gap: 8px; align-items: center; }
.err { color: var(--bad); font-size: 13px; min-height: 18px; }

/* cutout studio */
.studio { display: grid; grid-template-columns: 1fr 290px; flex: 1; min-height: 0; }
.studio-view { position: relative; background: #0a0a0b; overflow: hidden; touch-action: none; min-height: 0; }
.studio-view canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.studio-side { border-left: 1px solid var(--line); padding: 14px; overflow-y: auto; }
.studio-side h4.sh { margin-top: 14px; }
.tools { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.tool { border: 1px solid var(--line2); background: var(--panel2); border-radius: 9px; padding: 7px 2px 5px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11.5px; color: var(--muted); }
.tool.on { border-color: var(--accent); color: var(--text); background: #2a2016; }
.tool svg { width: 20px; height: 20px; }
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.studio-hint { position: absolute; left: 12px; bottom: 12px; background: rgba(0,0,0,.7); border-radius: 8px; padding: 6px 10px; font-size: 12.5px; color: #ddd; pointer-events: none; }
.studio-zoom { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 4px; background: rgba(0,0,0,.7); border-radius: 10px; padding: 3px; }

.toasts { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; pointer-events: none; }
.toast { background: #2b2c30; border: 1px solid var(--line2); color: var(--text); padding: 9px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5); font-size: 14px; animation: tin .18s ease-out; max-width: 90vw; }
.toast.bad { border-color: var(--bad); }
.toast.good { border-color: var(--good); }
@keyframes tin { from { opacity: 0; transform: translateY(8px); } }
.spin { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.25); border-top-color: currentColor; border-radius: 50%; animation: sp .8s linear infinite; display: inline-block; }
@keyframes sp { to { transform: rotate(360deg); } }

.only-narrow { display: none; }

/* ── narrow screens (phones, small tablets) ────────── */
@media (max-width: 1180px) { :root { --drawer: 280px; --insp: 280px; } .projname { width: 150px; } }
@media (max-width: 900px) {
  :root { --top: 50px; }
  .only-narrow { display: inline-grid; }
  .hide-narrow { display: none !important; }
  .brand-name, #sizeBtn { display: none; }
  .projname { width: auto; flex: 1; min-width: 60px; }
  .top .grow { display: none; }
  .btn.primary span { display: none; }
  .btn.primary { padding: 0 10px; }
  .main { display: block; position: relative; }
  .main.no-drawer { display: block; }
  .rail {
    position: fixed; left: 0; right: 0; bottom: 0; height: 60px; flex-direction: row; border-right: 0; border-top: 1px solid var(--line);
    z-index: 40; padding: 0 2px env(safe-area-inset-bottom); overflow-x: auto; justify-content: space-around;
  }
  .rail button { border-left: 0; border-top: 2px solid transparent; padding: 6px 0; min-width: 0; flex: 1; font-size: 10px; }
  .rail { scrollbar-width: none; }
  .rail::-webkit-scrollbar { display: none; }
  .rail button.on { border-left-color: transparent; border-top-color: var(--accent); background: transparent; }
  .rail button svg { width: 20px; height: 20px; }
  .stage { position: absolute; inset: 0 0 60px 0; }
  .stage-in { padding: 14px; }
  .drawer, .inspector {
    position: fixed; left: 0; right: 0; bottom: 60px; height: min(58vh, 520px); z-index: 35; border: 0; border-top: 1px solid var(--line2);
    border-radius: 16px 16px 0 0; box-shadow: 0 -16px 40px rgba(0,0,0,.5); transform: translateY(0); transition: transform .2s;
  }
  .main.no-drawer .drawer, .inspector:not(.open) { transform: translateY(calc(100% + 70px)); }
  .ctxbar { bottom: 10px; }
  .studio { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .studio-side { border-left: 0; border-top: 1px solid var(--line); max-height: 44vh; }
  .modal.big { height: calc(100vh - 16px); }
  .modal-back { padding: 8px; }
  .sizes { grid-template-columns: 1fr; }
}
.rail .only-narrow-rail { display: none; }
@media (max-width: 900px) { .rail .only-narrow-rail { display: flex; } }
