/* ============================================================
   MAGIC CROP & PRINT — Premium Style (Original Blue/Purple Theme)
   ============================================================ */

:root {
    --primary: #6366f1; 
    --primary-hover: #4f46e5; 
    --primary-light: #eef2ff;
    --accent: #6366f1; 
    --accent-hover: #4f46e5;
    --accent-glow: rgba(99, 102, 241, 0.12);
    --border-active: rgba(99, 102, 241, 0.4);
    --magic: #a78bfa; 
    --magic-hover: #8b5cf6;
    --success: #10b981; 
    --danger: #ef4444; 
    --warn: #f59e0b;
    --bg-app: #f8fafc;
    --bg-surface: #ffffff;
    --bg-card: #ffffff;
    --bg-input: #f1f5f9;
    --bg-toolbar: #f8fafc;
    --border: #e2e8f0;
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --topnav-h: 60px;
    --actionbar-h: 65px;
    --radius: 16px;
    --radius-sm: 8px;
    --shadow: 0 8px 25px rgba(0,0,0,0.04);
    --shadow-sm: 0 4px 12px rgba(0,0,0,0.03);
}

[data-theme="dark"], body.dark-mode {
    --bg-app: #0b1120; 
    --bg-surface: #1e293b; 
    --bg-card: #0f172a;
    --bg-input: #1e293b; 
    --bg-toolbar: #1e293b;
    --border: #334155;
    --text-primary: #f8fafc; 
    --text-secondary: #94a3b8; 
    --text-muted: #64748b;
    --primary-light: rgba(99, 102, 241, 0.15);
    --accent-glow: rgba(99, 102, 241, 0.2);
    --shadow: 0 10px 30px rgba(0,0,0,0.4);
    --shadow-sm: 0 4px 15px rgba(0,0,0,0.2);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Inter', Arial, sans-serif;
    background: var(--bg-app); color: var(--text-primary);
    min-height: 100vh; display: flex; flex-direction: column;
    overflow-y: auto; font-size: 13px;
    transition: background 0.3s, color 0.3s;
}

/* ===== APP SHELL ===== */
.app-shell { display: flex; flex-direction: column; min-height: 100vh; }

/* ===== TOPNAV ===== */
.topnav {
    position: sticky; top: 0; z-index: 100;
    height: var(--topnav-h); flex-shrink: 0;
    background: var(--bg-surface); border-bottom: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; padding: 0 24px;
    box-shadow: var(--shadow-sm);
}

.topnav-left  { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-mark { display: flex; align-items: center; gap: 10px; }
.brand-icon-wrap {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--accent), var(--magic));
    border-radius: 10px; display: flex; align-items: center; justify-content: center;
    color: white; font-size: 15px; box-shadow: 0 4px 10px var(--accent-glow);
}
.brand-name { font-size: 14px; font-weight: 800; color: var(--text-primary); line-height: 1.2; letter-spacing: 0.3px;}

/* Center Controls */
.topnav-center { display: flex; align-items: center; gap: 12px; flex: 1; justify-content: center; flex-wrap: wrap; }

.premium-group {
    display: flex; align-items: center; background: var(--bg-input); 
    border: 1px solid var(--border); border-radius: 12px; padding: 6px 14px;
    box-shadow: inset 0 2px 4px rgba(0,0,0,0.02); transition: 0.3s;
}
.premium-group:focus-within {
    border-color: var(--accent); background: var(--bg-surface);
    box-shadow: 0 0 0 3px var(--accent-glow), inset 0 2px 4px rgba(0,0,0,0.02);
}

.nav-label { font-size: 11px; font-weight: 800; color: var(--accent); text-transform: uppercase; letter-spacing: 0.5px; margin-right: 8px;}
.size-inputs { display: flex; align-items: center; gap: 4px; }
.size-sep { color: var(--text-muted); font-weight: 800; font-size: 14px; }
.unit-label { font-size: 11px; font-weight: 800; color: var(--text-muted); margin-left: 2px;}

.size-inputs input {
    background: transparent; border: none; width: 45px; text-align: center;
    font-size: 14px; font-weight: 800; color: var(--text-primary); outline: none; font-family: inherit;
}
.size-inputs input::-webkit-inner-spin-button { -webkit-appearance: none; }

.nav-select-borderless, .nav-input-borderless {
    background: transparent; border: none; color: var(--text-primary);
    font-family: inherit; font-size: 13px; font-weight: 700; outline: none; padding: 2px;
}
.nav-input-borderless { width: 140px; }

/* Right side */
.topnav-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

.cust-counter {
    display: flex; align-items: center; gap: 2px;
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 12px; padding: 4px;
}
.counter-btn {
    width: 28px; height: 28px; border: none; background: transparent;
    color: var(--text-secondary); cursor: pointer; border-radius: 8px;
    font-size: 12px; display: flex; align-items: center; justify-content: center; transition: 0.2s;
}
.counter-btn:hover { background: var(--accent-glow); color: var(--accent); }
#custCountDisplay { font-size: 14px; font-weight: 800; color: var(--text-primary); padding: 0 8px; min-width: 24px; text-align: center; }

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1; padding: 24px; display: flex; flex-direction: column; gap: 24px; max-width: 1400px; margin: 0 auto; width: 100%;
}

/* ===== CUSTOMER BLOCK ===== */
.customer-block {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
.customer-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 15px 24px; background: var(--bg-surface);
    border-bottom: 1px solid var(--border);
}
.customer-title-area { display: flex; align-items: center; gap: 12px; }
.customer-num {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, var(--accent), var(--magic));
    border-radius: 8px; display: flex; align-items: center; justify-content: center;
    font-size: 14px; font-weight: 800; color: white; box-shadow: 0 4px 10px var(--accent-glow);
}
.customer-label { font-size: 15px; font-weight: 800; color: var(--text-primary); letter-spacing: 0.3px;}
.customer-size-badge {
    background: var(--accent-glow); color: var(--accent); border: 1px solid var(--border-active);
    padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 700; text-transform: uppercase;
}

.btn-copy-settings {
    font-size: 12px; font-weight: 700; color: var(--text-secondary);
    background: var(--bg-input); border: 1px solid var(--border);
    border-radius: 8px; padding: 6px 12px; cursor: pointer; transition: 0.2s;
    display: flex; align-items: center; gap: 6px;
}
.btn-copy-settings:hover { color: var(--accent); border-color: var(--accent); background: var(--bg-surface); }

/* ===== CUSTOMER CARDS GRID ===== */
.customer-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 0; align-items: stretch; }

/* ===== CARD PANEL ===== */
.card-panel {
    border-right: 1px solid var(--border); padding: 20px;
    display: flex; flex-direction: column; gap: 15px;
}
.card-panel:last-child { border-right: none; }

.card-panel-header { display: flex; align-items: center; justify-content: space-between; }
.card-side-badge {
    font-size: 12px; font-weight: 800; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 1px; display: flex; align-items: center; gap: 8px;
}
.card-side-badge i { font-size: 12px; color: var(--accent); }

/* ===== UPLOAD ZONE ===== */
.upload-zone {
    border: 2px dashed var(--border); border-radius: var(--radius);
    padding: 35px 20px; text-align: center; transition: 0.3s;
    background: var(--bg-input); display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: var(--accent-glow); transform: translateY(-2px); }
.upload-zone i { font-size: 32px; color: var(--text-muted); transition: 0.3s; margin-bottom: 5px; }
.upload-zone:hover i { color: var(--accent); transform: scale(1.1); }
.upload-zone-text { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.upload-zone-btns { display: flex; gap: 10px; margin-top: 10px; }

.btn-upload-sm, .btn-scan-sm {
    padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 700; cursor: pointer;
    display: flex; align-items: center; gap: 6px; transition: 0.2s; font-family: inherit;
}
.btn-upload-sm { background: var(--accent); color: white; border: none; box-shadow: 0 4px 12px var(--accent-glow); }
.btn-upload-sm:hover { background: var(--accent-hover); transform: translateY(-2px); box-shadow: 0 6px 15px var(--accent-glow); }
.btn-scan-sm { background: var(--bg-surface); color: var(--text-primary); border: 1px solid var(--border); }
.btn-scan-sm:hover { border-color: var(--accent); color: var(--accent); }

/* ===== IMAGE EDITING AREA ===== */
.image-editing-area { display: none; flex-direction: column; gap: 12px; }
.image-editing-area.visible { display: flex; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: translateY(0); } }
input[type="file"] { display: none !important; }

/* ===== TOOLBAR WITH TEXT ===== */
.img-toolbar { 
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap; 
    background: var(--bg-toolbar); padding: 10px; border-radius: var(--radius-sm); 
    border: 1px solid var(--border); 
}
.tool-btn {
    padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-surface);
    color: var(--text-secondary); cursor: pointer; font-size: 12px; font-weight: 700; display: flex; align-items: center; gap: 6px; transition: 0.2s;
}
.tool-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--bg-input); transform: translateY(-1px); }
.tool-btn.active { background: var(--accent); color: white; border-color: var(--accent); box-shadow: 0 4px 10px var(--accent-glow); }
.tool-btn.danger:hover { color: white; border-color: var(--danger); background: var(--danger); }
.tool-btn.magic { background: rgba(167,139,250,0.1); color: var(--magic); border-color: rgba(167,139,250,0.3); }
.tool-btn.magic:hover { background: rgba(167,139,250,0.2); color: var(--magic-hover); border-color: var(--magic-hover);}
.tool-divider { width: 1px; height: 24px; background: var(--border); margin: 0 4px; }

/* ===== CROP MODE BUTTONS ===== */
.crop-mode-row { display: flex; gap: 8px; margin-bottom: 5px;}
.crop-mode-btn {
    flex: 1; padding: 8px 10px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--bg-input);
    color: var(--text-secondary); font-size: 11px; font-weight: 800; cursor: pointer; transition: 0.2s;
    display: flex; align-items: center; justify-content: center; gap: 6px; text-transform: uppercase; letter-spacing: 0.5px;
}
.crop-mode-btn:hover { color: var(--text-primary); border-color: var(--accent); background: var(--bg-surface); }
.crop-mode-btn.active { background: var(--accent-glow); color: var(--accent); border-color: var(--accent); }

/* ===== SLIDERS PANEL ===== */
.sliders-panel {
    background: var(--bg-toolbar); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 15px;
    display: flex; flex-direction: column; gap: 12px;
}
.slider-row { display: flex; align-items: center; gap: 10px; }
.slider-icon { width: 16px; text-align: center; font-size: 12px; color: var(--text-muted); flex-shrink: 0; }
.slider-label-text { font-size: 10px; font-weight: 800; color: var(--text-secondary); flex-shrink: 0; min-width: 35px; text-transform: uppercase; }
.slider-track { flex: 1; height: 6px; -webkit-appearance: none; border-radius: 6px; outline: none; margin: 0; cursor: pointer; min-width: 0; }
.slider-track.brightness { background: linear-gradient(90deg, #334155 0%, #fef9c3 100%); }
.slider-track.contrast   { background: linear-gradient(90deg, #64748b 0%, #f8fafc 100%); }
.slider-track.black-pt   { background: linear-gradient(90deg, #f8fafc 0%, #64748b 50%, #000 100%); }
.slider-track::-webkit-slider-thumb {
    -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; cursor: pointer;
    border: 3px solid white; box-shadow: 0 2px 6px rgba(0,0,0,0.3); transition: 0.2s;
}
.slider-track::-webkit-slider-thumb:hover { transform: scale(1.2); }
.slider-track.brightness::-webkit-slider-thumb { background: #fbbf24; }
.slider-track.contrast::-webkit-slider-thumb   { background: #94a3b8; }
.slider-track.black-pt::-webkit-slider-thumb   { background: #475569; }
.slider-val { font-size: 11px; font-weight: 800; color: var(--text-primary); min-width: 35px; text-align: right; flex-shrink: 0; }

/* ===== IMAGE WRAPPER ===== */
.img-wrapper {
    width: 100%; height: 65vh; min-height: 450px; max-height: 800px;     
    background: #0f172a; border-radius: var(--radius); border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center; overflow: hidden; position: relative;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.6);
}
.perspective-container { position: relative; display: inline-block; line-height: 0; max-width: 100%; max-height: 100%; touch-action: none; }
.perspective-container img { display: block; width: auto; height: auto; max-width: 100%; max-height: 62vh; min-height: 350px; pointer-events: none; border-radius: 4px;}
.persp-svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 10; display: none; touch-action: none; }
.persp-svg circle { cursor: grab; transition: r 0.15s, fill 0.15s; }
.persp-svg circle:hover { fill: #a5b4fc; r: 16; }
.persp-svg circle:active { cursor: grabbing; fill: #ef4444; }
.grid-line { stroke: rgba(165, 180, 252, 0.6); stroke-dasharray: 6; stroke-width: 2; pointer-events: none; }

/* ===== QUALITY SLIDER & ACTION BAR ===== */
.action-bar {
    position: sticky; bottom: 0; z-index: 100; height: var(--actionbar-h); flex-shrink: 0;
    background: var(--bg-surface); border-top: 1px solid var(--border);
    display: flex; align-items: center; justify-content: space-between; padding: 0 24px; gap: 15px; box-shadow: 0 -4px 15px rgba(0,0,0,0.03);
}
.action-bar-left   { flex-shrink: 0; }
.action-bar-center { flex: 1; display: flex; justify-content: center; align-items: center; }
.action-bar-right  { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }

.quality-row { display: flex; align-items: center; gap: 10px; background: var(--bg-input); padding: 6px 16px; border-radius: 100px; border: 1px solid var(--border); }
#jpgQuality { width: 130px; height: 6px; -webkit-appearance: none; border-radius: 6px; outline: none; cursor: pointer; background: linear-gradient(90deg, var(--accent) 90%, var(--border) 90%); }
#jpgQuality::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 3px solid white; box-shadow: 0 2px 8px var(--accent-glow); transition: 0.2s; }
#jpgQuality::-webkit-slider-thumb:hover { transform: scale(1.15); }
.quality-val { font-size: 13px; font-weight: 800; color: var(--text-primary); white-space: nowrap; }
.size-badge { background: var(--bg-surface); color: var(--text-muted); padding: 4px 12px; border-radius: 16px; font-size: 12px; font-weight: 800; border: 1px solid var(--border); min-width: 80px; text-align: center; white-space: nowrap; }

/* ===== BUTTONS ===== */
.btn {
    padding: 10px 18px; border: none; font-size: 14px; font-weight: 700; border-radius: var(--radius-sm); cursor: pointer; color: white; display: flex; align-items: center; gap: 8px; transition: 0.2s; white-space: nowrap; font-family: inherit; box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}
.btn:hover { transform: translateY(-2px); box-shadow: 0 6px 15px rgba(0,0,0,0.15); }
.btn-ghost { background: var(--bg-input); color: var(--text-primary); border: 1px solid var(--border); box-shadow: none; }
.btn-ghost:hover { background: var(--bg-surface); border-color: var(--accent); color: var(--accent); box-shadow: 0 4px 10px var(--accent-glow); }
.btn-reset { color: var(--danger); background: rgba(239,68,68,0.05); border: 1px solid rgba(239,68,68,0.2); box-shadow: none;}
.btn-reset:hover { background: rgba(239,68,68,0.1); border-color: var(--danger); color: var(--danger); box-shadow: none; transform: none;}
.btn-preview { background: linear-gradient(135deg, #10b981, #059669); box-shadow: 0 4px 10px rgba(16,185,129,0.2); }
.btn-print { background: linear-gradient(135deg, var(--magic), var(--magic-hover)); box-shadow: 0 4px 10px rgba(139,92,246,0.2); }
.btn-pdf { background: linear-gradient(135deg, #ef4444, #dc2626); box-shadow: 0 4px 10px rgba(239,68,68,0.2); }
.btn-jpg { background: linear-gradient(135deg, var(--accent), var(--accent-hover)); box-shadow: 0 4px 10px var(--accent-glow); }

/* ===== LOADER & TOAST & MODAL ===== */
.loader-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.85); backdrop-filter: blur(8px); display: none; justify-content: center; align-items: center; z-index: 99999; flex-direction: column; color: white; }
.spinner { width: 50px; height: 50px; border-radius: 50%; border: 4px solid rgba(255,255,255,0.1); border-top: 4px solid var(--accent); animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast-container { position: fixed; bottom: 85px; right: 24px; z-index: 99999; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast { background: #1e293b; color: white; padding: 12px 18px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 700; box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px; animation: toastIn 0.3s cubic-bezier(0.4,0,0.2,1), toastOut 0.3s ease 3s forwards; border-left: 4px solid var(--accent); }
.toast.success { border-color: var(--success); } .toast.error { border-color: var(--danger); }
@keyframes toastIn  { from{opacity:0;transform:translateX(20px)} to{opacity:1;transform:translateX(0)} }
@keyframes toastOut { from{opacity:1} to{opacity:0;transform:translateX(20px)} }

.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,0.85); backdrop-filter: blur(8px); display: none; justify-content: center; align-items: flex-start; z-index: 99990; overflow-y: auto; padding: 30px 20px; }
/* ===== MODAL / PRINT PREVIEW (DESKTOP ONLY - COMPACT) ===== */
.modal-box {
    background: var(--bg-surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 20px 50px rgba(0,0,0,0.3);
    padding: 18px;
    width: 100%;
    max-width: 650px;            /* 🟢 reduced from 700px */
    display: flex;
    flex-direction: column;
    gap: 12px;                   /* 🟢 reduced from 15px */
    align-items: center;
    margin: auto;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    font-size: 15px;             /* 🟢 slightly smaller */
    font-weight: 800;
    border-bottom: 1px solid var(--border);
    padding-bottom: 12px;        /* 🟢 reduced from 15px */
}

.modal-close {
    width: 30px;                 /* 🟢 reduced from 32px */
    height: 30px;                /* 🟢 reduced from 32px */
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

#previewImageRender {
    width: 100%;
    max-width: 100%;
    max-height: 65vh;            /* 🟢 ADDED: limits height */
    object-fit: contain;         /* 🟢 ADDED: keeps aspect ratio */
    border-radius: 8px;
    border: 1px solid var(--border);
    display: block;
}

.preview-nav {
    display: flex;
    align-items: center;
    gap: 12px;                   /* 🟢 reduced from 15px */
    font-weight: 700;
}

.preview-nav button {
    width: 34px;                 /* 🟢 reduced from 36px */
    height: 34px;                /* 🟢 reduced from 36px */
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    cursor: pointer;
    color: var(--accent);
    transition: 0.2s;
}

.preview-nav button:hover {
    background: var(--accent-glow);
    border-color: var(--accent);
}

#magnifierCanvas {
    position: fixed;
    border: 3px solid var(--accent);
    border-radius: 50%;
    pointer-events: none;
    display: none;
    z-index: 100000;
    box-shadow: 0 8px 25px rgba(0,0,0,0.3);
}

/* ============================================================
   RESPONSIVE MOBILE OPTIMIZATION (FIXED + CUSTOMER HEADER)
   ============================================================ */
@media (max-width: 900px) {
    /* Base Mobile Optimizations */
    * {
        -webkit-tap-highlight-color: transparent;
    }

    body {
        overflow-x: hidden;
        font-size: 15px;
        line-height: 1.5;
        max-width: 100vw;
    }

    .app-shell,
    .main-content {
        max-width: 100%;
        overflow-x: hidden;
    }

    .customer-header {
        flex-wrap: wrap;
        gap: 12px;
        padding: 15px 16px;
    }

    .customer-title-area {
        flex: 1 1 auto;
        min-width: 150px;
    }

    .customer-label {
        font-size: 14px;
        white-space: normal;
        word-break: break-word;
    }

    .btn-copy-settings {
        flex-shrink: 0;
        white-space: nowrap;
        margin-left: auto;
    }

    .customer-num {
        flex-shrink: 0;
    }

    .customer-cards {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .card-panel {
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 16px;
    }

    .card-panel:last-child {
        border-bottom: none;
    }

    /* ========== TOPNAV COMPACT (CHANGES MADE HERE) ========== */
    .topnav {
        height: auto;
        flex-direction: column;
        padding: 8px 12px;          
        gap: 8px;                  
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        max-width: 100%;
        overflow-x: hidden;
    }

    .topnav-left,
    .topnav-center,
    .topnav-right {
        width: 100%;
        justify-content: space-between;
        max-width: 100%;
        overflow: hidden;
    }

    .topnav-center {
        display: flex;
        flex-wrap: nowrap;
        gap: 6px;                   
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
        scrollbar-width: none;
        -ms-overflow-style: none;
        max-width: 100%;
        white-space: nowrap;
    }

    .topnav-center::-webkit-scrollbar {
        display: none;
    }

    .premium-group {
        flex-shrink: 0;
        max-width: 100%;
        padding: 2px 8px;          
    }

    .size-inputs input {
        width: 35px;                
        font-size: 14px;            
    }

    .nav-input-borderless {
        width: 100px;               
    }

    /* Brand elements smaller */
    .brand-icon-wrap {
        width: 28px;               
        height: 28px;              
        font-size: 12px;          
    }

    .brand-name {
        font-size: 13px;            
    }

    /* Counter buttons slightly smaller (if not moved to header) */
    .cust-counter .counter-btn {
        width: 32px;               
        height: 32px;               
    }

    #custCountDisplay {
        font-size: 14px;            
        padding: 0 6px;             
    }

    /* ========== END TOPNAV COMPACT ========== */

    /* Touch Targets & Buttons */
    .btn {
        min-height: 44px;
        min-width: 44px;
        padding: 10px 16px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        white-space: nowrap;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .btn span {
        display: inline-block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .btn i + span,
    .btn svg + span {
        display: none;
    }

    .btn i,
    .btn svg,
    .btn img {
        margin: 0;
    }

    /* Action Bar */
    .action-bar {
        flex-wrap: wrap;
        height: auto;
        padding: 12px 16px;
        justify-content: center;
        gap: 12px;
        border-radius: 0;
        max-width: 100%;
        overflow-x: hidden;
    }

    .action-bar-left,
    .action-bar-center,
    .action-bar-right {
        width: 100%;
        justify-content: center;
        margin-bottom: 0;
        gap: 12px;
        flex-wrap: wrap;
        max-width: 100%;
    }

    .action-bar-left .btn,
    .action-bar-center .btn,
    .action-bar-right .btn {
        flex: 1 1 auto;
        min-width: 0;
        max-width: 100%;
    }

    .quality-row {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
        gap: 8px;
    }

    #jpgQuality {
        width: 100%;
        min-width: 120px;
    }

    /* Inputs & Readability */
    input,
    select,
    textarea {
        font-size: 16px !important;
    }

    p,
    .text-content {
        word-wrap: break-word;
        overflow-wrap: break-word;
        hyphens: auto;
    }

    /* Tool Specific Fixes */
    .img-wrapper {
        height: 45vh;
        min-height: 300px;
        max-width: 100%;
    }

    .perspective-container img {
        max-height: 43vh;
        min-height: auto;
    }

    .tool-btn span,
    .crop-mode-btn span {
        font-size: 10px;
    }

    .tool-btn {
        padding: 6px 10px;
        white-space: nowrap;
    }

    .sliders-panel {
        max-width: 100%;
    }

    .slider-row {
        flex-wrap: wrap;
    }

    .slider-track {
        min-width: 100px;
    }

    .modal-box {
        max-width: 95vw;
        padding: 16px;
    }
}