.tool-box {
    max-width: 1180px;
}

.tool-shell {
    max-width: 1180px;
    margin: 0 auto;
}

.tool-main-card,
.preview-card,
.file-info-card,
.task-options,
.photo-result {
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 18px;
}

.tool-main-card {
    padding: 1rem;
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.04);
}

.tool-workspace {
    display: grid;
    grid-template-columns: minmax(0, 540px) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.tool-sidebar,
.tool-output {
    min-width: 0;
}

.upload-area {
    border: 1.5px dashed #cbd5e1;
    border-radius: 16px;
    padding: 2.2rem 1.4rem;
    text-align: center;
    cursor: pointer;
    background: #f8fbff;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.upload-area:hover,
.upload-area.dragover {
    border-color: #2563eb;
    background: #eff6ff;
    transform: translateY(-1px);
}

.upload-icon {
    width: 56px;
    height: 56px;
    margin: 0 auto 0.9rem;
    border-radius: 16px;
    background: #dbeafe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.7rem;
}

.upload-text {
    color: #1f2937;
    font-weight: 700;
    font-size: 1.05rem;
}

.upload-link {
    color: #2563eb;
}

.upload-hint {
    margin-top: 0.6rem;
    color: #6b7280;
    line-height: 1.7;
    font-size: 0.92rem;
}

.file-shell {
    display: grid;
    grid-template-columns: minmax(280px, 0.95fr) minmax(0, 1.05fr);
    gap: 0.85rem;
    margin-top: 0.9rem;
}

.preview-card,
.file-info-card {
    padding: 1rem;
}

.preview-head,
.photo-head,
.result-head,
.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
}

.preview-title,
.result-title,
.panel-title {
    color: #1f2937;
    font-size: 1.05rem;
    font-weight: 700;
}

.panel-sub,
.result-sub,
.file-note {
    margin-top: 0.35rem;
    color: #6b7280;
    line-height: 1.7;
    font-size: 0.92rem;
}

.preview-image-wrap {
    margin-top: 0.9rem;
    border-radius: 14px;
    overflow: hidden;
    background: #f5f7fb;
    border: 1px solid #eef2f7;
}

.preview-image-wrap img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 420px;
    object-fit: contain;
}

.btn-change {
    border: 1px solid #bfdbfe;
    border-radius: 999px;
    background: #eff6ff;
    color: #1d4ed8;
    padding: 0.5rem 0.9rem;
    font: inherit;
    cursor: pointer;
}

.file-name {
    color: #1f2937;
    font-size: 1rem;
    font-weight: 700;
    word-break: break-all;
}

.file-meta {
    margin-top: 0.55rem;
    color: #6b7280;
    line-height: 1.7;
}

.task-options,
.photo-result {
    margin-top: 0.9rem;
    padding: 1rem;
}

.option-section + .option-section {
    margin-top: 0.9rem;
}

.option-label {
    display: block;
    margin-bottom: 0.7rem;
    color: #1f2937;
    font-weight: 700;
}

.option-help {
    margin-top: 0.55rem;
    color: #6b7280;
    line-height: 1.6;
    font-size: 0.84rem;
}

.segmented-group,
.chip-group {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
}

.segmented-option input,
.chip-option input {
    display: none;
}

.segmented-option span,
.chip-option span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0.58rem 0.88rem;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #fff;
    color: #374151;
    cursor: pointer;
    transition: border-color 0.2s ease, background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.segmented-option span {
    min-width: 110px;
    font-weight: 600;
}

.chip-option span {
    min-width: 78px;
}

.segmented-option input:checked + span,
.chip-option input:checked + span {
    border-color: #2563eb;
    background: #eff6ff;
    color: #1d4ed8;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.select-wrap {
    position: relative;
}

.option-select,
.number-field input {
    width: 100%;
    min-height: 44px;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #fff;
    color: #1f2937;
    padding: 0.75rem 0.95rem;
    font: inherit;
}

.number-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}

.single-number {
    grid-template-columns: minmax(0, 220px);
    margin-top: 0.8rem;
}

.number-field {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    color: #4b5563;
    font-size: 0.9rem;
}

.tool-actions {
    margin-top: 1rem;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    padding: 0.82rem 1.2rem;
    font-size: 0.94rem;
    cursor: pointer;
    text-decoration: none;
}

.btn-primary {
    background: #2563eb;
    color: #fff;
}

.btn-primary:hover {
    background: #1d4ed8;
}

.btn-secondary {
    background: #f3f4f6;
    color: #374151;
}

.btn-submit {
    width: 100%;
    min-height: 46px;
    font-size: 0.96rem;
    font-weight: 700;
}

.result-empty {
    min-height: 180px;
    padding: 1rem;
    background: #fff;
    border: 1px dashed #d1d5db;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.result-empty-title {
    color: #1f2937;
    font-size: 1rem;
    font-weight: 700;
}

.result-empty-sub {
    margin-top: 0.45rem;
    color: #6b7280;
    line-height: 1.7;
    font-size: 0.9rem;
}

.result-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 0.8rem;
}

.summary-chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0.38rem 0.72rem;
    border-radius: 999px;
    background: #f3f4f6;
    color: #4b5563;
    font-size: 0.88rem;
}

.result-notice {
    margin-top: 0.8rem;
    padding: 0.75rem 0.9rem;
    border-radius: 14px;
    background: #fffbeb;
    border: 1px solid #fde68a;
    color: #92400e;
    line-height: 1.7;
}

.result-extra {
    margin-top: 0.8rem;
}

.photo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
    margin-top: 0.85rem;
}

.photo-card {
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
}

.photo-card-wide {
    grid-column: 1 / -1;
}

.photo-head {
    padding: 0.8rem 0.9rem;
    border-bottom: 1px solid #f0f2f5;
}

.photo-title {
    color: #1f2937;
    font-weight: 700;
}

.download-btn {
    white-space: nowrap;
}

.photo-preview {
    background: #f8fafc;
    min-height: 220px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.photo-preview-layout {
    min-height: 280px;
}

.photo-preview img {
    display: block;
    max-width: 100%;
    max-height: 360px;
    width: auto;
    height: auto;
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.size-table-wrap {
    overflow-x: auto;
}

.size-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-size: 15px;
}

.size-table th,
.size-table td {
    padding: 14px 16px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: top;
}

.size-table th {
    color: #111827;
    background: #f9fafb;
    font-weight: 700;
}

.size-table td {
    color: #4b5563;
}

.size-table a {
    color: #2563eb;
    font-weight: 700;
    text-decoration: none;
}

@media (max-width: 1080px) {
    .tool-workspace {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 960px) {
    .file-shell,
    .number-grid,
    .photo-grid {
        grid-template-columns: 1fr;
    }

    .photo-card-wide {
        grid-column: auto;
    }

    .single-number {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .tool-main-card {
        padding: 0.85rem;
    }

    .upload-area {
        padding: 1.8rem 1rem;
    }

    .preview-head,
    .photo-head,
    .result-head,
    .panel-head {
        flex-direction: column;
        align-items: stretch;
    }

    .segmented-group,
    .chip-group {
        gap: 0.55rem;
    }

    .segmented-option,
    .chip-option {
        flex: 1 1 calc(50% - 0.55rem);
    }

    .segmented-option span,
    .chip-option span {
        width: 100%;
        min-width: 0;
    }
}
