/* ImageTools - Design System (matches imagecomp) */
:root {
    --radius: 0.625rem;
    --background: oklch(1 0 0);
    --foreground: oklch(0.141 0.005 285.823);
    --card: oklch(1 0 0);
    --card-foreground: oklch(0.141 0.005 285.823);
    --popover: oklch(1 0 0);
    --popover-foreground: oklch(0.141 0.005 285.823);
    --primary: oklch(0.21 0.006 285.885);
    --primary-foreground: oklch(0.985 0 0);
    --secondary: oklch(0.967 0.001 286.375);
    --secondary-foreground: oklch(0.21 0.006 285.885);
    --muted: oklch(0.967 0.001 286.375);
    --muted-foreground: oklch(0.552 0.016 285.938);
    --accent: oklch(0.967 0.001 286.375);
    --accent-foreground: oklch(0.21 0.006 285.885);
    --destructive: oklch(0.637 0.237 25.331);
    --destructive-foreground: oklch(0.637 0.237 25.331);
    --border: oklch(0.92 0.004 286.32);
    --input: oklch(0.871 0.006 286.286);
    --ring: oklch(0.871 0.006 286.286);
    --success: oklch(0.723 0.191 142.542);
    --success-foreground: oklch(0.985 0 0);
}

.dark {
    --background: oklch(0.141 0.005 285.823);
    --foreground: oklch(0.985 0 0);
    --card: oklch(0.141 0.005 285.823);
    --card-foreground: oklch(0.985 0 0);
    --popover: oklch(0.141 0.005 285.823);
    --popover-foreground: oklch(0.985 0 0);
    --primary: oklch(0.985 0 0);
    --primary-foreground: oklch(0.21 0.006 285.885);
    --secondary: oklch(0.274 0.006 286.033);
    --secondary-foreground: oklch(0.985 0 0);
    --muted: oklch(0.21 0.006 285.885);
    --muted-foreground: oklch(0.65 0.01 286);
    --accent: oklch(0.21 0.006 285.885);
    --accent-foreground: oklch(0.985 0 0);
    --destructive: oklch(0.396 0.141 25.723);
    --destructive-foreground: oklch(0.637 0.237 25.331);
    --border: oklch(0.274 0.006 286.033);
    --input: oklch(0.274 0.006 286.033);
    --ring: oklch(0.442 0.017 285.786);
}

/* Reset & Base */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--background);
    color: var(--foreground);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Container */
.container {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    letter-spacing: -0.025em;
}

h1 { font-size: clamp(1.875rem, 4vw, 2.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 1.875rem); }
h3 { font-size: 1.125rem; }

p {
    color: var(--muted-foreground);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    white-space: nowrap;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    height: 2.25rem;
    padding: 0 1rem;
    border-radius: calc(var(--radius) - 2px);
    border: 1px solid transparent;
    cursor: pointer;
    outline: none;
    transition: color 0.15s, box-shadow 0.15s, background-color 0.15s;
    text-decoration: none;
}

.btn:focus-visible {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 50%, transparent);
}

.btn:disabled {
    pointer-events: none;
    opacity: 0.5;
}

.btn svg {
    width: 1rem;
    height: 1rem;
    pointer-events: none;
    flex-shrink: 0;
}

.btn-primary {
    background-color: var(--primary);
    color: var(--primary-foreground);
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.btn-primary:hover {
    background-color: color-mix(in oklch, var(--primary) 90%, transparent);
}

.btn-outline {
    background: var(--background);
    color: var(--foreground);
    border-color: var(--input);
    box-shadow: 0 1px 2px 0 rgb(0 0 0 / 0.05);
}

.btn-outline:hover {
    background-color: var(--accent);
    color: var(--accent-foreground);
}

.btn-ghost {
    background: transparent;
    color: var(--foreground);
}

.btn-ghost:hover {
    background-color: var(--accent);
    color: var(--accent-foreground);
}

.btn-lg {
    height: 2.5rem;
    padding: 0 2rem;
}

.btn-sm {
    height: 2rem;
    padding: 0 0.75rem;
    font-size: 0.75rem;
}

.btn-block {
    width: 100%;
}

/* Badge */
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
    white-space: nowrap;
    padding: 0 0.375rem;
    font-size: 0.75rem;
    font-weight: 500;
    line-height: 1.25rem;
    border-radius: 9999px;
    border: 1px solid transparent;
}

.badge-secondary {
    background-color: var(--secondary);
    color: var(--secondary-foreground);
}

/* Navbar */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    background: color-mix(in oklch, var(--background) 80%, transparent);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
}

.navbar-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 3.5rem;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground);
    text-decoration: none;
}

.logo svg {
    width: 1.25rem;
    height: 1.25rem;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    list-style: none;
}

.nav-links a {
    display: inline-flex;
    align-items: center;
    height: 2rem;
    padding: 0 0.75rem;
    color: var(--muted-foreground);
    text-decoration: none;
    font-size: 0.875rem;
    font-weight: 500;
    border-radius: calc(var(--radius) - 2px);
    transition: color 0.15s, background-color 0.15s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--foreground);
    background-color: var(--accent);
}

/* ---- Nav chevron ---- */
.nav-chevron {
    margin-left: 3px;
    flex-shrink: 0;
    transition: transform 0.2s;
    color: var(--muted-foreground);
    vertical-align: middle;
}
.nav-dropdown:hover > a .nav-chevron {
    transform: rotate(180deg);
}

/* ---- Dropdown container ---- */
.nav-dropdown {
    position: relative;
}

/* ---- Base dropdown menu (hidden) ---- */
.nav-dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    box-shadow: 0 8px 24px -4px rgba(0,0,0,0.12), 0 2px 8px rgba(0,0,0,0.06);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    margin-top: -4px;
    transition: opacity 0.15s, visibility 0.15s, margin-top 0.15s;
    z-index: 200;
}
/* Bridge gap so menu stays open when moving cursor down */
.nav-dropdown-menu::before {
    content: '';
    position: absolute;
    top: -8px;
    left: 0;
    right: 0;
    height: 8px;
}
.nav-dropdown:hover > .nav-dropdown-menu {
    opacity: 1;
    visibility: visible;
    pointer-events: all;
    margin-top: 0;
}

/* ---- Simple dropdown menu ---- */
.nav-simple-menu {
    width: 210px;
    padding: 0.375rem;
    left: 50%;
    transform: translateX(-50%);
}
.nav-simple-menu-right {
    left: auto;
    right: 0;
    transform: none;
}
/* Language switcher */
.nav-lang-menu {
    width: 165px;
    left: auto;
    right: 0;
    transform: none;
    max-height: 320px;
    overflow-y: auto;
}
.nav-lang-menu a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.nav-lang-active {
    color: var(--foreground) !important;
    font-weight: 600 !important;
}
.nav-lang-trigger {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.nav-lang-code {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}
.nav-simple-menu a {
    display: block;
    padding: 0.4375rem 0.75rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.12s, color 0.12s;
}
.nav-simple-menu a:hover {
    background: var(--accent);
    color: var(--foreground);
}
.nav-simple-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted-foreground);
    padding: 0.5rem 0.75rem 0.2rem;
    opacity: 0.65;
    margin: 0;
}
.nav-simple-divider {
    height: 1px;
    background: var(--border);
    margin: 0.375rem 0.375rem;
}

/* Two-column grid for resize presets */
.nav-simple-menu-2col {
    width: 280px;
}
.nav-2col-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 0 0.25rem;
}
.nav-2col-grid a {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-decoration: none;
    padding: 0.375rem 0.5rem;
    border-radius: calc(var(--radius) - 2px);
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}
.nav-2col-grid a:hover {
    background: var(--accent);
    color: var(--foreground);
}

/* Footer "View all" row */
.nav-dropdown-footer {
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
    padding: 0.375rem 0.25rem 0.25rem;
}
.nav-dropdown-footer a {
    display: block;
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    border-radius: calc(var(--radius) - 2px);
    transition: background 0.12s;
}
.nav-dropdown-footer a:hover {
    background: color-mix(in oklch, var(--primary) 8%, var(--card));
}

/* ---- Mega menu (Convert) ---- */
.nav-mega-menu {
    width: 520px;
    left: 0;
    transform: none;
    padding: 1rem 0.75rem 0.75rem;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.25rem 0.75rem;
}
.nav-mega-col {
    display: flex;
    flex-direction: column;
    gap: 1px;
}
.nav-mega-heading {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted-foreground);
    margin: 0 0 0.25rem;
    padding: 0 0.375rem;
    opacity: 0.65;
}
.nav-mega-col a {
    padding: 0.3125rem 0.375rem;
    border-radius: calc(var(--radius) - 2px);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-decoration: none;
    transition: background 0.12s, color 0.12s;
    white-space: nowrap;
}
.nav-mega-col a:hover {
    background: var(--accent);
    color: var(--foreground);
}
.nav-mega-footer {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border);
    padding-top: 0.5rem;
    margin-top: 0.375rem;
}
.nav-mega-footer a {
    display: inline-block;
    padding: 0.375rem 0.5rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    border-radius: calc(var(--radius) - 2px);
    transition: background 0.12s;
}
.nav-mega-footer a:hover {
    background: color-mix(in oklch, var(--primary) 8%, var(--card));
}

/* ---- Hide dropdowns on mobile ---- */
@media (max-width: 768px) {
    .nav-chevron { display: none; }
    .nav-dropdown-menu { display: none !important; }
    .nav-dropdown.open > .nav-lang-menu {
        display: flex !important;
        flex-direction: column;
        position: static;
        box-shadow: none;
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 0.25rem;
        margin-top: 0.25rem;
        width: 100%;
        max-height: 260px;
        overflow-y: auto;
        opacity: 1;
        pointer-events: auto;
        transform: none;
    }
    .nav-lang-trigger .nav-chevron {
        display: inline-block !important;
        transition: transform 0.2s;
    }
    .nav-dropdown.open .nav-lang-trigger .nav-chevron {
        transform: rotate(180deg);
    }
}

.nav-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    color: var(--foreground);
    border-radius: calc(var(--radius) - 2px);
}

.mobile-menu-btn:hover {
    background-color: var(--accent);
}

/* Hidden on desktop, shown as drawer header on mobile */
.nav-drawer-header {
    display: none;
}

.theme-toggle {
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted-foreground);
    border-radius: calc(var(--radius) - 2px);
    transition: background-color 0.15s, color 0.15s;
}

.theme-toggle:hover {
    background-color: var(--accent);
    color: var(--foreground);
}

/* Hero Section */
.hero {
    padding: 7rem 0 0;
}

.hero-home {
    padding: 7rem 0 2rem;
}

.hero-content {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.hero-content .badge {
    margin-bottom: 1rem;
}

.hero-content h1 {
    margin-bottom: 1rem;
    color: var(--foreground);
}

.hero-description {
    font-size: 1rem;
    color: var(--muted-foreground);
    max-width: 480px;
    margin: 0 auto 1.75rem;
    line-height: 1.6;
}

.hero-search {
    position: relative;
    max-width: 520px;
    margin: 0 auto;
}

.search-bar {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    background: var(--card);
    border: 1.5px solid var(--border);
    border-radius: calc(var(--radius) + 6px);
    padding: 0.625rem 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.search-bar:focus-within {
    border-color: var(--ring);
    box-shadow: 0 0 0 3px oklch(from var(--primary) l c h / 0.12);
}

.search-icon {
    width: 1rem;
    height: 1rem;
    color: var(--muted-foreground);
    flex-shrink: 0;
}

.search-bar input {
    flex: 1;
    border: none;
    background: none;
    font-size: 0.9375rem;
    color: var(--foreground);
    outline: none;
    min-width: 0;
}

.search-bar input::placeholder {
    color: var(--muted-foreground);
}

.search-clear {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.125rem;
    color: var(--muted-foreground);
    display: flex;
    align-items: center;
    border-radius: 50%;
    transition: color 0.15s;
}

.search-clear:hover {
    color: var(--foreground);
}

.search-clear svg {
    width: 0.875rem;
    height: 0.875rem;
}

.search-results {
    position: absolute;
    top: calc(100% + 0.5rem);
    left: 0;
    right: 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    box-shadow: 0 8px 24px -4px rgba(0,0,0,0.12);
    z-index: 100;
    overflow: hidden;
    display: none;
}

.hero-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.875rem;
}

.hero-preset-chip {
    display: inline-block;
    padding: 0.3rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted-foreground);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 999px;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    white-space: nowrap;
}

.hero-preset-chip:hover {
    background: var(--accent);
    color: var(--foreground);
    border-color: var(--ring);
}

.hero-preset-chip.active {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.search-results.open {
    display: block;
}

.search-result-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 1rem;
    text-decoration: none;
    color: var(--foreground);
    font-size: 0.875rem;
    transition: background 0.1s;
}

.search-result-item:hover,
.search-result-item.active {
    background: var(--accent);
}

.search-result-item svg {
    width: 0.875rem;
    height: 0.875rem;
    color: var(--muted-foreground);
    flex-shrink: 0;
}

.search-result-empty {
    padding: 0.875rem 1rem;
    font-size: 0.875rem;
    color: var(--muted-foreground);
    text-align: center;
}

.hero-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Section Styles */
.section {
    padding: 4rem 0;
}

.section-alt {
    background: var(--muted);
}

.section-header {
    text-align: center;
    max-width: 500px;
    margin: 0 auto 2.5rem;
}

.section-header h2 {
    margin-bottom: 0.75rem;
    color: var(--foreground);
}

.section-header p {
    font-size: 0.9375rem;
}

/* ========================================
   Tool Category Cards (Homepage)
   ======================================== */
.tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.25rem;
}

.tool-card {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    text-decoration: none;
    color: var(--foreground);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
    position: relative;
    overflow: hidden;
}

.tool-card-icon {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    color: var(--primary-foreground);
}

.tool-card-icon .tool-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.tool-card-body h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.tool-card-body p {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    line-height: 1.6;
    margin-bottom: 0.75rem;
}

.tool-card-arrow {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    color: var(--muted-foreground);
}

.tool-card-arrow svg {
    width: 1.25rem;
    height: 1.25rem;
}

/* ========================================
   Quick Tool Cards (Convert)
   ======================================== */
.quick-tools-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 1.25rem;
}

.quick-tool-card {
    display: flex;
    flex-direction: column;
    padding: 1.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    text-decoration: none;
    color: var(--foreground);
    position: relative;
    overflow: hidden;
}

.quick-tool-card .tool-card-body h3 {
    font-size: 0.9375rem;
    margin-bottom: 0;
}

/* ========================================
   Converter Hub Page
   ======================================== */
.converter-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 0.75rem;
    max-width: 900px;
    margin: 0 auto;
}

.converter-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.25rem 0.75rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    text-decoration: none;
    color: var(--foreground);
    transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}

.converter-card:hover {
    border-color: var(--ring);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
}

.converter-card-formats {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.converter-card-from,
.converter-card-to {
    font-size: 0.875rem;
    font-weight: 700;
    padding: 0.25rem 0.625rem;
    border-radius: calc(var(--radius) - 2px);
}

.converter-card-from {
    background: var(--muted);
    color: var(--foreground);
}

.converter-card-to {
    background: var(--primary);
    color: var(--primary-foreground);
}

.converter-card-arrow {
    width: 0.875rem;
    height: 0.875rem;
    color: var(--muted-foreground);
}

.converter-card p {
    font-size: 0.6875rem;
    color: var(--muted-foreground);
    text-align: center;
}

/* ========================================
   Converter Tool Page
   ======================================== */
.compressor-section {
    padding: 0 0 4rem;
}

.compressor-wrapper {
    max-width: 800px;
    margin: 0 auto;
}

/* Upload Area */
.upload-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    min-height: 8rem;
    padding: 0 2rem 1rem;
    transition: opacity 0.25s ease, transform 0.25s ease;
    transform-origin: top center;
}
.upload-area.anim-hide {
    animation: compUploadHide 0.28s ease forwards;
}
.upload-area.anim-show {
    animation: compUploadShow 0.32s ease forwards;
}
@keyframes compUploadHide {
    0%   { opacity: 1; transform: scale(1) translateY(0); }
    100% { opacity: 0; transform: scale(0.95) translateY(-8px); }
}
@keyframes compUploadShow {
    0%   { opacity: 0; transform: scale(0.95) translateY(-8px); }
    100% { opacity: 1; transform: scale(1) translateY(0); }
}

#addFilesArea {
    width: 100%;
}

.btn-add-files {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    width: 100%;
    padding: 1rem 2rem;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: 0.07em;
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: opacity 0.15s;
}

.btn-add-files:hover {
    opacity: 0.88;
}

.add-files-plus {
    font-size: 1.7rem;
    font-weight: 300;
    line-height: 1;
}

.upload-hint {
    color: var(--muted-foreground);
    font-size: 0.875rem;
}

/* Page-wide drag-and-drop overlay */
.page-drop-overlay {
    position: fixed;
    inset: 0;
    z-index: 9997;
    pointer-events: none;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.15s;
}
.page-drop-overlay.active {
    opacity: 1;
    background: rgba(0, 0, 0, 0.04);
}
.page-drop-overlay-inner {
    background: var(--background);
    border: 2px dashed var(--primary);
    border-radius: var(--radius);
    padding: 1.25rem 2.5rem;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary);
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.14);
    display: flex;
    align-items: center;
    gap: 0.75rem;
    pointer-events: none;
}

/* Preview Area */
.preview-area {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 14rem;
    padding: 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    overflow: hidden;
}

.preview-image-wrap {
    position: relative;
    display: inline-block;
    max-width: 100%;
    max-height: 100%;
}

.preview-image {
    max-width: 100%;
    max-height: 12rem;
    border-radius: var(--radius);
    object-fit: contain;
}

.preview-remove {
    position: absolute;
    top: -0.5rem;
    right: -0.5rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--destructive);
    color: white;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s, background-color 0.15s;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.preview-remove:hover {
    transform: scale(1.1);
    background: color-mix(in oklch, var(--destructive) 80%, black);
}

.preview-remove svg {
    width: 1rem;
    height: 1rem;
}

.preview-size {
    position: absolute;
    bottom: 0.5rem;
    left: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: calc(var(--radius) - 2px);
}

/* Settings Card */
.settings-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.settings-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.settings-label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

.settings-row {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.settings-hint {
    font-size: 0.75rem;
    color: var(--muted-foreground);
}

/* Format button grid */
.cv-format-section {
    display: flex;
    align-items: flex-start;
    gap: 1.25rem;
    margin-bottom: 0.75rem;
}

.cv-format-label {
    font-size: 0.9375rem;
    font-weight: 700;
    color: var(--foreground);
    white-space: nowrap;
    padding-top: 0.45rem;
    min-width: 85px;
}

.cv-format-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.375rem;
    flex: 1;
}

.cv-format-btn {
    padding: 0.4rem 0.3rem;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    background: var(--muted);
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    text-align: center;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    white-space: nowrap;
}

.cv-format-btn:hover:not(.active) {
    background: var(--accent);
}

.cv-format-btn.active {
    background: var(--primary);
    color: var(--primary-foreground);
    border-color: var(--primary);
}

.cv-format-btn.active::before {
    content: "\2713\00a0";
}

@media (max-width: 768px) {
    .cv-format-section {
        flex-direction: column;
        gap: 0.5rem;
    }
    .cv-format-label {
        padding-top: 0;
    }
    .cv-format-grid {
        grid-template-columns: repeat(4, 1fr);
        width: 100%;
    }
}

@media (max-width: 640px) {
    .compressor-wrapper .settings-card {
        padding: 1rem;
    }
    .cv-format-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.3rem;
    }
    .cv-format-btn {
        font-size: 0.8125rem;
        padding: 0.5rem 0.25rem;
    }
}

/* Target fixed badge (for specific converter pages) */
.convert-info-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

.convert-info-badge strong {
    color: var(--foreground);
    font-weight: 600;
}

.settings-group-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    text-align: center;
}

.settings-row-centered {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
}

.settings-row-centered .btn {
    width: 100%;
    max-width: 260px;
}

/* ========================================
   Image Compressor Page
   ======================================== */

/* Toolbar */
.comp-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
    animation: compSlideDown 0.3s ease both;
}
@keyframes compSlideDown {
    0%   { opacity: 0; transform: translateY(-12px); }
    100% { opacity: 1; transform: translateY(0); }
}

.comp-toolbar-left,
.comp-toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* Shared button base */
.comp-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.5rem 1rem;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    border-radius: 50px;
    cursor: pointer;
    border: 1.5px solid transparent;
    transition: opacity 0.15s, background 0.15s;
}

.comp-btn svg { width: 15px; height: 15px; }

.comp-btn-primary {
    background: var(--primary);
    color: var(--primary-foreground);
}
.comp-btn-primary:hover { opacity: 0.88; }

.comp-btn-danger {
    background: transparent;
    color: var(--destructive);
    border-color: var(--destructive);
}
.comp-btn-danger:hover { background: color-mix(in oklch, var(--destructive) 10%, transparent); }

.comp-btn-outline {
    background: transparent;
    color: var(--foreground);
    border-color: var(--border);
}
.comp-btn-outline:hover { background: var(--muted); }

.comp-btn-secondary {
    background: var(--secondary);
    color: var(--secondary-foreground);
    border-color: var(--border);
}
.comp-btn-secondary:hover { opacity: 0.88; }

.comp-btn-icon {
    padding: 0.5rem;
    background: transparent;
    color: var(--muted-foreground);
    border: 1.5px solid var(--border);
    border-radius: var(--radius);
}
.comp-btn-icon:hover { background: var(--muted); color: var(--foreground); }

.comp-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Settings backdrop */
.comp-settings-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 199;
    background: rgba(0,0,0,0.25);
}
.comp-settings-backdrop.active { display: block; }

/* Settings panel */
.comp-settings {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 200;
    width: min(420px, calc(100vw - 2rem));
    max-height: calc(100vh - 4rem);
    overflow-y: auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    padding: 1.25rem;
    box-shadow: 0 8px 32px rgba(0,0,0,0.18);
}

.comp-settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.comp-settings-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--foreground);
}

.comp-settings-close {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted-foreground);
    padding: 0.25rem;
}
.comp-settings-close:hover { color: var(--foreground); }

.comp-settings-body {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comp-setting-row { display: flex; flex-direction: column; gap: 0.35rem; }

.comp-setting-row-pair {
    flex-direction: row;
    gap: 1rem;
}

.comp-setting-field { flex: 1; display: flex; flex-direction: column; gap: 0.35rem; }

.comp-setting-label {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    font-weight: 500;
}

.comp-input {
    width: 100%;
    padding: 0.5rem 0.625rem;
    font-family: inherit;
    font-size: 0.875rem;
    background: var(--background);
    color: var(--foreground);
    border: 1px solid var(--input);
    border-radius: var(--radius);
}
.comp-input:focus { outline: 2px solid var(--ring); outline-offset: -1px; }

.comp-input-group {
    display: flex;
    gap: 0.5rem;
}
.comp-input-group .comp-input { flex: 1; }

.comp-select {
    padding: 0.5rem 0.625rem;
    font-family: inherit;
    font-size: 0.875rem;
    background: var(--background);
    color: var(--foreground);
    border: 1px solid var(--input);
    border-radius: var(--radius);
    cursor: pointer;
}
.comp-select-full { width: 100%; }

/* Range slider */
.comp-slider {
    -webkit-appearance: none;
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: var(--muted);
    outline: none;
}

.comp-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid var(--background);
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

.comp-slider::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--primary);
    cursor: pointer;
    border: 2px solid var(--background);
    box-shadow: 0 1px 3px rgba(0,0,0,.25);
}

/* Toggle switches */
.comp-toggles {
    flex-direction: row;
    gap: 1.5rem;
}

.comp-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.875rem;
    color: var(--foreground);
    cursor: pointer;
}
.comp-toggle input { display: none; }

.comp-toggle-track {
    position: relative;
    width: 2.5rem;
    height: 1.35rem;
    background: var(--muted);
    border-radius: 999px;
    transition: background 0.2s;
}
.comp-toggle input:checked + .comp-toggle-track { background: var(--primary); }

.comp-toggle-thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: calc(1.35rem - 4px);
    height: calc(1.35rem - 4px);
    background: white;
    border-radius: 50%;
    transition: transform 0.2s;
}
.comp-toggle input:checked + .comp-toggle-track .comp-toggle-thumb {
    transform: translateX(calc(2.5rem - 1.35rem));
}

.comp-setting-hint {
    font-size: 0.78rem;
    color: var(--muted-foreground);
    margin-top: -0.25rem;
    margin-bottom: 0.25rem;
}

/* ---- Stats bar ---- */
.comp-stats-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.75rem;
    margin-bottom: 0.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.82rem;
    color: var(--muted-foreground);
}
.comp-stats-item strong { color: var(--foreground); }
.comp-stats-sep { opacity: 0.4; }

/* ---- Hold-to-peek thumbnail ---- */
.comp-thumb-peekable { cursor: pointer; position: relative; overflow: hidden; }
.comp-peek-badge {
    position: absolute;
    bottom: 3px; left: 50%;
    transform: translateX(-50%);
    background: rgba(0,0,0,0.65);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 1px 5px;
    border-radius: 3px;
    pointer-events: none;
    white-space: nowrap;
}

.comp-setting-warn {
    font-size: 0.78rem;
    color: var(--destructive);
    margin-top: -0.25rem;
}

.comp-settings-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--border);
}

/* Settings panel — bottom sheet on mobile */
@media (max-width: 640px) {
    .comp-settings {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        width: 100%;
        max-width: 100%;
        max-height: 90dvh;
        max-height: 90vh; /* fallback */
        border-radius: calc(var(--radius) + 8px) calc(var(--radius) + 8px) 0 0;
        padding: 0 1rem 1.25rem;
    }
    /* Drag handle */
    .comp-settings::before {
        content: '';
        display: block;
        width: 2.5rem;
        height: 4px;
        background: var(--border);
        border-radius: 99px;
        margin: 0.75rem auto 1rem;
    }
    .comp-setting-row-pair {
        flex-direction: column;
        gap: 0.75rem;
    }
    .comp-settings-footer {
        flex-direction: column-reverse;
        gap: 0.5rem;
    }
    .comp-settings-footer .comp-btn {
        width: 100%;
        justify-content: center;
    }
    .comp-toggles {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
}

/* File list */
.comp-file-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.comp-file-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.comp-file-row.anim-remove {
    animation: compRowOut 0.22s ease forwards;
}
@keyframes compRowOut {
    0%   { opacity: 1; transform: translateX(0); max-height: 80px; }
    100% { opacity: 0; transform: translateX(20px); max-height: 0; padding: 0; margin: 0; }
}

.comp-file-thumb {
    width: 3.5rem;
    height: 3.5rem;
    flex-shrink: 0;
    border-radius: calc(var(--radius) - 2px);
    overflow: hidden;
    background: var(--muted);
    position: relative;
}
.comp-file-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.comp-thumb-clickable {
    cursor: zoom-in;
    position: relative;
}
.comp-thumb-zoom {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.38);
    color: #fff;
    opacity: 0;
    transition: opacity 0.18s;
    border-radius: inherit;
}
.comp-thumb-clickable:hover .comp-thumb-zoom,
.comp-thumb-peekable:hover .comp-thumb-zoom { opacity: 1; }

/* ---- Before/After Preview Modal ---- */
.comp-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}
.comp-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
}
.comp-preview-dialog {
    position: relative;
    z-index: 1;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    width: 100%;
    max-width: 820px;
    overflow: hidden;
    animation: compModalIn 0.22s ease both;
}
@keyframes compModalIn {
    from { opacity: 0; transform: scale(0.96); }
    to   { opacity: 1; transform: scale(1); }
}
.comp-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
}
.comp-preview-title {
    font-weight: 600;
    font-size: 0.9375rem;
}
.comp-preview-comparison {
    position: relative;
    overflow: hidden;
    cursor: ew-resize;
    background: var(--muted);
    height: 60vh;
    max-height: 500px;
    user-select: none;
    touch-action: none;
}
.comp-preview-img {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    object-fit: contain;
    pointer-events: none;
    display: block;
}
.comp-preview-divider {
    position: absolute;
    top: 0; bottom: 0;
    width: 3px;
    background: #fff;
    transform: translateX(-50%);
    pointer-events: none;
    box-shadow: 0 0 6px rgba(0,0,0,0.4);
}
.comp-preview-handle {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 2.75rem;
    height: 2.75rem;
    background: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
.comp-preview-arrow {
    display: inline-block;
    width: 0; height: 0;
}
.comp-preview-arrow-left {
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-right: 8px solid #555;
}
.comp-preview-arrow-right {
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
    border-left: 8px solid #555;
}
.comp-preview-label {
    position: absolute;
    top: 0.75rem;
    background: rgba(0,0,0,0.55);
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    padding: 0.2rem 0.55rem;
    border-radius: 0.3rem;
    pointer-events: none;
    letter-spacing: 0.03em;
}
.comp-preview-label-before { left: 0.75rem; }
.comp-preview-label-after  { right: 0.75rem; }
.comp-preview-footer {
    display: flex;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    border-top: 1px solid var(--border);
}

.comp-file-info { flex: 1; min-width: 0; }

.comp-file-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--foreground);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    min-width: 0;
}

.comp-fname {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
    flex: 1;
}

.comp-check {
    width: 16px;
    height: 16px;
    color: var(--success);
    flex-shrink: 0;
}

.comp-file-sizes {
    font-size: 0.78rem;
    color: var(--muted-foreground);
    margin-top: 0.15rem;
}

.comp-size-orig { text-decoration: line-through; opacity: 0.7; }
.comp-size-new { color: var(--success); font-weight: 600; }
.comp-size-sep { margin: 0 0.15rem; }
.comp-dim-label { display: block; color: var(--muted-foreground); font-size: 0.75rem; }

.comp-file-status {
    flex-shrink: 0;
    text-align: right;
    min-width: 3rem;
}

.comp-saved {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--foreground);
}

.comp-status { font-size: 0.78rem; font-weight: 500; }
.comp-status-queued { color: var(--muted-foreground); }
.comp-status-processing { color: var(--primary); }
.comp-status-error { color: var(--destructive); }

/* Converter bulk status badges */
.cv-status-loading    { color: var(--muted-foreground); }
.cv-status-queued     { color: var(--muted-foreground); }
.cv-status-converting { color: var(--primary); }
.cv-status-done       { color: var(--success); font-weight: 700; }
.cv-status-error      { color: var(--destructive); }

.comp-file-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
}

.comp-dl-btn { color: var(--foreground) !important; }

.spinner-sm {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--muted);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ========================================
   Image Resizer Page
   ======================================== */

/* Outer wrapper — full-width padding so editor can exceed .container width */
.rz-outer {
    padding: 0 1rem;
}

/* Editor card */
.rz-editor {
    max-width: 1400px;
    margin: 0 auto;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 6px);
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    overflow: hidden;
}

/* Card header */
.rz-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.rz-header-info {
    flex: 1;
    min-width: 0;
}

.rz-header-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--foreground);
    margin: 0;
}

.rz-header-meta {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    margin: 0.15rem 0 0;
}

.rz-header-btns {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.rz-hbtn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.4rem 0.75rem;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}
.rz-hbtn svg { width: 14px; height: 14px; }

.rz-hbtn-outline {
    background: transparent;
    color: var(--foreground);
    border: 1px solid var(--border);
}
.rz-hbtn-outline:hover { background: var(--muted); }

.rz-hbtn-ghost {
    background: transparent;
    color: var(--muted-foreground);
    border: 1px solid transparent;
}
.rz-hbtn-ghost:hover { background: var(--muted); color: var(--foreground); }

/* Tabs */
.rz-tabs {
    display: flex;
    gap: 0;
    border-bottom: 1px solid var(--border);
    padding: 0 1.5rem;
    background: var(--card);
}

.rz-tab {
    flex: 0;
    padding: 0.75rem 1.25rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    background: none;
    border: none;
    color: var(--muted-foreground);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.15s, border-color 0.15s;
}
.rz-tab:hover { color: var(--foreground); }
.rz-tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* Two-column body */
.rz-body {
    display: grid;
    grid-template-columns: 320px 1fr;
    min-height: 480px;
}

/* Left controls column */
.rz-controls-col {
    border-right: 1px solid var(--border);
    padding: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
}

/* Panes */
.rz-pane { display: none; flex-direction: column; gap: 0.75rem; }
.rz-pane.active { display: flex; }

.rz-field-label {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted-foreground);
    margin-bottom: 0.1rem;
}

/* Two-column input grid */
.rz-two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}
/* Legacy alias */
.rz-dim-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.rz-input {
    width: 100%;
    padding: 0.5rem 0.625rem;
    font-family: inherit;
    font-size: 0.875rem;
    background: var(--background);
    color: var(--foreground);
    border: 1px solid var(--input);
    border-radius: var(--radius);
}
.rz-input:focus { outline: 2px solid var(--ring); outline-offset: -1px; }

.rz-lock-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.rz-lock {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: 50%;
    cursor: pointer;
    color: var(--muted-foreground);
    transition: background 0.15s, color 0.15s;
    flex-shrink: 0;
}
.rz-lock svg { width: 14px; height: 14px; }
.rz-lock.active { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }

.rz-aspect-label {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

/* Buttons */
.rz-btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-top: 0.25rem;
}

.rz-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.55rem 1rem;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    text-align: center;
    transition: opacity 0.15s, background 0.15s;
}
.rz-btn svg { width: 14px; height: 14px; }
.rz-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.rz-btn-primary { background: var(--primary); color: var(--primary-foreground); }
.rz-btn-primary:hover { opacity: 0.88; }
.rz-btn-outline { background: transparent; color: var(--foreground); border-color: var(--border); }
.rz-btn-outline:hover { background: var(--muted); }
.rz-btn-danger { background: var(--destructive); color: white; border-color: var(--destructive); }
.rz-btn-danger:hover { opacity: 0.88; }
.rz-btn-success { background: var(--success); color: var(--success-foreground); }
.rz-btn-success:hover { opacity: 0.88; }
.rz-btn-block { width: 100%; }

/* Preset buttons */
.rz-preset-row {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.rz-preset {
    padding: 0.4rem 0.7rem;
    font-family: inherit;
    font-size: 0.78rem;
    font-weight: 600;
    background: var(--muted);
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.rz-preset.active { background: var(--primary); color: var(--primary-foreground); border-color: var(--primary); }
.rz-preset:hover:not(.active) { background: var(--accent); }

/* Transform grid — tall buttons with icon + label stacked */
.rz-transform-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.rz-transform-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 1rem 0.5rem;
    background: var(--muted);
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
}
.rz-transform-btn svg { width: 22px; height: 22px; }
.rz-transform-btn:hover { background: var(--accent); border-color: var(--primary); }

/* Export section */
.rz-export {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.rz-export-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--foreground);
    margin: 0;
}

.rz-export-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.rz-export-field { flex: 1; }

.rz-select {
    padding: 0.5rem 0.625rem;
    font-family: inherit;
    font-size: 0.875rem;
    background: var(--background);
    color: var(--foreground);
    border: 1px solid var(--input);
    border-radius: var(--radius);
    cursor: pointer;
}
.rz-select-full { width: 100%; }

/* Right: image preview column */
.rz-preview-col {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--muted);
    min-height: 480px;
    overflow: hidden;
}

.rz-preview-box {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

#rzPreviewImg,
#frPreviewImg {
    max-width: 100%;
    max-height: 480px;
    object-fit: contain;
    border-radius: var(--radius);
    display: block;
}

/* Canvas crop container */
#rzCropWrap {
    position: absolute;
    inset: 0;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

/* Responsive */
@media (max-width: 768px) {
    .rz-body {
        grid-template-columns: 1fr;
    }
    .rz-preview-col {
        min-height: 280px;
        order: -1;
        border-bottom: 1px solid var(--border);
    }
    .rz-controls-col {
        border-right: none;
    }
    #rzCropWrap {
        inset: 0;
    }
    .rz-tabs {
        padding: 0 1rem;
    }
    .rz-tab {
        padding: 0.6rem 0.75rem;
        font-size: 0.8125rem;
    }
    .rz-header {
        flex-wrap: wrap;
    }
}

/* Result section (shown after download) */
.rz-result {
    max-width: 1400px;
    margin: 1.5rem auto 0;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    overflow: hidden;
    animation: fadeIn 0.3s ease;
}

.rz-result-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--border);
}

.rz-result-header svg {
    width: 20px;
    height: 20px;
    color: var(--success);
    flex-shrink: 0;
}

.rz-result-header h3 {
    font-size: 1rem;
    font-weight: 600;
    margin: 0;
    color: var(--success);
}

.rz-result-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
}

.rz-result-col {
    padding: 1.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.rz-result-col + .rz-result-col {
    border-left: 1px solid var(--border);
}

.rz-result-col-out {
    background: var(--accent);
}

.rz-result-col-label {
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.rz-result-col-img {
    max-width: 100%;
    max-height: 180px;
    object-fit: contain;
    border-radius: var(--radius);
    border: 1px solid var(--border);
    background: var(--muted);
}

.rz-result-col-dims {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--foreground);
}

.rz-result-col-size {
    font-size: 0.875rem;
    color: var(--muted-foreground);
}

@media (max-width: 640px) {
    .rz-result-cols {
        grid-template-columns: 1fr;
    }
    .rz-result-col + .rz-result-col {
        border-left: none;
        border-top: 1px solid var(--border);
    }
}

/* Result Card */
.result-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    padding: 1.5rem;
    animation: fadeIn 0.3s ease;
}

.result-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
    align-items: start;
}

.result-left {
    min-width: 0;
}

.result-preview {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--muted);
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.result-right {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.result-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--foreground);
}

.convert-details {
    padding: 1rem;
    background: var(--muted);
    border-radius: var(--radius);
}

.convert-details h4 {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
    margin-bottom: 0.75rem;
}

.detail-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--border);
}

.detail-row:last-child {
    border-bottom: none;
}

.detail-row span:first-child {
    color: var(--muted-foreground);
}

.detail-row span:last-child {
    font-weight: 500;
    color: var(--foreground);
}

.detail-row.success span:last-child {
    color: var(--success);
}

/* Button loading state */
.btn-loading {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.spinner {
    width: 1rem;
    height: 1rem;
    border: 2px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

.btn-loading .spinner {
    width: 0.875rem;
    height: 0.875rem;
    border-width: 2px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeOut {
    from { opacity: 1; transform: translateY(0); }
    to   { opacity: 0; transform: translateY(4px); }
}
.rp-fade-in  { animation: fadeIn  0.28s ease both; }
.rp-fade-out { animation: fadeOut 0.2s  ease both; }

/* ========================================
   Features Section
   ======================================== */
.features-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.feature-card {
    padding: 1.25rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    transition: border-color 0.2s;
}

.feature-card:hover {
    border-color: var(--ring);
}

.feature-icon {
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--muted);
    border-radius: calc(var(--radius));
    margin-bottom: 0.75rem;
}

.feature-icon svg {
    width: 1rem;
    height: 1rem;
    opacity: 0.6;
}

.feature-card h3 {
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    color: var(--foreground);
}

.feature-card p {
    font-size: 0.8125rem;
    line-height: 1.5;
}

/* How To Grid */
.how-to-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.how-to-card {
    position: relative;
    padding: 1.5rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    transition: all 0.2s ease;
}

.how-to-card:hover {
    border-color: var(--ring);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.how-to-number {
    position: absolute;
    top: 1.5rem;
    right: 1.5rem;
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--muted);
    line-height: 1;
}

.how-to-content {
    position: relative;
    z-index: 1;
}

.how-to-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    color: var(--primary-foreground);
}

.how-to-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.how-to-card h3 {
    font-size: 1rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.how-to-card p {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    line-height: 1.6;
}

/* FAQ Section */
.faq-container {
    max-width: 672px;
    margin: 0 auto;
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    overflow: hidden;
}

.dark .faq-container {
    border-color: oklch(0.32 0.006 286.033);
}

.faq-item {
    border-bottom: 1px solid var(--border);
}

.faq-item:last-child {
    border-bottom: none;
}

.faq-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    background: none;
    border: none;
    cursor: pointer;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    text-align: left;
    outline: none;
    transition: background-color 0.15s;
}

.faq-trigger:hover {
    background-color: color-mix(in oklch, var(--accent) 50%, transparent);
}

.faq-icon {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
    color: var(--muted-foreground);
    transition: transform 0.2s;
}

.faq-item[data-state="open"] .faq-icon {
    transform: rotate(180deg);
}

.faq-content {
    display: grid;
    grid-template-rows: 0fr;
    opacity: 0;
    overflow: hidden;
    transition: grid-template-rows 0.2s ease, opacity 0.2s ease;
}

.faq-item[data-state="open"] .faq-content {
    grid-template-rows: 1fr;
    opacity: 1;
}

.faq-content > p {
    min-height: 0;
    padding: 0 1.25rem 1rem;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: var(--muted-foreground);
    overflow: hidden;
}

/* CTA Section */
.cta-content {
    text-align: center;
    max-width: 700px;
    margin: 0 auto;
    padding: 3rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
}

.cta-content h2 {
    margin-bottom: 0.75rem;
    color: var(--foreground);
}

.cta-content p {
    margin-bottom: 1.25rem;
    font-size: 0.9375rem;
}

/* Footer */
.footer {
    padding: 3rem 0 1.5rem;
    background: var(--muted);
    border-top: 1px solid var(--border);
}

.footer-content {
    display: grid;
    grid-template-columns: 1.25fr 2fr;
    gap: 3rem;
    margin-bottom: 2rem;
}

.footer-brand .logo {
    margin-bottom: 0.75rem;
}

.footer-brand p {
    font-size: 0.8125rem;
    max-width: 280px;
}

.footer-links {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.5rem;
}

.footer-column h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
    color: var(--foreground);
}

.footer-column ul {
    list-style: none;
}

.footer-column li {
    margin-bottom: 0.375rem;
}

.footer-column a {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    text-decoration: none;
    transition: color 0.15s;
}

.footer-column a:hover {
    color: var(--foreground);
}

.footer-bottom {
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 1.5rem;
    border-top: 1px solid var(--border);
}

.footer-bottom p {
    font-size: 0.75rem;
}

/* ========================================
   Legal Pages
   ======================================== */
.legal-header {
    padding: 6rem 0 2rem;
    border-bottom: 1px solid var(--border);
    text-align: center;
}

.legal-header h1 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--foreground);
}

.legal-header .legal-updated {
    font-size: 0.875rem;
    color: var(--muted-foreground);
    margin: 0;
}

.legal-content {
    max-width: 800px;
    margin: 0 auto;
}

.legal-section {
    margin-bottom: 2.5rem;
}

.legal-content h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 1rem;
}

.legal-content h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--foreground);
    margin: 1.5rem 0 0.75rem;
}

.legal-content p {
    font-size: 0.9375rem;
    color: var(--muted-foreground);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.legal-content ul {
    list-style: disc;
    padding-left: 1.5rem;
    margin-bottom: 1rem;
}

.legal-content li {
    font-size: 0.9375rem;
    color: var(--muted-foreground);
    line-height: 1.7;
    margin-bottom: 0.5rem;
}

.legal-content strong {
    color: var(--foreground);
}

.legal-content a {
    color: var(--primary);
    text-decoration: none;
}

.legal-content a:hover {
    text-decoration: underline;
}

/* About Page */
.about-content {
    max-width: 700px;
    margin: 0 auto;
    text-align: center;
}

.about-content h2 {
    font-size: 1.75rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 1rem;
}

.about-content p {
    font-size: 1rem;
    color: var(--muted-foreground);
    line-height: 1.7;
    margin-bottom: 1rem;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    max-width: 900px;
    margin: 0 auto;
}

.about-card {
    padding: 2rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    transition: all 0.3s ease;
}

.about-card:hover {
    border-color: var(--primary);
    transform: translateY(-4px);
    box-shadow: 0 12px 24px -8px rgba(0, 0, 0, 0.15);
}

.about-card-icon {
    width: 3rem;
    height: 3rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--muted);
    border-radius: var(--radius);
    margin-bottom: 1rem;
    color: var(--primary);
}

.about-card-icon svg {
    width: 1.5rem;
    height: 1.5rem;
}

.about-card h3 {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.5rem;
}

.about-card p {
    font-size: 0.9375rem;
    color: var(--muted-foreground);
    line-height: 1.6;
}

/* Contact Page */
.contact-grid {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 3rem;
    max-width: 1100px;
    margin: 0 auto;
}

.contact-form-wrapper h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.75rem;
}

.contact-form-wrapper > p {
    font-size: 0.9375rem;
    color: var(--muted-foreground);
    margin-bottom: 2rem;
    line-height: 1.6;
}

.contact-form {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.form-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--foreground);
    background: var(--background);
    border: 1px solid var(--input);
    border-radius: var(--radius);
    transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 20%, transparent);
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.contact-info h2 {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 1.5rem;
}

.contact-cards {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-bottom: 2rem;
}

.contact-card {
    padding: 1.25rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    transition: border-color 0.2s;
}

.contact-card:hover {
    border-color: var(--ring);
}

.contact-card-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--muted);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
    color: var(--primary);
}

.contact-card-icon svg {
    width: 1.25rem;
    height: 1.25rem;
}

.contact-card h3 {
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--foreground);
    margin-bottom: 0.25rem;
}

.contact-card p {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}

.contact-card a {
    font-size: 0.875rem;
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}

.contact-card a:hover {
    text-decoration: underline;
}

/* Utility */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========================================
   Responsive
   ======================================== */
@media (max-width: 768px) {
    .mobile-menu-btn {
        display: block;
    }

    .nav-links {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        height: 100vh;
        background: var(--background);
        flex-direction: column;
        display: flex;
        padding: 0 0 1rem;
        gap: 0;
        border-right: 1px solid var(--border);
        box-shadow: 4px 0 24px rgba(0,0,0,0.12);
        z-index: 1001;
        overflow-y: auto;
        transform: translateX(-100%);
        transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .nav-links.active {
        transform: translateX(0);
    }

    .nav-drawer-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.4);
        z-index: 999;
    }

    .nav-drawer-backdrop.active {
        display: block;
    }

    .nav-links li {
        width: 100%;
        padding: 0 0.5rem;
    }

    .nav-links a {
        width: 100%;
        justify-content: flex-start;
        height: auto;
        padding: 0.625rem 0.75rem;
    }

    /* Drawer header injected by JS */
    .nav-drawer-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        list-style: none;
        padding: 1.25rem 1rem;
        border-bottom: 1px solid var(--border);
        margin-bottom: 0.5rem;
        flex-shrink: 0;
    }

    .nav-drawer-logo {
        display: flex;
        align-items: center;
        gap: 0.5rem;
        font-size: 1rem;
        font-weight: 600;
        color: var(--foreground);
        text-decoration: none;
    }

    .nav-drawer-logo:hover {
        background: none !important;
        color: var(--foreground) !important;
    }

    .nav-drawer-close {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 2rem;
        height: 2rem;
        background: none;
        border: none;
        cursor: pointer;
        color: var(--muted-foreground);
        border-radius: calc(var(--radius) - 2px);
        padding: 0;
        flex-shrink: 0;
    }

    .nav-drawer-close:hover {
        background: var(--accent);
        color: var(--foreground);
    }

    .hero {
        padding: 6rem 0 2rem;
    }

    .tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .features-grid {
        grid-template-columns: 1fr;
    }

    .how-to-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .quick-tools-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .converter-grid {
        grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    }

    .result-grid {
        grid-template-columns: 1fr;
    }

    .result-preview {
        aspect-ratio: 4 / 3;
    }

    .settings-row {
        flex-direction: column;
    }

    .footer-content {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .footer-links {
        grid-template-columns: repeat(2, 1fr);
    }

    .footer-bottom {
        flex-direction: column;
        gap: 0.75rem;
        text-align: center;
    }

    .contact-grid {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .about-grid {
        grid-template-columns: 1fr;
    }

    /* ---- Mobile nav accordion (Convert / Resize / Compress) ---- */

    /* Show chevrons on dropdown trigger links (not language) */
    .nav-dropdown > a:not(.nav-lang-trigger) .nav-chevron {
        display: inline-block !important;
        margin-left: auto;
        transition: transform 0.22s;
        flex-shrink: 0;
    }
    .nav-dropdown.open > a:not(.nav-lang-trigger) .nav-chevron {
        transform: rotate(180deg);
    }
    /* Make trigger link flex so chevron pushes to the right */
    .nav-dropdown > a:not(.nav-lang-trigger) {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
    }

    /* Accordion panel */
    .nav-dropdown.open > .nav-dropdown-menu:not(.nav-lang-menu) {
        display: flex !important;
        flex-direction: column;
        position: static;
        width: 100%;
        max-height: 58vh;
        overflow-y: auto;
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transform: none;
        box-shadow: none;
        border: 1px solid var(--border);
        border-radius: calc(var(--radius) + 2px);
        padding: 0.375rem;
        margin: 0.25rem 0 0.5rem;
        gap: 1px;
        animation: none;
    }

    /* Mega menu (Convert): flatten 4-col grid into scrollable list */
    .nav-dropdown.open .nav-mega-menu {
        display: flex;
        flex-direction: column;
        width: 100%;
        padding: 0.375rem;
        grid-template-columns: none;
        gap: 0;
    }
    .nav-dropdown.open .nav-mega-menu .nav-mega-col {
        display: contents;
    }
    .nav-dropdown.open .nav-mega-menu .nav-mega-heading {
        display: block;
        padding: 0.5rem 0.5rem 0.2rem;
    }
    .nav-dropdown.open .nav-mega-menu .nav-mega-col a {
        padding: 0.4rem 0.5rem;
        white-space: normal;
    }
    .nav-dropdown.open .nav-mega-menu .nav-mega-footer {
        display: block;
        grid-column: auto;
    }
    .nav-dropdown.open .nav-mega-menu .nav-mega-footer a {
        padding: 0.4rem 0.5rem;
    }

    /* Simple/2-col menus (Resize, Compress) */
    .nav-dropdown.open .nav-simple-menu {
        width: 100%;
    }
    .nav-dropdown.open .nav-simple-menu a {
        padding: 0.4rem 0.5rem;
        white-space: normal;
    }
    .nav-dropdown.open .nav-2col-grid {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }
    .nav-dropdown.open .nav-2col-grid a {
        padding: 0.4rem 0.5rem;
    }
    .nav-dropdown.open .nav-dropdown-footer {
        padding: 0.375rem 0.25rem 0.125rem;
    }
    .nav-dropdown.open .nav-dropdown-footer a {
        padding: 0.4rem 0.5rem;
    }
}

@media (max-width: 480px) {
    .hero-buttons {
        flex-direction: column;
        width: 100%;
    }

    .hero-buttons .btn {
        width: 100%;
    }

    .tools-grid {
        grid-template-columns: 1fr;
    }

    .footer-links {
        grid-template-columns: 1fr;
    }

    .quick-tools-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .converter-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

/* ========================================
   Image Cropper Tool (cp-*)
   ======================================== */

/* Fixed full-screen editor overlay (shown when image is loaded) */
.cp-editor-overlay {
    display: none;
    position: fixed;
    top: 3.5rem;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 500;
    background: var(--background);
}

/* Full-page layout: sidebar left + canvas right */
.cp-page-layout {
    display: flex;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* Left sidebar — always visible */
.cp-sidebar {
    width: 300px;
    flex-shrink: 0;
    padding: 1.75rem 1.375rem 6.5rem;
    border-right: 1px solid var(--border);
    background: var(--card);
    overflow-y: auto;
}

.cp-sidebar-title {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--foreground);
    margin: 0 0 1.25rem;
}

.cp-sidebar-subtitle {
    font-size: 1rem;
    font-weight: 700;
    color: var(--foreground);
    margin: 0 0 1rem;
}

.cp-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.25rem 0 1.5rem;
}

/* Fields */
.cp-field {
    margin-bottom: 0.875rem;
}
.cp-field:last-child { margin-bottom: 0; }

.cp-field label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--muted-foreground);
    margin-bottom: 0.375rem;
}

.cp-field-pair {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 0.875rem;
}
.cp-field-pair .cp-field { margin-bottom: 0; }

/* Inputs */
.cp-input {
    width: 100%;
    padding: 0.5625rem 0.75rem;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--foreground);
    background: var(--background);
    border: 1px solid var(--input);
    border-radius: 0.5rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.cp-input:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 12%, transparent);
}

.cp-select {
    width: 100%;
    padding: 0.5625rem 0.75rem;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--foreground);
    background: var(--background);
    border: 1px solid var(--input);
    border-radius: 0.5rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='7' viewBox='0 0 12 7'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%236c757d' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 0.75rem center;
    padding-right: 2rem;
    transition: border-color 0.15s, box-shadow 0.15s;
}
.cp-select:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 12%, transparent);
}

/* Reset button */
.cp-btn-reset {
    width: 100%;
    padding: 0.625rem 1rem;
    background: transparent;
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
    margin-top: 0.5rem;
}
.cp-btn-reset:hover { background: var(--muted); border-color: var(--ring); }

/* Fixed crop button bar at bottom of sidebar */
.cp-crop-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 300px;
    padding: 1rem;
    background: var(--card);
    border-top: 1px solid var(--border);
    z-index: 50;
}
.cp-crop-bar button {
    width: 100%;
    padding: 0.875rem;
    border: none;
    background: var(--primary);
    border-radius: 0.625rem;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    color: var(--primary-foreground);
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
}
.cp-crop-bar button:hover { opacity: 0.9; }
.cp-crop-bar button:active { transform: scale(0.98); }

/* Right canvas / upload / result area */
.cp-canvas-area {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--muted);
    overflow: hidden;
    position: relative;
}

/* Upload drop zone */
.cp-upload-zone {
    width: 560px;
    max-width: 100%;
    height: 360px;
    border: 2px dashed var(--border);
    border-radius: 0.875rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    cursor: pointer;
    background: var(--card);
    transition: border-color 0.2s, background 0.2s;
}
.cp-upload-zone:hover,
.cp-upload-zone.drag-over {
    border-color: var(--primary);
    background: color-mix(in oklch, var(--primary) 4%, var(--card));
}
.cp-upload-icon { color: var(--muted-foreground); opacity: 0.55; }
.cp-upload-title { font-size: 0.9375rem; font-weight: 500; color: var(--foreground); }
.cp-upload-hint  { font-size: 0.8125rem; color: var(--muted-foreground); }
.cp-upload-btn {
    margin-top: 0.25rem;
    padding: 0.625rem 1.375rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s;
}
.cp-upload-btn:hover { opacity: 0.88; }

/* Canvas wrapper (shown after upload) */
.cp-canvas-wrapper {
    position: relative;
    display: none;
    user-select: none;
    -webkit-user-select: none;
    cursor: crosshair;
    line-height: 0;
    border-radius: 6px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.18);
    max-width: 100%;
    max-height: 100%;
}
.cp-canvas-wrapper canvas {
    display: block;
    border-radius: 6px;
}

/* Crop overlay — absolute, same size as canvas display */
.cp-crop-overlay {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 2;
    overflow: visible;
}

/* Dark regions outside the crop selection */
.cp-dark-region {
    position: absolute;
    background: rgba(0, 0, 0, 0.45);
    pointer-events: none;
}

/* Crop box with dashed border */
.cp-crop-box {
    position: absolute;
    border: 1.5px dashed rgba(255, 255, 255, 0.92);
    box-sizing: border-box;
    pointer-events: all;
    cursor: move;
    z-index: 3;
}

/* Rule-of-thirds horizontal lines */
.cp-crop-box::before {
    content: '';
    position: absolute;
    top: 33.33%; left: 0; right: 0; height: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.28);
    pointer-events: none;
}
.cp-crop-box::after {
    content: '';
    position: absolute;
    top: 66.66%; left: 0; right: 0; height: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.28);
    pointer-events: none;
}

/* Rule-of-thirds vertical lines */
.cp-grid-v1, .cp-grid-v2 {
    position: absolute;
    top: 0; bottom: 0; width: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.28);
    pointer-events: none;
}
.cp-grid-v1 { left: 33.33%; }
.cp-grid-v2 { left: 66.66%; }

/* Drag handles */
.cp-handle {
    position: absolute;
    width: 12px;
    height: 12px;
    background: #fff;
    border-radius: 50%;
    border: 1.5px solid rgba(255, 255, 255, 0.9);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
    pointer-events: all;
    z-index: 4;
}
.cp-handle[data-handle="tl"] { top: -6px; left: -6px; cursor: nw-resize; }
.cp-handle[data-handle="tc"] { top: -6px; left: calc(50% - 6px); cursor: n-resize; }
.cp-handle[data-handle="tr"] { top: -6px; right: -6px; cursor: ne-resize; }
.cp-handle[data-handle="ml"] { top: calc(50% - 6px); left: -6px; cursor: w-resize; }
.cp-handle[data-handle="mr"] { top: calc(50% - 6px); right: -6px; cursor: e-resize; }
.cp-handle[data-handle="bl"] { bottom: -6px; left: -6px; cursor: sw-resize; }
.cp-handle[data-handle="bc"] { bottom: -6px; left: calc(50% - 6px); cursor: s-resize; }
.cp-handle[data-handle="br"] { bottom: -6px; right: -6px; cursor: se-resize; }

/* Result panel inside canvas area */
.cp-result {
    max-width: 680px;
    width: 100%;
    padding: 2rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    overflow-y: auto;
    max-height: calc(100vh - 6rem);
}

/* Responsive */
@media (max-width: 768px) {
    .cp-editor-overlay {
        overflow-y: auto;
    }
    .cp-page-layout {
        flex-direction: column;
        height: auto;
        min-height: 100%;
        overflow: visible;
    }
    .cp-sidebar {
        width: 100%;
        padding: 1.25rem 1rem 1.25rem;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow-y: visible;
    }
    .cp-crop-bar {
        position: sticky;
        width: 100%;
    }
    .cp-canvas-area {
        padding: 1.5rem 1rem;
        min-height: 60vh;
    }
}

/* ========================================
   Flip & Rotate — sidebar button styles
   ======================================== */
.fr-btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.625rem;
    margin-bottom: 0.75rem;
}
.fr-btn-row:has(> :only-child) {
    grid-template-columns: 1fr;
}

.fr-action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.375rem;
    padding: 0.75rem 0.5rem;
    background: var(--background);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--foreground);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.fr-action-btn i,
.fr-action-btn svg {
    width: 20px;
    height: 20px;
}
.fr-action-btn:hover {
    background: var(--muted);
    border-color: var(--ring);
}
.fr-action-btn.fr-active {
    background: color-mix(in oklch, var(--primary) 12%, var(--background));
    border-color: var(--primary);
    color: var(--primary);
}

/* Custom angle input row */
.fr-angle-row {
    display: flex;
    gap: 0.5rem;
}
.fr-angle-row .cp-input {
    flex: 1;
    min-width: 0;
}
.fr-angle-apply {
    padding: 0.5625rem 1rem;
    background: var(--primary);
    color: var(--primary-foreground);
    border: none;
    border-radius: 0.5rem;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s;
}
.fr-angle-apply:hover { opacity: 0.88; }

/* ========================================
   Image to Text / OCR — styles
   ======================================== */

/* Sidebar preview image */
.ocr-preview-wrap {
    border-radius: 0.5rem;
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--muted);
    line-height: 0;
}
.ocr-preview-img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
    max-height: 200px;
}

/* Placeholder in output area */
.ocr-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    text-align: center;
    color: var(--muted-foreground);
    font-size: 0.9375rem;
    max-width: 360px;
}

/* Progress */
.ocr-progress {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    max-width: 400px;
    width: 100%;
    text-align: center;
    min-height: 220px;
    margin: 0 auto;
}
.ocr-progress-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: ocrSpin 0.75s linear infinite;
}
@keyframes ocrSpin {
    to { transform: rotate(360deg); }
}
.ocr-progress-label {
    font-size: 0.9375rem;
    font-weight: 500;
    color: var(--foreground);
}
.ocr-progress-bar-wrap {
    width: 100%;
    height: 6px;
    background: var(--muted);
    border-radius: 3px;
    overflow: hidden;
}
.ocr-progress-bar {
    height: 100%;
    background: var(--primary);
    border-radius: 3px;
    transition: width 0.25s ease;
}

/* Result area */
.ocr-result-wrap {
    display: flex;
    flex-direction: column;
    width: 100%;
    height: 100%;
    max-width: 100%;
    gap: 0;
}
.ocr-result-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-bottom: none;
    border-radius: calc(var(--radius) + 2px) calc(var(--radius) + 2px) 0 0;
    flex-shrink: 0;
}
.ocr-result-info {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
}
.ocr-result-actions {
    display: flex;
    gap: 0.5rem;
}
.ocr-toolbar-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.4375rem 0.875rem;
    background: var(--background);
    color: var(--foreground);
    border: 1px solid var(--border);
    border-radius: 0.375rem;
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}
.ocr-toolbar-btn i,
.ocr-toolbar-btn svg {
    width: 14px;
    height: 14px;
}
.ocr-toolbar-btn:hover {
    background: var(--muted);
    border-color: var(--ring);
}
.ocr-result-text {
    flex: 1;
    width: 100%;
    box-sizing: border-box;
    min-height: 200px;
    padding: 1rem 1.25rem;
    font-family: 'Inter', system-ui, sans-serif;
    font-size: 0.9375rem;
    line-height: 1.7;
    color: var(--foreground);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 0 0 calc(var(--radius) + 2px) calc(var(--radius) + 2px);
    resize: none;
    outline: none;
}
.ocr-result-text:focus {
    border-color: var(--ring);
}

/* ========================================
   Toast Notifications
   ======================================== */
.toast-container {
    position: fixed;
    top: 4.5rem;
    right: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 9999;
    pointer-events: none;
    max-width: 380px;
    width: 100%;
}

.toast {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    padding: 0.85rem 1rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 2px);
    box-shadow: 0 8px 24px -4px rgba(0, 0, 0, 0.15), 0 2px 8px rgba(0, 0, 0, 0.08);
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--foreground);
    pointer-events: auto;
    animation: toastIn 0.25s ease;
    transition: opacity 0.2s, transform 0.2s;
}

.toast.toast-dismiss {
    opacity: 0;
    transform: translateX(100%);
}

.toast-icon {
    flex-shrink: 0;
    width: 1.125rem;
    height: 1.125rem;
    margin-top: 0.1rem;
}

.toast-body {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: 0.8125rem;
    margin-bottom: 0.1rem;
}

.toast-message {
    font-size: 0.8125rem;
    color: var(--muted-foreground);
    word-break: break-word;
}

.toast-close {
    flex-shrink: 0;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted-foreground);
    padding: 0.15rem;
    border-radius: calc(var(--radius) - 2px);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.15s, background 0.15s;
}

.toast-close:hover {
    color: var(--foreground);
    background: var(--muted);
}

.toast-close svg {
    width: 0.875rem;
    height: 0.875rem;
}

/* Toast type accents */
.toast-success { border-left: 3px solid var(--success); }
.toast-success .toast-icon { color: var(--success); }

.toast-error { border-left: 3px solid var(--destructive); }
.toast-error .toast-icon { color: var(--destructive); }

.toast-info { border-left: 3px solid var(--primary); }
.toast-info .toast-icon { color: var(--primary); }

.toast-warning { border-left: 3px solid #f59e0b; }
.toast-warning .toast-icon { color: #f59e0b; }

@keyframes toastIn {
    from { opacity: 0; transform: translateX(2rem); }
    to   { opacity: 1; transform: translateX(0); }
}


/* ========================================
   Resize Preset Pages — Comparison Slider & Inputs
   ======================================== */

/* Comparison card */
.comparison-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: calc(var(--radius) + 4px);
    padding: 1.5rem;
}

.comparison-grid {
    display: grid;
    grid-template-columns: 1fr 280px;
    gap: 1.5rem;
    align-items: start;
}

.comparison-left { min-width: 0; }

.comparison-slider {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 10;
    border-radius: var(--radius);
    overflow: hidden;
    cursor: ew-resize;
    user-select: none;
    touch-action: none;
    background: var(--muted);
}

.comparison-after,
.comparison-before {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    pointer-events: none;
}

.comparison-after img,
.comparison-before img {
    width: 100%; height: 100%;
    object-fit: contain;
    -webkit-user-drag: none;
}

.comparison-before {
    z-index: 2;
    background: var(--muted);
}

.comparison-label {
    position: absolute;
    bottom: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 0.75rem;
    font-weight: 500;
    border-radius: calc(var(--radius) - 2px);
}

.comparison-label-before { left: 0.75rem; }
.comparison-label-after  { right: 0.75rem; }

.comparison-handle {
    position: absolute;
    top: 0; bottom: 0;
    left: 50%;
    width: 2px;
    background: white;
    transform: translateX(-50%);
    box-shadow: 0 0 4px rgba(0,0,0,0.3);
    z-index: 3;
}

.comparison-handle-btn {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%,-50%);
    width: 2.5rem; height: 2.5rem;
    background: white;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}

.comparison-handle-btn span {
    width: 3px; height: 12px;
    background: var(--primary);
    border-radius: 2px;
}

.comparison-right {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.comparison-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: var(--foreground);
}

.compression-details {
    padding: 1rem;
    background: var(--muted);
    border-radius: var(--radius);
}

.compression-details h4 {
    font-size: 0.8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--muted-foreground);
    margin-bottom: 0.75rem;
}

/* Resizer inputs */
.resizer-inputs-row {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
}

.resizer-input-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.resizer-input-group label {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--muted-foreground);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.resizer-input-group .size-input {
    width: 100%;
    padding: 0.625rem 0.75rem;
    font-family: inherit;
    font-size: 0.875rem;
    color: var(--foreground);
    background: var(--background);
    border: 1px solid var(--input) !important;
    border-radius: var(--radius);
    transition: border-color 0.15s, box-shadow 0.15s;
    min-width: 0;
}

.resizer-input-group .size-input:focus {
    outline: none;
    border-color: var(--ring);
    box-shadow: 0 0 0 3px color-mix(in oklch, var(--ring) 20%, transparent);
}

.resizer-lock-btn {
    width: 2.5rem; height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--muted);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    color: var(--muted-foreground);
    transition: all 0.15s;
    flex-shrink: 0;
}

.resizer-lock-btn:hover { border-color: var(--ring); color: var(--foreground); }

.resizer-lock-btn.active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-foreground);
}

.resizer-lock-btn svg { width: 1rem; height: 1rem; }

/* Compress-to grid (used on resize.php and preset pages CTA) */
.compress-to-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
    justify-content: center;
}

.compress-to-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem 1.125rem;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--foreground);
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.compress-to-card:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--primary-foreground);
}

@media (max-width: 768px) {
    .comparison-grid { grid-template-columns: 1fr; }
    .comparison-slider { aspect-ratio: 4 / 3; }
}

@media (max-width: 480px) {
    .resizer-inputs-row { flex-wrap: wrap; }
    .resizer-input-group { flex: 1 1 0; min-width: 0; }
    .resizer-lock-btn { flex: 0 0 auto; }
    .resizer-inputs-row > .btn { flex: 1 1 100%; }
}
