:root {
    --nav-h: 0px;
}


#bgContainer, #joeContainer, #textOverlayContainer{
    position: relative;
}

.canvas-container{
    z-index: inherit;
}

#app{
    position: relative;
}

#bgContainer {
    z-index: 10;
}

#joeContainer{
    z-index: 20;
}
#textOverlayContainer {
    z-index: 30;
}

#app .canvas-container, #app canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    display: block;
}

#app .canvas-container {
    display: block;
}


#textOverlayContainer .canvas-container.interactive {
    pointer-events: auto !important;
}

#textOverlayContainer .canvas-container.hidden {
    display: none !important;
}

/* Ensure both canvas elements in Fabric.js structure are visible */
#textOverlayContainer .canvas-container canvas {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    display: block !important;
    opacity: 1 !important;
}

body:not(.is-joe) #joeContainer canvas{
    pointer-events: none;
}

body.is-joe #textOverlayContainer *, body.is-joe #textOverlayContainer,body.is-joe #bgContainer,body.is-joe #bgContainer *{
    pointer-events: none;
}

#topActionButtons, #toggleButtonsContainer, #actionPanel, #uiLeft, #uiRight, .bgUploadPanel, .bgPickerPanel, .textToolbarPanel, #txtolControls{
    z-index: 100000;
}

/* Iro Color Picker Styling for Text Toolbar */
#txtolTextColorPicker,
#txtolStrokeColorPicker,
#txtolShadowColorPicker {
    position: absolute !important;
    z-index: 100001 !important;
    min-width: 200px !important;
    min-height: 300px !important;
    max-height: 350px !important;
    overflow: visible !important;
    background: white;
    padding: 20px;
    box-shadow: -1px 0px 20px grey;
    border: solid 2px yellow;
}

#txtolTextColorPicker .iro-color-picker,
#txtolStrokeColorPicker .iro-color-picker,
#txtolShadowColorPicker .iro-color-picker {
    background: rgba(255, 255, 255, 0.98) !important;
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25), 0 4px 16px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    padding: 12px !important;
    border: 1px solid rgba(221, 221, 221, 0.8) !important;
    backdrop-filter: blur(10px) !important;
    width: 180px !important;
    height: auto !important;
    overflow: visible !important;
    position: relative !important;
}

#txtolTextColorPicker .iro-color-picker svg,
#txtolStrokeColorPicker .iro-color-picker svg,
#txtolShadowColorPicker .iro-color-picker svg {
    display: block !important;
    width: 100% !important;
    height: auto !important;
    overflow: visible !important;
}

/* Ensure color wheel components are visible */
#txtolTextColorPicker .iro-wheel,
#txtolStrokeColorPicker .iro-wheel,
#txtolShadowColorPicker .iro-wheel,
#txtolTextColorPicker .iro-slider,
#txtolStrokeColorPicker .iro-slider,
#txtolShadowColorPicker .iro-slider {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    overflow: visible !important;
}

/* Color button styling */
#txtolTextColorBtn,
#txtolStrokeColorBtn,
#txtolShadowColorBtn {
    border: 1px solid #666 !important;
    border-radius: 8px !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1), 0 1px 4px rgba(0, 0, 0, 0.05) !important;
    transition: all 0.2s ease !important;
    position: relative !important;
    overflow: hidden !important;
}

#txtolTextColorBtn:hover,
#txtolStrokeColorBtn:hover,
#txtolShadowColorBtn:hover {
    border-color: #999 !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 6px rgba(0, 0, 0, 0.1) !important;
    transform: translateY(-1px) !important;
}

/* Remove any white background effects that could interfere with color display */

/* Close button styling for color pickers */
.color-picker-close-btn {
    position: absolute !important;
    top: 4px !important;
    right: 4px !important;
    width: 20px !important;
    height: 20px !important;
    background: rgba(255, 255, 255, 0.95) !important;
    border: 1px solid rgba(0, 0, 0, 0.2) !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    font-weight: bold !important;
    color: #666 !important;
    transition: all 0.2s ease !important;
    z-index: 100003 !important;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2) !important;
    line-height: 1 !important;
}

.color-picker-close-btn:hover {
    background: rgba(255, 255, 255, 1) !important;
    color: #333 !important;
    transform: scale(1.1) !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

/* Ensure the text toolbar container doesn't clip the color pickers */
#txtolControls {
    overflow: visible !important;
}

body.is-text #uiLeft, body.is-text #uiRight, body.is-text #topActionButtons{
    display: none !important;
}

body.is-bg #uiLeft, body.is-bg #uiRight,body.is-bg #toggleButtonsContainer, body.is-bg #topActionButtons{
    display: none !important;
}
body.is-bg #joeContainer *, body.is-bg #textOverlayContainer *,body.is-bg #joeContainer , body.is-bg #textOverlayContainer {
    opacity: 0.7 !important;
    pointer-events: none !important;
}

/* Force font loading */
.font-preload {
    font-family: 'Asimovian', sans-serif;
}
.font-preload::after {
    content: 'Barrio Chewy Chicle Funnel Display Poiret One';
    font-family: 'Barrio', cursive;
    font-family: 'Chewy', cursive;
    font-family: 'Chicle', cursive;
    font-family: 'Funnel Display', sans-serif;
    font-family: 'Poiret One', cursive;
    position: absolute;
    left: -9999px;
    opacity: 0;
}

/* Control sections */
.controlSection {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 10px;
    margin: 10px 12px;
    backdrop-filter: blur(6px);
}

.controlSection .sectionHeader {
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
}

.controlSection .sectionTitle {
    font-weight: 700;
}

.controlSection.collapsed .row {
    display: none !important;
}

.controlSection.collapsed .sectionHeader + .row {
    display: none !important;
}

.controlSection.collapsed .sectionHeader + .controlSectionContent {
    display: none !important;
}

.controlSection .sectionHeader button {
    cursor: pointer;
}

/* Chevron icon */
.controlSection .sectionHeader .chevron {
    margin-left: 10px;
    width: 20px;
    height: 20px;
    display: inline-flex;
    display: none;
    align-items: center;
    justify-content: center;
    transition: transform 0.2s ease;
}

.controlSection .sectionHeader .chevron svg {
    width: 100%;
    height: 100%;
    display: block;
}

.controlSection.collapsed .sectionHeader .chevron {
    transform: rotate(-90deg);
}

/* On small screens, collapse by default; JS also enforces on load */
@media (max-width: 768px) {
    #uiLeft, #uiRight {
        max-width: 45vw;
    }
}

/* Action panel and icon buttons */
.actionPanel {
    position: fixed;
    left: 12px;
    bottom: 12px;
    display: flex;
    gap: 10px;
}

.actionBtn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid #d0d0d0;
    background: #ffffff;
    /*display: none;*/
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.08);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.actionBtn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2), 0 4px 8px rgba(0, 0, 0, 0.12);
    border-color: #b0b0b0;
}

.actionBtn:active {
    transform: translateY(0px) scale(0.98);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18), 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: all 0.1s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ripple effect for click animation */
.actionBtn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: rgba(0, 123, 255, 0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.actionBtn:active::before {
    width: 60px;
    height: 60px;
}

#bgColorBtn.colorWheelBtn {
    background: conic-gradient(from 0deg, red, yellow, lime, cyan, blue, magenta, red);
}

/* Text Panel Button - Text Settings Icon */
#textPanelBtn {
    background: #ffffff url('images/text-settings.png') center/24px 24px no-repeat;
}

#textPanelBtn:hover {
    background: #f8f9fa url('images/text-settings.png') center/26px 26px no-repeat;
    border-color: #007bff;
}

#textPanelBtn:active {
    background: #e9ecef url('images/text-settings.png') center/22px 22px no-repeat;
}

/* Popup panel for color picker */
.bgPickerPanel[hidden] {
    display: none !important;
}

.bgPickerPanel {
    position: fixed;
    left: 12px;
    bottom: 64px; /* above action panel */
    padding: 10px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Background Image Upload Panel */
.bgUploadPanel[hidden] {
    display: none !important;
}

.bgUploadPanel {
    position: fixed;
    left: 12px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
    width: 280px;
    overflow: hidden;
}

.upload-header, .txtol-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    background: #f8f9fa;
    border-bottom: 1px solid #e5e5e5;
    font-weight: 600;
    font-size: 14px;
    color: #333;
}

.txtol-header{
    /*display: none;*/
}

.close-btn, .minimize-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

.close-btn:hover, .minimize-btn:hover {
    background: #e9ecef;
    color: #333;
}

.minimize-btn {
    font-size: 24px;
    font-weight: bold;
    line-height: 1;
}

.minimize-btn.maximized {
    transform: rotate(180deg);
}

/* Minimized panel states */
.bgUploadPanel.minimized,
#txtolControls.minimized {
    height: auto !important;
    overflow: hidden;
}

.bgUploadPanel.minimized .txt-deleter,
.bgUploadPanel.minimized .upload-area,
#txtolControls.minimized .txtol-form,
#txtolControls.minimized .txtol-text-toolbar-info,
#txtolControls.minimized #txtolTextToolbar {
    display: none !important;
}

.bgUploadPanel.minimized .upload-header,
#txtolControls.minimized .txtol-header {
    border-bottom: none;
}

/* Minimized panel animations */
.bgUploadPanel,
#txtolControls {
    transition: all 0.3s ease;
}

.bgUploadPanel.minimized {
    width: auto;
    min-width: 200px;
}

#txtolControls.minimized {
    width: auto;
    min-width: 150px;
}

.upload-area {
    padding: 20px;
    border: 2px dashed #ddd;
    margin: 16px;
    border-radius: 8px;
    text-align: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.upload-area:hover {
    border-color: #007bff;
    background: #f8f9ff;
}

.upload-area.drag-over {
    border-color: #007bff;
    background: #e3f2fd;
    border-style: solid;
}

.upload-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.upload-content svg {
    color: #666;
    margin-bottom: 8px;
}

.upload-content p {
    margin: 0;
    font-size: 14px;
    color: #333;
    font-weight: 500;
}

.upload-content span {
    font-size: 12px;
    color: #666;
}

.browse-btn {
    background: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s ease;
}

.browse-btn:hover {
    background: #0056b3;
}

/* Text toolbar */
.textToolbarPanel[hidden] {
    display: none !important;
}

.textToolbarPanel {
    position: fixed;
    left: 12px;
    bottom: 128px; /* above picker and actions */
    padding: 10px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 10px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
    min-width: 260px;
}

.textToolbarPanel .toolbarRow {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 6px 0;
}

.textToolbarPanel label {
    font-size: 12px;
    color: #333;
    min-width: 54px;
}

.textToolbarPanel input[type="number"] {
    width: 72px;
}

.textToolbarPanel input[type="range"] {
    flex: 1;
}

.addTextBtn {
    width: 100%;
    padding: 8px 12px;
    background: #007bff;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
}

.addTextBtn:hover {
    background: #0056b3;
}

.toolbarClose {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    border: none;
    background: #f0f0f0;
    border-radius: 50%;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
}

.toolbarClose:hover {
    background: #e0e0e0;
}

html, body {
    height: 100%;
    margin: 0;
    background: #ffffff;
}

/* App area starts below fixed nav */
#app {
    position: relative;
    width: 100%;
    height: calc(100% - var(--nav-h));
    overflow: hidden;
}

#app canvas {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
}

#textOverlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    pointer-events: none; /* completely disabled by default */
    /*z-index: -1; !* behind everything by default *!*/
    touch-action: none;
    background: transparent;
    visibility: hidden; /* completely hidden by default */
}

/* Canvas container visibility handled by TextOverlayComponent directly */
body {
    padding-top: var(--nav-h);
}

/* Top navigation */
.topNav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    background: #ffdc00;
    border-bottom: 1px solid #e3b600;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}
*{
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.topNav .navInner {
    max-width: 1200px;
    margin: 0 auto;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.topNav .brand {
    font-weight: 800;
    color: #5a4300;
    letter-spacing: 0.02em;
}

.topNav .navLinks {
    list-style: none;
    display: flex;
    gap: 16px;
    margin: 0;
    padding: 0;
}

.topNav .navLinks a {
    text-decoration: none;
    color: #5a4300;
    font-weight: 600;
}

.topNav .navLinks a:hover {
    text-decoration: underline;
}

canvas {
    display: block;
}

/* When a background is requested, we apply it via CSS variable to avoid CORS with WebGL */
/* Cursor behavior for interaction */
canvas {
    cursor: grab;
}

canvas.dragging {
    cursor: grabbing;
}

/* Text editing cursor styles handled by TextOverlayComponent directly */
canvas.hasBg {
    background: var(--canvas-bg, none) center / cover no-repeat fixed;
}

/* Simple floating UIs: transparent containers; cards are in .controlSection */
#uiLeft, #uiRight {
    position: fixed;
    top: 70px;
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    color: #111;
    box-shadow: none;
    /*min-width: 220px;*/
}

#uiLeft {
    left: 12px;
}

#uiRight {
    right: 12px;
}

.controlSection {
    margin-bottom: 14px;
    background: rgba(255, 255, 255, 0.9);
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    max-height: 25vh;
    overflow: auto;
}

.controlSection .row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 8px 0;
}

.controlSection label {
    flex: 0 0 120px;
    font-size: 13px;
    color: #333;
}

.controlSection input[type="range"] {
    flex: 1 1 auto;
}

.controlSection .value {
    width: 42px;
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-size: 12px;
    color: #555;
}

.morphLabel {
    flex: 0 0 160px;
}

.emptyNote {
    font-size: 12px;
    color: #666;
}

/* Yellow themed sliders */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    height: 18px; /* space for thumb */
    background: transparent;
    cursor: pointer; /* hand cursor on sliders */
}

/* WebKit (Chrome/Electron/Safari) */
input[type="range"]::-webkit-slider-runnable-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #fff7c8 0%, #fbd24d 100%);
    border: 1px solid #e3b600;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    margin-top: -6px; /* centers on 6px track */
    border-radius: 50%;
    background: #facc15;
    border: 1px solid #a47800;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

/* Firefox */
input[type="range"]::-moz-range-track {
    height: 6px;
    border-radius: 999px;
    background: linear-gradient(90deg, #fff7c8 0%, #fbd24d 100%);
    border: 1px solid #e3b600;
}

input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #facc15;
    border: 1px solid #a47800;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    cursor: pointer;
}

.sectionHeader {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.sectionHeader .sectionTitle {
    margin: 0;
    flex: 1 1 auto;
    font-weight: 700;
    font-size: 14px;
    color: #111;
    letter-spacing: 0.02em;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sectionHeader .sectionTitle::before {
    content: '';
    display: inline-block;
    width: 6px;
    height: 14px;
    border-radius: 3px;
    background: linear-gradient(180deg, #FDE68A 0%, #F59E0B 100%);
}

.sectionHeader button {
    /* color: red; */
    flex: 0 0 auto;
    /* padding: 6px 10px; */
    font-size: 12px;
    /* border-radius: 8px; */
    /* background: linear-gradient(180deg, #FFF7C2 0%, #FDE68A 100%); */
    cursor: pointer;
    margin-top: 0;
    color: #927500;
    border: none;
    background: none;
    /* text-decoration: underline; */
}

.sectionHeader button:hover {
    background: linear-gradient(180deg, #e3e3e3 0%, #fff7c8 100%);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 2px 4px rgba(0, 0, 0, 0.08);
}

.sectionHeader button:active {
    transform: translateY(1px);
}

.controlSection {
    margin-bottom: 14px;
    background: rgba(255, 255, 255, 0.3);
    border: 1px solid #ddd;
    border-radius: 8px;
    padding: 10px 12px;
    box-shadow: 0 2px 15px rgb(87 87 87 / 42%);
    max-height: 25vh;
    overflow: auto;
}

/* Responsive tightening for small screens */
@media (max-width: 600px) {
    .controlSection .row {
        gap: 6px;
        margin: 6px 0;
    }

    .controlSection label {
        flex: 0 0 120px;
    }

    .controlSection input[type="range"] {
        flex: 1 1 auto;
        max-width: 60vw;
    }

    .controlSection .value {
        display: none;
    }

    .morphLabel {
        flex-basis: 45%;
    }
}

@media (max-width: 768px) {
    .controlSection .value {
        display: none;
    }
}



.txtol {
    font-family: Arial, sans-serif;
}

.txtol button {
    /*padding: 8px 16px;*/
    /*margin: 5px;*/
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    font-size: 14px;
}

.txtol button:hover {
    background: #f0f0f0;
}

.txtol button.active {
    background: #007bff;
    color: white;
}

/* Align txtolControls styling with bgUploadPanel for consistency */
#txtolControls {
    position: fixed;
    left: 12px;
    background: #fff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

#txtolControls, .bgUploadPanel {
    bottom: 100px;
}

/* Add padding to content area below header */
#txtolControls > div:not(.txtol-header) {
    padding: 12px 16px;
}

#txtolClearBtn, #txtolToggleCanvasBtn{
  display: none;
}

/* Style close button to match header design */
#txtolCloseBtn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.2s ease;
}

#txtolCloseBtn:hover {
    background: rgba(0, 0, 0, 0.1);
    color: #333;
}

/* Animation buttons grid styling */
.animation-buttons-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 10px 0;
}

/* Responsive: 1 column for small devices */
@media (max-width: 768px) {
    .animation-buttons-grid {
        grid-template-columns: 1fr;
    }
}

.animation-btn {
    padding: 8px 12px;
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    text-align: center;
    transition: all 0.2s ease;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.animation-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.animation-btn.active {
    background: #007bff;
    color: white;
    border-color: #0056b3;
}

.animation-btn:active {
    transform: translateY(1px);
}

.txtol input, .txtol select {
    font-size: 14px;
}

.txtol #txtolColorPresets {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.txtol .txtol-tooltip {
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
    max-width: 300px;
    pointer-events: none;
}


#txtolTextToolbar {
    display: none;
    /*margin: 10px;*/
    /*border: 2px solid #d8d8d8;*/
    /*border-radius: 8px;*/
    /*background: #f8f9fa;*/
}

.txtol-form {
    border-bottom: 1px solid #ccc;
    background: #f4f4f4;
}

/*#txtolDeleteTextBtn, #txtolAddTextBtn {*/
/*    width: 32px;*/
/*    height: 32px;*/
/*    border-radius: 4px;*/
/*    font-size: 16px;*/
/*    cursor: pointer;*/
/*    display: flex;*/
/*    align-items: center;*/
/*    justify-content: center;*/
/*}*/
/*#txtolDeleteTextBtn {*/
/*    border: 1px solid #ffcfd4;*/
/*    background: #ffecec;*/
/*    color: #dc3545;*/
/*    display: none;*/
/*}*/

/*#deleteImageBtn{*/
/*    border: 1px solid #ffcfd4;*/
/*    background: #ffecec;*/
/*    color: #dc3545;*/
/*    cursor: pointer;*/
/*}*/


.txt-deleter{
    display: flex;
    align-items: center;
    margin-bottom: 8px;
    /*border: 1px solid #ff9090;*/
    /*border-radius: 5px;*/
    padding-left: 2px;
    margin: 5px;
    padding: 5px;
    justify-content: flex-end;
}

#txtolTextToolbar input[type="range"] {
  width: 100px;
}

#txtolTextToolbar-info{
    padding: 0px !important;
    margin: 0px !important;
}

#txtolTextToolbar input[type="number"]{
  padding: 0;
  border: 1px solid #d8d8d8;
  border-radius: 4px;
  font-size: 13px;
  text-align: center;
}

/* ===== COMPACT TEXT TOOLBAR STYLES ===== */
.compact-text-toolbar {
    /*padding: 8px;*/
    /*background: rgba(255, 255, 255, 0.95);*/
    /*border-radius: 8px;*/
    /*box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);*/
    /*backdrop-filter: blur(10px);*/
    /*border: 1px solid rgba(0, 0, 0, 0.1);*/
    /*max-width: 280px;*/
}

.toolbar-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.toolbar-row:last-child {
    margin-bottom: 0;
}

/* Font Select */
.font-select {
    flex: 1;
    min-width: 80px;
    height: 28px;
    padding: 4px 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 12px;
    background: white;
    cursor: pointer;
}

.font-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Style Buttons */
.style-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    color: #333;
}

.style-btn:hover {
    background: #f8f9fa;
    border-color: #007bff;
}

.style-btn.active {
    background: #007bff;
    border-color: #007bff;
    color: white;
}

.style-btn svg {
    pointer-events: none;
}

/* Color Controls */
.color-control {
    display: flex;
    align-items: center;
    gap: 2px;
    position: relative;
}

.color-control svg {
    color: #666;
}

.color-btn {
    width: 20px;
    height: 20px;
    border: 1px solid #ddd;
    border-radius: 3px;
    cursor: pointer;
    position: relative;
}

.color-picker-popup {
    position: absolute;
    bottom: 25px;
    left: -60px;
    z-index: 100001;
    display: none;
}

/* Size Selects */
.size-select {
    width: 45px;
    height: 28px;
    padding: 2px 4px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 11px;
    background: white;
    cursor: pointer;
}

.size-select:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

/* Control Groups */
.control-group {
    margin-right: 10px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* Delete Button */
.delete-btn {
    width: 28px;
    height: 28px;
    border: 1px solid #dc3545;
    border-radius: 4px;
    background: #fff5f5;
    color: #dc3545;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    margin-left: auto;
}

.delete-btn:hover {
    background: #dc3545;
    color: white;
}

.delete-btn svg {
    pointer-events: none;
}

/* Legacy support for existing functionality */
#txtolTextColorBtn, #txtolStrokeColorBtn, #txtolShadowColorBtn {
    background: #ff0000;
}

#txtolStrokeColorBtn {
    background: #00ff00;
}

#txtolShadowColorBtn {
    background: #888888;
}
input[type="text"]{
  border: 1px solid #d8d8d8;
}

input[type="text"]:focus, input[type="text"]:active, input[type="text"]:focus-visible,
input[type="text"]:focus-within, input[type="text"]:target{
  border: solid 1px #e6ac22
}
.controlSection .value {
  display: none;
}

body.is-joe #downloadBtn,body.is-joe #toggleCanvasBtn  {
    display: inline-flex;
}

body:not(.is-joe) #downloadBtn {
    display: inline-flex;
}

body:not(.is-joe) #toggleCanvasBtn, body:not(.is-joe) #addBgBtn, body:not(.is-joe) #toggle-collapse-all {
    display: none;
}

#addBgBtn{
    display: none;
}


/* 3-Way Mode Toggle Styles */
.mode-toggle-3way {
  display: flex;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 24px;
  padding: 4px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15), 0 2px 4px rgba(0, 0, 0, 0.1);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  margin-right: 15px;
}

.mode-btn {
  padding: 8px 16px;
  border: none;
  background: transparent;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  color: #666;
  font-family: verdana, serif;
  min-width: 60px;
}

.mode-btn:hover {
  background: rgba(102, 126, 234, 0.1);
  color: #333;
}

.mode-btn.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
  transform: translateY(-1px);
}

.mode-btn.active:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}


#textPanelBtn{
  display: none;
}

button.toggle-btn {
    padding: 6px;
    background: white;
    color: #333;
    border: 2px solid #ffd700;
    border-radius: 8px;
    cursor: pointer;
    font-size: 20px;
    position: relative;
    box-shadow: 1px 1px 9px #dab93e;
    transition: all 0.1s ease;
}

button.toggle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* Toggle buttons styling */
.toggle-btn {
    position: relative;
    overflow: hidden;
}
button.toggle-btn.hidden::after {
    display: none;
}

button.toggle-btn.hidden {
    background: white;
    border-color: #bbb;
    box-shadow: none !important;
}

/* Collapse all button states */
button.toggle-btn.expand-all {
    background: white;
    border-color: #ffd700;
    color: #333;
}

button.toggle-btn.collapse-all {
    transform: rotate(-90deg) !important;
}

button.toggle-btn.expand-all:hover,
button.toggle-btn.collapse-all:hover {
    background: #f8f9fa;
    /*transform: scale(1.05);*/
}

/* UI panels toggle button states */
button.toggle-btn.ui-visible {
    /*background: white;*/
    /*border-color: #ffd700;*/
    /*color: #333;*/
}

button.toggle-btn.ui-hidden {
    /*background: #ffe6e6;*/
    /*border-color: #ff6b6b;*/
    background: white;
    border-color: #bbb;
    box-shadow: none !important;
    /*color: #d63031;*/
}

button.toggle-btn.ui-visible:hover,
button.toggle-btn.ui-hidden:hover {
    background: #f8f9fa;
}

/*#deleteImageBtn {*/
/*    padding: 5px;*/
/*}*/
