:root {
	--bg-color: #121212;
	--surface-color: #1e1e1e;
	--primary-color: #8a63f5;
	--primary-hover-color: #a081f7;
	--text-color: #e0e0e0;
	--text-secondary-color: #a0a0a0;
	--border-color: #333333;
	--error-color: #ff5252;
	--success-color: #4caf50;
	--header-height: 60px;
	--footer-height: 80px;
}
*, *::before, *::after {
	box-sizing: border-box;
}
html, body {
	height: 100%;
}
body {
	font-family: 'Inter', sans-serif;
	background-color: var(--bg-color);
	color: var(--text-color);
	margin: 0;
	font-size: 16px;
	line-height: 1.5;
	overflow: hidden;
}
body.no-scroll {
	overflow: hidden !important;
}
.container {
	display: flex;
	flex-direction: column;
	height: 100vh;
	max-width: 1600px;
	margin: 0 auto;
}
h1, h2, p {
	margin: 0;
}
h2 {
	font-size: 1.25rem;
	padding-bottom: 0.75rem;
	margin-bottom: 1.5rem;
	border-bottom: 1px solid var(--border-color);
	flex-shrink: 0;
}
.hidden {
	display: none !important;
}
header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 0 1.5rem;
	height: var(--header-height);
	background-color: var(--surface-color);
	border-bottom: 1px solid var(--border-color);
	flex-shrink: 0;
}
header h1 {
	font-size: 1.5rem;
	color: var(--primary-color);
}
.logout-link {
	color: var(--text-secondary-color);
	text-decoration: none;
	padding: 0.5rem 1rem;
	border-radius: 8px;
	transition: color 0.2s, background-color 0.2s;
}
.logout-link:hover {
	color: var(--text-color);
	background-color: var(--border-color);
}
.action-bar {
	flex-shrink: 0;
	display: flex;
	gap: 1rem;
	padding: 1rem 1.5rem;
	height: var(--footer-height);
	background-color: var(--surface-color);
	border-top: 1px solid var(--border-color);
	align-items: center;
}
.main-content {
	flex-grow: 1;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.5rem;
	padding: 1.5rem;
	overflow: hidden;
}
.controls-panel, .result-panel {
	background-color: var(--surface-color);
	border-radius: 12px;
	padding: 0.8rem;
	border: 1px solid var(--border-color);
	display: flex;
	flex-direction: column;
	overflow: hidden;
}
#generation-form {
	display: flex;
	flex-direction: column;
	flex-grow: 1;
	overflow-y: auto;
	padding-right: 5px;
}
.form-group, .fieldset {
	margin-bottom: 1.5rem;
}
label:not(.drop-zone-wrapper) {
	display: block;
	font-weight: 500;
	margin-bottom: 0.5rem;
	color: var(--text-secondary-color);
	font-size: 0.9rem;
}
input[type="text"], input[type="password"], textarea, select {
	width: 100%;
	padding: 0.75rem;
	background-color: var(--bg-color);
	border: 1px solid var(--border-color);
	border-radius: 8px;
	color: var(--text-color);
	font-size: 1rem;
	font-family: inherit;
}
textarea:focus, select:focus {
	outline: none;
	border-color: var(--primary-color);
	box-shadow: 0 0 0 2px rgba(138, 99, 245, 0.4);
}
textarea {
	resize: vertical;
	min-height: 80px;
}
.radio-group {
	display: flex;
	gap: 1rem;
}
.radio-group label {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-weight: 400;
	color: var(--text-color);
}
input[type="radio"] {
	accent-color: var(--primary-color);
}
.prompt-actions {
	display: flex;
	gap: 0.5rem;
	margin-top: 0.75rem;
}
.secondary-button {
	padding: 0.5rem 1rem;
	background-color: var(--border-color);
	border: none;
	color: var(--text-color);
	border-radius: 8px;
	cursor: pointer;
	transition: background-color 0.2s;
	font-size: 0.9rem;
}
#clear-prompt-btn {
	padding: 0.5rem;
	width: 36px;
	font-size: 1.2rem;
	line-height: 1;
}
.secondary-button:hover:not(:disabled) {
	background-color: #444;
}
.secondary-button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}
.clear-all-button {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0.5rem;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
}
.clear-all-button svg {
	fill: var(--text-secondary-color);
	transition: fill 0.2s;
}
.clear-all-button:hover svg {
	fill: var(--text-color);
}
.submit-button {
	flex-grow: 1;
	height: 100%;
	padding: 0 1.5rem;
	border: none;
	border-radius: 8px;
	font-size: 1rem;
	font-weight: 700;
	cursor: pointer;
	background-color: var(--primary-color);
	color: white;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	transition: background-color 0.2s;
	min-height: 40px;
}
.submit-button:hover:not(:disabled) {
	background-color: var(--primary-hover-color);
}
.submit-button:disabled {
	background-color: #555;
	cursor: not-allowed;
}
.drop-zone-wrapper {
	display: block;
	cursor: pointer;
}
.drop-zone {
	border: 2px dashed var(--border-color);
	border-radius: 8px;
	padding: 1rem;
	transition: all 0.2s;
	position: relative;
	min-height: 120px;
	background-color: var(--bg-color);
}
.drop-zone-wrapper:hover .drop-zone {
	border-color: var(--primary-color);
}
.drop-zone.dragging-over {
	border-color: var(--primary-color);
	background-color: rgba(138, 99, 245, 0.1);
}
.drop-zone-prompt {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	color: var(--text-secondary-color);
	position: absolute;
	inset: 0;
	transition: opacity 0.2s;
}
.drop-zone-prompt small {
	font-size: 0.8rem;
	max-width: 80%;
}
.drop-zone.has-files .drop-zone-prompt {
	opacity: 0;
	pointer-events: none;
}
#preview-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
	gap: 0.5rem;
}
.preview-thumbnail {
	position: relative;
	aspect-ratio: 1/1;
	border-radius: 6px;
	overflow: hidden;
}
.preview-thumbnail img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}
.remove-btn {
	position: absolute;
	top: 4px;
	right: 4px;
	background: rgba(0, 0, 0, 0.6);
	color: white;
	border: none;
	border-radius: 50%;
	width: 22px;
	height: 22px;
	font-size: 14px;
	line-height: 22px;
	text-align: center;
	cursor: pointer;
	transition: all 0.2s;
	opacity: 0;
	z-index: 10;
}
.preview-thumbnail:hover .remove-btn {
	opacity: 1;
}
.remove-btn:hover {
	background: var(--error-color);
}
.image-display-area {
	flex-grow: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	min-height: 100px;
}
#result-image {
	cursor: zoom-in;
	max-width: 100%;
	max-height: 100%;
	border-radius: 8px;
	object-fit: contain;
}
.placeholder-text {
	color: var(--text-secondary-color);
	text-align: center;
}
.result-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding-top: 1rem;
	flex-shrink: 0;
}
.cost-info {
	font-size: 0.9rem;
	color: var(--text-secondary-color);
}
.download-button {
	background: none;
	border: none;
	cursor: pointer;
	padding: 0.5rem;
	border-radius: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
}
.download-button svg {
	fill: var(--text-secondary-color);
	transition: fill 0.2s;
}
.download-button:hover svg {
	fill: var(--primary-color);
}
#toast-container {
	position: fixed;
	top: calc(var(--header-height) + 10px);
	right: 20px;
	z-index: 1050;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 10px;
	pointer-events: none;
}
.toast {
	padding: 12px 20px;
	border-radius: 8px;
	color: #fff;
	font-weight: 500;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
	opacity: 0;
	transform: translateX(100%);
	transition: all 0.5s cubic-bezier(0.68, -0.55, 0.27, 1.55);
	pointer-events: auto;
}
.toast.show {
	opacity: 1;
	transform: translateX(0);
}
.toast.error, .toast.success {
	background-color: var(--error-color);
}
.toast.success {
	background-color: var(--success-color);
}
.lightbox {
	position: fixed;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.9);
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 1rem;
	cursor: zoom-out;
}
.close-lightbox {
	position: absolute;
	top: 15px;
	right: 35px;
	color: #f1f1f1;
	font-size: 40px;
	font-weight: bold;
	transition: 0.3s;
	z-index: 1001;
	cursor: pointer;
}
.close-lightbox:hover {
	color: #bbb;
}
.lightbox-content {
	margin: auto;
	display: block;
	max-width: 95%;
	max-height: 95%;
	object-fit: contain;
	cursor: default;
}
#orientation-lock {
	display: none;
}
.spinner {
	width: 20px;
	height: 20px;
	border: 3px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}
@keyframes spin {
	to {
		transform: rotate(360deg);
	}
}
@media (max-width: 900px) {
	:root {
		--footer-height: 60px;
	}
	.main-content {
		display: flex;
		flex-direction: column;
		padding: 0.75rem;
		gap: 0.75rem;
	}
	.result-panel {
		order: 1;
		flex: 0 1 50%;
		min-height: 150px;
	}
	.controls-panel {
		order: 2;
		flex: 1 1 auto;
		overflow-y: auto;
	}
	header {
		height: 50px;
	}
	header h1 {
		font-size: 1rem;
	}
	.controls-panel, .result-panel {
		padding-top: 0.5rem;
	}
	h2 {
		font-size: 1rem;
		padding-bottom: 0.2rem;
		margin-bottom: 0.45rem;
	}
	.form-group, .fieldset {
		margin-bottom: 0.75rem;
	}
	label:not(.drop-zone-wrapper) {
		margin-bottom: 0.25rem;
		font-size: 0.8rem;
	}
	textarea {
		min-height: 60px;
		font-size: 0.9rem;
	}
	select, .radio-group {
		font-size: 0.9rem;
	}
	.drop-zone {
		min-height: 90px;
	}
	.action-bar {
		padding: 0.5rem 0.75rem;
		gap: 0.75rem;
	}
	.submit-button {
		font-size: 1rem;
	}
	#toast-container {
		bottom: calc(var(--footer-height) + 10px);
		width: 90%;
	}
	@media (orientation: landscape) {
		#orientation-lock {
			display: flex;
			position: fixed;
			inset: 0;
			background-color: var(--bg-color);
			color: var(--text-color);
			align-items: center;
			justify-content: center;
			text-align: center;
			z-index: 2000;
		}
		.container {
			display: none;
		}
	}
}