.editor-page { overflow-x: hidden; }
.studio {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 22px; align-items: start;
  padding: 20px clamp(16px, 3vw, 32px) 40px; max-width: 1500px; margin: 0 auto;
}
@media (max-width: 980px) { .studio { grid-template-columns: 1fr; } }

/* ---------- stage / preview ---------- */
.stage { position: sticky; top: 84px; min-width: 0; }
@media (max-width: 980px) { .stage { position: static; } }
.stage-hint { color: var(--dim); font-size: 13px; font-weight: 600; margin: 0 0 12px 4px; }
.tilt { position: relative; transform-style: preserve-3d; will-change: transform; border-radius: 22px; }
.tilt .shine {
  position: absolute; inset: 0; border-radius: 20px; pointer-events: none; z-index: 5; mix-blend-mode: soft-light;
  background: radial-gradient(500px circle at var(--shine-x, 50%) var(--shine-y, 50%), rgba(255, 255, 255, .22), transparent 55%);
}
#preview .tl { box-shadow: 0 40px 80px -30px rgba(0, 0, 0, .8), 0 0 0 1px rgba(196, 170, 255, .18), 0 0 60px -10px rgba(168, 85, 247, .35); }
#preview .tl-title { outline: none; border-radius: 8px; padding: 2px 6px; margin-left: -6px; cursor: text; }
#preview .tl-title:hover, #preview .tl-title:focus { background: rgba(255, 255, 255, .08); }
#preview .tl-label { cursor: text; position: relative; outline: none; }
#preview .tl-label:focus { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .8); }
#preview .tl-note { outline: none; cursor: text; }
#preview .tl-note:focus { background: rgba(255, 255, 255, .08); border-radius: 6px; }
#preview .tl-note:empty::before { content: 'Type text over this tier…'; opacity: .5; }
#preview .tl-row { position: relative; transition: box-shadow .15s, background .15s; }
#preview .tl-row.over { box-shadow: inset 0 0 0 2px var(--lime), 0 0 24px -6px rgba(184, 255, 60, .6); }
#preview .add-note {
  position: absolute; right: 8px; top: 6px; opacity: 0; transition: opacity .15s; z-index: 2;
  font-size: 11px; font-weight: 800; padding: 4px 9px; border-radius: 999px; border: 0; cursor: pointer;
  background: rgba(10, 4, 30, .7); color: #fff;
}
#preview .tl-row:hover .add-note { opacity: 1; }
#preview .tl-items:empty::after { content: ''; }

.item { cursor: grab; transition: transform .18s cubic-bezier(.2, .9, .3, 1.3), box-shadow .18s, opacity .18s; }
.item:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 10px 20px -6px rgba(0, 0, 0, .7), 0 0 0 2px rgba(255, 255, 255, .5); z-index: 2; }
.item.placeholder { opacity: .25; transform: scale(.9); box-shadow: 0 0 0 2px dashed var(--lime); outline: 2px dashed var(--lime); outline-offset: -2px; }
.item.pop { animation: pop .35s cubic-bezier(.2, .9, .3, 1.4); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.ghost {
  position: fixed; z-index: 400; pointer-events: none; margin: 0; cursor: grabbing;
  transform: rotate(-6deg) scale(1.15); box-shadow: 0 24px 40px -10px rgba(0, 0, 0, .8), 0 0 0 3px var(--lime) !important;
  transition: none;
}
body.dragging, body.dragging * { cursor: grabbing !important; user-select: none; }

.bin {
  position: fixed; left: 50%; bottom: 22px; z-index: 350; transform: translate(-50%, calc(100% + 60px));
  padding: 14px 26px; border-radius: 999px; font-weight: 800; background: rgba(60, 10, 30, .9); border: 2px dashed var(--danger); color: #ffd0d6;
  transition: transform .25s cubic-bezier(.2, .9, .3, 1.3), background .15s;
}
body.dragging .bin { transform: translate(-50%, 0); }
.bin.over { background: var(--danger); color: #fff; }

/* ---------- panel ---------- */
.panel { position: sticky; top: 84px; display: flex; flex-direction: column; max-height: calc(100vh - 100px); overflow: hidden; }
@media (max-width: 980px) { .panel { position: static; max-height: none; } }
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; padding: 8px; border-bottom: 1px solid var(--line); }
.tab { border: 0; background: transparent; padding: 10px 4px; border-radius: 12px; font-weight: 800; font-size: 13px; color: var(--muted); cursor: pointer; transition: background .2s, color .2s; }
.tab:hover { color: var(--text); background: var(--card); }
.tab.on { color: #160b33; background: var(--lime); }
.tabpane { display: none; padding: 16px; overflow-y: auto; flex: 1; min-height: 0; }
.tabpane.on { display: block; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 20px 14px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line-hi); border-radius: 16px; background: rgba(168, 85, 247, .06); transition: border-color .2s, background .2s, transform .2s;
}
.drop:hover, .drop.hot { border-color: var(--magenta); background: rgba(255, 79, 216, .1); }
.drop.hot { transform: scale(1.02); }
.drop-ico { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: linear-gradient(135deg, #a855f7, #ff4fd8); font-weight: 900; margin-bottom: 4px; }
.drop b { font-family: var(--font-display); font-size: 15px; }
.drop small { color: var(--muted); }

.text-add { display: flex; gap: 6px; margin-top: 12px; }
.text-add input:not([type=color]) { flex: 1; min-width: 0; }
input:not([type=color]):not([type=checkbox]):not([type=range]), select {
  background: rgba(10, 4, 30, .55); border: 1px solid var(--line-hi); border-radius: 12px; padding: 9px 12px; font-size: 14px; outline: none; transition: border-color .2s, box-shadow .2s;
}
input:focus { border-color: var(--violet); box-shadow: 0 0 0 3px rgba(168, 85, 247, .25); }
input[type=color] { width: 40px; height: 38px; padding: 3px; border-radius: 12px; border: 1px solid var(--line-hi); background: rgba(10, 4, 30, .55); cursor: pointer; flex: none; }
input[type=range] { width: 100%; accent-color: var(--magenta); }

.tray-head { display: flex; justify-content: space-between; align-items: center; margin: 16px 2px 8px; font-weight: 800; font-size: 13px; color: var(--muted); }
.tray-head em { font-style: normal; color: var(--lime); margin-left: 4px; }
.link-btn { background: none; border: 0; color: var(--dim); font-weight: 700; font-size: 12px; cursor: pointer; }
.link-btn:hover { color: var(--danger); }
.tray {
  min-height: 120px; border-radius: 14px; background: rgba(10, 4, 30, .45); border: 1px solid var(--line); padding: 8px; gap: 6px;
  transition: box-shadow .15s;
}
.tray.over { box-shadow: inset 0 0 0 2px var(--lime); }
.tray:empty::before { content: 'Uploaded items land here'; color: var(--dim); font-size: 13px; margin: auto; padding: 36px 0; width: 100%; text-align: center; }
.tip { color: var(--dim); font-size: 12.5px; line-height: 1.5; margin: 10px 2px 0; }

.tier-editor { display: flex; flex-direction: column; gap: 8px; }
.tier-row { display: grid; grid-template-columns: 26px 64px 40px 1fr 26px; gap: 6px; align-items: center; padding: 8px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.tier-row input.lbl { text-align: center; font-weight: 900; padding: 8px 4px; }
.tier-row input.note { font-size: 13px; }
.mv { display: flex; flex-direction: column; gap: 2px; }
.mini { width: 26px; height: 20px; padding: 0; border: 0; border-radius: 6px; background: rgba(255, 255, 255, .07); color: var(--muted); cursor: pointer; font-size: 10px; }
.mini:hover { background: rgba(255, 255, 255, .16); color: #fff; }
.mini.del { height: 30px; font-size: 14px; }
.mini.del:hover { background: var(--danger); }
.row-btns { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.field em { font-style: normal; color: var(--lime); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; border-radius: 14px; background: rgba(10, 4, 30, .5); border: 1px solid var(--line); }
.seg button { border: 0; background: transparent; border-radius: 10px; padding: 9px 4px; font-weight: 800; font-size: 13px; color: var(--muted); cursor: pointer; }
.seg button.on { background: linear-gradient(135deg, #a855f7, #ff4fd8); color: #fff; }
.custom-opts { display: none; padding-top: 4px; }
.custom-opts.on { display: block; }
.bg-row { display: flex; gap: 8px; }

.preset-box { padding: 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); margin-bottom: 12px; }
.preset-box h3 { margin: 0 0 4px; font-family: var(--font-display); font-size: 15px; }
.preset-box .tip { margin-top: 0; margin-bottom: 12px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin-bottom: 12px; color: var(--muted); }
.check input { accent-color: var(--lime); width: 16px; height: 16px; }
.code-out { margin-top: 12px; padding: 12px; border-radius: 12px; background: rgba(184, 255, 60, .08); border: 1px solid rgba(184, 255, 60, .35); display: flex; align-items: center; gap: 10px; justify-content: space-between; }
.code-out b { font-family: var(--font-display); font-size: 20px; color: var(--lime); letter-spacing: .06em; }
.my-presets { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.my-presets button { display: flex; justify-content: space-between; gap: 8px; text-align: left; width: 100%; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--line); background: rgba(10, 4, 30, .4); cursor: pointer; font-size: 13px; }
.my-presets button:hover { border-color: var(--line-hi); background: rgba(255, 255, 255, .06); }
.my-presets code { color: var(--lime); font-weight: 800; }

.panel-foot { padding: 12px 16px 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.panel-foot .ad-slot { margin: 0 auto; }
.panel-foot .ad-slot.is-placeholder { min-height: 60px; width: 100%; }
@media (max-height: 820px) { .panel-foot .ad-slot.is-placeholder { display: none; } }
.gen-btn { width: 100%; padding: 16px; font-family: var(--font-display); font-size: 18px; letter-spacing: .06em; border-radius: 16px; position: relative; overflow: hidden; }
.gen-btn::after { content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%); transform: translateX(-100%); animation: sweep 3.2s ease-in-out infinite; }
@keyframes sweep { 60%, 100% { transform: translateX(100%); } }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 500; display: grid; place-items: center; padding: 16px; background: rgba(6, 2, 18, .72); backdrop-filter: blur(8px); animation: fadeIn .2s; }
.modal[hidden] { display: none; }
.modal-card { position: relative; width: min(720px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 28px; text-align: center; background: rgba(26, 13, 58, .96); }
.modal-x { position: absolute; top: 14px; right: 14px; }
.modal h2 { font-family: var(--font-display); font-weight: 900; font-size: clamp(22px, 3.5vw, 30px); margin: 6px 0 16px; }
.gen-loading { padding: 40px 0 30px; }
.stack { display: flex; flex-direction: column; gap: 6px; width: 200px; margin: 0 auto 24px; }
.stack i { height: 20px; border-radius: 6px; background: var(--c); box-shadow: 0 0 20px -2px var(--c); animation: dropin 1.2s cubic-bezier(.3, 1.4, .5, 1) infinite; }
.stack i:nth-child(2) { animation-delay: .1s; width: 85%; } .stack i:nth-child(3) { animation-delay: .2s; width: 70%; }
.stack i:nth-child(4) { animation-delay: .3s; width: 55%; } .stack i:nth-child(5) { animation-delay: .4s; width: 40%; }
@keyframes dropin { 0% { transform: translateY(-40px); opacity: 0; } 30%, 80% { transform: none; opacity: 1; } 100% { opacity: 0; } }
#genImg { width: 100%; border-radius: 14px; margin: 0 auto 18px; box-shadow: 0 20px 50px -20px rgba(0, 0, 0, .8); animation: pop .5s cubic-bezier(.2, .9, .3, 1.3); }
.gen-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.share-url { width: 100%; margin-top: 12px; text-align: center; font-size: 13px !important; color: var(--muted); }
.local-note { font-size: 12.5px; color: var(--gold); margin: 10px 0 0; }
.thanks { margin: 18px 0 6px; font-size: 16px; color: #e6dcff; }
.gen-more { display: flex; gap: 8px; justify-content: center; margin-top: 12px; }

/* ---------- visibility step ---------- */
.gen-choose { padding: 8px 0 4px; }
.vis-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 6px 0 18px; }
@media (max-width: 560px) { .vis-grid { grid-template-columns: 1fr; } }
.vis-opt { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 20px 16px; border-radius: 18px; cursor: pointer; text-align: center;
  background: rgba(10, 4, 30, .5); border: 2px solid var(--line); transition: border-color .2s, transform .2s, background .2s, box-shadow .2s; }
.vis-opt:hover { transform: translateY(-2px); border-color: var(--line-hi); }
.vis-opt.on { border-color: var(--lime); background: rgba(184, 255, 60, .08); box-shadow: 0 10px 30px -12px rgba(184, 255, 60, .5); }
.vis-ico { font-size: 30px; }
.vis-opt b { font-family: var(--font-display); font-size: 17px; }
.vis-opt small { color: var(--muted); line-height: 1.45; font-size: 13px; }
.vis-author { max-width: 360px; margin: 0 auto 16px; text-align: left; }
.gen-go { min-width: 220px; padding: 14px 22px; font-size: 16px; font-family: var(--font-display); }
.public-note { margin: 14px 0 0; color: var(--lime); font-weight: 700; }
.public-note a { color: inherit; }
#preview .tl-by { font-size: 13px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.vis-opt { position: relative; }
.vis-opt::after { content: '✓'; position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
  font-size: 13px; font-weight: 900; color: #160b33; background: var(--lime); transform: scale(0); transition: transform .25s cubic-bezier(.2, .9, .3, 1.6); }
.vis-opt.on::after { transform: scale(1); }
.vis-opt.on .vis-ico { animation: pop .4s cubic-bezier(.2, .9, .3, 1.6); }
