/* ── AI Draw tools (ai-art-qr / ai-word) ── */

[data-legacy-shell] .legacy-tool-root[data-legacy-tool="ai-art-qr"],
[data-legacy-shell] .legacy-tool-root[data-legacy-tool="ai-word"] {
    --aid-accent: var(--tool-accent, #c45c26);
    --aid-accent-soft: rgba(196, 92, 38, 0.12);
    --aid-stage-radius: 0.75rem;
}

[data-legacy-shell] .legacy-tool-root[data-legacy-tool="ai-art-qr"] .generator-layout.ai-draw-layout,
[data-legacy-shell] .legacy-tool-root[data-legacy-tool="ai-word"] .generator-layout.ai-draw-layout {
    gap: 0;
}

@media (min-width: 1024px) {
    [data-legacy-shell] .legacy-tool-root[data-legacy-tool="ai-art-qr"] .generator-layout.ai-draw-layout,
    [data-legacy-shell] .legacy-tool-root[data-legacy-tool="ai-word"] .generator-layout.ai-draw-layout {
        grid-template-columns: minmax(0, 24rem) minmax(0, 1fr);
        align-items: start;
    }

    [data-legacy-shell] .ai-draw-layout .aid-preview-panel {
        position: sticky;
        top: 1rem;
        max-height: calc(100vh - 2rem);
        display: flex;
        flex-direction: column;
        overflow: hidden;
    }

    [data-legacy-shell] .ai-draw-layout .aid-preview-workspace {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-width: thin;
        scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
    }

    [data-legacy-shell] .ai-draw-layout .aid-preview-workspace::-webkit-scrollbar {
        width: 5px;
    }

    [data-legacy-shell] .ai-draw-layout .aid-preview-workspace::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
        border-radius: 999px;
    }
}

/* ── Left panel ── */
[data-legacy-shell] .ai-draw-layout .aid-input-panel {
    display: flex;
    flex-direction: column;
    gap: 0;
    max-height: calc(100vh - 8rem);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-gutter: stable;
}

[data-legacy-shell] .ai-draw-layout .aid-login-chip {
    margin-bottom: 0.75rem;
}

[data-legacy-shell] .ai-draw-layout .aid-credits-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.625rem;
    margin-bottom: 0.875rem;
    padding-bottom: 0.875rem;
    border-bottom: 1px solid var(--tool-border);
}

[data-legacy-shell] .ai-draw-layout .aid-credits-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.4rem 0.85rem;
    border-radius: 999px;
    background: var(--aid-accent-soft);
    color: var(--tool-ink);
    font-size: 0.8125rem;
}

[data-legacy-shell] .ai-draw-layout .aid-credits-pill i {
    color: var(--aid-accent);
}

[data-legacy-shell] .ai-draw-layout .aid-credits-detail {
    font-size: 0.75rem;
    color: var(--tool-muted, rgba(255, 255, 255, 0.55));
}

[data-legacy-shell] .ai-draw-layout .aid-step-panel h3,
[data-legacy-shell] .ai-draw-layout .aid-kzw-panel h3 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.875rem;
}

[data-legacy-shell] .ai-draw-layout .aid-step-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 999px;
    background: var(--aid-accent);
    color: #fff;
    font-size: 0.6875rem;
    font-weight: 700;
    flex-shrink: 0;
}

[data-legacy-shell] .ai-draw-layout .aid-tab-row {
    display: flex;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
    padding: 0.25rem;
    border-radius: 0.625rem;
    background: rgba(0, 0, 0, 0.15);
}

[data-legacy-shell] .ai-draw-layout .aid-tab {
    flex: 1;
    border: none;
    background: transparent;
    border-radius: 0.5rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.8125rem;
    cursor: pointer;
    color: var(--tool-muted, rgba(255, 255, 255, 0.65));
    transition: background 0.15s ease, color 0.15s ease;
}

[data-legacy-shell] .ai-draw-layout .aid-tab.is-active {
    background: var(--tool-panel-bg, rgba(255, 255, 255, 0.08));
    color: var(--tool-ink);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

[data-legacy-shell] .ai-draw-layout .aid-file-drop {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 7rem;
    padding: 1rem;
    border: 1.5px dashed var(--tool-border);
    border-radius: 0.625rem;
    cursor: pointer;
    text-align: center;
    font-size: 0.8125rem;
    color: var(--tool-muted);
    transition: border-color 0.15s ease, background 0.15s ease;
}

[data-legacy-shell] .ai-draw-layout .aid-file-drop:hover {
    border-color: var(--aid-accent);
    background: var(--aid-accent-soft);
}

[data-legacy-shell] .ai-draw-layout .aid-file-drop i {
    font-size: 1.35rem;
    color: var(--aid-accent);
}

[data-legacy-shell] .ai-draw-layout .aid-upload-note {
    margin-top: 0.5rem;
    font-size: 0.75rem;
    color: #f56c6c;
    text-align: center;
}

/* ── AI QR create card ── */
[data-legacy-shell] .ai-draw-layout .aid-qr-card-body {
    min-height: 12.5rem;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-login {
    min-height: 12.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-login-btn {
    border-radius: 999px;
    padding: 0.65rem 1.25rem;
    font-weight: 600;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-form {
    text-align: center;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-preview-area {
    position: relative;
    background: #f5f5f5;
    border-radius: 0.625rem;
    padding: 0.5rem;
    margin: 0.3125rem 0.3125rem 0.75rem;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-preview-area img {
    width: 12.5rem;
    height: 12.5rem;
    object-fit: contain;
    background: #fff;
    border-radius: 0.375rem;
    display: block;
    margin: 0 auto;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-settings-btn {
    position: absolute;
    right: 0.625rem;
    bottom: 0.625rem;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 999px;
    background: #fff;
    color: #606266;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-settings-btn:hover {
    color: #409eff;
}

body.aid-qr-settings-open {
    overflow: hidden;
}

.aid-qr-settings-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
}

.aid-qr-settings-modal[hidden] {
    display: none !important;
}

.aid-qr-settings-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
}

.aid-qr-settings-panel {
    position: absolute;
    top: 0;
    right: 0;
    width: min(24rem, 100vw);
    height: 100%;
    background: #fff;
    box-shadow: -4px 0 24px rgba(0, 0, 0, 0.12);
    overflow-y: auto;
    padding: 1rem 1.125rem 1.5rem;
}

.aid-qr-settings-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.aid-qr-settings-head h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #303133;
}

.aid-qr-settings-close {
    border: none;
    background: transparent;
    color: #909399;
    font-size: 1.125rem;
    cursor: pointer;
}

.aid-qr-settings-form {
    display: grid;
    gap: 0.875rem;
}

.aid-qr-settings-field label {
    display: block;
    margin-bottom: 0.375rem;
    font-size: 0.875rem;
    color: #606266;
}

.aid-qr-settings-field--inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.aid-qr-settings-field--inline label {
    margin: 0;
}

.aid-qr-settings-radio-row,
.aid-qr-settings-radio-col {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem 0.875rem;
}

.aid-qr-settings-radio-col {
    flex-direction: column;
    align-items: flex-start;
}

.aid-qr-settings-radio-row label,
.aid-qr-settings-radio-col label {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    margin: 0;
    font-size: 0.8125rem;
    color: #303133;
}

.aid-qr-settings-select,
.aid-qr-settings-input {
    width: 100%;
    padding: 0.5rem 0.625rem;
    border: 1px solid #dcdfe6;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    box-sizing: border-box;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-text-input {
    width: 100%;
    min-height: 3.75rem;
    padding: 1rem 1.125rem;
    border: 1px solid #dcdfe6;
    border-radius: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: #303133;
    background: #fff;
    box-sizing: border-box;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-text-input:focus {
    outline: none;
    border-color: #409eff;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-custom-upload {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 10rem;
    margin-bottom: 0.5rem;
    border: 1px dashed #dcdfe6;
    border-radius: 0.5rem;
    background: #fafafa;
    cursor: pointer;
    flex-direction: column;
    gap: 0.5rem;
    color: #909399;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-custom-upload img {
    max-width: 12.5rem;
    max-height: 12.5rem;
    object-fit: contain;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-decode-mode {
    text-align: center;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-decode-upload {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 10rem;
    margin-bottom: 0.5rem;
    border: 1px dashed #dcdfe6;
    border-radius: 0.5rem;
    background: #fafafa;
    cursor: pointer;
    flex-direction: column;
    gap: 0.5rem;
    color: #909399;
    transition: border-color 0.15s ease, background 0.15s ease;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-decode-upload:hover,
[data-legacy-shell] .ai-draw-layout .aid-qr-decode-upload.is-dragover {
    border-color: #409eff;
    background: #ecf5ff;
    color: #606266;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-decode-upload i {
    font-size: 1.75rem;
    color: #409eff;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-decode-upload img {
    max-width: 12.5rem;
    max-height: 12.5rem;
    object-fit: contain;
    border-radius: 0.375rem;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-decode-status {
    margin: 0.25rem 0 0;
    font-size: 0.8125rem;
    color: #606266;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-decode-status.is-loading {
    color: #409eff;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-decode-status.is-success {
    color: #67c23a;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-decode-status.is-error {
    color: #f56c6c;
}

[data-legacy-shell] .ai-draw-layout .aid-step-panel {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--tool-border);
}

[data-legacy-shell] .ai-draw-layout .aid-step-panel:last-child,
[data-legacy-shell] .ai-draw-layout .aid-kzw-panel {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-editor-section.panel-section {
    padding-bottom: 1rem;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--tool-border);
}

[data-legacy-shell] .ai-draw-layout .aid-qr-editor-section.panel-section h3 {
    display: none;
}

[data-legacy-shell] .ai-draw-layout .aid-styles-panel {
    padding-top: 0.25rem;
    flex-shrink: 0;
}

[data-legacy-shell] .ai-draw-layout .aid-styles-panel .aid-cats {
    margin-bottom: 0.625rem;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
    flex-wrap: wrap;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-submit-btn {
    border: 2px solid #e6a23c;
    background: #fff;
    color: #e6a23c;
    border-radius: 999px;
    padding: 0.55rem 1.15rem;
    font-weight: 600;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-submit-btn:hover:not(:disabled) {
    background: #fdf6ec;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-submit-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-clear-btn {
    border: 1px solid #dcdfe6;
    background: #fff;
    color: #606266;
    border-radius: 999px;
    padding: 0.55rem 1.15rem;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-preview-wrap,
[data-legacy-shell] .ai-draw-layout .aid-text-preview-wrap {
    margin-top: 0.875rem;
}

[data-legacy-shell] .ai-draw-layout .aid-qr-preview-box,
[data-legacy-shell] .ai-draw-layout .aid-text-preview-box {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem;
    border-radius: 0.625rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--tool-border);
}

[data-legacy-shell] .ai-draw-layout .aid-qr-preview-box img {
    width: 8rem;
    height: 8rem;
    object-fit: contain;
    border-radius: 0.375rem;
    background: #fff;
}

[data-legacy-shell] .ai-draw-layout .aid-text-preview-box canvas {
    width: 100%;
    max-width: 10rem;
    height: auto;
    border-radius: 0.375rem;
    background: #fff;
}

[data-legacy-shell] .ai-draw-layout .aid-word-controls {
    display: grid;
    gap: 0.625rem;
}

/* ── AI Word editor card (matches original site) ── */
[data-legacy-shell] .ai-draw-layout .aid-word-section-title {
    margin-bottom: 0.75rem;
}

[data-legacy-shell] .ai-draw-layout .aid-word-card {
    border-radius: 0.75rem;
    padding: 0.75rem 0.875rem 0.875rem;
    color: #fff;
    background: linear-gradient(145deg, #d4844a 0%, #c45c26 55%, #9a4318 100%);
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.25);
}

[data-legacy-shell] .ai-draw-layout .aid-word-card-head {
    padding-bottom: 0.75rem;
}

[data-legacy-shell] .ai-draw-layout .aid-word-tabs {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 0.375rem;
    width: 100%;
}

[data-legacy-shell] .ai-draw-layout .aid-word-tab {
    border: none;
    background: transparent;
    color: rgba(255, 255, 255, 0.92);
    font-size: 0.8125rem;
    font-weight: 600;
    line-height: 1.2;
    padding: 0.5rem 0.4rem;
    border-radius: 0.5rem;
    cursor: pointer;
    transition: background 0.15s ease, color 0.15s ease;
    white-space: nowrap;
    text-align: center;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-legacy-shell] .ai-draw-layout .aid-word-tab.is-active {
    background: #ff374e;
    color: #fff;
}

[data-legacy-shell] .ai-draw-layout .aid-word-card-body {
    background: #fff;
    border-radius: 0.625rem;
    padding: 0.625rem;
    text-align: center;
}

[data-legacy-shell] .ai-draw-layout .aid-word-edit-trigger {
    display: flex;
    align-items: center;
    justify-content: center;
    width: calc(100% - 1.25rem);
    min-height: 12.5rem;
    margin: 0.625rem auto;
    padding: 0.5rem;
    border: 1px dashed #ccc;
    border-radius: 0.375rem;
    background: #f5f5f5;
    color: #999;
    cursor: pointer;
    transition: border-color 0.15s ease;
}

[data-legacy-shell] .ai-draw-layout .aid-word-edit-trigger:hover:not(:disabled) {
    border-color: #409eff;
}

[data-legacy-shell] .ai-draw-layout .aid-word-edit-trigger img {
    max-width: 100%;
    max-height: 11rem;
    object-fit: contain;
}

[data-legacy-shell] .ai-draw-layout .aid-word-upload-zone {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 12.5rem;
    margin: 0.625rem auto;
    width: calc(100% - 1.25rem);
    border: 1px dashed #ccc;
    border-radius: 0.375rem;
    background: #f5f5f5;
    color: #999;
    cursor: pointer;
    flex-direction: column;
    gap: 0.5rem;
}

[data-legacy-shell] .ai-draw-layout .aid-word-upload-zone:hover {
    border-color: #409eff;
}

[data-legacy-shell] .ai-draw-layout .aid-word-upload-zone img {
    max-width: 100%;
    max-height: 11rem;
    object-fit: contain;
}

[data-legacy-shell] .ai-draw-layout .aid-word-upload-zone i {
    font-size: 1.5rem;
    color: #bbb;
}

/* ── Word edit modal ── */
body.aid-word-modal-open {
    overflow: hidden;
}

.aid-word-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.aid-word-modal[hidden] {
    display: none !important;
}

.aid-word-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 13, 11, 0.65);
    backdrop-filter: blur(3px);
}

.aid-word-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(100%, 68rem);
    max-height: min(92vh, 44rem);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: #fff;
    border-radius: 0.75rem;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.35);
    color: #1f2937;
}

.aid-word-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1.125rem;
    border-bottom: 1px solid #e4e7ed;
}

.aid-word-modal-header h4 {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #303133;
}

.aid-word-modal-close {
    border: none;
    background: transparent;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    cursor: pointer;
    color: #909399;
}

.aid-word-modal-close:hover {
    background: #f5f7fa;
    color: #606266;
}

.aid-word-modal-body.dk-text {
    display: flex;
    align-items: flex-start;
    justify-content: space-evenly;
    gap: 1.5rem;
    padding: 1.25rem 1.5rem;
    overflow-y: auto;
}

.aid-word-modal-left.dk-text-left {
    flex: 0 0 22.625rem;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.aid-word-fabric-wrap.dk-canvas {
    width: 22.625rem;
    height: 22.625rem;
    border: 1px solid #ccc;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    overflow: hidden;
}

.aid-word-fabric-wrap .canvas-container {
    width: 360px !important;
    height: 360px !important;
}

.aid-word-fabric-wrap canvas {
    display: block;
}

.aid-word-canvas-toolbar.dk-options {
    display: flex;
    justify-content: space-evenly;
    width: 100%;
    margin-top: 0.625rem;
}

.aid-word-tool-btn {
    border: none;
    background: transparent;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    font-size: 1.125rem;
    color: #606266;
}

.aid-word-tool-btn:hover:not(:disabled) {
    color: #409eff;
}

.aid-word-tool-btn:disabled {
    color: #ccc;
    cursor: not-allowed;
}

.aid-word-modal-form.dk-text-right {
    flex: 1 1 34.375rem;
    max-width: 34.375rem;
    min-width: 0;
}

.aid-word-form-tabs.el-tabs {
    display: flex;
    gap: 1.5rem;
    margin-bottom: 0.875rem;
    border-bottom: 1px solid #e4e7ed;
}

.aid-word-form-tab {
    border: none;
    background: transparent;
    padding: 0 0 0.75rem;
    margin-bottom: -1px;
    font-size: 0.875rem;
    font-weight: 500;
    color: #303133;
    cursor: pointer;
    border-bottom: 2px solid transparent;
}

.aid-word-form-tab.is-active {
    color: #409eff;
    border-bottom-color: #409eff;
}

.aid-word-form-pane {
    min-height: 18.75rem;
}

.aid-word-field {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-bottom: 0.625rem;
}

.aid-word-field--compact {
    flex-direction: column;
    gap: 0.35rem;
}

.aid-word-field--color {
    align-items: center;
}

.aid-word-field-label {
    flex: 0 0 5rem;
    font-size: 0.875rem;
    font-weight: 800;
    color: #303133;
    line-height: 2rem;
}

.aid-word-field--compact .aid-word-field-label {
    flex: none;
    line-height: 1.25;
}

.aid-word-field-control {
    flex: 1;
    min-width: 0;
}

.aid-word-input {
    width: 100%;
    border: 1px solid #dcdfe6;
    border-radius: 0.25rem;
    padding: 0.45rem 0.65rem;
    font-size: 0.875rem;
    color: #606266;
    background: #fff;
    box-sizing: border-box;
}

textarea.aid-word-input {
    min-height: 4.5rem;
    resize: vertical;
    line-height: 1.5;
}

.aid-word-input:focus {
    outline: none;
    border-color: #409eff;
}

.aid-word-field--fonts {
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
}

.aid-word-field--fonts .aid-word-field-label {
    flex: none;
    line-height: 1.35;
}

.aid-word-font-radios {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    max-height: 20rem;
    overflow-y: auto;
    overflow-x: hidden;
    padding-right: 0.25rem;
    scrollbar-width: thin;
    width: 100%;
}

.aid-word-font-group-label {
    margin: 0 0 0.4rem;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #909399;
}

.aid-word-font-group-items {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.aid-word-font-hint {
    margin: 0.5rem 0 0;
    font-size: 0.6875rem;
    line-height: 1.45;
    color: #909399;
}

.aid-word-font-opt {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.35rem;
    padding: 0.45rem 0.9rem;
    border: 1px solid #dcdfe6;
    border-radius: 0.375rem;
    cursor: pointer;
    font-size: 0.75rem;
    margin: 0;
    background: #fafafa;
    color: #303133;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    user-select: none;
    transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.aid-word-font-preview {
    white-space: nowrap;
    font-family: inherit;
    line-height: 1.2;
}

.aid-word-font-opt.is-loading {
    opacity: 0.55;
    pointer-events: none;
}

.aid-word-font-opt input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.aid-word-font-opt img {
    max-height: 1.25rem;
}

.aid-word-font-opt:has(input:checked) {
    border-color: #409eff;
    color: #409eff;
    background: rgba(64, 158, 255, 0.08);
}

.aid-word-weight-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.625rem;
}

.aid-word-weight-opt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 5rem;
    padding: 0.625rem 1rem;
    border: 1px solid #dcdfe6;
    border-radius: 0.25rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.aid-word-weight-opt .is-bold {
    font-weight: 700;
}

.aid-word-weight-opt input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.aid-word-weight-opt:has(input:checked) {
    border-color: #409eff;
    color: #409eff;
}

.aid-word-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1rem;
}

.aid-word-color-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem 1rem;
}

.aid-num-input {
    display: inline-flex;
    align-items: stretch;
    border: 1px solid #dcdfe6;
    border-radius: 0.25rem;
    overflow: hidden;
    width: 100%;
}

.aid-num-input--wide {
    max-width: 12rem;
}

.aid-num-btn {
    border: none;
    background: #f5f7fa;
    color: #606266;
    width: 1.75rem;
    cursor: pointer;
    font-size: 0.875rem;
}

.aid-num-btn:hover {
    color: #409eff;
}

.aid-num-input .aid-word-input {
    border: none;
    border-left: 1px solid #dcdfe6;
    border-right: 1px solid #dcdfe6;
    border-radius: 0;
    text-align: center;
    padding: 0.35rem 0.25rem;
}

.aid-color-picker {
    width: 2rem;
    height: 2rem;
    padding: 0.125rem;
    border: 1px solid #dcdfe6;
    border-radius: 0.25rem;
    cursor: pointer;
    background: #fff;
}

.aid-color-hex-wrap {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    max-width: 11rem;
}

.aid-color-swatch-btn {
    position: relative;
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    display: inline-flex;
    cursor: pointer;
}

.aid-color-swatch {
    width: 100%;
    height: 100%;
    border: 1px solid #dcdfe6;
    border-radius: 0.25rem;
    background: #fff;
    box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.04);
    pointer-events: none;
}

.aid-color-picker-native {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
    margin: 0;
}

.aid-color-hex-input {
    flex: 1;
    min-width: 0;
    width: 100%;
    border: 1px solid #dcdfe6;
    border-radius: 0.25rem;
    padding: 0.45rem 0.55rem;
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
    font-size: 0.8125rem;
    letter-spacing: 0.02em;
    color: #303133;
    background: #fff;
    box-sizing: border-box;
}

.aid-color-hex-input:focus {
    outline: none;
    border-color: #409eff;
}

.aid-color-hex-input.is-invalid {
    border-color: #f56c6c;
}

.aid-word-form-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.25rem;
    padding-top: 0.5rem;
}

.aid-word-confirm-btn {
    min-width: 12.5rem;
    background: #c45c26 !important;
    border-color: #c45c26 !important;
}

.aid-word-cancel-btn {
    border: none !important;
    background: transparent !important;
    color: #606266 !important;
    box-shadow: none !important;
}

@media (max-width: 900px) {
    .aid-word-modal-body.dk-text {
        flex-direction: column;
        align-items: stretch;
    }

    .aid-word-modal-left.dk-text-left,
    .aid-word-modal-form.dk-text-right {
        flex: none;
        max-width: none;
        width: 100%;
    }

    .aid-word-fabric-wrap.dk-canvas {
        width: min(100%, 22.625rem);
        height: auto;
        aspect-ratio: 1;
        margin: 0 auto;
    }

    .aid-word-form-grid,
    .aid-word-color-grid {
        grid-template-columns: 1fr;
    }
}

[data-legacy-shell] .ai-draw-layout .aid-range-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
}

[data-legacy-shell] .ai-draw-layout .aid-range-row input[type="range"] {
    flex: 1;
}

[data-legacy-shell] .ai-draw-layout .aid-color-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

[data-legacy-shell] .ai-draw-layout .aid-color-row input[type="color"] {
    width: 2.75rem;
    height: 2rem;
    padding: 0.15rem;
    border: 1px solid var(--tool-border);
    border-radius: 0.375rem;
    cursor: pointer;
}

/* ── Categories & styles ── */
[data-legacy-shell] .ai-draw-layout .aid-cats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    margin-bottom: 0.75rem;
}

[data-legacy-shell] .ai-draw-layout .aid-cat {
    border: 1px solid var(--tool-border);
    background: rgba(0, 0, 0, 0.12);
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font-size: 0.75rem;
    cursor: pointer;
    color: var(--tool-muted);
    transition: all 0.15s ease;
    white-space: nowrap;
}

[data-legacy-shell] .ai-draw-layout .aid-cat.is-active {
    background: var(--aid-accent);
    color: #fff;
    border-color: transparent;
}

[data-legacy-shell] .ai-draw-layout .aid-style-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
}

@media (min-width: 1200px) {
    [data-legacy-shell] .ai-draw-layout .aid-style-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

[data-legacy-shell] .ai-draw-layout .aid-style-card {
    position: relative;
    border: 2px solid transparent;
    border-radius: 0.5rem;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
    padding: 0;
    aspect-ratio: 1;
}

[data-legacy-shell] .ai-draw-layout .aid-style-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

[data-legacy-shell] .ai-draw-layout .aid-style-card.is-active {
    border-color: var(--aid-accent);
    box-shadow: 0 0 0 2px var(--aid-accent);
}

[data-legacy-shell] .ai-draw-layout .aid-style-card img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

[data-legacy-shell] .ai-draw-layout .aid-style-card .aid-style-name {
    display: none;
}

[data-legacy-shell] .ai-draw-layout .aid-style-card .aid-style-cost {
    position: absolute;
    right: 0.35rem;
    bottom: 0.35rem;
    top: auto;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    background: rgba(124, 58, 237, 0.92);
    color: #fff;
    font-size: 0.625rem;
    font-weight: 600;
    line-height: 1.2;
    z-index: 1;
}

[data-legacy-shell] .ai-draw-layout .aid-style-card.is-active .aid-style-cost {
    background: rgba(196, 92, 38, 0.95);
}

[data-legacy-shell] .ai-draw-layout .aid-style-zoom {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 2;
    border: none;
    border-radius: 0 0.45rem 0 0.45rem;
    width: 1.75rem;
    height: 1.75rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(124, 58, 237, 0.95);
    color: #fff;
    cursor: pointer;
    font-size: 0.75rem;
}

[data-legacy-shell] .ai-draw-layout .aid-style-zoom:hover {
    background: #9a4318;
}

[data-legacy-shell] .ai-draw-layout .aid-style-pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.35rem 0.5rem;
    margin-top: 0.75rem;
    padding-top: 0.75rem;
    border-top: 1px solid var(--tool-border);
}

[data-legacy-shell] .ai-draw-layout .aid-style-page-list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

[data-legacy-shell] .ai-draw-layout .aid-style-page-num {
    min-width: 1.75rem;
    height: 1.75rem;
    padding: 0 0.35rem;
    border: 1px solid var(--tool-border);
    border-radius: 0.375rem;
    background: rgba(0, 0, 0, 0.12);
    color: var(--tool-ink);
    font-size: 0.75rem;
    cursor: pointer;
}

[data-legacy-shell] .ai-draw-layout .aid-style-page-num.is-active {
    background: var(--aid-accent);
    border-color: var(--aid-accent);
    color: #fff;
    cursor: default;
}

[data-legacy-shell] .ai-draw-layout .aid-style-page-num:hover:not(.is-active) {
    border-color: var(--aid-accent);
    background: var(--aid-accent-soft);
}

[data-legacy-shell] .ai-draw-layout .aid-style-page-ellipsis {
    padding: 0 0.15rem;
    color: var(--tool-muted);
    font-size: 0.75rem;
    line-height: 1.75rem;
}

[data-legacy-shell] .ai-draw-layout .aid-style-page-total {
    flex-basis: 100%;
    text-align: center;
    font-size: 0.6875rem;
    color: var(--tool-muted);
}

[data-legacy-shell] .ai-draw-layout .aid-style-page-btn {
    border: 1px solid var(--tool-border);
    background: rgba(0, 0, 0, 0.12);
    color: var(--tool-ink);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.75rem;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    white-space: nowrap;
}

[data-legacy-shell] .ai-draw-layout .aid-style-page-btn:hover:not(:disabled) {
    border-color: var(--aid-accent);
    background: var(--aid-accent-soft);
}

[data-legacy-shell] .ai-draw-layout .aid-style-page-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ── KZW panel (left sidebar) ── */
[data-legacy-shell] .ai-draw-layout .aid-kzw-form {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
}

[data-legacy-shell] .ai-draw-layout .aid-kzw-item {
    border: 1px solid var(--tool-border);
    border-radius: 0.5rem;
    overflow: hidden;
}

[data-legacy-shell] .ai-draw-layout .aid-kzw-item summary {
    padding: 0.55rem 0.75rem;
    font-size: 0.8125rem;
    font-weight: 600;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.12);
    list-style: none;
}

[data-legacy-shell] .ai-draw-layout .aid-kzw-item summary::-webkit-details-marker {
    display: none;
}

[data-legacy-shell] .ai-draw-layout .aid-kzw-fields {
    padding: 0.625rem 0.75rem 0.75rem;
    display: grid;
    gap: 0.625rem;
}

[data-legacy-shell] .ai-draw-layout .aid-kzw-field label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.75rem;
    margin-bottom: 0.25rem;
    color: var(--tool-muted);
}

[data-legacy-shell] .ai-draw-layout .aid-kzw-field input[type="range"] {
    width: 100%;
    margin: 0;
}

[data-legacy-shell] .ai-draw-layout .aid-kzw-field .aid-kzw-num {
    font-variant-numeric: tabular-nums;
    color: var(--tool-ink);
}

/* ── Preview panel ── */
[data-legacy-shell] .legacy-tool-root[data-legacy-tool="ai-art-qr"] .aid-preview-panel,
[data-legacy-shell] .legacy-tool-root[data-legacy-tool="ai-word"] .aid-preview-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0 !important;
    background: var(--ws-artboard-chrome, #141210) !important;
    background-image: none !important;
}

[data-legacy-shell] .legacy-tool-root[data-legacy-tool="ai-art-qr"] .aid-preview-area,
[data-legacy-shell] .legacy-tool-root[data-legacy-tool="ai-word"] .aid-preview-area {
    background: transparent !important;
    background-image: none !important;
}

[data-legacy-shell] .ai-draw-layout .aid-preview-workspace {
    width: min(100%, 32rem);
    max-width: 32rem;
    margin: 0 auto;
    padding: 1rem 1.25rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1;
    justify-content: flex-start;
}

[data-legacy-shell] .ai-draw-layout .aid-preview-card {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    padding: 0.875rem;
    border-radius: 0.875rem;
    border: 1px solid rgba(255, 255, 255, 0.08);
    background: rgba(0, 0, 0, 0.22);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

[data-legacy-shell] .ai-draw-layout .aid-preview-panel {
    display: flex;
    flex-direction: column;
    min-height: 0;
    padding: 0 !important;
}

[data-legacy-shell] .ai-draw-layout .aid-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--tool-border);
}

[data-legacy-shell] .ai-draw-layout .aid-preview-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

[data-legacy-shell] .ai-draw-layout .aid-preview-area {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: transparent;
}

[data-legacy-shell] .ai-draw-layout .aid-draw-stage {
    position: relative;
    width: 100%;
    aspect-ratio: 1;
    border-radius: calc(var(--aid-stage-radius) - 2px);
    overflow: hidden;
    background: #0f0f0f;
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: none;
}

[data-legacy-shell] .ai-draw-layout .aid-draw-stage--idle {
    border-style: dashed;
    border-color: rgba(255, 255, 255, 0.12);
    background: rgba(255, 255, 255, 0.02);
}

[data-legacy-shell] .ai-draw-layout .aid-draw-stage--has-style {
    border-style: solid;
    background: #0a0a0a;
}

[data-legacy-shell] .ai-draw-layout .aid-draw-stage--has-style .aid-style-backdrop {
    object-fit: contain;
    filter: none;
    transform: none;
    background: #101010;
}

[data-legacy-shell] .ai-draw-layout .aid-draw-stage--has-style .aid-stage-dim {
    display: none;
}

[data-legacy-shell] .ai-draw-layout .aid-stage-zoom-btn {
    position: absolute;
    top: 0.65rem;
    right: 0.65rem;
    z-index: 3;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 0.45rem;
    background: rgba(124, 58, 237, 0.95);
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

[data-legacy-shell] .ai-draw-layout .aid-stage-zoom-btn:hover {
    background: #9a4318;
}

[data-legacy-shell] .ai-draw-layout .aid-stage-zoom-btn[hidden] {
    display: none !important;
}

[data-legacy-shell] .ai-draw-layout .aid-draw-stage--result,
[data-legacy-shell] .ai-draw-layout .aid-draw-stage--generating {
    background: #141414;
}

[data-legacy-shell] .ai-draw-layout .aid-draw-stage--result .aid-style-backdrop,
[data-legacy-shell] .ai-draw-layout .aid-draw-stage--result .aid-stage-dim,
[data-legacy-shell] .ai-draw-layout .aid-draw-stage--generating .aid-style-backdrop,
[data-legacy-shell] .ai-draw-layout .aid-draw-stage--generating .aid-stage-dim {
    display: none !important;
}

[data-legacy-shell] .ai-draw-layout .aid-style-backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: brightness(0.72) saturate(0.95);
    transform: scale(1.02);
}

[data-legacy-shell] .ai-draw-layout .aid-stage-dim {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.15) 0%, rgba(0, 0, 0, 0.55) 100%);
    pointer-events: none;
}

[data-legacy-shell] .ai-draw-layout .aid-stage-idle {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    text-align: center;
    z-index: 1;
}

[data-legacy-shell] .ai-draw-layout .aid-stage-idle[hidden] {
    display: none !important;
}

[data-legacy-shell] .ai-draw-layout .aid-stage-placeholder {
    color: rgba(255, 255, 255, 0.72);
    max-width: 14rem;
}

[data-legacy-shell] .ai-draw-layout .aid-stage-icon {
    font-size: 1.75rem;
    margin-bottom: 0.625rem;
    opacity: 0.55;
    color: var(--aid-accent);
}

[data-legacy-shell] .ai-draw-layout .aid-stage-placeholder p {
    margin: 0 0 0.3rem;
    font-size: 0.875rem;
    font-weight: 600;
}

[data-legacy-shell] .ai-draw-layout .aid-stage-placeholder small {
    font-size: 0.6875rem;
    opacity: 0.65;
    line-height: 1.45;
}

[data-legacy-shell] .ai-draw-layout .aid-stage-actions-bar {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    width: 100%;
}

[data-legacy-shell] .ai-draw-layout .aid-stage-actions-bar[hidden] {
    display: none !important;
}

[data-legacy-shell] .ai-draw-layout .aid-generate-btn {
    width: 100%;
    padding: 0.75rem 1.25rem;
    border-radius: 0.625rem;
    font-weight: 600;
    font-size: 0.9375rem;
    box-shadow: 0 6px 20px rgba(196, 92, 38, 0.28);
}

[data-legacy-shell] .ai-draw-layout .aid-cost-hint {
    margin: 0;
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.45);
    text-align: center;
}

[data-legacy-shell] .ai-draw-layout .aid-preview-stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2;
    padding: 0;
    background: #141414;
}

[data-legacy-shell] .ai-draw-layout .aid-preview-stage[hidden] {
    display: none !important;
}

[data-legacy-shell] .ai-draw-layout .aid-preview-stage img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 0;
    background: #141414;
}

[data-legacy-shell] .ai-draw-layout .aid-loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 13, 11, 0.78);
    backdrop-filter: blur(4px);
}

[data-legacy-shell] .ai-draw-layout .aid-loading-overlay[hidden] {
    display: none !important;
}

[data-legacy-shell] .ai-draw-layout .aid-loading-card {
    width: min(92%, 22rem);
    text-align: center;
}

[data-legacy-shell] .ai-draw-layout .aid-progress-steps {
    display: flex;
    justify-content: space-between;
    gap: 0.35rem;
    list-style: none;
    margin: 0 0 0.85rem;
    padding: 0;
}

[data-legacy-shell] .ai-draw-layout .aid-progress-steps li {
    flex: 1;
    position: relative;
    padding: 0.35rem 0.25rem;
    border-radius: 0.375rem;
    font-size: 0.6875rem;
    line-height: 1.3;
    color: rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.06);
}

[data-legacy-shell] .ai-draw-layout .aid-progress-steps li.is-active {
    color: #fff8ee;
    background: rgba(232, 160, 76, 0.28);
}

[data-legacy-shell] .ai-draw-layout .aid-progress-steps li.is-done {
    color: rgba(200, 230, 201, 0.95);
    background: rgba(76, 175, 80, 0.22);
}

[data-legacy-shell] .ai-draw-layout .aid-progress-meta {
    margin: 0.4rem 0 0;
    font-size: 0.75rem;
    line-height: 1.4;
    color: rgba(255, 232, 196, 0.88);
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status {
    display: flex;
    gap: 0.75rem;
    align-items: flex-start;
    margin: 0.65rem 0 0;
    padding: 0.8rem 0.9rem;
    border-radius: 0.7rem;
    border: 1px solid rgba(232, 160, 76, 0.45);
    background: linear-gradient(145deg, rgba(232, 160, 76, 0.18), rgba(20, 16, 12, 0.55));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status[hidden] {
    display: none !important;
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status[data-state="warming"],
[data-legacy-shell] .ai-draw-layout .aid-gpu-status[data-state="idle"] {
    border-color: rgba(232, 160, 76, 0.5);
    background: linear-gradient(145deg, rgba(232, 160, 76, 0.2), rgba(20, 16, 12, 0.55));
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status[data-state="ready"] {
    border-color: rgba(102, 187, 106, 0.55);
    background: linear-gradient(145deg, rgba(76, 175, 80, 0.22), rgba(16, 22, 16, 0.6));
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status[data-state="error"] {
    border-color: rgba(239, 154, 154, 0.55);
    background: linear-gradient(145deg, rgba(229, 115, 115, 0.2), rgba(28, 14, 14, 0.55));
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status__pulse {
    width: 0.65rem;
    height: 0.65rem;
    margin-top: 0.35rem;
    border-radius: 999px;
    background: #ffb74d;
    flex-shrink: 0;
    box-shadow: 0 0 0 0 rgba(255, 183, 77, 0.55);
    animation: aid-gpu-pulse 1.6s ease-out infinite;
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status[data-state="ready"] .aid-gpu-status__pulse {
    background: #81c784;
    box-shadow: 0 0 0 3px rgba(129, 199, 132, 0.2);
    animation: none;
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status[data-state="error"] .aid-gpu-status__pulse {
    background: #ef9a9a;
    box-shadow: none;
    animation: none;
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status__body {
    min-width: 0;
    flex: 1;
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status__title {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 650;
    line-height: 1.4;
    letter-spacing: 0.01em;
    color: #fff6e8;
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status[data-state="ready"] .aid-gpu-status__title {
    color: #e8f5e9;
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status[data-state="error"] .aid-gpu-status__title {
    color: #ffebee;
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status__detail {
    margin: 0.3rem 0 0;
    font-size: 0.75rem;
    line-height: 1.5;
    color: rgba(255, 244, 225, 0.78);
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status[data-state="ready"] .aid-gpu-status__detail {
    color: rgba(232, 245, 233, 0.78);
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status[data-state="error"] .aid-gpu-status__detail {
    color: rgba(255, 235, 238, 0.78);
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status__steps {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    list-style: none;
    margin: 0.65rem 0 0;
    padding: 0;
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status__steps li {
    padding: 0.22rem 0.55rem;
    border-radius: 999px;
    font-size: 0.6875rem;
    line-height: 1.35;
    color: rgba(255, 255, 255, 0.42);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.08);
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status__steps li.is-active {
    color: #fff8e7;
    background: rgba(255, 183, 77, 0.28);
    border-color: rgba(255, 183, 77, 0.55);
    font-weight: 650;
    box-shadow: 0 0 0 1px rgba(255, 183, 77, 0.12);
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status__steps li.is-done {
    color: #c8e6c9;
    background: rgba(129, 199, 132, 0.2);
    border-color: rgba(129, 199, 132, 0.35);
}

[data-legacy-shell] .ai-draw-layout .aid-gpu-status[data-state="ready"] .aid-gpu-status__steps li.is-done {
    color: #e8f5e9;
    background: rgba(129, 199, 132, 0.28);
    border-color: rgba(165, 214, 167, 0.45);
}

@keyframes aid-gpu-pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 183, 77, 0.55); }
    70% { box-shadow: 0 0 0 0.55rem rgba(255, 183, 77, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 183, 77, 0); }
}

[data-legacy-shell] .ai-draw-layout .aid-progress-bar {
    height: 0.5rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    overflow: hidden;
    margin-bottom: 0.625rem;
}

[data-legacy-shell] .ai-draw-layout .aid-progress-bar span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--aid-accent), #e8a04c);
    transition: width 0.25s ease;
}

[data-legacy-shell] .ai-draw-layout .aid-progress-text {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.92);
}

[data-legacy-shell] .ai-draw-layout .aid-progress-hint {
    margin: 0.5rem 0 0;
    font-size: 0.75rem;
    line-height: 1.45;
    color: rgba(255, 255, 255, 0.62);
}

[data-legacy-shell] .ai-draw-layout .aid-progress-preview {
    margin-top: 0.75rem;
    max-width: 100%;
    max-height: 8rem;
    border-radius: 0.375rem;
    object-fit: contain;
}

[data-legacy-shell] .ai-draw-layout .aid-alert {
    margin: 0;
    padding: 0.55rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.75rem;
}

[data-legacy-shell] .ai-draw-layout .aid-alert--error {
    background: rgba(229, 115, 115, 0.15);
    color: #ffcdd2;
}

[data-legacy-shell] .ai-draw-layout .aid-alert--success {
    background: rgba(76, 175, 80, 0.15);
    color: #c8e6c9;
}

[data-legacy-shell] .ai-draw-layout .aid-history-panel {
    flex-shrink: 0;
    border-top: none;
    background: transparent;
    padding: 0;
    width: 100%;
}

[data-legacy-shell] .ai-draw-layout .aid-history-head h4 {
    margin: 0 0 0.45rem;
    font-size: 0.75rem;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.5);
    display: flex;
    align-items: center;
    gap: 0.35rem;
    letter-spacing: 0.03em;
}

[data-legacy-shell] .ai-draw-layout .aid-history-grid {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    padding-bottom: 0.15rem;
    min-height: 4.5rem;
    align-items: center;
    scroll-snap-type: x mandatory;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.25) transparent;
}

[data-legacy-shell] .ai-draw-layout .aid-history-grid:empty::before {
    content: attr(data-empty-hint);
    font-size: 0.6875rem;
    color: rgba(255, 255, 255, 0.38);
    padding: 0.25rem 0;
}

[data-legacy-shell] .ai-draw-layout .aid-history-grid::-webkit-scrollbar {
    height: 4px;
}

[data-legacy-shell] .ai-draw-layout .aid-history-grid::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.22);
    border-radius: 999px;
}

[data-legacy-shell] .ai-draw-layout .aid-history-grid::-webkit-scrollbar-track {
    background: transparent;
}

[data-legacy-shell] .ai-draw-layout .aid-history-item {
    flex: 0 0 4.25rem;
    scroll-snap-align: start;
    border: 2px solid transparent;
    border-radius: 0.45rem;
    overflow: hidden;
    cursor: pointer;
    transition: border-color 0.15s ease;
    padding: 0;
    background: none;
}

[data-legacy-shell] .ai-draw-layout .aid-history-head h4 i {
    color: var(--aid-accent);
}

[data-legacy-shell] .ai-draw-layout .aid-history-item:hover,
[data-legacy-shell] .ai-draw-layout .aid-history-item.is-active {
    border-color: var(--aid-accent);
}

[data-legacy-shell] .ai-draw-layout .aid-history-item img {
    display: block;
    width: 4.25rem;
    height: 4.25rem;
    object-fit: cover;
}

body.aid-lightbox-open {
    overflow: hidden;
}

.aid-style-lightbox {
    position: fixed;
    inset: 0;
    z-index: 1300;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.aid-style-lightbox[hidden] {
    display: none !important;
}

.aid-style-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.78);
}

.aid-style-lightbox-dialog {
    position: relative;
    z-index: 1;
    max-width: min(92vw, 42rem);
    max-height: min(92vh, 42rem);
    background: #111;
    border-radius: 0.75rem;
    padding: 0.75rem;
    box-shadow: 0 24px 64px rgba(0, 0, 0, 0.45);
}

.aid-style-lightbox-dialog img {
    display: block;
    max-width: 100%;
    max-height: calc(92vh - 4rem);
    margin: 0 auto;
    object-fit: contain;
}

.aid-style-lightbox-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    z-index: 2;
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    cursor: pointer;
}

.aid-style-lightbox-close:hover {
    background: rgba(255, 255, 255, 0.28);
}

@media (max-width: 1023px) {
    [data-legacy-shell] .ai-draw-layout .aid-input-panel {
        max-height: none;
        overflow: visible;
    }

    [data-legacy-shell] .ai-draw-layout .aid-preview-workspace {
        width: 100%;
        max-width: none;
        padding: 0 0.75rem 0.75rem;
    }

    [data-legacy-shell] .ai-draw-layout .aid-style-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    [data-legacy-shell] .ai-draw-layout .aid-word-tab {
        font-size: 0.75rem;
        padding: 0.45rem 0.3rem;
    }

    [data-legacy-shell] .ai-draw-layout .aid-style-page-num {
        min-width: 1.55rem;
        height: 1.55rem;
        font-size: 0.6875rem;
    }
}
