/* VK Képszerkesztő — self-contained styles (portable). */
:root {
	--ink: #1a1714;
	--panel: #ffffff;
	--bg: #f3efe9;
	--line: rgba(26, 23, 20, 0.14);
	--gold: #b8893b;
	--gold-deep: #946a26;
	--red: rgba(214, 54, 56, 0.34);
	--shadow: 0 18px 50px -28px rgba(26, 23, 20, 0.5);
}

* { box-sizing: border-box; }

/* The [hidden] attribute must always win over the display rules below
   (class selectors like .vkks-overlay{display:flex} otherwise override the
   UA [hidden]{display:none}, leaving the overlay/modal permanently visible). */
[hidden] { display: none !important; }

.vkks-body {
	margin: 0;
	background: var(--bg);
	color: var(--ink);
	font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	-webkit-font-smoothing: antialiased;
}

.vkks-app { min-height: 100vh; display: flex; flex-direction: column; }

.vkks-head {
	height: 60px; display: flex; align-items: center; padding: 0 24px;
	background: var(--panel); border-bottom: 1px solid var(--line);
}
.vkks-logo { font-weight: 700; font-size: 1.15rem; letter-spacing: -0.01em; }
.vkks-crown { color: var(--gold); }

.vkks-main { flex: 1; display: flex; gap: 0; min-height: 0; }

/* Controls */
.vkks-controls {
	width: 300px; flex: 0 0 300px; background: var(--panel);
	border-right: 1px solid var(--line); padding: 24px; display: flex;
	flex-direction: column; gap: 24px; overflow-y: auto;
}
.vkks-ctl-group { display: flex; flex-direction: column; gap: 10px; }
.vkks-ctl-label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: #7a7166; }

.vkks-toggle { display: flex; background: var(--bg); border-radius: 10px; padding: 4px; }
.vkks-toggle-btn { flex: 1; border: 0; background: transparent; padding: 9px; border-radius: 7px; font: inherit; font-weight: 600; cursor: pointer; color: #6b6358; }
.vkks-toggle-btn.is-active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.12); }

.vkks-select { width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; }

.vkks-zoom { display: flex; align-items: center; gap: 10px; }
.vkks-zoom input[type=range] { flex: 1; accent-color: var(--gold-deep); }
.vkks-zoom-btn { width: 40px; height: 40px; border: 1px solid var(--line); background: #fff; border-radius: 10px; font-size: 1.3rem; line-height: 1; cursor: pointer; }
.vkks-zoom-btn:active { background: var(--bg); }

.vkks-ctl-actions { margin-top: auto; gap: 10px; }
.vkks-btn {
	display: inline-flex; align-items: center; justify-content: center;
	background: var(--ink); color: #fff; border: 0; border-radius: 100px;
	padding: 15px 22px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
	transition: background .2s, transform .2s;
}
.vkks-btn:hover { background: var(--gold-deep); }
.vkks-btn:disabled { opacity: .4; cursor: not-allowed; }
.vkks-btn-ghost { background: transparent; border: 1px solid var(--line); border-radius: 100px; padding: 13px 20px; font: inherit; font-weight: 600; cursor: pointer; color: var(--ink); }
.vkks-btn-upload { width: 100%; }

.vkks-hint { font-size: 0.82rem; line-height: 1.5; color: #7a7166; margin: 4px 0 0; }

/* Stage + box */
.vkks-stage { flex: 1; display: flex; align-items: center; justify-content: center; padding: 28px; min-width: 0; }
.vkks-box {
	position: relative; overflow: hidden; background: #ddd6cc;
	box-shadow: var(--shadow); touch-action: none; user-select: none;
	max-width: 100%; max-height: 100%;
}
.vkks-img { position: absolute; top: 0; left: 0; will-change: left, top, width, height; cursor: grab; }
.vkks-box.is-dragging .vkks-img { cursor: grabbing; }

/* Bleed overlay (thickness set by JS) */
.vkks-bleed { position: absolute; background: var(--red); pointer-events: none; z-index: 3; }
.vkks-bleed-top { top: 0; left: 0; right: 0; }
.vkks-bleed-bottom { bottom: 0; left: 0; right: 0; }
.vkks-bleed-left { left: 0; }
.vkks-bleed-right { right: 0; }

/* Safe-area guides (dotted white) */
.vkks-guide { position: absolute; pointer-events: none; z-index: 4; }
.vkks-guide-top, .vkks-guide-bottom { left: 0; right: 0; border-top: 1px dashed rgba(255,255,255,.9); }
.vkks-guide-left, .vkks-guide-right { top: 0; bottom: 0; border-left: 1px dashed rgba(255,255,255,.9); }

/* Empty-state drop zone */
.vkks-drop {
	position: absolute; inset: 0; z-index: 6; display: flex; flex-direction: column;
	align-items: center; justify-content: center; gap: 8px; border: 0; cursor: pointer;
	background: #efe9df; color: #6b6358; font: inherit;
}
.vkks-drop.is-over { background: #e6dccb; color: var(--gold-deep); }
.vkks-drop-icon { font-size: 2.6rem; line-height: 1; }
.vkks-drop-title { font-weight: 700; font-size: 1.1rem; color: var(--ink); }
.vkks-drop-sub { font-size: 0.85rem; }

/* Modal */
.vkks-modal, .vkks-overlay { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; background: rgba(26,23,20,.55); padding: 20px; }
.vkks-modal-card, .vkks-overlay-card { background: #fff; border-radius: 16px; padding: 30px; max-width: 440px; width: 100%; text-align: center; box-shadow: var(--shadow); }
.vkks-modal-title { margin: 0 0 12px; font-size: 1.35rem; color: #b5302f; }
.vkks-modal-text { margin: 0 0 22px; line-height: 1.6; color: var(--ink); }

/* Overlay (loading / result) */
.vkks-overlay-text { margin: 16px 0 0; font-weight: 500; }
.vkks-overlay-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.vkks-spinner { width: 46px; height: 46px; margin: 0 auto; border: 4px solid #e6dccb; border-top-color: var(--gold-deep); border-radius: 50%; animation: vkks-spin .8s linear infinite; }
@keyframes vkks-spin { to { transform: rotate(360deg); } }

/* Mobile */
@media (max-width: 820px) {
	.vkks-main { flex-direction: column-reverse; }
	.vkks-controls { width: 100%; flex: 0 0 auto; flex-direction: row; flex-wrap: wrap; align-items: flex-end; border-right: 0; border-top: 1px solid var(--line); gap: 16px; }
	.vkks-ctl-group { flex: 1 1 130px; }
	.vkks-ctl-actions { flex: 1 1 100%; flex-direction: row; }
	.vkks-ctl-actions .vkks-btn { flex: 1; }
	.vkks-hint { flex: 1 1 100%; }
	.vkks-stage { padding: 16px; }
}
