
:root {
    --accent: #0056d2;
    --accent-contrast: #ffffff;
    --focus-glow: #7fb3ff;
}
body {
    font-family: Arial, sans-serif;
    text-align: center;
    background-color: #2a2522;
    color: white;
}
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    scrollbar-width: none;
}
::-webkit-scrollbar { display: none; }

.notice {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 12px 20px;
    border-radius: 10px;
    margin: 20px auto 20px auto;
    font-size: 14px;
    color: #ccc;
    max-width: 80%;
    line-height: 1.4;
    transition: border-color 0.3s, background 0.3s;
}
.notice-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    color: rgba(255,255,255,0.5);
    transition: color 0.3s;
}
.file-input {
    display: none;
}
.custom-file-upload {
    display: inline-block;
    padding: 10px 15px;
    background-color: var(--btn-bg, #3c3c3c);
    color: #fff;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 500;
    margin-bottom: 0;
    line-height: 1.2;
    border: 1px solid rgba(255,255,255,0.12);
    transition: background-color 0.3s, filter 0.2s;
}
.custom-file-upload:hover {
    filter: brightness(1.2);
}
.custom-file-upload:focus-visible {
    outline: 3px solid var(--focus-glow);
    outline-offset: 2px;
}
.controls {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.theme-selector {
    display: none;
}
.custom-dropdown {
    position: relative;
    min-width: 180px;
}
.dropdown-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 9px 14px;
    background: rgba(255,255,255,0.06);
    color: #ddd;
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    font-size: 14px;
    cursor: pointer;
    transition: border-color 0.2s;
    user-select: none;
    white-space: nowrap;
}
.dropdown-toggle:hover {
    border-color: rgba(255,255,255,0.25);
}
.dropdown-toggle .arrow {
    width: 10px;
    height: 10px;
    opacity: 0.4;
    transition: transform 0.2s;
}
.custom-dropdown.open .dropdown-toggle {
    border-color: var(--accent);
    border-radius: 8px 8px 0 0;
}
.custom-dropdown.open .arrow {
    transform: rotate(180deg);
}
.dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.1);
    border-top: none;
    border-radius: 0 0 8px 8px;
    overflow: hidden;
    z-index: 100;
    display: none;
}
.custom-dropdown.open .dropdown-menu {
    display: block;
}
.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    font-size: 14px;
    color: #bbb;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}
.dropdown-item:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
}
.dropdown-item.active {
    color: #fff;
}
.dropdown-item .swatch {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    border: 1px solid rgba(255,255,255,0.2);
    flex-shrink: 0;
}
canvas {
    margin-top: 10px;
    width: 100%;
}
#pdfContainer {
    width: 100%;
    margin: 0 auto;
    overflow-y: auto;
    overflow-x: hidden;
    max-height: 0;
    transition: max-height 0.3s ease-out;
    position: relative;
    /* Themed scrollbar - Firefox */
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb, rgba(255,255,255,0.12)) transparent;
}
#pdfContainer.has-previews {
    max-height: 80vh;
    padding: 16px 0;
}
/* Themed scrollbar - Webkit */
#pdfContainer::-webkit-scrollbar { display: block; width: 6px; }
#pdfContainer::-webkit-scrollbar-track { background: transparent; }
#pdfContainer::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb, rgba(255,255,255,0.12)); border-radius: 3px; }
#pdfContainer::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover, rgba(255,255,255,0.22)); }
#cancelBtn {
    margin-top: 10px;
    padding: 5px 16px;
    background: transparent;
    color: rgba(255,255,255,0.45);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    font-size: 12px;
    cursor: pointer;
    display: none;
    transition: color 0.15s, border-color 0.15s;
}
#cancelBtn:hover {
    color: rgba(255,255,255,0.7);
    border-color: rgba(255,255,255,0.25);
}
.scanned-tip {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    top: -32px;
    font-size: 13px;
    color: rgba(255,255,255,0.45);
    letter-spacing: 0.01em;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
    white-space: nowrap;
    z-index: 2;
}
.scanned-tip.visible {
    opacity: 1;
    pointer-events: auto;
}
.scanned-tip a {
    color: rgba(255,255,255,0.7);
    text-decoration: underline;
    text-decoration-style: dotted;
    text-underline-offset: 3px;
    cursor: pointer;
    transition: color 0.2s;
}
.scanned-tip a:hover {
    color: #fff;
}
.scanned-tip-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--tooltip-bg, rgba(30,30,30,0.95));
    color: var(--tooltip-color, #ccc);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0.01em;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--tooltip-border, rgba(255,255,255,0.1));
    white-space: normal;
    width: 260px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    box-shadow: var(--tooltip-shadow, 0 4px 20px rgba(0,0,0,0.4));
    z-index: 100;
    text-align: left;
}
.scanned-tip-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--tooltip-bg, rgba(30,30,30,0.95));
}
.scanned-tip a:hover + .scanned-tip-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    transition-delay: 0.8s;
}
/* --- Converter stage: stacks dropZone & progressContainer in same cell --- */
.converter-stage {
    display: grid;
    justify-items: center;
    position: relative;
    margin-top: 42px; /* room for scannedTip absolutely positioned above */
}
.converter-stage > * {
    grid-area: 1 / 1;
}
#progressContainer {
    width: 90%;
    max-width: 520px;
    background-color: rgba(255,255,255,0.06);
    border: 1px solid transparent;
    padding: 16px 20px 12px;
    border-radius: 12px;
    text-align: center;
    overflow: hidden;
    pointer-events: none;
    opacity: 0;
    transform: scaleY(0.92);
    transition: opacity 0.3s ease, transform 0.3s ease, border-color 0.3s ease;
    align-self: center;
}
#progressContainer.visible {
    border-color: rgba(255,255,255,0.08);
    opacity: 1;
    transform: scaleY(1);
    pointer-events: auto;
    z-index: 1;
}
#progressTrack {
    width: 100%;
    height: 10px;
    background: rgba(255,255,255,0.12);
    border-radius: 5px;
    overflow: hidden;
}
#progressBar {
    height: 100%;
    background: var(--bar-color, rgba(255,255,255,0.6));
    width: 0;
    border-radius: 5px;
    transition: width 0.3s ease-in-out, background 0.3s;
}
#progressText {
    margin-top: 10px;
    color: rgba(255,255,255,0.6);
    font-size: 13px;
    font-weight: 500;
    letter-spacing: 0.01em;
}
#downloadBtn {
    margin-top: 20px;
    padding: 10px 20px;
    background-color: var(--btn-bg, #3c3c3c);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.12);
    cursor: pointer;
    display: none;
    position: relative;
    left: 50%;
    transform: translateX(-50%);
    font-size: 16px;
    font-weight: 500;
    border-radius: 8px;
    transition: background-color 0.3s, filter 0.2s;
}
#downloadBtn:hover {
    filter: brightness(1.2);
}
#downloadBtn:focus-visible {
    outline: 3px solid var(--focus-glow);
    outline-offset: 2px;
}
.github-ribbon {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 1000;
}
.github-ribbon picture,
.github-ribbon img {
    display: block;
}
.bratuka-logo {
    position: fixed;
    top: 0;
    right: 16px;
    z-index: 1000;
    height: 0;
    display: flex;
    align-items: center;
}
.bratuka-logo img {
    height: 22px;
    width: auto;
    display: block;
    opacity: 0.6;
    transition: opacity 0.2s;
    transform: translateY(20px);
}
.bratuka-logo img:hover {
    opacity: 1;
}
.site-footer {
    width: 100%;
    box-sizing: border-box;
    padding: 30px 20px 24px;
    text-align: center;
    font-size: 13px;
    color: rgba(255,255,255,0.4);
    border-top: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
}
.footer-logo {
    display: inline-block;
    margin-bottom: 10px;
}
.footer-logo img {
    height: 32px;
    width: auto;
    opacity: 0.7;
    transition: opacity 0.2s;
}
.footer-logo img:hover {
    opacity: 1;
}
.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.footer-links a {
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}
.footer-links a:hover {
    color: rgba(255,255,255,0.85);
}
.footer-copy {
    margin: 0;
    line-height: 1.6;
}
.footer-credit {
    margin: 4px 0 0;
    font-size: 11px;
    color: rgba(255,255,255,0.25);
    line-height: 1.4;
}
.footer-credit a {
    color: rgba(255,255,255,0.35);
    text-decoration: none;
}
.footer-credit a:hover {
    color: rgba(255,255,255,0.6);
}
.tool-desc {
    font-size: 13px;
    color: rgba(255,255,255,0.35);
    max-width: 480px;
    margin: 4px auto 20px;
    line-height: 1.5;
}
.color-picker-hidden {
    display: none;
}
.dropdown-item .swatch.custom-swatch {
    background: transparent !important;
    border: 1px dashed rgba(255,255,255,0.35) !important;
    display: flex;
    align-items: center;
    justify-content: center;
}
.dropdown-item .swatch.custom-swatch svg {
    width: 8px;
    height: 8px;
    stroke: rgba(255,255,255,0.5);
}
.color-panel {
    position: absolute;
    top: 50%;
    left: calc(100% + 10px);
    transform: translateY(-50%);
    background: #1a1a1a;
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 10px;
    padding: 12px;
    z-index: 200;
    display: none;
    width: auto;
}
.color-panel.visible {
    display: block;
}
.color-panel-grid {
    display: grid;
    grid-template-columns: repeat(4, 24px);
    gap: 6px;
    margin-bottom: 10px;
}
.color-panel-swatch {
    width: 24px;
    height: 24px;
    border-radius: 5px;
    cursor: pointer;
    border: 2px solid transparent;
    box-sizing: border-box;
    transition: border-color 0.15s;
}
.color-panel-swatch:hover {
    border-color: rgba(255,255,255,0.35);
}
.color-panel-swatch.selected {
    border-color: #fff;
}
.color-panel-hex {
    display: flex;
    align-items: center;
}
.color-panel-hex input {
    flex: 1;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: #eee;
    font-family: monospace;
    font-size: 13px;
    padding: 5px 8px;
    outline: none;
    width: 100%;
    box-sizing: border-box;
}
.color-panel-hex input:focus {
    border-color: rgba(255,255,255,0.3);
}
.mode-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 11px;
    user-select: none;
}
.mode-toggle span {
    color: rgba(255,255,255,0.35);
    transition: color 0.2s;
}
.mode-toggle span.active {
    color: #fff;
    font-weight: 600;
}
.mode-toggle-track {
    width: 32px;
    height: 16px;
    border-radius: 8px;
    background: rgba(255,255,255,0.15);
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}
.mode-toggle-track .knob {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: #fff;
    transition: left 0.2s;
}
.mode-toggle-track.light-active .knob {
    left: 18px;
}
body.light-mode .mode-toggle span { color: rgba(0,0,0,0.35); }
body.light-mode .mode-toggle span.active { color: #000; }
body.light-mode .mode-toggle-track { background: rgba(0,0,0,0.15); }
body.light-mode .mode-toggle-track .knob { background: #333; }
@media (max-width: 768px) {
    .color-panel {
        left: 50%;
        top: calc(100% + 8px);
        transform: translateX(-50%);
    }
}
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.settings-toggle {
    max-width: 600px;
    margin: 0 auto 20px;
}
.settings-toggle-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: rgba(255,255,255,0.4);
    cursor: pointer;
    user-select: none;
    padding: 6px 0;
    transition: color 0.2s;
    background: none;
    border: none;
    width: 100%;
}
.settings-label {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 6px;
    transition: background 0.3s, box-shadow 0.3s;
}
.settings-toggle-btn:hover {
    color: rgba(255,255,255,0.65);
}
.settings-label.highlight {
    animation: settings-highlight 1.2s ease forwards;
}
@keyframes settings-highlight {
    0% { background: rgba(255,255,255,0.15); }
    100% { background: transparent; }
}
.settings-toggle-btn .chevron {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: rotate(-45deg);
    transition: transform 0.3s ease;
    margin-top: -2px;
}
.settings-toggle.open .settings-toggle-btn .chevron {
    transform: rotate(45deg);
    margin-top: 0;
}
.settings-collapsible {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.3s ease;
    opacity: 0;
}
.settings-toggle.open .settings-collapsible {
    max-height: 500px;
    opacity: 1;
    overflow: visible;
    transition: max-height 0.35s ease, opacity 0.3s ease, overflow 0s 0.35s;
}
.settings-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-top: 12px;
    padding: 18px 24px;
    background-color: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
}
.toggle-row {
    display: flex;
    justify-content: center;
    gap: 40px;
}
.toggle-group {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    position: relative;
}
.toggle-group label {
    font-size: 13px;
    color: #999;
    letter-spacing: 0.02em;
    margin-bottom: 0;
}
.toggle-switch {
    position: relative;
    width: 38px;
    height: 20px;
}
.toggle-switch input {
    opacity: 0;
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    margin: 0;
    cursor: pointer;
    z-index: 1;
}
.toggle-track {
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0.12);
    border-radius: 10px;
    cursor: pointer;
    transition: background 0.2s;
}
.toggle-track::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #888;
    transition: left 0.2s, background 0.2s;
}
.toggle-switch input:checked + .toggle-track {
    background: rgba(255,255,255,0.25);
}
.toggle-switch input:checked + .toggle-track::after {
    left: 20px;
    background: #fff;
}
@keyframes toggle-highlight {
    0% { box-shadow: 0 0 0 0 rgba(255,255,255,0.4); }
    40% { box-shadow: 0 0 0 6px rgba(255,255,255,0.15); }
    100% { box-shadow: 0 0 0 0 rgba(255,255,255,0); }
}
.toggle-track.highlight {
    animation: toggle-highlight 1.2s ease;
}
body.light-mode .toggle-track { background: rgba(0,0,0,0.1); }
body.light-mode .toggle-track::after { background: #aaa; }
body.light-mode .toggle-switch input:checked + .toggle-track { background: rgba(0,0,0,0.2); }
body.light-mode .toggle-switch input:checked + .toggle-track::after { background: #333; }
body.light-mode .toggle-group label { color: #555; }
.setting-tooltip {
    position: absolute;
    bottom: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(4px);
    background: var(--tooltip-bg, rgba(30,30,30,0.95));
    color: var(--tooltip-color, #ccc);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: 0.01em;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--tooltip-border, rgba(255,255,255,0.1));
    white-space: normal;
    width: 220px;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
    box-shadow: var(--tooltip-shadow, 0 4px 20px rgba(0,0,0,0.4));
    z-index: 100;
    text-align: left;
}
.setting-tooltip::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 6px solid transparent;
    border-top-color: var(--tooltip-bg, rgba(30,30,30,0.95));
}
.slider-group:hover .setting-tooltip,
.toggle-group:hover .setting-tooltip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
    transition-delay: 0.8s;
}
.slider-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
}
.slider-group label {
    margin-bottom: 10px;
    font-size: 13px;
    color: #999;
    letter-spacing: 0.02em;
}
.slider-group label span {
    color: #eee;
    font-weight: 600;
}
.slider-group input[type="range"] {
    width: 100%;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.1);
    outline: none;
    margin: 0;
}
.slider-group input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.3);
    transition: box-shadow 0.15s;
}
.slider-group input[type="range"]::-webkit-slider-thumb:hover {
    box-shadow: 0 0 0 4px rgba(255,255,255,0.15);
}
.slider-group input[type="range"]:active::-webkit-slider-thumb {
    box-shadow: 0 0 0 6px rgba(255,255,255,0.1);
}
.slider-group input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #fff;
    border: none;
    cursor: pointer;
    box-shadow: 0 0 0 2px rgba(0,0,0,0.3);
}
.slider-group input[type="range"]::-moz-range-track {
    height: 4px;
    border-radius: 2px;
    background: rgba(255,255,255,0.1);
    border: none;
}
.slider-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    font-size: 11px;
    color: rgba(255,255,255,0.3);
    margin-top: 10px;
}
.preview-slot {
    position: relative;
    margin-top: 10px;
    background: rgba(255,255,255,0.03);
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}
.preview-slot:first-of-type {
    margin-top: 0;
}
.preview-slot img {
    position: absolute;
    top: 0; left: 0;
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
    border-radius: 4px;
}
/* Page pill - floats over the scroll container */
.pdf-container-wrap {
    position: relative;
    width: 70%;
    margin: 20px auto 0;
    border-radius: 12px;
    background: var(--pdf-container-bg, rgba(255,255,255,0.04));
    border: 0 solid var(--pdf-container-border, rgba(255,255,255,0.06));
    padding: 0;
    transition: padding 0.25s ease, border-width 0.25s ease;
}
.pdf-container-wrap.visible {
    padding: 0 6px 0 16px;
    border-width: 1px;
}
.page-pill {
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    padding: 4px 14px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 500;
    background: var(--pill-bg, rgba(30,30,30,0.85));
    color: var(--pill-color, rgba(255,255,255,0.7));
    border: 1px solid var(--pill-border, rgba(255,255,255,0.1));
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.2);
    opacity: 0;
    transition: opacity 0.3s;
    white-space: nowrap;
    pointer-events: none;
}
.page-pill.visible { opacity: 1; }
/* "X more pages" label */
.more-pages {
    text-align: center;
    padding: 14px 0 4px;
    font-size: 12px;
    color: var(--more-pages-color, rgba(255,255,255,0.3));
    font-weight: 500;
    letter-spacing: 0.02em;
}
.preview-loader {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: rgba(255,255,255,0.25);
    font-size: 12px;
}
.preview-loader .spinner {
    width: 24px;
    height: 24px;
    border: 2px solid rgba(255,255,255,0.08);
    border-top-color: rgba(255,255,255,0.3);
    border-radius: 50%;
    animation: prevSpin 0.8s linear infinite;
}
@keyframes prevSpin { to { transform: rotate(360deg); } }
.preview-loader.cancelled {
    color: rgba(255,255,255,0.18);
}
.preview-loader.cancelled svg {
    opacity: 0.5;
}
.preview-text-layer {
    position: absolute;
    top: 1px;
    left: 1px;
    transform-origin: 0 0;
}
.preview-text-layer span {
    position: absolute;
    color: transparent;
    white-space: pre;
    line-height: 1;
    cursor: text;
}
.preview-text-layer span::selection {
    background: rgba(0, 100, 255, 0.3);
}
@media (max-width: 768px) {
    .github-ribbon {
        display: none;
    }
    .github-ribbon img {
        width: 110px;
        height: auto;
    }
    .bratuka-logo {
        top: auto;
        bottom: 24px;
        right: 16px;
        height: auto;
        transition: opacity 0.25s ease;
    }
    .bratuka-logo img {
        height: 32px;
        transform: none;
    }
    .notice {
        font-size: 12px;
        margin-top: 10px;
    }
    .controls {
        flex-direction: column;
    }
    .settings-panel {
        gap: 15px;
        padding: 14px 18px;
    }
    .slider-group {
        min-width: 0;
    }
    .pdf-container-wrap {
        width: 95%;
    }
    .tool-desc {
        padding: 0 20px;
    }
    /* Mobile: move lang-switcher into flex flow so it doesn't overlap */
    .tools-bar .lang-switcher { position: static; transform: none; margin-left: auto; }
}
@media (max-width: 480px) {
    .github-ribbon img {
        width: 90px;
    }
    .bratuka-logo img {
        height: 28px;
    }
    .footer-links { gap: 14px; }
}
/* Light-mode overrides: applied via JS when theme luminance is high */
body.light-mode { color: #1a1a1a; }
body.light-mode .notice { color: #333; background: rgba(0,0,0,0.06) !important; border-color: rgba(0,0,0,0.15) !important; }
body.light-mode .notice-icon { color: rgba(0,0,0,0.45) !important; }
body.light-mode .custom-file-upload { color: #fff; border-color: rgba(0,0,0,0.08); }
body.light-mode .custom-file-upload:hover { filter: brightness(0.85); }
body.light-mode .dropdown-toggle { background: rgba(0,0,0,0.06); color: #333; border-color: rgba(0,0,0,0.15); }
body.light-mode .dropdown-toggle:hover { border-color: rgba(0,0,0,0.3); }
body.light-mode .dropdown-menu { background: #f0f0f0; border-color: rgba(0,0,0,0.12); }
body.light-mode .dropdown-item { color: #333; }
body.light-mode .dropdown-item:hover { background: rgba(0,0,0,0.08); color: #000; }
body.light-mode .dropdown-item.active { color: #000; }
body.light-mode .dropdown-item .swatch { border-color: rgba(0,0,0,0.2); }
body.light-mode .dropdown-item .swatch.custom-swatch { border-color: rgba(0,0,0,0.3) !important; }
body.light-mode .dropdown-item .swatch.custom-swatch svg { stroke: rgba(0,0,0,0.5); }
body.light-mode #cancelBtn { color: rgba(0,0,0,0.45); border-color: rgba(0,0,0,0.15); }
body.light-mode #cancelBtn:hover { color: rgba(0,0,0,0.7); border-color: rgba(0,0,0,0.3); }
body.light-mode #progressContainer.visible { background-color: rgba(0,0,0,0.05); border-color: rgba(0,0,0,0.1); }
body.light-mode .scanned-tip { color: rgba(0,0,0,0.45); }
body.light-mode .scanned-tip a { color: rgba(0,0,0,0.65); }
body.light-mode .scanned-tip a:hover { color: #000; }
body.light-mode .scanned-tip-tooltip { background: rgba(255,255,255,0.95); color: #444; border-color: rgba(0,0,0,0.1); box-shadow: 0 4px 20px rgba(0,0,0,0.15); }
body.light-mode .scanned-tip-tooltip::after { border-top-color: rgba(255,255,255,0.95); }
body.light-mode .toolbar-tip { background: rgba(255,255,255,0.95); color: #444; border-color: rgba(0,0,0,0.1); box-shadow: 0 4px 20px rgba(0,0,0,0.15); }
body.light-mode .toolbar-tip::after { border-bottom-color: rgba(255,255,255,0.95); }
body.light-mode #progressTrack { background: rgba(0,0,0,0.1); }
body.light-mode #progressText { color: rgba(0,0,0,0.55); }
body.light-mode #downloadBtn { border-color: rgba(0,0,0,0.08); color: #fff; }
body.light-mode #downloadBtn:hover { filter: brightness(0.85); }
body.light-mode .site-footer { color: rgba(0,0,0,0.4); border-top-color: rgba(0,0,0,0.08); background: rgba(0,0,0,0.02); }
body.light-mode .footer-links a { color: rgba(0,0,0,0.45); }
body.light-mode .footer-links a:hover { color: rgba(0,0,0,0.8); }
body.light-mode .footer-logo img { filter: invert(1); }
body.light-mode .bratuka-logo img { filter: invert(1); }
body.light-mode .tool-desc { color: rgba(0,0,0,0.45); }
body.light-mode .settings-toggle-btn { color: rgba(0,0,0,0.45); }
body.light-mode .settings-toggle-btn:hover { color: rgba(0,0,0,0.7); }
body.light-mode .settings-panel { background-color: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.08); }
body.light-mode .slider-group label { color: #555; }
body.light-mode .slider-group label span { color: #111; }
body.light-mode .slider-group input[type="range"] { background: rgba(0,0,0,0.12); }
body.light-mode .slider-group input[type="range"]::-webkit-slider-thumb { background: #333; box-shadow: 0 0 0 2px rgba(0,0,0,0.15); }
body.light-mode .slider-group input[type="range"]::-moz-range-thumb { background: #333; box-shadow: 0 0 0 2px rgba(0,0,0,0.15); }
body.light-mode .slider-group input[type="range"]::-moz-range-track { background: rgba(0,0,0,0.12); }
body.light-mode .slider-labels { color: rgba(0,0,0,0.35); }

body.light-mode .color-panel { background: #f0f0f0; border-color: rgba(0,0,0,0.12); }
body.light-mode .color-panel-swatch:hover { border-color: rgba(0,0,0,0.4); }
body.light-mode .color-panel-swatch.selected { border-color: #000; }
body.light-mode .color-panel-hex input { background: rgba(0,0,0,0.06); border-color: rgba(0,0,0,0.15); color: #222; }
body.light-mode .color-panel-hex input:focus { border-color: rgba(0,0,0,0.35); }

/* --- Drop zone --- */
.drop-zone {
    width: 90%;
    max-width: 520px;
    margin: 6px auto 0;
    border: 2px dashed var(--drop-border, rgba(255,255,255,0.12));
    border-radius: 14px;
    padding: 18px 20px;
    text-align: center;
    transition: border-color 0.2s, background 0.2s, opacity 0.3s ease, transform 0.3s ease;
    position: relative;
    opacity: 1;
    transform: scaleY(1);
    align-self: center;
}
.drop-zone.processing {
    opacity: 0;
    transform: scaleY(0.92);
    pointer-events: none;
    border-color: transparent;
    z-index: 0;
}
.drop-zone-idle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--drop-text, rgba(255,255,255,0.3));
    font-size: 13px;
    pointer-events: none;
}
.drop-zone-icon {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}
.drop-zone-active {
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--drop-active-text, rgba(255,255,255,0.7));
    font-size: 15px;
    font-weight: 600;
    padding: 8px 0;
    pointer-events: none;
}
.drop-zone.dragging {
    border-color: var(--drop-active-border, rgba(255,255,255,0.4));
    background: var(--drop-active-bg, rgba(255,255,255,0.04));
}
.drop-zone.dragging .drop-zone-idle { display: none; }
.drop-zone.dragging .drop-zone-active { display: flex; }
.drop-zone-error {
    display: none;
    color: #ff6b6b;
    font-size: 13px;
    margin-top: 8px;
}
.drop-zone-error.visible {
    display: block;
}
body.light-mode .drop-zone { border-color: var(--drop-border, rgba(0,0,0,0.12)); }
body.light-mode .drop-zone-idle { color: var(--drop-text, rgba(0,0,0,0.3)); }
body.light-mode .drop-zone.dragging { border-color: var(--drop-active-border, rgba(0,0,0,0.4)); background: var(--drop-active-bg, rgba(0,0,0,0.04)); }

/* --- Batch progress --- */
#batchInfo {
    display: none;
    width: 90%;
    max-width: 520px;
    margin: 16px auto 0;
    text-align: center;
}
#batchInfo .batch-label {
    font-size: 13px;
    color: rgba(255,255,255,0.5);
    margin-bottom: 8px;
}
#batchInfo .batch-file-current {
    font-size: 14px;
    color: rgba(255,255,255,0.75);
    font-weight: 500;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
body.light-mode #batchInfo .batch-label { color: rgba(0,0,0,0.45); }
body.light-mode #batchInfo .batch-file-current { color: rgba(0,0,0,0.7); }


/* --- SEO content sections --- */
.seo-content {
    max-width: 780px;
    margin: 60px auto 0;
    padding: 0 20px 60px;
    text-align: left;
    transition: opacity 0.3s;
}

.seo-content h2 {
    font-size: 22px;
    font-weight: 700;
    margin: 48px 0 16px;
    color: rgba(255,255,255,0.92);
}
.seo-content h2:first-child {
    margin-top: 0;
}
.seo-content p {
    font-size: 15px;
    line-height: 1.7;
    color: rgba(255,255,255,0.55);
    margin: 0 0 14px;
}
.seo-content a,
.faq-a a {
    color: rgba(255,255,255,0.7);
    text-decoration: underline;
    text-decoration-color: rgba(255,255,255,0.25);
    text-underline-offset: 2px;
    transition: color 0.2s, text-decoration-color 0.2s;
}
.seo-content a:hover,
.faq-a a:hover {
    color: rgba(255,255,255,0.95);
    text-decoration-color: rgba(255,255,255,0.5);
}
body.light-mode .seo-content a,
body.light-mode .faq-a a {
    color: rgba(0,0,0,0.6);
    text-decoration-color: rgba(0,0,0,0.2);
}
body.light-mode .seo-content a:hover,
body.light-mode .faq-a a:hover {
    color: rgba(0,0,0,0.85);
    text-decoration-color: rgba(0,0,0,0.4);
}
/* Feature grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin: 20px 0;
}
@media (max-width: 720px) {
    .feature-grid { grid-template-columns: repeat(2, 1fr); }
}
.feature-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 22px 20px;
}
.feature-card .fc-icon {
    width: 32px;
    height: 32px;
    margin-bottom: 12px;
    display: block;
    color: rgba(255,255,255,0.5);
    stroke-width: 1.5;
}
body.light-mode .feature-card .fc-icon { color: rgba(0,0,0,0.45); }
.feature-card h3 {
    font-size: 15px;
    font-weight: 600;
    color: rgba(255,255,255,0.88);
    margin: 0 0 6px;
}
.feature-card p {
    font-size: 13px;
    line-height: 1.6;
    color: rgba(255,255,255,0.45);
    margin: 0;
}
/* Steps */
.steps {
    display: flex;
    gap: 18px;
    margin: 20px 0;
    counter-reset: step;
}
.step {
    flex: 1;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 22px 20px;
    position: relative;
    counter-increment: step;
}
.step::before {
    content: counter(step);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    font-weight: 700;
    margin-bottom: 10px;
}
.step h3 {
    font-size: 14px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    margin: 0 0 4px;
}
.step p {
    font-size: 13px;
    line-height: 1.55;
    color: rgba(255,255,255,0.45);
    margin: 0;
}
/* FAQ accordion */
.faq-list {
    margin: 20px 0;
}
.faq-item {
    border-bottom: 1px solid rgba(255,255,255,0.07);
}
.faq-q {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 16px 0;
    background: none;
    border: none;
    color: rgba(255,255,255,0.85);
    font-size: 15px;
    font-weight: 500;
    text-align: left;
    cursor: pointer;
    line-height: 1.4;
}
.faq-q:hover {
    color: #fff;
}
.faq-q::after {
    content: '+';
    font-size: 18px;
    font-weight: 400;
    color: rgba(255,255,255,0.35);
    margin-left: 16px;
    flex-shrink: 0;
    transition: transform 0.2s;
}
.faq-item.open .faq-q::after {
    content: '\2212';
}
.faq-a {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
}
.faq-item.open .faq-a {
    max-height: 300px;
}
.faq-a p {
    padding: 0 0 16px;
    font-size: 14px;
    line-height: 1.65;
    color: rgba(255,255,255,0.48);
    margin: 0;
}
@media (max-width: 600px) {
    .steps { flex-direction: column; }
}
@media (max-width: 480px) {
    .feature-grid { grid-template-columns: 1fr; }
}
/* Light mode overrides for SEO content */
body.light-mode .seo-content h2 { color: rgba(0,0,0,0.88); }
body.light-mode .seo-content p { color: rgba(0,0,0,0.5); }
body.light-mode .feature-card { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); }
body.light-mode .feature-card h3 { color: rgba(0,0,0,0.82); }
body.light-mode .feature-card p { color: rgba(0,0,0,0.45); }
body.light-mode .step { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); }
body.light-mode .step::before { background: rgba(0,0,0,0.07); color: rgba(0,0,0,0.6); }
body.light-mode .step h3 { color: rgba(0,0,0,0.8); }
body.light-mode .step p { color: rgba(0,0,0,0.45); }
body.light-mode .faq-item { border-color: rgba(0,0,0,0.08); }
body.light-mode .faq-q { color: rgba(0,0,0,0.8); }
body.light-mode .faq-q:hover { color: #000; }
body.light-mode .faq-q::after { color: rgba(0,0,0,0.3); }
body.light-mode .faq-a p { color: rgba(0,0,0,0.45); }

/* Blog posts section */
.blog-posts-section h2 { margin-bottom: 6px; }
.blog-posts-subtitle {
    font-size: 14px;
    color: rgba(255,255,255,0.35);
    margin-bottom: 20px;
}
.blog-carousel-wrap {
    position: relative;
}
.blog-carousel-fade {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 40px;
    z-index: 1;
    pointer-events: none;
    transition: opacity 0.2s;
}
.blog-carousel-fade.fade-left {
    left: 0;
    background: linear-gradient(to right, var(--carousel-fade, #1a1a1a), transparent);
}
.blog-carousel-fade.fade-right {
    right: 0;
    background: linear-gradient(to left, var(--carousel-fade, #1a1a1a), transparent);
}
.blog-carousel-fade.hidden { opacity: 0; }
.blog-carousel-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    background: var(--carousel-btn-bg, #3a3a3a);
    border: 1px solid var(--carousel-btn-border, #4a4a4a);
    color: var(--carousel-btn-color, #bbb);
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, color 0.2s, opacity 0.2s, box-shadow 0.2s, border-color 0.2s;
    padding: 0;
    line-height: 1;
    box-shadow: var(--carousel-btn-shadow, 0 2px 8px rgba(0,0,0,0.35));
}
.blog-carousel-btn:hover {
    background: var(--carousel-btn-bg-hover, #4a4a4a);
    color: var(--carousel-btn-color-hover, #fff);
    box-shadow: var(--carousel-btn-shadow-hover, 0 3px 12px rgba(0,0,0,0.45));
}
.blog-carousel-btn svg { width: 18px; height: 18px; }
.blog-carousel-btn.hidden { opacity: 0; pointer-events: none; }
.blog-carousel-btn.prev { left: -18px; }
.blog-carousel-btn.next { right: -18px; }
.blog-posts-grid {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scroll-behavior: smooth;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding: 4px 0;
    margin-bottom: 8px;
    cursor: grab;
}
.blog-posts-grid::-webkit-scrollbar { display: none; }
.blog-post-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 12px;
    padding: 22px 20px;
    text-decoration: none;
    display: block;
    transition: border-color 0.2s;
    min-width: 260px;
    max-width: 260px;
    flex-shrink: 0;
}
.blog-post-card:hover {
    border-color: rgba(255,255,255,0.18);
    text-decoration: none;
}
.blog-post-card .bp-title {
    font-size: 15px;
    font-weight: 600;
    color: rgba(255,255,255,0.85);
    margin-bottom: 6px;
    line-height: 1.35;
}
.blog-post-card:hover .bp-title { color: #fff; }
.blog-post-card .bp-desc {
    font-size: 13px;
    color: rgba(255,255,255,0.4);
    line-height: 1.5;
    margin-bottom: 8px;
}
.blog-post-card .bp-date {
    font-size: 12px;
    color: rgba(255,255,255,0.22);
}
.blog-view-all {
    display: inline-block;
    font-size: 14px;
    color: rgba(255,255,255,0.4);
    margin-top: 12px;
    transition: color 0.15s;
}
.blog-view-all:hover { color: rgba(255,255,255,0.7); text-decoration: none; }
@media (max-width: 720px) {
    .blog-post-card { min-width: 220px; max-width: 220px; }
    .blog-carousel-btn.prev { left: -8px; }
    .blog-carousel-btn.next { right: -8px; }
}
body.light-mode .blog-posts-subtitle { color: rgba(0,0,0,0.35); }

body.light-mode .blog-post-card { background: rgba(0,0,0,0.03); border-color: rgba(0,0,0,0.08); }
body.light-mode .blog-post-card:hover { border-color: rgba(0,0,0,0.18); }
body.light-mode .blog-post-card .bp-title { color: rgba(0,0,0,0.8); }
body.light-mode .blog-post-card:hover .bp-title { color: #000; }
body.light-mode .blog-post-card .bp-desc { color: rgba(0,0,0,0.4); }
body.light-mode .blog-post-card .bp-date { color: rgba(0,0,0,0.22); }
body.light-mode .blog-view-all { color: rgba(0,0,0,0.4); }
body.light-mode .blog-view-all:hover { color: rgba(0,0,0,0.7); }

/* Language switcher - critical sizing (prevents CLS before async lang.css loads) */
.lang-switcher { position: relative; }
.lang-toggle { display: flex; align-items: center; gap: 4px; padding: 3px 8px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.08); border-radius: 5px; color: rgba(255,255,255,0.38); font-size: 11px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.lang-globe { width: 13px; height: 13px; flex-shrink: 0; }
.lang-chevron { width: 7px; height: 4px; flex-shrink: 0; opacity: 0.4; }
.lang-dropdown { position: absolute; opacity: 0; max-height: 0; pointer-events: none; overflow: hidden; }

/* Tools bar (persistent across all tool pages) */
.tools-bar {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0;
    padding: 10px 20px;
    margin: 0;
    position: sticky;
    top: 0;
    z-index: 900;
    background: var(--toolbar-bg, rgba(30, 27, 24, 0.65));
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--toolbar-border, rgba(255,255,255,0.06));
    transition: background 0.3s, border-color 0.3s;
}
.tools-bar a,
.tools-bar span {
    font-size: 13px;
    color: var(--toolbar-text, rgba(255,255,255,0.38));
    text-decoration: none;
    transition: color 0.2s;
    padding: 4px 14px;
}
/* Position lang-switcher absolutely so it doesn't shift toolbar content */
.tools-bar .lang-switcher { position: absolute; right: 60px; top: 50%; transform: translateY(-50%); margin: 0; }
.tools-bar a:hover {
    color: var(--toolbar-text-hover, rgba(255,255,255,0.7));
}
.tools-bar .active {
    color: var(--toolbar-text-active, rgba(255,255,255,0.85));
    font-weight: 600;
}
.tools-bar .disabled {
    color: var(--toolbar-text-disabled, rgba(255,255,255,0.18));
    cursor: not-allowed;
    position: relative;
}
.tools-bar .disabled .toolbar-tip {
    position: absolute;
    top: calc(100% + 10px);
    left: 50%;
    transform: translateX(-50%) translateY(-4px);
    background: var(--tooltip-bg, rgba(30,30,30,0.95));
    color: var(--tooltip-color, #ccc);
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid var(--tooltip-border, rgba(255,255,255,0.1));
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
    box-shadow: var(--tooltip-shadow, 0 4px 20px rgba(0,0,0,0.4));
    z-index: 100;
}
.tools-bar .disabled .toolbar-tip::after {
    content: '';
    position: absolute;
    bottom: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-bottom-color: var(--tooltip-bg, rgba(30,30,30,0.95));
}
.tools-bar .disabled:hover .toolbar-tip {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) translateY(0);
}
.tools-bar .sep {
    color: var(--toolbar-sep, rgba(255,255,255,0.12));
    padding: 0;
    font-size: 14px;
    user-select: none;
}
/* Invert page: neutral gray glass instead of warm brown */
[data-theme="negative"] .tools-bar {
    --toolbar-bg: rgba(24, 24, 24, 0.7);
    --toolbar-border: rgba(255,255,255,0.08);
}

/* Language switcher - styles in css/lang.css, loaded by lang-switcher.js */

/* Sub-page nav bar */
.converter-nav {
    display: flex;
    align-items: center;
    gap: 20px;
    padding: 18px 24px;
    max-width: 900px;
    margin: 0 auto;
}
.converter-nav .site-name {
    font-weight: 700;
    font-size: 16px;
    color: #fff;
    text-decoration: none;
    margin-right: auto;
}
.converter-nav a {
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    font-size: 14px;
}
.converter-nav a:hover {
    color: rgba(255,255,255,0.85);
}