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

.is-hidden { display: none !important; }

.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 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: 340px 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: 340px;
    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;
    border-bottom: 1px solid var(--border);
}
.option-heading {
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 800;
    color: #6f4955;
    background: #fff8fa;
    border-bottom: 1px solid var(--border);
}
.option-body { padding: 16px; }
.option-help {
    margin: 10px 0 0;
    color: #81636f;
    font-size: 12px;
    line-height: 1.65;
}
.auto-adjust-button,
.reset-button,
.process-button { width: 100%; justify-content: center; }
.option-section--actions { padding: 16px; display: grid; gap: 12px; }

.adjustment-list { padding: 4px 0; }
.adjustment-control {
    padding: 14px 16px 12px;
    border-bottom: 1px solid #f0e0e6;
}
.adjustment-control:last-child { border-bottom: 0; }
.adjustment-control__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}
.adjustment-control__head label {
    font-size: 14px;
    font-weight: 700;
    color: #563946;
}
.adjustment-control__head input[type="number"] {
    width: 76px;
    min-height: 34px;
    padding: 0 8px;
    border: 1px solid #d7a2b0;
    border-radius: 7px;
    text-align: right;
    font-size: 13px;
}
.adjustment-control input[type="range"] {
    width: 100%;
    accent-color: #9f1239;
}
.adjustment-control__scale {
    display: flex;
    justify-content: space-between;
    margin-top: 4px;
    color: #9a7d87;
    font-size: 10px;
}

.image-workspace {
    min-width: 0;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.workspace-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 2px 2px 0;
}
.workspace-toolbar strong { font-size: 18px; color: #402530; }
.file-count { margin-left: 8px; font-size: 13px; font-weight: 700; color: #7f5b68; }
.workspace-toolbar__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.upload-progress,
.upload-feedback,
.process-message {
    border-radius: 12px;
    padding: 12px 14px;
    background: #ffffff;
    border: 1px solid #e7cad3;
}
.upload-progress__bar {
    height: 10px;
    border-radius: 999px;
    background: #f4dbe3;
    overflow: hidden;
}
.upload-progress__bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #b01443 0%, #e14a7f 100%);
    transition: width 0.2s ease;
}
.upload-progress__text { margin-top: 8px; color: #6d4753; font-size: 13px; }
.upload-feedback,
.process-message { white-space: pre-line; color: #8f183f; background: #fff6f8; }
.upload-feedback.is-success,
.process-message.is-success { color: #155724; background: #f1fbf4; border-color: #b9e1c2; }

.preview-shell {
    background: #ffffff;
    border: 1px solid #ead2da;
    border-radius: 20px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}
.preview-toolbar {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}
.preview-toolbar__nav {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}
.preview-nav-button,
.compare-button {
    min-height: 40px;
    padding: 0 14px;
    border: 1px solid #dcb4c3;
    border-radius: 10px;
    background: #ffffff;
    color: #6e3347;
    font-weight: 700;
    cursor: pointer;
}
.preview-nav-button:disabled { cursor: default; opacity: 0.45; }
.preview-toolbar__select {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #6f4955;
    font-size: 13px;
    font-weight: 700;
}
.preview-toolbar__select select {
    min-width: 280px;
    min-height: 40px;
    padding: 0 10px;
    border: 1px solid #d7a2b0;
    border-radius: 7px;
    background: #ffffff;
}
.preview-toolbar__meta { color: #7d5f69; font-size: 13px; line-height: 1.5; }
.compare-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: flex-end;
}
.compare-button.is-showing-original {
    background: #9f1239;
    border-color: #9f1239;
    color: #ffffff;
}
.compare-status { color: #775a66; font-size: 13px; font-weight: 700; }
.preview-stage {
    min-height: 540px;
    padding: 20px;
    border-radius: 18px;
    border: 1px dashed #e9c5d2;
    background: #fbf3f6;
    display: flex;
    align-items: center;
    justify-content: center;
}
.preview-canvas-wrap {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    border-radius: 18px;
    background:
        linear-gradient(45deg, #f2dde5 25%, transparent 25%, transparent 75%, #f2dde5 75%),
        linear-gradient(45deg, #f2dde5 25%, transparent 25%, transparent 75%, #f2dde5 75%),
        #ffffff;
    background-position: 0 0, 12px 12px;
    background-size: 24px 24px;
}
#previewCanvas {
    display: block;
    max-width: 100%;
    max-height: 68vh;
    width: auto;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 18px 36px rgba(95, 66, 80, 0.12);
}
.preview-empty { color: #886874; font-size: 15px; text-align: center; }
.preview-caption { color: #85636f; font-size: 13px; line-height: 1.5; text-align: center; }
.thumbnail-heading { padding: 2px 2px 0; font-size: 14px; font-weight: 800; color: #6f4955; }
.image-grid--thumbs {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 14px;
}
.image-card {
    position: relative;
    background: #ffffff;
    border: 1px solid #ead1da;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 18px rgba(90, 45, 62, 0.05);
}
.image-card.is-current {
    border-color: #cf5379;
    box-shadow: 0 0 0 2px rgba(207,83,121,0.15), 0 12px 22px rgba(90,45,62,0.10);
}
.image-card__main {
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.image-card__preview {
    aspect-ratio: 1 / 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    background:
        linear-gradient(45deg, #f2dde5 25%, transparent 25%, transparent 75%, #f2dde5 75%),
        linear-gradient(45deg, #f2dde5 25%, transparent 25%, transparent 75%, #f2dde5 75%),
        #ffffff;
    background-position: 0 0, 10px 10px;
    background-size: 20px 20px;
}
.image-card__preview img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.image-card__meta { padding: 10px 12px 12px; }
.image-card__order { margin-bottom: 4px; font-size: 11px; font-weight: 800; color: #a1506d; }
.image-card__name,
.image-card__output-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-card__name { color: #4d2f3b; font-size: 13px; font-weight: 700; }
.image-card__output-name { margin-top: 3px; color: #80616b; font-size: 12px; }
.image-card__sizes {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
    margin-top: 10px;
}
.size-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    padding: 0 8px;
    border-radius: 999px;
    background: #f8e7ec;
    color: #7a4254;
    font-size: 11px;
    font-weight: 700;
}
.image-card__remove {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 999px;
    background: rgba(73,43,55,0.72);
    color: #ffffff;
    font-size: 18px;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 1200px) {
    .preview-stage { min-height: 460px; }
    .preview-toolbar__select select { min-width: 220px; }
}
@media (max-width: 1040px) {
    .editor-layout { grid-template-columns: 1fr; }
    .editor-layout::before { display: none; }
    .options-panel { border-bottom: 1px solid var(--border); }
    .options-panel__sticky { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 640px) {
    .upload-start { width: min(100%, calc(100% - 24px)); margin-bottom: 64px; }
    .drop-zone { min-height: 280px; padding: 34px 18px; }
    .image-workspace { padding: 16px; }
    .workspace-toolbar,
    .preview-toolbar { flex-direction: column; align-items: stretch; }
    .preview-toolbar__nav { flex-direction: column; align-items: stretch; }
    .preview-toolbar__select { flex-direction: column; align-items: stretch; }
    .preview-toolbar__select select { min-width: 0; }
    .compare-toolbar { justify-content: flex-start; flex-wrap: wrap; }
    .preview-stage { min-height: 320px; padding: 12px; }
    .preview-canvas-wrap { padding: 10px; }
    .image-grid--thumbs { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}
