* {
	box-sizing: border-box;
}

:root {
	font-family: 'Inter', sans-serif;
	color: #1f2a44;
	background-color: #f3f4f8;
	font-size: 16px;
	--primary: #6366f1;
	--primary-dark: #4f46e5;
	--surface: rgba(255, 255, 255, 0.92);
	--border: rgba(99, 102, 241, 0.18);
	--shadow: 0 16px 40px rgba(79, 70, 229, 0.18);
}

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	background: linear-gradient(160deg, #eef2ff 0%, #fde1ff 100%);
	padding: 24px 16px 48px;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	-webkit-text-size-adjust: 100%;
}

.app-shell {
	width: 100%;
	max-width: 420px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 24px;
}

.card {
	width: 100%;
	background: var(--surface);
	backdrop-filter: blur(12px);
	border-radius: 28px;
	box-shadow: var(--shadow);
	padding: 26px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 28px;
	text-align: center;
}

.card button,
button {
	font-family: inherit;
}

.card__header {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}

.header__logo {
	width: 100%;
	height: auto;
}

.card__title {
	margin: 0;
	font-size: 1.375rem;
	font-weight: 700;
}

.card__subtitle {
	margin: 0;
	font-size: 0.9375rem;
	color: rgba(31, 42, 68, 0.65);
}

.panel {
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 18px;
}

.panel__title {
	margin: 0;
	font-size: 1.05rem;
	font-weight: 600;
}

.fold-toggle {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 12px 16px;
	border: 1px solid var(--border);
	border-radius: 16px;
	background: rgba(99, 102, 241, 0.08);
	color: var(--primary);
	font-weight: 600;
	font-size: 0.95rem;
	cursor: pointer;
	transition: background 0.2s ease, box-shadow 0.2s ease;
}

.fold-toggle i {
	transition: transform 0.3s ease;
}

.fold-toggle.collapsed i,
.fold-toggle[aria-expanded="false"] i {
	transform: rotate(-90deg);
}

.fold-content {
	width: 100%;
	overflow: hidden;
	transition: max-height 0.35s ease;
}

.fold-content.collapsed {
	max-height: 0 !important;
}

.form-grid {
	display: flex;
	flex-direction: column;
	gap: 18px;
	padding-top: 6px;
}

.input-block {
	display: flex;
	flex-direction: column;
	gap: 8px;
	width: 100%;
	align-items: center;
}

.input-block > * {
	width: 100%;
}

.input__label {
	font-size: 0.85rem;
	font-weight: 600;
	color: rgba(31, 42, 68, 0.7);
}

.text--small {
	font-size: 0.75rem;
	color: rgba(31, 42, 68, 0.55);
}

.relative {
	position: relative;
}

.relative i {
	position: absolute;
	left: 12px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--primary);
}

.icon {
	position: absolute;
	font-size: 0.85rem;
	color: rgba(31, 42, 68, 0.55);
	right: 12px;
	top: 50%;
	transform: translateY(-50%);
}

.input {
	border: 1px solid rgba(99, 102, 241, 0.25);
	border-radius: 14px;
	padding: 11px 14px;
	font-size: 0.95rem;
	background: rgba(255, 255, 255, 0.9);
	color: inherit;
	text-align: center;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.input:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.2);
}

.input:disabled {
	color: rgba(31, 42, 68, 0.4);
}

.input__icon {
	padding-left: 42px;
	padding-right: 36px;
}

.flex {
	display: flex;
}

.flex-1 {
	flex: 1 1 auto;
}

.flex--input {
	gap: 12px;
	align-items: center;
}

.input--left {
	border-top-right-radius: 14px;
	border-bottom-right-radius: 14px;
}

.bttn-group {
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 12px;
	align-items: center;
}

.bttn-group--inline {
	flex-direction: row;
	gap: 0;
	justify-content: center;
}

.bttn-group--inline .bttn {
	max-width: none;
}

.bttn-group__row {
	width: 100%;
	display: flex;
	justify-content: center;
}

.bttn {
	flex: 1;
	padding: 11px 14px;
	background: rgba(99, 102, 241, 0.08);
	border: 1px solid rgba(99, 102, 241, 0.18);
	color: var(--primary);
	font-weight: 600;
	border-radius: 12px;
	cursor: pointer;
	transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
	text-align: center;
}

.bttn.fill {
	max-width: 100%;
}

.bttn.left {
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
}

.bttn.right {
	border-top-left-radius: 0;
	border-bottom-left-radius: 0;
}

.bttn.active {
	background: var(--primary);
	color: #fff;
	box-shadow: 0 12px 20px rgba(99, 102, 241, 0.28);
	border-color: transparent;
}

.bttn:hover {
	background: rgba(99, 102, 241, 0.2);
}

.bttn.active:hover {
	background: var(--primary-dark);
}

.bttn__primary {
	width: 100%;
	padding: 14px 18px;
	border: none;
	border-radius: 18px;
	background: linear-gradient(130deg, var(--primary) 0%, #a855f7 100%);
	color: #fff;
	font-size: 1.05rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	box-shadow: 0 16px 32px rgba(99, 102, 241, 0.35);
	cursor: pointer;
	transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.bttn__primary:active {
	transform: translateY(2px);
	box-shadow: 0 10px 20px rgba(99, 102, 241, 0.3);
}

.is-hidden {
	display: none !important;
}

.preview {
	width: 100%;
	margin: 0;
	padding: 14px;
	border-radius: 18px;
	border: 1px dashed rgba(99, 102, 241, 0.25);
	background: rgba(255, 255, 255, 0.6);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}

#imagePreview {
	width: 100%;
	border-radius: 14px;
	display: none;
	box-shadow: 0 12px 24px rgba(15, 23, 42, 0.18);
}

.preview__caption {
	margin: 0;
	font-size: 0.8rem;
	color: rgba(31, 42, 68, 0.5);
}

.card__footer {
	width: 100%;
}

.result {
	width: 100%;
	max-width: 420px;
	background: var(--surface);
	border-radius: 24px;
	padding: 22px;
	box-shadow: var(--shadow);
	display: none;
	flex-direction: column;
	align-items: center;
	gap: 16px;
	text-align: center;
}

.result__header {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
}

.headline {
	margin: 0;
	font-size: 1.2rem;
	font-weight: 700;
}

.result__body {
	width: 100%;
	max-height: 280px;
	overflow-y: auto;
	padding: 16px;
	border-radius: 16px;
	background: rgba(99, 102, 241, 0.08);
	color: rgba(31, 42, 68, 0.9);
	font-family: 'SFMono-Regular', Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace;
	font-size: 0.85rem;
	text-align: left;
	word-break: break-word;
}

.result__body--media {
	padding: 0;
	background: transparent;
	max-height: none;
	font-family: 'Inter', sans-serif;
	text-align: center;
}

.result__body--media > * {
	width: 100%;
}

.result__body--code {
	background: #111827;
	color: #f8fafc;
	box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.15);
}

.result__body--code pre {
	margin: 0;
	white-space: pre-wrap;
}

.result figure {
	margin: 0;
}

.result img {
	width: 100%;
	border-radius: 16px;
}

.result__figure {
	width: 100%;
	display: flex;
	flex-direction: column;
	gap: 12px;
	align-items: center;
}

.result__caption {
	margin: 0;
	font-size: 0.9rem;
	line-height: 1.4;
	color: rgba(31, 42, 68, 0.7);
	text-align: center;
}

#resultContainer.active {
	display: flex;
}

.loader-spinner {
	width: 18px;
	height: 18px;
	border: 3px solid rgba(99, 102, 241, 0.2);
	border-top: 3px solid var(--primary);
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

.loader-progress-wrap {
	width: 100%;
	height: 4px;
	background: rgba(99, 102, 241, 0.18);
	overflow: hidden;
	border-radius: 999px;
}

.loader-progress-bar {
	width: 40%;
	height: 100%;
	background: linear-gradient(90deg, var(--primary), #a855f7);
	animation: progressAnim 1.6s linear infinite;
}

#loadingAnim {
	width: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 12px;
}

#loadingAnim span {
	font-weight: 600;
}

@keyframes spin {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

@keyframes progressAnim {
	0% {
		margin-left: -40%;
	}
	100% {
		margin-left: 100%;
	}
}
