/* Image Tools — Stylesheet */

:root {
    --bg-primary: #f8f9fa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f1f3f5;
    --bg-hover: #e9ecef;
    --bg-active: #e7f5ff;
    --text-primary: #1a1a2e;
    --text-secondary: #6c757d;
    --text-tertiary: #adb5bd;
    --border-color: #e0e0e0;
    --border-light: #f0f0f0;
    --accent: #2563eb;
    --accent-hover: #1d4ed8;
    --accent-light: #dbeafe;
    --success: #10b981;
    --success-light: #d1fae5;
    --warning: #f59e0b;
    --danger: #ef4444;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.12);
    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 999px;
    --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    --topbar-h: 56px;
    --tabs-h: 52px;
    --downloadbar-h: 64px;
}

[data-theme="dark"] {
    --bg-primary: #0f0f1a;
    --bg-secondary: #1a1a2e;
    --bg-tertiary: #16213e;
    --bg-hover: #233;
    --bg-active: #1a3a5c;
    --text-primary: #e8e8e8;
    --text-secondary: #a0a0b0;
    --text-tertiary: #666680;
    --border-color: #2a2a3e;
    --border-light: #1e1e30;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-light: #1e3a5f;
    --success: #34d399;
    --success-light: #0f3d2e;
    --warning: #fbbf24;
    --danger: #f87171;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 24px rgba(0,0,0,0.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; height: 100%; }
body {
    font-family: var(--font);
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex; flex-direction: column;
    height: 100vh; overflow: hidden;
    transition: background var(--transition), color var(--transition);
}

.top-bar {
    height: var(--topbar-h); display: flex; align-items: center;
    justify-content: space-between; padding: 0 20px;
    background: var(--bg-secondary); border-bottom: 1px solid var(--border-color);
    flex-shrink: 0; z-index: 100;
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text-primary); font-weight: 700; font-size: 1.1rem; }
.logo__icon { width: 28px; height: 28px; color: var(--accent); }
.theme-toggle {
    background: none; border: none; cursor: pointer; width: 36px; height: 36px;
    border-radius: var(--radius-sm); display: flex; align-items: center; justify-content: center;
    color: var(--text-secondary); transition: all var(--transition);
}
.theme-toggle:hover { background: var(--bg-hover); color: var(--text-primary); }
.icon-moon { display: none; }
[data-theme="dark"] .icon-sun { display: none; }
[data-theme="dark"] .icon-moon { display: block; }
.theme-toggle svg { width: 20px; height: 20px; }

.tool-tabs {
    height: var(--tabs-h); display: flex; align-items: center; gap: 4px;
    padding: 0 20px; background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-color); overflow-x: auto;
    flex-shrink: 0; scrollbar-width: thin;
}
.tool-tabs::-webkit-scrollbar { height: 3px; }
.tool-tabs::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 3px; }
.tool-tab {
    display: flex; align-items: center; gap: 6px; padding: 8px 14px;
    border: none; background: none; color: var(--text-secondary);
    font-size: 0.87rem; font-family: var(--font); cursor: pointer;
    border-radius: var(--radius-sm); white-space: nowrap;
    transition: all var(--transition); position: relative;
}
.tool-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.tool-tab.active { color: var(--accent); background: var(--bg-active); }
.tool-tab.active::after {
    content: ''; position: absolute; bottom: -1px; left: 50%; transform: translateX(-50%);
    width: 60%; height: 2px; background: var(--accent); border-radius: 2px;
}
.tool-tab svg { width: 16px; height: 16px; }

.workspace { flex: 1; display: flex; overflow: hidden; min-height: 0; }
.control-panel {
    width: 340px; flex-shrink: 0; background: var(--bg-secondary);
    border-right: 1px solid var(--border-color); overflow-y: auto;
    padding: 20px; scrollbar-width: thin;
}
.control-panel::-webkit-scrollbar { width: 5px; }
.control-panel::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 5px; }
.panel-section { margin-bottom: 24px; }
.panel-section:last-child { margin-bottom: 0; }
.panel-label {
    font-size: 0.75rem; font-weight: 600; color: var(--text-secondary);
    text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 10px; display: block;
}

.upload-zone {
    border: 2px dashed var(--border-color); border-radius: var(--radius-md);
    padding: 24px 16px; text-align: center; cursor: pointer;
    transition: all var(--transition); background: var(--bg-tertiary);
}
.upload-zone:hover, .upload-zone.dragover { border-color: var(--accent); background: var(--accent-light); }
.upload-zone__icon { width: 36px; height: 36px; color: var(--text-secondary); margin-bottom: 8px; }
.upload-zone__text { font-size: 0.85rem; color: var(--text-secondary); }
.upload-zone__link { color: var(--accent); font-weight: 600; }
.upload-security-note {
    display: flex; align-items: flex-start; gap: 6px; margin-top: 10px; padding: 10px;
    background: var(--bg-tertiary); border-radius: var(--radius-sm);
    font-size: 0.72rem; color: var(--text-secondary); line-height: 1.5;
}
.upload-security-note svg { width: 14px; height: 14px; flex-shrink: 0; margin-top: 1px; color: var(--success); }

.file-info { display: flex; align-items: center; gap: 10px; padding: 12px; background: var(--bg-tertiary); border-radius: var(--radius-sm); margin-bottom: 16px; }
.file-info__thumb { width: 40px; height: 40px; border-radius: var(--radius-sm); object-fit: cover; background: var(--border-color); }
.file-info__details { flex: 1; min-width: 0; }
.file-info__name { font-size: 0.82rem; font-weight: 500; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-info__meta { font-size: 0.72rem; color: var(--text-secondary); }
.file-info__change { background: none; border: none; color: var(--accent); font-size: 0.75rem; cursor: pointer; padding: 4px 8px; border-radius: var(--radius-sm); }
.file-info__change:hover { background: var(--accent-light); }

.sub-tabs { display: flex; gap: 2px; background: var(--bg-tertiary); border-radius: var(--radius-sm); padding: 3px; margin-bottom: 12px; }
.sub-tab { flex: 1; padding: 6px 10px; border: none; background: none; color: var(--text-secondary); font-size: 0.8rem; font-family: var(--font); cursor: pointer; border-radius: 4px; transition: all var(--transition); }
.sub-tab.active { background: var(--bg-secondary); color: var(--text-primary); box-shadow: var(--shadow-sm); }

.input-row { display: flex; gap: 10px; margin-bottom: 10px; }
.input-group { flex: 1; }
.input-group label { display: block; font-size: 0.72rem; color: var(--text-secondary); margin-bottom: 4px; }
.input-text, .input-number, .input-select {
    width: 100%; padding: 8px 10px; border: 1px solid var(--border-color);
    border-radius: var(--radius-sm); background: var(--bg-secondary); color: var(--text-primary);
    font-size: 0.85rem; font-family: var(--font); transition: all var(--transition); outline: none;
}
.input-text:focus, .input-number:focus, .input-select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.input-select {
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center; background-size: 16px; padding-right: 30px;
}

.range-row { display: flex; align-items: center; gap: 10px; }
.range-slider { flex: 1; -webkit-appearance: none; appearance: none; height: 4px; background: var(--border-color); border-radius: 2px; outline: none; }
.range-slider::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--bg-secondary); box-shadow: var(--shadow-sm); }
.range-slider::-moz-range-thumb { width: 18px; height: 18px; border-radius: 50%; background: var(--accent); cursor: pointer; border: 2px solid var(--bg-secondary); }
.range-value { min-width: 36px; text-align: center; font-size: 0.82rem; font-weight: 600; color: var(--accent); font-family: var(--font-mono); }

.checkbox-row { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 6px 0; }
.checkbox-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; }
.checkbox-row label { font-size: 0.82rem; color: var(--text-primary); cursor: pointer; }

.format-hint { font-size: 0.7rem; color: var(--text-secondary); margin-top: 4px; line-height: 1.4; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 18px; border: none; border-radius: var(--radius-sm); font-size: 0.85rem; font-family: var(--font); font-weight: 600; cursor: pointer; transition: all var(--transition); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--accent-hover); box-shadow: var(--shadow-md); }
.btn--secondary { background: var(--bg-tertiary); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn--secondary:hover:not(:disabled) { background: var(--bg-hover); }
.btn--lg { padding: 12px 28px; font-size: 0.95rem; }
.btn--full { width: 100%; }
.btn-icon { width: 16px; height: 16px; }
.btn-action { margin-top: 8px; width: 100%; padding: 11px; font-size: 0.9rem; }

.preview-area { flex: 1; display: flex; align-items: center; justify-content: center; background: var(--bg-primary); overflow: hidden; position: relative; padding: 24px; }
.preview-empty { text-align: center; color: var(--text-secondary); }
.empty-icon { width: 120px; height: 120px; color: var(--text-tertiary); margin-bottom: 16px; }
.empty-title { font-size: 1.1rem; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.empty-hint { font-size: 0.85rem; color: var(--text-secondary); margin-bottom: 20px; }
.upload-trigger { margin-bottom: 16px; }
.empty-security { display: flex; align-items: center; gap: 6px; justify-content: center; font-size: 0.72rem; color: var(--text-tertiary); max-width: 360px; margin: 0 auto; line-height: 1.5; }
.security-icon { width: 14px; height: 14px; flex-shrink: 0; }
.preview-content { width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.preview-image-wrap { max-width: 100%; max-height: 100%; display: flex; align-items: center; justify-content: center; position: relative; }
.checkerboard { background-color: #fff; background-image: linear-gradient(45deg, #d9dee7 25%, transparent 25%), linear-gradient(-45deg, #d9dee7 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #d9dee7 75%), linear-gradient(-45deg, transparent 75%, #d9dee7 75%); background-size: 20px 20px; background-position: 0 0, 0 10px, 10px -10px, -10px 0; }
.preview-image { max-width: 100%; max-height: calc(100vh - var(--topbar-h) - var(--tabs-h) - var(--downloadbar-h) - 80px); border-radius: var(--radius-sm); box-shadow: var(--shadow-md); object-fit: contain; background: inherit; }

.crop-editor {
    display: inline-block;
    overflow: hidden;
    user-select: none;
    touch-action: none;
}

.crop-editor__image {
    display: block;
    pointer-events: none;
}

.crop-box {
    position: absolute;
    border: 2px solid #fff;
    box-shadow: 0 0 0 9999px rgba(15, 23, 42, .42), 0 0 0 1px rgba(37, 99, 235, .85);
    cursor: move;
    min-width: 20px;
    min-height: 20px;
    touch-action: none;
}

.crop-box::before,
.crop-box::after {
    display: none;
}

.crop-box::after {
    display: none;
}

.crop-handle {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #2563eb;
    box-shadow: 0 1px 4px rgba(15, 23, 42, .28);
    z-index: 2;
}

.crop-handle--nw { left: -8px; top: -8px; cursor: nwse-resize; }
.crop-handle--n { left: 50%; top: -8px; transform: translateX(-50%); cursor: ns-resize; }
.crop-handle--ne { right: -8px; top: -8px; cursor: nesw-resize; }
.crop-handle--e { right: -8px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }
.crop-handle--se { right: -8px; bottom: -8px; cursor: nwse-resize; }
.crop-handle--s { left: 50%; bottom: -8px; transform: translateX(-50%); cursor: ns-resize; }
.crop-handle--sw { left: -8px; bottom: -8px; cursor: nesw-resize; }
.crop-handle--w { left: -8px; top: 50%; transform: translateY(-50%); cursor: ew-resize; }

.crop-box__label {
    position: absolute;
    right: 6px;
    top: 6px;
    padding: 5px 8px;
    border-radius: 6px;
    background: rgba(15, 23, 42, .86);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    white-space: nowrap;
}

.split-editor {
    display: inline-block;
    overflow: hidden;
}

.split-editor__image {
    display: block;
}

.split-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.split-line {
    position: absolute;
    z-index: 2;
    background: #2563eb;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .9);
}

.split-line--h {
    left: 0;
    width: 100%;
    height: 2px;
    transform: translateY(-50%);
}

.split-line--v {
    top: 0;
    width: 2px;
    height: 100%;
    transform: translateX(-50%);
}

.result-stats {
    width: min(660px, 100%);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-top: 16px;
}

.result-stat {
    min-height: 76px;
    padding: 12px 14px;
    border: 1px solid #dfe6ec;
    border-radius: 8px;
    background: #fff;
}

.result-stat__label {
    display: block;
    color: #657384;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
}

.result-stat__value {
    display: block;
    margin-top: 8px;
    color: #0f172a;
    font-size: 18px;
    line-height: 1.2;
}

.result-stat--success .result-stat__value {
    color: #059669;
}

.result-stat--warning .result-stat__value {
    color: #dc2626;
}

.comparison-container { position: relative; max-width: 100%; max-height: calc(100vh - var(--topbar-h) - var(--tabs-h) - var(--downloadbar-h) - 80px); overflow: hidden; border-radius: var(--radius-sm); box-shadow: var(--shadow-md); user-select: none; }
.comparison-before { display: block; max-width: 100%; max-height: 100%; }
.comparison-after { position: absolute; top: 0; left: 0; max-width: 100%; max-height: 100%; clip-path: inset(0 50% 0 0); }
.comparison-handle { position: absolute; top: 0; left: 50%; width: 3px; height: 100%; background: var(--accent); cursor: ew-resize; transform: translateX(-50%); }
.comparison-handle::before { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 36px; height: 36px; border-radius: 50%; background: var(--accent); box-shadow: var(--shadow-md); }
.comparison-handle::after { content: '\21C4'; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #fff; font-size: 18px; z-index: 1; }
.comparison-label { position: absolute; top: 12px; padding: 4px 10px; border-radius: var(--radius-sm); font-size: 0.72rem; font-weight: 600; color: #fff; backdrop-filter: blur(4px); z-index: 2; }
.comparison-label--before { left: 12px; background: rgba(0,0,0,0.5); }
.comparison-label--after { right: 12px; background: rgba(0,0,0,0.5); }

.download-bar { height: var(--downloadbar-h); display: flex; align-items: center; justify-content: space-between; padding: 0 24px; background: var(--bg-secondary); border-top: 1px solid var(--border-color); flex-shrink: 0; }
.download-bar__info { display: flex; gap: 20px; font-size: 0.8rem; color: var(--text-secondary); }
.download-bar__info span { display: flex; align-items: center; gap: 4px; }
.download-bar__info strong { color: var(--text-primary); font-weight: 600; }
.reduction-badge { padding: 2px 8px; border-radius: var(--radius-full); font-size: 0.72rem; font-weight: 700; background: var(--success-light); color: var(--success); }
.download-bar__actions { display: flex; gap: 10px; }

.toast-container { position: fixed; bottom: calc(var(--downloadbar-h) + 16px); right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 20px; border-radius: var(--radius-sm); background: var(--bg-secondary); box-shadow: var(--shadow-lg); border-left: 3px solid var(--accent); font-size: 0.82rem; color: var(--text-primary); display: flex; align-items: center; gap: 8px; animation: toastIn 0.3s ease; max-width: 360px; }
.toast--success { border-left-color: var(--success); }
.toast--error { border-left-color: var(--danger); }
.toast--warning { border-left-color: var(--warning); }
@keyframes toastIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
.toast.fade-out { animation: toastOut 0.3s ease forwards; }
@keyframes toastOut { to { opacity: 0; transform: translateX(20px); } }

.loading-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(2px); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 9998; }
.loading-spinner { width: 40px; height: 40px; border: 3px solid var(--border-color); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin-bottom: 12px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { color: #fff; font-size: 0.9rem; }

.batch-list { margin-top: 12px; }
.batch-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; background: var(--bg-tertiary); border-radius: var(--radius-sm); margin-bottom: 6px; font-size: 0.8rem; }
.batch-item__name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.batch-item__remove { background: none; border: none; color: var(--text-tertiary); cursor: pointer; padding: 2px; border-radius: var(--radius-sm); }
.batch-item__remove:hover { color: var(--danger); background: var(--bg-hover); }

@media (max-width: 768px) {
    .workspace { flex-direction: column; }
    .control-panel { width: 100%; height: 45vh; border-right: none; border-bottom: 1px solid var(--border-color); }
    .preview-area { padding: 12px; }
    .tool-tabs { padding: 0 8px; }
    .tool-tab { padding: 6px 10px; font-size: 0.8rem; }
    .download-bar { padding: 0 12px; }
    .download-bar__info { gap: 10px; font-size: 0.72rem; }
}

/* Public PNGDEX shell and image tools landing pages */
body.tools-landing-page,
body.tool-detail-page {
    min-height: 100vh;
    height: auto;
    overflow: auto;
    display: block;
    background: #ffffff;
    color: #202733;
}

.site-shell-header {
    position: sticky;
    top: 0;
    z-index: 200;
    background: rgba(255,255,255,0.96);
    border-bottom: 1px solid #e6edf1;
    backdrop-filter: blur(10px);
}

.site-shell-header__inner {
    width: min(calc(100% - 40px), 1180px);
    min-height: 64px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: auto minmax(260px, 420px) auto;
    align-items: center;
    gap: 24px;
}

.site-shell-header__brand {
    color: #1d8ea7;
    font-size: 1.5rem;
    font-weight: 900;
    text-decoration: none;
}

.site-shell-header__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
}

.site-shell-header__search-field {
    position: relative;
    display: flex;
    align-items: center;
}

.site-shell-header__input {
    width: 100%;
    min-height: 40px;
    padding: 0 44px 0 14px;
    border: 1px solid #d7e6f4;
    border-radius: 8px;
    color: #202733;
    font: inherit;
    outline: none;
}

.site-shell-header__input:focus {
    border-color: #1d8ea7;
    box-shadow: 0 0 0 3px rgba(29,142,167,0.14);
}

.site-shell-header__search-btn {
    position: absolute;
    right: 4px;
    width: 32px;
    height: 32px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: #6f7c8c;
    cursor: pointer;
}

.site-shell-header__search-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
}

.site-shell-header__nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
    white-space: nowrap;
}

.site-shell-header__nav a {
    color: #516070;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}

.site-shell-header__nav a:hover {
    color: #1d8ea7;
}

.tools-landing,
.tool-page {
    width: min(calc(100% - 40px), 1180px);
    margin: 0 auto;
}

.tools-breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 28px 0 16px;
    color: #7b8794;
    font-size: 0.88rem;
    font-weight: 600;
}

.tools-breadcrumb a {
    color: #7b8794;
    text-decoration: none;
}

.tools-breadcrumb a:hover {
    color: #1d8ea7;
}

.tools-hero {
    padding: 28px 24px 42px;
    text-align: center;
    background: linear-gradient(180deg, #fbffff 0%, #f2fbfd 100%);
    border: 1px solid #e5f1f4;
    border-radius: 8px;
}

.tools-hero__badge {
    display: inline-flex;
    align-items: center;
    min-height: 32px;
    padding: 0 16px;
    margin: 0 0 18px;
    border-radius: 999px;
    background: #e9f9fc;
    color: #1d8ea7;
    font-size: 0.82rem;
    font-weight: 800;
}

.tools-hero h1,
.tool-page-hero h1 {
    margin: 0;
    color: #111827;
    font-size: clamp(2rem, 4vw, 3.1rem);
    line-height: 1.12;
    letter-spacing: 0;
}

.tools-hero__intro,
.tool-page-hero p {
    max-width: 720px;
    margin: 14px auto 0;
    color: #607082;
    font-size: 1rem;
    line-height: 1.65;
}

.tools-hero__chips {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 24px;
}

.tools-hero__chips span {
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    padding: 0 16px;
    border: 1px solid #dde8ee;
    border-radius: 999px;
    background: #ffffff;
    color: #2f3a46;
    font-size: 0.9rem;
    font-weight: 700;
}

.tools-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 18px;
    margin: 36px 0 76px;
}

.tool-card {
    min-height: 220px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: 28px;
    border: 1px solid #dde6ec;
    border-radius: 8px;
    background: #ffffff;
    color: #202733;
    text-decoration: none;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04);
    transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}

.tool-card:hover,
.tool-card:focus-visible,
.tool-card--featured {
    border-color: #1d8ea7;
    box-shadow: 0 10px 28px rgba(29,142,167,0.13);
    transform: translateY(-2px);
    outline: none;
}

.tool-card__icon {
    width: 48px;
    height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: #eaf8fb;
    color: #1d8ea7;
    margin-bottom: 22px;
}

.tool-card__icon svg {
    width: 26px;
    height: 26px;
}

.tool-card__title {
    color: #202733;
    font-size: 1.22rem;
    font-weight: 800;
    line-height: 1.25;
}

.tool-card__desc {
    margin-top: 8px;
    color: #667789;
    font-size: 0.95rem;
    line-height: 1.5;
}

.tool-card__cta {
    margin-top: auto;
    padding-top: 22px;
    color: #1d8ea7;
    font-size: 0.9rem;
    font-weight: 800;
}

.tools-copy {
    max-width: 840px;
    margin: 0 auto 72px;
}

.tools-copy h2,
.tools-faq h2,
.tool-page-seo h2 {
    margin: 0 0 18px;
    color: #111827;
    font-size: 1.65rem;
    line-height: 1.25;
    letter-spacing: 0;
}

.tools-copy p,
.tools-faq p,
.tool-page-seo p {
    color: #607082;
    font-size: 1rem;
    line-height: 1.75;
}

.tools-faq {
    max-width: 900px;
    margin: 0 auto 88px;
    padding: 28px;
    border: 1px solid #e1e8ed;
    border-radius: 8px;
    background: #f7f9fb;
}

.tools-faq details {
    border: 1px solid #e3e9ee;
    border-radius: 8px;
    background: #ffffff;
    margin-top: 12px;
    overflow: hidden;
}

.tools-faq summary {
    min-height: 52px;
    display: flex;
    align-items: center;
    padding: 0 18px;
    color: #202733;
    font-weight: 800;
    cursor: pointer;
}

.tools-faq details p {
    margin: 0;
    padding: 0 18px 18px;
}

.tool-page-hero {
    padding: 0 0 24px;
    text-align: center;
}

.tool-app-shell {
    height: calc(100vh - 230px);
    min-height: 620px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid #dfe6ec;
    border-radius: 8px;
    background: var(--bg-secondary);
    box-shadow: 0 12px 34px rgba(15, 23, 42, 0.06);
}

.tool-page-seo {
    max-width: 900px;
    margin: 48px auto 72px;
    padding: 32px;
    border: 1px solid #e4eaef;
    border-radius: 8px;
    background: #ffffff;
}

.tool-page-related {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.tool-page-related a {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid #dce7ed;
    border-radius: 999px;
    color: #1d8ea7;
    font-size: 0.9rem;
    font-weight: 700;
    text-decoration: none;
}

.site-shell-footer {
    background: #eef2f4;
    border-top: 1px solid #dfe6eb;
}

.site-shell-footer__inner {
    width: min(calc(100% - 40px), 1180px);
    margin: 0 auto;
    padding: 42px 0;
    display: grid;
    grid-template-columns: minmax(220px, 1.4fr) repeat(3, minmax(140px, 1fr));
    gap: 28px;
}

.site-shell-footer h2,
.site-shell-footer h3,
.site-shell-footer p {
    margin: 0;
}

.site-shell-footer h2 {
    color: #1d8ea7;
    font-size: 1.55rem;
    font-weight: 900;
}

.site-shell-footer h3 {
    color: #202733;
    font-size: 0.9rem;
    font-weight: 800;
    text-transform: uppercase;
}

.site-shell-footer p,
.site-shell-footer a {
    color: #5f6f7f;
    font-size: 0.92rem;
    line-height: 1.6;
}

.site-shell-footer__brand p {
    margin-top: 10px;
    max-width: 320px;
}

.site-shell-footer__copy {
    color: #7d8a96;
}

.site-shell-footer__column {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.site-shell-footer__column a {
    text-decoration: none;
}

.site-shell-footer__column a:hover {
    color: #1d8ea7;
}

@media (max-width: 920px) {
    .site-shell-header__inner {
        grid-template-columns: 1fr auto;
    }
    .site-shell-header__search {
        grid-column: 1 / -1;
        order: 3;
        padding-bottom: 12px;
    }
    .site-shell-header__nav {
        gap: 12px;
        overflow-x: auto;
    }
    .tools-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .site-shell-footer__inner {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 768px) {
    .tool-app-shell {
        height: auto;
        min-height: 0;
    }
    .tool-app-shell .workspace {
        min-height: 760px;
    }
}

@media (max-width: 620px) {
    .site-shell-header__inner,
    .tools-landing,
    .tool-page,
    .site-shell-footer__inner {
        width: min(calc(100% - 28px), 1180px);
    }
    .site-shell-header__nav {
        display: none;
    }
    .tools-hero {
        padding: 24px 16px 32px;
    }
    .tools-grid {
        grid-template-columns: 1fr;
        margin-bottom: 56px;
    }
    .tool-card {
        min-height: 190px;
        padding: 22px;
    }
    .tools-faq,
    .tool-page-seo {
        padding: 20px;
    }
    .site-shell-footer__inner {
        grid-template-columns: 1fr;
    }
}

/* PNGDEX main-site shell alignment for /tools */
:root {
    --color-text-heading: #212121;
    --color-text-body: #333333;
    --color-bg-page: #ffffff;
    --color-bg-section: #f3f4f4;
    --color-bg-footer: #efefef;
    --color-border-card: #e6e6e6;
    --logo-color: #1d8ea7;
    --button-color: #1d8ea7;
    --button-text-color: #fff;
    --shell-max: 1440px;
    --shell-gutter: 32px;
    --shell-content-width: min(calc(100% - (var(--shell-gutter) * 2)), var(--shell-max));
    --topbar-offset: 56px;
    --home-search-icon: #8b97a9;
    --home-search-border: #d7e6f4;
    --home-search-shadow: 0 2px 6px rgba(18, 100, 200, .08), 0 8px 28px rgba(18, 143, 235, .13), inset 0 0 0 1.5px rgb(143 215 228 / 90%);
    --font-heading: "Oswald", ui-sans-serif, system-ui, sans-serif;
    --font-body: "Manrope", ui-sans-serif, system-ui, sans-serif;
    --font-default: "Helvetica Neue", Arial, ui-sans-serif;
}

body.tools-landing-page,
body.tool-detail-page {
    min-height: 100vh;
    height: auto;
    overflow: auto;
    display: block;
    font-family: var(--font-body);
    background: var(--color-bg-page);
    color: var(--color-text-body);
}

body.tools-landing-page main,
body.tool-detail-page main {
    padding-top: var(--topbar-offset);
    background: var(--color-bg-page);
}

.tools-hero h1,
.tool-page-hero h1,
.tools-copy h2,
.tools-faq h2,
.tool-page-seo h2,
.tool-how-to__card h3,
.tool-card__title {
    font-family: var(--font-heading);
    color: var(--color-text-heading);
    letter-spacing: 0;
}

.list-topbar {
    position: fixed;
    inset: 0 0 auto 0;
    z-index: 180;
    background: var(--color-bg-footer);
    border-bottom: 1px solid var(--color-bg-footer);
}

.list-topbar__inner {
    width: var(--shell-content-width);
    margin: 0 auto;
    padding: 10px 0;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    column-gap: 18px;
}

.list-topbar__brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--logo-color);
    text-decoration: none;
    font-family: var(--font-default);
    font-size: 30px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -1px;
    white-space: nowrap;
}

.list-topbar__search { width: 100%; }
.list-topbar__label {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    border: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

.list-topbar__search-field {
    position: relative;
    border: 1px solid transparent;
    border-radius: 4px;
    background: var(--color-bg-page);
    overflow: hidden;
    transition: border-color .18s ease, box-shadow .18s ease;
}

.list-topbar__search-field:focus-within {
    border-color: var(--home-search-border);
    box-shadow: var(--home-search-shadow);
}

.list-topbar__input {
    appearance: none;
    -webkit-appearance: none;
    width: 100%;
    height: 35px;
    padding: 0 56px 0 16px;
    border: 0;
    background: transparent;
    outline: none;
    color: var(--color-text-heading);
    font-size: 13px;
}

.list-topbar__input::placeholder { color: #8f8f8f; }
.list-topbar__input::-webkit-search-cancel-button,
.list-topbar__input::-webkit-search-decoration,
.list-topbar__input::-webkit-search-results-button,
.list-topbar__input::-webkit-search-results-decoration {
    display: none;
    -webkit-appearance: none;
}

.list-topbar__search-icon {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    border: 0;
    background: transparent;
    color: var(--home-search-icon);
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.list-topbar__search-icon svg,
.list-topbar__mobile-btn svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 2.1;
    stroke-linecap: round;
    stroke-linejoin: round;
    fill: none;
}

.list-topbar__mobile-actions,
.list-topbar__mobile-menu,
.list-topbar__mobile-menu-card,
.list-topbar__mobile-menu-link {
    display: none;
}

.tools-landing,
.tool-page {
    width: var(--shell-content-width);
    margin: 0 auto;
}

.tools-breadcrumb {
    padding: 28px 0 16px;
    font-size: 13px;
    color: #7d8895;
    font-weight: 500;
}

.tools-breadcrumb a { color: inherit; text-decoration: none; }
.tools-breadcrumb a:hover { color: var(--logo-color); }

.tools-hero {
    padding: 32px 24px 40px;
    border: 1px solid #e9eeee;
    border-radius: 8px;
    background: linear-gradient(180deg, #ffffff 0%, #f6fbfc 100%);
}

.tools-hero__badge {
    min-height: 30px;
    margin-bottom: 18px;
    background: #eaf8fb;
    color: var(--logo-color);
    font-size: 13px;
}

.tools-hero h1,
.tool-page-hero h1 {
    font-size: clamp(36px, 5vw, 56px);
    line-height: 1.05;
    font-weight: 700;
}

.tools-hero__intro,
.tool-page-hero p {
    color: #657384;
    font-size: 16px;
    line-height: 1.65;
}

.tools-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 18px;
    margin-top: 34px;
}

.tool-card {
    min-height: 212px;
    border-color: var(--color-border-card);
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(18, 38, 63, .04);
}

.tool-card__icon {
    border-radius: 8px;
    background: #eaf8fb;
    color: var(--logo-color);
}

.tool-card__title {
    font-size: 24px;
    line-height: 1.15;
    font-weight: 700;
}

.tool-card__cta { color: var(--logo-color); }

.tool-page-hero {
    padding: 0 0 24px;
    text-align: center;
}

.tool-app-shell {
    min-height: 680px;
    height: calc(100vh - 220px);
    border: 1px solid #dfe6ec;
    border-radius: 8px;
    box-shadow: 0 12px 34px rgba(15, 23, 42, .06);
}

.tool-tabs {
    height: 58px;
    padding: 0 18px;
    background: #fff;
}

.tool-tab {
    text-decoration: none;
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 14px;
}

.control-panel {
    width: 360px;
    padding: 22px;
    background: #fff;
}

.panel-label {
    color: #657384;
    font-size: 13px;
    letter-spacing: .06em;
}

.choice-select {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.choice-list {
    display: grid;
    gap: 8px;
}

.choice-option {
    width: 100%;
    min-height: 38px;
    padding: 8px 12px;
    border: 1px solid #dce7ed;
    border-radius: 8px;
    background: #fff;
    color: #344252;
    font-family: var(--font-body);
    font-size: 13px;
    font-weight: 700;
    text-align: left;
    cursor: pointer;
    transition: border-color .18s ease, background-color .18s ease, color .18s ease;
}

.choice-option:hover,
.choice-option.active {
    border-color: var(--logo-color);
    background: #eaf8fb;
    color: var(--logo-color);
}

.preview-area {
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    padding: 0;
    background: #f8fafc;
}

.preview-empty,
.preview-content {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
    padding: 24px;
}

.preview-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.preview-content {
    align-items: center;
    justify-content: center;
}

.download-bar {
    width: 100%;
    min-height: 72px;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px 22px;
    background: #fff;
    border-top: 1px solid #dfe6ec;
}

.download-bar__info {
    flex-wrap: wrap;
    color: #657384;
    line-height: 1.5;
}

.btn--download {
    min-width: 160px;
    min-height: 42px;
    border-radius: 8px;
    background: #a9b0ba;
    color: #fff;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .04em;
    cursor: not-allowed;
}

.btn--download.is-ready,
.btn--download:not(:disabled) {
    background: #2563eb;
    cursor: pointer;
}

.btn--download.is-ready:hover,
.btn--download:not(:disabled):hover {
    background: #1d4ed8;
    box-shadow: var(--shadow-md);
}

.btn--download-zip {
    min-width: 150px;
}

.tool-page-seo.tool-how-to {
    max-width: none;
    margin: 62px auto 80px;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: center;
}

.tool-page-seo h2 {
    margin: 0;
    font-size: clamp(34px, 4vw, 52px);
    line-height: 1.1;
    font-weight: 700;
}

.tool-how-to__intro {
    margin: 18px auto 34px;
    max-width: 720px;
    color: #657384;
    font-size: 18px;
    line-height: 1.6;
}

.tool-how-to__grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 26px;
    text-align: left;
}

.tool-how-to__card {
    min-height: 220px;
    padding: 30px 34px;
    border: 1px solid #dfe6ec;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 8px 24px rgba(15, 23, 42, .06);
}

.tool-how-to__step {
    display: block;
    margin-bottom: 26px;
    color: #8b97a9;
    font-size: 24px;
    line-height: 1.2;
}

.tool-how-to__card h3 {
    margin: 0 0 18px;
    font-size: 24px;
    line-height: 1.2;
    font-weight: 700;
}

.tool-how-to__card p {
    margin: 0;
    color: #657384;
    font-size: 18px;
    line-height: 1.5;
}

.tool-page-related {
    justify-content: center;
    margin-top: 34px;
}

.site-footer {
    background: var(--color-bg-footer);
    color: var(--color-text-body);
}

.site-footer__inner {
    width: var(--shell-content-width);
    margin: 0 auto;
    padding: 44px 0 56px;
}

.site-footer__layout {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.site-footer__brand { padding-right: 16px; }
.site-footer__logo {
    margin: 0;
    color: var(--logo-color);
    font-family: var(--font-default);
    font-size: 30px;
    line-height: 1;
    font-weight: 800;
    letter-spacing: -1px;
    text-transform: uppercase;
}

.site-footer__tagline {
    margin: 18px 0 0;
    color: var(--color-text-body);
    font-size: 13px;
    line-height: 1.35;
}

.site-footer__copy {
    margin: 14px 0 0;
    color: var(--color-text-body);
    font-size: 13px;
    line-height: 1.25;
}

.site-footer__heading {
    margin: 0 0 18px;
    color: var(--color-text-heading);
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1;
    font-weight: 700;
    letter-spacing: .5px;
    text-transform: uppercase;
}

.site-footer__links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 10px;
}

.site-footer__links a {
    color: var(--color-text-body);
    font-size: 13px;
    line-height: 1.4;
    text-decoration: none;
}

.site-footer__links a:hover { text-decoration: underline; }

.back-to-top {
    position: fixed;
    right: 6px;
    bottom: 56px;
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 8px;
    background: rgba(113, 113, 113, .8);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transform: translateY(8px);
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
    transition: opacity .2s ease, transform .2s ease, visibility .2s ease, background-color .2s ease;
    z-index: 60;
}

.back-to-top.back-to-top--visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
    transform: translateY(0);
}

.back-to-top:hover { background: var(--logo-color); }
.back-to-top__icon {
    width: 22px;
    height: 22px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
}

@media (max-width: 1100px) {
    :root { --shell-gutter: 24px; }
    .list-topbar__inner { padding: 8px 0; }
    .tools-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .tool-how-to__grid { gap: 18px; }
}

@media (max-width: 768px) {
    :root {
        --shell-gutter: 18px;
        --topbar-offset: 62px;
    }
    .list-topbar__inner {
        grid-template-columns: minmax(0, 1fr) auto;
        padding: 10px 0;
    }
    .list-topbar__brand { font-size: 28px; }
    .list-topbar__search { display: none; }
    .list-topbar__mobile-actions {
        display: inline-flex;
        align-items: center;
        gap: 8px;
    }
    .list-topbar__mobile-btn {
        width: 36px;
        height: 36px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        border: 0;
        border-radius: 8px;
        background: #fff;
        color: var(--home-search-icon);
    }
    .list-topbar__mobile-btn-icon-close { display: none; }
    .list-topbar.is-search-open .list-topbar__brand,
    .list-topbar.is-search-open .list-topbar__mobile-menu-btn { display: none; }
    .list-topbar.is-search-open .list-topbar__search { display: block; }
    .list-topbar.is-search-open .list-topbar__mobile-btn-icon-search { display: none; }
    .list-topbar.is-search-open .list-topbar__mobile-btn-icon-close { display: block; }
    .list-topbar__mobile-menu:not([hidden]) {
        display: block;
        width: var(--shell-content-width);
        margin: 0 auto 10px;
    }
    .list-topbar__mobile-menu-card {
        display: grid;
        gap: 6px;
        padding: 10px;
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 10px 26px rgba(15, 23, 42, .1);
    }
    .list-topbar__mobile-menu-link {
        display: block;
        padding: 10px 12px;
        border-radius: 6px;
        color: var(--color-text-body);
        text-decoration: none;
        font-size: 14px;
    }
    .tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tool-app-shell { height: auto; min-height: 0; }
    .tool-app-shell .workspace { min-height: 760px; }
    .tool-how-to__grid { grid-template-columns: 1fr; }
    .site-footer__inner { padding: 38px 0 46px; }
    .site-footer__layout {
        grid-template-columns: 1fr 1fr;
        gap: 28px 20px;
    }
    .site-footer__brand {
        grid-column: 1 / -1;
        padding-right: 0;
    }
}

@media (max-width: 480px) {
    :root { --shell-gutter: 14px; }
    .list-topbar__brand { font-size: 26px; }
    .tools-grid { grid-template-columns: 1fr; }
    .tool-card { min-height: 190px; padding: 22px; }
    .download-bar {
        align-items: stretch;
        flex-direction: column;
    }
    .download-bar__actions,
    .btn--download { width: 100%; }
    .site-footer__inner { padding: 32px 0 40px; }
    .site-footer__layout {
        grid-template-columns: 1fr;
        gap: 24px;
    }
}

/* Center standalone download action. */
.download-bar {
    justify-content: center;
}

.download-bar__info {
    display: none;
}

.download-bar__actions {
    width: 100%;
    justify-content: center;
}

.btn--download {
    width: min(660px, 100%);
    max-width: 100%;
}

.btn--download-zip {
    width: min(320px, 100%);
}
/* Restore original tool control panel behavior; only remove left-panel internal scrolling. */
.tool-app-shell {
    height: auto;
    min-height: 680px;
    overflow: visible;
}

.tool-app-shell .workspace,
.workspace {
    overflow: visible;
    align-items: stretch;
}

.control-panel {
    width: 340px;
    padding: 20px;
    overflow: visible;
    scrollbar-width: auto;
}

.control-panel::-webkit-scrollbar,
.control-panel::-webkit-scrollbar-thumb {
    display: none;
}

.panel-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 10px;
}

.input-group label {
    font-size: 0.72rem;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.input-text,
.input-number,
.input-select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    background-color: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: var(--font);
    line-height: normal;
}

.input-select {
    position: static;
    height: auto;
    opacity: 1;
    pointer-events: auto;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c757d' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    background-size: 16px;
    padding-right: 30px;
}

.choice-list,
.choice-option {
    display: none;
}

/* Compact result presentation for tool workspace. */
.preview-content {
    gap: 10px;
}

.preview-content--has-result {
    justify-content: center;
}

.preview-content--has-result .preview-image,
.preview-content--has-result .comparison-container {
    max-height: calc(100vh - var(--topbar-h) - var(--tabs-h) - var(--downloadbar-h) - 48px);
}

.result-summary {
    width: min(760px, 100%);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 7px 18px;
    margin-top: 2px;
    color: #334155;
    font-size: 14px;
    line-height: 1.35;
}

.result-summary__item {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    min-width: 92px;
}

.result-summary__label {
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

.result-summary__value {
    color: #0f172a;
    font-size: 15px;
    font-weight: 400;
}

.result-summary__item--success .result-summary__value {
    color: #059669;
}

.result-summary__item--warning .result-summary__value {
    color: #dc2626;
}

.split-result-grid {
    width: min(760px, 100%);
    max-height: calc(100vh - var(--topbar-h) - var(--tabs-h) - var(--downloadbar-h) - 92px);
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 8px;
    overflow: auto;
    padding: 4px;
}

.split-result-tile {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 92px;
    border: 1px solid #dfe6ec;
    border-radius: 6px;
    overflow: hidden;
}

.split-result-tile img {
    max-width: 100%;
    max-height: 160px;
    object-fit: contain;
}

.comparison-container {
    max-height: calc(100vh - var(--topbar-h) - var(--tabs-h) - var(--downloadbar-h) - 48px);
}

.comparison-before {
    width: auto;
    max-width: 100%;
    max-height: calc(100vh - var(--topbar-h) - var(--tabs-h) - var(--downloadbar-h) - 48px);
}

.comparison-after {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.comparison-label {
    max-width: calc(50% - 44px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 4px 8px;
    font-size: 11px;
}

@media (max-width: 768px) {
    .preview-content {
        padding: 14px;
    }

    .preview-content--has-result .preview-image,
    .preview-content--has-result .comparison-container,
    .comparison-before {
        max-height: calc(100vh - var(--topbar-h) - var(--tabs-h) - var(--downloadbar-h) - 118px);
    }

    .comparison-label {
        max-width: calc(50% - 32px);
        padding: 3px 6px;
        font-size: 10px;
    }

    .result-summary {
        gap: 5px 12px;
        font-size: 13px;
    }

    .result-summary__item {
        min-width: 78px;
    }
}

@media (max-width: 768px) {
    .control-panel {
        width: 100%;
        height: auto;
        max-height: none;
        overflow: visible;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }

    .tool-app-shell .workspace {
        min-height: 0;
    }
}

/* Final tool workspace sizing pass */
.tool-page-hero {
    padding: 0 0 14px;
}

.tool-page-hero .tools-breadcrumb {
    padding: 18px 0 8px;
}

.tool-page-hero h1 {
    font-size: clamp(34px, 4vw, 52px);
    line-height: 1.05;
    margin: 0 0 10px;
}

.tool-page-hero p {
    margin: 0 auto;
    font-size: 16px;
    line-height: 1.45;
}

.tool-app-shell {
    height: calc(100vh - 160px);
    min-height: 760px;
}

.tool-app-shell .workspace {
    min-height: 700px;
}

.preview-content {
    padding: 14px 18px;
}

.preview-content--has-result {
    gap: 8px;
}

.preview-image,
.crop-editor,
.split-editor,
.comparison-container {
    max-height: calc(100vh - 240px);
}

.preview-image {
    max-height: calc(100vh - 240px);
}

.comparison-container {
    max-height: calc(100vh - 240px);
}

.crop-editor__image,
.split-editor__image {
    max-height: calc(100vh - 240px);
}

.preview-image-wrap {
    max-height: calc(100vh - 240px);
}

.split-result-grid {
    max-height: calc(100vh - 275px);
}

.split-result-tile img {
    max-height: 220px;
}

.result-summary {
    margin-top: 0;
}

@media (max-width: 768px) {
    .tool-page-hero {
        padding-bottom: 10px;
    }

    .tool-page-hero .tools-breadcrumb {
        padding: 12px 0 8px;
    }

    .tool-page-hero h1 {
        font-size: clamp(30px, 9vw, 42px);
    }

    .tool-app-shell {
        height: auto;
        min-height: 0;
    }

    .tool-app-shell .workspace {
        min-height: 0;
    }

    .preview-image,
    .crop-editor,
    .split-editor,
    .comparison-container,
    .crop-editor__image,
    .split-editor__image,
    .preview-image-wrap {
        max-height: calc(100vh - 300px);
    }
}

/* Panel-relative preview sizing */
.preview-content {
    height: auto;
    flex: 1 1 0;
    min-height: 0;
    overflow: hidden;
}

.preview-stage {
    width: 100%;
    flex: 1 1 0;
    min-width: 0;
    min-height: 0;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-stage > .preview-image-wrap,
.preview-stage > .crop-editor,
.preview-stage > .split-editor,
.preview-stage > .comparison-container {
    flex: 0 0 auto;
    max-width: none;
    max-height: none;
}

.preview-stage .preview-image,
.preview-stage .crop-editor__image,
.preview-stage .split-editor__image,
.preview-stage .comparison-before,
.preview-stage .comparison-after {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: contain;
}

.preview-stage .comparison-container {
    position: relative;
    overflow: hidden;
}

.preview-content--has-result .result-summary {
    flex: 0 0 auto;
}

.preview-stage .split-result-grid {
    max-height: 100%;
}

.preview-stage__loading {
    position: absolute;
    inset: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.preview-stage__loading[hidden] {
    display: none;
}

.preview-stage__spinner {
    width: 30px;
    height: 30px;
    border: 3px solid #d8e0e8;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}

.preview-frame--loading {
    visibility: hidden;
    opacity: 0;
}

.preview-frame--ready {
    visibility: visible;
    opacity: 1;
}

/* Left settings remain fully visible; tallest panel determines workspace height. */
.tool-app-shell {
    height: auto;
    min-height: 760px;
    overflow: visible;
}

.tool-app-shell .workspace {
    min-height: 700px;
    overflow: visible;
    align-items: stretch;
}

@media (max-width: 768px) {
    .tool-app-shell {
        min-height: 0;
    }

    .tool-app-shell .workspace {
        min-height: 0;
    }

    .preview-area {
        min-height: 560px;
    }

    .preview-content {
        min-height: 480px;
    }
}

/* Child tool content outside the functional workspace. */
.tool-detail-page .tool-page-hero {
    padding: 0 0 16px;
}

.tool-detail-page .tool-page-hero .tools-breadcrumb {
    padding: 16px 0 10px;
    font-family: var(--font-body);
    font-size: 14px;
    font-weight: 400;
}

.tool-detail-page .tool-page-hero h1 {
    margin: 0 0 8px;
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
}

.tool-detail-page .tool-page-hero > p {
    max-width: 720px;
    margin: 0 auto;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
}

.tool-detail-page .tool-page-seo.tool-how-to {
    max-width: none;
    margin: 56px auto 0;
    padding: 44px 0 52px;
    border: 0;
    border-radius: 0;
    background: #f3f4f4;
    box-shadow: 0 0 0 100vmax #f3f4f4;
    clip-path: inset(0 -100vmax);
    text-align: center;
}

.tool-detail-page .tool-how-to h2 {
    margin: 0;
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 700;
    line-height: 1.2;
    letter-spacing: 0;
}

.tool-detail-page .tool-how-to__intro {
    max-width: 720px;
    margin: 10px auto 24px;
    color: #657384;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.5;
}

.tool-detail-page .tool-how-to__grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 20px;
}

.tool-detail-page .tool-how-to__card {
    min-height: 190px;
    padding: 26px 30px;
    border: 1px solid #d9dee3;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 5px 14px rgba(15, 23, 42, .05);
}

.tool-detail-page .tool-how-to__step {
    margin-bottom: 16px;
    color: #8b929b;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.4;
}

.tool-detail-page .tool-how-to__card h3 {
    margin: 0 0 12px;
    font-family: var(--font-heading);
    font-size: 20px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0;
}

.tool-detail-page .tool-how-to__card p {
    margin: 0;
    color: #657384;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.55;
}

.tool-detail-page .tool-page-related {
    justify-content: center;
    gap: 12px;
    margin-top: 28px;
}

.tool-detail-page .tool-page-related a {
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid #d5dadd;
    border-radius: 7px;
    background: #fff;
    color: #20242a;
    font-family: var(--font-body);
    font-size: 16px;
    font-weight: 400;
    line-height: 1.4;
    transition: border-color .18s ease, color .18s ease, background-color .18s ease;
}

.tool-detail-page .tool-page-related a:hover,
.tool-detail-page .tool-page-related a:focus-visible {
    border-color: var(--logo-color);
    background: #eef9fb;
    color: var(--logo-color);
}

@media (max-width: 768px) {
    .tool-detail-page .tool-page-hero {
        padding-bottom: 14px;
    }

    .tool-detail-page .tool-page-hero h1 {
        font-size: 24px;
    }

    .tool-detail-page .tool-page-seo.tool-how-to {
        margin-top: 40px;
        padding: 36px 0 42px;
    }

    .tool-detail-page .tool-how-to h2 {
        font-size: 28px;
    }

    .tool-detail-page .tool-how-to__grid {
        grid-template-columns: 1fr;
        gap: 14px;
    }

    .tool-detail-page .tool-how-to__card {
        min-height: 0;
        padding: 22px;
    }
}
