body.studio { height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; background: #e9edf7; }
.st-bar { display: flex; align-items: center; gap: .4rem; padding: .45rem .7rem; background: var(--paper); border-bottom: 1px solid var(--rule); overflow-x: auto; flex: none; }
.st-bar .btn { flex: none; }
.st-sep { width: 1px; height: 22px; background: var(--rule); margin: 0 .2rem; flex: none; }
.st-zoom { min-width: 4.2rem; }
.st-name { flex: 1 1 140px; min-width: 110px; max-width: 280px; margin-left: auto; padding: .4rem .6rem; font-weight: 700; border-color: transparent; background: transparent; text-align: right; }
.st-name:hover { border-color: var(--rule-strong); }

.st-main { flex: 1; min-height: 0; display: grid; grid-template-columns: 76px minmax(0, 1fr) 320px; }
.st-rail { background: var(--paper); border-right: 1px solid var(--rule); display: flex; flex-direction: column; gap: .2rem; padding: .5rem .35rem; overflow-y: auto; }
.st-rail button { display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .55rem .2rem; border: 0; background: none; border-radius: 12px; color: var(--muted); cursor: pointer; font: inherit; }
.st-rail button i { font-style: normal; font-size: .7rem; font-weight: 600; }
.st-rail button .ic { width: 22px; height: 22px; }
.st-rail button:hover { background: var(--ink-soft); color: var(--ink); }
.st-rail button.on { background: var(--ink); color: #fff; }

.st-stage { position: relative; overflow: auto; display: grid; padding: 48px; touch-action: pan-x pan-y; }
.st-paper { position: relative; margin: auto; flex: none; box-shadow: 0 10px 40px -12px rgba(15, 30, 80, .35); background-color: #fff;
  background-image: linear-gradient(45deg, #dfe4f0 25%, transparent 25%, transparent 75%, #dfe4f0 75%), linear-gradient(45deg, #dfe4f0 25%, transparent 25%, transparent 75%, #dfe4f0 75%);
  background-size: 16px 16px; background-position: 0 0, 8px 8px; }
.st-paper canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#ov { max-width: none; touch-action: none; cursor: default; inset: auto; left: -44px; top: -44px; width: calc(100% + 88px); height: calc(100% + 88px); }
.st-hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: var(--text); color: #fff; padding: .45rem .9rem; border-radius: 99px; font-size: .85rem; pointer-events: none; }

.st-panel { background: var(--paper); border-left: 1px solid var(--rule); display: flex; flex-direction: column; min-height: 0; }
.st-tabs { display: flex; border-bottom: 1px solid var(--rule); flex: none; }
.st-tabs button { flex: 1; padding: .8rem .4rem; border: 0; background: none; font: inherit; font-weight: 700; font-size: .9rem; color: var(--muted); cursor: pointer; border-bottom: 3px solid transparent; }
.st-tabs button.on { color: var(--ink); border-bottom-color: var(--ink); }
.st-body { overflow-y: auto; padding: 1rem; flex: 1; }
.st-body h3 { font-size: .8rem; font-weight: 700; color: var(--muted); margin: 1.2rem 0 .55rem; letter-spacing: 0; }
.st-body h3:first-child { margin-top: 0; }
.st-body label { margin-bottom: .6rem; }
.st-body textarea { min-height: 5rem; resize: vertical; }
.st-empty { color: var(--muted); font-size: .95rem; }
.st-empty b { color: var(--text); display: block; margin-bottom: .3rem; }

.st-r { display: grid; grid-template-columns: 1fr auto; gap: .7rem; align-items: center; margin-bottom: .55rem; }
.st-r > span { font-size: .85rem; color: var(--muted); font-weight: 500; }
.st-r .v { font-variant-numeric: tabular-nums; min-width: 2.6rem; text-align: right; font-size: .85rem; color: var(--text); }
.st-slider { display: grid; grid-template-columns: 5.6rem 1fr 2.6rem; gap: .5rem; align-items: center; margin-bottom: .45rem; font-size: .85rem; color: var(--muted); font-weight: 500; }
.st-slider output { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; }
.st-grid { display: grid; gap: .4rem; }
.st-grid.c3 { grid-template-columns: repeat(3, 1fr); } .st-grid.c4 { grid-template-columns: repeat(4, 1fr); } .st-grid.c6 { grid-template-columns: repeat(6, 1fr); } .st-grid.c2 { grid-template-columns: 1fr 1fr; }
.st-btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .55rem .4rem; border: 1px solid var(--rule-strong); border-radius: 10px; background: var(--paper); font: inherit; font-size: .85rem; font-weight: 600; color: var(--text); cursor: pointer; }
.st-btn:hover { border-color: var(--ink); color: var(--ink); }
.st-btn.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.st-btn.danger { color: var(--danger); }
.st-btn:disabled { opacity: .4; cursor: not-allowed; }
.st-colors { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; }
.st-colors .sw { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--paper); box-shadow: 0 0 0 1px var(--rule-strong); cursor: pointer; padding: 0; }
.st-colors .sw.on { box-shadow: 0 0 0 2px var(--ink); }
.st-colors input[type=color] { width: 32px; height: 32px; padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; }
.st-colors .none { background: linear-gradient(135deg, #fff 45%, #d33 45%, #d33 55%, #fff 55%); }
.st-filters { display: grid; grid-template-columns: repeat(4, 1fr); gap: .45rem; }
.st-filters button { border: 2px solid transparent; background: none; padding: 0; cursor: pointer; border-radius: 10px; font: inherit; font-size: .72rem; font-weight: 600; color: var(--muted); }
.st-filters button canvas { width: 100%; aspect-ratio: 1; border-radius: 8px; display: block; margin-bottom: .2rem; background: #ddd; }
.st-filters button.on { border-color: var(--ink); color: var(--ink); }

.st-layer { display: grid; grid-template-columns: 24px 1fr auto; gap: .5rem; align-items: center; padding: .5rem .55rem; border: 1px solid var(--rule); border-radius: 10px; margin-bottom: .4rem; cursor: pointer; background: var(--paper); }
.st-layer.on { border-color: var(--ink); background: var(--ink-soft); }
.st-layer.off { opacity: .5; }
.st-layer .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; font-weight: 600; }
.st-layer .acts { display: flex; gap: .1rem; }
.st-layer .acts button { border: 0; background: none; padding: .25rem; border-radius: 6px; cursor: pointer; color: var(--muted); display: grid; }
.st-layer .acts button:hover { background: #fff; color: var(--ink); }

.st-modal-box { max-width: 760px; max-height: 88vh; overflow-y: auto; }
.st-modal-box.narrow { max-width: 430px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .9rem; margin-top: 1rem; }
.tpl { border: 1px solid var(--rule); border-radius: 14px; padding: .6rem; background: var(--bg); cursor: pointer; text-align: center; font: inherit; font-weight: 700; font-size: .85rem; color: var(--text); }
.tpl:hover { border-color: var(--ink); }
.tpl canvas { max-width: 100%; max-height: 170px; display: block; margin: 0 auto .5rem; border-radius: 6px; box-shadow: 0 4px 14px -6px rgba(15, 30, 80, .4); }
.tpl small { display: block; color: var(--muted); font-weight: 500; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(54px, 1fr)); gap: .4rem; margin-top: 1rem; }
.icon-grid button { aspect-ratio: 1; border: 1px solid var(--rule); border-radius: 12px; background: var(--paper); cursor: pointer; color: var(--ink); display: grid; place-items: center; }
.icon-grid button:hover { border-color: var(--ink); background: var(--ink-soft); }
.icon-grid .ic { width: 26px; height: 26px; }
.prj { display: grid; grid-template-columns: 74px 1fr auto; gap: .8rem; align-items: center; padding: .6rem; border: 1px solid var(--rule); border-radius: 12px; margin-top: .6rem; }
.prj img { width: 74px; height: 74px; object-fit: contain; background: var(--bg); border-radius: 8px; }
.prj b { display: block; }
.prj small { color: var(--muted); }

@media (max-width: 900px) {
  .st-main { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr) minmax(0, 42%); }
  .st-rail { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--rule); overflow-x: auto; overflow-y: hidden; padding: .3rem .4rem; }
  .st-rail button { flex: 1 0 64px; padding: .4rem .2rem; }
  .st-panel { border-left: 0; border-top: 1px solid var(--rule); }
  .st-stage { padding: 30px; }
  .st-bar .lbl { display: none; }
  .st-name { max-width: 120px; flex-basis: 90px; }
}

.tpl-cats { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: 1rem; position: sticky; top: -1.8rem; background: var(--paper); padding: .6rem 0; z-index: 2; }
.tpl-cats button { border: 1px solid var(--rule-strong); background: var(--paper); border-radius: 99px; padding: .4rem .9rem; font: inherit; font-size: .88rem; font-weight: 600; color: var(--text); cursor: pointer; }
.tpl-cats button:hover { border-color: var(--ink); color: var(--ink); }
.tpl-cats button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.tpl { min-height: 150px; }
.st-modal-box { max-width: 880px; }

/* Dégradés, préréglages, pinceau */
.st-gradbar { height: 26px; border-radius: 8px; border: 1px solid var(--line, #dbe3f5); margin: .2rem 0 .7rem; background-image: linear-gradient(45deg, #e5eaf7 25%, transparent 25%), linear-gradient(-45deg, #e5eaf7 25%, transparent 25%); background-size: 10px 10px; }
.st-small-h { display: grid; grid-template-columns: 34px 1fr 1fr 30px; gap: .4rem; font-size: .68rem; color: var(--muted, #64748b); margin: .5rem 0 .2rem; font-weight: 600; }
.st-stop { display: grid; grid-template-columns: 34px 1fr 1fr 30px; gap: .4rem; align-items: center; margin-bottom: .35rem; }
.st-stop input[type=color] { width: 34px; height: 30px; padding: 0; border: 1px solid var(--line, #dbe3f5); border-radius: 8px; background: none; }
.st-stop input[type=range] { width: 100%; min-width: 0; }
.st-stop .st-btn { padding: .25rem; min-height: 30px; }
.st-presets { display: grid; grid-template-columns: repeat(8, 1fr); gap: .35rem; margin-top: .4rem; }
.st-presets button { aspect-ratio: 1; border-radius: 8px; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line, #dbe3f5); cursor: pointer; }
.st-presets button:hover { box-shadow: 0 0 0 2px var(--ink, #1a56ff); }
