/* ============================================================
   TOOL CSS — Extracted from Image-Prep-Tool index.html
   Palette is overridden below to match the site's brand colors.
   ============================================================ */ 

/* Override tool CSS variables to match site palette — second :root below wins */
:root {
    --brand-primary: #6830BB;   /* purple primary */
    --brand-hover: #30BBAD;     /* teal accent */
    --brand-bg: #110e1c;
    --brand-text-pri: #f0eeff;
    --brand-text-sec: #9888c0;
    --success-green: #83BB30;
    --danger-red: #BB303E;
}

/* ── PHANTOM TEMPLATE RESET for all tool buttons ──
   Phantom's global button rule forces height:3.5em, overflow:hidden,
   color:#585858!important, and a pink box-shadow on hover.
   These overrides neutralise every one of those for our tool UI. */
.tool-tab-btn,
.mat-size-btn,
.action-btn,
.acc-btn,
.ui-select,
#zoom-toolbar button {
    box-shadow: none !important;
    height: auto !important;
    line-height: normal !important;
    overflow: visible !important;
}
.tool-tab-btn,
.mat-size-btn,
.action-btn,
.acc-btn,
#zoom-toolbar button {
    padding-left: unset;
    padding-right: unset;
}
.tool-tab-btn:hover,
.mat-size-btn:hover,
.action-btn:hover,
.acc-btn:hover,
#zoom-toolbar button:hover {
    box-shadow: none !important;
    color: inherit;   /* let component-level rules take effect */
}

    /* ── TOOL TABS ── */
    .tool-tab-bar {
        display: flex;
        border-bottom: 2px solid rgba(255,255,255,0.12);
        margin-bottom: 28px;
        gap: 4px;
        flex-wrap: wrap;
        justify-content: center;
    }
    .tool-tab-btn {
        background: rgba(255,255,255,0.04);
        border: 1px solid rgba(255,255,255,0.1);
        border-bottom: 3px solid transparent;
        border-radius: 6px 6px 0 0;
        margin-bottom: -2px;
        padding: 14px 12px;
        color: #9888c0 !important;
        font-size: 14px;
        font-weight: 700;
        letter-spacing: 1.5px;
        text-transform: uppercase;
        cursor: pointer;
        transition: color 0.15s, border-color 0.15s, background 0.15s;
        white-space: nowrap;
        font-family: 'Plus Jakarta Sans', sans-serif;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        gap: 7px;
        flex: 1 1 0;
        min-width: 0;
    }
    .tool-tab-btn:hover {
        color: #8565B5 !important;
        background: rgba(133,101,181,0.1);
        border-color: rgba(133,101,181,0.3);
        border-bottom-color: transparent;
    }
    .tool-tab-btn.active {
        color: #30BBAD !important;
        border-bottom-color: #30BBAD;
        background: rgba(48,187,173,0.08);
        border-color: rgba(48,187,173,0.25);
        border-bottom-color: #30BBAD;
    }
    .tool-tab-panel { display: none; }
    .tool-tab-panel.active { display: block; }

    /* ── QUICK UPLOAD INLINE / TAB MODE ── */
    /* When #simple-backdrop is moved into the tab panel it becomes a static block */
    #simple-backdrop.tab-mode {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        background: transparent !important;
        padding: 0 !important;
        display: block !important;
        z-index: auto !important;
        overflow: visible !important;
    }
    #simple-backdrop.tab-mode #simple-modal {
        max-width: none !important;
        max-height: none !important;
        box-shadow: 0 4px 20px rgba(0,0,0,0.4) !important;
        overflow: visible !important;
        height: auto !important;
    }
    #simple-backdrop.tab-mode #simple-canvas-wrap {
        overflow: visible !important;
        height: auto !important;
        min-height: 0 !important;
    }
    #simple-backdrop.tab-mode #simple-tools {
        overflow-y: visible !important;
        overflow: visible !important;
    }
    #simple-backdrop.tab-mode .version-tag { display: none; }

    /* ── ADVANCED EDITOR INLINE / TAB MODE ── */
    /* When #adv-backdrop is moved into the tab panel it becomes a static block */
    #adv-backdrop.tab-mode {
        position: static !important;
        width: 100% !important;
        height: auto !important;
        background: transparent !important;
        padding: 0 !important;
        display: block !important;
        z-index: auto !important;
        overflow: visible !important;
    }
    #adv-backdrop.tab-mode #playmat-tool-root {
        max-width: none !important;
        width: 100% !important;
        height: calc(100vh - 220px) !important;
        min-height: 500px !important;
        max-height: none !important;
        border-radius: 6px !important;
    }
    #adv-backdrop.tab-mode .version-tag { display: none; }

    /* ── RESPONSIVE WIDTH ── */
    /* Override the source's max-width:600px on #landing-ui so it fills wide screens */
    #landing-ui {
        max-width: none !important;
        width: 100% !important;
        padding: 10px 32px !important;
        box-sizing: border-box;
    }
    /* Make batch/converter preview grids denser on wider screens */
    @media (min-width: 700px) {
        #batch-preview-grid,
        #converter-preview-grid {
            grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
        }
    }
    @media (min-width: 1000px) {
        #landing-ui { padding: 10px 48px !important; }
        #batch-preview-grid,
        #converter-preview-grid {
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        }
    }
    @media (min-width: 1400px) {
        #landing-ui { padding: 10px 64px !important; }
    }

    /* ── SIMPLE EDITOR FULL-SCREEN MODE ── */
    #simple-modal.simple-fullscreen-mode {
        position: fixed !important;
        top: 5vh !important;
        left: 5vw !important;
        right: auto !important;
        width: 90vw !important;
        height: 90vh !important;
        max-width: 90vw !important;
        max-height: 90vh !important;
        box-sizing: border-box !important;
        z-index: 10000 !important;
        border-radius: 6px !important;
    }
    :root {
        --brand-primary: #6830BB;   /* purple primary */
        --brand-hover: #30BBAD;     /* teal — site interactive accent */
        --brand-bg: #181228;        /* dark purple — matches site surface */
        --brand-text-sec: #9888c0;
        --brand-text-pri: #f0eeff;
        --success-green: #83BB30;
        --danger-red: #BB303E;
        --app-width: 85%;
    }
    
    .designer-container-wrap { width: 100%; padding: 24px 0; display: flex; flex-direction: column; align-items: stretch; background: transparent; font-family: 'Plus Jakarta Sans', sans-serif; font-size: 16px; color: var(--brand-text-pri); }

    /* Allow the viewport-breakout on #designer-visibility-wrapper to overflow .inner */
    html body #wrapper #tools > div.inner {
        overflow: visible !important;
    }
    
    /* UI Components */
    .ui-select { width: 100%; box-sizing: border-box !important; padding: 12px 36px 12px 12px !important; background-color: rgba(0,0,0,0.2) !important; background-image: url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0naHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmcnIHdpZHRoPScxMicgaGVpZ2h0PSc4JyB2aWV3Qm94PScwIDAgMTIgOCc+PHBhdGggZD0nTTEgMWw1IDUgNS01JyBzdHJva2U9JyMwMGM5YTcnIHN0cm9rZS13aWR0aD0nMS44JyBmaWxsPSdub25lJyBzdHJva2UtbGluZWNhcD0ncm91bmQnIHN0cm9rZS1saW5lam9pbj0ncm91bmQnLz48L3N2Zz4=") !important; background-repeat: no-repeat !important; background-position: right 12px center !important; background-size: 12px 8px !important; color: var(--brand-text-pri); border: 1px solid rgba(255,255,255,0.2); border-radius: 6px; font-size: 12px; font-family: 'Plus Jakarta Sans', sans-serif; transition: border 0.3s; cursor: pointer; appearance: none; -webkit-appearance: none; height: auto !important; }
    .ui-select:focus { outline: none; border-color: var(--brand-hover); }
    .ui-select option { background: var(--brand-bg); color: var(--brand-text-pri); }
    
    /* ── ACTION BUTTONS ── */
    .action-btn { width: 100%; box-sizing: border-box; background: var(--brand-primary); border: none !important; font-weight: 700; font-family: 'Plus Jakarta Sans', sans-serif; cursor: pointer; color: #fff !important; transition: background 0.2s, transform 0.1s; padding: 10px 14px; border-radius: 6px; font-size: 14px !important; letter-spacing: 0.8px; text-transform: uppercase; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 7px; min-width: 0; }
    .action-btn:hover:not(:disabled) { background: var(--brand-hover) !important; color: #fff !important; }
    .action-btn:active:not(:disabled) { transform: scale(0.98); }
    .btn-secondary { background: rgba(255,255,255,0.1) !important; color: #f0eeff !important; border: 1px solid rgba(255,255,255,0.2) !important; }
    .btn-secondary:hover:not(:disabled) { background: var(--brand-hover) !important; border-color: var(--brand-hover) !important; color: #fff !important; }

    /* Advanced editor btn-secondary — white text, visible on dark bg */
    #playmat-tool-root .btn-secondary,
    #zoom-toolbar .btn-secondary {
        background: rgba(255,255,255,0.15) !important;
        color: #fff !important;
        border: 1px solid rgba(255,255,255,0.25) !important;
    }
    #playmat-tool-root .btn-secondary:hover:not(:disabled),
    #zoom-toolbar .btn-secondary:hover:not(:disabled) {
        background: var(--brand-hover) !important;
        border-color: var(--brand-hover) !important;
        color: #fff !important;
    }

    /* Landing page editor choice buttons */
    .btn-landing-simple { background: #10333D !important; color: #fff !important; border: none; }
    .btn-landing-adv    { background: var(--brand-primary) !important; color: #fff !important; border: none; }
    .btn-landing-simple:hover:not(:disabled),
    .btn-landing-adv:hover:not(:disabled) { background: var(--brand-hover) !important; }
    .action-btn:disabled { background: rgba(255,255,255,0.2) !important; color: rgba(255,255,255,0.5); cursor: not-allowed; transform: none; }

    .beta-badge { background: var(--brand-hover); color: var(--brand-bg); padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: bold; letter-spacing: 1px; }

    input[type=range] { -webkit-appearance: none; width: 100%; background: transparent; }
    input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; height: 18px; width: 18px; border-radius: 50%; background: var(--brand-hover); cursor: pointer; margin-top: -7px; box-shadow: 0 0 0 3px rgba(48,187,173,0.3), 0 1px 4px rgba(0,0,0,0.5); transition: box-shadow 0.2s; }
    input[type=range]:hover::-webkit-slider-thumb { box-shadow: 0 0 0 5px rgba(48,187,173,0.35), 0 0 10px rgba(48,187,173,0.55), 0 1px 4px rgba(0,0,0,0.5); }
    input[type=range]:active::-webkit-slider-thumb { box-shadow: 0 0 0 6px rgba(48,187,173,0.45), 0 0 14px rgba(48,187,173,0.65), 0 1px 4px rgba(0,0,0,0.5); }
    input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 4px; cursor: pointer; background: linear-gradient(to right, var(--brand-hover) var(--fill-pct, 0%), rgba(104,48,187,0.35) var(--fill-pct, 0%)); border-radius: 6px; transition: filter 0.2s; }
    input[type=range]:hover::-webkit-slider-runnable-track { filter: drop-shadow(0 0 5px rgba(48,187,173,0.75)); }
    input[type=range]::-moz-range-track { width: 100%; height: 4px; cursor: pointer; background: rgba(104,48,187,0.35); border-radius: 6px; border: none; }
    input[type=range]::-moz-range-progress { background: var(--brand-hover); height: 4px; border-radius: 6px; transition: box-shadow 0.2s; }
    input[type=range]:hover::-moz-range-progress { box-shadow: 0 0 6px 2px rgba(48,187,173,0.65); }
    input[type=range]::-moz-range-thumb { height: 18px; width: 18px; border-radius: 50%; background: var(--brand-hover); cursor: pointer; border: none; box-shadow: 0 0 0 3px rgba(48,187,173,0.3), 0 1px 4px rgba(0,0,0,0.5); transition: box-shadow 0.2s; }
    input[type=range]:hover::-moz-range-thumb { box-shadow: 0 0 0 5px rgba(48,187,173,0.35), 0 0 10px rgba(48,187,173,0.55), 0 1px 4px rgba(0,0,0,0.5); }
    input[type=range]:active::-moz-range-thumb { box-shadow: 0 0 0 6px rgba(48,187,173,0.45), 0 0 14px rgba(48,187,173,0.65), 0 1px 4px rgba(0,0,0,0.5); }
    
    .color-swatch { width: 100%; height: 40px; border: 1px solid rgba(255,255,255,0.2); border-radius: 6px; background: none; cursor: pointer; padding: 0; }
    .hidden-field { display: none !important; }

    /* --- LANDING UI --- */
    #landing-ui { text-align: center; padding: 10px 20px; background: transparent; max-width: 600px; width: 100%; }
    #landing-ui p { color: #444 !important; }
    .landing-label { color: var(--brand-hover); font-size: 14px; font-weight: bold; letter-spacing: 1px; display: block; margin-bottom: 8px; }

    /* --- ADVANCED EDITOR --- */
    #playmat-tool-root { display: flex; width: 100%; height: clamp(650px, 90vh, 1050px); background: #181228; overflow: hidden; box-shadow: 0 20px 50px rgba(0,0,0,0.5); position: relative; flex-direction: column; }
    .app-fullscreen-mode { position: fixed !important; top: 5vh !important; left: 5vw !important; right: auto !important; width: 90vw !important; height: 90vh !important; max-width: 90vw !important; max-height: 90vh !important; box-sizing: border-box !important; z-index: 10000 !important; border-radius: 6px !important; }

    /* ── EDITOR TOP BAR ── */
    #editor-top-bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 14px; background: rgba(0,0,0,0.35); border-bottom: 1px solid rgba(104,48,187,0.3); flex-shrink: 0; gap: 12px; }
    .etb-group { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
    .etb-title { display: flex; flex-direction: column; align-items: center; flex: 0 1 auto; min-width: 0; gap: 2px; }
    #editor-top-bar .action-btn { width: auto; padding: 7px 14px; font-size: 11px !important; letter-spacing: 0.5px; white-space: nowrap; }

    /* ── EDITOR MAIN (sidebar + canvas side-by-side) ── */
    #editor-main { display: flex; flex-direction: row; flex: 1; min-height: 0; overflow: hidden; }

    #sidebar { width: 300px; border-right: 1px solid rgba(104,48,187,0.25); overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; scrollbar-color: rgba(104,48,187,0.7) rgba(255,255,255,0.05); background: #0f1314; flex-shrink: 0; z-index: 20; display: flex; flex-direction: column; }
    #sidebar::-webkit-scrollbar { display: block; width: 6px; }
    #sidebar::-webkit-scrollbar-thumb { background: rgba(104,48,187,0.7); border-radius: 4px; }
    #sidebar::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); }
    /* Sidebar action buttons: keep text from overflowing the fixed 300px panel */
    #sidebar .action-btn { font-size: 11px !important; letter-spacing: 0.5px; padding: 9px 10px; }

    .studio-title-wrap { padding: 16px 15px; text-align: center; background: rgba(104,48,187,0.15); border-bottom: 1px solid rgba(104,48,187,0.25); }
    .studio-title { margin:0; font-size:18px; color:#30BBAD; text-transform:uppercase; letter-spacing:2px; font-family:'Plus Jakarta Sans', sans-serif; font-weight:700; }
    .studio-subtitle { font-size:12px; color:#9888c0; letter-spacing:2px; text-transform:uppercase; font-weight:600; }

    .sidebar-header { background: rgba(0,0,0,0.3); padding: 10px 12px; border-bottom: 1px solid rgba(255,255,255,0.08); display: flex; gap: 8px; justify-content: center; }
    /* Sidebar header buttons — compact */
    .sidebar-header .action-btn { font-size: 14px !important; padding: 8px 14px; letter-spacing: 1px; }

    /* ── ACCORDION CARDS ── */
    .acc-card { margin: 8px; border-radius: 8px; border: 1px solid rgba(104,48,187,0.35); overflow: hidden; background: #181228; flex-shrink: 0; }
    .acc-btn { width: 100%; padding: 11px 16px; background: rgba(104,48,187,0.08) !important; color: #f0eeff !important; border: none !important; border-bottom: 1px solid rgba(104,48,187,0.2) !important; text-align: left; cursor: pointer; font-size: 14px !important; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; display: flex; justify-content: space-between; align-items: center; transition: background 0.2s; font-family: 'Plus Jakarta Sans', sans-serif; box-sizing: border-box; }
    .acc-btn:hover { background: rgba(104,48,187,0.18) !important; color: #30BBAD !important; }
    .acc-content { padding: 16px; display: none; background: transparent; border-bottom: none; }
    .slider-row { margin-top: 12px; }
    .slider-row label { font-size: 12px; color: var(--brand-text-sec); display: block; margin-bottom: 6px; text-transform: uppercase; font-weight: 500; }
    .adj-item { margin-top: 12px; }
    .adj-item:first-child { margin-top: 0; }
    .adj-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 5px; }
    .adj-name { font-size: 11px; color: var(--brand-text-sec); text-transform: uppercase; font-weight: 500; display: flex; align-items: center; gap: 4px; }
    .adj-tip { display: inline-flex; align-items: center; justify-content: center; width: 13px; height: 13px; border-radius: 50%; border: 1px solid currentColor; font-size: 9px; cursor: help; opacity: 0.55; line-height: 1; flex-shrink: 0; position: relative; }
    .adj-right { display: flex; align-items: center; gap: 5px; }
    .adj-val { font-size: 10px; color: var(--brand-text-sec); font-variant-numeric: tabular-nums; min-width: 32px; text-align: right; opacity: 0.8; }
    .adj-reset { background: rgba(48,187,173,0.07); border: 1px solid rgba(48,187,173,0.28); border-radius: 4px; color: var(--brand-hover); cursor: pointer; font-size: 14px; width: 22px; height: 22px; padding: 0; display: grid; place-items: center; opacity: 0.55; line-height: 1; transition: opacity 0.15s, background 0.15s; flex-shrink: 0; }
    .adj-reset:hover { opacity: 1; background: rgba(48,187,173,0.2); }
    .btn-eraser.active { background: #BB303E !important; box-shadow: 0 0 12px rgba(187,48,62,0.4); border-color: #BB303E !important; }
    .btn-recolor.active { background: #83BB30 !important; box-shadow: 0 0 12px rgba(131,187,48,0.4); border-color: #83BB30 !important; }
    #canvas-size-btns { display: flex; flex-direction: row; align-items: center; gap: 4px; flex-wrap: nowrap; margin-right: 12px; padding-right: 16px; border-right: 1px solid rgba(255,255,255,0.12); }
    .canvas-sz-label { color: var(--brand-text-sec); font-size: 10px; font-weight: bold; letter-spacing: 1px; white-space: nowrap; }
    #playmat-tool-root .canvas-sz-btn { padding: 5px 9px !important; font-size: 10px !important; min-width: 0 !important; letter-spacing: 0.5px; }
    #playmat-tool-root .canvas-sz-btn.canvas-sz-active,
    #playmat-tool-root #dl-fmt-jpeg.canvas-sz-active,
    #playmat-tool-root #dl-fmt-png.canvas-sz-active { background: var(--brand-hover) !important; border-color: var(--brand-hover) !important; color: #fff !important; }
    #canvas-column { flex-grow: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; background: #0b0912; position: relative; overflow: hidden; cursor: default; }
    /* Large canvas mode — editor box expands to fit full-width canvas */
    #playmat-tool-root.size-mode-large { height: auto !important; max-height: none !important; overflow: visible !important; }
    /* In fullscreen, L mode expands to full viewport for maximum canvas width */
    #playmat-tool-root.app-fullscreen-mode.size-mode-large { width: 100vw !important; left: 0 !important; top: 0 !important; height: 100vh !important; border-radius: 0 !important; }
    /* Tab-mode applies height: calc(100vh - 220px) !important with higher specificity (2,1,0) so we must match it */
    #adv-backdrop.tab-mode #playmat-tool-root.size-mode-large { height: auto !important; overflow: visible !important; }
    #playmat-tool-root.size-mode-large #editor-main { flex: none; height: auto; overflow: visible; }
    #playmat-tool-root.size-mode-large #canvas-column { height: auto; overflow: visible; justify-content: flex-start; padding: 8px; }
    #playmat-tool-root.size-mode-large #sidebar { position: sticky; top: 0; max-height: 100vh; overflow-y: auto; align-self: flex-start; }
    #canvas-wrapper { position: relative; line-height: 0; box-shadow: 0 0 40px rgba(0,0,0,0.6); transform-origin: center center; transition: transform 0.2s; cursor: none; flex-shrink: 0; margin-bottom: 16px; }
    .compass { width: 24px; height: 24px; border: 1px solid rgba(255,255,255,0.3); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: bold; color: var(--brand-hover); }
    #zoom-toolbar { position: absolute; top: 14px; right: 14px; background: rgba(11,9,18,0.75); padding: 6px 10px; border-radius: 6px; box-shadow: 0 4px 12px rgba(0,0,0,0.4); z-index: 10; display: flex; gap: 6px; align-items: center; border: 1px solid rgba(104,48,187,0.3); }
    #zoom-toolbar .btn-secondary { font-size: 12px !important; padding: 5px 10px !important; letter-spacing: 0.5px; min-width: 28px; }
    #zoom-toolbar span { font-size: 12px !important; color: #9888c0; letter-spacing: 1px; font-weight: 700; text-transform: uppercase; font-family: 'Plus Jakarta Sans', sans-serif; }
    .version-tag { position: absolute; bottom: 8px; right: 12px; font-size: 10px; color: rgba(255,255,255,0.25); font-family: monospace; z-index: 100; pointer-events: none; }

    /* HIGH CONTRAST BRUSH CURSOR */
    #brush-cursor { 
        position: fixed; 
        pointer-events: none; 
        z-index: 9999999 !important; 
        display: none; 
        border: 2px solid #FFFFFF; 
        box-shadow: 0 0 4px #000000, inset 0 0 4px #000000;
        background: rgba(255, 255, 255, 0.15);
        transform: translate(-50%, -50%); 
    }
    
    .inner-panel { background: rgba(0,0,0,0.2); padding: 15px; border-radius: 6px; margin-bottom: 15px; border: 1px solid rgba(255,255,255,0.05); }
    .panel-title { font-size: 12px; font-weight: bold; color: var(--brand-hover); display: block; margin-bottom: 10px; letter-spacing: 0.5px; text-transform: uppercase; }
    .disclaimer-text { font-size: 10px; color: var(--brand-text-sec); display: block; text-align: center; }

    /* --- SIMPLE EDITOR BUTTON OVERRIDES ---
       btn-secondary inside the dark simple modal needs white text and
       a visible background — overrides the light-page defaults. */
    #simple-modal .btn-secondary,
    #simple-modal .action-btn.btn-secondary {
        background: rgba(255,255,255,0.15) !important;
        color: #fff !important;
        border: 1px solid rgba(255,255,255,0.25) !important;
    }
    #simple-modal .btn-secondary:hover:not(:disabled),
    #simple-modal .action-btn.btn-secondary:hover:not(:disabled) {
        background: var(--brand-hover) !important;
        border-color: var(--brand-hover) !important;
        color: #fff !important;
    }

    /* --- PRESET BUTTON TOOLTIPS --- */
    .preset-btn-tip { position: relative; }
    .preset-btn-tip::after {
        content: attr(data-tip);
        position: absolute;
        bottom: calc(100% + 7px);
        left: 50%;
        transform: translateX(-50%);
        background: #1a1428;
        color: var(--brand-text);
        border: 1px solid rgba(104,48,187,0.45);
        border-radius: 6px;
        padding: 6px 10px;
        font-size: 10px;
        font-weight: normal;
        line-height: 1.45;
        white-space: normal;
        width: 160px;
        text-align: center;
        z-index: 200;
        box-shadow: 0 4px 14px rgba(0,0,0,0.55);
        pointer-events: none;
        opacity: 0;
        letter-spacing: 0;
        text-transform: none;
        transition: opacity 0s;
    }
    .preset-btn-tip::before {
        content: '';
        position: absolute;
        bottom: calc(100% + 2px);
        left: 50%;
        transform: translateX(-50%);
        border: 5px solid transparent;
        border-top-color: rgba(104,48,187,0.45);
        z-index: 200;
        pointer-events: none;
        opacity: 0;
        transition: opacity 0s;
    }
    .preset-btn-tip:hover::after,
    .preset-btn-tip:hover::before {
        opacity: 1;
        transition: opacity 0.2s 1s;
    }

    /* --- INFO TOOLTIP --- */
    .info-tooltip { display: inline-flex; align-items: center; justify-content: center; width: 14px; height: 14px; border-radius: 50%; background: rgba(255,255,255,0.15); color: var(--brand-text-sec); font-size: 9px; font-weight: bold; cursor: default; vertical-align: middle; margin-left: 5px; position: relative; font-style: normal; text-transform: none; letter-spacing: 0; line-height: 1; }

    /* --- CANVAS ACTIONS BAR --- */
    #adv-canvas-actions { width: 100%; padding: 14px 20px; background: rgba(0,0,0,0.3); border-top: 1px solid rgba(255,255,255,0.1); flex-shrink: 0; box-sizing: border-box; }
    #adv-canvas-actions .action-row-3 { max-width: 640px; margin: 0 auto; }

    /* --- CANVAS INFO BAR --- */
    .canvas-info-bar { text-align: center; padding: 8px 20px; font-size: 12px; font-family: 'Plus Jakarta Sans', monospace; color: var(--brand-text-sec); background: rgba(0,0,0,0.25); border-top: 1px solid rgba(255,255,255,0.06); line-height: 1.8; letter-spacing: 0.3px; }
    #playmat-tool-root.size-mode-large #adv-info-bar { position: sticky; bottom: 0; z-index: 20; background: #0b0912; border-top: 1px solid rgba(255,255,255,0.08); }
    .canvas-info-bar span { margin: 0 10px; white-space: nowrap; }
    .canvas-info-bar .info-red    { color: #ff4757; font-weight: 700; }
    .canvas-info-bar .info-yellow { color: #ffd32a; font-weight: 700; }
    /* Red info bar state when art doesn't cover canvas */
    .canvas-info-bar.coverage-warn { background: rgba(255,71,87,0.25); border-top-color: rgba(255,71,87,0.4); }
    .canvas-info-bar.coverage-warn #si-dpi,
    .canvas-info-bar.coverage-warn #ai-dpi { color: #ff4757; font-weight: 700; }

    /* --- BLEED WARNING BANNERS --- */
    .bleed-warning-banner { display: none; background: rgba(255,71,87,0.15); border: 1px solid rgba(255,71,87,0.5); border-radius: 6px; padding: 10px 14px; margin-bottom: 12px; font-size: 12px; color: #ff4757; font-weight: 600; line-height: 1.5; text-align: center; }
    .bleed-warning-banner.visible { display: block; }

    /* --- FULLSCREEN BACKDROP BLUR --- */
    #fs-backdrop { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); z-index: 999998; }

    /* --- ADVANCED EDITOR LIGHTBOX --- */
    #adv-backdrop { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.92); z-index: 999999; justify-content: center; align-items: flex-start; padding: 20px; padding-top: max(20px, calc(var(--adv-nav-offset, 80px) + 20px)); box-sizing: border-box; overflow-y: auto; }

    /* --- SIMPLE LIGHTBOX --- */
    #simple-backdrop { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.9); z-index: 999999; justify-content: center; align-items: flex-start; padding: 20px; padding-top: max(20px, calc(var(--adv-nav-offset, 80px) + 20px)); box-sizing: border-box; overflow-y: auto; }
    #simple-modal { background: var(--brand-bg); width: 100%; max-width: min(1400px, 95vw); height: 95vh; max-height: 95vh; border-radius: 8px; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.8); border: 1px solid rgba(255,255,255,0.1); position: relative; }
    #simple-header { padding: 15px 20px; background: rgba(0,0,0,0.3); border-bottom: 1px solid rgba(255,255,255,0.1); display: flex; justify-content: space-between; align-items: center; }
    #simple-canvas-wrap { flex-grow: 1; display: flex; justify-content: center; align-items: center; padding: 20px; background: #0b0912; overflow: auto; min-height: 0; position: relative; }
    #simple-canvas-inner { position: relative; box-shadow: 0 0 30px rgba(0,0,0,0.5); }
    #simple-tools { padding: 20px; background: var(--brand-bg); border-top: 1px solid rgba(255,255,255,0.1); overflow-y: auto; display: flex; flex-direction: column; justify-content: space-between; }

    /* --- OVERLAY MODALS --- */
    .overlay-modal { display: none; position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.85); z-index: 9999999; align-items: center; justify-content: center; padding: 20px; box-sizing: border-box; }
    .overlay-box { background: var(--brand-bg); padding: 30px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.1); max-width: 450px; width: 100%; box-shadow: 0 10px 40px rgba(0,0,0,0.6); font-family: 'Plus Jakarta Sans', sans-serif; position: relative; }
    
    .social-row { display: flex; gap: 20px; align-items: center; justify-content: center; margin-top: 10px; }
    .social-row a { display: flex; align-items: center; justify-content: center; color: var(--brand-text-pri); text-decoration: none; background: rgba(0,0,0,0.2); padding: 12px; border-radius: 50%; transition: 0.2s; border: 1px solid rgba(255,255,255,0.05); }
    .social-row a:hover { background: var(--brand-hover); transform: scale(1.05); }
    .social-icon { width: 24px; height: 24px; fill: currentColor; }

    /* ── THREE-BUTTON ACTION ROW (GET PRINTED | DOWNLOAD | SHARE) ── */
    .action-row-3 { display: flex; gap: 8px; margin-bottom: 10px; }
    .action-row-3 .action-btn { height: auto !important; min-height: 48px; padding: 8px 4px !important; font-size: 13px !important; letter-spacing: 0.3px !important; flex-direction: column !important; gap: 3px !important; white-space: normal !important; line-height: 1.2 !important; }
    /* Advanced editor sidebar: stack buttons vertically at full width */
    #sidebar .action-row-3 { flex-direction: column; gap: 6px; }
    #sidebar .action-row-3 .action-btn { flex-direction: row !important; height: 44px !important; font-size: 13px !important; padding: 10px 14px !important; letter-spacing: 0.8px !important; white-space: nowrap !important; gap: 7px !important; min-height: unset !important; flex: none !important; width: 100% !important; }

    /* --- RESPONSIVENESS --- */
    @media (max-width: 900px) {
        :root { --app-width: 100%; }
        .designer-container-wrap { padding: 0; }

        /* Advanced editor — stack canvas above sidebar, both scroll together */
        #adv-backdrop { padding-top: 0 !important; }
        #playmat-tool-root { border-radius: 0; box-shadow: none; width: 100%; max-width: 100%; height: auto; max-height: none; }
        /* Tab-mode height lock must not clip the stacked sidebar on mobile */
        #adv-backdrop.tab-mode #playmat-tool-root { height: auto !important; overflow: visible !important; }
        #editor-top-bar { flex-wrap: wrap; gap: 8px; }
        #editor-top-bar .etb-title { order: -1; flex: 0 0 100%; text-align: center; }
        #editor-main { flex-direction: column; overflow: visible; }
        #sidebar { width: 100%; order: 2; border-right: none; overflow: visible; flex-shrink: 0; }
        #canvas-column { order: 1; flex-shrink: 0; width: 100%; padding: 10px; padding-top: 120px;
                         height: auto; min-height: 0;
                         background: #0A1F26; border-bottom: 2px solid var(--brand-primary);
                         box-shadow: 0 5px 15px rgba(0,0,0,0.5);
                         display: flex; flex-direction: column;
                         align-items: center; justify-content: flex-start; overflow: visible; }
        #adv-info-bar { font-size: 10px; padding: 6px 10px; }
        #adv-info-bar span { margin: 0 4px; }
        #zoom-toolbar { top: 8px; right: 8px; bottom: auto; transform: scale(0.8); transform-origin: top right; }

        /* Quick upload editor */
        #simple-modal { max-height: 100vh; border-radius: 0; }
        #simple-backdrop { padding: 0; }
        #simple-canvas-wrap { padding: 10px; }
        .simple-tool-grid { grid-template-columns: 1fr !important; }
        /* Mobile: restore original layout — DOWNLOAD+SHARE side-by-side, GET PRINTED full-width below */
        .action-row-3 { flex-wrap: wrap; }
        .action-row-3 > button:first-child { order: 3; flex: 0 0 100% !important; }
        .action-row-3 > button:not(:first-child) { flex: 1; }
        .action-row-3 .action-btn { flex-direction: row !important; height: 48px !important; font-size: 12px !important; padding: 10px 14px !important; letter-spacing: 0.6px !important; white-space: nowrap !important; gap: 7px !important; min-height: unset !important; }
        /* Hide the flex-grow spacer so action buttons appear right after accordions */
        .sidebar-spacer { display: none !important; }
        /* iOS: prevent auto-zoom on select/input focus (requires font-size >= 16px) */
        .ui-select, input[type="text"], input[type="email"], input[type="number"],
        input[type="url"], textarea { font-size: 16px !important; }
        /* Zoom toolbar — minimum 44px touch targets on touch screens */
        #zoom-toolbar button { min-width: 44px !important; min-height: 44px !important; }
        /* Canvas info bar — slightly larger on mobile for readability */
        #adv-info-bar { font-size: 11px !important; }
    }
    @media (hover: none) and (pointer: coarse) { #brush-cursor { display: none !important; } }
    
    /* TOGGLE SWITCH CSS */
    .toggle-wrap { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
    .switch { position: relative; display: inline-block; width: 38px; height: 22px; margin: 0; }
    .switch input { opacity: 0; width: 0; height: 0; }
    .slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: rgba(255,255,255,0.2); transition: .3s; border-radius: 22px; }
    .slider:before { position: absolute; content: ""; height: 16px; width: 16px; left: 3px; bottom: 3px; background-color: white; transition: .3s; border-radius: 50%; box-shadow: 0 2px 4px rgba(0,0,0,0.3); }
    .switch input:checked + .slider { background-color: var(--success-green); }
    .switch input:checked + .slider:before { transform: translateX(16px); }
    .toggle-label { font-size: 12px; color: var(--brand-text-sec); font-weight: bold; text-transform: uppercase; cursor: pointer; user-select: none; }

    /* ── MAT SIZE BUTTON GROUP ── */
    .mat-size-btn-group {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 12px;
        margin: 0 auto 28px;
    }
    /* Phantom reset — must come before the theming rules */
    .mat-size-btn {
        box-shadow: none !important;
        height: auto !important;
        line-height: normal !important;
        overflow: visible !important;
        /* theming */
        display: flex !important;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        gap: 4px;
        padding: 12px 28px !important;
        background: rgba(255,255,255,0.05) !important;
        border: 2px solid rgba(255,255,255,0.15) !important;
        border-radius: 8px !important;
        cursor: pointer;
        font-family: 'Plus Jakarta Sans', sans-serif;
        transition: background 0.18s, border-color 0.18s;
        min-width: 130px;
        text-align: center;
    }
    .mat-size-btn:hover {
        background: rgba(133,101,181,0.2) !important;
        border-color: #8565B5 !important;
        box-shadow: none !important;
    }
    .mat-size-btn.active {
        background: rgba(48,187,173,0.12) !important;
        border-color: #30BBAD !important;
    }
    .mat-size-btn .msb-name {
        font-size: 14px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 1.2px;
        color: #f0eeff !important;
        display: block;
    }
    .mat-size-btn.active .msb-name { color: #30BBAD !important; }
    .mat-size-btn:hover .msb-name  { color: #8565B5 !important; }
    .mat-size-btn .msb-dim {
        font-size: 12px;
        color: #9888c0 !important;
        letter-spacing: 0.5px;
        display: block;
    }
    .mat-size-btn .msb-icon {
        display: block;
        margin-top: 8px;
    }
    .mat-size-btn .msb-icon rect {
        fill: rgba(255,255,255,0.04);
        stroke: rgba(152,136,192,0.55);
        stroke-width: 1.5;
    }
    .mat-size-btn.active .msb-icon rect {
        fill: rgba(48,187,173,0.12);
        stroke: #30BBAD;
    }
    .mat-size-btn:hover .msb-icon rect {
        fill: rgba(133,101,181,0.12);
        stroke: #8565B5;
    }

    /* ── BATCH / CONVERTER PANEL THEMING (matches Quick Upload style) ── */
    .ps-drop-zone {
        border: 2px dashed rgba(48,187,173,0.35);
        border-radius: 8px;
        padding: 44px 20px;
        text-align: center;
        cursor: pointer;
        margin-bottom: 20px;
        transition: border-color 0.2s, background 0.2s;
        background: rgba(0,0,0,0.15);
    }
    .ps-drop-zone:hover { border-color: #30BBAD; background: rgba(48,187,173,0.06); }
    .ps-drop-zone .dz-icon { font-size: 38px; margin-bottom: 10px; }
    .ps-drop-zone .dz-title {
        font-size: 14px;
        font-weight: 700;
        color: #f0eeff;
        margin: 0 0 6px;
        text-transform: uppercase;
        letter-spacing: 1px;
        font-family: 'Plus Jakarta Sans', sans-serif;
    }
    .ps-drop-zone .dz-sub {
        font-size: 16px;
        color: #9888c0;
        margin: 0;
    }
    .ps-drop-zone .dz-note {
        font-size: 14px;
        color: #9888c0;
        margin: 8px 0 0;
        opacity: 0.85;
    }
    /* ── IMAGE HOSTING TAB ── */
    .host-hist-btn {
        width: auto !important;
        padding: 4px 10px !important;
        margin: 0 !important;
        font-size: 12px !important;
        flex-shrink: 0;
    }
    .ps-panel-label {
        color: #30BBAD;
        font-size: 12px;
        font-weight: 700;
        text-transform: uppercase;
        letter-spacing: 1px;
        display: block;
        margin-bottom: 10px;
        font-family: 'Plus Jakarta Sans', sans-serif;
    }
    .ps-tool-controls {
        display: flex;
        align-items: center;
        gap: 10px;
        margin-bottom: 20px;
        flex-wrap: wrap;
    }
    .ps-tool-controls .ps-panel-label { margin: 0; white-space: nowrap; }

    /* Modal close buttons — hover state (replaces inline onmouseover/onmouseout) */
    #share-result-close:hover,
    #get-printed-close:hover { color: #fff !important; }
</style>
