/* ==========================================================================
   TurabFB Maker — Grok.com aesthetic + Canva tool flow
   Clean dark UI · fixed icon sizes · one-page studio
   ========================================================================== */

:root,
[data-theme="dark"] {
	/* Pure Grok chrome — black / white / gray only (no green UI) */
	--bg: #000000;
	--bg-2: #0a0a0a;
	--bg-3: #141414;
	--bg-4: #1a1a1a;
	--border: rgba(255, 255, 255, 0.09);
	--border-2: rgba(255, 255, 255, 0.14);
	--text: #f5f5f5;
	--muted: #a1a1a1;
	--faint: #6b6b6b;
	--accent: #ffffff;
	--brand: #ffffff;
	--brand-2: #e5e5e5;
	--danger: #ff6b6b;
	--ok: #a3a3a3;
	--warn: #d4d4d4;
	--radius: 12px;
	--radius-sm: 8px;
	--font: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
	--nav-h: 52px;
	--dock-h: 58px;
	--sheet-h: min(46vh, 420px);

	/* post canvas — full photo + black GRADIENT only (no solid bar) */
	--canvas-w: 1080px;
	--canvas-h: 1350px;
	--hl: #e9ff2e;
	--hl-text: #000;
	--text-post: #fff;
	--icon-c: #d0d0d0;
	--icon-op: 0.75;
	--icon-sz: 34px;
	--icon-gap: 56px;
	--logo-w: 120px;
	--logo-t: 35px;
	--logo-l: 35px;
	--logo-op: 1;
	--logo-display: block;
	--pad-t: 16px;
	--pad-r: 40px;
	--pad-b: 40px;
	--pad-l: 40px;
	--font-post: "Montserrat", sans-serif;
	--font-w: 800;
	--font-sz: 58px;
	--img-scale: 1;
	--pan-x: 0px;
	--pan-y: 0px;
	--ov: 0.82;
	--ov-start: 42%;
	--text-zone-h: 32%;
	color-scheme: dark;
}

[data-theme="light"] {
	--bg: #f5f5f5;
	--bg-2: #ffffff;
	--bg-3: #f0f0f0;
	--bg-4: #e8e8e8;
	--border: rgba(0, 0, 0, 0.08);
	--border-2: rgba(0, 0, 0, 0.12);
	--text: #0a0a0a;
	--muted: #525252;
	--faint: #8a8a8a;
	--accent: #111111;
	--brand: #111111;
	--brand-2: #333333;
	--ok: #525252;
	--warn: #737373;
	color-scheme: light;
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
	font-family: var(--font);
	font-size: 14px;
	line-height: 1.4;
	background: var(--bg);
	color: var(--text);
	overflow: hidden;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}
button, input, select, textarea {
	font: inherit;
	color: inherit;
	appearance: none;
	-webkit-appearance: none;
}
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }

/* ========== ICONS — hard size lock (fixes giant/scattered icons) ========== */
svg.ico,
.ico {
	width: 18px !important;
	height: 18px !important;
	min-width: 18px !important;
	min-height: 18px !important;
	max-width: 18px !important;
	max-height: 18px !important;
	flex: 0 0 18px !important;
	display: block !important;
	overflow: visible;
	stroke: currentColor;
	fill: none;
	color: inherit;
	pointer-events: none;
}
svg.ico.ico--sm,
.ico--sm {
	width: 16px !important;
	height: 16px !important;
	min-width: 16px !important;
	min-height: 16px !important;
	max-width: 16px !important;
	max-height: 16px !important;
	flex-basis: 16px !important;
}
svg.ico.ico--lg,
.ico--lg {
	width: 22px !important;
	height: 22px !important;
	min-width: 22px !important;
	min-height: 22px !important;
	max-width: 22px !important;
	max-height: 22px !important;
	flex-basis: 22px !important;
	opacity: 0.85;
}
svg.ico use,
.ico use {
	pointer-events: none;
}

/* App shell */
.app {
	display: flex;
	flex-direction: column;
	height: 100dvh;
	height: 100svh;
	max-height: 100dvh;
	background: var(--bg);
}

/* ---------- Top nav (Grok-like minimal) ---------- */
.nav {
	height: var(--nav-h);
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 0 14px;
	padding-top: env(safe-area-inset-top);
	border-bottom: 1px solid var(--border);
	background: rgba(0, 0, 0, 0.72);
	backdrop-filter: blur(16px);
	-webkit-backdrop-filter: blur(16px);
	z-index: 60;
}
[data-theme="light"] .nav { background: rgba(255, 255, 255, 0.85); }

.brand {
	display: flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
}
.brand img {
	width: 24px;
	height: 24px;
	border-radius: 6px;
	flex-shrink: 0;
}
.brand__name {
	font-size: 14px;
	font-weight: 600;
	letter-spacing: -0.02em;
	color: var(--text);
}

.nav__right {
	display: flex;
	align-items: center;
	gap: 6px;
	flex-shrink: 0;
}

.status {
	font-size: 11px;
	font-weight: 500;
	color: var(--muted);
	padding: 4px 10px;
	border-radius: 999px;
	border: 1px solid var(--border);
	background: var(--bg-3);
	max-width: 30vw;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.status.is-busy { color: var(--warn); border-color: rgba(245, 197, 66, 0.25); }
.status.is-ok { color: var(--ok); border-color: rgba(61, 214, 140, 0.25); }

.icon-btn {
	width: 34px;
	height: 34px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 9px;
	color: var(--muted);
	transition: background 0.15s, color 0.15s;
	flex-shrink: 0;
}
.icon-btn:hover {
	background: var(--bg-3);
	color: var(--text);
}

/* Buttons */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: 34px;
	padding: 0 12px;
	border-radius: 9px;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: -0.01em;
	border: 1px solid var(--border);
	background: var(--bg-3);
	color: var(--text);
	white-space: nowrap;
	transition: background 0.15s, border-color 0.15s, transform 0.1s;
	flex-shrink: 0;
}
.btn:active { transform: scale(0.97); }
.btn--primary {
	background: #fff;
	color: #000;
	border-color: transparent;
}
.btn--primary:hover { opacity: 0.9; }
.btn--accent {
	background: #fff;
	color: #000;
	border-color: transparent;
	font-weight: 700;
}
[data-theme="light"] .btn--primary,
[data-theme="light"] .btn--accent {
	background: #111;
	color: #fff;
}
.btn--ghost {
	background: transparent;
	border-color: transparent;
	color: var(--muted);
}
.btn--ghost:hover {
	background: var(--bg-3);
	color: var(--text);
}
.btn--sm {
	height: 30px;
	padding: 0 10px;
	font-size: 12px;
}
.btn--block { width: 100%; }
.btn--danger { color: var(--danger); }
.btn--export {
	min-width: 34px;
	padding: 0 10px;
}

/* ---------- Studio (canvas + bottom tools) ---------- */
/* Mobile-first: bottom is IN FLOW (not absolute) so canvas never draws under tools */
.studio {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	position: relative;
	overflow: hidden;
}

.canvas-area {
	flex: 1 1 auto;
	min-height: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 8px 10px 6px;
	overflow: hidden;
	background:
		radial-gradient(ellipse 60% 50% at 50% 40%, rgba(255, 255, 255, 0.03), transparent 60%),
		var(--bg);
}

.stage {
	flex: 1 1 auto;
	width: 100%;
	min-height: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	contain: layout paint;
}
.stage-frame {
	position: relative;
	flex: 0 0 auto;
	overflow: hidden;
	/* JS sets width/height to scaled canvas size */
	line-height: 0;
}
.stage-frame .post {
	transform-origin: top left;
}

.canvas-tip {
	flex: 0 0 auto;
	display: none; /* hide on small screens — dock is enough */
	align-items: center;
	gap: 6px;
	font-size: 11px;
	font-weight: 500;
	color: var(--faint);
	padding: 2px 0 4px;
}

/* ========== Full photo + BLACK GRADIENT under text (NO solid bar) ========== */
.post {
	position: relative;
	width: var(--canvas-w);
	height: var(--canvas-h);
	background: #000;
	overflow: hidden;
	transform-origin: center center;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55);
	flex-shrink: 0;
	border-radius: 2px;
}

/* Full-bleed image */
.post__media {
	position: absolute;
	inset: 0;
	overflow: hidden;
	z-index: 0;
	background: #111;
}
.post__hero-img {
	position: absolute;
	left: 50%;
	top: 50%;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transform: translate(calc(-50% + var(--pan-x)), calc(-50% + var(--pan-y))) scale(var(--img-scale));
	transform-origin: center center;
	pointer-events: none;
	user-select: none;
	will-change: transform;
}

/* Multi-stop BLACK gradient — only dark behind text, never a solid rectangle */
.post__gradient {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	background: linear-gradient(
		to bottom,
		rgba(0, 0, 0, 0) 0%,
		rgba(0, 0, 0, 0) var(--ov-start),
		rgba(0, 0, 0, calc(var(--ov) * 0.25)) calc(var(--ov-start) + (100% - var(--ov-start)) * 0.28),
		rgba(0, 0, 0, calc(var(--ov) * 0.55)) calc(var(--ov-start) + (100% - var(--ov-start)) * 0.55),
		rgba(0, 0, 0, calc(var(--ov) * 0.82)) calc(var(--ov-start) + (100% - var(--ov-start)) * 0.8),
		rgba(0, 0, 0, var(--ov)) 100%
	);
}

.post__drag {
	position: absolute;
	inset: 0;
	z-index: 3;
	cursor: grab;
	touch-action: none;
	user-select: none;
}
.post__drag.is-dragging { cursor: grabbing; }

.post__logo {
	position: absolute;
	top: var(--logo-t);
	left: var(--logo-l);
	width: var(--logo-w);
	height: auto;
	z-index: 4;
	display: var(--logo-display);
	opacity: var(--logo-op);
	background: transparent !important;
	object-fit: contain;
	pointer-events: none;
	filter: drop-shadow(0 2px 10px rgba(0, 0, 0, 0.5));
	max-width: none;
}

/* Text + footer on gradient — transparent, no solid bg */
.post__textzone {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 5;
	min-height: var(--text-zone-h);
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: flex-end;
	gap: 20px;
	padding: var(--pad-t) var(--pad-r) var(--pad-b) var(--pad-l);
	background: transparent !important;
	pointer-events: none;
	overflow: hidden;
}
.post__title {
	max-width: 92%;
	margin: 0 auto;
	text-align: center;
	font-family: var(--font-post);
	font-weight: var(--font-w);
	font-size: var(--font-sz);
	line-height: 1.1;
	color: var(--text-post);
	text-shadow: 0 2px 16px rgba(0, 0, 0, 0.55);
}
.post__title .highlight {
	display: inline-block;
	padding: 6px 12px;
	margin: 2px;
	border-radius: 2px;
	background: var(--hl);
	color: var(--hl-text);
	text-shadow: none;
}
.post__footer {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent !important;
	flex: 0 0 auto;
}
.post__footer.is-hidden { display: none; }
.post__icons {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--icon-gap);
}
.post__icons svg {
	width: var(--icon-sz) !important;
	height: var(--icon-sz) !important;
	min-width: var(--icon-sz) !important;
	min-height: var(--icon-sz) !important;
	max-width: var(--icon-sz) !important;
	max-height: var(--icon-sz) !important;
	color: var(--icon-c);
	opacity: var(--icon-op);
	display: block;
	flex: none;
	filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.55));
}

/* ---------- Bottom tools (Canva) — in-flow on mobile ---------- */
.bottom {
	position: relative;
	flex: 0 0 auto;
	z-index: 50;
	display: flex;
	flex-direction: column;
	width: 100%;
	/* never overlap canvas */
	background: var(--bg-2);
}

.sheet {
	background: var(--bg-2);
	border-top: 1px solid var(--border);
	max-height: 0;
	opacity: 0;
	overflow: hidden;
	transition: max-height 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.2s ease;
	display: flex;
	flex-direction: column;
}
.studio.is-sheet-open .sheet {
	max-height: var(--sheet-h);
	opacity: 1;
}
.studio.is-sheet-expanded .sheet {
	max-height: min(62vh, 520px);
}

.sheet__handle {
	width: 100%;
	padding: 10px 0 2px;
	display: flex;
	justify-content: center;
	flex-shrink: 0;
}
.sheet__grip {
	width: 32px;
	height: 3px;
	border-radius: 99px;
	background: var(--border-2);
}
.sheet__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 2px 12px 8px;
	flex-shrink: 0;
}
.sheet__title {
	font-size: 13px;
	font-weight: 600;
	letter-spacing: -0.01em;
}
.sheet__body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overflow-x: hidden;
	padding: 0 12px 14px;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: thin;
	scrollbar-color: var(--border-2) transparent;
}

/* Dock */
.dock {
	height: calc(var(--dock-h) + env(safe-area-inset-bottom));
	padding: 0 4px;
	padding-bottom: env(safe-area-inset-bottom);
	display: flex;
	align-items: stretch;
	justify-content: space-around;
	background: var(--bg-2);
	border-top: 1px solid var(--border);
	z-index: 55;
}
.dock__btn {
	flex: 1 1 0;
	min-width: 0;
	max-width: 80px;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 3px;
	padding: 6px 2px;
	color: var(--faint);
	font-size: 10px;
	font-weight: 500;
	letter-spacing: -0.01em;
	border-radius: 10px;
	margin: 4px 1px;
	transition: color 0.15s, background 0.15s;
}
.dock__btn span {
	line-height: 1;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.dock__btn .ico {
	/* lock dock icons */
	width: 20px !important;
	height: 20px !important;
	min-width: 20px !important;
	min-height: 20px !important;
	max-width: 20px !important;
	max-height: 20px !important;
	flex-basis: 20px !important;
}
.dock__btn.is-active {
	color: var(--text);
	background: var(--bg-3);
}
.dock__btn.is-active .ico {
	color: #fff;
}
[data-theme="light"] .dock__btn.is-active .ico {
	color: #111;
}
.nav-link {
	font-size: 12px;
	font-weight: 600;
	color: var(--muted);
	padding: 6px 10px;
	border-radius: 8px;
	border: 1px solid var(--border);
}
.nav-link:hover {
	color: var(--text);
	background: var(--bg-3);
}

/* ---------- Panels / forms ---------- */
.panel {
	display: none;
	flex-direction: column;
	gap: 12px;
}
.panel.is-active {
	display: flex;
	animation: fadeUp 0.18s ease;
}
@keyframes fadeUp {
	from { opacity: 0; transform: translateY(4px); }
	to { opacity: 1; transform: none; }
}

.label {
	display: block;
	font-size: 11px;
	font-weight: 600;
	color: var(--muted);
	margin-bottom: 6px;
	letter-spacing: 0.01em;
}
.label-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 6px;
}
.label-row .label { margin: 0; display: inline-flex; align-items: center; gap: 6px; }
.hint { font-size: 11px; color: var(--faint); line-height: 1.35; }
.block { display: flex; flex-direction: column; }
.two-col {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}
.two-col label { display: flex; flex-direction: column; min-width: 0; }

.input,
.textarea,
select.input {
	width: 100%;
	height: 38px;
	padding: 0 11px;
	background: var(--bg-3);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	outline: none;
	color: var(--text);
	font-size: 13px;
	transition: border-color 0.15s, box-shadow 0.15s;
}
.input:focus,
.textarea:focus {
	border-color: rgba(255, 255, 255, 0.22);
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.06);
}
.textarea {
	height: auto;
	min-height: 80px;
	padding: 10px 11px;
	resize: vertical;
	line-height: 1.45;
}
.input.mono {
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-size: 12px;
	width: 86px;
	flex: 0 0 auto;
}

.range {
	width: 100%;
	height: 24px;
	accent-color: var(--brand);
	cursor: pointer;
}
.field-inline {
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.field-inline .hint {
	display: flex;
	justify-content: space-between;
	font-weight: 500;
}

.composer {
	padding: 12px;
	border-radius: var(--radius);
	background: var(--bg-3);
	border: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.composer .label { margin: 0; }

.search-bar {
	display: flex;
	align-items: center;
	gap: 8px;
	height: 40px;
	padding: 0 6px 0 10px;
	background: var(--bg-3);
	border: 1px solid var(--border);
	border-radius: 10px;
}
.search-bar__ico { color: var(--faint); flex-shrink: 0; }
.search-bar__input {
	flex: 1 1 auto;
	min-width: 0;
	height: 100%;
	border: none;
	background: transparent;
	outline: none;
	font-size: 13px;
}
.search-bar__input::placeholder { color: var(--faint); }

.seg-control {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 3px;
	padding: 3px;
	background: var(--bg-3);
	border: 1px solid var(--border);
	border-radius: 10px;
}
.seg {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 5px;
	height: 32px;
	border-radius: 8px;
	font-size: 11px;
	font-weight: 600;
	color: var(--faint);
}
.seg.is-active {
	background: var(--bg-2);
	color: var(--text);
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
	border: 1px solid var(--border);
}

.image-panel { display: none; flex-direction: column; gap: 8px; }
.image-panel.is-active { display: flex; }
.image-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 6px;
	max-height: 168px;
	overflow: auto;
}
.image-card {
	aspect-ratio: 1;
	border-radius: 8px;
	overflow: hidden;
	border: 2px solid transparent;
	padding: 0;
	background: var(--bg-3);
	position: relative;
}
.image-card img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}
.image-card:hover,
.image-card.is-selected { border-color: var(--brand); }
.image-card__cap {
	position: absolute;
	left: 0; right: 0; bottom: 0;
	padding: 3px 4px;
	font-size: 8px;
	background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
	color: #ddd;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	text-align: left;
}

.dropzone {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 6px;
	min-height: 88px;
	padding: 16px;
	border-radius: var(--radius);
	border: 1px dashed var(--border-2);
	background: var(--bg-3);
	text-align: center;
	cursor: pointer;
	color: var(--muted);
	font-size: 13px;
	font-weight: 500;
}
.dropzone:hover,
.dropzone.is-dragover {
	border-color: rgba(255, 255, 255, 0.35);
	background: rgba(255, 255, 255, 0.04);
}
.status.is-ok { color: #d4d4d4; border-color: rgba(255,255,255,0.15); }
.status.is-busy { color: #e5e5e5; border-color: rgba(255,255,255,0.2); }

.glass-card {
	padding: 12px;
	border-radius: var(--radius);
	background: var(--bg-3);
	border: 1px solid var(--border);
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.glass-card.accent {
	border-color: rgba(255, 255, 255, 0.14);
	background: var(--bg-3);
}

.segments {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	min-height: 42px;
	padding: 8px;
	background: var(--bg-3);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
}
.segment {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 5px 8px 5px 10px;
	background: var(--bg-2);
	border: 1px solid var(--border);
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	cursor: grab;
	user-select: none;
	max-width: 100%;
}
.segment.is-highlight {
	background: var(--hl);
	color: var(--hl-text);
	border-color: transparent;
}
.segment.is-dragging { opacity: 0.4; }
.segment__text {
	max-width: 120px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.segment__rm {
	width: 16px;
	height: 16px;
	display: grid;
	place-items: center;
	border-radius: 50%;
	opacity: 0.5;
	font-size: 12px;
	line-height: 1;
}

.color-row {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}
.color-row input[type="color"] {
	width: 36px;
	height: 36px;
	padding: 2px;
	border-radius: 8px;
	border: 1px solid var(--border);
	background: var(--bg-3);
	cursor: pointer;
}
.swatches { display: flex; gap: 5px; }
.swatch {
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--c);
	border: 2px solid transparent;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.2);
	padding: 0;
}
.swatch.is-active { border-color: var(--text); }

.btn-row {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	align-items: center;
}
.btn-col {
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.logo-row {
	display: flex;
	gap: 12px;
	align-items: center;
}
.logo-preview {
	width: 52px;
	height: 52px;
	object-fit: contain;
	border-radius: 10px;
	border: 1px solid var(--border);
	padding: 4px;
	flex-shrink: 0;
	background-color: #1a1a1a;
	background-image:
		linear-gradient(45deg, #2a2a2a 25%, transparent 25%),
		linear-gradient(-45deg, #2a2a2a 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, #2a2a2a 75%),
		linear-gradient(-45deg, transparent 75%, #2a2a2a 75%);
	background-size: 10px 10px;
	background-position: 0 0, 0 5px, 5px -5px, -5px 0;
}
.icon-picks {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}
.chip {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 6px 10px;
	border-radius: 999px;
	font-size: 11px;
	font-weight: 600;
	background: var(--bg-3);
	border: 1px solid var(--border);
	cursor: pointer;
	color: var(--muted);
}
.chip:has(input:checked) {
	border-color: rgba(255, 255, 255, 0.35);
	color: var(--text);
	background: rgba(255, 255, 255, 0.08);
}
.chip input { width: 12px; height: 12px; accent-color: #fff; }
.check {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	font-weight: 500;
	color: var(--muted);
}
.check input { width: 14px; height: 14px; accent-color: #fff; }
.range { accent-color: #fff; }

.list { display: flex; flex-direction: column; gap: 6px; }
.list-item {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 10px;
	background: var(--bg-3);
	border: 1px solid var(--border);
}
.list-item__meta { flex: 1; min-width: 0; }
.list-item__name {
	display: block;
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.list-item__sub { font-size: 11px; color: var(--faint); }
.empty {
	text-align: center;
	padding: 18px 10px;
	color: var(--faint);
	font-size: 12px;
}

.desktop-only { display: none !important; }

/* Desktop / tablet */
@media (min-width: 900px) {
	:root {
		--nav-h: 54px;
		--dock-h: 60px;
		--sheet-h: min(40vh, 380px);
	}
	.desktop-only { display: inline-flex !important; }
	.canvas-tip { display: inline-flex; }
	.btn--export {
		padding: 0 14px;
		gap: 7px;
	}
	.image-grid {
		grid-template-columns: repeat(4, 1fr);
		max-height: 200px;
	}
}

/* Large desktop: canvas left, tools column right (still one page, no drawer) */
@media (min-width: 1100px) {
	:root {
		--sheet-h: min(50vh, 480px);
	}
	.studio {
		flex-direction: row;
		align-items: stretch;
	}
	.canvas-area {
		flex: 1 1 auto;
		min-width: 0;
		padding: 16px 12px 16px 16px;
	}
	.bottom {
		width: min(380px, 34vw);
		flex: 0 0 min(380px, 34vw);
		border-left: 1px solid var(--border);
		height: 100%;
		max-height: 100%;
		display: flex;
		flex-direction: column;
	}
	/* sheet always open on large desktop */
	.sheet {
		flex: 1 1 auto;
		max-height: none !important;
		opacity: 1 !important;
		border-top: none;
		min-height: 0;
	}
	.sheet__handle { display: none; }
	.sheet__body {
		flex: 1 1 auto;
	}
	.dock {
		flex: 0 0 auto;
		order: -1; /* tools tabs on top of right panel like Grok sidebar-ish */
		border-top: none;
		border-bottom: 1px solid var(--border);
		height: auto;
		padding: 8px 6px;
		padding-bottom: 8px;
	}
	.dock__btn {
		flex-direction: row;
		gap: 8px;
		max-width: none;
		justify-content: flex-start;
		padding: 10px 12px;
		margin: 2px 4px;
		font-size: 12px;
	}
	.studio.is-sheet-open .sheet,
	.studio.is-sheet-expanded .sheet {
		max-height: none !important;
	}
}

@media (prefers-reduced-motion: reduce) {
	*, *::before, *::after {
		animation-duration: 0.01ms !important;
		transition-duration: 0.01ms !important;
	}
}
