.cxp-panel {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    color: var(--text-primary);
    font-size: 14px;
    user-select: none;
    box-sizing: border-box;
    width: 480px;
    max-width: 100%;
    margin: 0 auto;
    position: relative;
    border-radius: 12px;
    background-color: var(--bg-color);
    padding: 16px;
    border: 1px solid #222;
    box-shadow: 0 8px 24px rgba(0,0,0,0.8);
}
.cxp-panel {
    --bg-color: #0b0914; /* Deep dark purple/indigo */
    --panel-bg: rgba(26, 22, 43, 0.6); /* Glassy dark purple */
    --panel-border: rgba(138, 115, 255, 0.15);
    --border-color: rgba(255, 255, 255, 0.08);
    --text-primary: #f0f0f5;
    --text-secondary: #a09eb5;
    --accent-color: #7b5ff0;
    --accent-hover: #9d85ff;
    --danger: #ff4d6d;
    --success: #00e5a0;
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.cxp-panel * {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}



.cxp-panel .app-container {
    display: flex;
    flex-direction: column;
}

/* Header */
.cxp-panel header {
    margin-bottom: 24px;
    text-align: center;
}

.cxp-panel header h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    letter-spacing: -0.5px;
}

.cxp-panel .pro-badge {
    background: linear-gradient(135deg, #7b5ff0, #d35ff0);
    color: white;
    font-size: 10px;
    padding: 3px 8px;
    border-radius: 6px;
    font-weight: 800;
    letter-spacing: 0.5px;
    box-shadow: 0 2px 10px rgba(123, 95, 240, 0.4);
}

.cxp-panel .subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Main Content */
.cxp-panel main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 16px;
    position: relative;
    z-index: 10;
}

/* Cards */
.cxp-panel .settings-card {
    position: relative;
    background: var(--panel-bg);
    border: 1px solid var(--panel-border);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-radius: 12px;
    padding: 16px;
    box-shadow: var(--glass-shadow);
}

/* Utilities */
.cxp-panel .mt-12 { margin-top: 12px; }
.cxp-panel .mt-16 { margin-top: 16px; }
.cxp-panel .mb-12 { margin-bottom: 12px; }
.cxp-panel .p-0 { padding: 0; }

.cxp-panel .control-row {
    display: flex;
    gap: 12px;
}

.cxp-panel .half {
    flex: 1;
}

.cxp-panel .third {
    flex: 1;
}

.cxp-panel .control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cxp-panel label {
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* Inputs & Selects */
input[type="text"],
input[type="number"],
.cxp-panel select {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}

.cxp-panel input:focus, .cxp-panel select:focus {
    border-color: var(--accent-color);
    box-shadow: 0 0 0 3px rgba(123, 95, 240, 0.2);
    background-color: rgba(0, 0, 0, 0.5);
}

/* Custom Select Wrapper */
.cxp-panel .select-wrapper {
    position: relative;
}

.cxp-panel .select-wrapper::after {
    content: '▾';
    font-size: 14px;
    color: var(--text-secondary);
    position: absolute;
    right: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    transition: color 0.3s ease;
}

.cxp-panel .select-wrapper:hover::after {
    color: var(--text-primary);
}

.cxp-panel select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 36px;
    cursor: pointer;
}

/* File Picker */
.cxp-panel .file-picker-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

.cxp-panel .file-label {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    padding: 9px 12px;
    border-radius: 8px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    color: var(--text-secondary);
}

/* Slider */
.cxp-panel .slider-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cxp-panel #durationVal, .cxp-panel #yOffsetVal {
    font-weight: 600;
    color: var(--accent-color);
    font-size: 13px;
}

.cxp-panel input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    background: transparent;
    padding: 8px 0;
    outline: none;
}

.cxp-panel input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    height: 16px;
    width: 16px;
    border-radius: 50%;
    background: var(--text-primary);
    cursor: pointer;
    margin-top: -6px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
    transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), background 0.2s ease;
    border: 2px solid var(--accent-color);
}

.cxp-panel input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    background: #ffffff;
}

.cxp-panel input[type="range"]::-webkit-slider-runnable-track {
    width: 100%;
    height: 4px;
    cursor: pointer;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 2px;
}

.cxp-panel input[type="range"]:focus::-webkit-slider-thumb {
    box-shadow: 0 0 0 4px rgba(123, 95, 240, 0.3);
}

/* iOS Style Toggle Switch */
.cxp-panel .toggle-group {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding: 2px 0;
}

.cxp-panel .toggle-group label:first-child {
    font-size: 14px;
    color: var(--text-primary);
}

.cxp-panel .toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
}

.cxp-panel .toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.cxp-panel .toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(255, 255, 255, 0.1);
    transition: .3s;
    border-radius: 24px;
    border: 1px solid var(--border-color);
}

.cxp-panel .toggle-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 2px;
    bottom: 2px;
    background-color: var(--text-secondary);
    transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 50%;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.cxp-panel input:checked + .toggle-slider {
    background-color: var(--accent-color);
    border-color: var(--accent-color);
}

.cxp-panel input:checked + .toggle-slider:before {
    transform: translateX(20px);
    background-color: #fff;
}

/* Box Controls (Animated visibility) */
.cxp-panel .box-controls {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cxp-panel .box-controls.visible {
    max-height: 250px;
    opacity: 1;
    margin-top: 12px;
}

/* Color Picker */
.cxp-panel .color-picker-wrapper {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 6px 12px 6px 6px;
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
    cursor: pointer;
}

.cxp-panel .color-picker-wrapper:hover {
    border-color: var(--accent-color);
    background: rgba(0, 0, 0, 0.4);
}

.cxp-panel input[type="color"] {
    -webkit-appearance: none;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.cxp-panel input[type="color"]::-webkit-color-swatch-wrapper {
    padding: 0;
}

.cxp-panel input[type="color"]::-webkit-color-swatch {
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 6px;
    box-shadow: inset 0 0 0 1px rgba(0,0,0,0.2);
}

.cxp-panel #hexValue, .cxp-panel #textColorHex, .cxp-panel #strokeColorHex, .cxp-panel #boxStrokeHexValue {
    font-family: 'Inter', monospace;
    font-size: 13px;
    color: var(--text-primary);
    flex-grow: 1;
    text-align: center;
    font-weight: 500;
}

/* Divider */
.cxp-panel .section-divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border-color), transparent);
    border: none;
}

/* Buttons */
.cxp-panel footer {
    margin-top: 24px;
}

.cxp-panel button {
    width: 100%;
    padding: 12px 20px;
    border-radius: 8px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1), color 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    border: none;
    outline: none;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cxp-panel .btn-primary {
    background: linear-gradient(135deg, var(--accent-color), #b14cf0);
    color: white;
    box-shadow: 0 4px 15px rgba(123, 95, 240, 0.4);
    position: relative;
    overflow: hidden;
}

.cxp-panel .btn-primary::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0.2) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cxp-panel .btn-primary:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(123, 95, 240, 0.6);
}

.cxp-panel .btn-primary:hover::after {
    opacity: 1;
}

.cxp-panel .btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 2px 10px rgba(123, 95, 240, 0.4);
}

.cxp-panel .btn-danger {
    background: linear-gradient(135deg, #dc3545, #b02a37);
    color: white;
    box-shadow: 0 4px 15px rgba(220, 53, 69, 0.4);
    position: relative;
    overflow: hidden;
}

.cxp-panel .btn-danger::after {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(to bottom, rgba(255,255,255,0.2) 0%, transparent 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.cxp-panel .btn-danger:hover {
    transform: scale(1.02);
    box-shadow: 0 6px 20px rgba(220, 53, 69, 0.6);
}

.cxp-panel .btn-danger:hover::after {
    opacity: 1;
}

.cxp-panel .btn-danger:active {
    transform: scale(0.98);
    box-shadow: 0 2px 10px rgba(220, 53, 69, 0.4);
}

.cxp-panel .btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-primary);
    padding: 8px 16px;
    border: 1px solid var(--border-color);
}

.cxp-panel .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.15);
}

/* Loader */
.cxp-panel .loader {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 50%;
    border-top-color: white;
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Setup Container */
.cxp-panel .progress-bar-container {
    width: 100%;
    height: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.cxp-panel .progress-bar-fill {
    height: 100%;
    background: linear-gradient(to right, var(--accent-color), #d35ff0);
    width: 0%;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(123, 95, 240, 0.5);
}

.cxp-panel .status-text {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    margin: 8px 0;
    font-weight: 500;
}

/* Full Screen Setup View */
.cxp-panel .view-container {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    padding: 24px;
    justify-content: center;
    align-items: center;
}

.cxp-panel .setup-content {
    width: 100%;
    max-width: 360px;
    text-align: center;
    padding: 32px 24px;
}

.cxp-panel .setup-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    color: var(--text-primary);
}

.cxp-panel .setup-subtitle {
    font-size: 13px;
    color: var(--accent-color);
    margin-bottom: 16px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.cxp-panel .setup-description {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 24px;
}


/* Custom Premium Scrollbar */
.cxp-panel *::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}
.cxp-panel *::-webkit-scrollbar-track {
    background: transparent;
}
.cxp-panel *::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}
.cxp-panel *::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Advanced Settings Accordion */
.cxp-panel .accordion-card {
    overflow: hidden;
}

.cxp-panel .advanced-toggle {
    background: transparent;
    color: var(--text-primary);
    padding: 16px;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
    transition: background 0.3s ease;
    box-shadow: none;
}

.cxp-panel .advanced-toggle:hover {
    background: rgba(255, 255, 255, 0.03);
    transform: none;
    box-shadow: none;
}

.cxp-panel .toggle-icon {
    font-size: 11px;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
}

.cxp-panel .advanced-toggle.active .toggle-icon {
    transform: rotate(180deg);
}

.cxp-panel .advanced-content {
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.4s cubic-bezier(0.4, 0, 0.2, 1), color 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cxp-panel .advanced-content.open {
    max-height: 1000px; /* Large enough */
    opacity: 1;
    padding: 0 16px 16px 16px;
}

/* Live Preview */
.cxp-panel .preview-container {
    margin-bottom: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 12px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.cxp-panel .preview-title {
    font-size: 11px;
    color: var(--accent-color);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
}

.cxp-panel .preview-frame {
    width: 100%;
    aspect-ratio: 16 / 9;
    height: auto;
    background-color: #050505;
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5);
}

.cxp-panel .preview-comp {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    transform-origin: center center;
    background-image: linear-gradient(45deg, #111 25%, transparent 25%), 
                      linear-gradient(-45deg, #111 25%, transparent 25%), 
                      linear-gradient(45deg, transparent 75%, #111 75%), 
                      linear-gradient(-45deg, transparent 75%, #111 75%);
    background-size: 40px 40px;
    background-position: 0 0, 0 20px, 20px -20px, -20px 0px;
}


.cxp-panel .preview-box {
    position: absolute;
    display: flex;
    justify-content: center;
    align-items: center;
   transition: padding 0.2s ease, opacity 0.2s ease;
    padding: 8px 16px;
    width: max-content;
    z-index: 1;
}

.preview-box::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    z-index: -1;
    border-radius: var(--box-radius, 4px);
    background-color: var(--box-bg, transparent);
    transform: scale(var(--box-scale, 1));
    transition: background-color 0.2s ease, border-radius 0.2s ease, transform 0.2s ease;
}

.cxp-panel .preview-text {
    display: block;
    font-family: Arial, Helvetica, sans-serif;
    font-weight: 400;
    white-space: nowrap;
    text-align: center;
    transition: color 0.2s ease, opacity 0.2s ease;
    line-height: 1.2;
}

.cxp-panel .preview-text span {
    display: inline-block;
}

/* Animation Preview Classes */
@keyframes popupAnim {
    0% { transform: scale(0); opacity: 0; animation-timing-function: ease-out; }
    60% { transform: scale(1.2); opacity: 1; animation-timing-function: ease-in-out; }
    100% { transform: scale(1); opacity: 1; }
}

.cxp-panel .anim-popup span {
    opacity: 0;
    transform-origin: bottom center;
    animation: popupAnim 0.6s forwards;
}

@keyframes fadeinAnim {
    0% { opacity: 0; transform: translateY(50px); }
    100% { opacity: 1; transform: translateY(0); }
}

.cxp-panel .anim-fadein span {
    opacity: 0;
    animation: fadeinAnim 0.5s ease-out forwards;
}

@keyframes typewriterAnim {
    0% { opacity: 0; }
    100% { opacity: 1; }
}

.cxp-panel .anim-typewriter span {
    opacity: 0;
    animation: typewriterAnim 0.01s forwards;
}

@keyframes karaokeWordAnim {
    0% { color: inherit; }
    10% { color: var(--karaoke-color, #FFCC00); }
    90% { color: var(--karaoke-color, #FFCC00); }
    100% { color: inherit; }
}

.cxp-panel .anim-karaoke span {
    animation: karaokeWordAnim 0.6s forwards;
}

@keyframes bounceinAnim {
    0% { transform: translateY(-50px); opacity: 0; }
    40% { transform: translateY(15px); opacity: 1; }
    75% { transform: translateY(-10px); opacity: 1; }
    100% { transform: translateY(0); opacity: 1; }
}

.cxp-panel .anim-bouncein span {
    opacity: 0;
    animation: bounceinAnim 0.6s ease-in-out forwards;
}

@keyframes blurinAnim {
    0% { filter: blur(12px); transform: translateX(40px); opacity: 0; }
    30% { opacity: 1; filter: blur(8px); }
    100% { filter: blur(0px); transform: translateX(0); opacity: 1; }
}

.cxp-panel .anim-blurin span {
    opacity: 0;
    animation: blurinAnim 0.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

@keyframes highlightBoxText {
    0% { color: inherit; }
    10% { color: var(--highlight-text-color, #000); }
    90% { color: var(--highlight-text-color, #000); }
    100% { color: inherit; }
}

@keyframes highlightBoxBg {
    0% { background-color: transparent; border-radius: 0; left: 0; right: 0; top: 0; bottom: 0; }
    10% { background-color: var(--karaoke-color, #FFCC00); border-radius: 0.20em; left: -0.08em; right: -0.08em; top: -0.28em; bottom: -0.15em; }
    90% { background-color: var(--karaoke-color, #FFCC00); border-radius: 0.20em; left: -0.08em; right: -0.08em; top: -0.28em; bottom: -0.15em; }
    100% { background-color: transparent; border-radius: 0; left: 0; right: 0; top: 0; bottom: 0; }
}

.cxp-panel .anim-highlightbox span {
    animation: highlightBoxText 0.6s forwards;
}

.cxp-panel .anim-highlightbox span::before {
    animation: highlightBoxBg 0.6s forwards;
    animation-delay: var(--delay, 0s);
}


/* Custom Dropdown Styles */
.cxp-panel .custom-select-wrapper {
    position: relative;
    width: 100%;
}

.cxp-panel .custom-select-trigger {
    width: 100%;
    background-color: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    padding: 10px 12px;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: opacity 0.3s ease, transform 0.3s ease, background-color 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease;
}

.cxp-panel .custom-select-trigger:hover, .cxp-panel .custom-select-wrapper.open .custom-select-trigger {
    border-color: var(--accent-color);
    background-color: rgba(0, 0, 0, 0.5);
}

.cxp-panel .custom-select-trigger::after {
    content: '▾';
    font-size: 14px;
    color: var(--text-secondary);
    transition: transform 0.3s ease;
}

.cxp-panel .custom-select-wrapper.open .custom-select-trigger::after {
    transform: rotate(180deg);
}

.cxp-panel .custom-select-options {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    width: 100%;
    background: #1a162b;
    border: 1px solid var(--accent-color);
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    max-height: 200px;
    overflow-y: auto;
    z-index: 9999;
    display: none;
    opacity: 0;
    transform: translateY(-5px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.cxp-panel .custom-select-options.show {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.cxp-panel .custom-option {
    padding: 10px 12px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-primary);
    transition: background 0.2s ease;
}

.cxp-panel .custom-option.has-fav {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.cxp-panel .fav-star {
    font-size: 16px;
    color: var(--text-secondary);
    transition: color 0.2s ease, transform 0.2s ease;
}

.cxp-panel .fav-star:hover {
    color: var(--accent-color);
    transform: scale(1.2);
}

.cxp-panel .fav-star.active {
    color: #FFCC00;
}

.cxp-panel .custom-option:hover {
    background: rgba(123, 95, 240, 0.2);
}

.cxp-panel .custom-option.selected {
    background: rgba(123, 95, 240, 0.4);
    color: #fff;
    font-weight: 600;
}

/* Toast Notifications */
.cxp-panel .toast-container {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    z-index: 10000;
    pointer-events: none; /* Let clicks pass through if not on a toast */
    width: 100%;
    padding: 0 20px;
}

.cxp-panel .toast {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 8px;
    color: #fff;
    font-size: 13px;
    font-weight: 500;
    pointer-events: auto;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
    transform: translateY(30px) scale(0.95);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55), opacity 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55), background-color 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55), border-color 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55), color 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55);
    background: #1e1e24; /* Fallback */
    line-height: 1.4;
    max-width: 100%;
}

.cxp-panel .toast.show {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.cxp-panel .toast-icon {
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.cxp-panel .toast.success {
    background: rgba(13, 110, 253, 0.95); /* Blue box as requested */
    border: 1px solid rgba(13, 110, 253, 0.5);
}

.cxp-panel .toast.warning {
    background: rgba(255, 193, 7, 0.95); /* Yellow box */
    border: 1px solid rgba(255, 193, 7, 0.5);
    color: #000; /* Dark text for better contrast on yellow */
}

.cxp-panel .toast.error {
    background: rgba(220, 53, 69, 0.95); /* Red box */
    border: 1px solid rgba(220, 53, 69, 0.5);
}

/* TAB NAVIGATION */
.cxp-panel .sticky-preview {
    position: sticky;
    top: 0;
    z-index: 100;
    margin-bottom: 8px;
    padding-bottom: 8px;
    padding-top: 16px; /* Cover any top padding when scrolled */
    margin-top: -16px; /* Offset the top padding */
    background-color: var(--bg-color); /* Correct variable name for solid background */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4); /* Add shadow to show it's sticky over content */
}

.cxp-panel .preview-container {
    padding: 12px;
}
.cxp-panel .preview-title { display: none; } /* Remove preview title to save space */

.cxp-panel .tab-nav {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    padding: 4px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.cxp-panel .tab-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 6px 0;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    cursor: pointer;
    transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}

.cxp-panel .tab-btn:hover {
    color: var(--text-primary);
    background: rgba(255, 255, 255, 0.05);
}

.cxp-panel .tab-btn.active {
    background: rgba(255, 255, 255, 0.1);
    color: var(--accent-color); /* Correct variable name */
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.cxp-panel .tab-pane {
    display: none;
}
.cxp-panel .tab-pane.active {
    display: block;
}

.cxp-panel .tabbed-card {
    padding: 12px; /* reduced padding to save space */
}
.cxp-panel .mt-8 {
    margin-top: 8px !important;
}

.cxp-panel .custom-select-options.drop-up {
    top: auto;
    bottom: calc(100% + 4px);
    transform: translateY(5px);
}
.cxp-panel .custom-select-options.drop-up.show {
    transform: translateY(0);
}
/* Capture Frame Button */
.cxp-panel .capture-frame-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px;
    min-height: 32px;
    max-width: 32px;
    max-height: 32px;
    padding: 0 !important;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    color: #fff;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 100;
    transition: opacity 0.2s ease, transform 0.2s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
    flex-shrink: 0;
    box-sizing: border-box;
}

.cxp-panel .capture-frame-btn svg {
    display: block;
    flex-shrink: 0;
    pointer-events: none;
}

.cxp-panel .capture-frame-btn svg.icon-x { display: none; }
.cxp-panel .capture-frame-btn.active svg.icon-eye { display: none; }
.cxp-panel .capture-frame-btn.active svg.icon-x { display: block; }

.cxp-panel .capture-frame-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.3);
    transform: none;
    box-shadow: none;
}

.cxp-panel .capture-frame-btn.active {
    color: #ff4444;
    background: rgba(255, 68, 68, 0.15);
    border-color: rgba(255, 68, 68, 0.3);
}

.cxp-panel .capture-frame-btn.active:hover {
    background: rgba(255, 68, 68, 0.25);
    transform: none;
    box-shadow: none;
}

/* Editable Hex */
.cxp-panel .editable-hex {
    width: 65px !important;
    min-width: 65px;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin: 0 !important;
    width: 60px !important;
    outline: none !important;
    cursor: text;
    color: inherit;
    font-size: 13px;
    font-family: inherit;
}

.cxp-panel .editable-hex:focus {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
}

/* Caption Editor Styles */
.cxp-panel .editor-container {
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 12px;
}
.cxp-panel .editor-rows-container {
    max-height: 250px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-right: 4px;
}
.cxp-panel .editor-row {
    display: flex;
    gap: 8px;
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    border-radius: 6px;
    border: 1px solid transparent;
    transition: border-color 0.2s;
}
.cxp-panel .editor-row:focus-within {
    border-color: #7b5ff0;
}
.cxp-panel .editor-row-times {
    display: flex;
    flex-direction: column;
    gap: 4px;
    width: 100px;
    flex-shrink: 0;
}
.cxp-panel .editor-time-input {
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 4px;
    padding: 2px 4px;
    font-size: 11px;
    font-family: monospace;
    text-align: center;
}
.cxp-panel .editor-time-input:focus {
    border-color: #7b5ff0;
    outline: none;
}
.cxp-panel .editor-text-input {
    flex-grow: 1;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    border-radius: 4px;
    padding: 6px;
    font-size: 13px;
    font-family: inherit;
    resize: none;
    height: 44px;
}
.cxp-panel .editor-text-input:focus {
    border-color: #7b5ff0;
    outline: none;
}
.cxp-panel .editor-row-actions {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
}
.cxp-panel .btn-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 4px;
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s, background-color 0.2s, border-color 0.2s, box-shadow 0.2s, color 0.2s;
}
.cxp-panel .btn-icon:hover {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}
.cxp-panel .btn-icon.danger:hover {
    background: rgba(255, 68, 68, 0.2);
    color: #ff4444;
}
/* Fix for stroke clipping on large text */
.cxp-panel .preview-text {
    paint-order: stroke fill;
    stroke-linejoin: round;
    stroke-linecap: round;
}

.cxp-panel .preview-text span {
    display: inline-block;
    position: relative;
    z-index: 1;
}

.cxp-panel .preview-text span::before {
    content: "";
    position: absolute;
    z-index: -2;
    left: -0.08em; top: -0.28em; right: -0.08em; bottom: -0.15em;
    border-radius: 0.20em;
    pointer-events: none;
}

.cxp-panel .preview-text span::after {
    content: attr(data-text);
    position: absolute;
    left: 0;
    top: 0;
    z-index: -1;
    -webkit-text-stroke: var(--stroke-width, 0px) var(--stroke-color, transparent);
    color: transparent;
    pointer-events: none;
}

 / *   C u s t o m   D i a l o g   * / 
 . c x p - p a n e l   . c u s t o m - d i a l o g - o v e r l a y   { 
         p o s i t i o n :   a b s o l u t e ; 
         t o p :   0 ;   l e f t :   0 ;   r i g h t :   0 ;   b o t t o m :   0 ; 
         b a c k g r o u n d :   r g b a ( 0 ,   0 ,   0 ,   0 . 6 ) ; 
         b a c k d r o p - f i l t e r :   b l u r ( 4 p x ) ; 
         z - i n d e x :   1 0 0 0 0 ; 
         d i s p l a y :   f l e x ; 
         a l i g n - i t e m s :   c e n t e r ; 
         j u s t i f y - c o n t e n t :   c e n t e r ; 
         o p a c i t y :   0 ; 
         t r a n s i t i o n :   o p a c i t y   0 . 3 s   e a s e ; 
 } 
 
 . c x p - p a n e l   . c u s t o m - d i a l o g - o v e r l a y . s h o w   { 
         o p a c i t y :   1 ; 
 } 
 
 . c x p - p a n e l   . c u s t o m - d i a l o g   { 
         b a c k g r o u n d :   # 2 4 2 4 3 0 ;   
         b o r d e r - r a d i u s :   1 2 p x ; 
         p a d d i n g :   2 4 p x ; 
         w i d t h :   3 2 0 p x ; 
         b o x - s h a d o w :   0   1 0 p x   4 0 p x   r g b a ( 0 ,   0 ,   0 ,   0 . 5 ) ,   0   0   0   1 p x   r g b a ( 2 5 5 , 2 5 5 , 2 5 5 , 0 . 0 5 ) ; 
         t r a n s f o r m :   s c a l e ( 0 . 9 5 ) ; 
         t r a n s i t i o n :   t r a n s f o r m   0 . 3 s   c u b i c - b e z i e r ( 0 . 1 7 5 ,   0 . 8 8 5 ,   0 . 3 2 ,   1 . 2 7 5 ) ; 
 } 
 
 . c x p - p a n e l   . c u s t o m - d i a l o g - o v e r l a y . s h o w   . c u s t o m - d i a l o g   { 
         t r a n s f o r m :   s c a l e ( 1 ) ; 
 } 
 
 . c x p - p a n e l   . c u s t o m - d i a l o g   h 3   { 
         m a r g i n :   0   0   1 2 p x   0 ; 
         f o n t - s i z e :   1 8 p x ; 
         f o n t - w e i g h t :   6 0 0 ; 
         c o l o r :   w h i t e ; 
 } 
 
 . c x p - p a n e l   . c u s t o m - d i a l o g   p   { 
         m a r g i n :   0   0   2 4 p x   0 ; 
         f o n t - s i z e :   1 4 p x ; 
         c o l o r :   r g b a ( 2 5 5 , 2 5 5 , 2 5 5 , 0 . 7 ) ; 
         l i n e - h e i g h t :   1 . 4 ; 
 } 
 
 . c x p - p a n e l   . c u s t o m - d i a l o g   . d i a l o g - b u t t o n s   { 
         d i s p l a y :   f l e x ; 
         j u s t i f y - c o n t e n t :   f l e x - e n d ; 
         g a p :   1 2 p x ; 
 } 
 
 . c x p - p a n e l   . c u s t o m - d i a l o g   . d i a l o g - b u t t o n s   b u t t o n   { 
         p a d d i n g :   8 p x   1 6 p x ; 
         b o r d e r - r a d i u s :   8 p x ; 
         f o n t - w e i g h t :   5 0 0 ; 
         b o r d e r :   n o n e ; 
         c u r s o r :   p o i n t e r ; 
 } 
 
 . c x p - p a n e l   . c u s t o m - d i a l o g   . d i a l o g - i n p u t   { 
         w i d t h :   1 0 0 % ; 
         m a r g i n - b o t t o m :   2 4 p x ; 
         b a c k g r o u n d :   r g b a ( 0 , 0 , 0 , 0 . 3 ) ; 
         b o r d e r :   1 p x   s o l i d   r g b a ( 2 5 5 , 2 5 5 , 2 5 5 , 0 . 1 ) ; 
         c o l o r :   w h i t e ; 
         p a d d i n g :   1 0 p x   1 2 p x ; 
         b o r d e r - r a d i u s :   6 p x ; 
         o u t l i n e :   n o n e ; 
 } 
 . c x p - p a n e l   . c u s t o m - d i a l o g   . d i a l o g - i n p u t : f o c u s   { 
         b o r d e r - c o l o r :   v a r ( - - a c c e n t - c o l o r ) ; 
 } 
 
 
 

/* Mobile Responsiveness for QuickSub Pro */
@media (max-width: 768px) {
    .cxp-panel {
        padding: 10px;
    }
    .cxp-panel .tab-nav {
        overflow-x: auto;
        white-space: nowrap;
        justify-content: flex-start;
    }
    .cxp-panel .control-row {
        flex-direction: column;
        gap: 12px;
    }
    .cxp-panel .control-group.half,
    .cxp-panel .control-group.third {
        width: 100%;
        margin-right: 0;
    }
    .cxp-panel .box-controls .control-row {
        flex-direction: column;
    }
}
