﻿* {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}


:root {
	--gold: #e8a830;
	--gold-bright: #f5c842;
	--gold-dim: #b87d1e;
	--gold-glow: rgba(232, 168, 48, 0.25);
	--crimson: #d4453b;
	--crimson-deep: #a8322b;
	--crimson-glow: rgba(212, 69, 59, 0.2);
	--bg-abyss: #08080f;
	--bg-deep: #0f0f1a;
	--bg-card: #151522;
	--bg-elevated: #1c1c2e;
	--text-warm: #f2e6d0;
	--text-muted: rgba(242, 230, 208, 0.5);
	--text-dim: rgba(242, 230, 208, 0.35);
	--border-subtle: rgba(232, 168, 48, 0.1);
	--border-gold: rgba(232, 168, 48, 0.25);
	--border-active: rgba(232, 168, 48, 0.45);
}

html,
body {
	height: 100%;
	background: var(--bg-abyss);
	background-image:
		radial-gradient(ellipse at 20% 10%, rgba(232, 168, 48, 0.04) 0%, transparent 60%),
		radial-gradient(ellipse at 80% 90%, rgba(212, 69, 59, 0.03) 0%, transparent 55%),
		radial-gradient(ellipse at 50% 50%, rgba(15, 15, 26, 1) 0%, var(--bg-abyss) 100%);
	color: var(--text-warm);
	font-family: "DM Sans", "Segoe UI", Tahoma, sans-serif;
	overflow-x: hidden;
}

body {
	display: block;
	margin: 0;
	padding: 16px;
}

body::before {
	content: "";
	position: fixed;
	inset: 0;
	z-index: -1;
	opacity: 0.03;
	background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
	pointer-events: none;
}

body,
button,
input,
textarea {
	font-family: "DM Sans", "Segoe UI", Tahoma, sans-serif;
}

.hidden {
	display: none !important;
}

.app {
	width: 100%;
	max-width: 1180px;
	margin: 0 auto 40px;
	padding: 0 32px;
	padding-top: calc(12px + var(--tg-safe-area-top, 0px));
	display: flex;
	flex-direction: column;
	gap: 32px;
}

.app-nav {
	display: inline-flex;
	align-items: center;
	gap: 0;
	padding: 6px;
	border-radius: 14px;
	background: var(--bg-card);
	border: 1px solid var(--border-subtle);
	margin-bottom: 4px;
}

/* ── Bottom Tab Bar (iOS liquid glass style) ── */

.app-tab-bar {
	position: fixed;
	bottom: 0;
	left: 0;
	right: 0;
	display: flex;
	justify-content: center;
	gap: 8px;
	padding: 6px 12px;
	padding-bottom: calc(6px + var(--tg-safe-area-bottom, 0px));
	background: rgba(20, 20, 36, 0.72);
	backdrop-filter: blur(24px) saturate(160%);
	-webkit-backdrop-filter: blur(24px) saturate(160%);
	border-top: 1px solid rgba(255, 255, 255, 0.08);
	z-index: 100;
}

.tab-btn {
	flex: 0 1 auto;
	min-width: 100px;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 9px 20px;
	border-radius: 14px;
	background: transparent;
	border: 0;
	color: rgba(255, 255, 255, 0.45);
	font-size: 13px;
	font-weight: 500;
	letter-spacing: 0.3px;
	cursor: pointer;
	transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn .tab-label {
	transition: color 0.25s ease;
}

.tab-btn.active {
	background: rgba(232, 168, 48, 0.12);
	color: var(--gold);
	border: 1px solid rgba(232, 168, 48, 0.15);
}

/* Remove old nav styles */
.app-nav { display: none; }
.nav-btn { display: none; }

/* Main area gets bottom padding for tab bar */
.app-main {
	flex: 1;
	width: 100%;
	padding-bottom: 72px;
}

.app-version {
	align-self: center;
	color: var(--text-dim);
	font-size: 10px;
	letter-spacing: 0.5px;
	margin-top: -12px;
	user-select: none;
	text-transform: uppercase;
}

.app-page { display: none; }
.app-page.active {
	display: flex;
	flex-direction: column;
	gap: 24px;
}
#editorPage.app-page.active { align-items: center; }
#editorPage .preview-card { width: min(100%, 420px); }
#promptPage.app-page.active { gap: 20px; }
#promptPage .prompt-card {
	width: min(100%, 860px);
	align-self: center;
}

.preview-card,
.prompt-card {
	background: var(--bg-card);
	border: 1px solid var(--border-subtle);
	border-radius: 16px;
	padding: 24px;
	display: flex;
	flex-direction: column;
	gap: 20px;
	width: 100%;
	box-sizing: border-box;
	position: relative;
	overflow: hidden;
}

.preview-card::before,
.prompt-card::before {
	content: "";
	position: absolute;
	inset: 0;
	border-radius: 16px;
	padding: 1px;
	background: linear-gradient(135deg, var(--border-gold), transparent 40%, transparent 60%, rgba(212,69,59,0.15));
	-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	pointer-events: none;
	z-index: 0;
}

.preview-card > *,
.prompt-card > * {
	position: relative;
	z-index: 1;
}

.card-header h2 {
	font-family: "Playfair Display", serif;
	font-size: 22px;
	font-weight: 700;
	letter-spacing: 0.5px;
	background: linear-gradient(135deg, var(--gold-bright), var(--gold));
	-webkit-background-clip: text;
	-webkit-text-fill-color: transparent;
	background-clip: text;
}

.badge {
	padding: 3px 12px;
	border-radius: 999px;
	background: rgba(232, 168, 48, 0.12);
	border: 1px solid var(--border-gold);
	font-size: 12px;
	font-weight: 600;
	color: var(--gold);
	letter-spacing: 0.3px;
}

.preview-frame {
	position: relative;
	width: 100%;
	aspect-ratio: 3 / 4;
	border-radius: 12px;
	border: 1px solid var(--border-subtle);
	background: var(--bg-abyss);
	overflow: hidden;
}

.file-input-hidden { display: none; }

.preview-upload-btn {
	position: absolute;
	top: 10px;
	left: 10px;
	height: 36px;
	padding: 0 13px;
	border-radius: 8px;
	border: 1px solid var(--border-gold);
	background: rgba(232, 168, 48, 0.1);
	color: var(--gold);
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.25s ease;
	z-index: 5;
}
.preview-upload-btn:hover {
	background: rgba(232, 168, 48, 0.2);
	box-shadow: 0 0 16px var(--gold-glow);
}

.preview-placeholder {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	text-align: center;
	padding: 16px;
	color: var(--text-muted);
	font-size: 13px;
	z-index: 1;
	cursor: pointer;
}

.preview-placeholder-content { display: flex; flex-direction: column; gap: 10px; align-items: center; }

.preview-image {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: contain;
	background: var(--bg-abyss);
}

.preview-edit-button {
	position: absolute;
	inset: auto 12px 12px;
	height: 40px;
	border-radius: 10px;
	border: 1px solid var(--border-gold);
	background: linear-gradient(135deg, rgba(232,168,48,0.25), rgba(212,69,59,0.15));
	color: var(--gold-bright);
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	transition: all 0.3s ease;
	letter-spacing: 0.5px;
}
.preview-edit-button:hover:not(:disabled) {
	box-shadow: 0 0 20px var(--gold-glow), 0 0 40px rgba(232,168,48,0.1);
	transform: translateY(-1px);
}
.preview-edit-button:disabled { cursor: not-allowed; opacity: 0.35; }

#downloadOriginalButton {
	width: 100%;
	min-height: 48px;
	margin-top: 12px;
}

.preview-actions {
	display: flex;
	gap: 12px;
	margin-top: 12px;
}

.action-btn {
	flex: 1;
	height: 40px;
	border-radius: 10px;
	border: 1px solid var(--border-gold);
	background: rgba(232, 168, 48, 0.06);
	color: var(--text-warm);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.25s ease;
	letter-spacing: 0.2px;
}
.action-btn:hover:not(:disabled) {
	background: rgba(232, 168, 48, 0.15);
	box-shadow: 0 0 12px var(--gold-glow);
}
.action-btn:active:not(:disabled) { transform: scale(0.97); }
.action-btn:disabled { cursor: not-allowed; opacity: 0.4; }

.action-btn.primary {
	background: linear-gradient(135deg, var(--gold), var(--gold-dim));
	border: 0;
	color: #1a1a12;
	font-weight: 700;
	animation: pulse-gold 2.5s ease-in-out infinite;
}
.action-btn.primary:hover:not(:disabled) {
	background: linear-gradient(135deg, var(--gold-bright), var(--gold));
	box-shadow: 0 0 24px var(--gold-glow), 0 0 48px rgba(232,168,48,0.15);
	transform: translateY(-1px);
}

@keyframes pulse-gold {
	0%, 100% { box-shadow: 0 0 8px var(--gold-glow); }
	50% { box-shadow: 0 0 22px var(--gold-glow), 0 0 36px rgba(232,168,48,0.12); }
}

.hint { font-size: 12px; color: var(--text-muted); }

.section-title {
	font-family: "Playfair Display", serif;
	font-size: 16px;
	font-weight: 700;
	margin-bottom: 10px;
	color: var(--gold);
	letter-spacing: 0.3px;
}
.section-title.compact { margin-bottom: 0; font-size: 14px; }

.prompt-divider {
	height: 1px;
	margin: 14px 0;
	background: linear-gradient(90deg, transparent, var(--border-gold), transparent);
}

.prompt-groups,
.prompt-optional-panels { display: flex; flex-direction: column; gap: 14px; }

.prompt-group {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 14px;
	border-radius: 12px;
	background: var(--bg-deep);
	border: 1px solid var(--border-subtle);
}
.prompt-group-title {
	font-size: 14px;
	font-weight: 600;
	color: var(--text-warm);
}
.prompt-options,
.prompt-toggle-grid { display: flex; flex-wrap: wrap; gap: 8px; }

.prompt-option-btn,
.prompt-toggle-btn {
	padding: 5px 10px;
	border-radius: 7px;
	border: 1px solid var(--border-subtle);
	background: var(--bg-abyss);
	color: var(--text-muted);
	font-size: 11px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.2s ease;
	min-width: 48px;
	text-align: center;
}
.prompt-option-btn:hover,
.prompt-toggle-btn:hover {
	background: rgba(232, 168, 48, 0.1);
	border-color: var(--border-gold);
	color: var(--text-warm);
}
.prompt-option-btn.active,
.prompt-toggle-btn.active {
	background: linear-gradient(135deg, rgba(232,168,48,0.25), rgba(212,69,59,0.12));
	border-color: var(--border-active);
	color: var(--gold-bright);
	font-weight: 600;
}

.prompt-save-section {
	grid-column: 1 / -1;
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 14px;
	border-radius: 12px;
	background: var(--bg-deep);
	border: 1px solid var(--border-subtle);
	margin-bottom: 4px;
}
.prompt-save-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.prompt-save-actions { display: flex; gap: 6px; align-items: center; }

.prompt-save-list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 6px;
	border: 1px solid var(--border-subtle);
	border-radius: 8px;
	background: var(--bg-abyss);
	padding: 6px;
}
.prompt-save-list .hint {
	grid-column: 1 / -1;
	padding: 8px 10px; margin: 0; text-align: center;
	font-size: 12px;
}
.prompt-save-slot {
	display: flex; align-items: center; gap: 0;
	padding: 6px 10px;
	border-radius: 6px;
	border: 0;
	background: transparent; color: var(--text-muted);
	font-size: 12px; text-align: left; cursor: pointer;
	transition: all 0.2s ease;
}
.prompt-save-slot:hover { background: rgba(232,168,48,0.06); color: var(--text-warm); }
.prompt-save-slot.active {
	background: rgba(232,168,48,0.12);
	color: var(--gold-bright);
	font-weight: 600;
}
.prompt-save-slot-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.output-field.collapsible .collapsible-toggle {
	cursor: pointer;
	user-select: none;
	transition: color 0.2s ease;
	display: flex; align-items: center; gap: 4px;
}
.output-field.collapsible .collapsible-toggle:hover { color: var(--gold); }
.output-field.collapsible .collapsible-toggle::first-letter { font-size: 10px; margin-right: 2px; }
.output-field.collapsible.collapsed .collapsible-content { display: none; }
.output-field.collapsible.collapsed .collapsible-toggle::first-letter { content: "▶"; }
.output-field:not(.collapsed) .collapsible-toggle::first-letter { content: "▼"; }

.form-field label span,
.form-field > span {
	display: block;
	font-size: 12px;
	font-weight: 600;
	color: var(--text-muted);
	margin-bottom: 4px;
	letter-spacing: 0.3px;
}

textarea, input[type="text"], input[type="number"] {
	width: 100%;
	padding: 8px 10px;
	border-radius: 8px;
	border: 1px solid var(--border-subtle);
	background: var(--bg-abyss);
	color: var(--text-warm);
	font-size: 12px;
	resize: vertical;
	transition: border 0.2s ease, box-shadow 0.2s ease;
	font-family: "DM Sans", "Segoe UI", sans-serif;
}
textarea:focus, input[type="text"]:focus, input[type="number"]:focus {
	outline: none;
	border-color: var(--border-gold);
	box-shadow: 0 0 8px var(--gold-glow);
}

.queue-submit-section {
	grid-column: 1 / -1;
	display: flex; flex-direction: column; gap: 10px;
	padding-top: 4px; width: 100%;
}

.queue-preset-list {
	display: flex; flex-wrap: wrap;
	gap: 6px; padding: 8px;
	border: 1px solid var(--border-subtle);
	border-radius: 8px;
	background: var(--bg-abyss);
	margin-bottom: 10px;
	min-height: 38px;
	align-items: flex-start;
	align-content: flex-start;
}

.queue-preset-pill {
	display: inline-flex; align-items: center;
	padding: 5px 10px;
	border: 1px solid var(--border-subtle);
	border-radius: 6px;
	background: rgba(232, 168, 48, 0.04);
	color: var(--text-muted);
	font-size: 11px; font-weight: 520;
	line-height: 1.3; cursor: pointer;
	user-select: none;
	transition: all 0.2s ease;
}
.queue-preset-pill:hover {
	background: rgba(232, 168, 48, 0.1);
	border-color: var(--border-gold);
	color: var(--text-warm);
}
.queue-preset-pill:active { transform: scale(0.95); }
.queue-preset-pill.selected {
	background: linear-gradient(135deg, rgba(232,168,48,0.22), rgba(212,69,59,0.08));
	border-color: var(--border-active);
	color: var(--gold-bright);
	font-weight: 600;
}

.queue-submit-btn { width: 100%; }
.queue-submit-status { text-align: center; margin-top: 6px; font-size: 11px; }
.queue-submit-status.success { color: var(--gold); }
.queue-submit-status.error { color: var(--crimson); }

.prompt-output-fields {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 16px;
	width: 100%;
}

.prompt-save-section {
	grid-column: 1 / -1;
	display: flex;
	flex-direction: column;
	gap: 12px;
	padding: 14px;
	border-radius: 14px;
	background: rgba(18, 18, 28, 0.78);
	border: 1px solid rgba(255, 255, 255, 0.05);
}

.prompt-save-header {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.prompt-save-actions {
	display: flex;
	gap: 8px;
	align-items: center;
}

.prompt-save-btn {
	padding: 6px 14px;
	border-radius: 999px;
	border: 1px solid rgba(255, 255, 255, 0.16);
	background: rgba(255, 255, 255, 0.06);
	color: var(--text-warm);
	font-size: 13px;
	cursor: pointer;
	transition: background 0.2s ease, border 0.2s ease, transform 0.15s ease;
}

.prompt-save-btn.icon-btn {
	width: 42px;
	height: 36px;
	padding: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 18px;
}

.prompt-save-btn.primary {
	background: rgba(232, 168, 48, 0.28);
	border-color: rgba(232, 168, 48, 0.5);
}

.prompt-save-btn.danger {
	background: rgba(255, 99, 99, 0.18);
	border-color: rgba(255, 99, 99, 0.5);
}

.prompt-save-btn.danger:hover:not(:disabled) {
	background: rgba(255, 99, 99, 0.3);
	border-color: rgba(255, 140, 140, 0.7);
}

.prompt-save-btn:hover:not(:disabled) {
	background: rgba(232, 168, 48, 0.22);
	border-color: rgba(232, 168, 48, 0.5);
}

.prompt-save-btn:active:not(:disabled) {
	transform: scale(0.97);
}

.prompt-save-btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}
}

.output-field {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.output-field textarea {
	min-height: 80px;
	max-height: 140px;
	overflow-y: auto;
}

.prompt-output-primary,
.prompt-output-secondary {
	width: 100%;
	min-width: 0;
}

@media (max-width: 960px) {
	.prompt-output-fields {
		grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	}
}

.prompt-tab-bar {
	display: flex;
	flex-wrap: nowrap;
	gap: 10px;
	margin-bottom: 8px;
	overflow-x: auto;
	padding-bottom: 4px;
	scrollbar-width: none;
}

.prompt-tab-bar::-webkit-scrollbar {
	display: none;
}

.prompt-tab-btn {
	padding: 8px 14px;
	border-radius: 8px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	background: rgba(12, 12, 20, 0.6);
	color: rgba(245, 245, 245, 0.78);
	font-size: 13px;
	cursor: pointer;
	transition: background 0.2s ease, border 0.2s ease;
}

.prompt-tab-btn:hover {
	background: rgba(232, 168, 48, 0.18);
	border-color: rgba(232, 168, 48, 0.4);
}

.prompt-tab-btn.active {
	background: rgba(232, 168, 48, 0.32);
	border-color: rgba(232, 168, 48, 0.5);
	color: var(--text-warm);
}

.prompt-optional-panel {
	display: none;
	flex-direction: column;
	gap: 16px;
	padding: 16px;
	border-radius: 14px;
	background: rgba(18, 18, 28, 0.8);
	border: 1px solid rgba(255, 255, 255, 0.05);
}

.prompt-optional-panel.active {
	display: flex;
}

.prompt-optional-header {
	font-size: 15px;
	font-weight: 600;
	color: rgba(245, 245, 245, 0.85);
}

.prompt-search-input {
	flex: 1;
	min-width: 0;
	height: 38px;
	padding: 0 14px;
	border-radius: 10px;
	border: 1px solid rgba(255, 255, 255, 0.15);
	background: rgba(18, 18, 28, 0.8);
	color: var(--text-warm);
	font-size: 14px;
	transition: border-color 0.2s, background 0.2s;
}

.prompt-search-input:focus {
	outline: none;
	border-color: rgba(232, 168, 48, 0.6);
	background: rgba(22, 22, 34, 0.95);
}

.prompt-search-input::placeholder {
	color: rgba(245, 245, 245, 0.4);
}

/* Accordion categories for optional prompts */
.accordion-style.prompt-optional-panels {
	gap: 10px;
}

.prompt-category-accordion {
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: 12px;
	background: rgba(18, 18, 28, 0.6);
}

.prompt-category-header {
	position: sticky;
	top: -1px;
	z-index: 10;
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 12px 16px;
	background: rgba(28, 28, 40, 0.95);
	backdrop-filter: blur(8px);
	border-radius: 12px;
	cursor: pointer;
	user-select: none;
	font-size: 14px;
	font-weight: 600;
	color: rgba(245, 245, 245, 0.85);
	transition: background 0.2s ease;
}

.prompt-category-accordion.expanded .prompt-category-header {
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
	border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.prompt-category-header:hover {
	background: rgba(35, 35, 50, 0.95);
}

.prompt-category-icon {
	transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
	font-size: 12px;
	opacity: 0.6;
}

.prompt-category-accordion.expanded .prompt-category-icon {
	transform: rotate(180deg);
}

.prompt-category-body {
	display: none;
	padding: 14px;
	background: rgba(15, 15, 24, 0.4);
	border-bottom-left-radius: 12px;
	border-bottom-right-radius: 12px;
}

.prompt-category-accordion.expanded .prompt-category-body {
	display: block;
}

.prompt-category-accordion.hidden {
	display: none !important;
}

.prompt-toggle-btn.filtered {
	display: none !important;
}

.prompt-actions .action-btn {
	width: 100%;
	min-width: 0;
	justify-content: center;
}

.record-command-btn {
	padding: 0 28px;
}

.form-field {
	display: flex;
	flex-direction: column;
	gap: 10px;
	min-width: 0;
	width: 100%;
}

.form-field span {
	font-size: 14px;
	color: rgba(245, 245, 245, 0.75);
}

textarea {
	width: 100%;
	max-width: 100%;
	min-height: 72px;
	padding: 12px;
	border-radius: 12px;
	border: 1px solid rgba(255, 255, 255, 0.08);
	background: rgba(15, 15, 25, 0.86);
	color: var(--text-warm);
	resize: vertical;
	font-size: 14px;
	overflow-y: auto;
}

textarea[readonly] {
	background: rgba(12, 12, 20, 0.66);
	color: rgba(245, 245, 245, 0.85);
}

textarea::placeholder {
	color: rgba(245, 245, 245, 0.4);
}

.input-error {
	border-color: rgba(255, 107, 107, 0.7) !important;
	box-shadow: 0 0 0 2px rgba(255, 107, 107, 0.2);
}

@media (max-width: 960px) {
	.app {
		padding: 24px;
	}

	.app-nav {
		flex-wrap: wrap;
	}

	.app-page.active {
		gap: 20px;
	}
}

@media (max-width: 768px) {
	.app {
		width: 100%;
		margin: 16px auto 24px;
		padding: 20px 16px;
		gap: 24px;
	}

	.preview-card,
	.prompt-card {
		padding: 18px;
		border-radius: 16px;
		gap: 18px;
	}

	.prompt-actions {
		grid-template-columns: 1fr;
	}

	.prompt-optional-panel {
		padding: 12px;
	}
}

@media (max-width: 540px) {
	.prompt-output-fields {
		grid-template-columns: 1fr;
	}

	.offset-grid {
		grid-template-columns: 1fr;
	}

	.app-nav {
		gap: 8px;
	}

	.prompt-tab-bar {
		gap: 8px;
	}
}

.offset-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 12px;
	width: 100%;
}

.offset-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 12px;
	border-radius: 12px;
	background: rgba(15, 15, 25, 0.7);
	border: 1px solid rgba(255, 255, 255, 0.08);
	min-width: 0;
}

.offset-field.compact {
	gap: 8px;
}

.offset-control {
	display: flex;
	align-items: center;
	gap: 10px;
}

.offset-stepper {
	display: flex;
	align-items: center;
	gap: 6px;
}

.offset-step-btn {
	width: 34px;
	height: 34px;
	border-radius: 10px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	background: rgba(12, 12, 20, 0.88);
	color: var(--text-warm);
	font-size: 18px;
	line-height: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.2s ease, border 0.2s ease, transform 0.15s ease;
}

.offset-step-btn:hover:not(:disabled) {
	background: rgba(232, 168, 48, 0.22);
	border-color: rgba(232, 168, 48, 0.5);
}

.offset-step-btn:active:not(:disabled) {
	transform: scale(0.94);
}

.offset-step-btn:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.offset-step-input {
	width: 52px;
	height: 34px;
	padding: 0 10px;
	border-radius: 10px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	background: rgba(9, 9, 16, 0.9);
	color: var(--text-warm);
	font-size: 13px;
	text-align: center;
	appearance: textfield;
	-moz-appearance: textfield;
}

.offset-step-input::-webkit-inner-spin-button,
.offset-step-input::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.offset-step-input:focus {
	outline: none;
	border-color: rgba(232, 168, 48, 0.6);
	box-shadow: 0 0 0 2px rgba(232, 168, 48, 0.18);
}

.offset-step-unit {
	font-size: 13px;
	color: rgba(245, 245, 245, 0.65);
	min-width: 12px;
	text-align: center;
}

.offset-direction {
	font-size: 18px;
	min-width: 24px;
	text-align: center;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

.offset-field span {
	font-size: 13px;
	color: rgba(245, 245, 245, 0.7);
}

.offset-field input:not(.offset-step-input) {
	width: 100%;
	padding: 10px 12px;
	border-radius: 10px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	background: rgba(9, 9, 16, 0.9);
	color: var(--text-warm);
	font-size: 14px;
}

.offset-field input:not(.offset-step-input):focus {
	outline: none;
	border-color: rgba(232, 168, 48, 0.6);
	box-shadow: 0 0 0 2px rgba(232, 168, 48, 0.18);
}

@media (max-width: 640px) {
	.offset-grid {
		gap: 10px;
	}

	.prompt-actions .action-btn {
		flex: 1 1 100%;
	}
}

.form-hint {
	font-size: 12px;
	color: rgba(245, 245, 245, 0.45);
}

.send-hint {
	text-align: center;
	margin-top: -4px;
	color: rgba(245, 245, 245, 0.58);
}

/* 发送到队列区块 */
.queue-submit-section {
	margin-top: 16px;
	padding: 12px;
	background: rgba(255, 255, 255, 0.05);
	border-radius: 12px;
	border: 1px solid rgba(255, 255, 255, 0.08);
}

.queue-preset-list {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
	padding: 8px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 10px;
	background: rgba(10, 14, 22, 0.6);
	margin-bottom: 12px;
	min-height: 40px;
	align-items: flex-start;
	align-content: flex-start;
}

.queue-preset-pill {
	display: inline-flex;
	align-items: center;
	padding: 5px 11px;
	border: 1px solid rgba(255, 255, 255, 0.14);
	border-radius: 7px;
	background: rgba(255, 255, 255, 0.04);
	color: rgba(245, 245, 245, 0.65);
	font-size: 12px;
	font-weight: 520;
	line-height: 1.35;
	cursor: pointer;
	user-select: none;
	transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.1s ease;
}

.queue-preset-pill:hover {
	background: rgba(255, 255, 255, 0.09);
	border-color: rgba(255, 255, 255, 0.25);
	color: var(--text-warm);
}

.queue-preset-pill:active {
	transform: scale(0.96);
}

.queue-preset-pill.selected {
	background: rgba(232, 168, 48, 0.18);
	border-color: rgba(232, 168, 48, 0.5);
	color: var(--gold-bright);
}

.queue-submit-btn {
	width: 100%;
}

.queue-submit-status {
	text-align: center;
	margin-top: 8px;
	font-size: 12px;
}

.queue-submit-status.success {
	color: var(--gold);
}

.queue-submit-status.error {
	color: var(--crimson);
}

.queue-submit-tray {
	position: fixed;
	left: 50%;
	bottom: 14px;
	z-index: 180;
	width: min(calc(100% - 28px), 420px);
	transform: translateX(-50%);
	transition: transform 0.22s ease, opacity 0.22s ease;
}

.queue-submit-tray.hidden {
	display: none;
}

.queue-submit-tray-inner {
	display: flex;
	align-items: center;
	gap: 10px;
	min-height: 44px;
	padding: 10px 12px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 8px;
	background: rgba(14, 18, 28, 0.94);
	box-shadow: 0 14px 34px rgba(0, 0, 0, 0.36);
	backdrop-filter: blur(12px);
}

.queue-submit-tray-title {
	min-width: 0;
	flex: 1;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 13px;
	color: rgba(245, 245, 245, 0.86);
}

.queue-submit-tray-status {
	flex: 0 0 auto;
	font-size: 12px;
	color: rgba(245, 245, 245, 0.62);
}

.queue-submit-tray.submitted .queue-submit-tray-status {
	color: var(--gold);
}

.queue-submit-tray.failed .queue-submit-tray-status {
	color: var(--crimson);
}

.queue-submit-tray.compact {
	transform: translateX(-50%) translateY(calc(100% - 12px));
	opacity: 0.82;
}

.queue-submit-tray-retry {
	height: 28px;
	padding: 0 12px;
	border: 1px solid rgba(252, 129, 129, 0.5);
	border-radius: 8px;
	background: rgba(252, 129, 129, 0.14);
	color: #ffe5e5;
	font-size: 12px;
	cursor: pointer;
}

.editor-overlay {
	position: fixed; inset: 0;
	background: rgba(4, 4, 10, 0.95);
	backdrop-filter: blur(8px);
	display: flex; align-items: center; justify-content: center;
	padding: 0; z-index: 200;
	touch-action: none;
}

.editor-wrapper {
	display: flex; flex-direction: column;
	width: 100%; height: 100%;
	background: var(--bg-abyss);
	border: none; border-radius: 0;
	overflow: hidden;
}


.slider {
	flex: 1; min-width: 80px; height: 5px;
	appearance: none;
	background: rgba(232, 168, 48, 0.15);
	border-radius: 999px; outline: none;
}
.slider::-webkit-slider-thumb {
	appearance: none; width: 22px; height: 22px;
	border-radius: 50%;
	background: var(--gold);
	box-shadow: 0 0 10px var(--gold-glow);
	cursor: pointer;
}
.slider::-moz-range-thumb {
	width: 22px; height: 22px;
	border-radius: 50%; border: 0;
	background: var(--gold);
	cursor: pointer;
}

.slider-group {
	display: flex; align-items: center; gap: 8px;
	flex: 1; min-width: 0;
}
.slider-icon {
	font-size: 12px; color: var(--text-muted);
	white-space: nowrap; user-select: none;
}
.zoom-indicator {
	font-size: 11px; color: var(--text-muted);
	white-space: nowrap; user-select: none;
}
.separator-dot {
	width: 4px; height: 4px;
	border-radius: 50%;
	background: var(--border-gold);
}
	border: none;
	box-shadow: 0 0 10px rgba(232, 168, 48, 0.35);
	cursor: pointer;
}

.slider::-moz-range-thumb {
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background: var(--gold);
	border: none;
	box-shadow: 0 0 10px rgba(232, 168, 48, 0.35);
	cursor: pointer;
}

.slider::-webkit-slider-runnable-track {
	height: 6px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.18);
}

.slider::-moz-range-track {
	height: 6px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.18);
}

.slider-group {
	flex: 1;
	display: inline-flex;
	align-items: center;
	gap: 10px;
}

.slider-icon {
	font-size: 16px;
	color: rgba(245, 245, 245, 0.72);
	min-width: 48px;
	text-align: center;
}

.zoom-indicator {
	font-size: 13px;
	color: rgba(245, 245, 245, 0.6);
	padding: 2px 8px;
	border-radius: 6px;
	background: rgba(255, 255, 255, 0.05);
	border: 1px solid rgba(255, 255, 255, 0.08);
	min-width: 60px;
	text-align: center;
	cursor: default;
	user-select: none;
	line-height: 26px;
}

.zoom-indicator:hover {
	background: rgba(255, 255, 255, 0.08);
	border-color: rgba(255, 255, 255, 0.15);
}

.separator-dot {
	width: 3px;
	height: 3px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.2);
	flex-shrink: 0;
}

.editor-stage {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 12px;
	position: relative;
	min-height: 0;
}

.floating-panel {
	display: flex; flex-direction: column; align-items: center; gap: 0;
	padding: 8px 12px;
	background: var(--bg-deep);
	border-top: 1px solid var(--border-subtle);
}

.stage {
	position: relative;
	width: min(96vw, calc((100vh - 210px) * 0.75));
	height: min(calc(100vh - 210px), calc(96vw * 1.3333));
	max-width: 100%; max-height: 100%;
	background-color: var(--bg-abyss);
	background-image:
		linear-gradient(45deg, rgba(232, 168, 48, 0.03) 25%, transparent 25%),
		linear-gradient(-45deg, rgba(232, 168, 48, 0.03) 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, rgba(232, 168, 48, 0.03) 75%),
		linear-gradient(-45deg, transparent 75%, rgba(232, 168, 48, 0.03) 75%);
	background-size: 36px 36px;
	background-position: 0 0, 0 18px, 18px -18px, -18px 0;
	border: 1px solid var(--border-subtle);
	border-radius: 12px;
	overflow: hidden;
}

#editorCanvas {
	width: 100%; height: 100%;
	max-width: 100%; max-height: 100%;
	touch-action: none;
	image-rendering: crisp-edges;
}

.panel-content {
	width: 100%; display: flex; flex-direction: column; align-items: center; gap: 6px;
}

.floating-row {
	display: flex; align-items: center; justify-content: center;
	gap: 4px; flex-wrap: nowrap;
}

.floating-actions { justify-content: center; }

.floating-row {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	flex-wrap: nowrap;
}

.floating-actions {
	justify-content: center;
}

.editor-expand-row {
	width: min(100%, 760px);
	padding: 8px;
	border-radius: 12px;
	background: rgba(255, 255, 255, 0.045);
	border: 1px solid rgba(255, 255, 255, 0.08);
	gap: 10px;
}

.editor-expand-title {
	flex: 0 0 auto;
	padding: 0 2px;
	color: rgba(245, 245, 245, 0.72);
	font-size: 13px;
	line-height: 34px;
}

.editor-expand-grid {
	flex: 1 1 auto;
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: 6px;
	min-width: 0;
}

.editor-expand-field {
	min-width: 0;
	height: 34px;
	display: grid;
	grid-template-columns: 16px 28px minmax(34px, 1fr) 12px 28px;
	align-items: center;
	gap: 4px;
	padding: 0 6px;
	border-radius: 10px;
	background: rgba(7, 12, 22, 0.78);
	border: 1px solid rgba(255, 255, 255, 0.08);
}

.editor-expand-field span,
.editor-expand-field em {
	color: rgba(245, 245, 245, 0.58);
	font-size: 12px;
	font-style: normal;
	text-align: center;
}

.editor-expand-step-btn {
	width: 28px;
	height: 26px;
	border-radius: 8px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	background: rgba(255, 255, 255, 0.05);
	color: var(--text-warm);
	font-size: 16px;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background 0.2s ease, border-color 0.2s ease, transform 0.15s ease;
}

.editor-expand-step-btn:hover:not(:disabled) {
	background: rgba(232, 168, 48, 0.22);
	border-color: rgba(232, 168, 48, 0.45);
}

.editor-expand-step-btn:active:not(:disabled) {
	transform: scale(0.94);
}

.editor-expand-step-btn:disabled {
	opacity: 0.42;
	cursor: not-allowed;
}

.editor-expand-input {
	min-width: 0;
	width: 100%;
	height: 26px;
	padding: 0 4px;
	border: 0;
	border-radius: 8px;
	background: rgba(255, 255, 255, 0.07);
	color: var(--text-warm);
	font-size: 12px;
	text-align: center;
	appearance: textfield;
	-moz-appearance: textfield;
}

.editor-expand-input::-webkit-inner-spin-button,
.editor-expand-input::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.editor-expand-input:focus {
	outline: none;
	box-shadow: 0 0 0 2px rgba(232, 168, 48, 0.24);
}

.editor-expand-apply-btn {
	flex: 0 0 42px;
	min-width: 42px;
	height: 34px;
	border-radius: 10px;
	font-size: 17px;
}

#doodleControls {
	display: inline-flex;
	align-items: center;
	gap: 8px;
}

#doodleColorInput {
	appearance: none;
	-webkit-appearance: none;
	width: 28px;
	height: 28px;
	padding: 0;
	border-radius: 10px;
	border: 1px solid rgba(255, 255, 255, 0.16);
	background: rgba(255, 255, 255, 0.05);
	cursor: pointer;
}

#doodleColorInput::-webkit-color-swatch-wrapper {
	padding: 4px;
	border-radius: 10px;
}

#doodleColorInput::-webkit-color-swatch,
#doodleColorInput::-moz-color-swatch {
	border: none;
	border-radius: 8px;
}

@media (max-width: 720px) {
	.stage {
		width: min(96vw, calc((100vh - 250px) * 0.75));
		height: min(calc(100vh - 250px), calc(96vw * 1.3333));
	}

	.editor-expand-row {
		align-items: stretch;
	}

	.editor-expand-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

@media (max-width: 430px) {
	.floating-panel {
		padding: 8px;
	}

	.editor-expand-row {
		gap: 6px;
	}

	.editor-expand-title {
		display: none;
	}

	.editor-expand-field {
		grid-template-columns: 14px 24px minmax(30px, 1fr) 10px 24px;
		padding: 0 4px;
	}

	.editor-expand-step-btn {
		width: 24px;
	}

	.editor-expand-apply-btn {
		flex-basis: 36px;
		min-width: 36px;
	}
}

/* Workbench refresh v1.0.5 */
:root {
	--bg: var(--bg-abyss);
	--panel: var(--bg-deep);
	--panel-strong: rgba(25, 30, 38, 0.96);
	--line: var(--border-subtle);
	--line-strong: var(--border-gold);
	--text: var(--text-warm);
	--muted: var(--text-muted);
	--faint: var(--text-dim);
	--accent: var(--gold);
	--accent-strong: var(--gold-bright);
	--accent-soft: var(--gold-glow);
	--warn: #f0b35a;
	--danger: #ef767a;
	--ok: #7dd39f;
	--radius: 8px;
	--shadow: 0 18px 48px rgba(0, 0, 0, 0.34);
}

html,
body {
	background:
		linear-gradient(135deg, rgba(79, 185, 198, 0.09), transparent 28%),
		linear-gradient(180deg, var(--bg-deep) 0%, var(--bg) 52%, var(--bg-abyss) 100%);
	color: var(--text);
	font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
}

body,
button,
input,
textarea {
	font-family: "Segoe UI", "Microsoft YaHei UI", "PingFang SC", sans-serif;
}

body {
	padding: max(12px, env(safe-area-inset-top), var(--tg-safe-top, 0px)) 12px max(18px, env(safe-area-inset-bottom), var(--tg-safe-bottom, 0px));
}

.app {
	max-width: 1120px;
	margin: 0 auto;
	padding: 18px 0 28px;
	gap: 16px;
	min-height: 100dvh;
}

.app-nav {
	position: sticky;
	top: 8px;
	z-index: 20;
	width: fit-content;
	padding: 5px;
	gap: 4px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: rgba(8, 11, 16, 0.76);
	backdrop-filter: blur(14px);
	box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
}

.nav-btn {
	height: 36px;
	padding: 0 16px;
	border-radius: 6px;
	background: transparent;
	border: 1px solid transparent;
	color: var(--muted);
	font-size: 13px;
	font-weight: 650;
}

.nav-btn:hover {
	background: rgba(232, 168, 48, 0.06);
	border-color: var(--line);
}

.nav-btn.active {
	background: var(--accent-soft);
	border-color: rgba(79, 185, 198, 0.42);
	color: var(--accent-strong);
}

.app-main {
	display: flex;
	min-height: 0;
}

.app-page.active {
	width: 100%;
	gap: 14px;
}

#editorPage.app-page.active {
	align-items: stretch;
}

#editorPage .preview-card {
	width: min(100%, 560px);
	align-self: center;
}

#promptPage .prompt-card {
	width: min(100%, 960px);
}

.preview-card,
.prompt-card {
	border-radius: var(--radius);
	border-color: var(--line);
	background: var(--panel);
	box-shadow: var(--shadow);
	padding: 14px;
	gap: 14px;
}

.preview-card {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
}

.preview-frame {
	aspect-ratio: 4 / 5;
	border-radius: var(--radius);
	border-color: var(--line-strong);
	background:
		linear-gradient(45deg, rgba(255, 255, 255, 0.045) 25%, transparent 25%),
		linear-gradient(-45deg, rgba(255, 255, 255, 0.045) 25%, transparent 25%),
		linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.045) 75%),
		linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.045) 75%),
		var(--bg-abyss);
	background-size: 34px 34px;
	background-position: 0 0, 0 17px, 17px -17px, -17px 0;
}

.preview-placeholder {
	color: var(--faint);
	font-size: 15px;
}

.preview-placeholder-content p {
	padding: 10px 14px;
	border: 1px dashed var(--line-strong);
	border-radius: var(--radius);
	background: rgba(255, 255, 255, 0.04);
}

.preview-upload-btn,
.preview-edit-button,
.action-btn,
.prompt-save-btn,
.prompt-tab-btn,
.prompt-option-btn,
.prompt-toggle-btn,
.queue-preset-pill,
.tool-btn,
.editor-expand-step-btn,
.queue-submit-tray-retry {
	border-radius: var(--radius);
}

.preview-upload-btn {
	top: 10px;
	left: 10px;
	height: 36px;
	padding: 0 13px;
	background: rgba(8, 11, 16, 0.72);
	border-color: var(--line-strong);
	backdrop-filter: blur(10px);
}

.preview-upload-btn:hover {
	background: var(--accent-soft);
	border-color: rgba(79, 185, 198, 0.5);
}

.preview-edit-button {
	inset: auto 12px 12px;
	height: 42px;
	background: rgba(8, 11, 16, 0.78);
	border-color: rgba(79, 185, 198, 0.35);
	backdrop-filter: blur(12px);
	font-weight: 700;
}

.preview-edit-button:hover:not(:disabled) {
	background: rgba(79, 185, 198, 0.22);
	border-color: rgba(232, 168, 48, 0.5);
}

.action-btn {
	height: 42px;
	border-color: var(--line-strong);
	background: rgba(232, 168, 48, 0.05);
	color: var(--text);
	font-weight: 650;
}

.action-btn:hover:not(:disabled) {
	background: var(--gold-glow);
	border-color: rgba(79, 185, 198, 0.5);
}

.action-btn.primary,
.tool-btn.primary {
	background: var(--accent);
	color: #1a1a12;
	border-color: transparent;
}

.action-btn.primary:hover:not(:disabled),
.tool-btn.primary:hover {
	background: var(--accent-strong);
}

.queue-submit-section {
	margin-top: 0;
	padding: 0;
	background: transparent;
	border: 0;
	border-radius: 0;
	display: grid;
	gap: 10px;
}

.queue-preset-list {
	border-color: var(--line);
	background: rgba(232, 168, 48, 0.03);
}

.queue-preset-pill {
	border-color: var(--line);
	color: var(--muted);
	font-weight: 650;
}

.queue-preset-pill:hover {
	background: rgba(232, 168, 48, 0.08);
	border-color: rgba(232, 168, 48, 0.15);
}

.queue-preset-pill.selected {
	background: var(--accent-soft);
	border-color: rgba(232, 168, 48, 0.45);
	color: var(--accent-strong);
}

.queue-submit-status {
	margin-top: 0;
	color: var(--muted);
}

.queue-submit-status.success {
	color: var(--ok);
}

.queue-submit-status.error {
	color: var(--danger);
}

.queue-submit-tray {
	bottom: max(14px, env(safe-area-inset-bottom));
	width: min(calc(100% - 24px), 460px);
}

.queue-submit-tray-inner {
	min-height: 46px;
	border-color: var(--line-strong);
	border-radius: var(--radius);
	background: rgba(10, 14, 20, 0.9);
	box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
}

.queue-submit-tray-title {
	font-weight: 700;
}

.queue-submit-tray.submitted .queue-submit-tray-status {
	color: var(--ok);
}

.queue-submit-tray.failed .queue-submit-tray-status {
	color: var(--danger);
}

.prompt-card {
	padding: 16px;
}

.card-header h2,
.section-title,
.prompt-group-title,
.prompt-optional-header {
	color: var(--text);
	font-weight: 750;
}

.prompt-output-fields {
	grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
	align-items: start;
}

.prompt-output-fields > .form-field:not(.output-field),
.prompt-output-fields > .prompt-actions {
	grid-column: 1 / -1;
}

.prompt-save-section,
.prompt-group,
.prompt-optional-panel,
.prompt-category-accordion {
	border-radius: var(--radius);
	border-color: var(--line);
	background: rgba(10, 14, 20, 0.54);
}

.prompt-save-list {
	border-radius: var(--radius);
	background: rgba(232, 168, 48, 0.03);
}

.prompt-save-slot {
	padding: 8px 12px;
	font-size: 12px;
}

.prompt-save-slot.active {
	background: rgba(232, 168, 48, 0.12);
}

.prompt-category-header {
	border-radius: var(--radius);
	background: rgba(20, 25, 33, 0.96);
}

.prompt-category-header:hover {
	background: rgba(27, 34, 44, 0.96);
}

.prompt-option-btn,
.prompt-toggle-btn {
	min-height: 30px;
	background: rgba(232, 168, 48, 0.04);
	border-color: var(--line);
	font-size: 11px;
}

.prompt-option-btn.active,
.prompt-toggle-btn.active,
.prompt-tab-btn.active {
	background: var(--accent-soft);
	border-color: rgba(232, 168, 48, 0.5);
	color: var(--accent-strong);
}

.prompt-search-input,
textarea,
.offset-step-input,
.editor-expand-input {
	border-radius: var(--radius);
	border-color: var(--line);
	background: rgba(7, 10, 15, 0.82);
	color: var(--text);
}

.prompt-search-input:focus,
textarea:focus,
.offset-step-input:focus,
.editor-expand-input:focus {
	outline: none;
	border-color: rgba(232, 168, 48, 0.5);
	box-shadow: 0 0 0 2px var(--gold-glow);
}

.prompt-divider {
	margin: 10px 0;
	background: var(--line);
}

.app-version {
	margin-top: 0;
	color: var(--faint);
}

.editor-overlay {
	background: rgba(5, 8, 12, 0.94);
	backdrop-filter: blur(8px);
}

.editor-wrapper {
	background: var(--bg-abyss);
}

.editor-stage {
	padding: 16px 16px 8px;
}

.stage {
	width: min(94vw, calc((100dvh - 190px) * 0.78));
	height: min(calc(100dvh - 190px), calc(94vw * 1.282));
	border-radius: var(--radius);
	border-color: rgba(79, 185, 198, 0.24);
	background-color: var(--bg-abyss);
	box-shadow: 0 22px 70px rgba(0, 0, 0, 0.48);
}

.floating-panel {
	position: relative;
	padding: 10px 12px max(10px, env(safe-area-inset-bottom));
	background: rgba(9, 13, 19, 0.94);
	border-top-color: var(--line);
	backdrop-filter: blur(16px);
}

.panel-content {
	gap: 8px;
}

.floating-row {
	gap: 7px;
}

.tool-btn {
	min-width: 42px;
	height: 42px;
	border-color: var(--line-strong);
	background: rgba(232, 168, 48, 0.05);
	font-size: 18px;
}

.tool-btn:hover:not(:disabled) {
	border-color: rgba(232, 168, 48, 0.4);
	background: rgba(79, 185, 198, 0.15);
}

.tool-btn.active {
	background: var(--accent);
	color: #1a1a12;
}

.editor-expand-row {
	width: min(100%, 820px);
	padding: 7px;
	border-radius: var(--radius);
	background: rgba(232, 168, 48, 0.03);
	border-color: var(--line);
}

.editor-expand-title {
	font-weight: 750;
	color: var(--muted);
}

.editor-expand-field {
	height: 34px;
	border-radius: var(--radius);
	background: rgba(7, 10, 15, 0.76);
	border-color: var(--line);
}

.editor-expand-step-btn {
	background: rgba(232, 168, 48, 0.05);
	border-color: var(--line);
	color: var(--text);
}

.editor-expand-step-btn:hover:not(:disabled) {
	background: var(--gold-glow);
	border-color: rgba(232, 168, 48, 0.4);
}

.slider::-webkit-slider-thumb {
	background: var(--accent);
	box-shadow: 0 0 0 5px rgba(232, 168, 48, 0.12);
}

.slider::-moz-range-thumb {
	background: var(--accent);
	box-shadow: 0 0 0 5px rgba(232, 168, 48, 0.12);
}

.zoom-indicator {
	border-radius: var(--radius);
	border-color: var(--line);
	background: rgba(232, 168, 48, 0.04);
	color: var(--muted);
}

.editor-edge-controls {
	position: absolute;
	inset: 0;
	pointer-events: none;
	z-index: 8;
	opacity: 0;
	transition: opacity 0.18s ease;
}

.editor-edge-mode .editor-edge-controls {
	opacity: 1;
}

.editor-edge-handle {
	position: absolute;
	pointer-events: none;
	border: 0;
	background: var(--gold-glow);
	opacity: 0.72;
	cursor: grab;
	touch-action: none;
	transition: opacity 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.editor-edge-mode .editor-edge-handle {
	pointer-events: auto;
}

.editor-edge-handle::after {
	content: "";
	position: absolute;
	inset: 50% auto auto 50%;
	width: 34px;
	height: 5px;
	border-radius: 999px;
	background: rgba(232, 168, 48, 0.7);
	transform: translate(-50%, -50%);
}

.editor-edge-handle::before {
	content: "";
	position: absolute;
	inset: 50% auto auto 50%;
	width: 9px;
	height: 9px;
	border-left: 2px solid rgba(232, 168, 48, 0.75);
	border-bottom: 2px solid rgba(232, 168, 48, 0.75);
	transform: translate(-50%, -50%) rotate(-45deg);
}

.editor-edge-handle:hover,
.editor-edge-handle.dragging {
	opacity: 1;
	background: rgba(79, 185, 198, 0.24);
}

.editor-edge-handle.dragging {
	cursor: grabbing;
}

.editor-edge-handle-top,
.editor-edge-handle-bottom {
	left: 50%;
	width: min(260px, 52vw);
	height: 18px;
	transform: translateX(-50%);
}

.editor-edge-handle-top {
	top: 0;
	border-radius: 0 0 var(--radius) var(--radius);
}

.editor-edge-handle-top::before {
	transform: translate(-50%, -35%) rotate(-45deg);
}

.editor-edge-handle-bottom {
	bottom: 0;
	border-radius: var(--radius) var(--radius) 0 0;
}

.editor-edge-handle-bottom::before {
	transform: translate(-50%, -65%) rotate(135deg);
}

.editor-edge-handle-left,
.editor-edge-handle-right {
	top: 50%;
	width: 18px;
	height: min(260px, 44dvh);
	transform: translateY(-50%);
}

.editor-edge-handle-left::after,
.editor-edge-handle-right::after {
	width: 5px;
	height: 34px;
}

.editor-edge-handle-left {
	left: 0;
	border-radius: 0 var(--radius) var(--radius) 0;
}

.editor-edge-handle-left::before {
	transform: translate(-35%, -50%) rotate(-135deg);
}

.editor-edge-handle-right {
	right: 0;
	border-radius: var(--radius) 0 0 var(--radius);
}

.editor-edge-handle-right::before {
	transform: translate(-65%, -50%) rotate(45deg);
}

.editor-edge-dragging,
.editor-edge-dragging * {
	cursor: grabbing !important;
	user-select: none;
}

.editor-edge-mode-btn {
	flex: 0 0 auto;
	height: 34px;
	min-width: 58px;
	padding: 0 10px;
	border-radius: var(--radius);
	border: 1px solid var(--line);
	background: rgba(232, 168, 48, 0.05);
	color: var(--muted);
	font-size: 12px;
	font-weight: 750;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.floating-row:not(.editor-expand-row) .editor-edge-mode-btn {
	height: 44px;
	min-width: 56px;
	padding: 0 12px;
	border-radius: 12px;
	border: 1px solid rgba(255, 255, 255, 0.16);
	background: rgba(255, 255, 255, 0.05);
	color: var(--text-warm);
	font-size: 14px;
	font-weight: 700;
	transition: transform 0.15s ease, background 0.2s ease, border 0.2s ease;
}

.floating-row:not(.editor-expand-row) .editor-edge-mode-btn:active {
	transform: scale(0.96);
}

.floating-row:not(.editor-expand-row) .editor-edge-mode-btn.active {
	background: var(--gold);
	border-color: transparent;
	color: var(--text-warm);
}

.editor-expand-reset-btn {
	flex: 0 0 34px;
	width: 34px;
	height: 34px;
	border-radius: var(--radius);
	border: 1px solid var(--line);
	background: rgba(232, 168, 48, 0.05);
	color: var(--muted);
	font-size: 17px;
	font-weight: 800;
	cursor: pointer;
	-webkit-tap-highlight-color: transparent;
}

.editor-expand-reset-btn:hover {
	background: var(--gold-glow);
	border-color: rgba(232, 168, 48, 0.4);
	color: var(--text);
}

@media (min-width: 980px) {
	.preview-card {
		grid-template-columns: minmax(360px, 1fr) minmax(220px, 0.56fr);
		align-items: stretch;
		width: min(100%, 860px) !important;
	}

	.queue-submit-section {
		align-self: stretch;
		align-content: end;
		padding-left: 4px;
	}
}

@media (max-width: 768px) {
	body {
		padding-left: 10px;
		padding-right: 10px;
	}

	.app {
		padding-top: 10px;
		gap: 12px;
	}

	.app-nav {
		width: 100%;
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.preview-card,
	.prompt-card {
		padding: 10px;
		gap: 10px;
	}

	.prompt-output-fields {
		grid-template-columns: 1fr;
	}

	.queue-preset-list {
		margin-bottom: 8px;
	}

	.editor-stage {
		padding: 12px 10px 6px;
	}

	.stage {
		width: min(96vw, calc((100dvh - 235px) * 0.78));
		height: min(calc(100dvh - 235px), calc(96vw * 1.282));
	}

	.floating-panel {
		padding: 8px 8px max(8px, env(safe-area-inset-bottom));
	}

	.floating-row:first-child {
		display: grid;
		grid-template-columns: repeat(auto-fit, minmax(44px, 1fr));
		width: 100%;
	}

	.tool-btn {
		min-width: 38px;
		height: 40px;
		font-size: 17px;
	}

	.editor-edge-handle-top,
	.editor-edge-handle-bottom {
		width: min(320px, 72vw);
		height: 44px;
	}

	.editor-edge-handle-left,
	.editor-edge-handle-right {
		width: 44px;
		height: min(320px, 54dvh);
	}
}

@media (max-width: 460px) {
	.queue-preset-list {
		margin-bottom: 6px;
	}

	.editor-expand-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.editor-expand-row {
		align-items: stretch;
	}

	.floating-actions {
		width: 100%;
	}
}

/* Fullscreen safe-area fix. */
:root {
	--app-safe-top: max(12px, env(safe-area-inset-top), var(--tg-safe-area-top, 0px), var(--tg-safe-top, 0px));
	--app-safe-bottom: max(10px, env(safe-area-inset-bottom), var(--tg-safe-area-bottom, 0px), var(--tg-safe-bottom, 0px));
	--app-safe-x: max(10px, env(safe-area-inset-left), env(safe-area-inset-right));
	--app-top-gap: 10px;
	--editor-reserved-height: calc(var(--app-safe-top) + var(--app-safe-bottom) + 210px);
}

body {
	padding: calc(var(--app-safe-top) + var(--app-top-gap)) var(--app-safe-x) calc(var(--app-safe-bottom) + 8px);
}

.app {
	padding-top: 0;
	padding-left: 0;
	padding-right: 0;
	min-height: calc(100dvh - var(--app-safe-top) - var(--app-safe-bottom) - var(--app-top-gap));
}

.app-tab-bar {
	padding-bottom: calc(6px + var(--app-safe-bottom));
}

.app-main {
	padding-bottom: calc(72px + var(--app-safe-bottom));
}

.queue-submit-tray {
	bottom: calc(14px + var(--app-safe-bottom));
}

.editor-overlay {
	padding-top: var(--app-safe-top);
	padding-left: env(safe-area-inset-left);
	padding-right: env(safe-area-inset-right);
}

.editor-wrapper {
	height: calc(100dvh - var(--app-safe-top));
}

.editor-stage {
	padding-top: 14px;
}

.stage {
	width: min(94vw, calc((100dvh - var(--editor-reserved-height)) * 0.78));
	height: min(calc(100dvh - var(--editor-reserved-height)), calc(94vw * 1.282));
}

.floating-panel {
	padding-bottom: calc(10px + var(--app-safe-bottom));
}

@media (max-width: 768px) {
	body {
		padding-top: calc(var(--app-safe-top) + 8px);
		padding-left: max(10px, env(safe-area-inset-left));
		padding-right: max(10px, env(safe-area-inset-right));
	}

	.app {
		padding-top: 0;
	}

	.stage {
		width: min(96vw, calc((100dvh - var(--editor-reserved-height) - 28px) * 0.78));
		height: min(calc(100dvh - var(--editor-reserved-height) - 28px), calc(96vw * 1.282));
	}

	.floating-panel {
		padding-bottom: calc(8px + var(--app-safe-bottom));
	}
}
#relaySubmitButton[hidden] {
    display: none;
}
