@charset "utf-8";

:root {
    --site-theme-color: #007fff;
    --tool-accent-color: #6f398a;
    --tool-accent-hover: #944db3;
    --tool-text: #333;
    --tool-muted: #667085;
    --tool-line: #ccc;
    --tool-soft-blue: #edf6ff;
}

.resolution-page {
    height: auto;
    min-height: 100%;
    color: var(--tool-text);
    background: #fff;
}

.resolution-page [hidden] {
    display: none !important;
}

.resolution-page header {
    position: fixed;
    top: 0;
    z-index: 100;
    width: 100%;
    height: 60px;
    max-height: none;
    padding: 5px 0;
    color: #fff;
    background-color: var(--site-theme-color);
    background-image: none;
    box-shadow: 0 2px 8px rgba(0, 72, 145, 0.2);
}

.tool-header-content {
    position: relative;
    display: flex;
    min-height: 60px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.tool-logo-img,
.tool-logo-img-small {
    position: absolute;
    top: 0;
    left: 5px;
    z-index: 110;
    width: auto;
    height: 60px;
    object-fit: contain;
}

.tool-logo-img-small {
    display: none;
}

.tool-title-wrap {
    display: flex;
    min-height: 60px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.resolution-page #logo {
    font-size: 20px;
    line-height: 1.25;
}

.resolution-page #version_header {
    font-size: 13px;
    line-height: 1.25;
}

.resolution-contents {
    width: min(max(80%, 1024px), 100%) !important;
    margin: 80px auto 0 !important;
    padding: 0 0 90px !important;
    background: #fff !important;
}

.tool-intro {
    margin: 0 20px 12px !important;
    padding: 0 !important;
    color: var(--tool-muted);
}

.quality-notice {
    margin: 0 20px 14px;
    padding: 9px 12px;
    border: 1px solid #e3bd72;
    border-left: 4px solid #d99a28;
    border-radius: 4px;
    color: #6f4a0b;
    background: #fff8e8;
    font-size: 13px;
    line-height: 1.65;
}

.quality-notice strong {
    display: block;
    margin-bottom: 2px;
    color: #8b5600;
}

.quality-notice p {
    margin: 0 !important;
}

.resolution-contents section {
    margin-bottom: 18px;
}

.resolution-contents section > h2 {
    margin: 5px 0 !important;
    padding: 5px 15px !important;
    color: #fff !important;
    background: var(--site-theme-color) !important;
    font-size: 1em !important;
    font-weight: bold;
}

.section-body {
    padding: 10px 20px 18px;
}

.section-body > p {
    padding: 5px 0 !important;
}

.resolution-contents h3 {
    margin: 15px 0 !important;
    padding: 5px 12px !important;
    border: 1px solid var(--tool-line) !important;
    background: #fafafa;
    font-size: 1em !important;
}

.step-label {
    display: inline-grid;
    width: 23px;
    height: 23px;
    margin-right: 8px;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--site-theme-color);
    font-size: 12px;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.drop-zone {
    display: flex;
    min-height: 120px;
    align-items: center;
    justify-content: center;
    gap: 14px;
    padding: 18px;
    border: 2px dashed #9ebbd5;
    color: var(--tool-muted);
    background: #fafcff;
    cursor: pointer;
    text-align: center;
}

.drop-zone:hover,
.drop-zone.is-dragging {
    border-color: var(--site-theme-color);
    background: var(--tool-soft-blue);
}

.drop-zone input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

.drop-zone strong {
    color: var(--site-theme-color);
    font-size: 17px;
}

.drop-zone small {
    padding: 3px 7px;
    border: 1px solid #c5d8e9;
    background: #fff;
}

.drop-icon {
    display: grid;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: var(--site-theme-color);
    font-size: 24px;
}

.source-card {
    display: grid;
    grid-template-columns: 180px minmax(0, 1fr);
    gap: 20px;
    padding: 12px;
    border: 1px solid var(--tool-line);
    background: #fff;
}

.source-preview-wrap {
    position: relative;
    width: 180px;
    height: 180px;
    box-sizing: border-box;
    overflow: hidden;
    border: 1px solid var(--tool-line);
    background:
        linear-gradient(45deg, #eceff2 25%, transparent 25%),
        linear-gradient(-45deg, #eceff2 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #eceff2 75%),
        linear-gradient(-45deg, transparent 75%, #eceff2 75%), #fff;
    background-position: 0 0, 0 6px, 6px -6px, -6px 0;
    background-size: 12px 12px;
}

#source-preview {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.source-details > strong {
    display: block;
    overflow: hidden;
    margin-bottom: 7px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.info-table {
    width: 100%;
    margin: 0 0 10px;
    border-collapse: collapse;
}

.info-table th,
.info-table td {
    padding: 6px 9px;
    border: 1px solid var(--tool-line);
    text-align: left;
}

.info-table th {
    width: 120px;
    background: #e8e8e8;
    white-space: nowrap;
}

.settings-area {
    max-width: 900px;
}

#preset-section {
    margin-top: 18px;
}

.choice-title,
.field-row > .choice-title {
    display: block;
    width: 100%;
    margin: 0 0 8px;
    padding: 0;
    font-size: 16px;
    font-weight: bold;
}

.field-row {
    display: grid;
    grid-template-columns: 110px minmax(0, 1fr);
    align-items: start;
    gap: 12px;
    margin-bottom: 14px;
}

.field-row > label,
.field-row > legend {
    padding-top: 9px;
    font-weight: bold;
}

.preset-fieldset {
    margin: 0 0 18px;
    padding: 0;
    border: 0;
}

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

.preset-options.preset-other-option {
    grid-template-columns: minmax(180px, 220px);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px dashed #bbb;
}

.preset-options label {
    min-width: 0;
    cursor: pointer;
}

.preset-options input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.preset-options span {
    display: grid;
    min-height: 56px;
    align-content: center;
    gap: 1px;
    padding: 7px 9px;
    border: 1px solid #999;
    border-radius: 3px;
    background: #fff;
    text-align: center;
}

.preset-options input:checked + span {
    border: 2px solid var(--site-theme-color);
    padding: 6px 8px;
    color: #005fbf;
    background: var(--tool-soft-blue);
}

.preset-options input:focus-visible + span {
    outline: 3px solid rgba(0, 127, 255, 0.25);
    outline-offset: 2px;
}

.preset-options small {
    overflow: hidden;
    color: var(--tool-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.selection-notice {
    margin: 8px 0 0 !important;
    padding: 7px 10px !important;
    border: 1px solid #e3bd72;
    color: #7a4c00;
    background: #fff8e8;
    font-weight: bold;
}

.scale-row {
    display: block;
    margin: 0 0 14px;
    padding: 0;
    border: 0;
}

.scale-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.scale-options label {
    flex: 1 1 220px;
    max-width: 280px;
    cursor: pointer;
}

.scale-options input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.scale-options span {
    display: grid;
    width: 100%;
    min-width: 0;
    height: 100%;
    box-sizing: border-box;
    gap: 2px;
    padding: 7px 12px;
    border: 1px solid #999;
    border-radius: 3px;
    background: #fff;
}

.scale-options input:checked + span {
    border: 2px solid var(--site-theme-color);
    padding: 6px 11px;
    background: var(--tool-soft-blue);
}

.scale-options input:focus-visible + span {
    outline: 3px solid rgba(0, 127, 255, 0.25);
    outline-offset: 2px;
}

.scale-options small {
    color: var(--tool-muted);
}

.scale-options .optional-scale span {
    border-style: dashed;
    background: #fafafa;
}

.scale-options .optional-scale input:checked + span {
    border-style: solid;
    background: var(--tool-soft-blue);
}

.fit-mode-row {
    margin-top: 18px;
}

.custom-size {
    display: flex;
    max-width: 660px;
    align-items: center;
    gap: 10px;
    margin: 0 0 14px;
    padding: 10px;
    border: 1px solid #c8d9e8;
    background: #f7fbff;
}

.compact-field {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0;
}

.compact-field > label {
    padding: 0;
    white-space: nowrap;
}

.number-input {
    display: flex;
    align-items: center;
    border: 1px solid #999;
    border-radius: 3px;
    background: #fff;
}

.number-input input[type="number"] {
    width: 110px;
    min-height: 34px;
    margin: 0;
    padding: 4px 7px;
    border: 0;
    font: inherit;
}

.number-input span {
    padding-right: 7px;
    color: var(--tool-muted);
}

.button-row {
    text-align: center;
}

.primary-button,
.download-button,
.sub-button {
    min-height: 40px;
    padding: 8px 20px;
    border: 0;
    border-radius: 5px;
    color: #fff;
    background: var(--tool-accent-color);
    cursor: pointer;
    font: inherit;
    font-size: 16px;
    font-weight: bold;
}

.primary-button:hover,
.download-button:hover,
.sub-button:hover {
    background: var(--tool-accent-hover);
    transform: scale(1.02);
}

.primary-button:disabled,
.download-button:disabled {
    cursor: not-allowed;
    opacity: 0.45;
    transform: none;
}

.sub-button {
    min-height: 32px;
    padding: 5px 12px;
    font-size: 13px;
}

.source-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.source-actions .sub-button {
    margin: 0;
}

.secondary-button {
    border: 1px solid var(--tool-accent-color);
    color: var(--tool-accent-color);
    background: #fff;
}

.secondary-button:hover {
    color: #fff;
}

.result-summary {
    padding: 0 0 10px !important;
    font-weight: bold;
}

.result-layout {
    display: grid;
    grid-template-columns: minmax(280px, 1fr) minmax(320px, 1fr);
    gap: 20px;
}

.canvas-wrap {
    display: block;
    width: fit-content;
    max-width: 100%;
    min-height: 0;
    max-height: none;
    justify-self: center;
    align-self: start;
    overflow: hidden;
    padding: 0;
    border: 1px solid var(--tool-line);
    background:
        linear-gradient(45deg, #e9edf1 25%, transparent 25%),
        linear-gradient(-45deg, #e9edf1 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #e9edf1 75%),
        linear-gradient(-45deg, transparent 75%, #e9edf1 75%), #fff;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
    background-size: 20px 20px;
}

#output-canvas {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 500px;
}

.result-table strong {
    color: var(--site-theme-color);
}

.arrow {
    margin: 0 8px;
    color: #888;
}

.result-message {
    margin: 10px 0 !important;
    padding: 8px 10px !important;
    border: 1px solid #acd8c6;
    color: #176a4d;
    background: #edf9f4;
    font-weight: bold;
}

.result-message.is-warning {
    border-color: #e8c27a;
    color: #8b5600;
    background: #fff8e8;
}

.result-message.is-error {
    border-color: #efaaaa;
    color: #c62828;
    background: #fff1f1;
}

.output-filename-field {
    margin: 12px 0 8px;
    padding: 0;
    border: 0;
}

.output-filename-field > legend {
    margin-bottom: 5px;
    padding: 0;
    font-weight: bold;
}

.filename-mode-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
}

.filename-mode-row {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: 7px;
    cursor: pointer;
}

.filename-mode-row.is-disabled {
    cursor: not-allowed;
    opacity: 0.55;
}

.filename-mode-row > label {
    overflow-wrap: anywhere;
    cursor: pointer;
}

.filename-mode-row > input {
    flex: 0 0 auto;
    margin: 0;
    accent-color: var(--site-theme-color);
}

.filename-input {
    display: flex;
    min-width: 0;
    min-height: 38px;
    flex: 1;
    overflow: hidden;
    border: 1px solid #999;
    border-radius: 4px;
    background: #fff;
}

.filename-input:focus-within {
    border-color: var(--site-theme-color);
    box-shadow: 0 0 0 2px rgba(0, 127, 255, 0.15);
}

.filename-input input {
    min-width: 0;
    flex: 1;
    padding: 7px 9px;
    border: 0;
    outline: 0;
    background: transparent;
    font: inherit;
}

.filename-input input:disabled {
    color: #777;
    background: #f5f5f5;
}

.filename-input input[readonly] {
    color: #777;
    cursor: pointer;
}

.filename-input span {
    display: flex;
    align-items: center;
    padding: 0 9px;
    border-left: 1px solid #ccc;
    color: var(--tool-muted);
    background: #f5f5f5;
}

.download-button {
    width: 100%;
}

.warning-dialog {
    width: min(440px, calc(100% - 32px));
    padding: 0;
    border: 0;
    border-radius: 7px;
    color: var(--tool-text);
    background: #fff;
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.28);
}

.warning-dialog:not([open]) {
    display: none;
}

.warning-dialog::backdrop {
    background: rgba(0, 0, 0, 0.48);
}

.warning-dialog form {
    padding: 20px;
}

.warning-dialog h2 {
    margin: 0 0 12px;
    color: #8b5600;
    font-size: 19px;
}

.warning-dialog p {
    margin: 0 0 10px;
}

#large-image-dimensions {
    font-weight: bold;
}

.warning-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 18px;
}

.warning-dialog-actions button {
    min-height: 40px;
    padding: 8px 16px;
    border-radius: 5px;
    cursor: pointer;
    font: inherit;
    font-weight: bold;
}

.dialog-cancel-button {
    border: 1px solid #999;
    color: var(--tool-text);
    background: #fff;
}

.dialog-continue-button {
    border: 1px solid var(--tool-accent-color);
    color: #fff;
    background: var(--tool-accent-color);
}

.dialog-continue-button:hover {
    background: var(--tool-accent-hover);
}

.resolution-page footer {
    position: fixed;
    bottom: 0;
    background: var(--site-theme-color);
}

@media (max-width: 760px) {
    .tool-logo-img {
        display: none;
    }

    .tool-logo-img-small {
        display: block;
    }

    .resolution-page #logo {
        font-size: 17px;
    }

    .resolution-contents {
        width: 100% !important;
    }

    .section-body {
        padding: 8px 12px 16px;
    }

    .drop-zone {
        min-height: 105px;
        flex-wrap: wrap;
    }

    .source-card,
    .result-layout {
        grid-template-columns: 1fr;
    }

    .source-preview-wrap {
        width: 100%;
        aspect-ratio: 1 / 1;
        height: auto;
    }

    .field-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .field-row > label,
    .field-row > legend {
        padding-top: 0;
    }

    .preset-options {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .preset-options.preset-other-option {
        grid-template-columns: 1fr;
    }

    .scale-options {
        display: grid;
        grid-template-columns: 1fr;
    }

    .scale-options label {
        max-width: none;
    }

    .scale-options span {
        min-width: 0;
    }

    .filename-mode-options {
        grid-template-columns: 1fr;
    }

    .custom-size {
        display: grid;
        grid-template-columns: 1fr;
        margin-left: 0;
    }

    .compact-field {
        display: grid;
        grid-template-columns: 80px 1fr;
    }

    .number-input input[type="number"] {
        width: 100%;
    }

    .size-cross {
        display: none;
    }

    .canvas-wrap {
        min-height: 0;
    }
}

@media (max-width: 480px) {
    .resolution-page #logo {
        font-size: 15px;
    }

    .resolution-page #version_header {
        font-size: 11px;
    }

    .drop-zone {
        display: grid;
    }

    .info-table th {
        width: 92px;
    }

    .warning-dialog-actions {
        flex-direction: column-reverse;
    }

    .warning-dialog-actions button {
        width: 100%;
    }
}
