.jpg-page {
    flex: 1 0 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.tool-intro {
    padding: 34px 24px 12px;
    text-align: center;
}

.tool-intro h1 {
    margin: 0 0 10px;
    font-size: clamp(28px, 3vw, 38px);
    letter-spacing: 0.01em;
}

.tool-intro p {
    margin: 0;
    color: #7a5c66;
    line-height: 1.7;
}

.upload-start {
    width: min(760px, calc(100% - 32px));
    margin: 18px auto 90px;
}

.drop-zone {
    min-height: 330px;
    padding: 44px 28px;
    border: 2px dashed #e8bcc9;
    border-radius: 20px;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    outline: none;
    transition: 0.16s ease;
}

.drop-zone:hover,
.drop-zone:focus,
.drop-zone.is-dragover {
    border-color: var(--primary);
    background: #fff5f7;
    box-shadow: 0 12px 32px rgba(159, 18, 57, 0.12);
}

.drop-zone__icon {
    width: 54px;
    height: 54px;
    margin-bottom: 18px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #ffe5ec;
    color: var(--primary);
    font-size: 28px;
    font-weight: 800;
}

.drop-zone p {
    margin: 14px 0 8px;
    color: #7a5c66;
}

.drop-zone small {
    color: #9a7682;
    line-height: 1.6;
}

.tool-unavailable {
    width: min(680px, calc(100% - 32px));
    margin: 34px auto 90px;
    padding: 42px;
    text-align: center;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 16px;
}

.editor-layout {
    position: relative;
    width: min(1600px, 100%);
    margin: 8px auto;
    flex: 1 0 auto;
    min-height: 0;
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    align-items: stretch;
    border: 1px solid var(--border);
    background: var(--page-bg);
}

.editor-layout::before {
    content: "";
    position: absolute;
    z-index: 0;
    top: 0;
    bottom: 0;
    left: 0;
    width: 320px;
    background: #ffffff;
    border-right: 1px solid var(--border);
    pointer-events: none;
}

.options-panel,
.image-workspace {
    position: relative;
    z-index: 1;
}

.options-panel {
    align-self: stretch;
    background: transparent;
}

.options-panel__sticky {
    position: sticky;
    top: var(--header-height);
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
    padding-bottom: 22px;
}

.options-panel h2 {
    margin: 0;
    padding: 22px 20px;
    text-align: center;
    font-size: 20px;
    border-bottom: 1px solid var(--border);
}

.option-section {
    background: #ffffff;
}

.option-section--notice {
    padding: 14px 16px 16px;
    border-bottom: 1px solid var(--border);
}

.notice-box {
    padding: 14px 14px;
    border-radius: 8px;
    background: #f8e7ec;
    color: #6c3144;
    font-size: 14px;
    font-weight: 700;
    text-align: center;
}

.option-heading {
    padding: 17px 16px 12px;
    font-size: 13px;
    font-weight: 800;
    color: #6f4955;
    border-bottom: 1px solid var(--border);
}

.field-row {
    min-height: 68px;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.field-row input[type="number"],
.field-row input[type="text"] {
    width: 112px;
    height: 40px;
    padding: 0 10px;
    text-align: right;
    border: 1px solid #d7a2b0;
    border-radius: 7px;
    outline: none;
    background: #ffffff;
}

.field-row input[type="number"]:focus,
.field-row input[type="text"]:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(159, 18, 57, 0.14);
}

.field-row--color {
    align-items: center;
}

.color-input-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
}

.color-input-wrap input[type="color"] {
    width: 44px;
    height: 40px;
    padding: 3px;
    border: 1px solid #d7a2b0;
    border-radius: 8px;
    background: #ffffff;
    cursor: pointer;
}

.color-input-wrap input[type="text"] {
    width: 96px;
    text-align: left;
    text-transform: uppercase;
}

.option-hint {
    padding: 11px 16px 13px;
    color: #8a6a75;
    font-size: 12px;
    line-height: 1.65;
    border-bottom: 1px solid var(--border);
}

.option-message {
    min-height: 42px;
    padding: 12px 16px 4px;
    color: var(--danger);
    font-size: 13px;
    line-height: 1.5;
}

.option-message.is-success {
    color: #0f766e;
}

.process-button {
    width: calc(100% - 28px);
    min-height: 60px;
    margin: 14px;
    padding: 14px 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    font-size: 17px;
}

.image-workspace {
    min-width: 0;
    padding: 20px 24px 50px;
    background: var(--page-bg);
}

.workspace-toolbar {
    min-height: 50px;
    margin-bottom: 14px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
}

.workspace-toolbar strong {
    font-size: 18px;
}

.workspace-toolbar__actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.clear-all-button {
    padding: 10px 16px;
    border: 1px solid #dbcbd0;
    border-radius: 10px;
    background: #ffffff;
    color: #765964;
    cursor: pointer;
    font-weight: 700;
    transition: 0.15s ease;
}

.clear-all-button:hover:not(:disabled) {
    border-color: #c58a9b;
    background: #fff7f9;
    color: var(--primary);
}

.clear-all-button:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.file-count {
    margin-left: 10px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
}

.image-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 10px;
}

.image-card {
    position: relative;
    min-width: 0;
    overflow: hidden;
    background: #ffffff;
    border: 1px solid #e4e8ef;
    border-radius: 10px;
    box-shadow: 0 2px 8px rgba(24, 35, 58, 0.035);
}

.image-card__preview {
    position: relative;
    height: 205px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    background: #f4f5f7;
    background-image:
        linear-gradient(45deg, #e7eaef 25%, transparent 25%),
        linear-gradient(-45deg, #e7eaef 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e7eaef 75%),
        linear-gradient(-45deg, transparent 75%, #e7eaef 75%);
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.image-card__preview img {
    display: block;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.08));
}

.image-card__remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 30px;
    height: 30px;
    border: 0;
    border-radius: 50%;
    color: #ffffff;
    background: rgba(24, 31, 43, 0.72);
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}

.image-card__remove:hover {
    background: #c43d3d;
}

.image-card__meta {
    padding: 10px 11px 12px;
}

.image-card__name,
.image-card__output-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: center;
    font-size: 12px;
}

.image-card__name {
    color: #485261;
}

.image-card__output-name {
    margin-top: 6px;
    color: var(--primary);
    font-weight: 700;
}

.image-card__sizes {
    margin-top: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    font-size: 11px;
}

.size-badge {
    padding: 3px 6px;
    border-radius: 4px;
    color: #ffffff;
    background: #969dac;
    font-weight: 700;
}

.size-badge--after {
    background: var(--primary);
}

.upload-progress {
    margin-bottom: 15px;
    padding: 11px 13px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 8px;
}

.upload-progress__bar {
    height: 6px;
    overflow: hidden;
    border-radius: 999px;
    background: #e9eef7;
}

.upload-progress__bar span {
    display: block;
    width: 0;
    height: 100%;
    background: var(--primary);
    transition: width 0.15s ease;
}

.upload-progress__text {
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
}

.initial-feedback,
.upload-feedback {
    width: min(760px, calc(100% - 32px));
    margin: 14px auto 0;
    border-radius: 14px;
    border: 1px solid #f2b5c5;
    background: #fff7f9;
    color: var(--danger);
    padding: 14px 16px;
    white-space: pre-line;
    line-height: 1.6;
}

.upload-feedback.is-success {
    border-color: #99d1c8;
    color: #0f766e;
    background: #f3fbf9;
}

@media (max-width: 980px) {
    .editor-layout {
        display: flex;
        flex-direction: column;
        border-left: 0;
        border-right: 0;
    }

    .editor-layout::before {
        display: none;
    }

    .image-workspace {
        order: 1;
    }

    .options-panel {
        order: 2;
        background: #ffffff;
        border-top: 1px solid var(--border);
    }

    .options-panel__sticky {
        position: static;
        max-height: none;
    }

    .image-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }

    .image-card__preview {
        height: 170px;
    }
}

@media (max-width: 620px) {
    .tool-intro {
        padding: 24px 16px 8px;
    }

    .tool-intro p br {
        display: none;
    }

    .drop-zone {
        min-height: 285px;
        padding: 30px 16px;
    }

    .primary-button--large {
        min-width: 230px;
    }

    .image-workspace {
        padding: 14px 10px 34px;
    }

    .workspace-toolbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .workspace-toolbar__actions {
        width: 100%;
    }

    .workspace-toolbar__actions .secondary-button,
    .workspace-toolbar__actions .clear-all-button {
        flex: 1;
    }

    .image-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 7px;
    }

    .image-card__preview {
        height: 155px;
    }

    .field-row {
        align-items: flex-start;
        flex-direction: column;
    }

    .color-input-wrap {
        width: 100%;
    }

    .color-input-wrap input[type="text"] {
        flex: 1;
        width: auto;
    }
}
