/*
 * Simple Editor (Mb Editor) - Industrial Grayscale "Sharp & Flat" Design
 * High-Performance Draft Interface with Production-Grade Rhymix Integration
 */

:root {
	--mb-black: #080808;
	--mb-white: #ffffff;
	--mb-gray-50: #fafafa;
	--mb-gray-100: #f5f5f5;
	--mb-gray-200: #eeeeee;
	--mb-gray-300: #dddddd;
	--mb-gray-400: #aaaaaa;
	--mb-gray-500: #777777;
	--mb-gray-800: #333333;
	--mb-accent: #444444;
}

.rx_mb_editor p:empty::after { content: '\00a0'; }
.rx_mb_editor p { min-height: 1.5em; line-height: inherit; margin: 0; padding: 0; }

.rx_mb_editor_wrapper {
	position: relative !important;
	display: flex;
	flex-direction: column;
	width: 100%;
    box-sizing: border-box !important;
    &, & * { box-sizing: border-box !important; } /* Global box-sizing for all editor components to prevent overflow */
	background: var(--mb-white);
	border: 1px solid #cccccc; /* Restored sharp border as requested */
	font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, Roboto, 'Helvetica Neue', 'Segoe UI', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic', sans-serif;
	box-shadow: none !important;
    border-radius: 5px; /* Restored 5px corner as requested */
    overflow: hidden;
}

.relative { position: relative; }

/* Scroll Lock for Popups */
:global(body.mb-editor-scroll-lock) {
    overflow: hidden !important;
}

/* Toolbar */
.mb-simple-editor-toolbar {
	display: flex;
	align-items: center;
	flex-wrap: nowrap;
	gap: 4px;
	padding: 10px 15px;
    box-sizing: border-box !important;
	background: var(--mb-gray-50);
	border-bottom: 1px solid var(--mb-gray-200);
	position: sticky;
	top: 0;
	z-index: 100;
    box-shadow: 0 1px 0 rgba(0,0,0,0.02);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
	scrollbar-width: none; 
    &::-webkit-scrollbar { display: none; }

	.mb-toolbar-group {
		display: flex;
		align-items: center;
		gap: 2px;
        flex-shrink: 0;
	}

	.mb-toolbar-divider {
		width: 1px;
		height: 20px;
		background: var(--mb-gray-300);
		margin: 0 6px;
        flex-shrink: 0;
	}

	.mb-editor-btn {
		padding: 8px;
		color: var(--mb-gray-800);
		background: transparent;
		border: none;
		cursor: pointer;
		display: flex;
		align-items: center;
		justify-content: center;
		transition: all 0.2s ease;
		border-radius: 4px;

		&:hover {
			background: var(--mb-gray-300);
			color: var(--mb-black);
		}

		&.active {
			background: #333333;
			color: #ffffff;

			i {
				color: #ffffff !important;
			}
		}

		i { font-size: 16px; }
        
        &.font-family-btn, &.font-size-btn {
            background: transparent !important;
            border: 1px solid transparent !important;
            padding: 0 4px !important;
            height: 32px;
            
            span {
                font-family: 'Inter', sans-serif;
                font-size: 11px !important;
                font-weight: 600 !important;
                color: var(--mb-gray-800);
            }
            
            &:hover {
                background: var(--mb-gray-200) !important;
            }
        }
	}

	.mb-color-hidden {
		position: absolute;
		top: 1px; /* Offset to prevent border clipping */
		left: 1px;
		width: calc(100% - 2px);
		height: calc(100% - 2px);
		opacity: 0;
		cursor: pointer;
		padding: 0;
		border: none;
	}
}

/* Popups (Table, Link) */
.mb-color-indicator {
	position: absolute;
	top: 5px;
	right: 5px;
	width: 7px;
	height: 7px;
	border-radius: 50%;
	z-index: 10;
	pointer-events: none;
	box-shadow: 0 0 0 1px var(--mb-white);
}

.mb-char-count-current {
    transition: color 0.4s ease;
    display: inline-block;
}

.mb-editor-inline-popup {
	display: none;
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: auto; /* Align to the left of the button as per user reference image */
	background: var(--mb-white);
	border: 1px solid var(--mb-gray-300);
	box-shadow: 0 10px 25px -5px rgba(0,0,0,0.15);
	padding: 8px 10px;
	z-index: 200;
	border-radius: 1px;
    animation: mb-slide-down 0.2s cubic-bezier(0.16, 1, 0.3, 1);

    .mb-size-item {
        &:hover {
            background: var(--mb-gray-100) !important;
            color: var(--mb-black);
        }
    }
    &.size-popup, &.family-popup {
        max-height: 250px;
        overflow-y: auto;
        
        &::-webkit-scrollbar { width: 4px; }
        &::-webkit-scrollbar-track { background: transparent; }
        &::-webkit-scrollbar-thumb { background: #eee; border-radius: 4px; }
        &::-webkit-scrollbar-thumb:hover { background: #ddd; }

        .mb-size-item {
            text-align: left;
            width: 100%;
            background: none;
            border: none;
            padding: 8px 10px;
            font-size: 13px;
            cursor: pointer;
            border-radius: 4px;
            color: #333;
            transition: background 0.1s;

            &:hover {
                background: var(--mb-gray-100) !important;
            }
        }
    }

	&.link-popup {
		width: max-content; /* Remove extra right-side gap */
		display: none;
		flex-direction: row;
		gap: 8px;
		align-items: center;

		.mb-link-input {
			width: 220px;
			padding: 6px 10px;
			border: 1px solid var(--mb-gray-300);
			font-size: 13px;
			outline: none;
			border-radius: 4px;
			&:focus { border-color: var(--mb-gray-500); }
		}

		.mb-link-apply-btn {
			padding: 6px 14px; /* Balanced button padding */
			background: var(--mb-gray-800);
			color: var(--mb-white);
			border: none;
			font-size: 12px;
			font-weight: 700;
			cursor: pointer;
			border-radius: 4px;
			&:hover { background: var(--mb-black); }
		}
	}

	&.table-popup {
		width: 240px;
		padding: 10px 12px;
        box-sizing: border-box;
	}

	&.color-popup {
		display: none;
		flex-direction: column;
		gap: 10px;
		padding: 10px;
		width: 200px;
		align-items: stretch;

		.mb-color-grid {
			display: grid;
			grid-template-columns: repeat(8, 1fr);
			gap: 4px;
			justify-content: center;
		}

		.mb-color-item {
			width: 18px;
			height: 18px;
			border: 1px solid var(--mb-gray-300);
			cursor: pointer;
			border-radius: 2px;
			&:hover { transform: scale(1.1); border-color: var(--mb-gray-500); }
		}

		.mb-color-footer {
			display: flex;
			flex-direction: row;
			justify-content: space-between;
			align-items: center;
			padding-top: 8px;
			border-top: 1px solid var(--mb-gray-100);
		}

		.mb-color-input {
			width: 24px;
			height: 24px;
			padding: 0;
			border: 1px solid var(--mb-gray-300);
			cursor: pointer;
			background: none;
			border-radius: 4px;
		}

		.mb-color-btn {
			padding: 5px 8px;
			border: none;
			border-radius: 4px;
			cursor: pointer;
			font-size: 10px;
			font-weight: 700;
			
			&.ok { background: var(--mb-gray-800); color: #fff; }
			&.reset { background: var(--mb-gray-100); color: var(--mb-gray-800); }
			&:hover { opacity: 0.8; }
		}
	}
}

/* Table Context Toolbar */
.mb-table-context-toolbar {
	background: #e5e5e5;
	border-bottom: 1px solid #cccccc;
	padding: 4px 10px;
	animation: mb-slide-down 0.2s ease-out;

	.mb-table-toolbar-inner {
		display: flex;
		align-items: center;
		flex-wrap: nowrap;
		gap: 2px;
		
		.mb-table-toolbar-title {
			font-size: 11px;
			font-weight: 800;
			color: #666;
			text-transform: uppercase;
			margin-right: 4px;
			white-space: nowrap;
		}

		.mb-table-width-box {
			display: inline-flex;
			align-items: center;
			gap: 4px;
			margin: 0 2px;
			white-space: nowrap;
		}

		.mb-table-width-label {
			font-size: 11px;
			font-weight: 600;
			color: #555;
			white-space: nowrap;
		}
		
		.mb-table-width-input {
			width: 52px !important;
			max-width: 52px !important;
			height: 22px !important;
			min-height: 22px !important;
			padding: 1px 4px !important;
			font-size: 11px !important;
			line-height: 20px !important;
			border: 1px solid #ccc !important;
			border-radius: 4px !important;
			background: #ffffff !important;
			color: #333333 !important;
			outline: none !important;
			box-sizing: border-box !important;
			text-align: center;
			margin: 0 !important;
			vertical-align: middle;
			&:focus { border-color: #666 !important; }
		}

		.mb-table-settings-dropdown {
			position: absolute;
			top: calc(100% + 8px);
			right: 0;
			background: #ffffff;
			border: 1px solid #dddddd;
			box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
			width: 260px;
			z-index: 1000;
			display: none;
			padding: 20px;
			border-radius: 12px;
			text-align: left;
			&.active { display: block; animation: mb-modal-pop 0.2s ease-out; }
			&.flip-up {
				top: auto;
				bottom: calc(100% + 8px);
				&::after {
					top: auto;
					bottom: -6px;
					border-top: none;
					border-left: none;
					border-bottom: 1px solid #dddddd;
					border-right: 1px solid #dddddd;
				}
			}
			
			&::after {
				content: '';
				position: absolute;
				top: -6px; right: 15px;
				width: 10px; height: 10px;
				background: #ffffff;
				border-top: 1px solid #dddddd;
				border-left: 1px solid #dddddd;
				transform: rotate(45deg);
			}

			.mb-sett-row { 
				display: flex; gap: 10px; margin-bottom: 12px; 
				&.last { margin-bottom: 0; } 
			}
			.mb-sett-col { 
				display: flex; flex-direction: column; gap: 6px; 
				min-width: 0;
			}
			.mb-label { 
				font-size: 11px; font-weight: 800; color: #222222; 
				text-transform: uppercase; letter-spacing: 0.02em;
			}
			.mb-sett-input { 
				width: 100% !important; height: 36px !important; min-height: 36px !important; font-size: 13px !important; font-weight: 500 !important;
                background: #ffffff !important; border: 1px solid #eeeeee !important; border-radius: 8px !important; 
				padding: 0 12px !important; box-sizing: border-box !important; outline: none !important;
                color: #444444 !important;
				transition: border-color 0.2s;
				margin: 0 !important;
				&:focus { border-color: #333333 !important; }
			}

			.mb-sett-color-input {
				width: 34px !important;
				min-width: 34px !important;
				max-width: 34px !important;
				height: 36px !important;
				min-height: 36px !important;
				padding: 2px !important;
				margin: 0 !important;
				border: 1px solid #e2e8f0 !important;
				border-radius: 6px !important;
				background: #f8fafc !important;
				cursor: pointer !important;
				box-sizing: border-box !important;
				
				&::-webkit-color-swatch-wrapper {
					padding: 2px !important;
				}
				&::-webkit-color-swatch {
					border: 1px solid #cccccc !important;
					border-radius: 3px !important;
				}
			}

			.mb-tpl-trigger-btn {
				width: 100%; height: 38px;
				background: #f9f9f9;
				border: 1px solid #eeeeee;
				border-radius: 8px;
				padding: 0 12px;
				display: flex; align-items: center; justify-content: space-between;
				font-size: 12px; font-weight: 600; color: #555555;
				cursor: pointer; transition: all 0.2s;
				box-shadow: none !important;
				
				&:hover { border-color: #cccccc; background: #f0f0f0; color: #222222; }
				i { font-size: 10px; color: #999999; }
                .line { flex: 0 0 60%; border-top: 2px solid #555555; margin-right: 8px; border-radius: 1px; }
			}

			.mb-scope-selector {
				display: flex !important;
				background: #eeeeee !important;
				border-radius: 8px !important;
				padding: 2px !important;
				gap: 2px !important;
				width: 100% !important;
				box-sizing: border-box !important;
				margin: 0 !important;

				label {
					flex: 1 1 0 !important;
					display: flex !important;
					align-items: center !important;
					justify-content: center !important;
					cursor: pointer !important;
					height: 32px !important;
					border-radius: 6px !important;
					border: 1px solid transparent !important;
					margin: 0 !important;
					padding: 0 !important;
					gap: 0 !important;
					box-sizing: border-box !important;
					background: transparent !important;

					input { display: none !important; margin: 0 !important; }
					span { font-size: 11px !important; font-weight: 700 !important; color: #777777 !important; line-height: 1 !important; user-select: none !important; }
					&:has(input:checked) {
						background: #ffffff !important;
						border-color: #dddddd !important;
						box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
						span { color: #333333 !important; }
					}
				}
			}

			.mb-btn-apply { 
				width: 100%; margin-top: 15px; padding: 12px; background: #000000; color: #f5f5f5;
				border: none; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 700;
				transition: background 0.2s;
				&:hover { background: #222222; }
			}

			.mb-table-styles-flyout {
				position: absolute;
				left: calc(100% + 2px); 
                top: 0;
				width: 220px;
				background: #ffffff;
				border: 1px solid #dddddd;
				border-radius: 12px;
				box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.05);
				padding: 18px;
				display: none;
				z-index: 1001;
				&.active { display: block; animation: mb-modal-pop 0.2s ease-out; }
				.flyout-header { font-size: 11px; font-weight: 800; color: #222222; margin-bottom: 12px; border-bottom: 1px solid #f5f5f5; padding-bottom: 8px; text-transform: uppercase; }
                
                &.border-styles { 
                    width: 180px; 
                    left: calc(100% + 22px); // Moved 5px further (Total +22px)
                    top: auto; bottom: 0; // Align to bottom to move it "up"
                }

                .visual-border-grid {
                    display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px;
                    .border-grid-item {
                        padding: 10px; border: 1px solid #eeeeee; border-radius: 8px;
                        cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 6px;
                        transition: all 0.2s; background: #ffffff;
                        &:hover { border-color: #999999; background: #f9f9f9; }
                        &.active { border-color: #000000; background: #f0f0f0; }
                        .line { width: 100%; height: 0; border-top-color: #333333; }
                        .line.solid { border-top: 2px solid #333333; }
                        .line.dashed { border-top: 2px dashed #333333; }
                        .line.dotted { border-top: 2px dotted #333333; }
                        .line.double { border-top: 4px double #333333; }
                        .line.groove { border-top: 3px groove #333333; }
                        .line.ridge { border-top: 3px ridge #333333; }
                        .line.none { border: none; height: 1px; background: #dddddd; }
                        span { font-size: 10px; font-weight: 700; color: #777777; }
                        &.active span { color: #000000; }
                    }
                }

                .table-template-picker {
                    display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px;
                    .tpl-item {
                        aspect-ratio: 1 / 1; border: 1px solid #e2e8f0; border-radius: 8px;
                        cursor: pointer; overflow: hidden; padding: 2px; background: #ffffff;
                        transition: all 0.2s;
                        &:hover { border-color: #cbd5e1; background: #f8fafc; }
                        &.active { border-color: #1e293b; border-width: 2px; padding: 1px; }
                        [class^="tpl-v-"] { 
                            width: 100%; height: 100%; display: grid; gap: 1px; background: #f1f5f9; 
                            grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr);
                            div { background: #ffffff; }
                        }
                        .tpl-v-header-dark .h { background: #334155; }
                        .tpl-v-header-gray .h { background: #cbd5e1; }
                        .tpl-v-zebra-v .z { background: #f8fafc; }
                        .tpl-v-zebra-h .z { background: #f8fafc; }
                        .tpl-v-min-h { background: transparent; gap: 0; .h { background: #f8fafc; border-bottom: 1px solid #e2e8f0; } .c { border-bottom: 1px solid #f8fafc; } }
                        .tpl-v-accent-blue { border: 1px solid #3b82f6; .h { background: #3b82f6; } }
                        .tpl-v-outline { display: block; border: 2px solid #334155; }
                    }
                }
			}
		}
		
		.mb-table-toolbar-inner {
			display: flex;
			align-items: center;
			gap: 1px; // Tightened from 4px
			padding: 4px;
		}
		
		.mb-table-tool-btn {
			padding: 4px 6px; // Tightened
			font-size: 11px;
			font-weight: 700;
			color: #444;
			background: transparent;
			border: 1px solid transparent;
			border-radius: 4px;
			cursor: pointer;
			transition: all 0.15s;
			display: flex;
			align-items: center;
			gap: 2px; // Tightened
			white-space: nowrap;
			
			&:hover { background: rgba(0,0,0,0.06); color: #000; }
			&.danger { &:hover { background: #fee2e2; color: #dc2626; } }
			i { font-size: 9px; opacity: 0.8; } // Smaller icons
		}

		.mb-toolbar-divider {
			width: 1px;
			height: 14px; // More compact height
			background: #bbb; // Darker for visibility
			margin: 0 4px; // Tightened
			flex-shrink: 0;
			opacity: 0.8;
		}
	}
}

/* Image Settings Modal */
.mb-editor-modal {
	position: fixed;
	top: 0; left: 0; width: 100%; height: 100%;
	z-index: 10000;
	display: none;
	align-items: center;
	justify-content: center;
	
	.mb-editor-modal-overlay {
		position: absolute;
		top: 0; left: 0; width: 100%; height: 100%;
		background: rgba(0,0,0,0.4);
		backdrop-filter: blur(2px);
	}
	
	.mb-editor-modal-content {
		position: relative;
		background: #fff;
		width: 320px;
		box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
		border-radius: 12px;
		overflow: hidden;
		animation: mb-modal-pop 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
		
		.mb-editor-modal-header {
			padding: 16px 20px;
			border-bottom: 1px solid #f3f4f6;
			display: flex;
			justify-content: space-between;
			align-items: center;
			h3 { font-size: 16px; font-weight: 800; color: #111; margin: 0; }
			.close-btn { background: none; border: none; font-size: 18px; color: #9ca3af; cursor: pointer; &:hover { color: #111; } }
		}
		
		.mb-editor-modal-body {
			padding: 24px 20px;
			.mb-input-group {
				margin-bottom: 16px;
				&:last-child { margin-bottom: 0; }
				label { display: block; font-size: 12px; font-weight: 700; color: #6b7280; margin-bottom: 6px; }
				input {
					width: 100%;
					padding: 10px;
					border: 1px solid #d1d5db;
					border-radius: 6px;
					font-size: 14px;
					outline: none;
					box-sizing: border-box;
					&:focus { border-color: #111; box-shadow: 0 0 0 2px rgba(0,0,0,0.05); }
				}
			}
		}
		
		.mb-editor-modal-footer {
			padding: 16px 20px;
			background: #f9fafb;
			border-top: 1px solid #f3f4f6;
			display: flex;
			gap: 8px;
			justify-content: flex-end;
			
			.mb-modal-btn {
				padding: 8px 16px;
				font-size: 13px;
				font-weight: 700;
				border-radius: 6px;
				cursor: pointer;
				transition: all 0.2s;
				&.cancel { background: #fff; border: 1px solid #d1d5db; color: #4b5563; &:hover { background: #f3f4f6; } }
				&.apply { background: #111; border: 1px solid #111; color: #fff; &:hover { background: #000; } }
			}
		}
	}
}

@keyframes mb-slide-down {
	from { transform: translateY(-10px); opacity: 0; }
	to { transform: translateY(0); opacity: 1; }
}
@keyframes mb-modal-pop {
	from { transform: scale(0.95); opacity: 0; }
	to { transform: scale(1); opacity: 1; }
}

/* Table Grid */
.mb-table-grid-container {
	display: flex;
	flex-direction: column;
	gap: 2px;
    margin: 0 auto;
    width: max-content;
}
.mb-table-grid-row {
	display: flex;
	gap: 2px;
}
.mb-table-grid-cell {
	width: 18px;
	height: 18px;
	border: 1px solid var(--mb-gray-200);
	cursor: pointer;
	transition: background-color 0.1s;
	
	&.active {
		background: var(--mb-gray-400);
		border-color: var(--mb-gray-600);
	}
}
.mb-table-grid-status {
	text-align: center;
	font-size: 11px;
	font-weight: 700;
	color: var(--mb-gray-500);
	margin-top: 8px;
}

/* Editor Body */
.mb-editor-body-container {
	position: relative;
	background: var(--mb-white);
}

.rx_mb_editor.rhymix_content.editable {
    box-sizing: border-box !important;
	display: block !important;
	width: 100%;
	max-width: 100% !important;
	min-width: 0 !important;
	min-height: 120px;
	padding: 13px 20px !important;
    white-space: normal !important;
    word-break: break-all !important;
    overflow-wrap: break-word !important;
	font-size: 18px !important;
	line-height: 1.6 !important;
    letter-spacing: 0em !important;
    &, & * { 
        font-family: 'Pretendard', 'Inter', 'Noto Sans KR', sans-serif !important;
        letter-spacing: inherit !important;
		max-width: 100% !important;
    }
	span, strong, em, u, s, a, font, mark {
		line-height: inherit !important;
	}
	color: var(--mb-gray-800);
	outline: none;
	overflow-y: auto;
	overflow-x: hidden;
	background: var(--mb-white);

	&::before {
		color: var(--mb-gray-400);
		pointer-events: none;
	}

	&::selection {
		background: rgba(0, 123, 255, 0.2);
	}
	&::-moz-selection {
		background: rgba(0, 123, 255, 0.2);
	}

    figure.image { width: 100% !important; max-width: 768px !important; margin: 14px auto !important; padding: 0 !important; }
    figure.image img { width: 100% !important; max-width: 100% !important; height: auto !important; display: block !important; margin: 0 !important; border-radius: 0 !important; }
    figure.image figcaption { font-size: 13px !important; color: #666 !important; margin: 8px 0 4px 0 !important; text-align: center; }
    img:not([editor_component]):not(.mb-inserted-sticker) { width: 100% !important; max-width: 768px !important; height: auto !important; display: block !important; margin: 14px auto !important; border-radius: 0 !important; }
    img.mb-inserted-sticker {
        width: 85px !important;
        height: 85px !important;
        min-width: 85px !important;
        min-height: 85px !important;
        max-width: 85px !important;
        max-height: 85px !important;
        display: inline-block !important;
        vertical-align: middle !important;
        margin: 4px 3px !important;
        float: none !important;
        user-select: none !important;
        border: none !important;
        background: transparent !important;
        box-shadow: none !important;
        padding: 0 !important;
        position: static !important;
        transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275) !important;
        &:hover {
            transform: scale(1.1) !important;
        }
    }
    video { max-width: 100%; border-radius: 8px; margin: 10px 0; }
    blockquote { border-left: 4px solid var(--mb-gray-400); color: var(--mb-gray-500); font-style: italic; background: var(--mb-gray-50); padding: 12px 20px; margin: 15px 0; border-radius: 0 4px 4px 0; }
    a { color: #2563eb; text-decoration: underline; }
    
    /* [v12.0.0] Fluid Liquid Attachment Cards */
    img[editor_component] {
        display: block;
        width: 100%;
        height: auto;
        margin: 15px 0;
        border-radius: 12px;
    }

    /* Percentage media can share a row without overflowing it. */
    p.mb-media-flow-item,
    figure.image.mb-media-flow-item,
    img.mb-media-flow-item,
    video.mb-media-flow-item {
        display: inline-block !important;
        width: calc(var(--mb-media-width, 100%) - 4px) !important;
        margin: 4px 4px 4px 0 !important;
        padding: 0 !important;
        box-sizing: border-box !important;
        vertical-align: top !important;
        line-height: 0 !important;
    }
    p.mb-media-flow-item > img,
    p.mb-media-flow-item > figure.image,
    p.mb-media-flow-item > video {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
    }
}

/* File Card Styling - Global Persistence */
.mb-editor-file-card {
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    padding: 12px 18px !important;
    background: #f8fafc !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 8px !important;
    margin: 15px 0 !important;
    font-family: 'Inter', -apple-system, sans-serif !important;
    user-select: none;
    -webkit-user-drag: none;
    transition: all 0.2s;
    cursor: default;
    box-shadow: 0 1px 2px rgba(0,0,0,0.03);
    box-sizing: border-box !important;
    clear: both !important;

    &:hover {
        border-color: #cbd5e1 !important;
        background: #f1f5f9 !important;
        box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
    }

    .f-info-box-wrap {
        display: flex !important;
        align-items: center !important;
        gap: 12px !important;
        min-width: 0 !important;
        flex: 1 !important;
        
        i { color: #64748b !important; font-size: 20px !important; }
        span { 
            color: #1e293b !important; 
            font-weight: 700 !important; 
            font-size: 14px !important;
            white-space: nowrap !important;
            overflow: hidden !important;
            text-overflow: ellipsis !important;
            display: block !important;
        }
    }

    .f-download {
        background: #1e293b !important;
        color: #ffffff !important;
        padding: 8px 16px !important;
        border-radius: 6px !important;
        text-decoration: none !important;
        font-size: 12px !important;
        font-weight: 700 !important;
        flex-shrink: 0 !important;
        transition: all 0.2s;
        border: 1px solid #1e293b;
        display: inline-block !important;

        &:hover {
            background: #0f172a !important;
            transform: translateY(-1px);
        }
    }
}

.mb-upload-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 28px;
    background: var(--mb-gray-100);
    z-index: 1000;
	border-bottom: 1px solid var(--mb-gray-200);
    overflow: hidden;
    pointer-events: none;

    .mb-progress-bar {
        height: 100%;
        background: #22c55e;
        background-image: linear-gradient(90deg, #22c55e, #16a34a);
        transition: width 0.3s cubic-bezier(0, 0.5, 0.5, 1); /* [v10.5.1] Optimized Smoothness */
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
        
        &::after {
            content: '';
            position: absolute;
            top: 0; left: 0; right: 0; bottom: 0;
            background: linear-gradient(rgba(255,255,255,0.2), transparent);
        }
    }

    .mb-progress-text {
        position: absolute;
        left: 12px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 10px;
        font-weight: 800;
        color: #fff;
        text-shadow: 0 1px 1px rgba(0,0,0,0.3);
        z-index: 2;
    }

    .mb-progress-meta {
        position: absolute;
        right: 12px;
        top: 50%;
        transform: translateY(-50%);
        font-size: 10px;
        font-weight: 700;
        color: #14532d;
        z-index: 2;
        text-shadow: 0 1px 0 rgba(255,255,255,0.45);
    }
}

.mb-editor-body-container {
    position: relative;
}

/* Dropzone Bar */
.mb-editor-dropzone-bar {
	margin: 16px 24px 16px 24px;
	padding: 14px;
	border: 1.5px dashed #d1d1d6;
	background: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 12px;
	cursor: pointer;
	transition: all 0.2s ease;
	border-radius: 12px;

	i { font-size: 19px; color: #8e8e93; }
	.dropzone-text { font-size: 13.5px; font-weight: 600; color: #8e8e93; letter-spacing: -0.01em; }

	&:hover, &.dragging {
		background: #f8f8f8;
		border-color: #1a1a1b;
		i { color: #1a1a1b; }
		.dropzone-text { color: #1a1a1b; }
	}
}

/* Uploader Dashboard (Pixel-Perfect React Clone) */
.mb-editor-uploader-unit {
	padding: 24px;
	border-top: 1px solid var(--mb-gray-200);
	background: var(--mb-gray-50);

	.dashboard-header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		margin-bottom: 20px;
		
		.title { font-size: 13px; font-weight: 800; color: var(--mb-gray-800); }
		.stats { font-size: 12px; color: var(--mb-gray-400); }
	}

	.dashboard-items {
		display: flex;
		flex-wrap: wrap;
		gap: 12px;
	}
}

.mb-file-card {
	display: flex;
	align-items: center;
	padding: 10px 14px;
	background: var(--mb-white);
	border: 1.5px solid #ececed;
	border-radius: 14px;
	position: relative;
	flex: 1 1 300px;
	min-width: 0;
	max-width: none;
	transition: all 0.25s cubic-bezier(0.23, 1, 0.32, 1);
	box-shadow: 0 1px 2px rgba(0,0,0,0.03);
	margin-bottom: 4px;
	
	&:hover {
		border-color: #d1d1d6;
		transform: translateY(-2px);
		box-shadow: 0 8px 24px rgba(0,0,0,0.06);
		background: #ffffff;
	}

	.preview {
		width: 60px;
		height: 44px;
		background-size: cover;
		background-position: center;
		background-color: #f4f4f5;
		border-radius: 10px;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-shrink: 0;
		margin-right: 14px;
		overflow: hidden;
		border: 1px solid rgba(0,0,0,0.04);
		position: relative;
		z-index: 1;

		&.is-file {
			background: #f8f9fa;
			i { font-size: 18px; color: #adb5bd; }
		}

		&.media-thumb {
			width: 80px;
			height: 52px;
			border-radius: 10px;
			background: #18181b;
			border: 1px solid rgba(0,0,0,0.1);
			
			&::after {
				content: '';
				position: absolute;
				inset: 0;
				background: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(255,255,255,0) 100%);
				pointer-events: none;
			}

			.media-thumb-icon {
				width: 26px;
				height: 26px;
				border-radius: 999px;
				background: rgba(0,0,0,0.6);
				backdrop-filter: blur(8px);
				color: #ffffff;
				display: flex;
				align-items: center;
				justify-content: center;
				font-size: 10px;
				z-index: 2;
				border: 1.5px solid rgba(255,255,255,0.25);
			}

			&.has-thumb {
				background-size: cover;
				background-position: center;
				background-repeat: no-repeat;
				.media-thumb-icon { display: none; }
			}
		}
	}

	.f-info-box {
		display: flex;
		flex-direction: column;
		flex: 1;
		min-width: 0;
		justify-content: center;
		padding-right: 20px;
	}

	.f-name {
		font-size: 13.5px;
		font-weight: 700;
		color: #1a1a1b;
		line-height: 1.4;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
		display: block;
		letter-spacing: -0.01em;
	}

	.f-size {
		margin-top: 3px;
		font-size: 11px;
		font-weight: 600;
		color: #8e8e93;
		display: block;
		letter-spacing: 0.02em;
		text-transform: uppercase;
	}

	.f-actions {
		position: absolute;
		right: 10px;
		top: 50%;
		transform: translateY(-50%) translateX(10px);
		display: flex;
		gap: 4px;
		opacity: 0;
		visibility: hidden;
		transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
		background: rgba(255,255,255,0.95);
		backdrop-filter: blur(4px);
		padding: 4px;
		border-radius: 10px;
		border: 1px solid #e5e5ea;
		box-shadow: 0 4px 12px rgba(0,0,0,0.08);
		z-index: 10;

		button {
			width: 32px;
			height: 32px;
			display: flex;
			align-items: center;
			justify-content: center;
			background: transparent;
			border: none;
			color: #3a3a3c;
			cursor: pointer;
			border-radius: 7px;
			transition: all 0.15s ease;

			&:hover {
				background: #f2f2f7;
				color: #000000;
				transform: scale(1.05);
			}
			
			&.btn-delete:hover { 
				background: #fff1f2; 
				color: #ef4444; 
			}
		}
	}
    
    &:hover .f-actions { 
		opacity: 1; 
		visibility: visible;
		transform: translateY(-50%) translateX(0);
	}
}

/* Poll Container in Editor Body */
.mb-editor-poll-container {
	padding: 16px 20px;
	background: #f8f9fa;
	border-radius: 0;
	border: 1.5px solid #ececed;
	margin: 10px 0;
	.mb-poll-card {
		display: flex;
		align-items: center;
		gap: 8px;
		background: #fff;
		border: 1px solid var(--mb-gray-200);
		padding: 6px 12px;
		font-size: 12px;
		font-weight: 800;
		cursor: pointer;
		border-radius: 6px;
		transition: all 0.2s;
		
		&:hover { border-color: var(--mb-black); box-shadow: 0 4px 6px -1px rgba(0,0,0,0.05); }
		i { font-size: 12px; color: var(--mb-gray-400); }
	}
}

/* Quick Styles & Grid Gallery Extension */
.mb-table-quick-tpl {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid var(--mb-gray-100);
    width: 100%;
    box-sizing: border-box;
    
    .tpl-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
        
        .label { font-size: 10px; font-weight: 800; color: var(--mb-gray-400); text-transform: uppercase; letter-spacing: 0.05em; }
        .btn-more {
            background: none; border: none; font-size: 10px; font-weight: 800; 
            color: var(--mb-gray-500); cursor: pointer; transition: color 0.2s;
            display: flex; align-items: center; gap: 3px;
            &:hover, &.active { color: var(--mb-black); }
            i { font-size: 8px; transition: transform 0.2s; }
            &.active i { transform: rotate(180deg); }
        }
    }
    
    .tpl-btns {
        display: flex;
        justify-content: center;
        gap: 6px;
        button {
            flex: 1; height: 28px; font-size: 11px; font-weight: 800;
            background: var(--mb-white); border: 1px solid var(--mb-gray-300);
            border-radius: 4px; cursor: pointer; color: var(--mb-gray-800);
            transition: all 0.2s;
            &:hover { border-color: var(--mb-black); background: var(--mb-gray-50); }
        }
    }
    
    .mb-table-grid-tpl-gallery {
        display: none;
        margin-top: 10px;
        border-top: 1px dashed var(--mb-gray-200);
        padding-top: 10px;
        
        &.active { display: block; animation: mbGridGalleryIn 0.2s ease-out; }
        
        .table-template-picker.mini {
            display: grid;
            grid-template-columns: repeat(4, auto);
            gap: 8px;
            justify-content: center;
            
            .tpl-item {
                width: 44px;
                height: 44px;
                border: 1px solid var(--mb-gray-200);
                border-radius: 4px;
                cursor: pointer;
                overflow: hidden;
                padding: 1px;
                background: #fff;
                &:hover { border-color: var(--mb-black); }
                
                [class^="tpl-v-"] { 
                    width: 100%; height: 100%; display: grid; gap: 0.5px; background: #eee; 
                    grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(4, 1fr);
                    div { background: #fff; }
                }
                .tpl-v-header-dark .h { background: #334155; }
                .tpl-v-header-gray .h { background: #cbd5e1; }
                .tpl-v-zebra-v .z { background: #f1f5f9; }
                .tpl-v-zebra-h .z { background: #f1f5f9; }
                .tpl-v-accent-blue { background: #3b82f6; .h { background: #3b82f6; } }
                .tpl-v-accent-red { background: #ef4444; .h { background: #ef4444; } }
            }
        }
    }
}

@keyframes mbGridGalleryIn {
    from { transform: translateY(-5px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

/* Layer Popups & Masks */
.mb-editor-layer-popup-mask {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(2px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.mb-editor-layer-popup {
    background: #fff;
    width: 480px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
    overflow: hidden;
    animation: mb-modal-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    padding: 24px;

    .popup-header {
        flex: 0 0 auto;
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 20px;
        .popup-title { font-size: 18px; font-weight: 800; color: var(--mb-black); letter-spacing: -0.03em; }
        .popup-close { font-size: 24px; color: var(--mb-gray-400); cursor: pointer; line-height: 1; &:hover { color: var(--mb-black); } }
    }

    .popup-body {
        flex: 1 1 auto;
        max-height: 600px;
        overflow-y: auto;
        padding-right: 5px; /* Space for scrollbar */
        margin-right: -5px;

        /* Custom Scrollbar */
        &::-webkit-scrollbar { width: 5px; }
        &::-webkit-scrollbar-track { background: transparent; }
        &::-webkit-scrollbar-thumb { background: #eee; border-radius: 10px; }
        &::-webkit-scrollbar-thumb:hover { background: #ddd; }
    }

    .popup-footer {
        flex: 0 0 auto;
    }

    .popup-section {
        margin-bottom: 16px;
        &:last-child { margin-bottom: 0; }
        .poll-label { 
            font-size: 11px; font-weight: 800; color: var(--mb-gray-400); 
            margin-bottom: 10px; display: block; text-transform: uppercase;
            letter-spacing: 0.05em;
        }
    }
    .poll-title-input { 
        width: 100%; display: block; border: 1.5px solid #cccccc; padding: 14px; 
        font-size: 15px; font-weight: 800; border-radius: 8px; outline: none; 
        background: var(--mb-gray-50); box-sizing: border-box;
        &:focus { border-color: var(--mb-black); background: #fff; box-shadow: 0 0 0 4px rgba(0,0,0,0.03); } 
    }

    .poll-item-row { 
        display: flex; align-items: center; gap: 10px; margin-bottom: 12px; 
        .num { font-size: 11px; font-weight: 800; color: var(--mb-gray-400); width: 14px; text-align: center; }
        input { 
            flex: 1; border: 1px solid #cccccc; padding: 12px; border-radius: 8px; 
            font-size: 14px; outline: none; transition: all 0.2s; background: var(--mb-gray-50);
            &:focus { border-color: var(--mb-black); background: #fff; box-shadow: 0 0 0 4px rgba(0,0,0,0.03); }
        }
    }

    .btn-add-item { 
        background: #fff; border: 1px dashed var(--mb-gray-300); 
        padding: 12px; width: 100%; border-radius: 10px; font-size: 12px; font-weight: 800; 
        color: var(--mb-gray-500); cursor: pointer; transition: all 0.2s;
        display: flex; align-items: center; justify-content: center; gap: 6px;
        margin-bottom: 8px;
        &:hover { border-color: var(--mb-black); color: var(--mb-black); background: var(--mb-gray-50); }
    }

    .btn-confirm { 
        width: 100%; height: 54px; background: var(--mb-gray-800); color: #fff; border: none; 
        border-radius: 12px; font-size: 16px; font-weight: 800; cursor: pointer; transition: all 0.2s;
        display: flex; align-items: center; justify-content: center;
        &:hover { background: var(--mb-black); transform: translateY(-2px); box-shadow: 0 10px 20px -5px rgba(0,0,0,0.3); }
        &:active { transform: translateY(0); }
    }

    .poll-date-input { 
        border: 1px solid #cccccc; padding: 12px; font-size: 14px; 
        border-radius: 8px; outline: none; background: var(--mb-white);
        color: var(--mb-gray-600); font-weight: 600;
        &:focus { border-color: var(--mb-black); color: var(--mb-black); } 
    }
    .poll-time-input { 
        border: 1px solid #cccccc; padding: 12px; font-size: 14px; 
        border-radius: 8px; outline: none; background: var(--mb-white);
        text-align: center; font-weight: 800; width: 62px;
        color: var(--mb-gray-600);
        &:focus { border-color: var(--mb-black); color: var(--mb-black); } 
    }

    .poll-quick-select {
        height: 48px; border: 1px solid #cccccc; border-radius: 8px;
        font-size: 13px; font-weight: 800; color: var(--mb-gray-500);
        background: var(--mb-gray-50); cursor: pointer; padding: 0 8px;
        &:focus { border-color: var(--mb-black); outline: none; color: var(--mb-black); }
    }
}

    /* Poll Management Unit Styles (Matches Uploader Unit) */
    .mb-editor-poll-unit {
        padding: 24px;
        border-top: 1px solid var(--mb-gray-200);
        background: var(--mb-gray-50);
        margin-top: 0;
        .mb-poll-header {
            display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px;
            span:first-child { font-size: 12px; font-weight: 800; color: var(--mb-gray-800); }
            .btn-add-poll { 
                font-size: 12px; font-weight: 800; color: var(--mb-gray-600); cursor: pointer;
                padding: 6px 12px; border-radius: 8px; background: var(--mb-gray-50); transition: all 0.2s;
                i { margin-right: 4px; }
                &:hover { background: var(--mb-gray-100); color: var(--mb-black); transform: translateY(-1px); }
            }
        }
        .mb-poll-list { display: flex; flex-direction: column; gap: 8px; }
        .mb-poll-item-card {
            width: 100% !important; 
            box-sizing: border-box !important;
            display: flex; justify-content: space-between; align-items: center;
            padding: 16px 15px; background: #fff; border: 1px solid #eeeeee; border-radius: 12px;
            transition: background 0.2s, border-color 0.2s, box-shadow 0.2s, transform 0.2s;
            backface-visibility: hidden;
            transform: translateZ(0);
            &:hover { border-color: #cccccc; box-shadow: 0 4px 12px rgba(0,0,0,0.06); background: #fcfcfc; }
            
            .poll-info {
                display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0;
                .poll-icon { 
                    width: 36px; height: 36px; background: var(--mb-gray-50); border-radius: 8px; 
                    display: flex; align-items: center; justify-content: center; color: var(--mb-gray-400); font-size: 16px;
                }
                .title-wrap {
                    display: flex; flex-direction: column; min-width: 0; flex: 1;
                    .title-row { 
                        display: flex; align-items: center; gap: 6px; margin-bottom: 2px;
                        .title { font-size: 14px; font-weight: 800; color: var(--mb-gray-800); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
                        .rx-poll-status-label { font-size: 9px; padding: 2px 8px; border-radius: 4px; font-weight: 800; line-height: 1.2; flex-shrink: 0; display: inline-block; white-space: nowrap; min-width: fit-content; width: auto; vertical-align: middle; margin-left: 4px; }
                    }
                    .meta-row { 
                        display: flex; align-items: center; gap: 8px; 
                        .meta { font-size: 11px; font-weight: 600; color: var(--mb-gray-400); }
                    }
                }
            }
            
            .poll-actions {
                display: flex; align-items: center; gap: 6px;
                button {
                    padding: 8px 12px; font-size: 11px; font-weight: 800; border-radius: 8px; cursor: pointer; 
                    transition: background 0.2s, border-color 0.2s, color 0.2s;
                    box-sizing: border-box; vertical-align: middle; position: relative;
                    i { font-size: 10px; pointer-events: none; }
                    &::before { content: ''; position: absolute; top: -5px; bottom: -5px; left: -5px; right: -5px; } /* Expand hit area */
                    &.btn-insert { 
                        background: var(--mb-black); color: #fff; border: 1px solid var(--mb-black); 
                        &:hover { background: #000; border-color: #000; }
                    }
                    &.btn-edit { background: #fff; color: var(--mb-gray-700); border: 1px solid #ddd; &:hover { border-color: var(--mb-black); color: var(--mb-black); background: var(--mb-gray-50); } }
                    &.btn-del { background: #fff; color: #f44336; border: 1px solid rgba(244,67,54,0.1); &:hover { background: #fdf2f2; border-color: #f44336; } }
                }
            }
        }
    }

    /* Fix: Enforce full width for poll components inside the editor canvas */
    [editor_component="poll_maker"] {
        margin: 20px 0;
    }
[editor_component='poll_maker'] { transition: opacity 0.1s; } .rx_mb_editor img[editor_component='poll_maker']:not([data-poll-hydrated='true']) { opacity: 0 !important; visibility: hidden; } .rx_mb_editor img[editor_component='poll_maker'][data-poll-hydrated='true'] { opacity: 1 !important; visibility: visible; }

body.mb-level-gate-open { overflow: hidden; }

.mb-editor-level-gate {
    position: fixed; inset: 0; z-index: 100000;
    display: flex; align-items: center; justify-content: center;
    padding: 20px; opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .22s ease, visibility .22s ease;
    box-sizing: border-box;

    &.is-open { opacity: 1; visibility: visible; pointer-events: auto; }
    *, *::before, *::after { box-sizing: border-box; }
    .level-gate-backdrop {
        position: absolute; inset: 0; width: 100%; height: 100%; border: 0;
        background: rgba(15, 23, 42, .62); backdrop-filter: blur(5px); cursor: default;
    }
    .level-gate-card {
        position: relative; width: min(440px, 100%); overflow: hidden;
        padding: 34px 34px 30px; border: 1px solid rgba(255,255,255,.78); border-radius: 24px;
        background: linear-gradient(155deg, #fff 0%, #fbfffd 58%, #eef8f3 100%);
        box-shadow: 0 28px 80px rgba(15, 23, 42, .27), 0 4px 16px rgba(15, 23, 42, .1);
        text-align: center; transform: translateY(14px) scale(.97);
        transition: transform .32s cubic-bezier(.2,.8,.2,1);
    }
    &.is-open .level-gate-card { transform: translateY(0) scale(1); }
    .level-gate-card::before {
        content: ''; position: absolute; inset: 0 0 auto; height: 6px;
        background: linear-gradient(90deg, #2f7c69, #8ac3a6 50%, #d5ad4f);
    }
    .level-gate-close {
        position: absolute; z-index: 2; top: 16px; right: 16px;
        width: 36px; height: 36px; border: 0; border-radius: 50%;
        background: rgba(15,23,42,.055); color: #52605c; font-size: 16px; cursor: pointer;
        transition: background .18s ease, transform .18s ease;
        &:hover { background: rgba(15,23,42,.1); transform: rotate(5deg); }
    }
    .level-gate-symbol {
        position: relative; display: flex; align-items: center; justify-content: center;
        width: 76px; height: 76px; margin: 2px auto 18px; border-radius: 24px;
        color: #fff; font-size: 29px;
        background: linear-gradient(145deg, #2f7c69, #194c41);
        box-shadow: 0 13px 30px rgba(47,124,105,.3), inset 0 1px rgba(255,255,255,.32);
        transform: rotate(-3deg);
    }
    .spark { position: absolute; width: 7px; height: 7px; border-radius: 2px; background: #e4bd5b; box-shadow: 0 0 12px rgba(228,189,91,.72); }
    .spark-a { top: -8px; right: 3px; animation: mbGateSpark 1.8s ease-in-out infinite; }
    .spark-b { right: -13px; bottom: 9px; width: 5px; height: 5px; animation: mbGateSpark 1.8s .45s ease-in-out infinite; }
    .spark-c { left: -9px; top: 11px; width: 4px; height: 4px; animation: mbGateSpark 1.8s .9s ease-in-out infinite; }
    .level-gate-eyebrow {
        display: inline-flex; align-items: center; min-height: 28px; padding: 0 12px;
        border: 1px solid rgba(47,124,105,.18); border-radius: 999px;
        background: rgba(47,124,105,.08); color: #2b6b5b; font-size: 12px; font-weight: 800; letter-spacing: .03em;
    }
    h2 { margin: 13px 0 8px; color: #17211e; font-size: 24px; line-height: 1.32; font-weight: 900; letter-spacing: -.035em; }
    .level-gate-description { margin: 0 auto; max-width: 350px; color: #66716d; font-size: 14px; line-height: 1.65; word-break: keep-all; }
    .level-gate-progress {
        margin: 24px 0 20px; padding: 17px 18px 15px; border: 1px solid #e2ebe7; border-radius: 16px;
        background: rgba(255,255,255,.78); text-align: left;
    }
    .level-gate-progress-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 11px; font-size: 11px; color: #77817e; }
    .level-gate-current { color: #284e44; font-size: 12px; }
    .level-gate-track { position: relative; height: 12px; overflow: visible; border-radius: 999px; background: #e8eeeb; box-shadow: inset 0 1px 2px rgba(15,23,42,.07); }
    .level-gate-fill {
        position: absolute; inset: 0 auto 0 0; min-width: 4px; overflow: hidden; border-radius: inherit;
        background: linear-gradient(90deg, #2e7967, #60aa88 70%, #dfbc62);
        box-shadow: 0 0 14px rgba(67,148,118,.35); transition: width 1.05s cubic-bezier(.2,.75,.2,1);
        i { position: absolute; inset: 0; background: linear-gradient(110deg, transparent 20%, rgba(255,255,255,.55) 46%, transparent 70%); transform: translateX(-110%); animation: mbGateShine 1.5s .45s ease-out both; }
    }
    .level-gate-remaining { margin-top: 10px; color: #52625d; font-size: 12px; font-weight: 800; text-align: center; }
    .level-gate-cta {
        display: flex; align-items: center; justify-content: center; width: 100%; min-height: 50px;
        border-radius: 14px; background: #18201e; color: #fff !important; text-decoration: none !important;
        font-size: 14px; font-weight: 850; box-shadow: 0 9px 18px rgba(15,23,42,.16);
        transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
        &:hover { background: #2b6b5b; transform: translateY(-2px); box-shadow: 0 12px 22px rgba(47,124,105,.24); }
    }
    &.is-guest .level-gate-progress { display: none; }
    &.is-guest .level-gate-cta { margin-top: 22px; }
}

@keyframes mbGateSpark { 0%,100% { opacity: .35; transform: scale(.7) rotate(0); } 50% { opacity: 1; transform: scale(1.2) rotate(45deg); } }
@keyframes mbGateShine { to { transform: translateX(110%); } }

@media (max-width: 600px) {
    .mb-editor-level-gate {
        align-items: flex-end; padding: 12px;
        .level-gate-card { width: 100%; padding: 29px 22px 22px; border-radius: 22px; }
        .level-gate-symbol { width: 64px; height: 64px; margin-bottom: 14px; border-radius: 20px; font-size: 25px; }
        h2 { font-size: 21px; }
        .level-gate-description { font-size: 13px; }
        .level-gate-progress { margin-top: 20px; padding: 15px; }
        .level-gate-progress-head { flex-wrap: wrap; }
    }
}

@media (prefers-reduced-motion: reduce) {
    .mb-editor-level-gate, .mb-editor-level-gate .level-gate-card, .mb-editor-level-gate .level-gate-fill { transition-duration: .01ms !important; }
    .mb-editor-level-gate .spark, .mb-editor-level-gate .level-gate-fill i { animation: none !important; }
}
