:root { --bg: #0b0b0f; --panel: #121218; --panel-2: #181822; --line: rgba(255,255,255,.08); --ink: #f3f1f4; --muted: rgba(243,241,244,.6); --accent: #ff2d55; --gold: #e8c872; --radius: 12px; font-family: Inter, system-ui, sans-serif; }
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); height: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; }
[hidden] { display: none !important; }
.brand { font-family: "Cormorant Garamond", serif; font-size: 26px; font-weight: 500; }
.brand span { color: var(--gold); font-style: italic; }
.brand--sm { font-size: 20px; }
.btn { height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.04); cursor: pointer; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; transition: background .2s, border-color .2s; }
.btn:hover { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.18); }
.btn--primary { background: linear-gradient(100deg, #ff7a3d, var(--accent)); border-color: transparent; color: #fff; }
.btn--primary:hover { filter: brightness(1.08); }
.btn--sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn--danger:hover { border-color: var(--accent); color: var(--accent); }
.icon { width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: rgba(255,255,255,.04); cursor: pointer; display: grid; place-items: center; font-size: 16px; }
input[type=text], input:not([type]), input[type=url], textarea, select { width: 100%; background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: 13px; outline: none; }
input:focus, textarea:focus, select:focus { border-color: var(--gold); }
select option { background: #15151d; }
label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); margin-bottom: 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; align-items: end; }
.switch { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--ink); }
.switch input { width: auto; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.5; }

/* home */
.home { min-height: 100vh; padding: 0 clamp(16px, 4vw, 48px) 60px; }
.home__head { display: flex; justify-content: space-between; align-items: center; height: 72px; }
.home__ai { font-size: 12px; color: var(--muted); padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; }
.home__hero { max-width: 860px; margin: 40px auto 50px; text-align: center; }
.home__hero h1 { font-family: "Cormorant Garamond", serif; font-size: clamp(44px, 6vw, 76px); font-weight: 500; line-height: 1; }
.home__hero h1 em { color: var(--gold); }
.home__hero p { color: var(--muted); max-width: 620px; margin: 18px auto 28px; line-height: 1.6; }
.promptbox { background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 14px; text-align: left; }
.promptbox textarea { background: transparent; border: 0; resize: vertical; font-size: 15px; padding: 6px 4px; }
.promptbox__row { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chips button { height: 28px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.chips button:hover { color: var(--ink); border-color: var(--gold); }
.home__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; max-width: 1100px; margin: 0 auto; }
.home__grid h2 { font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-bottom: 14px; }
.sitelist { display: grid; gap: 8px; }
.sitecard { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); cursor: pointer; transition: border-color .2s; }
.sitecard:hover { border-color: rgba(232,200,114,.5); }
.sitecard strong { display: block; font-size: 15px; }
.sitecard span { font-size: 12px; color: var(--muted); }
.sitecard .btn--sm { flex: none; }
@media (max-width: 800px) { .home__grid { grid-template-columns: 1fr; } }

/* editor */
.editor { height: 100vh; display: flex; flex-direction: column; }
.topbar { height: 56px; display: flex; align-items: center; gap: 12px; padding: 0 14px; border-bottom: 1px solid var(--line); background: var(--panel); }
.sitename { width: 200px; background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; font-weight: 600; }
.sitename:hover, .sitename:focus { border-color: var(--line); }
.topbar__center { flex: 1; display: flex; justify-content: center; align-items: center; gap: 10px; }
.topbar__right { display: flex; gap: 8px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.seg button { height: 32px; padding: 0 14px; border: 0; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.seg button.is-on { background: rgba(255,255,255,.1); color: var(--ink); }
.status { font-size: 12px; color: var(--muted); min-width: 80px; }
.workspace { flex: 1; display: grid; grid-template-columns: 400px 1fr; min-height: 0; }
.side { border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; height: 42px; border: 0; background: transparent; color: var(--muted); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; cursor: pointer; border-bottom: 2px solid transparent; }
.tabs button.is-on { color: var(--ink); border-bottom-color: var(--gold); }
.tab { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.tab h3 { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 10px 0 4px; }
.stage { background: #050507; display: grid; place-items: center; padding: 16px; min-height: 0; overflow: auto; }
.device { width: 100%; height: 100%; max-width: var(--w, 100%); transition: max-width .4s cubic-bezier(.22,1,.36,1); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #000; box-shadow: 0 30px 80px -30px rgba(0,0,0,.8); }
.device iframe { width: 100%; height: 100%; border: 0; display: block; background: #000; }

/* chat */
.chat { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 10px; min-height: 160px; }
.msg { padding: 10px 12px; border-radius: 12px; font-size: 13px; line-height: 1.5; max-width: 92%; white-space: pre-wrap; }
.msg--user { align-self: flex-end; background: rgba(255,45,85,.15); border: 1px solid rgba(255,45,85,.3); }
.msg--ai { align-self: flex-start; background: var(--panel-2); border: 1px solid var(--line); }
.msg--sys { align-self: center; color: var(--muted); font-size: 12px; }
.chatbox textarea { resize: vertical; }
.chatbox__row { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; }

/* sections */
.sections { display: grid; gap: 6px; }
.secrow { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); cursor: pointer; font-size: 13px; }
.secrow.is-on { border-color: var(--gold); }
.secrow.is-off { opacity: .5; }
.secrow .type { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); min-width: 64px; }
.secrow .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.secrow .mini { width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 12px; color: var(--muted); }
.secrow .mini:hover { color: var(--ink); border-color: var(--ink); }
.addrow { display: flex; gap: 8px; }
.fields { border-top: 1px solid var(--line); padding-top: 12px; display: grid; gap: 8px; }
.fields h3 { margin-top: 6px; }
.items { display: grid; gap: 8px; }
.item { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: rgba(0,0,0,.2); display: grid; gap: 6px; }
.item__head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); }
.item__head b { color: var(--ink); }

/* theme */
.presets { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.preset { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--panel-2); font-size: 13px; }
.preset.is-on { border-color: var(--gold); }
.preset i { width: 28px; height: 28px; border-radius: 50%; flex: none; }
.colors { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.colors label { flex-direction: row; display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; }
.colors input[type=color] { width: 36px; height: 28px; border: 0; background: transparent; padding: 0; cursor: pointer; }

/* effect grids */
.effectgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.effect { text-align: left; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); cursor: pointer; }
.effect.is-on { border-color: var(--gold); }
.effect b { display: block; font-size: 13px; }
.effect span { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; line-height: 1.4; }

/* images */
.slots { display: grid; gap: 8px; }
.slot { display: grid; grid-template-columns: 72px 1fr; gap: 10px; padding: 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); }
.slot .thumb { width: 72px; height: 54px; border-radius: 6px; background: #000 center/cover; border: 1px solid var(--line); display: grid; place-items: center; font-size: 10px; color: var(--muted); }
.slot .meta { display: grid; gap: 6px; min-width: 0; }
.slot .meta b { font-size: 12px; }
.slot textarea { font-size: 11px; }
.slot .actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: grid; place-items: center; z-index: 50; padding: 20px; }
.modal__card { width: min(900px, 100%); height: min(80vh, 800px); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; overflow: hidden; }
.modal__card header { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal__card header div { display: flex; gap: 8px; }
.modal__card textarea { flex: 1; border: 0; border-radius: 0; font-family: ui-monospace, monospace; font-size: 12px; resize: none; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; background: #1c1c26; border: 1px solid rgba(232,200,114,.4); padding: 10px 16px; border-radius: 999px; font-size: 13px; transition: .3s; z-index: 60; pointer-events: none; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
@media (max-width: 1000px) { .workspace { grid-template-columns: 1fr; grid-template-rows: 45vh 1fr; } .side { border-right: 0; border-bottom: 1px solid var(--line); } .topbar__center .seg { display: none; } }

/* model picker */
.modelpick { display: flex; align-items: center; gap: 10px; }
.modelpick label { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 12px; }
.modelpick select, .modelmini { width: auto; min-width: 200px; height: 34px; padding: 0 10px; border-radius: 999px; font-size: 12px; }
.modelmini { min-width: 180px; height: 32px; }
.modelpick optgroup, .modelmini optgroup { font-style: normal; }

/* ---------- reference box ---------- */
.refbox { max-width: 860px; margin: -20px auto 44px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 18px; display: grid; gap: 12px; }
.refbox__head h2 { font-size: 15px; margin-bottom: 4px; }
.refbox__head p { color: var(--muted); font-size: 13px; line-height: 1.5; }
.refbox__row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.refbox__row input:not([type=checkbox]) { flex: 1; min-width: 220px; }
.drop { display: grid; place-items: center; min-height: 40px; padding: 8px 14px; border: 1px dashed var(--line); border-radius: 10px; color: var(--muted); font-size: 12px; cursor: pointer; margin: 0; }
.drop.is-over, .drop:hover { border-color: var(--gold); color: var(--ink); }
.drop.has-file { border-style: solid; border-color: rgba(125,220,106,.6); color: var(--ink); }
.btn--studio { border-color: rgba(232,200,114,.5); color: var(--gold); }

/* ---------- studio ---------- */
.studio { height: 100vh; display: flex; flex-direction: column; }
.studio__body { flex: 1; display: grid; grid-template-columns: 260px 1fr 300px; min-height: 0; }
.spanel { background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.spanel--left { border-right: 1px solid var(--line); }
.spanel--right { border-left: 1px solid var(--line); overflow: auto; }
.sitename--ro { display: inline-block; }
.zoomctl { display: flex; align-items: center; gap: 4px; }
.zoomctl .icon { width: 30px; height: 30px; font-size: 16px; }
.zoomval { height: 30px; min-width: 58px; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--ink); font-size: 12px; cursor: pointer; }
.scrub { display: flex; align-items: center; gap: 8px; margin: 0; font-size: 11px; color: var(--muted); }
.scrub input { width: 120px; }
.canvas { position: relative; overflow: hidden; background: #1a1a20; background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1px); background-size: 22px 22px; cursor: default; }
.canvas.is-pan { cursor: grab; }
.canvas.is-panning { cursor: grabbing; }
.world { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.frame { position: relative; background: #000; box-shadow: 0 30px 120px -20px rgba(0,0,0,.9), 0 0 0 1px rgba(255,255,255,.08); border-radius: 6px; overflow: hidden; }
.frame::before { content: attr(data-label); position: absolute; left: 0; top: -22px; font-size: 11px; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; }
.frame iframe { display: block; border: 0; width: 100%; height: 100%; background: #000; }
.canvas__hint { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); font-size: 11px; color: var(--muted); background: rgba(18,18,24,.85); border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; pointer-events: none; white-space: nowrap; }
.layers { display: grid; gap: 2px; }
.layer { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px; cursor: pointer; font-size: 13px; }
.layer:hover { background: rgba(255,255,255,.05); }
.layer.is-on { background: rgba(59,130,246,.18); }
.layer.is-off { opacity: .45; }
.layer .type { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); min-width: 58px; }
.layer .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.layer--child { padding-left: 28px; font-size: 12px; color: var(--muted); }
.layer--child.is-on { color: var(--ink); }
.layer .eye { width: 20px; height: 20px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 12px; }
.assetgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.asset { aspect-ratio: 4/3; border-radius: 8px; border: 1px solid var(--line); background: #000 center/cover; cursor: pointer; position: relative; overflow: hidden; }
.asset.is-on { border-color: #3b82f6; }
.asset span { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 6px; font-size: 10px; background: rgba(0,0,0,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.props { padding: 14px; display: grid; gap: 10px; align-content: start; }
.props h3 { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 6px 0 2px; }
.props .crumb { font-size: 12px; color: var(--muted); }
.props .crumb b { color: var(--ink); }
.props .thumb { width: 100%; aspect-ratio: 16/10; border-radius: 10px; background: #000 center/cover; border: 1px solid var(--line); }
.props .btnrow { display: flex; gap: 6px; flex-wrap: wrap; }
.props .swatches { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.props .swatches label { display: flex; align-items: center; justify-content: space-between; gap: 6px; border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font-size: 11px; margin: 0; }
.props .swatches input[type=color] { width: 26px; height: 22px; border: 0; background: transparent; padding: 0; cursor: pointer; }
.props .presetrow { display: flex; flex-wrap: wrap; gap: 6px; }
.props .presetrow button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; }
.props .presetrow button.is-on { border-color: #fff; }
@media (max-width: 1100px) { .studio__body { grid-template-columns: 220px 1fr 260px; } }

.sitecard__actions { display: flex; gap: 6px; flex: none; }
