/* Bố cục 3 cột của editor và khu vực preview (stage). */
/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: 320px 1fr 340px; min-height: 0; }
.panel { background: var(--panel); overflow-y: auto; padding: 14px; min-height: 0; }
.panel.left { border-right: 1px solid var(--line); padding: 0; }
.panel.right { border-left: 1px solid var(--line); }
.panel h3 { margin: 0 0 12px; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); }
.panel label, .panel .field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; color: var(--muted); font-size: 12.5px; }
.panel .seg { align-self: flex-start; }
.panel input[type=range] { width: 100%; accent-color: var(--brand); }
.panel input[type=color] { width: 100%; height: 34px; padding: 2px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.colors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.hint { color: var(--muted); font-size: 12px; margin: 10px 0 0; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 2; }
.tabs button { background: transparent; border: 0; padding: 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font-weight: 600; }
.tabs button.on { color: var(--text); border-bottom-color: var(--brand); }
.tabpane { padding: 14px; }

.tpl-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tpl { background: var(--panel-2); border: 2px solid transparent; border-radius: 10px; padding: 6px; cursor: pointer; text-align: center; color: var(--muted); font-size: 12px; }
.tpl canvas { width: 100%; height: auto; border-radius: 6px; display: block; margin-bottom: 6px; }
.tpl:hover { border-color: #3a4156; }
.tpl.on { border-color: var(--brand); color: var(--text); }

/* ---------- Stage ---------- */
.center { display: grid; grid-template-rows: minmax(0, 1fr) auto; min-width: 0; min-height: 0; }
.stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 20px;
  background: radial-gradient(circle at 50% 40%, #181b25, var(--bg)); }
.stage { container-type: size; }
.stage canvas { max-width: 100cqw; max-height: 100cqh; width: auto; height: auto; border-radius: 6px; box-shadow: 0 20px 60px rgba(0,0,0,.5); }
.stage.drag { outline: 2px dashed var(--brand); outline-offset: -10px; }
.drop-hint { position: absolute; inset: 0; display: none; place-items: center; background: rgba(14,16,21,.7); font-size: 18px; font-weight: 600; pointer-events: none; }
.stage.drag .drop-hint { display: grid; }

.film { display: flex; gap: 10px; padding: 12px 14px; overflow-x: auto; background: var(--panel); border-top: 1px solid var(--line); align-items: flex-start; }
.film { --thumb-h: 120px; }
.thumb { position: relative; flex: 0 0 auto; width: auto; border: 2px solid transparent; border-radius: 8px; cursor: pointer; background: var(--panel-2); padding: 3px; }
.thumb canvas { display: block; height: var(--thumb-h); width: auto; border-radius: 5px; } /* cao cố định, bề ngang theo tỉ lệ size */
.thumb.on { border-color: var(--brand); }
.thumb.over { border-color: #fff; }
.thumb .no { position: absolute; left: 6px; top: 6px; background: rgba(0,0,0,.6); color: #fff; font-size: 11px; border-radius: 4px; padding: 0 5px; }
.thumb .acts { position: absolute; right: 4px; top: 4px; display: none; gap: 3px; }
.thumb:hover .acts, .thumb:focus-within .acts { display: flex; }
.thumb .acts button { width: 22px; height: 22px; border: 0; border-radius: 5px; background: rgba(0,0,0,.7); color: #fff; cursor: pointer; font-size: 12px; line-height: 1; }
.thumb .acts button:hover { background: var(--brand); }
.add-tile { flex: 0 0 auto; width: 70px; min-height: 120px; align-self: stretch; display: grid; place-items: center; text-align: center; border: 2px dashed var(--line); border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; padding: 4px; }
.add-tile:hover { border-color: var(--brand); color: var(--text); }
.add-tile b { display: block; font-size: 22px; line-height: 1; }

.imgbox { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; }
.imgbox img { width: 56px; height: 100px; object-fit: cover; object-position: top; border-radius: 8px; border: 1px solid var(--line); }
.imgbtns { display: flex; flex-direction: column; gap: 8px; }
