/* 3D Render Studio — full-screen overlay, dark CreativeStar-style UI, green primary + pink highlights. */
#studio {
	--st-bg: #09090e;
	--st-panel: #121019;
	--st-panel2: #1a1822;
	--st-line: rgba(255, 255, 255, 0.07);
	--st-text: #ecebf3;
	--st-mut: #8d8a9d;
	--st-green: #3ddc63;
	--st-green-d: #2bbd4f;
	--st-ink: #06210f;
	--st-pink: #ff2d78;
	position: fixed;
	inset: 0;
	z-index: 60;
	display: grid;
	grid-template-rows: auto 1fr;
	background: var(--st-bg);
	color: var(--st-text);
	font-family: Inter, system-ui, sans-serif;
}
#studio[hidden] { display: none; }

/* top bar */
#studio .st-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 18px;
	border-bottom: 1px solid var(--st-line);
	background: linear-gradient(180deg, #14121c, #0e0d14);
}
#studio .st-brand { display: flex; align-items: center; gap: 10px; font-size: 17px; font-weight: 600; letter-spacing: .2px; }
#studio .st-brand b { color: var(--st-green); font-weight: 800; }
#studio .st-logo {
	width: 26px; height: 26px;
	background: url("assets/branch-logo-128.png") center/contain no-repeat;
	filter: drop-shadow(0 0 6px rgba(61, 220, 99, 0.5));
}
#studio .st-top-actions { display: flex; gap: 8px; }
#studio .st-top-actions button {
	border: 1px solid var(--st-line);
	background: var(--st-panel2);
	color: var(--st-text);
	border-radius: 11px;
	padding: 8px 14px;
	font: inherit; font-size: 13px; font-weight: 600;
	cursor: pointer;
}
#studio .st-top-actions button:hover { border-color: rgba(255, 255, 255, 0.18); background: #221f2c; }
#studio .st-close { color: var(--st-mut) !important; }

/* body: three columns */
#studio .st-body { display: grid; grid-template-columns: 290px 1fr 340px; min-height: 0; }
#studio aside { overflow: auto; padding: 14px; }
#studio .st-left { border-right: 1px solid var(--st-line); background: var(--st-panel); }
#studio .st-right { border-left: 1px solid var(--st-line); background: var(--st-panel); }

/* add row */
#studio .st-add { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 7px; margin-bottom: 14px; }
#studio .st-add button {
	display: flex; flex-direction: column; align-items: center; gap: 4px;
	border: 1px solid var(--st-line); background: var(--st-panel2); color: var(--st-text);
	border-radius: 12px; padding: 10px 4px; font: inherit; font-size: 11px; font-weight: 600; cursor: pointer;
}
#studio .st-add button i { font-style: normal; color: var(--st-pink); font-size: 15px; line-height: 1; }
#studio .st-add button:hover { border-color: rgba(255, 45, 120, 0.4); background: #221f2c; }

/* layers list */
#studio .st-layers { display: flex; flex-direction: column; gap: 3px; }
#studio .st-layer {
	display: flex; align-items: center; gap: 10px;
	padding: 9px 10px; border-radius: 10px; cursor: pointer; color: var(--st-text);
	border: 1px solid transparent;
}
#studio .st-layer:hover { background: var(--st-panel2); }
#studio .st-layer.on { background: linear-gradient(90deg, rgba(61, 220, 99, 0.18), rgba(61, 220, 99, 0.04)); border-color: rgba(61, 220, 99, 0.35); }
#studio .st-layer .st-ico { width: 22px; height: 22px; display: grid; place-items: center; color: var(--st-mut); flex: none; }
#studio .st-layer.on .st-ico { color: var(--st-green); }
#studio .st-layer .st-name { flex: 1; font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#studio .st-layer .st-act { opacity: 0; color: var(--st-mut); background: none; border: 0; cursor: pointer; font-size: 14px; padding: 2px; }
#studio .st-layer:hover .st-act { opacity: 1; }
#studio .st-layer .st-act:hover { color: var(--st-pink); }
#studio .st-sub { padding-left: 16px; }

/* viewport */
#studio .st-view { position: relative; display: flex; flex-direction: column; min-width: 0; }
#studio .st-canvas {
	flex: 1; margin: 14px; border-radius: 16px; min-height: 0; position: relative; overflow: hidden;
	background: radial-gradient(120% 90% at 50% 20%, #211d2b 0%, #0c0b11 70%);
	box-shadow: inset 0 0 0 1px var(--st-line);
}
#studio .st-canvas canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; display: block; }
#studio .st-tools {
	position: absolute; left: 26px; top: 50%; transform: translateY(-50%);
	display: flex; flex-direction: column; gap: 4px; padding: 6px;
	background: rgba(14, 13, 20, 0.8); border: 1px solid var(--st-line); border-radius: 14px; backdrop-filter: blur(6px);
}
#studio .st-tools button {
	width: 38px; height: 38px; border: 0; border-radius: 10px; background: transparent; color: var(--st-mut);
	font-size: 17px; cursor: pointer; display: grid; place-items: center;
}
#studio .st-tools button:hover { background: var(--st-panel2); color: var(--st-text); }
#studio .st-tools button.on { background: var(--st-pink); color: #fff; }
#studio .st-gizmo {
	position: absolute; right: 28px; top: 26px; width: 74px; height: 74px; border-radius: 50%;
	background: rgba(14, 13, 20, 0.7); border: 1px solid var(--st-line); pointer-events: none;
}
#studio .st-hint {
	position: absolute; left: 0; right: 0; bottom: 80px; text-align: center; color: var(--st-mut); font-size: 12px; pointer-events: none;
}
#studio .st-bottom { display: flex; align-items: center; gap: 10px; padding: 0 16px 6px; }
#studio .st-spacer { flex: 1; }
#studio .st-size { display: flex; align-items: center; gap: 8px; }
#studio .st-size label { color: var(--st-mut); font-size: 12px; }
#studio select, #studio input[type=text], #studio input[type=number] {
	background: var(--st-panel2); color: var(--st-text); border: 1px solid var(--st-line);
	border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 13px;
}
#studio .st-bottom button {
	border: 1px solid var(--st-line); background: var(--st-panel2); color: var(--st-text);
	border-radius: 11px; padding: 9px 16px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer;
}
#studio .primary {
	background: linear-gradient(180deg, var(--st-green), var(--st-green-d)) !important;
	color: var(--st-ink) !important; border-color: transparent !important;
	box-shadow: 0 6px 18px rgba(61, 220, 99, 0.25);
}
#studio .primary:hover { filter: brightness(1.06); }
#studio .st-bar { height: 3px; margin: 0 16px; border-radius: 3px; background: var(--st-panel2); overflow: hidden; }
#studio #st-progress { height: 100%; width: 0; background: var(--st-green); transition: width .12s; }
#studio #st-status { padding: 2px 16px 10px; color: var(--st-mut); font-size: 12px; min-height: 16px; }

/* right properties panel, fields built in JS */
#studio .st-sec { margin-bottom: 8px; border: 1px solid var(--st-line); border-radius: 14px; overflow: hidden; background: var(--st-panel2); }
#studio .st-sec > h3 {
	margin: 0; padding: 12px 14px; font-size: 13px; font-weight: 700; letter-spacing: .3px;
	display: flex; align-items: center; gap: 9px; cursor: pointer; user-select: none;
}
#studio .st-sec > h3 .st-tag { margin-left: auto; color: var(--st-mut); font-size: 11px; font-weight: 600; transition: transform .15s; }
#studio .st-sec.closed > h3 .st-tag { transform: rotate(-90deg); }
#studio .st-sec .st-sec-body { padding: 4px 14px 14px; display: flex; flex-direction: column; gap: 12px; }
#studio .st-sec.closed .st-sec-body { display: none; }
#studio .st-hdr { color: var(--st-mut); font-size: 11px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; margin: 6px 2px 0; }

#studio .st-field { display: flex; flex-direction: column; gap: 6px; }
#studio .st-field > label { font-size: 12px; color: var(--st-mut); display: flex; justify-content: space-between; align-items: center; }
#studio .st-field > label .st-val { color: var(--st-text); font-variant-numeric: tabular-nums; }
#studio .st-field input[type=range] { -webkit-appearance: none; appearance: none; height: 4px; border-radius: 3px; background: var(--st-panel); outline: none; }
#studio .st-field input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; border-radius: 50%; background: var(--st-green); cursor: pointer; border: 2px solid #0c0b11; }
#studio .st-field input[type=color] { width: 100%; height: 30px; border: 1px solid var(--st-line); border-radius: 9px; background: var(--st-panel); padding: 2px; cursor: pointer; }
#studio .st-field select, #studio .st-field input[type=text], #studio .st-field input[type=number] { width: 100%; }
#studio .st-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#studio .st-row { display: flex; gap: 8px; }
#studio .st-row > * { flex: 1; }
#studio .st-btn {
	border: 1px solid var(--st-line); background: var(--st-panel); color: var(--st-text);
	border-radius: 10px; padding: 9px 10px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; text-align: center;
}
#studio .st-btn:hover { border-color: rgba(255, 255, 255, 0.18); }
#studio .st-btn.load { background: linear-gradient(180deg, var(--st-green), var(--st-green-d)); color: var(--st-ink); border-color: transparent; flex: 0 0 84px; }

/* segmented control */
#studio .st-seg { display: flex; gap: 4px; background: var(--st-panel); border: 1px solid var(--st-line); border-radius: 11px; padding: 3px; }
#studio .st-seg button { flex: 1; border: 0; background: transparent; color: var(--st-mut); border-radius: 8px; padding: 7px 4px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
#studio .st-seg button.on { background: var(--st-pink); color: #fff; }

/* toggle */
#studio .st-toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; cursor: pointer; }
#studio .st-toggle span { font-size: 13px; font-weight: 600; }
#studio .st-switch { width: 40px; height: 23px; border-radius: 12px; background: var(--st-panel); border: 1px solid var(--st-line); position: relative; flex: none; transition: background .15s; }
#studio .st-switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px; border-radius: 50%; background: var(--st-mut); transition: transform .15s, background .15s; }
#studio .st-toggle.on .st-switch { background: rgba(61, 220, 99, 0.3); border-color: var(--st-green); }
#studio .st-toggle.on .st-switch::after { transform: translateX(17px); background: var(--st-green); }

/* responsive: stack on narrow screens */
@media (max-width: 920px) {
	#studio .st-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr auto; }
	#studio .st-left { border-right: 0; border-bottom: 1px solid var(--st-line); max-height: 130px; }
	#studio .st-right { border-left: 0; border-top: 1px solid var(--st-line); max-height: 44vh; }
	#studio .st-add { grid-template-columns: repeat(4, 1fr); }
}
