/* ==========================================================================
   Image Compressor, Converter & Resizer — EasyToolio Studio
   Design System: Inspired by ILoveIMG, TinyPNG, Squoosh, and top-tier SaaS
   ========================================================================== */

.bg-subtle-grid-cyan {
    background-image: radial-gradient(rgba(6, 182, 212, 0.08) 1px, transparent 0);
    background-size: 24px 24px;
}

/* Base Variables — Dark Theme */
.imgo {
    --imgo-accent: #06b6d4;
    --imgo-accent-hover: #0891b2;
    --imgo-accent-gradient: linear-gradient(135deg, #06b6d4, #10b981);
    --imgo-accent-glow: 0 10px 30px -5px rgba(6, 182, 212, 0.45);
    --imgo-accent-soft: rgba(6, 182, 212, 0.12);
    --imgo-ok: #10b981;
    --imgo-ok-soft: rgba(16, 185, 129, 0.14);
    --imgo-warn: #f59e0b;
    --imgo-danger: #f43f5e;
    --imgo-danger-soft: rgba(244, 63, 94, 0.14);
    --imgo-text: #f4f4f5;
    --imgo-text-secondary: #d4d4d8;
    --imgo-muted: #a1a1aa;
    --imgo-faint: #71717a;
    --imgo-line: rgba(255, 255, 255, 0.08);
    --imgo-line-strong: rgba(255, 255, 255, 0.16);
    --imgo-surface: rgba(18, 21, 28, 0.88);
    --imgo-surface-2: rgba(12, 14, 19, 0.65);
    --imgo-surface-card: rgba(24, 27, 36, 0.75);
    --imgo-inset: rgba(0, 0, 0, 0.35);
    --imgo-shadow: 0 24px 60px -25px rgba(0, 0, 0, 0.85);
    --imgo-radius: 1.25rem;
    --imgo-radius-sm: 0.75rem;
    --imgo-radius-lg: 1.5rem;
    --imgo-focus: 0 0 0 3px rgba(6, 182, 212, 0.4);
    color: var(--imgo-text);
}

/* Light Theme Variables */
html:not(.dark) .imgo {
    --imgo-accent: #0891b2;
    --imgo-accent-hover: #0e7490;
    --imgo-accent-gradient: linear-gradient(135deg, #0891b2, #059669);
    --imgo-accent-glow: 0 10px 30px -5px rgba(8, 145, 178, 0.3);
    --imgo-accent-soft: rgba(8, 145, 178, 0.08);
    --imgo-ok: #059669;
    --imgo-ok-soft: rgba(5, 150, 105, 0.1);
    --imgo-warn: #d97706;
    --imgo-danger: #e11d48;
    --imgo-danger-soft: rgba(225, 29, 72, 0.1);
    --imgo-text: #0f172a;
    --imgo-text-secondary: #334155;
    --imgo-muted: #64748b;
    --imgo-faint: #94a3b8;
    --imgo-line: rgba(15, 23, 42, 0.08);
    --imgo-line-strong: rgba(15, 23, 42, 0.16);
    --imgo-surface: #ffffff;
    --imgo-surface-2: #f8fafc;
    --imgo-surface-card: #ffffff;
    --imgo-inset: #f1f5f9;
    --imgo-shadow: 0 20px 45px -20px rgba(15, 23, 42, 0.12);
}

/* General Container & Card Styles */
.imgo-card {
    background: var(--imgo-surface);
    border: 0;
    border-radius: var(--imgo-radius);
    box-shadow: var(--imgo-shadow);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.imgo button:focus-visible,
.imgo select:focus-visible,
.imgo input:focus-visible,
.imgo [tabindex]:focus-visible {
    outline: none;
    box-shadow: var(--imgo-focus);
}

/* Top Trust / Privacy Pill */
.imgo-trust-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.5rem 1rem;
    margin-bottom: 1rem;
    border-radius: 999px;
    background: var(--imgo-surface-2);
    border: 1px solid var(--imgo-line);
    font-size: 12px;
    font-weight: 600;
    color: var(--imgo-muted);
    text-align: center;
}

.imgo-trust-banner i {
    color: var(--imgo-ok);
    font-size: 13px;
}

/* Badges strip */
.imgo-chrome {
    display: flex;
    flex-direction: column;
    gap: 0.85rem;
    margin-top: 1.5rem;
}

.imgo-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.5rem;
}

.imgo-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--imgo-line);
    background: var(--imgo-surface-2);
    color: var(--imgo-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

/* ==========================================================================
   Goal Picker & Mode Header (.imgo-modebar)
   ========================================================================== */

.imgo-modebar {
    padding: 1.25rem 1.4rem;
    transition: all 200ms ease;
}

.imgo-modebar-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.75rem;
}

.imgo-section-title {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--imgo-muted);
}

.imgo-goal-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--imgo-text);
    text-transform: none;
    letter-spacing: -0.02em;
    margin-bottom: 0.2rem;
}

.imgo-step-no {
    color: var(--imgo-accent);
}

.imgo-hint {
    font-size: 11px;
    color: var(--imgo-muted);
    line-height: 1.5;
}

/* Goals Grid */
.imgo-goals {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
    margin-top: 1rem;
}

@media (min-width: 640px) {
    .imgo-goals {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.imgo-goal {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-height: 4.2rem;
    padding: 0.7rem 0.85rem;
    text-align: left;
    border: 1.5px solid var(--imgo-line-strong);
    border-radius: var(--imgo-radius-sm);
    background: var(--imgo-surface-2);
    color: var(--imgo-text);
    cursor: pointer;
    text-decoration: none;
    transition: all 160ms cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    user-select: none;
}

.imgo-goal:hover {
    border-color: var(--imgo-accent);
    background: var(--imgo-surface);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px -8px rgba(6, 182, 212, 0.25);
}

.imgo-goal:active {
    transform: translateY(0) scale(0.98);
}

.imgo-goal[aria-pressed="true"] {
    border-color: var(--imgo-accent);
    background: var(--imgo-accent-soft);
    box-shadow: 0 0 0 1px var(--imgo-accent) inset, 0 8px 24px -6px rgba(6, 182, 212, 0.35);
}

.imgo-goal-icon {
    flex: 0 0 2.4rem;
    width: 2.4rem;
    height: 2.4rem;
    border-radius: 0.75rem;
    display: grid;
    place-items: center;
    background: var(--imgo-accent-soft);
    border: 1px solid rgba(6, 182, 212, 0.25);
    color: var(--imgo-accent);
    font-size: 0.95rem;
    transition: all 160ms ease;
}

.imgo-goal[aria-pressed="true"] .imgo-goal-icon {
    background: var(--imgo-accent-gradient);
    color: #062026;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(6, 182, 212, 0.4);
}

.imgo-goal-text {
    display: flex;
    flex-direction: column;
    min-width: 0;
    line-height: 1.3;
}

.imgo-goal-text b {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--imgo-text);
}

.imgo-goal-text small {
    font-size: 0.72rem;
    color: var(--imgo-muted);
    font-weight: 500;
    margin-top: 0.15rem;
}

.imgo-goal-link {
    border-style: dashed;
    border-color: rgba(6, 182, 212, 0.3);
}

/* Mode Switcher Row */
.imgo-mode-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--imgo-line);
}

.imgo-mode-row .imgo-seg {
    min-width: min(100%, 28rem);
}

/* Compact ribbon modebar during workspace / results states */
.imgo[data-phase="ready"] .imgo-modebar,
.imgo[data-phase="processing"] .imgo-modebar,
.imgo[data-phase="results"] .imgo-modebar {
    padding: 0.75rem 1rem;
    margin-bottom: 0.85rem;
    background: var(--imgo-surface-2);
}

.imgo[data-phase="ready"] .imgo-modebar-head,
.imgo[data-phase="processing"] .imgo-modebar-head,
.imgo[data-phase="results"] .imgo-modebar-head {
    display: none;
}

.imgo[data-phase="ready"] .imgo-mode-row,
.imgo[data-phase="processing"] .imgo-mode-row,
.imgo[data-phase="results"] .imgo-mode-row {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.imgo[data-phase="ready"] .imgo-goals,
.imgo[data-phase="processing"] .imgo-goals,
.imgo[data-phase="results"] .imgo-goals {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid var(--imgo-line);
}

.imgo[data-phase="ready"] .imgo-goal,
.imgo[data-phase="processing"] .imgo-goal,
.imgo[data-phase="results"] .imgo-goal {
    min-height: auto;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    gap: 0.4rem;
}

.imgo[data-phase="ready"] .imgo-goal-icon,
.imgo[data-phase="processing"] .imgo-goal-icon,
.imgo[data-phase="results"] .imgo-goal-icon {
    width: 1.4rem;
    height: 1.4rem;
    font-size: 0.75rem;
    border-radius: 999px;
    flex: 0 0 1.4rem;
}

.imgo[data-phase="ready"] .imgo-goal-text small,
.imgo[data-phase="processing"] .imgo-goal-text small,
.imgo[data-phase="results"] .imgo-goal-text small {
    display: none;
}

/* ==========================================================================
   Exact Size Panel (.imgo-size-panel)
   ========================================================================== */

.imgo-size-panel {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--imgo-line);
    display: grid;
    gap: 0.95rem;
    animation: imgo-fade-in 180ms ease;
}

.imgo-size-row {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.imgo-size-input {
    display: flex;
    gap: 0.5rem;
}

/* Specificity matches .imgo-field select/input (loaded later), so these need the .imgo-field prefix
   or the unit select stretches to 100% and squeezes the number input down to just its spinner. */
.imgo-field .imgo-size-input input[type="number"] {
    flex: 1 1 auto;
    width: auto;
    min-width: 5rem;
    font-weight: 700;
}

.imgo-field .imgo-size-input select {
    flex: 0 0 5.5rem;
    width: 5.5rem;
    font-weight: 800;
    cursor: pointer;
}

/* Advanced (collapsed by default) */
.imgo-adv {
    margin-top: 0.85rem;
    border-top: 1px solid var(--imgo-line);
    padding-top: 0.75rem;
}

.imgo-adv > summary {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    list-style: none;
    font-size: 13px;
    font-weight: 800;
    color: var(--imgo-text);
    user-select: none;
}

.imgo-adv > summary::-webkit-details-marker { display: none; }

.imgo-adv > summary::after {
    content: "\f078";
    font-family: "Font Awesome 6 Free", "Font Awesome 5 Free";
    font-weight: 900;
    font-size: 0.7rem;
    margin-left: auto;
    color: var(--imgo-muted);
    transition: transform 160ms ease;
}

.imgo-adv[open] > summary::after { transform: rotate(180deg); }

.imgo-adv > summary small {
    font-size: 11px;
    font-weight: 600;
    color: var(--imgo-faint);
}

.imgo-adv-body {
    display: grid;
    gap: 0.95rem;
    padding-top: 0.9rem;
}

.imgo-adv-top .imgo-goals-more { margin-top: 0; }

.imgo-adv-side { margin: 0.25rem 0 0; }

.imgo-chips {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
}

.imgo-chips-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--imgo-muted);
    margin-right: 0.25rem;
}

.imgo-chip {
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    border: 1px solid var(--imgo-line-strong);
    background: var(--imgo-surface-2);
    color: var(--imgo-muted);
    cursor: pointer;
    transition: all 140ms ease;
}

.imgo-chip:hover {
    border-color: var(--imgo-accent);
    color: var(--imgo-text);
    transform: translateY(-1px);
}

.imgo-chip[aria-pressed="true"] {
    background: var(--imgo-accent-soft);
    border-color: var(--imgo-accent);
    color: var(--imgo-accent);
    box-shadow: 0 0 0 1px var(--imgo-accent) inset;
}

/* ==========================================================================
   Grand Dropzone Area (#dropzone-area)
   ========================================================================== */

.imgo-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 270px;
    padding: 2.5rem 1.5rem;
    border-radius: var(--imgo-radius-lg);
    border: 2px dashed var(--imgo-line-strong);
    background: radial-gradient(circle at center, var(--imgo-surface-card) 0%, var(--imgo-surface) 100%);
    cursor: pointer;
    transition: all 220ms cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

.imgo-dropzone:hover,
.imgo-dropzone:focus-visible,
.imgo-dropzone.is-dragover {
    border-color: var(--imgo-accent);
    background: radial-gradient(circle at center, var(--imgo-accent-soft) 0%, var(--imgo-surface) 100%);
    transform: translateY(-2px);
    box-shadow: 0 16px 45px -12px rgba(6, 182, 212, 0.35);
}

.imgo-dropzone.is-dragover {
    transform: scale(1.01);
}

.imgo-drop-icon-box {
    position: relative;
    width: 4.5rem;
    height: 4.5rem;
    border-radius: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.1rem;
    background: var(--imgo-accent-soft);
    border: 1px solid rgba(6, 182, 212, 0.35);
    color: var(--imgo-accent);
    font-size: 1.9rem;
    box-shadow: 0 12px 30px -8px rgba(6, 182, 212, 0.35);
    transition: transform 200ms ease;
}

.imgo-dropzone:hover .imgo-drop-icon-box {
    transform: scale(1.08) rotate(-3deg);
}

.imgo-drop-heading {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--imgo-text);
    letter-spacing: -0.02em;
    margin-bottom: 0.35rem;
}

.imgo-browse {
    margin-top: 1rem;
    padding: 0.75rem 1.8rem;
    border-radius: 999px;
    background: var(--imgo-accent-gradient);
    color: #062026;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.01em;
    box-shadow: var(--imgo-accent-glow);
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.imgo-dropzone:hover .imgo-browse {
    transform: translateY(-1px) scale(1.03);
    box-shadow: 0 12px 35px -5px rgba(6, 182, 212, 0.55);
}

.imgo-formats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin-top: 1.25rem;
}

.imgo-format-pill {
    padding: 0.22rem 0.6rem;
    border-radius: 999px;
    background: var(--imgo-surface-2);
    border: 1px solid var(--imgo-line);
    font-size: 10px;
    font-weight: 700;
    color: var(--imgo-muted);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ==========================================================================
   Studio Workspace (#imgo-workspace)
   ========================================================================== */

.imgo-workspace {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr) 320px;
    grid-template-rows: auto minmax(440px, 66vh) auto;
    grid-template-areas:
        "toolbar toolbar toolbar"
        "thumbs preview settings"
        "cta cta cta";
    overflow: hidden;
    border-radius: var(--imgo-radius);
}

/* Workspace Toolbar */
.imgo-toolbar {
    grid-area: toolbar;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid var(--imgo-line);
    background: var(--imgo-surface-2);
}

.imgo-toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    min-width: 0;
}

.imgo-badge-counter {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.3rem 0.75rem;
    border-radius: 999px;
    background: var(--imgo-accent-soft);
    border: 1px solid rgba(6, 182, 212, 0.25);
    color: var(--imgo-accent);
    font-size: 12px;
    font-weight: 800;
}

.imgo-total-size {
    font-size: 12px;
    font-weight: 700;
    color: var(--imgo-muted);
}

.imgo-toolbar-actions {
    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.imgo-toolbar-actions .imgo-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    border: 1px solid var(--imgo-line-strong);
    background: var(--imgo-surface-2);
    color: var(--imgo-text);
    transition: all 140ms ease;
    cursor: pointer;
    overflow: hidden;
}

.imgo-toolbar-actions .imgo-btn:hover {
    border-color: var(--imgo-accent);
    color: var(--imgo-accent);
    transform: translateY(-1px);
}

.imgo-toolbar-actions .imgo-btn:active {
    transform: translateY(0) scale(0.96);
}

.imgo-toolbar-actions .imgo-btn i {
    margin: 0 !important;
}

.imgo-toolbar-actions .imgo-btn-text,
.imgo-toolbar-actions .imgo-btn span {
    display: none !important;
}

#imgo-workspace.imgo-fs #btn-imgo-fullscreen {
    background: rgba(6, 182, 212, 0.15);
    border-color: var(--imgo-accent);
    color: var(--imgo-accent);
}

/* Thumbnails Column */
.imgo-thumbs {
    grid-area: thumbs;
    border-right: 1px solid var(--imgo-line);
    background: var(--imgo-inset);
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.imgo-thumbs-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.85rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
}

/* Modern Thumbnail Card */
.imgo-thumb {
    border: 1.5px solid var(--imgo-line);
    border-radius: var(--imgo-radius-sm);
    padding: 0.55rem;
    background: var(--imgo-surface);
    cursor: pointer;
    text-align: left;
    width: 100%;
    color: inherit;
    transition: all 160ms cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.imgo-thumb:hover {
    border-color: rgba(6, 182, 212, 0.5);
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.2);
}

.imgo-thumb.is-selected {
    border-color: var(--imgo-accent);
    background: var(--imgo-accent-soft);
    box-shadow: 0 0 0 1px var(--imgo-accent) inset, 0 6px 20px -5px rgba(6, 182, 212, 0.35);
}

.imgo-thumb-img-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 0.5rem;
    overflow: hidden;
    background:
        linear-gradient(45deg, rgba(127, 127, 127, 0.16) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(127, 127, 127, 0.16) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(127, 127, 127, 0.16) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(127, 127, 127, 0.16) 75%);
    background-size: 14px 14px;
    background-position: 0 0, 0 7px, 7px -7px, -7px 0;
    background-color: #111114;
}

html:not(.dark) .imgo-thumb-img-wrap {
    background-color: #f4f4f5;
}

.imgo-thumb-img-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.imgo-thumb-fmt-badge {
    position: absolute;
    top: 4px;
    left: 4px;
    padding: 2px 5px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 9px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    backdrop-filter: blur(4px);
}

.imgo-thumb-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.imgo-thumb-name {
    display: block;
    font-size: 11px;
    font-weight: 700;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--imgo-text);
}

.imgo-thumb-meta {
    font-size: 10px;
    color: var(--imgo-muted);
    font-weight: 600;
    margin-top: 2px;
}

.imgo-thumb-del {
    position: absolute;
    top: 0.4rem;
    right: 0.4rem;
    z-index: 2;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    width: 1.5rem;
    height: 1.5rem;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    transition: all 140ms ease;
}

.imgo-thumb-del:hover {
    background: var(--imgo-danger);
    border-color: var(--imgo-danger);
    color: #fff;
    transform: scale(1.1);
}

/* ==========================================================================
   Preview Stage Area (.imgo-preview)
   ========================================================================== */

.imgo-preview {
    grid-area: preview;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--imgo-surface-2);
}

.imgo-preview-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.65rem 1.1rem;
    border-bottom: 1px solid var(--imgo-line);
    background: var(--imgo-surface);
}

.imgo-preview-title {
    font-size: 12px;
    font-weight: 800;
    color: var(--imgo-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.imgo-stage {
    flex: 1;
    min-height: 280px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.25rem;
    overflow: auto;
    position: relative;
}

.imgo-stage img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 0.6rem;
    object-fit: contain;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    background:
        linear-gradient(45deg, rgba(127, 127, 127, 0.16) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(127, 127, 127, 0.16) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(127, 127, 127, 0.16) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(127, 127, 127, 0.16) 75%);
    background-size: 14px 14px;
    background-position: 0 0, 0 7px, 7px -7px, -7px 0;
    background-color: #111114;
}

html:not(.dark) .imgo-stage img {
    background-color: #f4f4f5;
}

/* Before / After Split Slider */
.imgo-compare {
    position: relative;
    overflow: hidden;
    width: min(100%, 780px);
    aspect-ratio: var(--imgo-ratio, 4 / 3);
    user-select: none;
    border-radius: 0.75rem;
    box-shadow: 0 12px 35px -5px rgba(0, 0, 0, 0.5);
    background:
        linear-gradient(45deg, rgba(127, 127, 127, 0.16) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(127, 127, 127, 0.16) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(127, 127, 127, 0.16) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(127, 127, 127, 0.16) 75%);
    background-size: 14px 14px;
    background-position: 0 0, 0 7px, 7px -7px, -7px 0;
    background-color: #111114;
}

html:not(.dark) .imgo-compare {
    background-color: #f4f4f5;
}

.imgo-compare img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    max-height: none;
    border-radius: 0;
}

.imgo-compare-opt {
    position: absolute;
    inset: 0 auto 0 0;
    width: 50%;
    overflow: hidden;
    border-right: 2px solid #ffffff;
    box-shadow: 4px 0 12px rgba(0, 0, 0, 0.35);
    z-index: 2;
}

.imgo-compare-opt img {
    width: var(--imgo-compare-w, 200%);
}

/* Comparison Badges (Original Left, Optimized Right) */
.imgo-badge-label {
    position: absolute;
    top: 12px;
    padding: 3px 8px;
    border-radius: 6px;
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    pointer-events: none;
    transition: opacity 140ms ease;
    user-select: none;
}

.imgo-badge-opt {
    right: 14px;
    z-index: 1;
    background: var(--imgo-accent-gradient, linear-gradient(135deg, #06b6d4, #10b981));
    color: #062026;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.imgo-badge-orig {
    left: 14px;
    z-index: 3;
    background: rgba(0, 0, 0, 0.78);
    border: 1px solid rgba(255, 255, 255, 0.18);
    color: #ffffff;
    backdrop-filter: blur(6px);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
}

.imgo-compare-handle {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 36px;
    margin-left: -18px;
    cursor: ew-resize;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
}

.imgo-compare-handle::before {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 2px;
    transform: translateX(-50%);
    background: #ffffff;
    box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
}

.imgo-compare-handle::after {
    content: "↔";
    position: relative;
    z-index: 2;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: #ffffff;
    color: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 900;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 0 2px rgba(6, 182, 212, 0.6);
    transition: transform 120ms ease;
}

.imgo-compare-handle:hover::after,
.imgo-compare-handle:focus-visible::after {
    transform: scale(1.12);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5), 0 0 0 3px rgba(6, 182, 212, 0.9);
}

.imgo-stage-meta {
    padding: 0.6rem 1rem;
    text-align: center;
    font-size: 11px;
    font-weight: 700;
    color: var(--imgo-muted);
    border-top: 1px solid var(--imgo-line);
    background: var(--imgo-surface);
}

/* ==========================================================================
   Settings Sidebar (.imgo-settings)
   ========================================================================== */

.imgo-settings {
    grid-area: settings;
    border-left: 1px solid var(--imgo-line);
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
    background: var(--imgo-surface);
    padding-bottom: 1.5rem;
}

.imgo-settings-head {
    padding: 1rem 1.1rem 0.6rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    border-bottom: 1px solid var(--imgo-line);
}

.imgo-settings-head h2 {
    font-size: 13px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--imgo-text);
}

.imgo-reset-btn {
    font-size: 11px;
    font-weight: 700;
    color: var(--imgo-accent);
    background: transparent;
    border: 0;
    cursor: pointer;
    padding: 0.2rem 0.5rem;
    border-radius: 0.4rem;
    transition: background 120ms ease;
}

.imgo-reset-btn:hover {
    background: var(--imgo-accent-soft);
}

.imgo-scope-note {
    padding: 0.4rem 1.1rem 0.8rem;
    font-size: 10px;
    font-weight: 600;
    color: var(--imgo-faint);
}

/* Input Fields */
.imgo-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0 1.1rem;
    margin-bottom: 1rem;
}

.imgo-field label {
    font-size: 11px;
    font-weight: 800;
    color: var(--imgo-muted);
    letter-spacing: 0.02em;
}

/* Pill badges for Quality and Resize mode */
.imgo-pill-badge,
#quality-val,
#imgo-resize-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.15rem 0.55rem;
    border-radius: 9999px;
    background: var(--imgo-accent-soft);
    border: 1px solid rgba(6, 182, 212, 0.3);
    color: var(--imgo-accent);
    font-size: 11px;
    font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    line-height: 1.25;
    white-space: nowrap;
}

html:not(.dark) .imgo-pill-badge,
html:not(.dark) #quality-val,
html:not(.dark) #imgo-resize-badge {
    background: #ecfeff;
    border-color: #a5f3fc;
    color: #0891b2;
}

/* Tooltips beside labels */
.imgo-label-with-tip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.imgo-tip-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 15px;
    height: 15px;
    border-radius: 9999px;
    background: transparent;
    border: none;
    color: #94a3b8;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    margin: 0;
    line-height: 1;
    transition: color 140ms ease;
    vertical-align: middle;
}

html:not(.dark) .imgo-tip-btn {
    color: #94a3b8;
}

.imgo-tip-btn:hover,
.imgo-tip-btn:focus-visible,
.imgo-tip-btn.is-active {
    color: var(--imgo-accent, #0891b2);
    outline: none;
}

/* Floating Tooltip — Positioned dynamically above trigger with zero clipping and zero input overlap */
.imgo-floating-tip {
    position: absolute;
    z-index: 99999;
    max-width: 250px;
    padding: 6px 10px;
    border-radius: 7px;
    background: #0f172a;
    color: #f8fafc;
    font-size: 11px;
    font-weight: 500;
    line-height: 1.45;
    text-align: left;
    white-space: normal;
    word-break: normal;
    box-shadow: 0 4px 16px -2px rgba(15, 23, 42, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.08);
    pointer-events: none;
    opacity: 0;
    transform: translateY(4px);
    transition: opacity 120ms ease, transform 120ms ease;
}

.imgo-floating-tip.is-visible {
    opacity: 1;
    transform: translateY(0);
}

.imgo-floating-tip::after {
    content: "";
    position: absolute;
    top: 100%;
    left: var(--tip-arrow-x, 50%);
    transform: translateX(-50%);
    border-width: 5px 5px 0 5px;
    border-style: solid;
    border-color: #0f172a transparent transparent transparent;
}

.imgo-floating-tip.is-bottom::after {
    top: auto;
    bottom: 100%;
    border-width: 0 5px 5px 5px;
    border-color: transparent transparent #0f172a transparent;
}

html.dark .imgo-floating-tip {
    background: #090d16;
    border: 1px solid rgba(56, 189, 248, 0.35);
    box-shadow: 0 6px 20px -2px rgba(0, 0, 0, 0.7);
}

html.dark .imgo-floating-tip::after {
    border-color: #090d16 transparent transparent transparent;
}

html.dark .imgo-floating-tip.is-bottom::after {
    border-color: transparent transparent #090d16 transparent;
}

.imgo-field select,
.imgo-field input[type="number"],
.imgo-field input[type="text"] {
    width: 100%;
    border-radius: var(--imgo-radius-sm);
    border: 1px solid var(--imgo-line-strong);
    background: var(--imgo-surface-2);
    color: var(--imgo-text);
    font-size: 13px;
    font-weight: 600;
    padding: 0.65rem 0.85rem;
    transition: border-color 140ms ease, box-shadow 140ms ease;
}

.imgo-field select:hover,
.imgo-field input[type="number"]:hover,
.imgo-field input[type="text"]:hover {
    border-color: var(--imgo-accent);
}

/* Segmented Buttons */
.imgo-seg {
    display: grid;
    gap: 0.35rem;
}

.imgo-seg[data-cols="2"] { grid-template-columns: repeat(2, 1fr); }
.imgo-seg[data-cols="3"] { grid-template-columns: repeat(3, 1fr); }
.imgo-seg[data-cols="4"] { grid-template-columns: repeat(4, 1fr); }

.imgo-seg button {
    border: 1px solid var(--imgo-line-strong);
    background: var(--imgo-surface-2);
    color: var(--imgo-muted);
    border-radius: 0.65rem;
    padding: 0.55rem 0.3rem;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    transition: all 140ms ease;
    user-select: none;
}

.imgo-seg button:hover {
    border-color: var(--imgo-accent);
    color: var(--imgo-text);
}

.imgo-seg button[aria-pressed="true"] {
    border-color: var(--imgo-accent);
    background: var(--imgo-accent-soft);
    color: var(--imgo-accent);
    box-shadow: 0 0 0 1px var(--imgo-accent) inset;
}

/* Quality Range Slider */
.imgo-range {
    width: 100%;
    accent-color: #06b6d4;
    cursor: pointer;
    height: 6px;
    border-radius: 999px;
}

/* Checkbox Blocks */
.imgo-check {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.75rem 0.95rem;
    margin: 0 1.1rem 0.95rem;
    border-radius: var(--imgo-radius-sm);
    border: 1px solid var(--imgo-line);
    background: var(--imgo-surface-2);
    font-size: 12px;
    cursor: pointer;
    transition: border-color 140ms ease;
}

.imgo-check:hover {
    border-color: var(--imgo-accent);
}

.imgo-check input[type="checkbox"] {
    margin-top: 0.15rem;
    width: 1rem;
    height: 1rem;
    accent-color: #06b6d4;
    cursor: pointer;
}

/* Advanced Accordion */
.imgo details.imgo-advanced {
    margin: 0 1.1rem 1rem;
    border-top: 1px solid var(--imgo-line);
    padding-top: 0.75rem;
}

.imgo details.imgo-advanced summary {
    cursor: pointer;
    font-size: 11px;
    font-weight: 800;
    color: var(--imgo-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    user-select: none;
}

/* ==========================================================================
   Sticky Bottom CTA Bar (.imgo-cta)
   ========================================================================== */

.imgo-cta {
    grid-area: cta;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1.4rem;
    border-top: 1px solid var(--imgo-line);
    background: var(--imgo-surface);
    backdrop-filter: blur(16px);
    z-index: 6;
}

.imgo-cta-plan {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 12px;
    font-weight: 600;
    color: var(--imgo-muted);
    min-width: 0;
}

.imgo-cta-plan i {
    color: var(--imgo-accent);
}

.imgo-cta-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.imgo-btn-settings-toggle {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    border: 1.5px solid var(--imgo-line-strong);
    background: var(--imgo-surface-2);
    color: var(--imgo-text);
    cursor: pointer;
    transition: all 160ms cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    flex-shrink: 0;
}

.imgo-btn-settings-toggle:hover {
    border-color: var(--imgo-accent);
    color: var(--imgo-accent);
    transform: translateY(-1px);
}

.imgo-btn-settings-toggle:active {
    transform: translateY(0) scale(0.96);
}

.imgo-btn-settings-toggle[aria-expanded="true"],
.imgo-btn-settings-toggle.is-active {
    background: var(--imgo-accent-soft) !important;
    border-color: var(--imgo-accent) !important;
    color: var(--imgo-accent) !important;
}

/* Primary and Ghost Buttons */
.imgo-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    border: 1px solid var(--imgo-line-strong);
    background: var(--imgo-surface-2);
    color: var(--imgo-text);
    border-radius: 999px;
    padding: 0.75rem 1.5rem;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
    transition: all 160ms cubic-bezier(0.4, 0, 0.2, 1);
    user-select: none;
    text-decoration: none;
}

.imgo-btn:hover {
    border-color: var(--imgo-accent);
    color: var(--imgo-text);
    transform: translateY(-1px);
}

.imgo-btn:active {
    transform: translateY(0) scale(0.98);
}

.imgo-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
    transform: none;
}

.imgo-btn-primary {
    border: 0;
    background: var(--imgo-accent-gradient);
    color: #062026 !important;
    box-shadow: var(--imgo-accent-glow);
}

.imgo-btn-primary:hover {
    box-shadow: 0 12px 35px -5px rgba(6, 182, 212, 0.6);
    transform: translateY(-2px);
}

.imgo-btn-ghost {
    background: transparent;
    border: 1px solid var(--imgo-line);
    color: var(--imgo-muted);
}

.imgo-btn-ghost:hover {
    background: var(--imgo-surface-2);
    color: var(--imgo-text);
}

.imgo-icon-btn {
    width: 2rem;
    height: 2rem;
    border-radius: 0.6rem;
    border: 1px solid var(--imgo-line);
    background: var(--imgo-surface-2);
    color: var(--imgo-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 140ms ease;
}

.imgo-icon-btn:hover {
    border-color: var(--imgo-accent);
    color: var(--imgo-text);
}

/* ==========================================================================
   Overlays (Processing & Drag Drops)
   ========================================================================== */

.imgo-overlay {
    position: relative;
}

.imgo-overlay-panel {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 1.5rem;
    background: color-mix(in srgb, var(--imgo-surface) 90%, transparent);
    backdrop-filter: blur(12px);
    z-index: 10;
    text-align: center;
}

.imgo-file-drop {
    pointer-events: none;
    opacity: 0;
    border: 2px dashed var(--imgo-accent);
    color: var(--imgo-accent);
    font-size: 1.1rem;
    font-weight: 800;
    transition: opacity 160ms ease;
}

.imgo-overlay.is-file-drag .imgo-file-drop {
    opacity: 1;
}

.imgo-spinner {
    width: 2.2rem;
    height: 2.2rem;
    border: 3px solid rgba(6, 182, 212, 0.2);
    border-top-color: #06b6d4;
    border-radius: 50%;
    animation: imgo-spin 0.7s linear infinite;
}

@keyframes imgo-spin { to { transform: rotate(360deg); } }

.imgo-progress {
    width: min(440px, 100%);
    height: 8px;
    border-radius: 99px;
    background: var(--imgo-inset);
    overflow: hidden;
}

.imgo-progress > span {
    display: block;
    height: 100%;
    width: 0;
    background: var(--imgo-accent-gradient);
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.6);
    transition: width 180ms ease;
}

/* Skeleton Loading */
.imgo-skel {
    border-radius: 1rem;
    background: linear-gradient(90deg, var(--imgo-inset), var(--imgo-line), var(--imgo-inset));
    background-size: 200% 100%;
    animation: imgo-skel 1.2s ease infinite;
}

@keyframes imgo-skel {
    0% { background-position: 100% 0; }
    100% { background-position: -100% 0; }
}

/* ==========================================================================
   Results View (#imgo-results)
   ========================================================================== */

.imgo-success {
    text-align: center;
    padding: 2.25rem 1.5rem 1rem;
}

.imgo-check-icon {
    width: 4rem;
    height: 4rem;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--imgo-ok-soft);
    border: 2px solid rgba(16, 185, 129, 0.35);
    color: var(--imgo-ok);
    font-size: 1.8rem;
    box-shadow: 0 10px 30px -5px rgba(16, 185, 129, 0.4);
    animation: imgo-bounce-in 400ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes imgo-bounce-in {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.imgo-savings {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--imgo-ok);
    letter-spacing: -0.03em;
    margin-top: 0.4rem;
}

.imgo-savings-meta {
    font-size: 14px;
    font-weight: 600;
    color: var(--imgo-muted);
    margin-top: 0.25rem;
}

.imgo-target-note {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    margin-top: 0.75rem;
}

.imgo-target-note.is-pass {
    background: var(--imgo-ok-soft);
    color: var(--imgo-ok);
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.imgo-target-note.is-fail {
    background: var(--imgo-danger-soft);
    color: var(--imgo-danger);
    border: 1px solid rgba(244, 63, 94, 0.3);
}

/* Results Actions Container & Sub-buttons */
.imgo-results-actions {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    margin-top: 1.25rem;
    width: 100%;
    max-width: 480px;
    margin-inline: auto;
}

.imgo-btn-download-main {
    flex: 1 1 auto;
    min-width: 0;
    min-height: 46px;
    font-size: 14px;
    font-weight: 800;
}

.imgo-label-full {
    display: inline;
}

.imgo-label-compact {
    display: none;
}

.imgo-btn-sub,
.imgo-btn-icon-mobile {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
    background: var(--imgo-surface-2);
    border: 1.5px solid var(--imgo-line-strong);
    color: var(--imgo-text);
    transition: all 160ms cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    user-select: none;
}

.imgo-btn-sub:hover,
.imgo-btn-icon-mobile:hover {
    border-color: var(--imgo-accent);
    color: var(--imgo-accent);
    transform: translateY(-1px);
}

.imgo-btn-sub:active,
.imgo-btn-icon-mobile:active {
    transform: translateY(0) scale(0.96);
}

.imgo-btn-sub i,
.imgo-btn-icon-mobile i {
    margin: 0 !important;
}

.imgo-sub-btn-text {
    display: none !important;
}

/* Hide floating global mobile tab bar and scroll-to-top while tool is actively in use */
body.imgo-active-tool #mobileTabBar,
body.imgo-active-tool #scrollTopBtn {
    display: none !important;
}

/* Result Cards Grid */
.imgo-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1rem;
    padding: 1.25rem;
}

.imgo-result-card {
    border: 1px solid var(--imgo-line);
    border-radius: var(--imgo-radius-sm);
    background: var(--imgo-surface-card);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    transition: transform 160ms ease, box-shadow 160ms ease;
}

.imgo-result-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.25);
    border-color: var(--imgo-line-strong);
}

.imgo-result-thumb-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background:
        linear-gradient(45deg, rgba(127, 127, 127, 0.16) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(127, 127, 127, 0.16) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(127, 127, 127, 0.16) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(127, 127, 127, 0.16) 75%);
    background-size: 14px 14px;
    background-position: 0 0, 0 7px, 7px -7px, -7px 0;
    background-color: #111114;
}

html:not(.dark) .imgo-result-thumb-wrap {
    background-color: #f4f4f5;
}

.imgo-result-thumb-wrap img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.imgo-result-saving-badge {
    position: absolute;
    top: 8px;
    right: 8px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    backdrop-filter: blur(6px);
}

.imgo-result-saving-badge.is-positive {
    background: rgba(16, 185, 129, 0.9);
    color: #062026;
}

.imgo-result-saving-badge.is-negative {
    background: rgba(244, 63, 94, 0.9);
    color: #ffffff;
}

.imgo-result-card-body {
    padding: 0.75rem 0.9rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex: 1;
}

.imgo-result-info {
    flex: 1 1 auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.imgo-result-name {
    font-size: 12px;
    font-weight: 800;
    color: var(--imgo-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.imgo-result-meta {
    font-size: 11px;
    color: var(--imgo-muted);
}

.imgo-result-sizes {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.imgo-size-old {
    text-decoration: line-through;
    opacity: 0.7;
}

.imgo-result-dims {
    font-size: 10px;
    color: var(--imgo-faint);
    margin-top: 2px;
}

.imgo-pass {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 11px;
    font-weight: 700;
    margin-top: 0.2rem;
}

.imgo-pass.is-pass { color: var(--imgo-ok); }
.imgo-pass.is-fail { color: var(--imgo-danger); }

.imgo-result-actions {
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.imgo-btn-download {
    width: 38px;
    height: 38px;
    min-width: 38px;
    min-height: 38px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.35);
    transition: all 160ms cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
}

.imgo-btn-download:hover {
    transform: scale(1.08) translateY(-1px);
    box-shadow: 0 6px 18px rgba(16, 185, 129, 0.45);
    color: #ffffff;
}

.imgo-btn-download:active {
    transform: scale(0.95);
}

.imgo-btn-download .imgo-btn-text {
    display: none !important;
}

.imgo-btn-icon-sub {
    width: 34px;
    height: 34px;
    min-width: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
    cursor: pointer;
}

/* Results Table */
.imgo-table-wrap {
    overflow-x: auto;
    padding: 0 1.25rem 0.75rem;
}

.imgo-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
}

.imgo-table th {
    text-align: left;
    padding: 0.65rem 0.6rem;
    border-bottom: 2px solid var(--imgo-line-strong);
    color: var(--imgo-muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.imgo-table td {
    text-align: left;
    padding: 0.65rem 0.6rem;
    border-bottom: 1px solid var(--imgo-line);
    color: var(--imgo-text);
    font-weight: 600;
}

.imgo-table-pill {
    display: inline-block;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
}

.imgo-table-pill.is-pass {
    background: var(--imgo-ok-soft);
    color: var(--imgo-ok);
}

.imgo-table-pill.is-fail {
    background: var(--imgo-danger-soft);
    color: var(--imgo-danger);
}

.imgo-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 11px;
    font-weight: 700;
}

.imgo-status-badge.is-pass { color: var(--imgo-ok); }
.imgo-status-badge.is-fail { color: var(--imgo-danger); }

/* ==========================================================================
   Tool Guide Design System (Matches Education & FAQs Standard)
   ========================================================================== */

.tool-guide {
    --tg-surface: rgba(255, 255, 255, 0.92);
    --tg-surface-soft: rgba(0, 0, 0, 0.025);
    --tg-border: rgba(0, 0, 0, 0.10);
    --tg-border-soft: rgba(0, 0, 0, 0.06);
    --tg-border-strong: rgba(0, 0, 0, 0.55);
    --tg-text: #09090b;
    --tg-body: #3f3f46;
    --tg-muted: #71717a;
    --tg-accent: #09090b;
    --tg-accent-text: #ffffff;
    --tg-ring: rgba(0, 0, 0, 0.08);
    --tg-shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 14px 34px -20px rgba(0, 0, 0, .28);
    --tg-shadow-lg: 0 2px 4px rgba(0, 0, 0, .04), 0 40px 80px -40px rgba(0, 0, 0, .35);
    color: var(--tg-body);
}

html.dark .tool-guide {
    --tg-surface: rgba(255, 255, 255, 0.03);
    --tg-surface-soft: rgba(255, 255, 255, 0.04);
    --tg-border: rgba(255, 255, 255, 0.10);
    --tg-border-soft: rgba(255, 255, 255, 0.06);
    --tg-border-strong: rgba(255, 255, 255, 0.60);
    --tg-text: #ffffff;
    --tg-body: #d4d4d8;
    --tg-muted: #8f8f99;
    --tg-accent: #ffffff;
    --tg-accent-text: #09090b;
    --tg-ring: rgba(255, 255, 255, 0.12);
    --tg-shadow: 0 1px 2px rgba(0, 0, 0, .5), 0 26px 50px -30px rgba(0, 0, 0, .9);
    --tg-shadow-lg: 0 2px 4px rgba(0, 0, 0, .5), 0 50px 90px -40px rgba(0, 0, 0, 1);
}

html body .tool-guide h2.tg-title,
html body .tool-guide h3.tg-title {
    color: var(--tg-text) !important;
    letter-spacing: normal;
}

html body .tool-guide .tg-body {
    color: var(--tg-body) !important;
}

html body .tool-guide .tg-muted {
    color: var(--tg-muted) !important;
}

.tool-guide .tg-eyebrow {
    display: block;
    margin-bottom: .25rem;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: #4f46e5 !important;
}

html.dark .tool-guide .tg-eyebrow {
    color: #818cf8 !important;
}

.tool-guide .tg-section {
    padding-top: 1.5rem;
    padding-bottom: 1.5rem;
}

.tool-guide .tg-block:not(:first-child) {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--tg-border-soft);
}

.tool-guide .tg-tile {
    background: var(--tg-surface) !important;
    border: 1px solid var(--tg-border) !important;
    border-radius: 1rem;
    box-shadow: var(--tg-shadow);
    padding: .9rem 1rem;
}

.tool-guide .tg-index {
    width: 1.75rem;
    height: 1.75rem;
    flex-shrink: 0;
    border-radius: .5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--tg-border) !important;
    background: var(--tg-surface-soft) !important;
    color: var(--tg-muted) !important;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: .65rem;
    font-weight: 700;
}

@media (min-width: 640px) {
    .tool-guide .tg-section {
        padding-top: 2.5rem;
        padding-bottom: 2.5rem;
    }

    .tool-guide .tg-block:not(:first-child) {
        margin-top: 2.5rem;
        padding-top: 2.5rem;
    }

    .tool-guide .tg-tile {
        border-radius: 1.25rem;
        padding: 1.35rem 1.4rem;
        transition: border-color .25s ease, transform .25s ease, box-shadow .25s ease;
    }

    .tool-guide .tg-tile:hover {
        border-color: var(--tg-border-strong) !important;
        transform: translateY(-3px);
        box-shadow: var(--tg-shadow-lg);
    }
}

@media (max-width: 639px) {
    .tool-guide .tg-tile {
        box-shadow: none;
        border-radius: .875rem;
    }
}

.imgo-prose ol {
    list-style: decimal;
    padding-left: 1.35rem;
    display: grid;
    gap: 0.5rem;
}

.imgo-prose ul {
    list-style: disc;
    padding-left: 1.35rem;
}

.imgo-prose a {
    color: var(--imgo-accent);
    font-weight: 700;
}

.imgo-sizes {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.5rem;
}

.imgo-sizes a {
    padding: 0.4rem 0.85rem;
    border: 1px solid var(--imgo-line-strong);
    border-radius: 999px;
    font-size: 0.82rem;
    color: var(--imgo-text);
    text-decoration: none;
    transition: all 140ms ease;
}

.imgo-sizes a:hover {
    border-color: var(--imgo-accent);
    color: var(--imgo-accent);
}

/* ==========================================================================
   Responsive Breakpoints
   ========================================================================== */

.imgo-finetune {
    grid-area: finetune;
    display: none;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.85rem 1rem;
    border: 0;
    border-top: 1px solid var(--imgo-line);
    background: var(--imgo-surface-2);
    color: var(--imgo-text);
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
    min-height: 2.9rem;
}

.imgo-finetune-chev {
    transition: transform 160ms ease;
    font-size: 0.75rem;
    color: var(--imgo-muted);
}

.imgo-finetune[aria-expanded="true"] .imgo-finetune-chev {
    transform: rotate(180deg);
}

/* Tablet Layout */
@media (max-width: 1023px) {
    .imgo-workspace {
        grid-template-columns: 180px minmax(0, 1fr);
        grid-template-rows: auto minmax(320px, 50vh) auto auto auto;
        grid-template-areas:
            "toolbar toolbar"
            "thumbs preview"
            "finetune finetune"
            "settings settings"
            "cta cta";
    }

    .imgo-finetune { display: flex; }
    .imgo-workspace:not(.is-settings-open) .imgo-settings { display: none; }
    .imgo-settings { border-left: 0; border-top: 1px solid var(--imgo-line); }
}

/* Mobile Phones Layout */
@media (max-width: 767px) {
    .imgo-workspace {
        display: flex;
        flex-direction: column;
    }

    /* Toolbar: sleek, compact, prevent collision */
    .imgo-toolbar {
        order: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 0.5rem;
        padding: 0.45rem 0.75rem;
        min-height: 42px;
        background: var(--imgo-surface);
        border-bottom: 1px solid var(--imgo-line);
    }

    .imgo-toolbar-left {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        min-width: 0;
        flex: 1 1 auto;
        overflow: hidden;
    }

    .imgo-badge-counter {
        display: inline-flex;
        align-items: center;
        gap: 0.3rem;
        padding: 0.2rem 0.5rem;
        border-radius: 999px;
        background: var(--imgo-accent-soft);
        border: 1px solid rgba(6, 182, 212, 0.25);
        color: var(--imgo-accent);
        font-size: 11px;
        font-weight: 800;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .imgo-count-word {
        display: none !important;
    }

    .imgo-total-size {
        font-size: 11px;
        font-weight: 600;
        color: var(--imgo-muted);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .imgo-toolbar-actions {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        flex-shrink: 0;
    }

    .imgo-toolbar-actions .imgo-btn {
        width: 32px !important;
        height: 32px !important;
        min-width: 32px !important;
        min-height: 32px !important;
        padding: 0 !important;
        border-radius: 999px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 12px !important;
        background: var(--imgo-surface-2) !important;
        border: 1px solid var(--imgo-line-strong) !important;
    }

    .imgo-toolbar-actions .imgo-btn i {
        margin: 0 !important;
    }

    .imgo-toolbar-actions .imgo-btn-text {
        display: none !important;
    }

    /* Preview area */
    .imgo-preview {
        order: 1;
        min-height: 0;
        max-height: min(34vh, 230px);
        padding: 0.45rem;
    }

    .imgo-preview-bar {
        padding: 0.35rem 0.65rem;
    }

    .imgo-preview-title {
        font-size: 11px;
    }

    .imgo-stage {
        min-height: 140px;
        max-height: 25vh;
        padding: 0.45rem;
    }

    .imgo-stage-meta {
        padding: 0.3rem 0.5rem;
        font-size: 10px;
    }

    /* Filmstrip: completely hide if only 1 image */
    .imgo-workspace[data-images="1"] .imgo-thumbs,
    #imgo-workspace[data-images="1"] .imgo-thumbs {
        display: none !important;
    }

    /* When > 1 images: compact Apple-style camera roll */
    .imgo-thumbs {
        order: 2;
        border-right: 0;
        border-top: 1px solid var(--imgo-line);
        border-bottom: 1px solid var(--imgo-line);
        background: var(--imgo-surface-2);
        padding: 0.25rem 0.5rem;
    }

    .imgo-thumbs-list {
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
        overflow-y: hidden;
        padding: 0.1rem 0;
        gap: 0.45rem;
        height: 50px;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .imgo-thumbs-list::-webkit-scrollbar {
        display: none;
    }

    .imgo-thumb {
        flex: 0 0 44px;
        width: 44px;
        height: 44px;
        padding: 2px;
        border-radius: 8px;
        border: 1.5px solid var(--imgo-line);
        background: var(--imgo-surface);
        position: relative;
    }

    .imgo-thumb.is-selected {
        border-color: var(--imgo-accent);
        box-shadow: 0 0 0 2px var(--imgo-accent-soft);
    }

    .imgo-thumb-img-wrap {
        width: 100%;
        height: 100%;
        border-radius: 6px;
        overflow: hidden;
    }

    .imgo-thumb-fmt-badge {
        font-size: 8px;
        padding: 1px 3px;
        top: 2px;
        left: 2px;
        border-radius: 3px;
    }

    .imgo-thumb-del {
        width: 18px;
        height: 18px;
        font-size: 9px;
        top: 2px;
        right: 2px;
    }

    .imgo-thumb-info {
        display: none !important;
    }

    /* Fine-tune toggle button: hidden on mobile in favor of bottom-bar icon button */
    .imgo-finetune {
        display: none !important;
    }

    /* Settings sidebar */
    .imgo-settings {
        order: 4;
        padding: 0.35rem 0.65rem 0.75rem;
    }

    .imgo-settings-head {
        padding: 0.55rem 0.75rem 0.4rem;
    }

    .imgo-scope-note {
        padding: 0.3rem 0.75rem 0.25rem;
        font-size: 10px;
    }

    .imgo-settings > .imgo-field {
        padding: 0.45rem 0.65rem;
        gap: 0.3rem;
    }

    .imgo-settings .imgo-section-title,
    .imgo-settings .imgo-field > label {
        font-size: 10px;
        letter-spacing: 0.05em;
    }

    .imgo-settings select {
        height: 36px;
        padding: 0.35rem 0.65rem;
        font-size: 12px;
        border-radius: 0.55rem;
    }

    /* Compact Segmented Buttons */
    .imgo-seg button {
        padding: 0.35rem 0.2rem;
        min-height: 32px;
        font-size: 11px;
        border-radius: 0.55rem;
    }

    .imgo-seg button small {
        font-size: 9px;
        margin-top: 1px;
    }

    /* Compact Advanced Settings Card */
    .imgo-adv-side {
        margin: 0.4rem 0 0.6rem;
        padding: 0.55rem 0.7rem;
        border-radius: 0.75rem;
    }

    .imgo-adv-side > summary {
        font-size: 11px;
    }

    .imgo-adv-side > summary small {
        display: none !important;
    }

    .imgo-adv-body {
        gap: 0.55rem;
        padding-top: 0.55rem;
    }

    .imgo-adv-body .imgo-field input[type="number"] {
        height: 34px;
        padding: 0.35rem 0.55rem;
        font-size: 12px;
        border-radius: 0.55rem;
    }

    .imgo-check {
        margin: 0 0 0.35rem;
        padding: 0.45rem 0.65rem;
        border-radius: 0.55rem;
        font-size: 11px;
        align-items: center;
    }

    .imgo-check input[type="checkbox"] {
        width: 1rem;
        height: 1rem;
        margin-top: 0;
    }

    .imgo-check .imgo-hint {
        display: none !important;
    }

    /* Sticky Bottom Action Dock (1-row Apple style) */
    .imgo-cta {
        order: 5;
        position: sticky;
        bottom: 0;
        z-index: 60;
        padding: 0.5rem 0.75rem;
        padding-bottom: max(0.55rem, env(safe-area-inset-bottom));
        background: color-mix(in srgb, var(--imgo-surface) 96%, transparent);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border-top: 1px solid var(--imgo-line-strong);
        box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.25);
    }

    .imgo-cta-plan {
        display: none !important;
    }

    .imgo-cta-bar {
        display: flex;
        align-items: center;
        gap: 0.45rem;
        width: 100%;
    }

    .imgo-btn-settings-toggle {
        width: 42px !important;
        height: 42px !important;
        min-width: 42px !important;
        min-height: 42px !important;
        padding: 0 !important;
        border-radius: 999px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 14px !important;
        flex-shrink: 0 !important;
        background: var(--imgo-surface-2) !important;
        border: 1.5px solid var(--imgo-line-strong) !important;
        color: var(--imgo-text) !important;
        transition: all 160ms ease;
    }

    .imgo-btn-settings-toggle[aria-expanded="true"] {
        background: var(--imgo-accent-soft) !important;
        border-color: var(--imgo-accent) !important;
        color: var(--imgo-accent) !important;
    }

    .imgo-cta .imgo-btn-primary {
        flex: 1 1 auto !important;
        width: auto !important;
        min-height: 42px !important;
        height: 42px !important;
        font-size: 14px !important;
        font-weight: 800 !important;
        border-radius: 999px !important;
    }

    /* Results Screen Mobile Proportions */
    .imgo-success {
        padding: 1.25rem 0.85rem 0.65rem;
    }

    .imgo-success h2 {
        font-size: 1.2rem;
        margin-top: 0.5rem;
    }

    .imgo-check-icon {
        width: 3rem;
        height: 3rem;
        font-size: 1.3rem;
    }

    .imgo-savings {
        font-size: 1.65rem;
        margin-top: 0.2rem;
    }

    .imgo-savings-meta {
        font-size: 11px;
    }

    /* Results Action Bar: 1-row compact dock with icon-only secondary buttons */
    .imgo-results-actions {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.35rem !important;
        margin-top: 0.75rem !important;
        width: 100% !important;
        max-width: 420px !important;
        margin-inline: auto !important;
        padding: 0 0.25rem !important;
        box-sizing: border-box !important;
    }

    .imgo-label-full {
        display: none !important;
    }

    .imgo-label-compact {
        display: inline !important;
    }

    .imgo-btn-download-main {
        flex: 1 1 auto !important;
        min-width: 0 !important;
        min-height: 40px !important;
        height: 40px !important;
        font-size: 12.5px !important;
        font-weight: 700 !important;
        padding: 0 0.75rem !important;
        border-radius: 999px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.4rem !important;
        overflow: hidden !important;
        box-sizing: border-box !important;
    }

    .imgo-btn-download-main i {
        flex-shrink: 0 !important;
        font-size: 12.5px !important;
        margin: 0 !important;
    }

    .imgo-btn-download-main #btn-download-all-text {
        min-width: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        display: inline-block !important;
    }

    .imgo-btn-download-main .imgo-label-compact,
    .imgo-btn-download-main .imgo-label-full {
        min-width: 0 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .imgo-btn-icon-mobile {
        width: 38px !important;
        height: 38px !important;
        min-width: 38px !important;
        min-height: 38px !important;
        padding: 0 !important;
        border-radius: 999px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 13.5px !important;
        flex-shrink: 0 !important;
        background: var(--imgo-surface-2) !important;
        border: 1.5px solid var(--imgo-line-strong) !important;
        color: var(--imgo-text) !important;
    }

    .imgo-btn-icon-mobile i {
        margin: 0 !important;
    }

    .imgo-sub-btn-text {
        display: none !important;
    }

    .imgo-next {
        display: none !important;
    }

    /* Redundant Junk & Table Elimination on Mobile */
    #imgo-results[data-images="1"] .imgo-table-wrap,
    #imgo-results[data-images="1"] .imgo-result-grid {
        display: none !important;
    }

    /* Batch list (when > 1 images) as compact iOS list items */
    .imgo-table-wrap {
        display: none !important;
    }

    .imgo-result-grid {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.45rem !important;
        padding: 0.5rem 0.75rem 1rem !important;
    }

    .imgo-result-card {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        padding: 0.45rem 0.65rem !important;
        gap: 0.6rem !important;
        border-radius: 0.75rem !important;
    }

    .imgo-result-thumb-wrap {
        width: 42px !important;
        height: 42px !important;
        flex: 0 0 42px !important;
        border-radius: 6px !important;
        aspect-ratio: 1 / 1 !important;
    }

    .imgo-result-saving-badge {
        display: none !important;
    }

    .imgo-result-card-body {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        padding: 0 !important;
        gap: 0.5rem !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
    }

    .imgo-result-name {
        font-size: 12px !important;
        max-width: 140px !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
    }

    .imgo-result-dims {
        display: none !important;
    }

    .imgo-result-sizes {
        font-size: 11px !important;
        gap: 0.25rem !important;
    }

    .imgo-pass {
        display: none !important;
    }

    .imgo-result-actions {
        margin: 0 !important;
        padding: 0 !important;
        flex-shrink: 0 !important;
    }

    .imgo-btn-download {
        width: 36px !important;
        height: 36px !important;
        min-width: 36px !important;
        min-height: 36px !important;
        padding: 0 !important;
        border-radius: 999px !important;
        display: inline-flex !important;
        align-items: center !important;
        justify-content: center !important;
        font-size: 13px !important;
    }

    .imgo-btn-download .imgo-btn-text {
        display: none !important;
    }

    .imgo-apple-card { padding: 1.15rem 1rem; border-radius: 1.25rem; }
    .imgo-apple-dropzone { min-height: 200px; padding: 1.75rem 1rem; }
    .imgo-drop-heading { font-size: 1.15rem; }
}

/* Mobile Goals Swipe Strip */
@media (max-width: 639px) {
    .imgo-goals {
        grid-template-columns: none;
        grid-template-rows: repeat(2, auto);
        grid-auto-flow: column;
        grid-auto-columns: 10.5rem;
        overflow-x: auto;
        scroll-snap-type: x proximity;
        -webkit-overflow-scrolling: touch;
        margin-inline: -1rem;
        padding: 0.2rem 1rem 0.6rem;
        scrollbar-width: none;
    }

    .imgo-goals::-webkit-scrollbar { display: none; }
    .imgo-goal { scroll-snap-align: start; min-height: 3.6rem; padding: 0.5rem 0.65rem; }
    .imgo-goal-text b { font-size: 0.8rem; }
    .imgo-goal-text small { font-size: 0.68rem; }
}

/* Utility Animations & Helpers */
.imgo-hidden { display: none !important; }

@keyframes imgo-fade-in {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
    .imgo-goal,
    .imgo-finetune-chev,
    .imgo-btn,
    .imgo-dropzone,
    .imgo-check-icon {
        transition: none !important;
        animation: none !important;
    }
}

/* ==========================================================================
   Settings sidebar redesign + full screen workspace
   ========================================================================== */

.imgo-workspace {
    grid-template-columns: 220px minmax(0, 1fr) 340px;
    transition: grid-template-columns 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* When settings is collapsed on desktop, preview expands full-width */
@media (min-width: 1024px) {
    .imgo-workspace.is-settings-collapsed {
        grid-template-columns: 220px minmax(0, 1fr) !important;
        grid-template-areas:
            "toolbar toolbar"
            "thumbs preview"
            "cta cta" !important;
    }
    .imgo-workspace.is-settings-collapsed .imgo-settings {
        display: none !important;
    }
}

.imgo-settings { background: var(--imgo-surface-2); padding-bottom: 0; }

.imgo-settings-head { background: var(--imgo-surface); }
.imgo-scope-note { padding: 0.55rem 1.1rem 0.4rem; }

/* Each control group is its own section */
.imgo-settings > .imgo-field {
    margin: 0;
    padding: 0.85rem 1.1rem;
    border-bottom: 1px solid var(--imgo-line);
    gap: 0.55rem;
}

.imgo-settings .imgo-section-title,
.imgo-settings .imgo-field > label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 800;
    color: var(--imgo-muted);
}

.imgo-settings .imgo-seg button {
    padding: 0.5rem 0.3rem;
    font-size: 12px;
    line-height: 1.15;
}

.imgo-settings .imgo-seg button small {
    display: block;
    margin-top: 0.1rem;
    font-size: 10px;
    font-weight: 700;
    opacity: 0.7;
}

/* Advanced card */
.imgo-adv-side {
    margin: 0.85rem 1rem 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid var(--imgo-line-strong);
    border-radius: var(--imgo-radius-sm);
    background: var(--imgo-surface);
}

.imgo-adv-side > summary { flex-wrap: wrap; row-gap: 0.15rem; }
.imgo-adv > summary::after { order: 2; }
.imgo-adv > summary small { order: 3; flex-basis: 100%; padding-left: 1.5rem; }
.imgo-adv-side .imgo-field { padding: 0; margin: 0; }
.imgo-adv-side .imgo-check { padding: 0; margin: 0; }

/* ==========================================================================
   Apple Studio Pre-Upload Hub (.imgo-apple-hub)
   ========================================================================== */

.imgo-apple-hub {
    width: 100%;
    margin-bottom: 2rem;
}

.imgo-apple-card {
    background: var(--imgo-surface);
    border: 1px solid var(--imgo-line-strong);
    border-radius: 1.5rem;
    box-shadow: 0 20px 45px -15px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(25px) saturate(190%);
    -webkit-backdrop-filter: blur(25px) saturate(190%);
    padding: 1.5rem;
    transition: all 240ms cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 768px) {
    .imgo-apple-card {
        padding: 2rem 2.25rem;
    }
}

.imgo-apple-header {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.imgo-apple-kicker {
    display: inline-flex;
    align-items: center;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--imgo-accent);
    margin-bottom: 0.35rem;
}

.imgo-apple-title {
    font-size: 1.45rem;
    font-weight: 800;
    letter-spacing: -0.025em;
    color: var(--imgo-text);
    margin: 0;
    line-height: 1.2;
}

@media (min-width: 640px) {
    .imgo-apple-title {
        font-size: 1.75rem;
    }
}

.imgo-apple-sub {
    font-size: 0.85rem;
    color: var(--imgo-muted);
    margin-top: 0.35rem;
    line-height: 1.5;
}

/* Apple Segmented Switcher */
.imgo-apple-modes {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem;
    background: var(--imgo-surface-2);
    border: 1px solid var(--imgo-line);
    border-radius: 1rem;
    padding: 0.35rem;
}

@media (min-width: 768px) {
    .imgo-apple-modes {
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 0.5rem;
    }
}

.imgo-apple-tab {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 0.75rem 0.95rem;
    border-radius: 0.75rem;
    border: 1px solid transparent;
    background: transparent;
    color: var(--imgo-text);
    text-align: left;
    cursor: pointer;
    user-select: none;
    transition: all 180ms cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.imgo-apple-tab:hover {
    background: rgba(255, 255, 255, 0.04);
}

html:not(.dark) .imgo-apple-tab:hover {
    background: rgba(0, 0, 0, 0.03);
}

.imgo-apple-tab[aria-pressed="true"],
.imgo-apple-tab[aria-selected="true"] {
    background: var(--imgo-surface);
    border-color: var(--imgo-accent);
    box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.35), 0 0 0 1px var(--imgo-accent) inset;
}

html:not(.dark) .imgo-apple-tab[aria-pressed="true"],
html:not(.dark) .imgo-apple-tab[aria-selected="true"] {
    background: #ffffff;
    box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.08), 0 0 0 1px var(--imgo-accent) inset;
}

.imgo-apple-tab-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 0.55rem;
    background: var(--imgo-accent-soft);
    color: var(--imgo-accent);
    font-size: 0.85rem;
    margin-bottom: 0.5rem;
    transition: all 180ms ease;
}

.imgo-apple-tab[aria-pressed="true"] .imgo-apple-tab-icon,
.imgo-apple-tab[aria-selected="true"] .imgo-apple-tab-icon {
    background: var(--imgo-accent);
    color: #031418;
    box-shadow: 0 2px 8px rgba(6, 182, 212, 0.4);
}

.imgo-apple-tab-label {
    font-size: 0.88rem;
    font-weight: 700;
    color: var(--imgo-text);
    line-height: 1.25;
}

.imgo-apple-tab-desc {
    font-size: 0.72rem;
    color: var(--imgo-muted);
    font-weight: 500;
    margin-top: 0.2rem;
}

/* Secondary Goals Pill Row */
.imgo-apple-subgoals {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.45rem;
    padding: 0.75rem 0.25rem 0;
    border-top: 1px solid var(--imgo-line);
}

.imgo-apple-subgoals-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--imgo-muted);
    margin-right: 0.35rem;
}

.imgo-subgoal-pill {
    display: inline-flex;
    align-items: center;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    background: var(--imgo-surface-2);
    border: 1px solid var(--imgo-line);
    color: var(--imgo-text-secondary);
    cursor: pointer;
    transition: all 140ms ease;
    text-decoration: none;
}

.imgo-subgoal-pill:hover {
    border-color: var(--imgo-accent);
    color: var(--imgo-accent);
    background: var(--imgo-accent-soft);
    transform: translateY(-1px);
}

.imgo-subgoal-pill[aria-pressed="true"] {
    background: var(--imgo-accent-soft);
    border-color: var(--imgo-accent);
    color: var(--imgo-accent);
}

.imgo-subgoal-link {
    border-style: dashed;
}

/* Apple Exact Size Target Dock */
.imgo-apple-size-dock {
    margin-top: 1rem;
    padding: 1.25rem;
    background: var(--imgo-surface-2);
    border: 1px solid var(--imgo-line-strong);
    border-radius: 1.15rem;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15);
}

.imgo-size-dock-inner {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.imgo-size-input-cluster {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.85rem;
}

@media (min-width: 640px) {
    .imgo-size-input-cluster {
        grid-template-columns: 1.4fr 1.2fr 1fr;
    }
}

.imgo-apple-field {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.imgo-apple-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--imgo-muted);
}

.imgo-apple-size-group {
    display: flex;
    align-items: center;
    border: 1.5px solid var(--imgo-line-strong);
    border-radius: 0.75rem;
    background: var(--imgo-surface);
    overflow: hidden;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}

.imgo-apple-size-group:focus-within {
    border-color: var(--imgo-accent);
    box-shadow: var(--imgo-focus);
}

.imgo-apple-size-group input {
    flex: 1 1 auto;
    width: 100%;
    border: none !important;
    background: transparent !important;
    padding: 0.55rem 0.75rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--imgo-text);
    outline: none !important;
    box-shadow: none !important;
}

.imgo-apple-size-group select {
    flex: 0 0 4.5rem;
    border: none !important;
    border-left: 1px solid var(--imgo-line-strong) !important;
    background: transparent !important;
    padding: 0.55rem 0.5rem;
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--imgo-accent);
    outline: none !important;
    box-shadow: none !important;
    cursor: pointer;
}

.imgo-apple-select,
.imgo-apple-input {
    width: 100%;
    padding: 0.55rem 0.75rem;
    border: 1.5px solid var(--imgo-line-strong);
    border-radius: 0.75rem;
    background: var(--imgo-surface);
    color: var(--imgo-text);
    font-size: 0.85rem;
    font-weight: 600;
    outline: none;
    transition: all 160ms ease;
}

.imgo-apple-select:focus,
.imgo-apple-input:focus {
    border-color: var(--imgo-accent);
    box-shadow: var(--imgo-focus);
}

.imgo-chips-cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* Apple iOS Toggle Switch */
.imgo-apple-switch-row {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--imgo-line);
}

.imgo-apple-switch {
    display: inline-flex;
    align-items: center;
    gap: 0.85rem;
    cursor: pointer;
    user-select: none;
}

.imgo-apple-switch input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.imgo-switch-slider {
    position: relative;
    width: 2.8rem;
    height: 1.6rem;
    background: rgba(255, 255, 255, 0.16);
    border-radius: 999px;
    transition: background 200ms ease;
    flex-shrink: 0;
}

html:not(.dark) .imgo-switch-slider {
    background: #cbd5e1;
}

.imgo-switch-slider::before {
    content: "";
    position: absolute;
    width: 1.25rem;
    height: 1.25rem;
    left: 0.175rem;
    top: 0.175rem;
    background: #ffffff;
    border-radius: 50%;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.25);
    transition: transform 200ms cubic-bezier(0.16, 1, 0.3, 1);
}

.imgo-apple-switch input:checked + .imgo-switch-slider {
    background: #06b6d4;
}

.imgo-apple-switch input:checked + .imgo-switch-slider::before {
    transform: translateX(1.2rem);
}

.imgo-switch-text strong {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--imgo-text);
}

.imgo-switch-text small {
    display: block;
    font-size: 0.72rem;
    color: var(--imgo-muted);
}

.imgo-size-feedback {
    font-size: 11px;
    font-weight: 600;
    color: var(--imgo-accent);
    margin: 0;
}

/* Apple Dropzone Styling */
.imgo-apple-dropzone {
    margin-top: 1.25rem;
    border-radius: 1.25rem;
    border: 2px dashed rgba(6, 182, 212, 0.3);
    background: radial-gradient(circle at center, rgba(6, 182, 212, 0.03) 0%, rgba(0, 0, 0, 0.2) 100%);
    padding: 2.25rem 1.5rem;
}

.imgo-apple-dropzone:hover,
.imgo-apple-dropzone.is-dragover {
    border-color: var(--imgo-accent);
    background: radial-gradient(circle at center, rgba(6, 182, 212, 0.08) 0%, rgba(0, 0, 0, 0.3) 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 30px -10px rgba(6, 182, 212, 0.3);
}

.imgo-apple-dropzone .imgo-browse {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 1.8rem;
    border-radius: 999px;
    background: var(--imgo-accent-gradient);
    color: #031418;
    font-size: 0.92rem;
    font-weight: 800;
    box-shadow: 0 4px 18px rgba(6, 182, 212, 0.4);
    transition: all 180ms ease;
    margin: 0.85rem 0 1rem;
}

.imgo-apple-dropzone .imgo-browse:hover {
    transform: scale(1.03);
    box-shadow: 0 6px 24px rgba(6, 182, 212, 0.55);
}

/* ==========================================================================
   Full Screen Isolation & Overlay Fix
   ========================================================================== */

body.imgo-fs-active {
    overflow: hidden !important;
    position: fixed !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    inset: 0 !important;
}

body.imgo-fs-active header:not(.imgo-toolbar),
body.imgo-fs-active nav,
body.imgo-fs-active footer,
body.imgo-fs-active section:not(#workspace-section),
body.imgo-fs-active .imgo-extra,
body.imgo-fs-active #imgo-idle,
body.imgo-fs-active #imgo-loading,
body.imgo-fs-active .imgo-chrome,
body.imgo-fs-active .floating-ai-button,
body.imgo-fs-active #btn-ask-ai,
body.imgo-fs-active #mobileTabBar,
body.imgo-fs-active #scrollTopBtn,
body.imgo-fs-active [data-banner],
body.imgo-fs-active .tool-rating-card,
body.imgo-fs-active .tool-content-container > *:not(#workspace-section) {
    display: none !important;
}

body.imgo-fs-active #workspace-section {
    position: static !important;
    z-index: auto !important;
    padding: 0 !important;
    margin: 0 !important;
    max-width: 100vw !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    overflow: hidden !important;
}

#imgo-workspace.imgo-fs {
    position: fixed !important;
    inset: 0 !important;
    z-index: 2147483647 !important;
    width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    max-width: none !important;
    max-height: none !important;
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: #09090b !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

#imgo-workspace.imgo-fs > .imgo-workspace {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: 100% !important;
    border-radius: 0 !important;
    display: grid !important;
    grid-template-columns: 220px minmax(0, 1fr) 360px !important;
    grid-template-rows: auto minmax(0, 1fr) auto !important;
    grid-template-areas:
        "toolbar toolbar toolbar"
        "thumbs preview settings"
        "cta cta cta" !important;
}

#imgo-workspace.imgo-fs .imgo-preview {
    min-height: 0 !important;
    max-height: none !important;
}

#imgo-workspace.imgo-fs .imgo-stage {
    min-height: 0 !important;
    flex: 1 1 auto !important;
}

#imgo-workspace.imgo-fs .imgo-finetune {
    display: none !important;
}

#imgo-workspace.imgo-fs .imgo-settings {
    display: block !important;
}

#imgo-workspace.imgo-fs > .imgo-workspace.is-settings-collapsed {
    grid-template-columns: 220px minmax(0, 1fr) !important;
    grid-template-areas:
        "toolbar toolbar"
        "thumbs preview"
        "cta cta" !important;
}

#imgo-workspace.imgo-fs > .imgo-workspace.is-settings-collapsed .imgo-settings {
    display: none !important;
}

@media (max-width: 1023px) {
    #imgo-workspace.imgo-fs > .imgo-workspace {
        display: flex !important;
        flex-direction: column !important;
        overflow-y: auto !important;
    }

    #imgo-workspace.imgo-fs .imgo-preview {
        flex: 0 0 auto !important;
        min-height: 38vh !important;
        max-height: 44vh !important;
        order: 1 !important;
    }

    #imgo-workspace.imgo-fs .imgo-thumbs {
        order: 2 !important;
    }

    #imgo-workspace.imgo-fs .imgo-settings {
        order: 3 !important;
        overflow: visible !important;
    }

    #imgo-workspace.imgo-fs .imgo-cta {
        position: sticky !important;
        bottom: 0 !important;
        order: 4 !important;
    }
}

.imgo-toolbar-actions .imgo-fs-btn i { margin: 0 !important; }
.imgo-toolbar-actions .imgo-fs-btn span { display: none !important; }

/* Workspace scroll clearance and loading height stabilization */
#workspace-section,
#imgo-workspace,
#imgo-loading,
#imgo-idle {
    scroll-margin-top: 80px;
}

#imgo-loading {
    min-height: 440px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

#imgo-loading.imgo-hidden,
#imgo-loading.hidden {
    display: none !important;
}

/* Resize Controls (Percentage & Dimensions - Simple Image Resizer Inspired) */
#resize-block {
    display: flex;
    flex-direction: column;
}

#imgo-resize-badge,
#quality-val {
    white-space: nowrap;
}

.imgo-seg[data-cols="5"] {
    grid-template-columns: repeat(5, 1fr);
}

.imgo-input {
    width: 100%;
    border-radius: var(--imgo-radius-sm);
    border: 1px solid var(--imgo-line-strong);
    background: var(--imgo-surface-card);
    color: var(--imgo-text);
    padding: 0.45rem 0.65rem;
    font-size: 13px;
    font-family: inherit;
    transition: border-color 140ms ease;
}

.imgo-input:focus {
    outline: none;
    border-color: var(--imgo-accent);
    box-shadow: 0 0 0 1px var(--imgo-accent);
}


