:root {
    --ink: #142039;
    --muted: #71809a;
    --line: #dce4f0;
    --line-soft: #eaf0f7;
    --canvas: #f4f8fe;
    --blue: #1769ff;
    --blue-strong: #0e5bea;
    --blue-soft: #edf4ff;
    --green: #12a87a;
    --danger: #ef4444;
    --shadow: 0 18px 45px rgba(22, 45, 81, .075);
    --shadow-soft: 0 10px 26px rgba(23, 52, 96, .055);
    font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
    color: var(--ink);
}

* { box-sizing: border-box; }
.visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }
html, body {
    min-width: 0;
    min-height: 100%;
    margin: 0;
    background:
        linear-gradient(180deg, rgba(255,255,255,.62), rgba(246,250,255,.82) 46%, rgba(241,247,255,.95)),
        var(--canvas);
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
    outline: 3px solid rgba(23, 105, 255, .18);
    outline-offset: 2px;
}
[hidden] { display: none !important; }

.saoya-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
}
.product-rail {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 100vh;
    padding: 18px 12px;
    color: #738197;
    background: #fff;
    border-right: 1px solid var(--line);
    box-shadow: 8px 0 24px rgba(31,45,72,.035);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}
.brand-mark {
    width: 42px;
    height: 42px;
    margin-bottom: 14px;
    display: grid;
    place-items: center;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.rail-link {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 13px;
    color: inherit;
    background: transparent;
    display: grid;
    place-items: center;
    text-decoration: none;
}
.rail-link svg { width: 20px; height: 20px; stroke-width: 1.8; }
.rail-link span {
    position: absolute;
    left: 55px;
    z-index: 50;
    width: max-content;
    padding: 7px 10px;
    border: 1px solid #273449;
    border-radius: 9px;
    color: #fff;
    background: #1b2638;
    box-shadow: 0 8px 22px rgba(0,0,0,.18);
    font-size: 10px;
    font-weight: 650;
    opacity: 0;
    pointer-events: none;
    transform: translateX(-5px);
    transition: opacity .16s ease, transform .16s ease;
}
.rail-link:hover, .rail-link:focus-visible,
.rail-link.active { color: var(--blue); background: var(--blue-soft); }
.rail-link:hover span, .rail-link:focus-visible span { opacity: 1; transform: translateX(0); }
.rail-link.active::before {
    content: "";
    position: absolute;
    left: -12px;
    width: 3px;
    height: 22px;
    border-radius: 0 3px 3px 0;
    background: var(--blue);
}
.account-anchor { position: relative; margin-top: auto; }
.account-button {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    padding: 0;
    overflow: hidden;
    border: 2px solid #dce5f4;
    border-radius: 50%;
    color: #fff;
    background: linear-gradient(145deg, #2d70ff, #554fe8);
    font-weight: 800;
    cursor: pointer;
    background-size: cover;
    background-position: center;
}
.account-button.has-avatar {
    color: var(--ink);
    background: #fff;
    box-shadow: none;
}
.account-button > #accountAvatar {
    display: grid;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    place-items: center;
    line-height: 1;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.account-button.has-avatar > #accountAvatar { background-color: #fff; }
.account-popover {
    position: absolute;
    left: 56px;
    bottom: 0;
    z-index: 100;
    width: 336px;
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: #fff;
    box-shadow: 0 22px 58px rgba(23,36,59,.16);
}
.account-summary {
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    padding-bottom: 11px;
    border-bottom: 1px solid var(--line-soft);
}
.account-avatar-large {
    width: 48px;
    height: 48px;
    overflow: hidden;
    border-radius: 16px;
    background: linear-gradient(145deg, #2d70ff, #554fe8);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 850;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}
.account-summary strong, .account-summary span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-summary strong { font-size: 14px; }
.account-summary span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.popover-action {
    width: 100%;
    min-height: 38px;
    margin-top: 8px;
    padding: 0 10px;
    border: 0;
    border-radius: 11px;
    color: #1d2b45;
    background: transparent;
    display: flex;
    align-items: center;
    gap: 9px;
    text-decoration: none;
    cursor: pointer;
}
.popover-action svg { width: 17px; height: 17px; }
.popover-action:hover { background: #f4f7fb; }
.popover-action.danger { color: #ef4444; }

.saoya-content {
    min-width: 0;
    padding: 28px clamp(22px, 3vw, 36px) 40px;
}

.studio-layout {
    display: grid;
    grid-template-columns: minmax(500px, .96fr) minmax(520px, .9fr);
    max-width: 1460px;
    margin: 0 auto;
    gap: 18px;
    align-items: start;
}
.control-column { display: grid; gap: 12px; }
.panel-card, .preview-card {
    border: 1px solid var(--line);
    border-radius: 20px;
    background: rgba(255,255,255,.96);
    box-shadow: var(--shadow);
}
.panel-card { padding: 14px 16px 16px; }
.panel-heading, .preview-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line-soft);
}
.panel-heading > div {
    display: flex;
    align-items: center;
    gap: 10px;
}
.panel-heading h3 { margin: 0; font-size: 16px; letter-spacing: .01em; }
.panel-heading small { color: var(--muted); font-size: 12px; }
.panel-icon {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    color: var(--blue);
    background: linear-gradient(180deg, #eef5ff, #f8fbff);
    display: grid;
    place-items: center;
}
.panel-icon svg { width: 17px; }
.heading-actions { display: flex; gap: 8px; }
.quiet-action, .logo-actions button, .theme-row button {
    min-height: 30px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: #52627a;
    background: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 760;
    cursor: pointer;
}
.quiet-action:hover, .logo-actions button:hover, .theme-row button:hover { color: var(--blue); border-color: #bcd1f3; background: #f7fbff; box-shadow: 0 6px 14px rgba(23,105,255,.07); }
.quiet-action svg { width: 14px; }

.segmented {
    display: inline-grid;
    width: min(620px, 100%);
    max-width: 100%;
    grid-template-columns: repeat(4, minmax(104px, 1fr));
    gap: 6px;
    margin: 14px 0 13px;
    padding: 6px;
    border: 1px solid #e8eef7;
    border-radius: 14px;
    background: linear-gradient(180deg, #edf3f9, #f2f6fb);
}
.segmented button {
    min-height: 38px;
    padding: 0 12px;
    border: 0;
    border-radius: 11px;
    color: #637187;
    background: transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 12px;
    font-weight: 800;
    cursor: pointer;
}
.segmented button svg { width: 15px; }
.segmented button.active {
    color: var(--blue);
    background: #fff;
    box-shadow: 0 8px 18px rgba(23, 71, 135, .1), inset 0 0 0 1px rgba(23,105,255,.08);
}

.type-panel { display: grid; gap: 12px; }
.two-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.field, .check-field {
    display: grid;
    gap: 8px;
    color: #304159;
    font-size: 12px;
    font-weight: 800;
}
.field.full { grid-column: 1 / -1; }
.type-panel .full { grid-column: 1 / -1; }
.field input, .field select, .field textarea {
    width: 100%;
    min-height: 44px;
    padding: 10px 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    outline: 0;
    background: linear-gradient(180deg, #fff, #fbfdff);
    color: var(--ink);
    font-size: 14px;
    font-weight: 650;
}
.field textarea { min-height: 96px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(23,105,255,.58); background: #fff; box-shadow: 0 0 0 3px rgba(23,105,255,.07); }
.check-field {
    align-self: end;
    min-height: 44px;
    grid-template-columns: 18px minmax(0, 1fr);
    align-items: center;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: linear-gradient(180deg, #fff, #fbfdff);
}
.check-field input, .mini-check input { accent-color: var(--blue); }
.field-message { min-height: 14px; margin: 9px 0 0; color: var(--muted); font-size: 12px; }
.field-message.error { color: var(--danger); }

.style-groups {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    align-items: start;
    padding-top: 10px;
}
.control-group {
    display: grid;
    gap: 7px;
    align-self: start;
    min-height: 0;
    padding: 10px 12px;
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff, #fbfdff);
    box-shadow: var(--shadow-soft);
}
.control-group > strong { color: #253653; font-size: 12px; letter-spacing: .01em; }
.choice-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
}
.choice-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.choice-grid button {
    min-height: 32px;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: #596a82;
    background: linear-gradient(180deg, #fff, #fcfdff);
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
}
.choice-grid button:hover { border-color: #bfd2ef; color: var(--blue); }
.choice-grid button.active, .logo-actions button.active, .theme-row button.active {
    color: var(--blue);
    border-color: #9dbdff;
    background: linear-gradient(180deg, #f5f9ff, #edf4ff);
    box-shadow: inset 0 0 0 1px rgba(23,105,255,.1), 0 7px 14px rgba(23,105,255,.08);
}
.color-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    align-items: end;
}
.color-row label, .mini-check {
    display: grid;
    gap: 6px;
    color: #52627a;
    font-size: 11px;
    font-weight: 760;
}
.color-input {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 6px;
    align-items: center;
}
.color-input input[type="color"] {
    width: 34px;
    height: 30px;
    padding: 3px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
}
.color-input input[type="text"], .number-grid input {
    width: 100%;
    min-width: 0;
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    outline: 0;
    background: linear-gradient(180deg, #fff, #fbfdff);
    color: #21314d;
    font-size: 11px;
    font-weight: 800;
}
.color-input input[type="text"]:focus, .number-grid input:focus {
    border-color: rgba(23,105,255,.58);
    box-shadow: 0 0 0 3px rgba(23,105,255,.07);
}
.mini-check {
    min-height: 28px;
    grid-template-columns: 16px auto;
    align-items: center;
    padding: 0 9px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: #fff;
}
.theme-row, .logo-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}
.logo-file { color: var(--muted); font-size: 11px; }
.number-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}
.number-grid label {
    display: grid;
    gap: 5px;
    color: #52627a;
    font-size: 11px;
    font-weight: 760;
}
.frame-text { margin-top: 2px; }
.prompt-group .number-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.preview-column {
    position: sticky;
    top: 28px;
}
.preview-card { padding: 22px; }
.preview-heading { padding-bottom: 13px; }
.preview-heading span, .preview-heading strong { display: block; }
.preview-heading span { color: var(--muted); font-size: 12px; font-weight: 800; }
.preview-heading strong { margin-top: 4px; font-size: 18px; letter-spacing: .01em; }
.preview-heading select {
    min-height: 38px;
    padding-inline: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: linear-gradient(180deg, #fff, #fbfdff);
    color: #4c5b72;
    font-size: 13px;
    font-weight: 800;
}
.preview-stage {
    margin-top: 18px;
    min-height: 472px;
    padding: 34px;
    border: 1px solid #d9e6f6;
    border-radius: 18px;
    background-color: #f8fbff;
    background-image:
        radial-gradient(#bed3ee 1px, transparent 1px),
        linear-gradient(180deg, rgba(255,255,255,.72), rgba(238,246,255,.42));
    background-size: 16px 16px, 100% 100%;
    display: grid;
    place-items: center;
}
.poster-card {
    width: 390px;
    max-width: 100%;
    padding: 28px 28px 30px;
    border: 1px solid #edf1f7;
    border-radius: 18px;
    background: #fff;
    box-shadow: 0 18px 42px rgba(42,61,97,.14);
    display: grid;
    justify-items: center;
    gap: 12px;
}
.poster-card.frame-none {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
}
.poster-badge {
    min-height: 23px;
    padding: 0 10px;
    border: 1px solid #cfe0ff;
    border-radius: 999px;
    color: var(--blue);
    background: #f3f8ff;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 850;
    letter-spacing: .08em;
}
.poster-badge svg { width: 12px; }
.qr-holder {
    width: 320px;
    height: 320px;
    display: grid;
    place-items: center;
}
.qr-holder canvas, .qr-holder svg {
    width: 320px !important;
    height: 320px !important;
    display: block !important;
}
.qr-placeholder {
    width: 300px;
    height: 300px;
    border: 1px dashed #cbd8ea;
    border-radius: 16px;
    color: #8190a6;
    display: grid;
    place-items: center;
    text-align: center;
    font-size: 13px;
    line-height: 1.5;
}
.poster-card p {
    max-width: 100%;
    margin: 0;
    color: #293a55;
    font-size: var(--text-size, 13px);
    font-weight: 800;
    line-height: 1.48;
    text-align: center;
    overflow-wrap: anywhere;
    transform: translate(var(--text-x, 0), var(--text-y, 0));
}
.poster-card.text-top #posterText { order: -1; }
.poster-card.text-bottom #posterText { order: 5; }
.poster-card.text-left, .poster-card.text-right {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}
.poster-card.text-right { grid-template-columns: auto minmax(0, 1fr); }
.poster-card.text-left .poster-badge,
.poster-card.text-right .poster-badge { grid-column: 1 / -1; }
.poster-card.text-left #posterText {
    order: 0;
    max-width: 82px;
    text-align: right;
}
.poster-card.text-left .qr-holder { order: 1; }
.poster-card.text-right .qr-holder { order: 0; }
.poster-card.text-right #posterText {
    order: 1;
    max-width: 82px;
    text-align: left;
}
.poster-card.text-left .qr-holder,
.poster-card.text-right .qr-holder,
.poster-card.text-left .qr-holder canvas,
.poster-card.text-right .qr-holder canvas,
.poster-card.text-left .qr-holder svg,
.poster-card.text-right .qr-holder svg {
    width: 248px !important;
    height: 248px !important;
}
.payload-preview {
    margin-top: 18px;
    padding: 14px 16px;
    border: 1px solid var(--line-soft);
    border-radius: 14px;
    background: linear-gradient(180deg, #fff, #fbfdff);
}
.payload-preview span {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
}
.payload-preview code {
    display: block;
    max-height: 86px;
    overflow: auto;
    color: #26354d;
    font-family: Consolas, "SFMono-Regular", monospace;
    font-size: 13px;
    line-height: 1.55;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.action-grid {
    display: grid;
    grid-template-columns: 1.25fr .75fr 1fr;
    gap: 12px;
    margin-top: 16px;
}
.action-grid button {
    min-height: 48px;
    padding: 0 13px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: linear-gradient(180deg, #fff, #fcfdff);
    color: #4b5d76;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}
.action-grid button:hover { color: var(--blue); border-color: #bcd1f3; background: #f7fbff; }
.action-grid .primary-action {
    color: #fff;
    border-color: var(--blue);
    background: linear-gradient(180deg, #2474ff, var(--blue));
    box-shadow: 0 14px 28px rgba(23,105,255,.24);
}
.action-grid .primary-action:hover { color: #fff; background: var(--blue-strong); }
.action-grid button:disabled { opacity: .58; cursor: not-allowed; }
.action-grid svg { width: 16px; }

.toast-region {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 200;
    display: grid;
    gap: 8px;
}
.toast {
    max-width: 330px;
    padding: 11px 13px;
    border: 1px solid #d9e3f0;
    border-radius: 13px;
    color: #24344d;
    background: #fff;
    box-shadow: 0 12px 30px rgba(18, 32, 57, .14);
    font-size: 13px;
    font-weight: 700;
}
.toast.error { color: #b91c1c; border-color: #fecaca; background: #fff5f5; }

@media (max-width: 1180px) {
    .studio-layout { grid-template-columns: minmax(0, 1fr); }
    .preview-column { position: static; }
}
@media (max-width: 760px) {
    .saoya-shell { grid-template-columns: 64px minmax(0, 1fr); }
    .product-rail { width: 64px; padding-inline: 10px; }
    .saoya-content { padding: 20px 14px 34px; }
    .segmented { display: grid; width: 100%; grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .two-column, .choice-grid, .choice-grid.compact, .color-row, .number-grid, .style-groups, .action-grid { grid-template-columns: 1fr; }
    .style-groups .control-group:first-child { grid-column: auto; }
    .panel-heading, .preview-heading { align-items: flex-start; flex-direction: column; }
    .heading-actions { width: 100%; }
    .quiet-action { flex: 1; }
    .preview-stage { padding: 15px; }
    .poster-card { width: 268px; padding: 20px; }
    .qr-holder, .qr-holder canvas, .qr-holder svg { width: 220px !important; height: 220px !important; }
}

/* 2026-08-20 · 扫鸭导出按钮 */
.action-grid #downloadPngButton {
    border: 1px solid #c8d9ef; border-radius: 14px; color: #18385f;
    background: linear-gradient(180deg, #fff 0%, #f2f7fd 100%);
    box-shadow: 0 8px 20px rgba(42,72,111,.10), inset 0 1px 0 rgba(255,255,255,.96);
    font-weight: 850; letter-spacing: .01em;
    transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease, color .16s ease;
}
.action-grid #downloadPngButton svg { color: #1169ff; stroke-width: 2.15; }
.action-grid #downloadPngButton:hover {
    color: #0b3978; border-color: #8eb4ea; background: linear-gradient(180deg, #fff 0%, #eaf3ff 100%);
    box-shadow: 0 11px 24px rgba(42,87,145,.14); transform: translateY(-1px);
}
.action-grid #downloadPngButton:active { transform: translateY(0); box-shadow: 0 5px 12px rgba(42,72,111,.10); }
.action-grid #downloadPngButton:focus-visible { outline: 3px solid rgba(17,105,255,.18); outline-offset: 2px; }
