.photo-fixer-page .photo-tool-shell {
    gap: 20px;
}

.photo-tool-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: stretch;
}

.photo-left-rail {
    display: grid;
    grid-template-rows: minmax(0, 1fr) auto auto auto;
    gap: 18px;
    align-content: stretch;
    min-height: 100%;
}

.photo-help-panel {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.8fr);
    gap: 18px;
    align-items: start;
    padding: 20px 22px;
    border: 1px solid var(--border-color);
    border-radius: 22px;
    background: var(--card-strong);
    box-shadow: var(--shadow);
}

.photo-help-panel h3 {
    margin: 6px 0 8px;
    color: var(--text);
    font-size: 22px;
    line-height: 1.2;
}

.photo-help-panel p {
    margin: 0;
    color: var(--muted);
    line-height: 1.65;
}

.photo-help-panel ul {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.photo-help-panel li {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--soft-bg);
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.photo-help-panel strong {
    color: var(--text);
}

.photo-card {
    min-height: 100%;
}

.photo-upload-card {
    display: grid;
    grid-template-rows: auto minmax(clamp(210px, 28vh, 360px), 1fr) auto auto auto;
    align-content: stretch;
}

.photo-upload-card .photo-drop-zone {
    height: 100%;
    min-height: 0;
}

.photo-control-card {
    align-self: start;
}

.photo-card-head {
    display: grid;
    gap: 8px;
    margin-bottom: 16px;
}

.photo-card-head p {
    margin: 0;
    color: var(--muted);
}

.photo-kicker {
    color: var(--accent);
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.photo-drop-zone {
    display: grid;
    place-items: center;
    gap: 8px;
    min-height: 210px;
    padding: 24px;
    border: 2px dashed var(--border-color);
    border-radius: 18px;
    background:
        linear-gradient(135deg, rgba(255,255,255,0.04), transparent),
        var(--soft-bg);
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.photo-drop-zone:hover,
.photo-drop-zone.is-dragging {
    border-color: var(--accent);
    transform: translateY(-2px);
}

.photo-drop-zone input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.photo-drop-main {
    color: var(--text);
    font-size: 24px;
    font-weight: 900;
    line-height: 1.1;
}

.photo-drop-sub {
    max-width: 440px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.55;
}

.photo-file-list {
    display: grid;
    gap: 8px;
    margin-top: 14px;
}

.photo-file-list p {
    margin: 0;
    color: var(--muted);
}

.photo-file-btn {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--soft-bg);
    color: var(--text);
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s, background 0.2s;
}

.photo-file-btn:hover,
.photo-file-btn.is-active {
    border-color: var(--accent);
    transform: translateY(-1px);
}

.photo-file-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800;
}

.photo-file-meta {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
}

.photo-batch-panel {
    display: grid;
    gap: 10px;
    margin-top: 14px;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--surface-card-bg);
}

.photo-batch-panel p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

.photo-batch-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.photo-batch-controls .download-link {
    min-width: 150px;
    padding: 9px 12px;
    font-size: 12px;
}

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

.photo-field,
.photo-check {
    display: grid;
    gap: 7px;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
}

.photo-field small {
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.45;
}

.photo-field span {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.photo-field select,
.photo-field input[type="range"],
.photo-field input[type="number"],
.photo-field input[type="text"] {
    width: 100%;
}

.photo-field select,
.photo-field input[type="number"],
.photo-field input[type="text"] {
    min-height: 46px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--surface);
    color: var(--text);
    padding: 0 12px;
    font: inherit;
}

.photo-field input[type="range"] {
    accent-color: var(--accent);
}

.photo-edit-panel {
    display: grid;
    gap: 12px;
    margin-top: 16px;
    padding: 14px;
    border: 1px solid var(--border-color);
    border-radius: 16px;
    background: rgba(255,255,255,0.035);
}

.photo-edit-panel h4 {
    margin: 0;
    color: var(--text);
    font-size: 15px;
    line-height: 1.2;
}

.photo-check {
    grid-column: 1 / -1;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    padding: 13px 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--soft-bg);
}

.photo-check input {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
}

.photo-check-inline {
    grid-column: auto;
}

.photo-check-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: stretch;
}

.photo-settings-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: stretch;
    margin-top: 16px;
}

.photo-settings-row .photo-check {
    min-height: 52px;
}

.photo-check small {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    line-height: 1.35;
}

.photo-reset-settings {
    min-width: 180px;
    align-self: stretch;
}

.photo-action-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.photo-action-row .download-link {
    min-width: 180px;
}

.photo-action-row button[disabled] {
    opacity: 0.54;
    cursor: not-allowed;
    transform: none;
    filter: grayscale(0.2);
}

.photo-status {
    margin: 14px 0 0;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--soft-bg);
    color: var(--muted);
    font-size: 14px;
    line-height: 1.5;
}

.photo-metrics {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0 0 16px;
}

.photo-metrics div {
    min-width: 0;
    padding: 12px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--soft-bg);
}

.photo-metrics dt {
    color: var(--muted);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.photo-metrics dd {
    margin: 6px 0 0;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 14px;
    font-weight: 800;
    line-height: 1.35;
}

.photo-warnings {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.photo-warnings li {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--surface-card-bg);
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.photo-warnings li.is-good {
    color: var(--text);
    border-color: rgba(20, 184, 166, 0.34);
}

.photo-preview-frame {
    position: relative;
    min-height: 420px;
    overflow: hidden;
    border: 1px solid var(--border-color);
    border-radius: 18px;
    background:
        linear-gradient(45deg, rgba(127,127,127,0.10) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(127,127,127,0.10) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, rgba(127,127,127,0.10) 75%),
        linear-gradient(-45deg, transparent 75%, rgba(127,127,127,0.10) 75%);
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    background-size: 20px 20px;
}

.photo-preview-frame img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: none;
}

.photo-preview-frame.has-original #photoBeforeImage,
.photo-preview-frame.has-result #photoAfterImage {
    display: block;
}

#photoAfterImage {
    clip-path: inset(0 50% 0 0);
}

.photo-preview-empty {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 24px;
    color: var(--muted);
    font-weight: 800;
    text-align: center;
}

.photo-preview-frame.has-original .photo-preview-empty {
    display: none;
}

.photo-compare-control {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 12px;
    margin-top: 14px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 800;
}

.photo-compare-control input {
    width: 100%;
    accent-color: var(--accent);
}

.photo-output-row {
    display: none;
    margin-top: 14px;
}

.photo-output-row.is-visible {
    display: flex;
}

.photo-route-index {
    display: grid;
    align-content: start;
    margin-bottom: 0;
}

@media (max-width: 980px) {
    .photo-help-panel,
    .photo-tool-grid {
        grid-template-columns: 1fr;
    }

    .photo-preview-frame {
        min-height: 340px;
    }

    .photo-left-rail {
        grid-template-rows: none;
        min-height: 0;
    }
}

@media (max-width: 640px) {
    .photo-control-grid,
    .photo-metrics,
    .photo-check-row,
    .photo-settings-row {
        grid-template-columns: 1fr;
    }

    .photo-drop-zone {
        min-height: 170px;
        padding: 18px;
    }

    .photo-drop-main {
        font-size: 20px;
    }

    .photo-preview-frame {
        min-height: 260px;
    }

    .photo-action-row .download-link {
        min-width: 100%;
    }
}
