/*
 * UltraCompress Pro: the tool's own components, styled in the site's design language (5 Oct 2026).
 * Base: /libs/site-pages.css (tokens, Inter and Space Grotesk, buttons, theme toggle, focus rings) and
 * /libs/shared-nav.css (the site's header and footer). This file holds only what the tool itself needs:
 * the drop zone, the settings cards and controls, the result cards, the comparison and metadata windows,
 * the progress overlay and the toast. Light is the default; dark applies when <html> has no data-theme.
 * Every class and id the script touches keeps its name.
 */

/* ----- Tokens the tool adds ----- */
:root {
    --surface: #ffffff;                 /* cards are true white in the light theme */
    --surface-2: #f3f4f8;               /* a quiet inset inside a card */
    --ring: rgba(139, 92, 246, 0.18);
    --app-max: 1600px;
}
:root:not([data-theme="light"]) {
    --surface: #14141f;
    --surface-2: rgba(255, 255, 255, 0.05);
}

/* ----- Page: full width, the page provides the side space ----- */
.container.app-container {
    max-width: calc(var(--app-max) + 2 * var(--content-gutter));
    margin-top: 16px;
}
@media (min-width: 640px) { .container.app-container { margin-top: 24px; } }

/* ----- Tools back link above the header, as on every other tool: the bar scrolls away under the sticky header ----- */
body { padding-top: 0; }
.back-bar { height: 48px; display: flex; align-items: center; padding: 0 var(--zdu-gutter, 24px); }
body > header { position: sticky; top: 0; z-index: 50; }
header .site-nav { position: relative; top: auto; }
.theme-toggle { top: calc(90px + var(--bar-offset, 48px)); }
@media (max-width: 768px) { .theme-toggle { top: calc(75px + var(--bar-offset, 48px)); } }

/* ----- Hero: brand row, headline, tagline ----- */
.upload-section { margin: 0 0 2.5rem; text-align: center; }
.app-brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1.25rem;
    font-family: 'Space Grotesk', 'Inter', sans-serif;
    font-weight: 700;
    font-size: 1.1rem;
    color: var(--text-strong);
}
.app-brand img { width: 44px; height: 44px; border-radius: 12px; display: block; }
.upload-section h1 { margin-bottom: 0.75rem; }
.app-tagline {
    color: var(--text-2);
    font-size: 1.125rem;
    line-height: 1.6;
    max-width: 44rem;
    margin: 0 auto 2rem;
}

/* ----- Drop zone: the one bold element on the page ----- */
.upload-zone {
    position: relative;
    overflow: hidden;
    background: var(--surface);
    border: 3px dashed rgba(139, 92, 246, 0.45);
    border-radius: 24px;
    padding: 4.5rem 2rem;
    margin: 0;
    width: 100%;
    cursor: pointer;
    box-shadow: var(--surface-shadow);
    transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
}
.upload-zone:hover, .upload-zone:focus-within {
    border-color: var(--brand);
    background: var(--tint-brand);
    transform: translateY(-4px);
    box-shadow: var(--surface-hover-shadow);
}
.upload-zone.drag-over {
    border-color: var(--brand);
    border-style: solid;
    background: var(--tint-brand);
    transform: scale(1.01);
}
.upload-zone-content { position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; }
.upload-icon {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: var(--gradient-brand);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    box-shadow: 0 10px 30px rgba(139, 92, 246, 0.35);
    transition: transform 0.3s ease;
}
.upload-zone:hover .upload-icon { transform: scale(1.1); }
.upload-zone h3 { margin: 0; font-size: 1.5rem; font-weight: 700; }
.upload-zone p { margin: 0; color: var(--text-2); font-size: 1.05rem; }
.upload-cta { margin-top: 1.25rem; }
.upload-hint { display: inline-flex; align-items: center; gap: 6px; margin-top: 1.25rem !important; color: var(--text-3) !important; font-size: 0.9rem !important; }
.supported-formats { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 1.25rem; }
.format-badge {
    display: inline-block;
    background: var(--chip);
    border: 1px solid var(--chip-border);
    color: var(--text-2);
    padding: 5px 12px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}
input[type="file"] { display: none; }

/* ----- Buttons: the site's pills, in the tool's sizes ----- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    border-radius: 9999px;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1.2;
    padding: 12px 24px;
    cursor: pointer;
    text-decoration: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}
.btn-primary { background: var(--gradient-brand); color: #fff; box-shadow: 0 4px 15px rgba(139, 92, 246, 0.3); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139, 92, 246, 0.4); color: #fff; }
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
    background: var(--surface);
    color: var(--text-strong);
    border: 1px solid var(--surface-border);
    padding: 11px 23px;
}
.btn-secondary:hover { border-color: var(--brand); color: var(--link); transform: translateY(-2px); }
.btn-lg { font-size: 1.05rem; padding: 14px 32px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; box-shadow: none; }

.btn svg { flex-shrink: 0; }

/* ----- Messages ----- */
.error-message, .success-message {
    display: none;
    max-width: 920px;
    margin: 1rem auto 0;
    padding: 12px 16px;
    border-radius: 12px;
    font-size: 0.95rem;
    text-align: left;
}
.error-message { background: rgba(185, 28, 28, 0.08); border: 1px solid rgba(185, 28, 28, 0.3); color: var(--danger); }
.success-message { background: rgba(22, 101, 52, 0.08); border: 1px solid rgba(22, 101, 52, 0.3); color: var(--success); }

/* ----- Settings ----- */
.compression-settings { display: none; margin: 0 0 2.5rem; }
.settings-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px 24px;
    margin-bottom: 1.25rem;
}
.settings-head h2 { margin: 0; font-size: 1.5rem; }
.settings-head p { margin: 0; color: var(--text-2); font-size: 0.95rem; }
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    align-items: start;
}
.setting-category {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    box-shadow: var(--surface-shadow);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}
.setting-category-header {
    margin: 0;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--surface-border);
    font-size: 1.05rem;
    font-weight: 700;
}
.setting-group { display: flex; flex-direction: column; gap: 10px; }
.setting-label {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-strong);
}
.setting-label span:last-child:not(:first-child) {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--link);
    background: var(--code-bg);
    padding: 2px 10px;
    border-radius: 9999px;
}
.setting-group small { color: var(--text-3); font-size: 0.8rem; line-height: 1.5; }
.setting-group > div[style] { flex-wrap: wrap; }

/* Sliders */
.slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 9999px;
    background: linear-gradient(90deg, var(--brand) 0, var(--brand) var(--fill, 50%), var(--surface-2) var(--fill, 50%), var(--surface-2) 100%);
    border: 1px solid var(--surface-border);
    outline: none;
    cursor: pointer;
    margin: 4px 0;
}
.slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--brand);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.35);
    cursor: grab;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.slider::-webkit-slider-thumb:hover, .slider:focus-visible::-webkit-slider-thumb { transform: scale(1.1); box-shadow: 0 0 0 6px var(--ring); }
.slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fff;
    border: 3px solid var(--brand);
    box-shadow: 0 2px 8px rgba(139, 92, 246, 0.35);
    cursor: grab;
}
.slider::-moz-range-progress { background: var(--brand); height: 6px; border-radius: 9999px; }
.slider::-moz-range-track { background: var(--surface-2); height: 6px; border-radius: 9999px; }
.slider:focus-visible { outline: none; }

/* Preset chips and the format switch */
.quality-preset-btn, .format-option {
    background: var(--chip);
    border: 1px solid var(--chip-border);
    color: var(--text-2);
    padding: 7px 14px;
    border-radius: 9999px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
}
.quality-preset-btn:hover, .format-option:hover { border-color: var(--brand); color: var(--link); }
.quality-preset-btn.active, .format-option.active { background: var(--gradient-brand); color: #fff; border-color: transparent; }
.format-selector { display: flex; flex-wrap: wrap; gap: 8px; }

/* The row that starts the work */
.settings-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
    margin-top: 1.5rem;
}

/* ----- Results ----- */
.preview-section { display: none; margin: 0 0 2.5rem; }
.preview-section h2 { margin: 0 0 1rem; font-size: 1.5rem; }
.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}
.image-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    box-shadow: var(--surface-shadow);
    overflow: hidden;
    animation: slideUp 0.4s ease-out;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.image-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
@keyframes slideUp { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeOut { to { opacity: 0; transform: scale(0.9); } }
.image-container { position: relative; background: var(--surface-2); }
.image-preview { width: 100%; height: 200px; object-fit: cover; display: block; background: var(--surface-2); }
.preview-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-2);
    font-size: 0.9rem;
}
.quality-indicator {
    position: absolute;
    top: 10px;
    left: 10px;
    background: rgba(10, 10, 20, 0.7);
    color: #fff;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 600;
}
.image-info { padding: 16px; }
.image-name { font-weight: 600; color: var(--text-strong); margin-bottom: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.image-dimensions, .individual-max-width { color: var(--text-3); font-size: 0.8rem; margin-bottom: 6px; }
.image-stats { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 0.875rem; color: var(--text-2); margin: 6px 0 12px; }
.compression-ratio {
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 9999px;
    font-size: 0.8rem;
    background: var(--text-3);
    color: #fff;   /* the script paints the background green or red when the result is known */
}
.image-actions { display: flex; gap: 8px; justify-content: center; }
.image-actions .btn {
    position: relative;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.1rem;
}
.image-actions .btn span { font-size: 1.1rem; line-height: 1; }
.image-actions .btn:hover::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    background: #0a0a14;
    color: #fff;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 0.75rem;
    font-weight: 500;
    white-space: nowrap;
    z-index: 100;
    margin-bottom: 6px;
}
.progress-bar { width: 100%; height: 6px; background: var(--surface-2); border: 1px solid var(--surface-border); border-radius: 9999px; overflow: hidden; margin-top: 8px; }
.progress-fill { height: 100%; background: var(--gradient-brand); transition: width 0.3s ease; border-radius: 9999px; }

/* Batch buttons that follow the page */
.batch-actions { position: fixed; bottom: 24px; right: 24px; display: none; flex-direction: column; gap: 12px; z-index: 50; }
.batch-actions.show { display: flex; }
.floating-btn {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: var(--gradient-brand);
    color: #fff;
    border: 0;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    box-shadow: 0 6px 20px rgba(139, 92, 246, 0.35);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.floating-btn:hover { transform: translateY(-2px) scale(1.05); box-shadow: 0 10px 28px rgba(139, 92, 246, 0.45); }
@media (max-width: 639px) { .batch-actions { bottom: 16px; right: 16px; } }

/* ----- Windows (comparison, metadata, editor) ----- */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 20, 0.6);
    backdrop-filter: blur(6px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.modal-content {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 20px;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
    max-width: 1000px;
    width: 100%;
    max-height: 92vh;
    overflow: auto;
    animation: modalSlide 0.25s ease-out;
}
@keyframes modalSlide { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 18px 20px;
    border-bottom: 1px solid var(--surface-border);
    position: sticky;
    top: 0;
    background: var(--surface);
    z-index: 2;
}
.modal-header h3 { margin: 0; font-size: 1.15rem; }
.close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--chip-border);
    background: var(--chip);
    color: var(--text-strong);
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.2s ease, color 0.2s ease;
}
.close-btn:hover { border-color: var(--brand); color: var(--link); }

.comparison-container { padding: 20px; }
.comparison-slider { position: relative; width: 100%; max-width: 860px; margin: 0 auto; overflow: hidden; border-radius: 16px; background: #0a0a14; min-height: 320px; }
.comparison-image { width: 100%; height: 100%; display: block; object-fit: contain; object-position: center; }
.comparison-slider img { display: block; }
.comparison-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; clip-path: inset(0 50% 0 0); }
.comparison-overlay img { width: 100%; height: 100%; display: block; object-fit: contain; object-position: center; }
.comparison-handle { position: absolute; top: 0; left: 50%; width: 3px; height: 100%; background: #fff; cursor: ew-resize; transform: translateX(-50%); z-index: 10; }
.comparison-handle::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    background: var(--gradient-brand);
    border: 2px solid #fff;
    border-radius: 50%;
    transform: translate(-50%, -50%);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.35);
}
.comparison-handle::after { content: '◀ ▶'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #fff; font-size: 12px; font-weight: 700; z-index: 1; }
.comparison-labels { position: absolute; top: 14px; left: 0; right: 0; display: flex; justify-content: space-between; padding: 0 14px; pointer-events: none; }
.comparison-label { background: rgba(10, 10, 20, 0.7); color: #fff; padding: 4px 12px; border-radius: 9999px; font-size: 0.8rem; font-weight: 600; }
.stats-panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-top: 20px; }
.stat-card { background: var(--surface-2); border: 1px solid var(--surface-border); border-radius: 12px; padding: 14px; text-align: center; }
.stat-value { font-family: 'Space Grotesk', 'Inter', sans-serif; font-size: 1.4rem; font-weight: 700; color: var(--text-strong); }
.stat-label { font-size: 0.8rem; color: var(--text-3); margin-top: 2px; }

/* Metadata window */
#metadataModal .modal-content { max-width: 760px; }
.metadata-panel { padding: 20px; }
#metadataContent { max-height: 70vh; overflow-y: auto; }
.metadata-section { margin-bottom: 20px; }
.metadata-section:last-child { margin-bottom: 0; }
.metadata-section-title { font-weight: 700; color: var(--text-strong); font-size: 0.95rem; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--surface-border); }
.metadata-items { display: grid; gap: 6px; }
.metadata-item { display: flex; justify-content: space-between; gap: 16px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); font-size: 0.875rem; }
.metadata-key { color: var(--text-2); font-weight: 500; }
.metadata-value { color: var(--text-strong); text-align: right; overflow-wrap: anywhere; }
.metadata-actions { display: flex; flex-wrap: wrap; gap: 10px; justify-content: flex-end; margin-top: 16px; }

/* Editor window: the inline layout in the page is kept; only the colours come from the tokens */
.preview-canvas-container { background: var(--surface-2) !important; }
.controls-panel { background: var(--surface) !important; border-color: var(--surface-border) !important; border-radius: 12px !important; }
.controls-panel .quality-preset-btn { background: var(--chip) !important; color: var(--text-2) !important; border: 1px solid var(--chip-border) !important; padding: 5px 10px !important; }
.controls-panel .quality-preset-btn:hover { border-color: var(--brand) !important; color: var(--link) !important; }
@media (max-width: 768px) {
    .preview-edit-container { flex-direction: column; max-height: none !important; }
    .controls-panel { flex: 1 1 auto !important; }
}

/* ----- Progress overlay ----- */
.processing-overlay { position: fixed; inset: 0; background: rgba(10, 10, 20, 0.7); backdrop-filter: blur(6px); display: none; align-items: center; justify-content: center; z-index: 999; padding: 16px; }
.processing-modal { background: var(--surface); border: 1px solid var(--surface-border); border-radius: 20px; box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35); padding: 32px 28px; text-align: center; max-width: 420px; width: 100%; }
.processing-modal h3 { margin: 0 0 6px; }
.processing-modal p { color: var(--text-2); margin-bottom: 1rem; }
.processing-spinner { width: 56px; height: 56px; border: 4px solid var(--surface-2); border-radius: 50%; border-top-color: var(--brand); animation: spin 0.9s linear infinite; margin: 0 auto 1.25rem; }
.loading-spinner { width: 20px; height: 20px; border: 2px solid var(--surface-2); border-top-color: var(--brand); border-radius: 50%; animation: spin 0.9s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.processing-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 1.25rem; }
.processing-stat { background: var(--surface-2); border: 1px solid var(--surface-border); border-radius: 12px; padding: 12px; }
.processing-stat > div:first-child { font-family: 'Space Grotesk', 'Inter', sans-serif; color: var(--text-strong); }
.worker-indicator { display: flex; gap: 6px; justify-content: center; margin-top: 1rem; }
.worker-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--surface-border); transition: background 0.3s ease; }
.worker-dot.active { background: var(--brand); animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.25); opacity: 0.7; } }

/* ----- Toast ----- */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: #0a0a14;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 9999px;
    padding: 12px 22px;
    font-size: 0.95rem;
    font-weight: 500;
    display: flex;
    align-items: center;
    gap: 10px;
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
    z-index: 1001;
    max-width: calc(100vw - 32px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}
.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }
.toast.success { border-color: #4ade80; }
.toast.error { border-color: #f87171; }

/* ----- Information sections below the tool ----- */
.info-section { margin: 0 0 2.5rem; }
.info-section h2 { font-size: 1.75rem; margin: 0 0 1.25rem; }
.info-section > p { max-width: 70ch; }
/* Three columns on desktops, two on tablets, one on phones: six cards fill two rows without a gap. */
.info-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.info-three { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
/* Five format cards: three in the first row, two wider ones in the second, so no slot stays empty. */
.formats-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 20px; }
.formats-grid > .info-card { grid-column: span 2; }
.formats-grid > .info-card:nth-child(4), .formats-grid > .info-card:nth-child(5) { grid-column: span 3; }
@media (max-width: 1023px) {
    .info-grid, .info-three { grid-template-columns: repeat(2, 1fr); }
    .formats-grid { grid-template-columns: repeat(2, 1fr); }
    .formats-grid > .info-card, .formats-grid > .info-card:nth-child(4) { grid-column: auto; }
    .formats-grid > .info-card:nth-child(5) { grid-column: span 2; }
}
@media (max-width: 639px) {
    .info-grid, .info-three, .formats-grid { grid-template-columns: 1fr; }
    .formats-grid > .info-card:nth-child(4), .formats-grid > .info-card:nth-child(5) { grid-column: auto; }
}
.info-stack { display: grid; gap: 20px; }
.info-stack--tight { gap: 12px; }
.info-two { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-top: 1rem; }
.info-card {
    background: var(--surface);
    border: 1px solid var(--surface-border);
    border-radius: 16px;
    box-shadow: var(--surface-shadow);
    padding: 20px;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.info-card:hover { transform: translateY(-4px); box-shadow: var(--surface-hover-shadow); }
.info-card--small { padding: 16px; box-shadow: none; }
.info-card--good { background: rgba(22, 163, 74, 0.07); border-color: rgba(22, 163, 74, 0.3); box-shadow: none; }
.info-card--bad { background: rgba(185, 28, 28, 0.06); border-color: rgba(185, 28, 28, 0.3); box-shadow: none; }
.info-card--good h4 { color: var(--success); }
.info-card--bad h4 { color: var(--danger); }
.info-card h3 { margin: 0 0 0.75rem; font-size: 1.15rem; }
.info-card h4 { margin: 0 0 0.5rem; font-size: 1rem; }
.info-card p { color: var(--text-2); margin-bottom: 0.75rem; }
.info-card p:last-child, .info-card ul:last-child { margin-bottom: 0; }
.info-card ul { padding-left: 20px; margin-bottom: 0; color: var(--text-2); }
.info-card li { color: var(--text-2); margin-bottom: 6px; font-size: 0.95rem; }
.info-section article:not(.info-card) h3 { font-size: 1.25rem; margin: 0 0 0.75rem; }
.info-section article:not(.info-card) p { color: var(--text-2); max-width: 70ch; }
.info-section article:not(.info-card) ul { color: var(--text-2); padding-left: 20px; }
.info-section article:not(.info-card) li { color: var(--text-2); }
.step-card { position: relative; padding-top: 24px; }
.step-num {
    position: absolute;
    top: -16px;
    left: 20px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--gradient-brand);
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(139, 92, 246, 0.3);
}
.step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 0.75rem; }
.step-head h3 { margin: 0; }
.step-emoji { font-size: 1.6rem; line-height: 1; }
.rate-list { display: grid; gap: 8px; }
@media (min-width: 640px) { .rate-list { grid-template-columns: 1fr 1fr; } }
.rate-row { display: flex; justify-content: space-between; gap: 16px; padding: 10px 14px; border-radius: 10px; background: var(--surface-2); font-size: 0.95rem; }
.rate-row .rate-val { color: var(--link); font-weight: 600; white-space: nowrap; }
.info-section details.info-card { padding: 0; }
.info-section details.info-card summary {
    cursor: pointer;
    padding: 16px 20px;
    font-weight: 600;
    color: var(--text-strong);
    list-style: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}
.info-section details.info-card summary::-webkit-details-marker { display: none; }
.info-section details.info-card summary::after { content: '+'; color: var(--link); font-weight: 700; font-size: 1.2rem; line-height: 1; flex-shrink: 0; }
.info-section details.info-card[open] summary::after { content: '−'; }
.info-section details.info-card p { padding: 0 20px 16px; margin: 0; color: var(--text-2); }

/* ----- Small screens ----- */
@media (max-width: 639px) {
    .upload-zone { padding: 2.5rem 1rem; border-radius: 20px; }
    .upload-icon { width: 76px; height: 76px; }
    .upload-icon svg { width: 36px; height: 36px; }
    .upload-zone h3 { font-size: 1.25rem; }
    .setting-category, .info-card { padding: 16px; }
    .image-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .image-preview { height: 140px; }
    .image-info { padding: 12px; }
    .modal { padding: 8px; }
    .comparison-container, .metadata-panel { padding: 12px; }
    .info-section h2 { font-size: 1.4rem; }
}
@media (max-width: 420px) { .image-grid { grid-template-columns: 1fr; } }

@media (prefers-reduced-motion: reduce) {
    .image-card, .btn, .floating-btn, .upload-zone, .modal-content, .toast { transition: none; animation: none; }
    .processing-spinner, .loading-spinner { animation-duration: 2s; }
}

/* Phones: 16 px text, 44 px tap targets (AdSense audit H-04, 8 Oct 2026) */
@media (max-width: 639.98px) {
    main button, main select, main summary, main [role="button"],
    main input:not([type="checkbox"]):not([type="radio"]):not([type="hidden"]):not([type="file"]) { min-height: 44px; }
    main .info-card li { font-size: 1rem; }
    .upload-zone .upload-hint { font-size: 1rem !important; } /* the base rule is !important */
}
