/* =============================================================
   KIE AI Generator — ChatGPT Mobile App Style
   ============================================================= */

/* ── Reset & base ── */
.kie-app *, .kie-app *::before, .kie-app *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* 抵御 WordPress 主题（Elementor / VamTam 等）对 button 的全局样式覆盖
   :where() 把基础重置特异性归零，避免与具体类名冲突 */
:where(.kie-app) button,
:where(.kie-app) input[type="button"],
:where(.kie-app) input[type="submit"] {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    background-image: none;
    color: inherit;
    border: 0;
    border-radius: 0;
    cursor: pointer;
    font-family: inherit;
    font-weight: inherit;
    line-height: 1.2;
    min-height: 0;
    min-width: 0;
    text-decoration: none;
    text-shadow: none !important;
    text-transform: none !important;
    letter-spacing: normal !important;
}
:where(.kie-app) button:hover,
:where(.kie-app) button:focus,
:where(.kie-app) button:active {
    transform: none !important;
    outline: none;
}
:where(.kie-app) a {
    text-decoration: none;
    color: inherit;
}

.kie-app {
    --bg:        #FFFFFF;
    --bg2:       #F5F5F5;
    --bg3:       #EBEBEB;
    --label:     #0D0D0D;
    --label2:    #6B6B6B;
    --label3:    #ABABAB;
    --sep:       rgba(0,0,0,0.10);
    --sep2:      rgba(0,0,0,0.06);
    --blue:      #10A37F;   /* ChatGPT green as brand */
    --red:       #EF4444;
    --radius:    14px;
    --radius-lg: 20px;
    --radius-pill: 999px;
    --shadow:    0 1px 6px rgba(0,0,0,0.08), 0 0 1px rgba(0,0,0,0.06);
    --trans:     0.28s cubic-bezier(0.4,0,0.2,1);

    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Helvetica Neue", sans-serif;
    color: var(--label);
    background: var(--bg);
    -webkit-font-smoothing: antialiased;
    position: relative;
    width: 100%;
    min-height: 100svh;
    overflow-x: hidden;
}

/* ── Icon button ── */
.kie-app .kie-icon-btn {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 38px !important;
    height: 38px !important;
    border: none !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    border-radius: 50% !important;
    cursor: pointer !important;
    color: var(--label) !important;
    flex-shrink: 0;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    transition: background var(--trans);
}
.kie-app .kie-icon-btn:hover { background: var(--bg2) !important; background-color: var(--bg2) !important; }

/* ══════════════════════════════
   OVERLAY
══════════════════════════════ */
.kie-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    z-index: 1000;
    animation: kie-fade-in 0.2s ease;
}
.kie-overlay.show { display: block; }

@keyframes kie-fade-in { from { opacity:0; } to { opacity:1; } }

/* ══════════════════════════════
   SIDEBAR
══════════════════════════════ */
.kie-sidebar {
    position: fixed;
    top: 0; left: -300px; bottom: 0;
    width: 280px;
    background: var(--bg2);
    z-index: 1010;
    display: flex;
    flex-direction: column;
    transition: left var(--trans);
    box-shadow: 2px 0 16px rgba(0,0,0,0.12);
    padding-bottom: env(safe-area-inset-bottom, 0);
}
.kie-sidebar.open { left: 0; }

.kie-sidebar-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--sep);
}
.kie-sidebar-brand {
    font-size: 15px;
    font-weight: 700;
    color: var(--label);
}

.kie-sidebar-nav { padding: 8px; }
.kie-sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    font-size: 15px;
    font-weight: 500;
    color: var(--label);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background var(--trans);
}
.kie-sidebar-item:hover { background: var(--bg3); }

.kie-sidebar-label {
    padding: 12px 20px 6px;
    font-size: 12px;
    font-weight: 600;
    color: var(--label3);
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.kie-sidebar-history {
    flex: 1;
    overflow-y: auto;
    padding: 4px 8px 16px;
}

.kie-sidebar-hist-item {
    display: block;
    width: 100%;
    padding: 9px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--label2);
    text-align: left;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: background var(--trans);
}
.kie-sidebar-hist-item:hover { background: var(--bg3); color: var(--label); }

.kie-sidebar-hist-empty {
    padding: 20px 12px;
    font-size: 13px;
    color: var(--label3);
    text-align: center;
}

/* ══════════════════════════════
   MAIN
══════════════════════════════ */
.kie-app-main {
    display: flex;
    flex-direction: column;
    min-height: 100svh;
}

/* Top nav */
.kie-topnav {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 10px 8px;
    background: var(--bg);
    border-bottom: 1px solid var(--sep2);
}
.kie-topnav-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--label);
}
.kie-points-pill {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px 5px 9px;
    background: var(--bg2);
    border-radius: var(--radius-pill);
    font-size: 13px;
    font-weight: 600;
    color: var(--label2);
}

/* ══════════════════════════════
   VIEWS
══════════════════════════════ */
.kie-view { display: none; flex-direction: column; flex: 1; }
.kie-view.active { display: flex; }

/* ══════════════════════════════
   CHAT VIEW
══════════════════════════════ */
#view-chat {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Messages */
.kie-messages {
    flex: 1;
    padding: 16px 16px 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    overflow-y: auto;
    min-height: 200px;
}

/* Empty state */
.kie-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 24px 40px;
    flex: 1;
}
.kie-empty-icon-wrap { margin-bottom: 18px; opacity: 0.85; }
.kie-empty h2 {
    font-size: 22px;
    font-weight: 700;
    color: var(--label);
    margin-bottom: 10px;
}
.kie-empty p {
    font-size: 15px;
    color: var(--label2);
    line-height: 1.6;
}
.kie-empty p b { color: var(--label); }

/* Message bubbles */
.kie-msg {
    display: flex;
    flex-direction: column;
    margin-bottom: 28px;
}

.kie-msg-user {
    align-items: flex-end;
}
.kie-msg-assistant {
    align-items: flex-start;
}

.kie-msg-user .kie-bubble {
    background: var(--bg2);
    border-radius: 18px 18px 4px 18px;
    padding: 12px 16px;
    max-width: 80%;
    font-size: 15px;
    line-height: 1.55;
    color: var(--label);
}

.kie-msg-user .kie-bubble-photos {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
    justify-content: flex-end;
}
.kie-bubble-photo-thumb {
    width: 72px;
    height: 72px;
    border-radius: 10px;
    object-fit: cover;
    display: block;
}

.kie-msg-user .kie-bubble-tpl {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    border-radius: var(--radius-pill);
    background: rgba(16,163,127,0.12);
    color: #0D7A5F;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 6px;
}

/* AI response area */
.kie-msg-assistant .kie-ai-wrap {
    max-width: 92%;
    width: 100%;
}

/* Generating state */
.kie-generating {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 0;
    color: var(--label2);
    font-size: 14px;
}
.kie-dots {
    display: flex;
    gap: 5px;
}
.kie-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--label3);
    animation: kie-dot-pulse 1.4s ease-in-out infinite;
}
.kie-dot:nth-child(2) { animation-delay: 0.2s; }
.kie-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes kie-dot-pulse {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40%            { transform: scale(1.1); opacity: 1; }
}

/* Result images grid */
.kie-result-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    margin-top: 8px;
}
.kie-result-grid.single { grid-template-columns: 1fr; }

.kie-result-img-card {
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg2);
    position: relative;
    cursor: pointer;
}
.kie-result-img-card img {
    width: 100%;
    display: block;
    border-radius: var(--radius);
}
.kie-result-img-overlay {
    position: absolute;
    bottom: 0; left: 0; right: 0;
    padding: 8px;
    background: linear-gradient(transparent, rgba(0,0,0,0.45));
    display: flex;
    justify-content: flex-end;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 0 0 var(--radius) var(--radius);
}
.kie-result-img-card:hover .kie-result-img-overlay { opacity: 1; }
.kie-dl-btn {
    background: rgba(255,255,255,0.92);
    border: none;
    border-radius: 8px;
    padding: 5px 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--label);
    cursor: pointer;
    font-family: inherit;
}

/* Error message */
.kie-msg-error {
    font-size: 14px;
    color: var(--red);
    padding: 10px 0;
}

/* Login banner */
.kie-login-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(239,68,68,0.08);
    border-top: 1px solid rgba(239,68,68,0.2);
    font-size: 13px;
    color: var(--red);
}
.kie-login-banner a {
    font-weight: 700;
    color: var(--red);
    text-decoration: none;
}

/* ══════════════════════════════
   INPUT AREA (sticky bottom)
══════════════════════════════ */
.kie-input-area {
    position: sticky;
    bottom: 0;
    background: var(--bg);
    border-top: 1px solid var(--sep2);
    padding: 8px 12px calc(8px + env(safe-area-inset-bottom, 0));
}

/* Attachment chips */
.kie-chips-row {
    overflow-x: auto;
    padding: 4px 0 8px;
    scrollbar-width: none;
}
.kie-chips-row::-webkit-scrollbar { display: none; }

.kie-chips-scroll {
    display: flex;
    gap: 8px;
    flex-wrap: nowrap;
}

.kie-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg2);
    border-radius: var(--radius);
    padding: 4px 8px 4px 4px;
    flex-shrink: 0;
    max-width: 140px;
    border: 1px solid var(--sep);
}
.kie-chip img {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: cover;
    flex-shrink: 0;
}
.kie-chip-name {
    font-size: 12px;
    color: var(--label2);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.kie-chip-rm {
    border: none;
    background: var(--bg3);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    color: var(--label2);
}

/* Template tag row */
.kie-tpl-tag-row { padding: 0 0 8px; }
.kie-tpl-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px 5px 10px;
    background: rgba(16,163,127,0.10);
    border-radius: var(--radius-pill);
    border: 1px solid rgba(16,163,127,0.25);
    color: #0A6B52;
    font-size: 13px;
    font-weight: 600;
}
.kie-tag-x {
    border: none;
    background: rgba(16,163,127,0.15);
    border-radius: 50%;
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #0A6B52;
    flex-shrink: 0;
}

/* Inputbar */
.kie-inputbar {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    background: var(--bg2);
    border-radius: 24px;
    padding: 6px 6px 6px 14px;
    border: 1px solid var(--sep);
}

.kie-app .kie-plus-btn {
    width: 34px !important;
    height: 34px !important;
    border: 1.5px solid var(--sep) !important;
    background: var(--bg) !important;
    background-color: var(--bg) !important;
    background-image: none !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer !important;
    flex-shrink: 0;
    color: var(--label) !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    transition: background var(--trans), border-color var(--trans);
}
.kie-app .kie-plus-btn:hover {
    background: var(--bg3) !important;
    background-color: var(--bg3) !important;
    border-color: var(--label3) !important;
}

.kie-prompt-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 15px;
    line-height: 1.5;
    color: var(--label);
    resize: none;
    font-family: inherit;
    max-height: 120px;
    overflow-y: auto;
    padding: 4px 0;
    scrollbar-width: none;
}
.kie-prompt-input:focus { outline: none; }
.kie-prompt-input::placeholder { color: var(--label3); }

.kie-app .kie-send-btn {
    width: 34px !important;
    height: 34px !important;
    border: none !important;
    background: #0D0D0D !important;
    background-color: #0D0D0D !important;
    background-image: none !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    cursor: pointer !important;
    flex-shrink: 0;
    color: #fff !important;
    padding: 0 !important;
    margin: 0 !important;
    box-shadow: none !important;
    min-width: 0 !important;
    min-height: 0 !important;
    transition: opacity var(--trans), transform 0.1s !important;
}
.kie-app .kie-send-btn:disabled {
    background: var(--bg3) !important;
    background-color: var(--bg3) !important;
    cursor: default !important;
}
.kie-app .kie-send-btn:not(:disabled):hover { transform: scale(1.05) !important; }

/* ══════════════════════════════
   GALLERY VIEW
══════════════════════════════ */
#view-gallery {
    flex-direction: column;
    background: var(--bg);
}

.kie-gallery-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px 10px 8px;
    border-bottom: 1px solid var(--sep2);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 5;
}
.kie-gallery-nav h2 {
    font-size: 17px;
    font-weight: 700;
    color: var(--label);
}

.kie-gallery-content {
    flex: 1;
    overflow-y: auto;
    padding: 0 12px 80px;
}
.kie-gallery-section-lbl {
    padding: 18px 4px 12px;
    font-size: 20px;
    font-weight: 700;
    color: var(--label);
}

.kie-gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 4px;
}
.kie-gallery-img {
    aspect-ratio: 1;
    border-radius: 4px;
    object-fit: cover;
    width: 100%;
    cursor: pointer;
    display: block;
    transition: opacity 0.15s;
}
.kie-gallery-img:hover { opacity: 0.9; }
.kie-gallery-empty {
    grid-column: 1/-1;
    padding: 48px 0;
    text-align: center;
    font-size: 15px;
    color: var(--label3);
}

/* ══════════════════════════════
   BOTTOM SHEET BACKDROP
══════════════════════════════ */
.kie-sheet-bd {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 900;
}
.kie-sheet-bd.show { display: block; }

/* ══════════════════════════════
   BOTTOM SHEET
══════════════════════════════ */
.kie-bottom-sheet {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--bg);
    border-radius: 20px 20px 0 0;
    z-index: 910;
    transform: translateY(100%);
    transition: transform var(--trans);
    max-height: 88svh;
    overflow-y: auto;
    padding-bottom: env(safe-area-inset-bottom, 16px);
}
.kie-bottom-sheet.open { transform: translateY(0); }

.kie-sheet-handle {
    width: 36px;
    height: 4px;
    background: var(--bg3);
    border-radius: 2px;
    margin: 10px auto 14px;
}

.kie-sheet-photo-hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px 10px;
}
.kie-sheet-sec-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--label);
}
.kie-sheet-link {
    border: none;
    background: transparent;
    color: #007AFF;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
}

/* Photo row */
.kie-sheet-photo-row {
    display: flex;
    gap: 10px;
    padding: 0 16px 16px;
    overflow-x: auto;
    scrollbar-width: none;
}
.kie-sheet-photo-row::-webkit-scrollbar { display: none; }

.kie-sheet-cam-btn,
.kie-sheet-upload-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    width: 82px;
    height: 82px;
    border-radius: var(--radius);
    background: var(--bg2);
    border: 1px solid var(--sep);
    cursor: pointer;
    flex-shrink: 0;
    font-size: 11px;
    color: var(--label2);
    font-family: inherit;
    transition: background var(--trans);
}
.kie-sheet-cam-btn:hover,
.kie-sheet-upload-btn:hover { background: var(--bg3); }

/* Selected photo previews in sheet */
.kie-sheet-previews {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.kie-sheet-preview-thumb {
    width: 82px;
    height: 82px;
    border-radius: var(--radius);
    object-fit: cover;
    position: relative;
    display: block;
}
.kie-sheet-preview-wrap {
    position: relative;
    flex-shrink: 0;
}
.kie-sheet-preview-rm {
    position: absolute;
    top: -5px;
    right: -5px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #333;
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    line-height: 1;
}

.kie-sheet-divider {
    height: 1px;
    background: var(--sep);
    margin: 0 0 16px;
}

.kie-sheet-tpl-hd {
    padding: 0 16px 12px;
}
.kie-sheet-sec-sub {
    font-size: 13px;
    color: var(--label2);
    margin-top: 3px;
    display: block;
}

/* ── Template grid ── */
.kie-tpl-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
    padding: 0 12px 20px;
}

.kie-tpl-card {
    cursor: pointer;
    border-radius: var(--radius-lg);
    overflow: hidden;
    aspect-ratio: 0.85;
    transition: transform 0.15s, box-shadow 0.15s;
}
.kie-tpl-card:hover { transform: scale(0.98); }
.kie-tpl-card:active { transform: scale(0.96); }

.kie-tpl-cover {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: flex-end;
    padding: 10px 12px;
    position: relative;
    border-radius: var(--radius-lg);
}
.kie-tpl-cover::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 45%, rgba(0,0,0,0.55));
    border-radius: var(--radius-lg);
}
.kie-tpl-label {
    position: relative;
    z-index: 1;
    font-size: 15px;
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 1px 4px rgba(0,0,0,0.4);
    line-height: 1.2;
}

/* ══════════════════════════════
   TEMPLATE DETAIL SHEET
══════════════════════════════ */
.kie-tpl-detail {
    position: fixed;
    inset: 0;
    z-index: 920;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform var(--trans);
}
.kie-tpl-detail.open { transform: translateY(0); }

.kie-tpl-detail-close {
    position: absolute;
    top: 12px; right: 12px;
    z-index: 10;
    width: 32px;
    height: 32px;
    border: none;
    background: rgba(255,255,255,0.85);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--shadow);
}

.kie-tpl-detail-cover {
    width: 100%;
    height: 50svh;
    min-height: 260px;
    flex-shrink: 0;
}

.kie-tpl-detail-body {
    padding: 22px 20px 16px;
    flex: 1;
    overflow-y: auto;
}
.kie-tpl-detail-body h3 {
    font-size: 24px;
    font-weight: 700;
    color: var(--label);
    margin-bottom: 10px;
}
.kie-tpl-detail-body p {
    font-size: 15px;
    color: var(--label2);
    line-height: 1.65;
}

.kie-tpl-detail-footer {
    padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0));
    display: flex;
    flex-direction: column;
    gap: 10px;
    border-top: 1px solid var(--sep2);
}
.kie-action-outline {
    width: 100%;
    padding: 15px;
    border: 1.5px solid var(--sep);
    background: transparent;
    border-radius: var(--radius-pill);
    font-size: 16px;
    font-weight: 600;
    color: var(--label);
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: background var(--trans);
}
.kie-action-outline:hover { background: var(--bg2); }
.kie-action-dark {
    width: 100%;
    padding: 15px;
    border: none;
    background: #0D0D0D;
    border-radius: var(--radius-pill);
    font-size: 16px;
    font-weight: 600;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: opacity var(--trans);
}
.kie-action-dark:hover { opacity: 0.87; }

/* ══════════════════════════════
   FULL IMAGE VIEWER
══════════════════════════════ */
.kie-viewer {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0,0,0,0.96);
    display: none;
    flex-direction: column;
}
.kie-viewer.open { display: flex; }

.kie-viewer-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
}
.kie-viewer-close,
.kie-viewer-dl {
    background: transparent;
    border: none;
    cursor: pointer;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background 0.15s;
}
.kie-viewer-close:hover,
.kie-viewer-dl:hover { background: rgba(255,255,255,0.12); }

.kie-viewer-body {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 16px 16px;
    overflow: hidden;
}
.kie-viewer-body img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    border-radius: var(--radius);
}

/* uploading chip placeholder */
.kie-chip-uploading {
    background: var(--bg-secondary, #f2f2f7);
    color: var(--ink-tertiary, #8e8e93);
    padding: 4px 10px;
    font-size: 12px;
    border-radius: 999px;
    animation: kie-pulse 1.2s ease-in-out infinite;
}
@keyframes kie-pulse { 50% { opacity: .55; } }

/* ══════════════════════════════
   OPTIONS ROW (aspect_ratio + resolution)
══════════════════════════════ */
.kie-options-row {
    display: flex;
    flex-wrap: nowrap;
    gap: 12px;
    align-items: center;
    padding: 8px 12px 4px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.kie-options-row::-webkit-scrollbar { display: none; }

.kie-option-group {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
}

.kie-option-label {
    font-size: 12px;
    color: var(--ink-tertiary, #8e8e93);
    flex-shrink: 0;
}

.kie-option-pills {
    display: inline-flex;
    gap: 4px;
    background: var(--bg-secondary, #f2f2f7);
    border-radius: 999px;
    padding: 3px;
}

.kie-app .kie-option-pill {
    appearance: none !important;
    -webkit-appearance: none !important;
    border: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    color: var(--ink-secondary, #3c3c43) !important;
    font-size: 12px !important;
    font-weight: 500 !important;
    padding: 5px 12px !important;
    border-radius: 999px !important;
    cursor: pointer !important;
    transition: background .15s, color .15s, opacity .15s !important;
    white-space: nowrap !important;
    line-height: 1.3 !important;
    min-height: 26px !important;
    height: auto !important;
    width: auto !important;
    box-shadow: none !important;
    text-shadow: none !important;
    margin: 0 !important;
}
.kie-app .kie-option-pill:hover {
    color: var(--ink-primary, #000) !important;
    background: rgba(0,0,0,.04) !important;
    background-color: rgba(0,0,0,.04) !important;
}
.kie-app .kie-option-pill.is-active {
    background: #fff !important;
    background-color: #fff !important;
    color: #000 !important;
    box-shadow: 0 1px 3px rgba(0,0,0,.08) !important;
}
.kie-app .kie-option-pill:disabled,
.kie-app .kie-option-pill.is-disabled {
    opacity: .35 !important;
    cursor: not-allowed !important;
    pointer-events: none !important;
}

/* ══════════════════════════════
   RESPONSIVE
══════════════════════════════ */
@media (min-width: 640px) {
    .kie-app-main { max-width: 540px; margin: 0 auto; }
    .kie-sidebar { top: 0; }
    .kie-result-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
    .kie-app { display: flex; gap: 0; }
    .kie-sidebar {
        position: relative;
        left: 0 !important;
        width: 260px;
        border-right: 1px solid var(--sep);
        box-shadow: none;
    }
    .kie-overlay { display: none !important; }
    .kie-app-main { flex: 1; max-width: none; }
    .kie-menu-btn { display: none; }
}
