/* SyntVision Image Editor — branded fullscreen shell */

:root {
	--sv-bg: #071018;
	--sv-bg-2: #0d1a24;
	--sv-panel: #101e2a;
	--sv-line: rgba(255, 255, 255, 0.08);
	--sv-text: #eef5fa;
	--sv-muted: #8aa0b2;
	--sv-blue: #0a86bf;
	--sv-blue-2: #0c9ad9;
	--sv-red: #d61f2b;
	--sv-radius: 12px;
	--sv-font: "Outfit", "Segoe UI", sans-serif;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	height: 100%;
	background: var(--sv-bg);
	color: var(--sv-text);
	font-family: var(--sv-font);
}

.sv-editor-body {
	overflow: hidden;
}

.sv-editor {
	display: flex;
	flex-direction: column;
	height: 100vh;
	height: 100dvh;
	background:
		radial-gradient(900px 420px at 12% -10%, rgba(10, 134, 191, 0.22), transparent 60%),
		radial-gradient(700px 380px at 90% 0%, rgba(214, 31, 43, 0.14), transparent 55%),
		linear-gradient(180deg, #0a141d 0%, #071018 100%);
}

.sv-editor__top {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	gap: 12px;
	padding: 10px 14px;
	border-bottom: 1px solid var(--sv-line);
	background: rgba(7, 16, 24, 0.72);
	backdrop-filter: blur(10px);
	z-index: 5;
}

.sv-editor__brand {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.sv-editor__mark {
	width: 18px;
	height: 18px;
	border-radius: 5px;
	background: linear-gradient(135deg, var(--sv-blue), var(--sv-red));
	box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.sv-editor__name {
	font-weight: 700;
	letter-spacing: 0.02em;
	font-size: 1.05rem;
}

.sv-editor__badge {
	font-size: 0.72rem;
	font-weight: 600;
	color: var(--sv-blue-2);
	border: 1px solid rgba(10, 134, 191, 0.45);
	border-radius: 999px;
	padding: 2px 8px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

.sv-editor__history,
.sv-editor__actions {
	display: flex;
	align-items: center;
	gap: 8px;
}

.sv-editor__actions {
	justify-content: flex-end;
}

.sv-editor__icon-btn,
.sv-editor__btn,
.sv-tool,
.sv-filter-chip {
	font-family: inherit;
	cursor: pointer;
	border: 1px solid var(--sv-line);
	background: rgba(255, 255, 255, 0.03);
	color: var(--sv-text);
}

.sv-editor__icon-btn {
	width: 36px;
	height: 36px;
	border-radius: 10px;
	font-size: 1.1rem;
	line-height: 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
}

.sv-editor__icon-btn:hover,
.sv-editor__btn:hover,
.sv-tool:hover,
.sv-filter-chip:hover {
	border-color: rgba(10, 134, 191, 0.55);
	background: rgba(10, 134, 191, 0.12);
}

.sv-editor__icon-btn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.sv-editor__btn {
	border-radius: 10px;
	padding: 9px 14px;
	font-weight: 600;
	font-size: 0.92rem;
}

.sv-editor__btn--primary {
	background: linear-gradient(180deg, var(--sv-blue-2), var(--sv-blue));
	border-color: transparent;
	color: #fff;
}

.sv-editor__btn--primary:hover {
	filter: brightness(1.06);
	background: linear-gradient(180deg, var(--sv-blue-2), var(--sv-blue));
}

.sv-editor__btn--ghost {
	background: transparent;
}

.sv-editor__btn.is-busy {
	opacity: 0.7;
	pointer-events: none;
}

.sv-editor__close {
	font-size: 1.35rem;
	margin-left: 2px;
}

.sv-editor__main {
	flex: 1;
	min-height: 0;
	display: grid;
	grid-template-columns: minmax(72px, 88px) minmax(0, 1fr) auto;
}

.sv-editor__tools {
	display: flex;
	flex-direction: column;
	justify-content: space-evenly;
	align-items: stretch;
	gap: clamp(2px, 0.55vh, 6px);
	padding: clamp(4px, 0.7vh, 10px) 6px;
	border-right: 1px solid var(--sv-line);
	background: rgba(13, 26, 36, 0.55);
	min-height: 0;
	height: 100%;
	overflow: hidden; /* fit tools in box — no scrollbar by default */
}

.sv-tool {
	display: flex;
	flex: 1 1 0;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: clamp(1px, 0.35vh, 4px);
	min-height: 0;
	padding: clamp(2px, 0.45vh, 8px) 2px;
	border-radius: 10px;
	background: transparent;
}

.sv-tool.is-active {
	background: rgba(10, 134, 191, 0.18);
	border-color: rgba(10, 134, 191, 0.55);
}

.sv-tool__icon {
	font-size: clamp(0.8rem, 1.55vh, 1.05rem);
	line-height: 1;
	flex-shrink: 0;
}

.sv-tool__label {
	font-size: clamp(0.52rem, 1.05vh, 0.65rem);
	color: var(--sv-muted);
	letter-spacing: 0.02em;
	line-height: 1.1;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* Very short viewports: keep icons, drop labels so everything still fits */
@media (max-height: 700px) {
	.sv-tool__label {
		display: none;
	}

	.sv-tool {
		gap: 0;
		padding: clamp(2px, 0.4vh, 6px) 2px;
	}
}

.sv-editor__stage-wrap {
	position: relative;
	min-width: 0;
	min-height: 0;
	display: flex;
	flex-direction: column;
}

.sv-editor__stage {
	position: relative;
	flex: 1;
	min-height: 0;
	margin: 12px;
	border-radius: var(--sv-radius);
	border: 1px solid var(--sv-line);
	background:
		linear-gradient(45deg, #0f1c27 25%, transparent 25%) 0 0 / 20px 20px,
		linear-gradient(-45deg, #0f1c27 25%, transparent 25%) 0 10px / 20px 20px,
		linear-gradient(45deg, transparent 75%, #0f1c27 75%) 10px -10px / 20px 20px,
		linear-gradient(-45deg, transparent 75%, #0f1c27 75%) -10px 0 / 20px 20px,
		#152533;
	overflow: hidden;
}

.sv-editor__stage .canvas-container {
	margin: 0 auto;
}

.sv-editor__loader {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(7, 16, 24, 0.55);
	color: var(--sv-muted);
	font-weight: 500;
	z-index: 2;
}

.sv-editor__loader[hidden] {
	display: none;
}

.sv-editor__zoom {
	position: absolute;
	right: 24px;
	bottom: 24px;
	display: flex;
	gap: 6px;
	z-index: 3;
}

.sv-editor__panel {
	width: min(280px, 86vw);
	border-left: 1px solid var(--sv-line);
	background: rgba(16, 30, 42, 0.92);
	padding: 16px;
	overflow-y: auto;
}

.sv-panel h3 {
	margin: 0 0 8px;
	font-size: 1rem;
}

.sv-panel p {
	margin: 0 0 14px;
	color: var(--sv-muted);
	font-size: 0.88rem;
	line-height: 1.45;
}

.sv-panel__row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.sv-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 14px;
	font-size: 0.85rem;
	color: var(--sv-muted);
}

.sv-field input[type="range"] {
	width: 100%;
	accent-color: var(--sv-blue);
}

.sv-field input[type="color"] {
	width: 100%;
	height: 40px;
	border: 1px solid var(--sv-line);
	border-radius: 8px;
	background: transparent;
	padding: 0;
}

.sv-field select,
.sv-field input[type="number"] {
	width: 100%;
	border-radius: 8px;
	border: 1px solid var(--sv-line);
	background: rgba(255, 255, 255, 0.04);
	color: var(--sv-text);
	padding: 8px 10px;
	font-family: inherit;
	font-size: 0.9rem;
}

.sv-field select option {
	color: #111;
}

.sv-panel-sep {
	border: 0;
	border-top: 1px solid var(--sv-line);
	margin: 12px 0;
}

.sv-histogram {
	width: 100%;
	height: 64px;
	border-radius: 8px;
	background: rgba(0, 0, 0, 0.25);
	margin-bottom: 12px;
	display: block;
}

.sv-draft-list {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin: 12px 0;
	max-height: 180px;
	overflow-y: auto;
}

.sv-draft-row {
	appearance: none;
	border: 1px solid var(--sv-line);
	background: rgba(255, 255, 255, 0.04);
	color: var(--sv-text);
	border-radius: 8px;
	padding: 8px 10px;
	text-align: left;
	cursor: pointer;
	font-family: inherit;
	font-size: 0.82rem;
}

.sv-draft-row:hover {
	border-color: rgba(10, 134, 191, 0.55);
	background: rgba(10, 134, 191, 0.12);
}

.sv-shortcuts {
	font-size: 0.8rem;
	line-height: 1.55;
	color: var(--sv-muted);
}

.sv-filter-chip.is-active {
	border-color: rgba(10, 134, 191, 0.7);
	background: rgba(10, 134, 191, 0.2);
}

.sv-filters {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8px;
}

.sv-filter-chip {
	border-radius: 10px;
	padding: 10px 8px;
	font-size: 0.85rem;
	font-weight: 600;
}

.sv-filter-chip.is-active {
	border-color: rgba(10, 134, 191, 0.7);
	background: rgba(10, 134, 191, 0.2);
}

.sv-editor__toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	transform: translateX(-50%);
	background: #123149;
	border: 1px solid rgba(10, 134, 191, 0.45);
	color: #fff;
	padding: 10px 16px;
	border-radius: 999px;
	font-weight: 600;
	font-size: 0.9rem;
	z-index: 50;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.sv-editor__toast.is-error {
	background: #3a1218;
	border-color: rgba(214, 31, 43, 0.55);
}

.sv-editor__toast[hidden] {
	display: none;
}

.sv-sticker-grid,
.sv-shape-grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 8px;
}

.sv-sticker-chip,
.sv-shape-chip {
	appearance: none;
	border: 1px solid var(--sv-line);
	background: rgba(255, 255, 255, 0.03);
	border-radius: 12px;
	cursor: pointer;
	color: var(--sv-text);
	font-family: inherit;
}

.sv-sticker-chip {
	aspect-ratio: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 8px;
}

.sv-sticker-chip svg {
	width: 70%;
	height: 70%;
	display: block;
}

.sv-sticker-chip--image img {
	width: 78%;
	height: 78%;
	object-fit: contain;
	display: block;
}

.sv-sticker-chip:hover,
.sv-shape-chip:hover {
	border-color: rgba(10, 134, 191, 0.55);
	background: rgba(10, 134, 191, 0.12);
}

.sv-shape-chip {
	padding: 12px 8px;
	font-size: 0.82rem;
	font-weight: 600;
}

.sv-layers {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 12px;
	max-height: min(52vh, 420px);
	overflow-y: auto;
}

.sv-layers__empty {
	margin: 0;
	color: var(--sv-muted);
	font-size: 0.88rem;
}

.sv-layer-row {
	display: grid;
	grid-template-columns: 32px minmax(0, 1fr) 32px;
	gap: 4px;
	align-items: center;
	padding: 4px;
	border-radius: 10px;
	border: 1px solid transparent;
	background: rgba(255, 255, 255, 0.03);
}

.sv-layer-row.is-active {
	border-color: rgba(10, 134, 191, 0.55);
	background: rgba(10, 134, 191, 0.16);
}

.sv-layer-row.is-hidden .sv-layer-row__name {
	opacity: 0.45;
	text-decoration: line-through;
}

.sv-layer-row.is-locked .sv-layer-row__name {
	font-style: italic;
}

.sv-layer-row__name,
.sv-layer-row__btn {
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--sv-text);
	font-family: inherit;
	cursor: pointer;
}

.sv-layer-row__name {
	text-align: left;
	padding: 8px 6px;
	font-size: 0.86rem;
	font-weight: 600;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.sv-layer-row__btn {
	width: 32px;
	height: 32px;
	border-radius: 8px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.sv-layer-row__btn:hover:not(:disabled) {
	background: rgba(10, 134, 191, 0.18);
}

.sv-layer-row__btn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.sv-layers__actions {
	margin-top: 4px;
}

@media (max-width: 860px) {
	.sv-editor__top {
		grid-template-columns: 1fr;
		justify-items: stretch;
	}

	.sv-editor__history {
		order: 3;
	}

	.sv-editor__actions {
		justify-content: stretch;
		flex-wrap: wrap;
	}

	.sv-editor__actions .sv-editor__btn {
		flex: 1;
	}

	.sv-editor__main {
		grid-template-columns: 64px minmax(0, 1fr);
		grid-template-rows: minmax(0, 1fr) auto;
	}

	.sv-editor__panel {
		grid-column: 1 / -1;
		width: 100%;
		border-left: 0;
		border-top: 1px solid var(--sv-line);
		max-height: 38vh;
	}

	.sv-tool__label {
		display: none;
	}

	.sv-sticker-grid {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}
