/* ==================== 图片生成器样式 ==================== */

.image-generator-container {
    flex: 1;
    min-width: 0;
    min-height: 0;
    width: 100%;
    padding: 24px 28px 40px;
    background: var(--bg);
    overflow-y: auto;
}

.image-generator-inner {
    width: min(960px, 100%);
    margin: 0 auto;
}

.ig-header {
    margin-bottom: 18px;
}

.ig-header h2 {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -.03em;
    color: var(--text);
}

.ig-header p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 13px;
}

/* ===== 模式切换 ===== */
.ig-tabs {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 16px;
    padding: 4px;
    border-radius: 16px;
    background: color-mix(in srgb, var(--panel) 76%, transparent);
    border: 1px solid color-mix(in srgb, var(--line-soft) 78%, transparent);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16);
}

.ig-tab {
    min-height: 38px;
    padding: 0 18px;
    border: 0;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ig-tab:hover {
    background: color-mix(in srgb, var(--panel) 80%, transparent);
    color: var(--text);
}

.ig-tab.active {
    background: var(--panel);
    border-color: transparent;
    color: var(--text);
    box-shadow: 0 8px 18px rgba(15, 23, 42, .08);
}

/* ===== 结果展示区 ===== */
.ig-result-area {
    position: relative;
    background: var(--panel);
    border: 1px solid var(--line-soft);
    border-radius: 16px;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 16px;
    padding: 16px;
    overflow: hidden;
}

.ig-result-area img {
    max-width: 100%;
    max-height: 520px;
    border-radius: 10px;
    cursor: zoom-in;
    display: block;
}

.ig-placeholder {
    color: var(--muted-2);
    text-align: center;
    font-size: 14px;
}

.ig-result-actions {
    position: absolute;
    bottom: 12px;
    right: 12px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.ig-result-actions .btn {
    min-height: 34px;
    padding: 0 14px;
    font-size: 13px;
}

/* ===== 加载动画 ===== */
.ig-loading {
    text-align: center;
    color: var(--muted);
}

.ig-spinner {
    width: 42px;
    height: 42px;
    margin: 0 auto 14px;
    border: 3px solid var(--line-soft);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: ig-spin 1s linear infinite;
}

@keyframes ig-spin {
    to { transform: rotate(360deg); }
}

.ig-loading p {
    margin: 0;
    font-size: 14px;
    color: var(--muted);
}

/* ===== 多图参考网格 ===== */
.ig-ref-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(108px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
    padding: 12px;
    border: 2px dashed var(--line);
    border-radius: 14px;
    background: var(--panel-muted);
    transition: border-color .2s ease, background-color .2s ease;
}

.ig-ref-grid.drag-over {
    border-color: var(--blue);
    background: var(--blue-soft);
}

.ig-ref-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 10px;
    overflow: hidden;
    background: var(--panel);
    border: 1px solid var(--line-soft);
}

.ig-ref-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ig-ref-thumb .ig-remove-ref {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 22px;
    height: 22px;
    border: none;
    border-radius: 50%;
    background: rgba(215, 0, 21, .85);
    color: #fff;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ig-ref-thumb .ig-remove-ref:hover {
    background: var(--red);
}

.ig-ref-add {
    aspect-ratio: 1;
    border: 1px dashed var(--line);
    border-radius: 10px;
    background: var(--panel);
    color: var(--muted);
    font-size: 12px;
    line-height: 1.4;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 8px;
    transition: all .2s ease;
}

.ig-ref-add:hover {
    border-color: var(--blue);
    color: var(--blue);
    background: var(--blue-soft);
}

.ig-ref-add-plus {
    font-size: 22px;
    line-height: 1;
    font-weight: 300;
}

.ig-ref-add-text {
    text-align: center;
    font-size: 11px;
}

.ig-ref-add-text small {
    color: var(--muted-2);
    font-size: 10px;
}

/* ===== 实际生效参数对比 ===== */
.ig-actual-params {
    margin-bottom: 14px;
    padding: 10px 14px;
    background: var(--panel-muted);
    border: 1px solid var(--line-soft);
    border-radius: 12px;
    font-size: 12px;
    color: var(--muted);
}

.ig-actual-params-title {
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
    font-size: 12px;
}

.ig-actual-params-list {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.ig-actual-params-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.ig-actual-params-item .label {
    color: var(--muted-2);
}

.ig-actual-params-item .value {
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.ig-actual-params-item.diff .value {
    color: var(--red);
    font-weight: 600;
}

.ig-actual-params-item.diff .arrow {
    color: var(--muted-2);
}

.ig-time-info {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--line-soft);
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.ig-time-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
}

.ig-time-item .label {
    color: var(--muted-2);
}

.ig-time-item .value {
    color: var(--text);
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.ig-revised-prompt {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--line-soft);
    font-size: 12px;
    color: var(--muted);
    line-height: 1.55;
    word-break: break-word;
}

.ig-revised-prompt b {
    color: var(--text);
    font-weight: 600;
}

/* ===== 多图结果展示 ===== */
.ig-result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
    width: 100%;
}

.ig-result-grid img {
    width: 100%;
    max-height: 360px;
    object-fit: contain;
    border-radius: 10px;
    cursor: zoom-in;
    background: var(--panel-muted);
}

/* ===== 尺寸按钮 ===== */
.ig-size-btn {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    cursor: pointer;
    transition: all .2s ease;
    min-width: 120px;
    text-align: left;
}

.ig-size-btn:hover {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, .12);
}

/* ===== 尺寸选择器模态框 ===== */
.ig-size-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(0, 0, 0, .3);
    backdrop-filter: blur(4px);
}

.ig-size-modal-content {
    position: relative;
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    background: var(--bg);
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
    display: flex;
    flex-direction: column;
}

.ig-size-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 20px 24px;
    border-bottom: 1px solid var(--line-soft);
}

.ig-size-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.ig-size-current {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--muted);
}

.ig-size-modal-close {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: var(--muted);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
    transition: all .2s ease;
}

.ig-size-modal-close:hover {
    background: var(--panel-muted);
    color: var(--text);
}

.ig-size-modal-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px 24px;
}

.ig-size-mode-tabs {
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--panel-muted);
    border-radius: 12px;
    margin-bottom: 20px;
}

.ig-size-mode-tab {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 8px;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s ease;
}

.ig-size-mode-tab:hover {
    color: var(--text);
}

.ig-size-mode-tab.active {
    background: var(--panel);
    color: var(--text);
    box-shadow: 0 2px 8px rgba(0, 0, 0, .08);
}

.ig-size-mode-content {
    position: relative;
    min-height: 320px;
}

.ig-size-mode-panel {
    display: none;
}

.ig-size-mode-panel.active {
    display: block;
}

/* 自动模式 */
.ig-size-auto-hint {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 40px 20px;
    color: var(--muted);
}

.ig-size-auto-hint svg {
    width: 48px;
    height: 48px;
    color: var(--blue);
    margin-bottom: 12px;
}

.ig-size-auto-hint h4 {
    margin: 0 0 8px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.ig-size-auto-hint p {
    margin: 0;
    font-size: 12px;
    line-height: 1.6;
}

/* 按比例模式 */
.ig-size-section {
    margin-bottom: 20px;
}

.ig-size-section-label {
    display: block;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--muted);
}

.ig-size-tier-btns {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.ig-size-tier-btn {
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    color: var(--text);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all .2s ease;
}

.ig-size-tier-btn:hover {
    border-color: var(--blue);
    background: var(--blue-soft);
}

.ig-size-tier-btn.active {
    border-color: var(--blue);
    background: var(--blue-soft);
    color: var(--blue);
}

.ig-size-ratio-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
}

.ig-size-ratio-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 8px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--panel);
    color: var(--text);
    font-size: 12px;
    cursor: pointer;
    transition: all .2s ease;
}

.ig-size-ratio-btn:hover {
    border-color: var(--blue);
    background: var(--blue-soft);
}

.ig-size-ratio-btn.active {
    border-color: var(--blue);
    background: var(--blue-soft);
    color: var(--blue);
}

.ig-size-ratio-icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.ig-size-ratio-icon > div {
    border: 1.5px solid currentColor;
    border-radius: 3px;
    opacity: .6;
}

/* 自定义宽高模式 */
.ig-size-custom-inputs {
    display: flex;
    align-items: flex-end;
    gap: 12px;
}

.ig-size-custom-input-wrap {
    flex: 1;
}

.ig-size-custom-input-wrap label {
    display: block;
    margin-bottom: 6px;
    font-size: 11px;
    color: var(--muted);
}

.ig-size-custom-input-wrap input {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--text);
    font-size: 13px;
    outline: none;
    transition: all .2s ease;
}

.ig-size-custom-input-wrap input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, .12);
}

.ig-size-custom-x {
    color: var(--muted-2);
    font-size: 14px;
    padding-bottom: 8px;
}

.ig-size-hint {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    background: var(--panel-muted);
    border: 1px solid var(--line-soft);
    border-radius: 10px;
    font-size: 11px;
    line-height: 1.5;
    color: var(--muted);
}

.ig-size-hint svg {
    flex-shrink: 0;
    margin-top: 2px;
    color: var(--blue);
}

/* 预览区 */
.ig-size-preview {
    margin-top: 20px;
    padding: 14px 16px;
    background: var(--panel-muted);
    border-radius: 12px;
}

.ig-size-preview-label {
    font-size: 11px;
    color: var(--muted);
    margin-bottom: 4px;
}

.ig-size-preview-value {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.ig-size-modal-footer {
    display: flex;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--line-soft);
}

.ig-size-modal-footer .btn {
    flex: 1;
    min-height: 40px;
    font-size: 14px;
}

/* 移动端适配 */
@media (max-width: 560px) {
    .ig-size-modal {
        padding: 0;
    }

    .ig-size-modal-content {
        max-width: 100%;
        max-height: 100vh;
        border-radius: 0;
    }

    .ig-size-ratio-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}
.ig-params-row {
    display: flex;
    gap: 14px;
    flex-wrap: wrap;
    align-items: center;
    margin-bottom: 14px;
}

.ig-param-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.ig-param-group label {
    font-size: 13px;
    color: var(--muted);
    white-space: nowrap;
    font-weight: 500;
}

.ig-param-group select,
.ig-param-group input {
    background: var(--panel);
    color: var(--text);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 7px 10px;
    font-size: 13px;
    outline: none;
}

.ig-param-group select:focus,
.ig-param-group input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, .12);
}

.ig-param-group.ig-param-disabled {
    opacity: .5;
}

.ig-param-group input:disabled {
    cursor: not-allowed;
    background: var(--panel-muted);
}

.ig-size-input {
    width: 76px;
    text-align: center;
}

/* ===== 输入区 ===== */
.ig-input-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: stretch;
    margin-bottom: 24px;
}

.ig-input-row textarea {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    color: var(--text);
    font-size: 14px;
    line-height: 1.5;
    resize: none;
    height: 56px;
    outline: none;
    font-family: inherit;
}

.ig-input-row textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(0, 113, 227, .12);
}

.ig-gen-btn {
    min-height: 56px;
    padding: 0 26px;
    border: none;
    border-radius: 14px;
    background: var(--blue);
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
    transition: background-color .15s ease;
}

.ig-gen-btn:hover:not(:disabled) {
    background: var(--blue-hover);
}

.ig-gen-btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

/* ===== 历史记录 ===== */
.ig-history-section {
    margin-top: 24px;
}

.ig-history-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.ig-history-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.ig-clear-btn {
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--panel);
    color: var(--red);
    font-size: 12px;
    cursor: pointer;
    transition: all .15s ease;
}

.ig-clear-btn:hover {
    background: rgba(215, 0, 21, .08);
    border-color: rgba(215, 0, 21, .3);
}

.ig-history-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 10px;
}

.ig-history-empty {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--muted-2);
    font-size: 13px;
    padding: 24px;
}

.ig-history-item {
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    cursor: pointer;
    aspect-ratio: 1;
    background: var(--panel-muted);
    border: 1px solid var(--line-soft);
}

.ig-history-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ig-history-delete {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 24px;
    height: 24px;
    background: rgba(215, 0, 21, .85);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    line-height: 1;
    display: none;
    align-items: center;
    justify-content: center;
}

.ig-history-item:hover .ig-history-delete {
    display: flex;
}

/* ===== 移动端适配 ===== */
@media (max-width: 760px) {
    .image-generator-container {
        padding: 14px 12px 24px;
    }

    .image-generator-inner {
        width: 100%;
    }

    .ig-header {
        margin-bottom: 14px;
    }

    .ig-header h2 {
        font-size: 20px;
    }

    .ig-header p {
        font-size: 12px;
        line-height: 1.55;
    }

    .ig-tabs {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        padding: 4px;
        margin-bottom: 14px;
    }

    .ig-tab {
        width: 100%;
        min-height: 40px;
        padding: 0 8px;
        font-size: 13px;
    }

    .ig-result-area {
        min-height: 240px;
        margin-bottom: 14px;
        padding: 12px;
    }

    .ig-placeholder {
        font-size: 14px;
        line-height: 1.5;
        text-align: center;
    }

    .ig-params-row {
        gap: 10px;
        margin-bottom: 12px;
        flex-direction: column;
        align-items: stretch;
    }

    .ig-param-group {
        width: 100%;
        justify-content: space-between;
    }

    .ig-param-group select,
    .ig-param-group input {
        flex: 1;
        min-width: 0;
    }

    .ig-input-row {
        grid-template-columns: 1fr;
        gap: 10px;
        margin-bottom: 18px;
    }

    .ig-input-row textarea {
        height: 84px;
        font-size: 14px;
    }

    .ig-gen-btn {
        width: 100%;
        min-height: 48px;
    }

    .ig-history-section {
        margin-top: 18px;
    }

    .ig-history-header {
        align-items: center;
    }

    .ig-history-header h3 {
        font-size: 15px;
    }

    .ig-history-grid {
        grid-template-columns: repeat(auto-fill, minmax(92px, 1fr));
        gap: 8px;
    }

    .ig-history-item {
        border-radius: 12px;
    }
}

@media (max-width: 560px) {
    .ig-tabs {
        gap: 6px;
    }

    .ig-tab {
        font-size: 12px;
    }

    .ig-result-actions {
        flex-wrap: wrap;
    }

    .ig-history-delete {
        display: flex;
    }
}

/* 2026 mobile refinement: lighter hierarchy and a chat-like creation composer. */
@media (max-width: 760px) {
    .image-generator-container {
        padding: 14px 12px 28px;
    }

    .ig-header {
        margin: 0 0 12px;
    }

    .ig-header h2 {
        display: none;
    }

    .ig-header p {
        margin: 0;
        color: var(--muted);
        font-size: 12px;
        line-height: 1.55;
    }

    .ig-tabs {
        gap: 3px;
        padding: 3px;
        border: 0;
        border-radius: 13px;
        background: var(--mobile-soft, var(--panel-muted));
        box-shadow: none;
    }

    .ig-tab {
        min-height: 40px;
        border-radius: 10px;
    }

    .ig-tab.active {
        background: var(--panel);
        box-shadow: 0 1px 3px rgba(0, 0, 0, .09);
    }

    .ig-result-area {
        min-height: 224px;
        padding: 12px;
        border: 0;
        border-radius: 17px;
        background: var(--mobile-soft, var(--panel-muted));
    }

    .ig-params-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 10px;
        margin: 2px 0 13px;
    }

    .ig-param-group {
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        justify-content: flex-start;
        gap: 5px;
    }

    .ig-param-group:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .ig-param-group label {
        padding-left: 2px;
        color: var(--muted);
        font-size: 11px;
        font-weight: 550;
    }

    .ig-param-group select,
    .ig-param-group input,
    .ig-size-btn {
        width: 100%;
        min-width: 0;
        min-height: 42px;
        padding: 0 11px;
        border: 0;
        border-radius: 11px;
        background: var(--mobile-soft, var(--panel-muted));
        color: var(--text);
        font-size: 13px;
    }

    .ig-param-group select:focus,
    .ig-param-group input:focus,
    .ig-size-btn:focus-visible {
        border: 0;
        outline: 2px solid color-mix(in srgb, var(--blue) 62%, transparent);
        outline-offset: 1px;
        box-shadow: none;
    }

    .ig-input-row {
        grid-template-columns: minmax(0, 1fr) 42px;
        gap: 4px;
        align-items: end;
        margin-bottom: 18px;
        padding: 6px;
        border: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
        border-radius: 22px;
        background: var(--panel);
        box-shadow: var(--mobile-composer-shadow, 0 8px 28px rgba(0, 0, 0, .08));
    }

    .ig-input-row textarea {
        width: 100%;
        height: 70px;
        padding: 8px 7px;
        border: 0;
        border-radius: 0;
        background: transparent;
        font-size: 16px;
        line-height: 1.42;
    }

    .ig-input-row textarea:focus {
        border: 0;
        box-shadow: none;
    }

    .ig-gen-btn {
        width: 42px;
        min-width: 42px;
        height: 42px;
        min-height: 42px;
        padding: 0;
        border-radius: 50%;
        background: var(--text);
        color: var(--bg);
        font-size: 0;
    }

    .ig-gen-btn::before {
        content: "✦";
        font-size: 18px;
        line-height: 1;
    }

    .ig-gen-btn:hover:not(:disabled),
    .ig-gen-btn:active:not(:disabled) {
        background: color-mix(in srgb, var(--text) 86%, var(--bg));
    }
}

/* 2026 desktop workspace: a focused preview with a compact creation rail. */
@media (min-width: 761px) {
    .image-generator-container {
        padding: clamp(26px, 3vw, 44px) clamp(24px, 3.4vw, 52px) 56px;
        background: var(--bg);
        scrollbar-gutter: stable;
    }

    .image-generator-inner {
        width: min(1120px, 100%);
        margin-inline: auto;
    }

    .app-shell.wide-mode .image-generator-inner {
        width: min(1440px, 100%);
    }

    .ig-header {
        margin: 0 0 20px;
    }

    .ig-header h2 {
        display: none;
    }

    .ig-header p {
        max-width: 720px;
        margin-top: 0;
        color: var(--muted);
        font-size: 13px;
        line-height: 1.6;
    }

    .ig-tabs {
        gap: 2px;
        margin: 0 0 18px;
        padding: 3px;
        border: 0;
        border-radius: 12px;
        background: color-mix(in srgb, var(--panel-muted) 88%, var(--bg));
        box-shadow: none;
    }

    .ig-tab {
        min-height: 34px;
        padding-inline: 15px;
        border-radius: 9px;
        font-size: 12px;
        font-weight: 600;
    }

    .ig-tab:hover {
        background: color-mix(in srgb, var(--panel) 68%, transparent);
    }

    .ig-tab.active {
        background: var(--panel);
        box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
    }

    .ig-result-area {
        flex-direction: column;
        align-items: stretch;
        justify-content: center;
        min-height: clamp(380px, 52vh, 620px);
        max-height: clamp(380px, calc(100dvh - 180px), 720px);
        margin-bottom: 18px;
        padding: 20px;
        border-color: color-mix(in srgb, var(--line-soft) 88%, transparent);
        border-radius: 22px;
        background: color-mix(in srgb, var(--panel-muted) 68%, var(--bg));
        box-shadow: inset 0 1px 0 color-mix(in srgb, var(--panel) 66%, transparent);
        overflow: hidden;
    }

    .ig-result-area:has(.ig-result-actions) {
        justify-content: flex-start;
        padding-bottom: 20px;
    }

    .ig-result-area > div:not(.ig-placeholder):not(.ig-loading):not(.ig-result-actions) {
        flex: 1 1 auto;
        width: 100%;
        min-height: 0;
        max-width: 100%;
        max-height: none;
        overflow: auto;
        overscroll-behavior: contain;
        scrollbar-gutter: stable;
    }

    .ig-result-area > div:not(.ig-placeholder):not(.ig-loading):not(.ig-result-actions):not(.ig-result-grid) {
        display: grid;
        place-items: center;
    }

    .ig-result-grid {
        align-content: start;
    }

    .ig-result-area img {
        max-height: min(620px, 68vh);
        border-radius: 14px;
        box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
    }

    .ig-placeholder {
        max-width: 260px;
        color: var(--muted-2);
        font-size: 13px;
        line-height: 1.55;
    }

    .ig-placeholder::before {
        content: "✦";
        display: grid;
        width: 42px;
        height: 42px;
        margin: 0 auto 12px;
        place-items: center;
        border: 1px solid var(--line-soft);
        border-radius: 13px;
        background: var(--panel);
        color: var(--muted);
        font-size: 17px;
        box-shadow: 0 4px 16px rgba(0, 0, 0, .04);
    }

    .ig-result-actions {
        position: static;
        right: auto;
        bottom: auto;
        flex: 0 0 auto;
        align-self: flex-end;
        max-width: 100%;
        margin-top: 14px;
        gap: 4px;
        padding: 4px;
        border: 1px solid color-mix(in srgb, var(--line-soft) 78%, transparent);
        border-radius: 13px;
        background: color-mix(in srgb, var(--panel) 90%, transparent);
        box-shadow: 0 8px 24px rgba(0, 0, 0, .1);
        backdrop-filter: blur(14px);
    }

    .ig-result-actions .btn {
        min-height: 34px;
        padding-inline: 11px;
        border-radius: 9px;
        font-size: 11px;
        font-weight: 650;
        white-space: nowrap;
    }

    .ig-actual-params {
        margin: 0 0 18px;
        padding: 12px 14px;
        border-color: color-mix(in srgb, var(--line-soft) 88%, transparent);
        border-radius: 13px;
        background: color-mix(in srgb, var(--panel-muted) 72%, transparent);
    }

    .ig-actual-params-list {
        gap: 7px 12px;
    }

    #igUploadSection {
        min-width: 0;
    }

    .ig-ref-grid {
        grid-template-columns: repeat(auto-fill, minmax(88px, 1fr));
        align-content: start;
        gap: 8px;
        max-height: clamp(204px, 32vh, 314px);
        margin: 0 0 14px;
        padding: 10px;
        border: 1px dashed var(--line);
        border-radius: 16px;
        background: color-mix(in srgb, var(--panel-muted) 64%, transparent);
        overflow-x: hidden;
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-gutter: stable;
    }

    .ig-ref-thumb,
    .ig-ref-add {
        border-radius: 11px;
    }

    .ig-ref-add {
        min-height: 88px;
        border-color: color-mix(in srgb, var(--line) 82%, transparent);
        background: color-mix(in srgb, var(--panel) 72%, transparent);
    }

    .ig-ref-add:hover {
        border-color: color-mix(in srgb, var(--text) 30%, var(--line));
        background: var(--panel);
        color: var(--text);
    }

    .ig-params-row {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 11px 10px;
        align-items: start;
        margin: 0 0 14px;
        padding: 15px;
        border: 1px solid color-mix(in srgb, var(--line-soft) 90%, transparent);
        border-radius: 18px;
        background: color-mix(in srgb, var(--panel-muted) 42%, var(--panel));
    }

    .ig-param-group {
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 6px;
    }

    .ig-param-group:last-child:nth-child(odd) {
        grid-column: 1 / -1;
    }

    .ig-param-group label {
        padding-left: 2px;
        color: var(--muted);
        font-size: 11px;
        font-weight: 600;
    }

    .ig-param-group select,
    .ig-param-group input,
    .ig-size-btn {
        width: 100%;
        min-width: 0;
        min-height: 40px;
        padding: 0 11px;
        border: 1px solid color-mix(in srgb, var(--line-soft) 92%, transparent);
        border-radius: 11px;
        background: var(--panel);
        color: var(--text);
        font-size: 12px;
        box-shadow: none;
    }

    .ig-size-btn {
        display: flex;
        align-items: center;
        text-align: left;
    }

    .ig-param-group select:hover,
    .ig-param-group input:hover,
    .ig-size-btn:hover {
        border-color: color-mix(in srgb, var(--text) 20%, var(--line));
        box-shadow: none;
    }

    .ig-param-group select:focus,
    .ig-param-group input:focus,
    .ig-size-btn:focus-visible {
        border-color: color-mix(in srgb, var(--text) 36%, var(--line));
        outline: 3px solid color-mix(in srgb, var(--blue) 13%, transparent);
        outline-offset: 0;
        box-shadow: none;
    }

    .ig-size-input {
        text-align: left;
    }

    .ig-input-row {
        grid-template-columns: minmax(0, 1fr) 42px;
        gap: 6px;
        align-items: end;
        margin: 0 0 26px;
        padding: 8px;
        border: 1px solid color-mix(in srgb, var(--line) 76%, transparent);
        border-radius: 20px;
        background: var(--panel);
        box-shadow: 0 8px 28px rgba(0, 0, 0, .06);
        transition: border-color .16s ease, box-shadow .16s ease;
    }

    .ig-input-row:focus-within {
        border-color: color-mix(in srgb, var(--text) 38%, var(--line));
        box-shadow: 0 10px 34px rgba(0, 0, 0, .08);
    }

    .ig-input-row textarea {
        width: 100%;
        height: 112px;
        min-height: 112px;
        padding: 8px 7px;
        border: 0;
        border-radius: 0;
        background: transparent;
        font-size: 14px;
        line-height: 1.55;
    }

    .ig-input-row textarea:focus {
        border: 0;
        box-shadow: none;
    }

    .ig-gen-btn {
        width: 42px;
        min-width: 42px;
        height: 42px;
        min-height: 42px;
        padding: 0;
        border-radius: 50%;
        background: var(--text);
        color: var(--bg);
        font-size: 0;
    }

    .ig-gen-btn::before {
        content: "✦";
        font-size: 17px;
        line-height: 1;
    }

    .ig-gen-btn:hover:not(:disabled) {
        background: color-mix(in srgb, var(--text) 86%, var(--bg));
    }

    .ig-history-section {
        margin-top: 30px;
        padding-top: 22px;
        border-top: 1px solid color-mix(in srgb, var(--line-soft) 88%, transparent);
    }

    .ig-history-header {
        margin-bottom: 13px;
    }

    .ig-history-header h3 {
        font-size: 15px;
        font-weight: 650;
        letter-spacing: -.015em;
    }

    .ig-clear-btn {
        min-height: 30px;
        padding: 0 10px;
        border: 0;
        border-radius: 8px;
        background: transparent;
        color: var(--muted);
    }

    .ig-clear-btn:hover {
        border-color: transparent;
        background: color-mix(in srgb, var(--red) 9%, transparent);
        color: var(--red);
    }

    .ig-history-grid {
        grid-template-columns: repeat(auto-fill, minmax(144px, 1fr));
        gap: 12px;
    }

    .ig-history-empty {
        min-height: 116px;
        display: grid;
        place-items: center;
        padding: 26px;
        border: 1px dashed color-mix(in srgb, var(--line) 75%, transparent);
        border-radius: 16px;
        background: color-mix(in srgb, var(--panel-muted) 44%, transparent);
    }

    .ig-history-item {
        border-color: color-mix(in srgb, var(--line-soft) 92%, transparent);
        border-radius: 14px;
        background: var(--panel-muted);
        box-shadow: 0 1px 2px rgba(0, 0, 0, .04);
        transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
    }

    .ig-history-item:hover {
        z-index: 1;
        border-color: color-mix(in srgb, var(--text) 18%, var(--line));
        box-shadow: 0 10px 28px rgba(0, 0, 0, .1);
        transform: translateY(-2px);
    }

    .ig-history-delete {
        top: 7px;
        right: 7px;
        width: 28px;
        height: 28px;
        border: 1px solid rgba(255, 255, 255, .14);
        background: rgba(15, 15, 16, .72);
        color: #fff;
        font-size: 16px;
        backdrop-filter: blur(10px);
    }

    .ig-size-modal {
        background: rgba(0, 0, 0, .32);
        backdrop-filter: blur(8px);
    }

    .ig-size-modal-content {
        max-width: 540px;
        max-height: min(88vh, 720px);
        border-color: color-mix(in srgb, var(--line) 80%, transparent);
        border-radius: 22px;
        background: var(--panel);
        box-shadow: 0 24px 80px rgba(0, 0, 0, .28);
    }

    .ig-size-modal-header {
        align-items: center;
        padding: 16px 20px;
    }

    .ig-size-modal-body {
        flex: 0 1 auto;
        padding: 16px 20px 18px;
    }

    .ig-size-mode-tabs {
        margin-bottom: 14px;
        padding: 3px;
    }

    .ig-size-mode-tab {
        padding-block: 7px;
    }

    .ig-size-mode-content {
        min-height: 0;
    }

    .ig-size-auto-hint {
        padding: 22px 16px 18px;
    }

    .ig-size-auto-hint svg {
        width: 40px;
        height: 40px;
        margin-bottom: 10px;
    }

    .ig-size-section {
        margin-bottom: 14px;
    }

    .ig-size-section:last-child {
        margin-bottom: 0;
    }

    .ig-size-ratio-btn {
        gap: 5px;
        padding: 10px 8px;
    }

    .ig-size-preview {
        margin-top: 14px;
        padding: 11px 14px;
    }

    .ig-size-modal-footer {
        padding: 12px 20px;
    }

    .ig-size-mode-tabs,
    .ig-size-preview,
    .ig-size-hint {
        background: color-mix(in srgb, var(--panel-muted) 82%, var(--bg));
    }

    .ig-size-tier-btn,
    .ig-size-ratio-btn,
    .ig-size-custom-input-wrap input {
        border-color: color-mix(in srgb, var(--line-soft) 92%, transparent);
        background: var(--bg);
    }
}

@media (min-width: 1024px) {
    .image-generator-inner {
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
        grid-template-areas:
            "header header"
            "tabs tabs"
            "result upload"
            "result params"
            "result composer"
            "actual ."
            "history history";
        gap: 14px 24px;
        align-items: start;
    }

    .app-shell.wide-mode .image-generator-inner {
        grid-template-columns: minmax(0, 1fr) minmax(300px, 340px);
        column-gap: 24px;
    }

    .image-generator-inner:has(#igUploadSection[style*="display:none"]),
    .image-generator-inner:has(#igUploadSection[style*="display: none"]) {
        grid-template-areas:
            "header header"
            "tabs tabs"
            "result params"
            "result composer"
            "actual ."
            "history history";
    }

    .ig-header {
        grid-area: header;
        margin: 0;
    }

    .ig-tabs {
        grid-area: tabs;
        justify-self: start;
        margin: 0 0 2px;
    }

    .ig-result-area {
        grid-area: result;
        align-self: stretch;
        width: 100%;
        height: 100%;
        min-height: 0;
        margin: 0;
    }

    #igUploadSection {
        grid-area: upload;
        width: 100%;
    }

    .ig-ref-grid {
        margin: 0;
    }

    .ig-params-row {
        grid-area: params;
        width: 100%;
        margin: 0;
    }

    .ig-input-row {
        grid-area: composer;
        width: 100%;
        margin: 0;
    }

    .ig-actual-params {
        grid-area: actual;
        width: 100%;
        margin: 0;
    }

    .ig-history-section {
        grid-area: history;
        min-width: 0;
        margin-top: 18px;
    }

    .app-shell.wide-mode .ig-history-grid {
        grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
    }
}

@media (min-width: 1024px) and (max-height: 760px) {
    .image-generator-container {
        padding-top: 18px;
        padding-bottom: 28px;
    }

    .image-generator-inner {
        gap: 10px 24px;
    }

    .ig-ref-grid {
        max-height: 150px;
    }

    .ig-params-row {
        gap: 6px 8px;
        padding: 10px;
    }

    .ig-param-group {
        gap: 3px;
    }

    .ig-param-group select,
    .ig-param-group input,
    .ig-size-btn {
        min-height: 34px;
    }

    .ig-input-row {
        padding: 6px;
        border-radius: 17px;
    }

    .ig-input-row textarea {
        height: 64px;
        min-height: 64px;
        padding-block: 5px;
    }
}
