:root {
    color-scheme: light;
    --ink: #182230;
    --muted: #667085;
    --line: #d0d7e2;
    --line-strong: #aab5c5;
    --panel: #ffffff;
    --soft: #f7f9fc;
    --surface: #eef3f8;
    --accent: #087f8c;
    --accent-dark: #075d66;
    --navy: #26384d;
    --gold: #b7791f;
    --danger: #b42318;
    --shadow: 0 18px 45px rgba(26, 39, 58, 0.12);
    --shadow-soft: 0 10px 24px rgba(26, 39, 58, 0.08);
    font-family: Inter, "Segoe UI", Arial, Helvetica, sans-serif;
}

* {
    box-sizing: border-box;
    letter-spacing: 0;
}

body {
    margin: 0;
    min-height: 100vh;
    background: linear-gradient(180deg, #f8fafc 0%, #e9eef5 100%);
    color: var(--ink);
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    width: min(1280px, calc(100% - 32px));
    margin: 0 auto;
    padding: 28px 0 44px;
}

.workspace,
.gallery-section {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-soft);
}

.topbar,
.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 22px 24px;
    border-bottom: 1px solid var(--line);
    background: #fff;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 30px;
    line-height: 1.15;
    font-weight: 800;
}

h2 {
    font-size: 20px;
    font-weight: 800;
}

.topbar p,
.section-head span,
.status,
.image-card span {
    color: var(--muted);
}

.topbar p {
    margin-top: 4px;
    font-size: 15px;
}

.upload-button,
button,
.download-link,
.secondary-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border: 0;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 8px 16px rgba(8, 127, 140, 0.18);
    transition: background 0.16s ease, transform 0.16s ease, box-shadow 0.16s ease;
}

.upload-button:hover,
button:hover,
.download-link:hover,
.secondary-link:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
}

.secondary-link {
    background: var(--navy);
    box-shadow: 0 8px 16px rgba(38, 56, 77, 0.16);
}

.secondary-link:hover {
    background: #182230;
}

.top-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.upload-button input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

button:disabled {
    cursor: not-allowed;
    opacity: 0.55;
    transform: none;
}

.tool-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 24px;
    padding: 24px;
    background: var(--soft);
}

.editor-panel {
    position: relative;
    min-height: 540px;
    overflow: hidden;
    border: 1px solid #192434;
    background: #182230;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
}

.editor-panel.has-image {
    justify-self: center;
    align-self: start;
    max-width: 100%;
    min-height: 0;
    background: transparent;
    border-color: #101828;
    box-shadow: var(--shadow-soft);
}

.empty-state {
    display: grid;
    place-content: center;
    gap: 8px;
    height: 540px;
    padding: 24px;
    color: #fff;
    text-align: center;
    background:
        linear-gradient(90deg, rgba(255,255,255,0.04) 1px, transparent 1px),
        linear-gradient(rgba(255,255,255,0.04) 1px, transparent 1px),
        #182230;
    background-size: 32px 32px;
}

.empty-state strong {
    font-size: 20px;
}

.empty-state span {
    color: #cbd5e1;
}

.crop-stage {
    position: relative;
    width: 100%;
    min-height: 540px;
    overflow: hidden;
}

.upload-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: grid;
    place-items: center;
    padding: 24px;
    background: rgba(15, 23, 42, 0.48);
    backdrop-filter: blur(2px);
}

.upload-overlay-card {
    display: grid;
    justify-items: center;
    gap: 10px;
    width: min(360px, 100%);
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.26);
    background: rgba(255, 255, 255, 0.94);
    box-shadow: 0 18px 44px rgba(15, 23, 42, 0.22);
    text-align: center;
}

.upload-preview-strip {
    display: flex;
    justify-content: center;
    gap: 8px;
    min-height: 58px;
}

.upload-preview-strip img {
    width: 58px;
    height: 58px;
    object-fit: cover;
    border: 1px solid var(--line);
    background: var(--soft);
}

.upload-overlay-card strong {
    color: var(--ink);
    font-size: 17px;
}

.upload-overlay-card span {
    color: var(--muted);
    font-size: 13px;
}

.upload-progress {
    width: 100%;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e5e7eb;
}

.upload-progress span {
    display: block;
    width: 0%;
    height: 100%;
    border-radius: inherit;
    background: var(--accent);
    transition: width 0.18s ease;
}

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

#sourceCanvas {
    display: block;
    width: auto;
    height: auto;
    max-width: none;
    max-height: none;
}

.crop-box {
    position: absolute;
    border: 2px solid #fff;
    background: rgba(8, 127, 140, 0.12);
    box-shadow: 0 0 0 9999px rgba(10, 16, 24, 0.52), 0 0 0 1px rgba(8, 127, 140, 0.35);
    cursor: move;
    touch-action: none;
}

.crop-info {
    position: absolute;
    left: 8px;
    bottom: 8px;
    z-index: 2;
    max-width: calc(100% - 16px);
    padding: 5px 8px;
    background: rgba(23, 32, 42, 0.88);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    pointer-events: none;
    box-shadow: 0 8px 18px rgba(0,0,0,0.18);
}

.crop-info.is-warning {
    background: rgba(180, 35, 24, 0.94);
}

.crop-box:focus {
    outline: 3px solid rgba(20, 184, 166, 0.55);
}

.handle {
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid #fff;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 3px 10px rgba(0,0,0,0.22);
}

.nw {
    left: 4px;
    top: 4px;
    cursor: nwse-resize;
}

.ne {
    right: 4px;
    top: 4px;
    cursor: nesw-resize;
}

.sw {
    left: 4px;
    bottom: 4px;
    cursor: nesw-resize;
}

.se {
    right: 4px;
    bottom: 4px;
    cursor: nwse-resize;
}

.controls {
    display: flex;
    flex-direction: column;
    gap: 16px;
    padding: 18px;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.controls label {
    display: grid;
    gap: 7px;
    color: var(--navy);
    font-size: 13px;
    font-weight: 700;
}

select,
input[type="text"],
input[type="password"],
input[type="number"] {
    width: 100%;
    min-height: 42px;
    border: 1px solid var(--line);
    border-radius: 6px;
    padding: 9px 11px;
    background: #fff;
    color: var(--ink);
    box-shadow: inset 0 1px 2px rgba(16, 24, 40, 0.04);
    max-width: 100%;
}

select {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

select:focus,
input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(8, 127, 140, 0.16);
}

.login-shell {
    position: relative;
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
    overflow: hidden;
    background: #f5f6fa;
}

.login-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 0;
    background:
        radial-gradient(circle at 20% 20%, rgba(75, 63, 214, 0.08), transparent 26%),
        radial-gradient(circle at 84% 70%, rgba(8, 127, 140, 0.08), transparent 28%);
    pointer-events: none;
}

.login-shell::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
    background: rgba(0, 0, 0, 0.2);
    pointer-events: none;
}

.login-app-preview {
    position: absolute;
    inset: 50% auto auto 50%;
    z-index: 0;
    display: grid;
    grid-template-columns: minmax(440px, 680px) 320px;
    gap: 22px;
    width: min(1060px, calc(100vw - 48px));
    transform: translate(-50%, -50%);
    opacity: 0.82;
    filter: saturate(0.95);
    pointer-events: none;
}

.login-upload-preview,
.login-control-preview {
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 18px 48px rgba(43, 38, 65, 0.08);
}

.login-upload-preview {
    position: relative;
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 11px;
    min-height: 500px;
    padding: 44px;
    text-align: center;
    background:
        radial-gradient(circle, rgba(75, 63, 214, 0.22) 1px, transparent 1.4px),
        #fff;
    background-size: 22px 22px;
}

.login-upload-preview strong {
    font-size: 21px;
    line-height: 1.2;
}

.login-upload-preview > span:not(.corner):not(.login-plus-mark):not(.login-preview-button) {
    color: var(--muted);
    font-size: 17px;
}

.corner {
    position: absolute;
    width: 34px;
    height: 34px;
    border-color: rgba(75, 63, 214, 0.5);
    border-style: solid;
}

.corner-tl {
    left: 26px;
    top: 26px;
    border-width: 2px 0 0 2px;
}

.corner-br {
    right: 26px;
    bottom: 26px;
    border-width: 0 2px 2px 0;
}

.login-plus-mark {
    width: 60px;
    height: 60px;
    border-radius: 17px;
    background:
        linear-gradient(var(--accent), var(--accent)) center / 23px 2px no-repeat,
        linear-gradient(90deg, var(--accent), var(--accent)) center / 2px 23px no-repeat,
        var(--accent-weak);
}

.login-preview-button,
.login-save-preview {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 39px;
    padding: 0 28px;
    border-radius: 9px;
    background: var(--accent);
    color: #fff;
    font-weight: 800;
    box-shadow: 0 8px 18px rgba(75, 63, 214, 0.26);
}

.login-control-preview {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 20px;
}

.login-preview-label {
    color: var(--faint);
    font-family: Consolas, "IBM Plex Mono", monospace;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
}

.login-select-preview {
    display: flex;
    align-items: center;
    min-height: 42px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--soft);
    font-weight: 800;
}

.login-mini-preview {
    display: grid;
    gap: 14px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
}

.login-mini-preview div {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.login-mini-preview div span {
    padding: 5px 9px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-family: Consolas, "IBM Plex Mono", monospace;
    font-size: 10px;
    white-space: nowrap;
}

.login-mini-preview figure {
    min-height: 260px;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 9px;
    background:
        linear-gradient(45deg, #f3f6fa 25%, transparent 25%),
        linear-gradient(-45deg, #f3f6fa 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f3f6fa 75%),
        linear-gradient(-45deg, transparent 75%, #f3f6fa 75%),
        #fff;
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0, 0 0;
}

.login-save-preview {
    width: 100%;
    margin-top: 4px;
}

.login-panel {
    position: relative;
    z-index: 2;
    display: grid;
    gap: 16px;
    width: min(420px, 100%);
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    box-shadow: var(--shadow);
}

.login-panel h1 {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-panel > p {
    margin-left: 52px;
}

.login-panel form {
    display: grid;
    gap: 14px;
}

.login-panel label {
    display: grid;
    gap: 7px;
    color: #344054;
    font-weight: 700;
}

.size-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.custom-save {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid #b9dfe4;
    background: #f0fbfc;
}

.format-field {
    display: grid;
    gap: 7px;
}

.preview-wrap {
    border: 1px solid var(--line);
    overflow: hidden;
    background: #fff;
}

.preview-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 13px;
    border-bottom: 1px solid var(--line);
    background: #f8fafc;
    color: var(--navy);
    font-weight: 700;
}

.quality-warning {
    margin: 0;
    padding: 10px 12px;
    border-bottom: 1px solid #fecdca;
    background: #fff1f0;
    color: var(--danger);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.35;
}

#previewCanvas {
    display: block;
    width: calc(100% - 24px);
    margin: 0 12px 12px;
    height: auto;
    background:
        linear-gradient(45deg, #f3f6fa 25%, transparent 25%),
        linear-gradient(-45deg, #f3f6fa 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #f3f6fa 75%),
        linear-gradient(-45deg, transparent 75%, #f3f6fa 75%);
    background-size: 18px 18px;
    background-position: 0 0, 0 9px, 9px -9px, -9px 0;
}

.status {
    min-height: 22px;
    line-height: 1.4;
    font-size: 14px;
}

.status.error {
    color: var(--danger);
}

.gallery-section {
    margin-top: 24px;
}

.image-columns {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 24px;
    margin-top: 24px;
}

.image-columns .gallery-section {
    display: flex;
    flex-direction: column;
    margin-top: 0;
}

.gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 18px;
    padding: 24px;
    background: var(--soft);
}

.gallery-empty {
    color: var(--muted);
}

.image-card {
    display: grid;
    gap: 12px;
    border: 1px solid var(--line);
    padding: 12px;
    background: #fff;
    box-shadow: 0 8px 18px rgba(26, 39, 58, 0.06);
}

.image-card img {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: contain;
    border: 1px solid #e5eaf1;
    background: #f8fafc;
}

.upload-card.is-active {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(75, 63, 214, 0.16);
}

.upload-thumb {
    display: block;
    width: 100%;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    cursor: pointer;
}

.upload-thumb:hover {
    background: transparent;
    transform: none;
}

.upload-thumb img {
    pointer-events: none;
}

.image-thumb-wrap {
    position: relative;
    display: block;
    margin: 10px 10px 0;
    overflow: hidden;
    background: #f8fafc;
}

.size-badge {
    position: absolute;
    left: 10px;
    bottom: 10px;
    padding: 5px 8px;
    border: 1px solid rgba(255, 255, 255, 0.38);
    border-radius: 999px;
    background: rgba(23, 32, 42, 0.82);
    color: #fff;
    font-family: Consolas, "IBM Plex Mono", monospace;
    font-size: 11px;
    font-weight: 700;
    line-height: 1;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
    pointer-events: none;
}

.image-card div {
    display: grid;
    gap: 4px;
}

.image-card strong {
    overflow-wrap: anywhere;
    font-size: 14px;
    color: var(--ink);
}

.image-card span {
    font-size: 13px;
}

.download-link {
    min-height: 38px;
    background: var(--navy);
    box-shadow: none;
}

.download-link:hover {
    background: #182230;
}

.card-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.delete-button {
    min-height: 38px;
    background: #b42318;
    box-shadow: none;
}

.delete-button:hover {
    background: #912018;
}

.settings-layout {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 24px;
    padding: 24px;
    background: var(--soft);
}

.settings-form,
.size-list {
    display: grid;
    align-content: start;
    gap: 14px;
}

.settings-form {
    padding: 18px;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: var(--shadow-soft);
}

.settings-form label {
    display: grid;
    gap: 7px;
    color: var(--navy);
    font-size: 13px;
    font-weight: 700;
}

.size-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 12px;
    border: 1px solid var(--line);
    background: #fff;
    box-shadow: 0 8px 18px rgba(26, 39, 58, 0.05);
}

.size-row div {
    display: grid;
    gap: 4px;
}

.size-row strong {
    overflow-wrap: anywhere;
}

.size-row span {
    color: var(--muted);
}

.user-row {
    grid-template-columns: minmax(160px, 1fr) minmax(300px, 1.2fr) auto;
}

.inline-reset-form {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) auto;
    gap: 10px;
}

.inline-reset-form input {
    min-height: 38px;
}

.inline-reset-form .secondary-link {
    min-height: 38px;
    white-space: nowrap;
}

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

    .topbar,
    .section-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .top-actions {
        width: 100%;
        flex-direction: column;
    }

    .secondary-link,
    .upload-button {
        width: 100%;
    }

    .settings-layout {
        grid-template-columns: 1fr;
    }

    .user-row,
    .inline-reset-form {
        grid-template-columns: 1fr;
    }

    .image-columns {
        grid-template-columns: 1fr;
    }

    .login-app-preview {
        grid-template-columns: 1fr;
        width: min(680px, calc(100vw - 40px));
    }

    .login-control-preview {
        display: none;
    }
}

@media (max-width: 520px) {
    .app-shell {
        width: min(100% - 20px, 1240px);
        padding-top: 10px;
    }

    .tool-layout,
    .topbar,
    .section-head,
    .gallery {
        padding: 14px;
    }

    .section-toolbar {
        justify-content: stretch;
    }

    .section-toolbar .clear-section-button {
        width: 100%;
    }

    .login-app-preview {
        display: none;
    }

    .editor-panel,
    .empty-state,
    .crop-stage {
        min-height: 360px;
    }

    .editor-panel.has-image,
    .editor-panel.has-image .crop-stage {
        min-height: 0;
    }

    h1 {
        font-size: 24px;
    }
}

/* Modern tool skin inspired by the standalone mockup. */
:root {
    --ink: #302f3a;
    --muted: #73717f;
    --faint: #9a97a8;
    --line: #e3e1ea;
    --line-strong: #cbc7d8;
    --panel: #ffffff;
    --soft: #f7f7f9;
    --surface: #f1f0f6;
    --accent: #4b3fd6;
    --accent-dark: #3d32b8;
    --accent-weak: #eeecff;
    --navy: #302f3a;
    --danger: #b42318;
    --shadow: 0 18px 46px rgba(43, 38, 65, 0.11);
    --shadow-soft: 0 8px 24px rgba(43, 38, 65, 0.07);
}

body {
    background: var(--soft);
    color: var(--ink);
}

.app-shell {
    width: min(1180px, calc(100% - 64px));
    padding: 34px 0 64px;
}

.workspace,
.gallery-section {
    border-color: var(--line);
    border-radius: 16px;
    box-shadow: 0 1px 2px rgba(43, 38, 65, 0.04);
    overflow: hidden;
}

.topbar {
    padding: 0 0 26px;
    border-bottom: 0;
    background: transparent;
}

.workspace > .topbar {
    padding: 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
}

.topbar h1 {
    position: relative;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 22px;
    letter-spacing: 0;
}

.login-panel h1::before {
    content: "";
    display: inline-block;
    width: 40px;
    height: 40px;
    flex: 0 0 auto;
    border: 1px solid #d9d4fb;
    border-radius: 11px;
    background:
        linear-gradient(var(--accent-dark), var(--accent-dark)) center / 17px 2px no-repeat,
        linear-gradient(90deg, var(--accent-dark), var(--accent-dark)) center / 2px 17px no-repeat,
        var(--accent-weak);
}

.app-mark-button {
    width: 40px;
    min-height: 40px;
    height: 40px;
    flex: 0 0 auto;
    padding: 0;
    border: 1px solid #d9d4fb;
    border-radius: 11px;
    background:
        linear-gradient(var(--accent-dark), var(--accent-dark)) center / 17px 2px no-repeat,
        linear-gradient(90deg, var(--accent-dark), var(--accent-dark)) center / 2px 17px no-repeat,
        var(--accent-weak);
    box-shadow: none;
}

.app-mark-button:hover {
    background:
        linear-gradient(#fff, #fff) center / 17px 2px no-repeat,
        linear-gradient(90deg, #fff, #fff) center / 2px 17px no-repeat,
        var(--accent);
}

.topbar p {
    margin-left: 54px;
    font-size: 13.5px;
}

.top-actions {
    gap: 9px;
}

.upload-button,
button,
.download-link,
.secondary-link {
    min-height: 38px;
    padding: 0 15px;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(75, 63, 214, 0.28);
    font-size: 13.5px;
}

.secondary-link,
.download-link {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--ink);
    box-shadow: none;
}

.secondary-link:hover,
.download-link:hover {
    border-color: var(--line-strong);
    background: #f9f9fb;
    color: var(--ink);
}

.tool-layout {
    grid-template-columns: minmax(0, 1fr) 400px;
    gap: 22px;
    padding: 24px;
    background: var(--soft);
}

.editor-panel {
    min-height: 560px;
    border-color: var(--line);
    border-radius: 16px;
    background: var(--panel);
    box-shadow: 0 1px 2px rgba(43, 38, 65, 0.04);
}

.editor-panel.has-image {
    border-radius: 0;
    border-color: #171622;
    box-shadow: none;
}

.empty-state {
    height: 560px;
    gap: 0;
    color: var(--ink);
    background-color: var(--panel);
    background-image: radial-gradient(#dfdce8 1.1px, transparent 1.1px);
    background-size: 22px 22px;
}

.empty-state::before,
.empty-state::after {
    content: "";
    position: absolute;
    width: 30px;
    height: 30px;
    border-color: #aaa4e7;
    pointer-events: none;
}

.empty-state::before {
    top: 26px;
    left: 26px;
    border-top: 2px solid #aaa4e7;
    border-left: 2px solid #aaa4e7;
    border-top-left-radius: 6px;
}

.empty-state::after {
    right: 26px;
    bottom: 26px;
    border-right: 2px solid #aaa4e7;
    border-bottom: 2px solid #aaa4e7;
    border-bottom-right-radius: 6px;
}

.empty-icon {
    width: 60px;
    height: 60px;
    margin: 0 auto 22px;
    border-radius: 16px;
    background:
        linear-gradient(var(--accent-dark), var(--accent-dark)) center / 22px 2px no-repeat,
        linear-gradient(90deg, var(--accent-dark), var(--accent-dark)) center / 2px 16px no-repeat,
        var(--accent-weak);
}

.empty-state strong {
    color: var(--ink);
    font-size: 20px;
    font-weight: 700;
}

.empty-state span {
    margin-top: 9px;
    color: var(--muted);
}

#emptyChooseButton {
    justify-self: center;
    margin-top: 22px;
    min-width: 150px;
}

.controls {
    padding: 0;
    gap: 0;
    border-color: var(--line);
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 1px 2px rgba(43, 38, 65, 0.04);
}

.controls > label,
.controls > select,
.size-grid,
.custom-save,
.preview-wrap,
#saveButton,
.controls .status {
    margin: 0 20px;
}

.controls > label:first-child {
    margin-top: 20px;
    margin-bottom: 11px;
    color: var(--faint);
    font-family: "IBM Plex Mono", Consolas, monospace;
    font-size: 11px;
    font-weight: 500;
    text-transform: uppercase;
}

.controls > select {
    width: calc(100% - 40px);
    margin-bottom: 20px;
}

.controls .size-grid,
.controls .custom-save,
.controls .format-field,
.controls .preview-wrap {
    width: calc(100% - 40px);
}

select,
input[type="text"],
input[type="password"],
input[type="number"] {
    min-height: 43px;
    border-radius: 10px;
    background: var(--soft);
    font-weight: 600;
}

.size-grid,
.custom-save,
.format-field {
    margin-bottom: 20px;
}

.preview-wrap {
    margin-top: 10px;
    margin-bottom: 20px;
    border-radius: 12px;
}

.preview-head {
    background: #fff;
    padding: 13px;
    border-bottom: 0;
    font-size: 14px;
    align-items: center;
    flex-wrap: wrap;
    row-gap: 8px;
}

.preview-head span:last-child {
    padding: 6px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--soft);
    color: var(--muted);
    font-family: Consolas, "IBM Plex Mono", monospace;
    font-size: 11px;
    font-weight: 500;
    white-space: nowrap;
}

#previewCanvas {
    border: 1px solid var(--line);
    border-radius: 11px;
}

#saveButton {
    width: calc(100% - 40px);
    min-height: 43px;
    margin-bottom: 12px;
}

.controls .status {
    padding-bottom: 20px;
    text-align: center;
    color: var(--faint);
    font-family: Consolas, "IBM Plex Mono", monospace;
    font-size: 11px;
}

.gallery-section {
    padding: 24px;
}

.section-head {
    padding: 0;
    border-bottom: 0;
    margin-bottom: 20px;
}

.section-head h2 {
    font-size: 17px;
}

.section-head span,
#imageCount,
#uploadCount {
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--accent-weak);
    color: var(--accent-dark);
    font-size: 12px;
    font-weight: 700;
}

.gallery {
    padding: 0;
    background: transparent;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 16px;
}

.section-toolbar {
    display: flex;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--line);
    margin-top: auto;
}

.image-card {
    border-radius: 13px;
    overflow: hidden;
    padding: 0 0 10px;
    box-shadow: none;
    transition: box-shadow .15s ease, border-color .15s ease;
}

.upload-card {
    padding-top: 10px;
}

.upload-card .upload-thumb {
    width: calc(100% - 20px);
    margin: 0 10px;
    overflow: hidden;
    background: #f8fafc;
}

.image-card:hover {
    border-color: var(--line-strong);
    box-shadow: 0 6px 20px rgba(43, 38, 65, 0.08);
}

.image-card img {
    border: 0;
    border-bottom: 1px solid var(--line);
}

.image-card > div {
    padding: 0 16px;
}

.image-card > div:last-child {
    padding-bottom: 18px;
}

.image-card strong {
    font-family: Consolas, "IBM Plex Mono", monospace;
    font-size: 12px;
    font-weight: 500;
}

.image-card span {
    color: var(--faint);
    font-size: 12px;
}

.card-actions {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.delete-button {
    border: 1px solid var(--line);
    background: transparent;
    color: var(--muted);
}

.delete-button:hover {
    border-color: #efc2bd;
    background: #fff1f0;
    color: var(--danger);
}

.clear-section-button {
    min-height: 32px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--muted);
    box-shadow: none;
    font-size: 12px;
    font-weight: 700;
}

.clear-section-button:hover {
    border-color: #efc2bd;
    background: #fff1f0;
    color: var(--danger);
    transform: none;
}

.clear-section-button:disabled,
.clear-section-button:disabled:hover {
    border-color: var(--line);
    background: #fff;
    color: var(--muted);
    opacity: 0.48;
    cursor: not-allowed;
}

.settings-layout {
    background: var(--soft);
}

.settings-form,
.size-row {
    border-radius: 13px;
}
