/* ══════════════════════════════════════════════════════════════
   Alibaba Cloud AI Testing Platform
   Style: Alibaba Cloud Design System — Clean light + orange brand
   ══════════════════════════════════════════════════════════════ */

/* ─── Variables ─────────────────────────────────────────────── */
:root {
    /* Alibaba Cloud Brand Colors */
    --ali-orange:      #01A0C7;
    --ali-orange-dark: #0183A3;
    --ali-orange-soft: #EBF7FB;
    --ali-orange-mid:  #A6DEEB;
    --ali-blue:        #0064C8;
    --ali-blue-soft:   #EBF4FF;

    /* Neutrals */
    --bg:           #F5F6F8;
    --bg-white:     #FFFFFF;
    --bg-aside:     #FAFBFC;
    --border:       #E0E3E8;
    --border-focus: #01A0C7;
    --text-h:       #1A1A2E;
    --text-body:    #3D4151;
    --text-sub:     #6B7280;
    --text-muted:   #9CA3AF;

    /* Status */
    --green:  #00B365;
    --red:    #F53F3F;
    --yellow: #FA8C16;

    /* Geometry */
    --radius-sm: 4px;
    --radius:    6px;
    --radius-lg: 10px;

    /* Shadow */
    --shadow-card: 0 1px 4px rgba(0,0,0,0.08), 0 0 0 1px var(--border);
    --shadow-btn:  0 1px 3px rgba(1,160,199,0.25);

    /* Transitions */
    --t: 0.18s ease;

    /* Font */
    --font: 'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;

    /* Sidebar */
    --sidebar-w: 280px;
    --header-h: 52px;
}

/* ─── Reset ──────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg); color: var(--text-body); min-height: 100vh; }
h1,h2,h3,h4 { color: var(--text-h); }
a { color: var(--ali-blue); text-decoration: none; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }

/* ─── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #C1C7D0; }

/* ─── Login Overlay ──────────────────────────────────────────── */
.login-overlay {
    position: fixed; inset: 0; z-index: 999;
    display: flex; align-items: center; justify-content: center;
    background: var(--bg);
    background-image: linear-gradient(135deg, #FFF8F4 0%, #F5F6F8 50%, #EBF4FF 100%);
}

.login-card {
    width: 420px;
    background: var(--bg-white);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    overflow: hidden;
}

.login-header {
    background: var(--ali-orange);
    background-image: linear-gradient(135deg, #01A0C7 0%, #3FC4E8 100%);
    padding: 28px 32px;
    display: flex; align-items: center; gap: 14px;
}
.login-logo-box {
    width: 44px; height: 44px; flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
}
.login-logo-box img { width: 100%; height: 100%; object-fit: contain; }
.login-header-text h1 {
    font-size: 1.15rem; font-weight: 700; color: white;
    letter-spacing: -0.01em;
}
.login-header-text p { font-size: 0.78rem; color: rgba(255,255,255,0.8); margin-top: 2px; }

.login-body { padding: 28px 32px 32px; }
.login-desc {
    font-size: 0.82rem; color: var(--text-sub); margin-bottom: 20px;
    padding: 10px 14px; background: var(--ali-orange-soft);
    border-left: 3px solid var(--ali-orange);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    line-height: 1.6;
}

.login-error {
    font-size: 0.82rem; color: var(--red); margin-top: 10px;
    min-height: 18px; display: flex; align-items: center; gap: 5px;
}

/* ─── Header ─────────────────────────────────────────────────── */
.app-header {
    height: var(--header-h);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border);
    display: flex; align-items: center;
    padding: 0 20px; gap: 0;
    position: sticky; top: 0; z-index: 100;
}

.header-brand {
    display: flex; align-items: center; gap: 10px;
    padding-right: 20px; border-right: 1px solid var(--border);
    flex-shrink: 0;
}
.brand-logo {
    width: 26px; height: 26px;
    display: flex; align-items: center; justify-content: center;
}
.brand-logo img { width: 100%; height: 100%; object-fit: contain; }
.brand-name {
    font-size: 0.88rem; font-weight: 700; color: var(--text-h);
    white-space: nowrap;
}
.brand-badge {
    font-size: 0.65rem; font-weight: 600; color: var(--ali-orange);
    background: var(--ali-orange-soft); border: 1px solid var(--ali-orange-mid);
    padding: 1px 6px; border-radius: 20px; margin-left: 4px;
}

/* Tab Nav */
.tab-nav {
    display: flex; align-items: stretch; height: var(--header-h);
    margin-left: 4px; gap: 2px;
}
.tab-btn {
    display: flex; align-items: center; gap: 6px;
    padding: 0 16px; height: 100%;
    background: transparent; border: none;
    font-family: var(--font); font-size: 0.86rem; font-weight: 500;
    color: var(--text-sub); cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: var(--t); white-space: nowrap;
    position: relative; top: 0;
}
.tab-btn:hover { color: var(--text-h); background: var(--bg); }
.tab-btn.active {
    color: var(--ali-orange);
    border-bottom-color: var(--ali-orange);
    background: var(--ali-orange-soft);
}
.tab-btn svg { flex-shrink: 0; }

.header-right {
    margin-left: auto;
    display: flex; align-items: center; gap: 8px;
}
.api-key-indicator {
    display: flex; align-items: center; gap: 6px;
    font-size: 0.78rem; color: var(--text-sub);
    background: var(--bg); border: 1px solid var(--border);
    padding: 4px 10px; border-radius: 20px;
}
.api-key-indicator .dot {
    width: 6px; height: 6px; border-radius: 50%; background: var(--green);
    flex-shrink: 0;
}

/* ─── Tab Content ────────────────────────────────────────────── */
.tab-content { display: none; height: calc(100vh - var(--header-h)); }
.tab-content.active { display: flex; }

/* ─── Panel Layout ───────────────────────────────────────────── */
.panel-sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    background: var(--bg-aside);
    border-right: 1px solid var(--border);
    overflow-y: auto; padding: 16px;
    display: flex; flex-direction: column; gap: 0;
}
.panel-main {
    flex: 1; display: flex; flex-direction: column; overflow: hidden;
}

.sidebar-section {
    margin-bottom: 4px;
}
.sidebar-section-title {
    font-size: 0.72rem; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: 0.06em;
    padding: 10px 4px 6px; border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}

/* ─── Form Elements ──────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label, .form-label {
    display: flex; justify-content: space-between; align-items: center;
    font-size: 0.8rem; font-weight: 500; color: var(--text-body);
    margin-bottom: 5px;
}
.param-val {
    font-family: var(--font-mono); font-size: 0.75rem;
    color: var(--ali-orange); font-weight: 600;
}
.param-hint {
    font-size: 0.7rem; color: var(--text-muted); font-weight: 400; margin-left: 4px;
}
input[type="number"].number-input {
    width: 100%; padding: 7px 10px;
    border: 1px solid var(--border); border-radius: var(--radius);
    font-family: var(--font-mono); font-size: 0.85rem; color: var(--text-body);
    background: var(--bg-white); outline: none; transition: var(--t);
}
input[type="number"].number-input:focus {
    border-color: var(--ali-orange);
    box-shadow: 0 0 0 2px rgba(1,160,199,0.12);
}
input[type="number"].number-input::placeholder { color: var(--text-muted); }

input[type="text"], input[type="password"],
select.select-input, textarea.textarea-input {
    width: 100%; padding: 7px 10px;
    border: 1px solid var(--border); border-radius: var(--radius);
    font-family: var(--font); font-size: 0.85rem; color: var(--text-body);
    background: var(--bg-white); outline: none; transition: var(--t);
    line-height: 1.4;
}
input:focus, select.select-input:focus, textarea.textarea-input:focus {
    border-color: var(--ali-orange);
    box-shadow: 0 0 0 2px rgba(1,160,199,0.12);
}
select.select-input {
    cursor: pointer; appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='%236B7280'%3E%3Cpath d='M7 10l5 5 5-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 8px center;
    padding-right: 28px;
}
select.select-input option { background: white; }
textarea.textarea-input { resize: vertical; min-height: 54px; }

/* Range */
input[type="range"] {
    -webkit-appearance: none; width: 100%;
    height: 3px; border-radius: 2px;
    background: #E0E3E8; outline: none; cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none; width: 14px; height: 14px;
    background: var(--ali-orange); border-radius: 50%;
    box-shadow: 0 1px 3px rgba(1,160,199,0.3);
}

/* Toggle */
.toggle-row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.toggle-row label:first-child { font-size: 0.8rem; font-weight: 500; color: var(--text-body); }
.toggle { position: relative; width: 36px; height: 20px; flex-shrink: 0; }
.toggle input { display: none; }
.toggle-slider {
    position: absolute; inset: 0;
    background: #D1D5DB; border-radius: 10px; transition: var(--t); cursor: pointer;
}
.toggle-slider::before {
    content: ''; position: absolute;
    left: 2px; top: 2px; width: 16px; height: 16px;
    background: white; border-radius: 50%; transition: var(--t);
    box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}
.toggle input:checked + .toggle-slider { background: var(--ali-orange); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ─── Buttons ────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border: none; border-radius: var(--radius);
    font-family: var(--font); font-size: 0.85rem; font-weight: 500;
    cursor: pointer; transition: var(--t); white-space: nowrap;
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary {
    background: var(--ali-orange); color: white;
    box-shadow: var(--shadow-btn);
}
.btn-primary:hover:not(:disabled) { background: var(--ali-orange-dark); }
.btn-ghost {
    background: transparent; color: var(--text-sub);
    border: 1px solid var(--border);
}
.btn-ghost:hover { color: var(--text-h); border-color: #B0B7C3; background: var(--bg); }
.btn-sm { padding: 5px 10px; font-size: 0.78rem; }
.btn-full { width: 100%; justify-content: center; }

/* ─── Chat (Text Tab) ────────────────────────────────────────── */
.chat-output {
    flex: 1; min-height: 0; overflow-y: auto; padding: 20px 24px;
    display: flex; flex-direction: column; gap: 12px;
    background: var(--bg-white);
}
.empty-state {
    flex: 1; display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 8px; color: var(--text-muted); font-size: 0.85rem;
    text-align: center; padding: 40px;
}
.empty-state svg { opacity: 0.3; }

.chat-message {
    max-width: 82%; padding: 10px 14px;
    border-radius: var(--radius-lg); font-size: 0.88rem; line-height: 1.7;
    white-space: pre-wrap; word-break: break-word;
    animation: fadeUp 0.2s ease;
}
.chat-message.user {
    align-self: flex-end;
    background: var(--ali-orange);
    color: white; border-bottom-right-radius: var(--radius-sm);
}
.chat-message.assistant {
    align-self: flex-start;
    background: var(--bg); border: 1px solid var(--border);
    color: var(--text-body); border-bottom-left-radius: var(--radius-sm);
}
.msg-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 6px; display: flex; justify-content: space-between; }
.streaming-cursor::after { content: '▋'; animation: blink 0.7s infinite; color: var(--ali-orange); font-size: 0.7em; }

.chat-input-bar {
    border-top: 1px solid var(--border);
    background: var(--bg-white);
    padding: 12px 16px;
}
.chat-input-row { display: flex; gap: 8px; align-items: flex-end; }
.chat-textarea {
    flex: 1; padding: 9px 12px;
    border: 1px solid var(--border); border-radius: var(--radius);
    font-family: var(--font); font-size: 0.88rem; color: var(--text-body);
    resize: none; outline: none; line-height: 1.5; min-height: 40px; max-height: 120px;
    background: var(--bg-white); transition: var(--t);
}
.chat-textarea:focus { border-color: var(--ali-orange); box-shadow: 0 0 0 2px rgba(1,160,199,0.1); }
.chat-textarea::placeholder { color: var(--text-muted); }
.chat-actions-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }

/* ─── Prompt Panel (Image/Video) ─────────────────────────────── */
.prompt-panel {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-white);
}
.prompt-row { display: flex; gap: 10px; align-items: flex-start; }
.prompt-col { flex: 1; }

/* ─── Results Area ───────────────────────────────────────────── */
.results-area {
    /* flex 子項預設 min-height:auto，內容一多就會撐破 flex:1 的高度限制，讓
       overflow-y:auto 完全失效（父層 .panel-main 的 overflow:hidden 會把超出
       範圍的內容整個裁掉、連捲軸都不會出現）——超過一定張數後最後幾張圖的
       下載按鈕「消失」正是這個原因，加 min-height:0 讓它老實地被限制在 flex
       分配到的高度內，才會真的產生捲軸 */
    flex: 1; min-height: 0; overflow-y: auto;
    padding: 20px; background: var(--bg);
    display: flex; flex-wrap: wrap;
    gap: 12px; align-content: flex-start;
}

/* Image results grid */
#imageResults {
    /* grid-auto-rows 預設的 auto 在容器有固定高度（來自上面 .results-area 的
       flex:1）時，會把每一列壓縮塞進容器高度，而不是照片自然高度排列、超出
       的部分交給 overflow-y:auto 捲動——結果是圖片一多，後面幾列（含下載按鈕）
       整列被壓扁到看不見。改成 min-content 讓每一列維持自然高度，容器才會
       真的產生可捲動的內容 */
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    grid-auto-rows: min-content;
    align-content: start;
}

/* Image card */
.img-card {
    width: auto; position: relative;
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius-lg); overflow: hidden;
    transition: var(--t); animation: fadeUp 0.25s ease;
}
.img-card:hover { border-color: var(--ali-orange); box-shadow: 0 2px 12px rgba(1,160,199,0.1); }
.img-card img {
    width: 100%; max-height: 300px; object-fit: cover;
    cursor: zoom-in; transition: opacity var(--t);
    display: block;
}
.img-card img:hover { opacity: 0.88; }
.img-card-footer {
    padding: 8px 10px; display: flex; justify-content: space-between; align-items: center;
    border-top: 1px solid var(--border);
}
.img-model-tag {
    font-size: 0.72rem; color: var(--text-sub);
    background: var(--bg); padding: 2px 7px; border-radius: 20px;
    border: 1px solid var(--border);
}
.img-dl {
    font-size: 0.75rem; color: var(--ali-orange); font-weight: 500;
    background: var(--ali-orange-soft); padding: 3px 10px;
    border-radius: var(--radius-sm); border: 1px solid var(--ali-orange-mid);
    text-decoration: none; transition: var(--t);
}
.img-dl:hover { background: var(--ali-orange); color: white; }
.img-actual-prompt {
    padding: 6px 10px; font-size: 0.72rem; line-height: 1.5;
    color: var(--text-sub); border-top: 1px solid var(--border);
    background: var(--bg);
}
.img-lb-btn {
    font-size: 0.75rem; color: var(--ali-orange); font-weight: 500;
    background: var(--ali-orange-soft); padding: 3px 10px;
    border-radius: var(--radius-sm); border: 1px solid var(--ali-orange-mid);
    cursor: pointer; transition: var(--t); margin-left: 8px;
}
.img-lb-btn:hover { background: var(--ali-orange); color: white; }

/* Video results */
.video-results-area {
    flex: 1; min-height: 0; overflow-y: auto; padding: 20px;
    background: var(--bg); display: flex; flex-direction: column; gap: 12px;
}

.video-task-card {
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 16px;
    animation: fadeUp 0.25s ease;
}
.vtc-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; gap: 8px; }
.vtc-model { font-size: 0.8rem; font-weight: 600; color: var(--text-h); }
.vtc-timer { font-size: 0.72rem; color: var(--text-muted); font-family: var(--font-mono); }
.vtc-status {
    font-size: 0.7rem; font-weight: 700; padding: 2px 8px;
    border-radius: 20px; text-transform: uppercase;
    margin-left: auto;
}
.vtc-status.pending  { background: #FFF8E1; color: var(--yellow); }
.vtc-status.running  { background: var(--ali-blue-soft); color: var(--ali-blue); }
.vtc-status.succeeded{ background: #E8F8F1; color: var(--green); }
.vtc-status.failed   { background: #FFF0F0; color: var(--red); }

.vtc-prompt { font-size: 0.82rem; color: var(--text-sub); margin-bottom: 10px; line-height: 1.5; }
.vtc-progress { height: 3px; background: var(--border); border-radius: 2px; margin-bottom: 10px; overflow: hidden; }
.vtc-progress-bar {
    height: 100%; border-radius: 2px;
    background: linear-gradient(90deg, var(--ali-orange) 0%, #3FC4E8 100%);
    transition: width 0.5s ease; animation: pulse 2s ease-in-out infinite;
}
.video-player {
    width: 100%; height: auto; max-height: 480px;
    border-radius: var(--radius); object-fit: contain;
    border: 1px solid var(--border); margin-top: 8px;
    display: block; background: var(--bg);
}

.video-card-actions {
    display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap;
}

.muleai-img-result {
    display: block; width: 100%; border-radius: var(--radius);
    margin-top: 8px; cursor: zoom-in; transition: opacity var(--t);
}
.muleai-img-result:hover { opacity: 0.88; }

/* ─── Upload area ────────────────────────────────────────────── */
.upload-zone {
    border: 1.5px dashed var(--border); border-radius: var(--radius);
    padding: 18px 12px; text-align: center;
    position: relative; cursor: pointer; transition: var(--t);
    background: var(--bg-white);
}
.upload-zone:hover { border-color: var(--ali-orange); background: var(--ali-orange-soft); }
.upload-zone input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.upload-zone-icon { color: var(--text-muted); font-size: 1.4rem; margin-bottom: 4px; }
.upload-zone p { font-size: 0.78rem; color: var(--text-sub); }
.upload-preview { max-height: 160px; margin: 8px auto 0; border-radius: var(--radius); object-fit: contain; }
.ref-list { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.ref-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 5px 8px; font-size: 0.78rem; color: var(--text-sub);
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.ref-item button { background: none; border: none; color: var(--red); cursor: pointer; font-size: 0.9rem; }

/* ─── Toast ──────────────────────────────────────────────────── */
.toast-container { position: fixed; top: 16px; right: 16px; z-index: 2000; display: flex; flex-direction: column; gap: 6px; }
.toast {
    padding: 10px 16px; max-width: 320px;
    border-radius: var(--radius); font-size: 0.82rem; font-weight: 500;
    border: 1px solid transparent;
    animation: slideRight 0.2s ease;
    box-shadow: 0 2px 8px rgba(0,0,0,0.12);
}
.toast.success { background: #E8F8F1; color: var(--green); border-color: #B7EBD0; }
.toast.error   { background: #FFF0F0; color: var(--red);   border-color: #FFCDD2; }
.toast.info    { background: var(--ali-orange-soft); color: var(--ali-orange); border-color: var(--ali-orange-mid); }

/* ─── Loading ────────────────────────────────────────────────── */
.loading-overlay {
    position: fixed; inset: 0; z-index: 900;
    background: rgba(255,255,255,0.75); backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center;
}
.loading-box {
    background: var(--bg-white); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 28px 36px;
    text-align: center; box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}
.spin-ring {
    width: 40px; height: 40px; margin: 0 auto 14px;
    border: 3px solid var(--ali-orange-mid);
    border-top-color: var(--ali-orange);
    border-radius: 50%; animation: spin 0.8s linear infinite;
}
.loading-box p { font-size: 0.85rem; color: var(--text-sub); }

/* ─── Tooltip ────────────────────────────────────────────────── */
[data-tip] { cursor: help; }
.global-tooltip {
    position: fixed;
    z-index: 9999;
    background: #1a1a2e;
    color: #e8eaf0;
    font-family: var(--font);
    font-size: 0.72rem;
    line-height: 1.55;
    padding: 7px 11px;
    border-radius: var(--radius);
    max-width: 240px;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(0,0,0,0.3);
    white-space: normal;
}

/* ─── Animations ─────────────────────────────────────────────── */
@keyframes fadeUp   { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideRight { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin     { to   { transform: rotate(360deg); } }
@keyframes blink    { 0%,100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes pulse    { 0%,100% { opacity: 1; } 50% { opacity: 0.7; } }

/* ─── Lightbox ───────────────────────────────────────────────── */
.lightbox {
    position: fixed; inset: 0; z-index: 3000;
    background: rgba(0,0,0,0.92);
    display: flex; align-items: center; justify-content: center;
    cursor: zoom-out;
    animation: fadeIn 0.15s ease;
}
.lightbox-inner {
    position: relative; display: flex; align-items: center; justify-content: center;
    max-width: 92vw; max-height: 92vh; cursor: default;
}
.lightbox-inner img {
    max-width: 90vw; max-height: 88vh;
    border-radius: var(--radius); object-fit: contain;
    box-shadow: 0 12px 48px rgba(0,0,0,0.6); display: block;
}
.lightbox-inner video {
    max-width: 90vw; max-height: 82vh;
    border-radius: var(--radius);
    box-shadow: 0 12px 48px rgba(0,0,0,0.6);
}
.lightbox-close {
    position: fixed; top: 16px; right: 16px;
    width: 40px; height: 40px;
    background: rgba(255,255,255,0.15); border: none; border-radius: 50%;
    color: white; font-size: 1.1rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background var(--t); z-index: 3001; line-height: 1;
}
.lightbox-close:hover { background: rgba(255,255,255,0.3); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ─── Voice Panel ─────────────────────────────────────────────── */
.voice-result {
    margin-top: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.voice-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}
.voice-result-text {
    padding: 14px;
    font-size: 14px;
    line-height: 1.75;
    color: var(--text-primary);
    white-space: pre-wrap;
    word-break: break-word;
    min-height: 60px;
}
.voice-result-meta {
    padding: 8px 14px;
    font-size: 11px;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
}
audio {
    accent-color: var(--accent);
    background: var(--surface-2);
}

/* ── Image Edit Multi-upload ── */
.img-thumb-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-bottom: 8px;
}
.img-thumb {
    position: relative;
    aspect-ratio: 1;
    border-radius: 6px;
    overflow: hidden;
    background: var(--surface-2);
}
.img-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.img-thumb-remove {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: rgba(0,0,0,.55);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}
.img-thumb-remove:hover { background: rgba(220,50,50,.8); }
.upload-add-btn {
    width: 100%;
    padding: 7px 0;
    border: 1.5px dashed var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    transition: border-color .15s, color .15s;
}
.upload-add-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
