@charset "UTF-8";

:root {
    --bg: #eef3f8;
    --surface: #ffffff;
    --surface-soft: #f6f9fc;
    --text: #172033;
    --muted: #637083;
    --line: #dce5ef;
    --accent: #256fd9;
    --accent-strong: #1858b5;
    --success: #12996a;
    --warning: #9a6400;
    --danger: #d33242;
    --shadow: 0 10px 28px rgba(28, 48, 76, 0.08);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100vh;
    margin: 0;
    padding: 0;
    background-color: var(--bg);
    background-image:
        linear-gradient(120deg, rgba(245, 246, 248, 0.74), rgba(245, 246, 248, 0.54)),
        url("../img/bg_main.jpg");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    color: var(--text);
    font-family: var(--font-base);
    font-size: 15px;
    line-height: 1.45;
    letter-spacing: 0;
}

body.modal-open {
    overflow: hidden;
}

button,
input,
select {
    font: inherit;
}

button {
    touch-action: manipulation;
}

.rsall-legacy-header {
    background-color: var(--surface);
    background-image:
        linear-gradient(90deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0.42)),
        url("../img/bg_head.jpg");
    background-size: cover;
    background-position: center;
    border-bottom: 1px solid var(--line);
}

.header-content {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    width: 100%;
    margin: 0 auto;
    padding: 14px 24px 14px 18px;
}

.header-logo {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
}

.logo {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(215, 43, 87, 0.16);
}

.site-name {
    flex: 1 1 auto;
    color: #0651c2;
    background: linear-gradient(180deg, #ffe97a 0%, #0f72d6 34%, #0457c3 68%, #0250eb 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    font-size: clamp(1.35rem, 2.1vw, 2rem);
    font-weight: 900;
    text-align: center;
    text-transform: uppercase;
    text-shadow:
        0 1px 1px rgba(255, 244, 164, 0.15),
        0 2px 0 rgba(14, 85, 227, 0.94),
        0 10px 18px rgba(12, 79, 212, 0.42);
}

.header-back {
    flex: 0 0 auto;
    min-width: 112px;
    display: flex;
    justify-content: flex-end;
}

.btn-backhome {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 40px;
    padding: 8px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text);
    font-weight: 700;
    text-decoration: none;
    transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.btn-backhome:hover,
.btn-backhome:focus {
    background: #fff1f5;
    border-color: #f2b7c6;
    color: var(--accent-strong);
}

.btn-backhome svg {
    width: 20px;
    height: 20px;
}

main {
    width: 100%;
    max-width: none;
    margin: 18px 0 28px;
    padding: 0 16px 0 0;
    background-image:
        linear-gradient(135deg, rgba(245, 248, 252, 0.5), rgba(255, 255, 255, 0.2)),
        url("../img/bg_main.jpg");
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
}

.container-2col {
    display: grid;
    grid-template-columns: clamp(430px, 34vw, 560px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.col-left,
.col-right {
    min-width: 0;
}

.col-left {
    position: sticky;
    top: 16px;
    padding: 18px 20px 18px 18px;
    border: 1px solid var(--line);
    border-left: 0;
    border-radius: 0 8px 8px 0;
    background: rgba(255, 255, 255, 0.9);
    box-shadow: var(--shadow);
}

.col-right {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.88);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.desc {
    margin: 0 0 12px;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

.choose-btns {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 8px;
}

.choose-block {
    min-width: 0;
}

.fake-btn,
.btn-main,
.btn-reset,
.page-btn,
.row-action,
.btn-dl,
.image-modal__close {
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 800;
    transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.fake-btn,
.btn-main {
    width: 100%;
    min-height: 40px;
    padding: 9px 12px;
    background: var(--accent);
    color: #fff;
}

.rsall-page .header-title,
.rsall-page h1,
.rsall-page h2,
.rsall-page h3,
.rsall-page h4,
.rsall-page label,
.rsall-page .fake-btn,
.rsall-page .btn-main,
.rsall-page .btn-reset,
.rsall-page .page-btn,
.rsall-page .row-action,
.rsall-page .btn-dl {
    font-family: var(--font-heading);
}

.fake-btn:hover,
.fake-btn:focus,
.btn-main:hover,
.btn-main:focus {
    background: var(--accent-strong);
}

.btn-secondary {
    background: #253044;
}

.btn-secondary:hover,
.btn-secondary:focus {
    background: #101828;
}

.btn-reset {
    min-height: 40px;
    padding: 9px 12px;
    background: var(--surface-soft);
    color: var(--accent-strong);
    border: 1px solid var(--line);
}

.btn-reset:hover,
.btn-reset:focus {
    background: #fff1f5;
    border-color: #f2b7c6;
}

.fake-btn:disabled,
.btn-main:disabled,
.btn-reset:disabled,
.page-btn:disabled {
    cursor: not-allowed;
    opacity: 0.58;
}

.note {
    margin: 3px 0 0;
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.4;
}

#options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 12px;
    margin-top: 12px;
}

.control-section {
    display: grid;
    gap: 6px;
}

.control-section:nth-child(2),
.control-section:nth-child(3) {
    grid-column: 1 / -1;
}

label {
    color: var(--text);
    font-size: 0.86rem;
    font-weight: 800;
}

input,
select {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
    color: var(--text);
    outline: none;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

input:focus,
select:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(215, 43, 87, 0.14);
}

input[type="file"] {
    padding: 0;
}

input[type="checkbox"] {
    width: 18px;
    min-height: 18px;
    accent-color: var(--accent);
}

input[type="range"] {
    padding: 0;
    accent-color: var(--accent);
}

.control-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
}

.control-field {
    display: grid;
    gap: 4px;
}

.control-field span,
.toggle-row span {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.control-field[hidden],
.toggle-row[hidden] {
    display: none;
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface-soft);
}

.quality-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 52px;
    align-items: center;
    gap: 8px;
}

#qualityValue {
    color: var(--text);
    font-size: 0.9rem;
    font-weight: 800;
    text-align: right;
}

.action-row {
    display: grid;
    grid-column: 1 / -1;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
    align-items: center;
    width: 100%;
    padding-top: 2px;
}

.action-row > * {
    width: 100%;
}

.progress-bar-bg {
    display: none;
    width: 100%;
    height: 10px;
    margin: 12px 0 8px;
    border-radius: 999px;
    background: #e8ebf1;
    overflow: hidden;
}

.progress-bar-fg {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 0.28s ease;
}

.progress-status {
    min-height: 22px;
    padding-right: 16px;
    color: var(--muted);
    font-size: 0.88rem;
    font-weight: 700;
}

.thumbs-scroll {
    max-height: calc(100vh - 146px);
    min-height: 480px;
    overflow: auto;
    background: transparent;
    contain: layout paint;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable both-edges;
}

.preview-info {
    padding: 64px 18px;
    color: var(--muted);
    font-size: 1rem;
    font-weight: 700;
    text-align: center;
}

.preview-toolbar {
    position: sticky;
    top: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    background: #ffffff;
}

.preview-summary {
    color: var(--text);
    font-weight: 900;
}

.preview-page-state {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 800;
}

#preview-table {
    width: 100%;
    min-width: 980px;
    table-layout: fixed;
    border-collapse: separate;
    border-spacing: 0;
}

#preview-table th,
#preview-table td {
    padding: 11px 10px;
    border-bottom: 1px solid var(--line);
    background: transparent;
    font-size: 0.94rem;
    text-align: center;
    vertical-align: middle;
}

#preview-table th {
    position: sticky;
    top: 53px;
    z-index: 2;
    background: #f2f4f7;
    color: #3d4657;
    font-size: 0.82rem;
    font-weight: 900;
    text-transform: uppercase;
}

#preview-table th:nth-child(1),
#preview-table td:nth-child(1) {
    width: 56px;
}

#preview-table th:nth-child(2),
#preview-table td:nth-child(2) {
    width: 112px;
}

#preview-table th:nth-child(3),
#preview-table td:nth-child(3) {
    width: auto;
}

#preview-table th:nth-child(4),
#preview-table td:nth-child(4),
#preview-table th:nth-child(5),
#preview-table td:nth-child(5) {
    width: 128px;
}

#preview-table th:nth-child(6),
#preview-table td:nth-child(6),
#preview-table th:nth-child(7),
#preview-table td:nth-child(7),
#preview-table th:nth-child(8),
#preview-table td:nth-child(8) {
    width: 116px;
}

#preview-table tbody tr {
    content-visibility: auto;
    contain-intrinsic-size: 76px;
}

#preview-table tbody tr:hover {
    background: transparent;
}

.thumb-button {
    width: 74px;
    height: 54px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    cursor: zoom-in;
    overflow: hidden;
}

.thumb-button:hover,
.thumb-button:focus {
    border-color: var(--accent);
}

.thumb-button img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}

.file-name {
    max-width: 340px;
    color: var(--text);
    font-weight: 700;
    text-align: left;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.btn-dl {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 7px 12px;
    background: #e8f7ef;
    color: var(--success);
    text-decoration: none;
}

.btn-dl:hover,
.btn-dl:focus {
    background: #d8f1e5;
}

.row-action {
    min-height: 32px;
    padding: 7px 10px;
    background: #fff1f5;
    color: var(--danger);
}

.row-action:hover,
.row-action:focus {
    background: #ffdce6;
}

.pagination {
    position: sticky;
    bottom: 0;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 13px 16px;
    border-top: 1px solid var(--line);
    background: #ffffff;
}

.page-btn {
    min-height: 36px;
    padding: 8px 12px;
    background: var(--surface-soft);
    color: var(--text);
    border: 1px solid var(--line);
}

.page-btn:hover,
.page-btn:focus {
    background: #fff1f5;
    border-color: #f2b7c6;
    color: var(--accent-strong);
}

.page-info {
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 800;
    padding: 0 6px;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 92px;
    max-width: 180px;
    border-radius: 999px;
    padding: 5px 9px;
    font-size: 0.84rem;
    font-weight: 900;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.status-pending {
    background: #eef1f6;
    color: #596173;
}

.status-processing {
    background: #fff4d8;
    color: var(--warning);
}

.status-done {
    background: #e4f8ee;
    color: var(--success);
}

.status-error {
    background: #fde8ee;
    color: var(--danger);
}

.image-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: rgba(13, 18, 30, 0.76);
}

.image-modal[aria-hidden="false"] {
    display: flex;
}

.image-modal__dialog {
    position: relative;
    display: grid;
    gap: 12px;
    max-width: min(1120px, 94vw);
    max-height: 92vh;
    padding: 14px;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
}

.image-modal__dialog img {
    max-width: 100%;
    max-height: calc(92vh - 96px);
    border-radius: 6px;
    object-fit: contain;
    background: #111827;
}

.image-modal__close {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 38px;
    height: 38px;
    background: rgba(17, 24, 39, 0.84);
    color: #fff;
    font-size: 1.6rem;
    line-height: 1;
}

.image-modal__close:hover,
.image-modal__close:focus {
    background: #000;
}

.image-modal__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 0.92rem;
    font-weight: 700;
}

#imageModalTitle {
    min-width: 0;
    color: var(--text);
    overflow-wrap: anywhere;
}

.footer,
footer {
    margin-top: 28px;
    padding: 18px 12px;
    border-top: 1px solid var(--line);
    background-color: var(--surface);
    background-image:
        linear-gradient(90deg, rgba(255, 255, 255, 0.64), rgba(255, 255, 255, 0.4)),
        url("../img/bg_footer.jpg");
    background-size: cover;
    background-position: center;
    color: var(--muted);
    font-size: 0.96rem;
    font-weight: 600;
    text-align: center;
}

footer span,
footer b {
    color: var(--accent-strong);
    font-weight: 800;
}

::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #eef1f6;
}

::-webkit-scrollbar-thumb {
    background: #c7ceda;
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: #aab3c2;
}

@media (max-width: 1100px) {
    main {
        margin-top: 16px;
        padding: 0 14px;
    }

    .container-2col {
        grid-template-columns: 1fr;
    }

    .col-left {
        position: static;
        border-left: 1px solid var(--line);
        border-radius: 8px;
    }

    .thumbs-scroll {
        max-height: 560px;
        min-height: 380px;
    }
}

@media (max-width: 700px) {
    .header-content {
        gap: 8px;
        padding: 12px;
    }

    .logo {
        width: 36px;
        height: 36px;
    }

    .site-name {
        font-size: 0.98rem;
        text-align: left;
    }

    .header-back {
        min-width: auto;
    }

    .btn-backtext {
        display: none;
    }

    .col-left {
        padding: 16px;
    }

    .choose-btns,
    .control-grid,
    .action-row {
        grid-template-columns: 1fr;
    }

    .thumbs-scroll {
        max-height: 430px;
        min-height: 320px;
    }

    #preview-table {
        min-width: 680px;
    }

    #preview-table th,
    #preview-table td {
        font-size: 0.88rem;
    }

    .preview-toolbar,
    .image-modal__meta {
        align-items: flex-start;
        flex-direction: column;
    }

    .image-modal {
        padding: 12px;
    }
}
