/* ============================================
   GIF Upscaler - Modern Stylesheet
   Dark Mode Support with Light Mode Default
   Color Theme: Green (#339966) - enhancement tool family
   ============================================ */

/* CSS Variables - Light Mode (Default) */
:root {
    --gu-transition-speed: 0.25s;
    
    /* Primary Colors - Blue Theme */
    --gu-primary: #339966;
    --gu-primary-light: #E8F5E9;
    --gu-primary-dark: #2b7f56;
    --gu-accent: #47b381;
    
    /* Status Colors */
    --gu-success: #339966;
    --gu-success-light: #E8F5E9;
    --gu-warning: #f59e0b;
    --gu-warning-light: #FEF3C7;
    --gu-danger: #e64e4e;
    --gu-danger-light: #FEE2E2;
    
    /* Background Colors */
    --gu-bg: #F2FAF6;
    --gu-bg-elevated: #ffffff;
    --gu-bg-secondary: #F1F5F9;
    --gu-bg-tertiary: #E2E8F0;
    
    /* Text Colors */
    --gu-text: #1E293B;
    --gu-text-secondary: #475569;
    --gu-text-muted: #64748B;
    
    /* Border Colors */
    --gu-border: #BAE6FD;
    --gu-border-light: #E2E8F0;
    
    /* Shadows */
    --gu-shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
    --gu-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --gu-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
    --gu-shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.1);
    --gu-shadow-primary: 0 4px 14px rgba(51, 153, 102, 0.25);
    --gu-shadow-primary-hover: 0 6px 20px rgba(51, 153, 102, 0.35);
    
    /* Radius */
    --gu-radius-sm: 6px;
    --gu-radius-md: 12px;
    --gu-radius-lg: 16px;
    --gu-radius-xl: 24px;
    --gu-radius-full: 9999px;
    
    /* Checkerboard for transparency */
    --gu-checker-light: #f0f0f0;
    --gu-checker-dark: #e0e0e0;
    
    /* Input */
    --gu-input-bg: #ffffff;
    --gu-input-border: #BAE6FD;
    
    /* Scrollbar */
    --gu-scrollbar-track: var(--gu-bg);
    --gu-scrollbar-thumb: var(--gu-text-muted);
    --gu-scrollbar-thumb-hover: var(--gu-text-secondary);
}

/* Dark Mode Colors */
[data-theme="dark"] {
    --gu-primary: #4ade80;
    --gu-primary-light: rgba(74, 222, 128, 0.15);
    --gu-primary-dark: #22c55e;
    --gu-accent: #86efac;
    
    /* Status Colors */
    --gu-success: #4ade80;
    --gu-success-light: rgba(74, 222, 128, 0.15);
    --gu-warning: #fbbf24;
    --gu-warning-light: rgba(251, 191, 36, 0.15);
    --gu-danger: #f87171;
    --gu-danger-light: rgba(248, 113, 113, 0.15);
    
    /* Background Colors */
    --gu-bg: #0F172A;
    --gu-bg-elevated: #1E293B;
    --gu-bg-secondary: #334155;
    --gu-bg-tertiary: #475569;
    
    /* Text Colors */
    --gu-text: #F1F5F9;
    --gu-text-secondary: #CBD5E1;
    --gu-text-muted: #94A3B8;
    
    /* Border Colors */
    --gu-border: #334155;
    --gu-border-light: #475569;
    
    /* Shadows */
    --gu-shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
    --gu-shadow-md: 0 4px 6px -1px rgba(0,0,0,0.4);
    --gu-shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.4);
    --gu-shadow-xl: 0 20px 25px -5px rgba(0,0,0,0.5);
    --gu-shadow-primary: 0 4px 14px rgba(74, 222, 128, 0.2);
    --gu-shadow-primary-hover: 0 6px 20px rgba(74, 222, 128, 0.3);
    
    /* Checkerboard for transparency */
    --gu-checker-light: #334155;
    --gu-checker-dark: #475569;
    
    /* Input */
    --gu-input-bg: #334155;
    --gu-input-border: #475569;
    
    /* Scrollbar */
    --gu-scrollbar-track: var(--gu-bg-elevated);
    --gu-scrollbar-thumb: var(--gu-text-muted);
    --gu-scrollbar-thumb-hover: var(--gu-text-secondary);
}

/* Base Styles */
* {
    box-sizing: border-box;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--gu-bg);
    color: var(--gu-text);
    line-height: 1.6;
    margin: 0;
    padding: 0;
    transition: background-color var(--gu-transition-speed), color var(--gu-transition-speed);
}

/* Container */
.tool-container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 2rem;
}

/* Header */
.tool-header {
    text-align: center;
    margin-bottom: 2rem;
}

.gu-tool-title-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.gu-tool-icon-wrapper {
    width: 64px;
    height: 64px;
    background: var(--gu-primary);
    border-radius: var(--gu-radius-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    box-shadow: var(--gu-shadow-primary);
    flex-shrink: 0;
    transition: background-color var(--gu-transition-speed), box-shadow var(--gu-transition-speed);
}

.gu-tool-icon-wrapper svg,
.gu-tool-icon-wrapper i {
    width: 28px;
    height: 28px;
}

.tool-title {
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    font-weight: 700;
    margin: 0;
    color: var(--gu-primary);
    letter-spacing: -0.02em;
}

.tool-description a {
    color: var(--gu-primary);
    text-decoration: none;
    font-weight: 500;
}

.tool-description a:hover {
    text-decoration: underline;
}

/* Main Tool Area */
.gu-tool-main {
    overflow: visible;
    margin-bottom: 2rem;
    transition: background-color var(--gu-transition-speed), border-color var(--gu-transition-speed), box-shadow var(--gu-transition-speed);
}

/* Upload Section */
.gu-upload-section {
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}

.gu-upload-area {
    background: var(--gu-bg-elevated);
    border: 2px dashed var(--gu-border);
    border-radius: var(--gu-radius-lg);
    padding: 3rem 2rem;
    text-align: center;
    cursor: pointer;
    transition: all var(--gu-transition-speed) ease;
    box-shadow: var(--gu-shadow-sm);
}

.gu-upload-area:hover,
.gu-upload-area.gu-dragover {
    border-color: var(--gu-primary);
    background: var(--gu-primary-light);
    transform: translateY(-2px);
    box-shadow: var(--gu-shadow-md);
}

.gu-upload-content {
    position: relative;
    z-index: 1;
}

.gu-upload-icon {
    color: var(--gu-primary);
    margin-bottom: 1rem;
    display: inline-flex;
}

.gu-upload-title {
    margin: 0 0 0.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gu-text);
}

.gu-upload-subtitle {
    margin: 0 0 1rem;
    color: var(--gu-text-muted);
    font-size: 0.95rem;
}

.gu-file-types {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.375rem;
    margin: 0.75rem auto 1rem;
    max-width: 560px;
}

.gu-file-type-badge {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.625rem;
    background: var(--gu-bg-secondary);
    color: var(--gu-text);
    border-radius: var(--gu-radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.gu-upload-hints {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 1.25rem;
    margin-top: 1rem;
}

.gu-hint {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    color: var(--gu-text-muted);
    font-size: 0.825rem;
}

.gu-hint i,
.gu-hint svg { color: var(--gu-primary); opacity: 0.7; }

/* Editor Section */
.gu-editor-section {
    background: var(--gu-bg-elevated);
    border-radius: var(--gu-radius-lg);
    overflow: hidden;
    border: 1px solid var(--gu-border);
    transition: background-color var(--gu-transition-speed), border-color var(--gu-transition-speed);
}

/* Preview Header */
.gu-preview-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: var(--gu-bg-secondary);
    border-bottom: 1px solid var(--gu-border);
    transition: background-color var(--gu-transition-speed), border-color var(--gu-transition-speed);
}

.gu-preview-header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--gu-text);
}

.gu-preview-header-left svg,
.gu-preview-header-left i {
    color: var(--gu-primary);
}

.gu-btn-text {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    color: var(--gu-primary);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: var(--gu-radius-md);
    transition: all 0.2s ease;
}

.gu-btn-text:hover {
    background: var(--gu-primary-light);
}

/* Preview Area */
.gu-preview-area {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2rem;
    background: var(--gu-bg-secondary);
    min-height: 200px;
    border-bottom: 1px solid var(--gu-border);
}

.gu-preview-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.gu-gif-preview {
    max-width: 400px;
    max-height: 300px;
    border-radius: var(--gu-radius-md);
    box-shadow: var(--gu-shadow-md);
    background-image: 
        linear-gradient(45deg, var(--gu-checker-light) 25%, transparent 25%),
        linear-gradient(-45deg, var(--gu-checker-light) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--gu-checker-light) 75%),
        linear-gradient(-45deg, transparent 75%, var(--gu-checker-light) 75%);
    background-size: 16px 16px;
    background-position: 0 0, 0 8px, 8px -8px, -8px 0px;
}

.gu-gif-info {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    justify-content: center;
}

.gu-gif-info-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    color: var(--gu-text-secondary);
}

.gu-gif-info-item svg,
.gu-gif-info-item i {
    width: 16px;
    height: 16px;
    color: var(--gu-primary);
}

/* Settings Panel */
.gu-settings-panel {
    padding: 2rem;
}

.gu-panel-header {
    margin-bottom: 1.5rem;
}

.gu-panel-header h3 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.1rem;
    font-weight: 600;
    margin: 0;
    color: var(--gu-text);
}

.gu-panel-header h3 svg,
.gu-panel-header h3 i {
    color: var(--gu-primary);
}

.gu-settings-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

.gu-settings-column {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
}

/* Section Label */
.gu-section-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gu-text);
    margin-bottom: 0.75rem;
}

.gu-section-label svg,
.gu-section-label i {
    color: var(--gu-primary);
    width: 16px;
    height: 16px;
}

/* Scale Options */
.gu-scale-options {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
}

.gu-scale-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1rem 0.5rem;
    background: var(--gu-bg-secondary);
    border: 1px solid var(--gu-border);
    border-radius: var(--gu-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
}

.gu-scale-btn:hover {
    border-color: var(--gu-primary);
    background: var(--gu-bg);
}

.gu-scale-btn.gu-active {
    border-color: var(--gu-primary);
    background: var(--gu-primary-light);
    border-width: 1px;
}

.gu-scale-btn .gu-scale-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gu-text);
}

.gu-scale-btn .gu-scale-label {
    font-size: 0.75rem;
    color: var(--gu-text-muted);
    margin-top: 0.25rem;
}

.gu-scale-btn.gu-active .gu-scale-value,
.gu-scale-btn.gu-active .gu-scale-label {
    color: var(--gu-primary);
}

/* Custom Scale */
.gu-custom-scale {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-top: 0.75rem;
}

.gu-custom-scale label {
    font-size: 0.9rem;
    color: var(--gu-text-secondary);
}

.gu-scale-input {
    width: 80px;
    padding: 0.5rem 0.75rem;
    font-size: 1rem;
    border: 2px solid var(--gu-input-border);
    border-radius: var(--gu-radius-sm);
    background: var(--gu-input-bg);
    color: var(--gu-text);
    transition: border-color 0.2s ease;
}

.gu-scale-input:focus {
    outline: none;
    border-color: var(--gu-primary);
}

/* New Resolution Display */
.gu-new-resolution {
    display: none;
    align-items: center;
    gap: 0.5rem;
    margin-top: 1rem;
    padding: 0.75rem 1rem;
    background: var(--gu-primary-light);
    border-radius: var(--gu-radius-md);
    font-size: 0.9rem;
    color: var(--gu-text-secondary);
}

.gu-new-resolution svg,
.gu-new-resolution i {
    color: var(--gu-primary);
}

.gu-new-resolution strong {
    color: var(--gu-primary);
    font-weight: 600;
}

/* Enhancement Options - Toggle Switches */
.gu-enhancement-options {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.gu-toggle-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.7rem 1rem;
    background: var(--gu-bg-secondary);
    border-radius: var(--gu-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.gu-toggle-option:hover {
    background: var(--gu-bg-tertiary);
}

.gu-toggle-option:has(input:checked) {
    background: var(--gu-success-light);
    border-color: var(--gu-success);
}

.gu-toggle-option input {
    display: none;
}

.gu-toggle-switch {
    position: relative;
    width: 36px;
    height: 20px;
    background: var(--gu-border);
    border-radius: var(--gu-radius-full);
    transition: background-color 0.2s ease;
    flex-shrink: 0;
}

.gu-toggle-switch::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: white;
    border-radius: 50%;
    transition: transform 0.2s ease;
    box-shadow: var(--gu-shadow-sm);
}

.gu-toggle-option input:checked + .gu-toggle-switch {
    background: var(--gu-success);
}

.gu-toggle-option input:checked + .gu-toggle-switch::after {
    transform: translateX(16px);
}

.gu-toggle-label {
    flex: 1;
    min-width: 0;
}

.gu-toggle-title {
    display: block;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--gu-text);
    line-height: 1.2;
}

.gu-toggle-desc {
    display: block;
    font-size: 0.78rem;
    color: var(--gu-text-muted);
    line-height: 1.4;
    margin-top: 2px;
}

/* Quality Slider */
.gu-quality-section {
    margin-top: 0.5rem;
}

.gu-quality-control {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.gu-quality-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gu-quality-value {
    font-weight: 600;
    color: var(--gu-primary);
    background: var(--gu-success-light);
    padding: 0.25rem 0.75rem;
    border-radius: var(--gu-radius-full);
    font-size: 0.85rem;
}

.gu-quality-slider {
    width: 100%;
    height: 8px;
    appearance: none;
    background: var(--gu-bg-tertiary);
    border-radius: var(--gu-radius-full);
    cursor: pointer;
    margin: 4px 0;
}

.gu-quality-slider::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--gu-success);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: var(--gu-shadow-md);
    transition: transform 0.2s ease;
}

.gu-quality-slider::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

.gu-quality-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--gu-success);
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: var(--gu-shadow-md);
}

.gu-quality-slider::-moz-range-track {
    height: 12px;
    background: var(--gu-bg-tertiary);
    border-radius: var(--gu-radius-full);
    border: none;
}

.gu-quality-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.75rem;
    color: var(--gu-text-muted);
}

/* Info Box */
.gu-info-box {
    display: flex;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--gu-primary-light);
    border-radius: var(--gu-radius-md);
    margin-top: 0.5rem;
}

.gu-info-box-icon {
    flex-shrink: 0;
    color: var(--gu-primary);
}

.gu-info-box-icon svg,
.gu-info-box-icon i {
    width: 18px;
    height: 18px;
}

.gu-info-box-text {
    font-size: 0.85rem;
    color: var(--gu-text-secondary);
    line-height: 1.5;
}

/* Action Bar */
.gu-action-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    padding: 1.5rem 2rem;
    background: var(--gu-bg-secondary);
    border-top: 1px solid var(--gu-border);
    transition: background-color var(--gu-transition-speed), border-color var(--gu-transition-speed);
}

.gu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--gu-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: inherit;
}

.gu-btn-primary {
    background: var(--gu-primary);
    color: white;
    box-shadow: var(--gu-shadow-primary);
}

.gu-btn-primary:hover:not(:disabled) {
    background: var(--gu-primary-dark);
    box-shadow: var(--gu-shadow-primary-hover);
    transform: translateY(-1px);
}

.gu-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.gu-btn-secondary {
    background: var(--gu-bg-tertiary);
    color: var(--gu-text);
    border: 1px solid var(--gu-border);
}

.gu-btn-secondary:hover {
    background: var(--gu-bg);
    border-color: var(--gu-text-muted);
}

/* ── Processing Overlay - analyzer-style ─────────────────────
   Dark backdrop + centered card with stage dots, CSS spinner,
   progressive preview thumbnail, and progress bar.
   All prefixed gu- to avoid custom_styles.css conflicts.
   ──────────────────────────────────────────────────────────── */

/* Dark semi-transparent backdrop */
.gu-processing-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9000;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}

/* Centered white/dark card */
.gu-processing-card {
    background: var(--gu-bg-elevated);
    border-radius: var(--gu-radius-xl);
    padding: 2rem 2.5rem;
    text-align: center;
    box-shadow: 0 25px 60px rgba(0,0,0,0.35);
    min-width: 320px;
    max-width: 400px;
    width: 90%;
    border: 1px solid var(--gu-border);
    transition: background-color var(--gu-transition-speed), border-color var(--gu-transition-speed);
}

/* Stage dots row */
.gu-stage-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 1.5rem;
}

.gu-stage-dot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    color: var(--gu-text-muted);
    transition: color 0.3s;
    flex-shrink: 0;
}

.gu-stage-icon {
    width: 20px;
    height: 20px;
    padding: 7px;
    background: var(--gu-bg-secondary);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-sizing: content-box;
}

.gu-stage-icon svg {
    width: 16px;
    height: 16px;
    display: block;
}

.gu-stage-dot span {
    font-size: 0.62rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    white-space: nowrap;
}

.gu-stage-dot.gu-active .gu-stage-icon { background: var(--gu-primary); color: #fff; }
.gu-stage-dot.gu-active                  { color: var(--gu-primary); }
.gu-stage-dot.gu-done   .gu-stage-icon  { background: var(--gu-success); color: #fff; }
.gu-stage-dot.gu-done                    { color: var(--gu-success); }

.gu-stage-connector {
    width: 24px;
    height: 2px;
    background: var(--gu-border);
    margin: 0 0.2rem 1.1rem;
    flex-shrink: 0;
    transition: background-color 0.3s;
}

/* Progressive preview thumbnail */
.gu-progressive-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
    animation: gu-fadeIn 0.4s ease;
}

.gu-progressive-preview canvas {
    max-width: 160px;
    max-height: 120px;
    width: auto;
    height: auto;
    border-radius: var(--gu-radius-md);
    box-shadow: var(--gu-shadow-md);
    border: 1px solid var(--gu-border);
    /* Checkerboard for transparency */
    background-image:
        linear-gradient(45deg, var(--gu-checker-light) 25%, transparent 25%),
        linear-gradient(-45deg, var(--gu-checker-light) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--gu-checker-light) 75%),
        linear-gradient(-45deg, transparent 75%, var(--gu-checker-light) 75%);
    background-size: 8px 8px;
    background-position: 0 0, 0 4px, 4px -4px, -4px 0;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.gu-preview-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gu-text-muted);
    background: var(--gu-bg-secondary);
    padding: 0.2rem 0.6rem;
    border-radius: var(--gu-radius-full);
    border: 1px solid var(--gu-border);
    letter-spacing: 0.02em;
}

/* CSS-only ring spinner (no Lucide dependency) */
.gu-css-spinner {
    width: 44px;
    height: 44px;
    border: 4px solid var(--gu-border);
    border-top-color: var(--gu-primary);
    border-radius: 50%;
    animation: gu-spin 0.8s linear infinite;
    margin: 0 auto 1.25rem;
}

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

/* Status line */
.gu-processing-status {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gu-text);
    margin: 0 0 0.75rem;
    min-height: 1.3em;
}

/* Progress bar */
.gu-progress-bar-wrap {
    height: 6px;
    background: var(--gu-border);
    border-radius: var(--gu-radius-full);
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.gu-progress-bar-fill {
    height: 100%;
    background: var(--gu-primary);
    width: 0%;
    transition: width 0.4s ease;
    border-radius: var(--gu-radius-full);
}

.gu-progress-pct {
    font-size: 0.82rem;
    color: var(--gu-text-muted);
    margin: 0;
}

/* Fade-in for progressive preview */
@keyframes gu-fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to   { opacity: 1; transform: scale(1); }
}

/* Results Section */
.gu-results-section {
    padding: 2rem;
}

.gu-results-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 2rem;
}

.gu-results-icon {
    width: 56px;
    height: 56px;
    background: var(--gu-success-light);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gu-success);
}

.gu-results-icon svg,
.gu-results-icon i {
    width: 28px;
    height: 28px;
}

.gu-results-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--gu-text);
    margin: 0;
}

/* Comparison Area */
.gu-comparison-area {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    gap: 1.5rem;
    align-items: center;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: var(--gu-bg-secondary);
    border-radius: var(--gu-radius-lg);
}

.gu-comparison-item {
    text-align: center;
}

.gu-comparison-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gu-text-muted);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.gu-comparison-preview {
    max-width: 100%;
    max-height: 200px;
    border-radius: var(--gu-radius-md);
    box-shadow: var(--gu-shadow-md);
    background-image: 
        linear-gradient(45deg, var(--gu-checker-light) 25%, transparent 25%),
        linear-gradient(-45deg, var(--gu-checker-light) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--gu-checker-light) 75%),
        linear-gradient(-45deg, transparent 75%, var(--gu-checker-light) 75%);
    background-size: 12px 12px;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0px;
}

.gu-comparison-stats {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-top: 0.75rem;
}

.gu-comparison-stat {
    font-size: 0.85rem;
    color: var(--gu-text-secondary);
}

.gu-comparison-stat strong {
    color: var(--gu-text);
}

.gu-comparison-arrow {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    color: var(--gu-primary);
}

.gu-comparison-arrow svg,
.gu-comparison-arrow i {
    width: 32px;
    height: 32px;
}

.gu-scale-badge {
    background: var(--gu-primary);
    color: white;
    padding: 0.35rem 0.75rem;
    border-radius: var(--gu-radius-full);
    font-size: 0.85rem;
    font-weight: 600;
}

/* Results Actions */
.gu-results-actions {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.gu-btn-success {
    background: var(--gu-success);
    color: white;
}

.gu-btn-success:hover {
    background: #2d8659;
}

/* Error Display */
.gu-error-display {
    display: none;
    align-items: flex-start;
    gap: 0.875rem;
    padding: 1rem 1.25rem;
    margin: 1rem 2rem;
    background: var(--gu-bg-elevated);
    border-radius: var(--gu-radius-md);
    border: 1px solid rgba(230, 78, 78, 0.25);
    box-shadow: 0 0 0 3px rgba(230, 78, 78, 0.07);
}

.gu-error-icon {
    color: var(--gu-danger);
    flex-shrink: 0;
    margin-top: 1px;
    opacity: 0.9;
}

.gu-error-body {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.gu-error-text {
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--gu-text);
    line-height: 1.5;
}

.gu-error-contact {
    margin: 0;
    font-size: 0.8rem;
    color: var(--gu-text-muted);
}

.gu-error-contact a {
    color: var(--gu-primary);
    text-decoration: none;
    font-weight: 600;
}

.gu-error-contact a:hover {
    text-decoration: underline;
}

.gu-error-server-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 0.5rem;
    padding: 0.45rem 0.9rem;
    background: var(--gu-primary);
    color: #fff;
    border: none;
    border-radius: var(--gu-radius-sm);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: background var(--gu-transition-speed);
}

.gu-error-server-btn:hover {
    background: var(--gu-primary-dark);
}

/* Info Cards */
.gu-info-section {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

.gu-info-card {
    padding: 2rem;
    background: var(--gu-bg-elevated);
    border-radius: var(--gu-radius-xl);
    border: 1px solid var(--gu-border);
    box-shadow: var(--gu-shadow-sm);
    transition: background-color var(--gu-transition-speed), border-color var(--gu-transition-speed);
}

.gu-info-card h2 {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--gu-text);
    margin: 0 0 1.25rem 0;
}

.gu-info-card h2 svg,
.gu-info-card h2 i {
    color: var(--gu-primary);
    width: 24px;
    height: 24px;
}

.gu-info-card p {
    color: var(--gu-text-secondary);
    line-height: 1.7;
    margin: 0 0 1rem 0;
}

.gu-info-card p:last-child {
    margin-bottom: 0;
}

.gu-info-card a {
    color: var(--gu-primary);
    text-decoration: none;
}

.gu-info-card a:hover {
    text-decoration: underline;
}

/* Features Grid */
.gu-features-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}

.gu-feature-item {
    display: flex;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--gu-bg-secondary);
    border-radius: var(--gu-radius-md);
    transition: background-color var(--gu-transition-speed);
}

.gu-feature-icon {
    flex-shrink: 0;
    width: 48px;
    height: 48px;
    background: var(--gu-primary-light);
    border-radius: var(--gu-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gu-primary);
}

.gu-feature-content h4 {
    margin: 0 0 0.5rem 0;
    font-size: 1rem;
    color: var(--gu-text);
}

.gu-feature-content p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--gu-text-secondary);
    line-height: 1.5;
}

/* Related Tools */
.gu-related-tools {
    display: flex;
	margin-top: 0 !important;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
	border: 0 !important;
	padding: 0 !important;
	box-shadow: none !important;
}

.gu-related-tool-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--gu-bg-secondary);
    border-radius: var(--gu-radius-full);
    color: var(--gu-text);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.2s ease;
}

.gu-related-tool-link:hover {
    background: var(--gu-primary-light);
    color: var(--gu-primary);
	text-decoration: none;
}

.gu-related-tool-link svg,
.gu-related-tool-link i {
    width: 16px;
    height: 16px;
}

/* FAQ */
.faq-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.faq-item {
    border: 1px solid var(--gu-border);
    border-radius: var(--gu-radius-md);
    overflow: hidden;
    transition: border-color var(--gu-transition-speed);
}

.faq-question {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 1.25rem;
    background: var(--gu-bg-secondary);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    color: var(--gu-text);
    text-align: left;
    transition: all 0.2s ease;
}

.faq-question:hover {
    background: var(--gu-bg-tertiary);
}

.faq-question svg,
.faq-question i {
    flex-shrink: 0;
    color: var(--gu-primary);
    width: 20px;
    height: 20px;
    transition: transform 0.3s ease;
}

.faq-item.open .faq-question svg,
.faq-item.open .faq-question i {
    transform: rotate(180deg);
}

.faq-answer {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.faq-item.open .faq-answer {
    max-height: 1200px;
}

.faq-answer p {
    margin: 0;
    color: var(--gu-text-secondary);
    line-height: 1.7;
    background: var(--gu-bg-elevated);
    transition: background-color var(--gu-transition-speed), border-color var(--gu-transition-speed);
}

.faq-answer a {
    color: var(--gu-primary);
    text-decoration: none;
}

.faq-answer a:hover {
    text-decoration: underline;
}

/* Responsive */
@media (max-width: 900px) {
    .gu-settings-grid {
        grid-template-columns: 1fr;
    }
    
    .gu-features-grid {
        grid-template-columns: 1fr;
    }
    
    .gu-comparison-area {
        grid-template-columns: 1fr;
        text-align: center;
    }
    
    .gu-comparison-arrow {
        transform: rotate(90deg);
    }
}

@media (max-width: 768px) {
    .tool-container {
        padding: 1rem;
    }
    
    .gu-tool-title-row {
        gap: 0.75rem;
    }
    
    .gu-tool-icon-wrapper {
        width: 50px;
        height: 50px;
    }
    
    .gu-tool-icon-wrapper svg,
    .gu-tool-icon-wrapper i {
        width: 24px;
        height: 24px;
    }
    
    .gu-upload-section {
        padding: 2rem 1.5rem;
    }
    
    .gu-upload-area {
        padding: 2.5rem 1.5rem;
    }
    
    .gu-settings-panel {
        padding: 1.5rem;
    }
    
    .gu-scale-options {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .gu-action-bar {
        flex-direction: column;
        padding: 1.25rem;
    }
    
    .gu-btn {
        width: 100%;
    }
    
    .gu-results-section {
        padding: 1.5rem;
    }
    
    .gu-results-actions {
        flex-direction: column;
    }
    
    .gu-results-actions .gu-btn {
        width: 100%;
    }
    
    .gu-feature-item {
        flex-direction: column;
        gap: 0.75rem;
    }
}

@media (max-width: 480px) {
    .gu-tool-title-row {
        flex-direction: column;
        gap: 0.75rem;
    }
    
    .gu-custom-scale {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--gu-scrollbar-track);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--gu-scrollbar-thumb);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--gu-scrollbar-thumb-hover);
}

/* Selection */
::selection {
    background: rgba(51, 153, 102, 0.2);
    color: var(--gu-text);
}

[data-theme="dark"] ::selection {
    background: rgba(74, 222, 128, 0.3);
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.gu-editor-section,
.gu-results-section {
    animation: fadeIn 0.4s ease;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* Toggle checkbox - hidden input, not affected by custom_styles.css */
.gu-toggle-option input[type="checkbox"] {
    display: none !important;
    width: auto !important;
    height: auto !important;
}

/* gu-btn-cancel: prefixed Cancel button to avoid custom_styles.css override */
.gu-btn-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1.75rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: var(--gu-radius-md);
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid var(--gu-border);
    font-family: inherit;
    background: var(--gu-bg-tertiary);
    color: var(--gu-text);
    text-decoration: none;
}

.gu-btn-cancel:hover {
    background: var(--gu-bg);
    border-color: var(--gu-text-muted);
}

.gu-btn-cancel svg,
.gu-btn-cancel i {
    width: 18px;
    height: 18px;
}

/* Ensure gu-btn-success is not overridden by custom_styles.css */
.gu-btn.gu-btn-success,
button.gu-btn-success {
    background: var(--gu-success) !important;
    color: white !important;
    border: none !important;
}

.gu-btn.gu-btn-success:hover,
button.gu-btn-success:hover {
    background: #2d8659 !important;
    transform: translateY(-1px);
}

/* =====================================================
   Announcement Toast
   ===================================================== */
.gu-toast {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%) translateY(calc(-100% - 2rem));
    z-index: 9999;
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    width: min(540px, calc(100vw - 2rem));
    background: var(--gu-bg-elevated);
    border: 1px solid var(--gu-border);
    border-radius: var(--gu-radius-lg);
    padding: 0.9rem 1rem 1.2rem 1rem;
    box-shadow: var(--gu-shadow-lg), 0 0 0 3px rgba(51,153,102,0.08);
    overflow: hidden;
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.34,1.56,0.64,1), opacity 0.4s ease;
    pointer-events: none;
}

.gu-toast.gu-toast-visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
    pointer-events: auto;
}

.gu-toast.gu-toast-hiding {
    transform: translateX(-50%) translateY(calc(-100% - 2rem));
    opacity: 0;
    pointer-events: none;
}

.gu-toast-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    background: var(--gu-primary-light);
    color: var(--gu-primary);
    border-radius: var(--gu-radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: 1px;
}

.gu-toast-body {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.gu-toast-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--gu-text);
    line-height: 1.3;
}

.gu-toast-msg {
    font-size: 0.82rem;
    color: var(--gu-text-secondary);
    line-height: 1.5;
}

.gu-toast-msg strong {
    color: var(--gu-primary);
    font-weight: 600;
}

.gu-toast-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: transparent;
    border: none;
    border-radius: var(--gu-radius-sm);
    color: var(--gu-text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    margin-top: -2px;
    transition: background 0.15s, color 0.15s;
}

.gu-toast-close:hover {
    background: var(--gu-bg-secondary);
    color: var(--gu-text);
}

/* Progress bar - shrinks from 100% to 0 over DISMISS_MS */
.gu-toast-progress {
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    width: 100%;
    background: var(--gu-primary);
    border-radius: 0 0 var(--gu-radius-lg) var(--gu-radius-lg);
    opacity: 0.55;
}

/* Mobile: anchor to bottom to avoid overlapping nav */
@media (max-width: 600px) {
    .gu-toast {
        top: auto;
        bottom: 1rem;
        transform: translateX(-50%) translateY(calc(100% + 2rem));
    }
    .gu-toast.gu-toast-visible {
        transform: translateX(-50%) translateY(0);
    }
    .gu-toast.gu-toast-hiding {
        transform: translateX(-50%) translateY(calc(100% + 2rem));
    }
    .gu-toast-progress {
        bottom: auto;
        top: 0;
        border-radius: var(--gu-radius-lg) var(--gu-radius-lg) 0 0;
    }
}

/* Inline feedback button replica inside toast message */
.gu-toast-fb-pill {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 9px 2px 7px;
    background: var(--gu-success);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    border-radius: 999px;
    vertical-align: middle;
    white-space: nowrap;
    line-height: 1.6;
    box-shadow: 0 1px 4px rgba(51,153,102,0.35);
    letter-spacing: 0.01em;
    position: relative;
    top: -1px;
}

.gu-toast-fb-pill svg {
    flex-shrink: 0;
    opacity: 0.95;
}

/* ====== Processing notes (e.g. denoise skipped on transparent GIFs) ====== */
.gu-processing-notes {
    margin: 0.75rem 0 1rem;
}

.gu-note-item {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    background: var(--gu-primary-light);
    border: 1px solid var(--gu-primary);
    border-radius: var(--gu-radius-md);
    padding: 0.6rem 0.9rem;
    font-size: 0.88rem;
    color: var(--gu-text);
    line-height: 1.5;
}

.gu-note-item + .gu-note-item {
    margin-top: 0.5rem;
}

[data-theme="dark"] .gu-note-item {
    background: rgba(74, 222, 128, 0.10);
    border-color: rgba(74, 222, 128, 0.45);
}


/* ====== Related tools - slim pill strip (detector pattern) ====== */
.gu-related-strip {
    margin: 1.5rem 0;
}

.gu-related-strip-box {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    padding: 1.25rem;
    background: var(--gu-bg-elevated);
    border: 1px solid var(--gu-border);
    border-radius: var(--gu-radius-lg);
    box-shadow: var(--gu-shadow-sm);
}

.gu-related-strip-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: 600;
    color: var(--gu-text-muted);
    white-space: nowrap;
}

.gu-related-strip-label i,
.gu-related-strip-label svg { color: var(--gu-primary); }

.gu-related-strip-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.gu-related-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.5rem 0.875rem;
    background: var(--gu-bg-secondary);
    border-radius: var(--gu-radius-full);
    color: var(--gu-text);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--gu-transition-speed) ease;
}

.gu-related-pill:hover {
    background: var(--gu-primary-light);
    color: var(--gu-primary);
}

/* ====== Numbered steps list (detector pattern) ====== */
.gu-steps-list {
    counter-reset: gustep;
    list-style: none;
    padding: 0;
    margin: 0.75rem 0 0;
}

.gu-steps-list li {
    position: relative;
    padding-left: 3rem;
    margin-bottom: 1rem;
    line-height: 1.6;
}

.gu-steps-list li::before {
    counter-increment: gustep;
    content: counter(gustep);
    position: absolute;
    left: 0;
    top: 0;
    width: 28px;
    height: 28px;
    background: var(--gu-primary);
    color: #ffffff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.875rem;
    font-weight: 700;
}

.gu-steps-list strong { color: var(--gu-text); }

/* Centered, slimmer tool description */

@media (max-width: 640px) {
    .gu-upload-area { padding: 2rem 1rem; }
    .gu-upload-title { font-size: 1.2rem; }
    .gu-related-strip-box { padding: 1rem; }
}
