:root {
	--primary: #4a90e2; --bg: #f1f2f6; --panel: #ffffff; --text: #2f3542;
	--border-light: #e1e4e8; --accent-bg: #f6f8fa;
}

.container {
	display: grid; grid-template-columns: 1fr 1fr; gap: 25px; max-width: 1200px; width: 100%;
	align-items: start;
}
@media (max-width: 850px) { .container { grid-template-columns: 1fr; } }
.border-card { background: var(--panel); padding: 25px; border-radius: 16px; box-shadow: 0 10px 25px rgba(0,0,0,0.1); overflow: hidden; }

.border-card.sticky {
	position: sticky;
	top: 40px;
}

.presets-bar { display: flex; gap: 10px; margin-bottom: 20px; overflow-x: auto; padding-bottom: 5px; }
.preset-card { 
	cursor: pointer; border: 2px solid transparent; border-radius: 8px; transition: 0.2s;
	width: 60px; height: 60px; object-fit: cover; background: #eee;margin-top: 5px;
}
.preset-card:hover { border-color: var(--primary); transform: scale(1.05); }

.workspace-wrapper {
	max-width: 100%; background: #dfe4ea; border: 3px dashed #ced6e0; border-radius: 12px;
	margin-bottom: 20px; overflow: hidden; display: flex; justify-content: center; align-items: center;
	min-height: 300px; /*height: 500px;*/ position: relative; padding: 20px;
}
.slicer-viewport { 
	position: relative; 
	line-height: 0; 
	transition: transform 0.2s ease;
	display: flex;
	align-items: center;
	justify-content: center;
}
#source-img { 
	display: block; 
	background-image: repeating-conic-gradient(#f0f0f0 0% 25%, #fff 0% 50%); 
	background-size: 20px 20px;
	width: 100%;
	height: auto;
	min-height: 300px;
	max-width: 600px;
	max-height: 450px;
	object-fit: contain;
}

.guide { 
	position: absolute; 
	background: rgba(255, 82, 82, 0.6);
	z-index: 10; 
	pointer-events: none;
}

.hor { width: 100%; height: 1px; left: 0; }
.ver { height: 100%; width: 1px; top: 0; }

.guide-handle {
	position: absolute;
	background: rgba(255, 82, 82, 0.9);
	border: 2px solid white;
	box-shadow: 0 2px 8px rgba(0,0,0,0.3);
	z-index: 11;
	pointer-events: all;
	transition: all 0.2s;
	display: flex;
	align-items: center;
	justify-content: center;
}

.guide-handle:hover {
	background: rgba(255, 102, 102, 1);
	transform: scale(1.15);
}

.guide-handle.dragging {
	background: rgba(74, 144, 226, 0.9);
	box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.3), 0 2px 12px rgba(0,0,0,0.4);
	transform: scale(1.2);
}

.guide-handle.horizontal {
	width: 30px;
	height: 10px;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	cursor: ns-resize;
	border-radius: 10px;
}

.guide-handle.vertical {
	width: 10px;
	height: 30px;
	left: 50%;
	top: 50%;
	transform: translate(-50%, -50%);
	cursor: ew-resize;
	border-radius: 10px;
}

.guide-handle.horizontal:hover {
	transform: translate(-50%, -50%) scale(1.15);
}

.guide-handle.vertical:hover {
	transform: translate(-50%, -50%) scale(1.15);
}

.guide-handle.horizontal.dragging {
	transform: translate(-50%, -50%) scale(1.2);
}

.guide-handle.vertical.dragging {
	transform: translate(-50%, -50%) scale(1.2);
}

.handle-icon {
	color: white;
	font-size: 12px;
	font-weight: bold;
	opacity: 0.9;
	pointer-events: none;
}

.guide-badge {
	position: absolute;
	background: rgba(0, 0, 0, 0.85);
	color: white;
	padding: 8px 10px;
	border-radius: 6px;
	font-size: 0.65rem;
	/*font-weight: bold;*/
	pointer-events: none;
	white-space: nowrap;
	z-index: 11;
	box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

#badge-top {
	top: -2px;
	left: 50%;
	transform: translate(-50%, -100%) translateY(-8px);
}

#badge-bottom {
	bottom: -2px;
	left: 50%;
	transform: translate(-50%, 100%) translateY(8px);
}

#badge-left {
	left: -2px;
	top: 50%;
	transform: translate(-100%, -50%) translateX(-8px);
}

#badge-right {
	right: -2px;
	top: 50%;
	transform: translate(100%, -50%) translateX(8px);
}

.zoom-indicator {
	position: absolute;
	top: 10px;
	right: 10px;
	background: rgba(0, 0, 0, 0.7);
	color: white;
	padding: 4px 8px;
	border-radius: 4px;
	font-size: 0.75rem;
	z-index: 5;
}

.btn-upload {
    background: #2f3542;
    color: white;
    padding: 10px 12px;
    border: 2px solid var(--primary);
    border-radius: 8px;
    width: 100%;
    font-weight: bold;
    cursor: pointer;
    margin-bottom: 15px;
    position: relative;
    overflow: hidden;
    transition: 0.3s;
}

.btn-upload:hover {
    background: var(--primary);
    color: white;
    box-shadow: 0 0 20px rgba(74, 144, 226, 0.4);
}

.btn-upload::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -60%;
    width: 20%;
    height: 200%;
    background: rgba(255, 255, 255, 0.1);
    transform: rotate(30deg);
    transition: 1s;
}

.btn-upload:hover::after {
    left: 120%;
}
.btn-secondary {
	background: #95a5a6; color: white; padding: 10px 16px; border: none; border-radius: 8px;
	font-weight: bold; cursor: pointer; transition: 0.2s;
}
.btn-secondary:hover { background: #7f8c8d; }

.btn-primary {
	background: var(--primary); color: white; padding: 10px 16px; border: none; border-radius: 8px;
	font-weight: bold; cursor: pointer; transition: 0.2s;
}
.btn-primary:hover { background: #357abd; }

.btn-row {
	display: flex; gap: 10px; margin-top: 15px;
}
.btn-row button { flex: 1; }

.input-group-gen {
	display: flex; gap: 10px; align-items: center; margin-bottom: 15px;
}
.input-group-gen input[type="text"] {
	flex: 1; padding: 10px; border: 1px solid #ddd; border-radius: 6px; font-size: 0.9rem;
}
.input-group-gen button {
	padding: 10px 20px; background: var(--primary); color: white; border: none;
	border-radius: 6px; font-weight: bold; cursor: pointer; white-space: nowrap;
}

.switch-row { display: flex; align-items: center; gap: 10px; font-size: 0.85rem; }
.checkbox-row { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; cursor: pointer; }
.checkbox-row input[type="checkbox"] { width: 18px; height: 18px; cursor: pointer; }

.switch { position: relative; display: inline-block; width: 34px; height: 20px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider-round { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #ccc; transition: .4s; border-radius: 34px; }
.slider-round:before { position: absolute; content: ""; height: 14px; width: 14px; left: 3px; bottom: 3px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider-round { background-color: var(--primary); }
input:checked + .slider-round:before { transform: translateX(14px); }

.badge { background: var(--primary); color: white; padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; }

.control-group { margin-top: 20px; }
.control-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }

.control-group-select {
    margin-top: 10px;
    padding-bottom: 15px;
    border-bottom: 1px solid var(--border-light);
}

select#repeat-mode {
    width: 100%;
    padding: 8px 15px;
    font-size: 0.95rem;
    font-family: inherit;
    color: var(--text);
    background-color: var(--accent-bg);
    border: 2px solid var(--border-light);
    border-radius: 10px;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%234a90e2' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 15px center;
    background-size: 15px;
    transition: all 0.2s ease;
}

select#repeat-mode:hover {
    border-color: var(--primary);
}

select#repeat-mode:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

.checkbox-row {
    display: flex;
    align-items: center;
    padding: 12px;
    background: var(--accent-bg);
    border-radius: 10px;
    border: 1px solid var(--border-light);
    transition: 0.2s;
}

.checkbox-row:hover {
    background: #f0f4f8;
}

.checkbox-row input[type="checkbox"] {
    accent-color: var(--primary);
    width: 18px;
    height: 18px;
    margin-right: 12px;
}

.slider-container {
	background: var(--accent-bg);
	border: 1px solid var(--border-light);
	border-radius: 10px;
	padding: 15px;
	margin-top: 12px;
}

.slider-group {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: 18px;
}

.slider-item {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.slider-header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-size: 0.75rem;
	font-weight: 600;
	text-transform: capitalize;
	color: #57606f;
	letter-spacing: 0.5px;
}

.slider-item input[type="range"] {
	width: 100%;
	height: 6px;
	border-radius: 3px;
	background: #dfe4ea;
	outline: none;
	-webkit-appearance: none;
}

.slider-item input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--primary);
	cursor: pointer;
	transition: 0.2s;
}

.slider-item input[type="range"]::-webkit-slider-thumb:hover {
	transform: scale(1.2);
	background: #357abd;
}

.slider-item input[type="range"]::-moz-range-thumb {
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: var(--primary);
	cursor: pointer;
	border: none;
	transition: 0.2s;
}

.slider-item input[type="range"]::-moz-range-thumb:hover {
	transform: scale(1.2);
	background: #357abd;
}

select, .zoom-control input {
	padding: 8px;
	border: 1px solid #ddd;
	border-radius: 6px;
	font-size: 0.9rem;
	background: white;
}

.zoom-control {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 10px;
}

.zoom-control input[type="range"] {
	flex: 1;
}

.color-picker-group {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 10px;
}

.color-picker-group input[type="color"] {
	width: 50px;
	height: 35px;
	border: 1px solid #ddd;
	border-radius: 6px;
	cursor: pointer;
}

#preview-wrapper {
	/*padding: 20px;*/
	border-radius: 8px;
	transition: background-color 0.3s;
	margin-bottom: 40px;
}

#preview-box {
	min-width: 100px; min-height: 100px; width: 80%; height: 220px; resize: both; overflow: auto;
	border: 20px solid transparent; display: flex; align-items: center; justify-content: center;
	background: #fff padding-box; margin: 0 auto; max-width:100%;
}

.advanced-toggle {
	cursor: pointer;
	user-select: none;
	color: var(--primary);
	font-weight: 600;
	margin-top: 15px;
	display: inline-block;
}

.advanced-toggle:hover {
	text-decoration: underline;
}

.advanced-section {
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s ease;
}

.advanced-section.expanded {
	max-height: 1000px;
}

.section-header {
	font-weight: 600;
	font-size: 0.95rem;
	margin-bottom: 8px;
	color: var(--text);
}

.help-text {
	font-size: 0.8rem;
	color: #666;
	margin: 5px 0 10px 0;
	line-height: 1.4;
}

.drag-hint {
	text-align: center;
	font-size: 0.85rem;
	color: #666;
	margin-top: 8px;
	font-style: italic;
}