/* =====================================================================
   好运 · AI 生图工作台
   依赖 css/hy-base.css 中的设计令牌与应用外壳。
   布局：左侧参数面板（固定、内部滚动、底部常驻生成按钮）+ 右侧结果舞台。
   ===================================================================== */

* { box-sizing: border-box; }

body { margin: 0; min-height: 100vh; }

button, select, textarea, input { font: inherit; color: inherit; }

.hidden { display: none !important; }
.hidden-tool { display: none !important; }

/* ---------------------------------------------------------------------
   启动 / 登录
   --------------------------------------------------------------------- */
.boot-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}
.boot-card {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    border: 1px solid var(--hy-border);
    border-radius: 999px;
    background: var(--hy-surface);
    color: var(--hy-muted);
    font-size: 13px;
    box-shadow: var(--hy-shadow-sm);
}
.boot-spinner,
.submit-btn.is-busy::before {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    border: 2px solid var(--hy-brand-soft-2);
    border-top-color: var(--hy-brand);
    animation: hy-spin .7s linear infinite;
}
@keyframes hy-spin { to { transform: rotate(360deg); } }

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(360px, 44%) 1fr;
    background: var(--hy-surface);
}
.auth-brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 32px;
    padding: 40px 48px;
    overflow: hidden;
    color: #fafafa;
    background:
        radial-gradient(600px 400px at 110% -10%, rgba(229, 77, 46, .38), transparent 60%),
        radial-gradient(500px 360px at -20% 110%, rgba(229, 77, 46, .18), transparent 60%),
        #18181b;
}
.auth-brand::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .04) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .04) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: linear-gradient(180deg, #000 0%, transparent 80%);
    pointer-events: none;
}
.auth-brand > * { position: relative; z-index: 1; }
.auth-brand-top { display: flex; align-items: center; gap: 10px; }
.auth-logo {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 9px;
    background: var(--hy-brand);
    color: #fff;
}
.auth-logo svg { width: 21px; height: 21px; }
.auth-logo-text { font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.auth-brand-body h2 {
    margin: 0 0 12px;
    font-size: 30px;
    line-height: 1.25;
    font-weight: 700;
    letter-spacing: -.01em;
}
.auth-brand-body p {
    margin: 0 0 28px;
    max-width: 420px;
    color: #a1a1aa;
    font-size: 14.5px;
    line-height: 1.7;
}
.auth-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.auth-points li {
    display: grid;
    gap: 2px;
    padding-left: 22px;
    position: relative;
}
.auth-points li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 5px;
    width: 12px;
    height: 12px;
    border-radius: 4px;
    background: var(--hy-brand);
    box-shadow: 0 0 0 4px rgba(229, 77, 46, .2);
}
.auth-points b { font-size: 14px; font-weight: 600; }
.auth-points span { color: #a1a1aa; font-size: 13px; }
.auth-brand-foot { color: #71717a; font-size: 12px; }

.auth-main {
    display: grid;
    place-items: center;
    padding: 40px 24px;
}
.auth-card {
    width: min(380px, 100%);
    display: grid;
    gap: 16px;
}
.auth-title { font-size: 24px; font-weight: 700; color: var(--hy-text); letter-spacing: -.01em; }
.auth-subtitle { margin-top: -10px; color: var(--hy-muted); font-size: 13.5px; }
.auth-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 4px;
    padding: 4px;
    border-radius: var(--hy-radius);
    background: var(--hy-muted-bg);
}
.auth-tab {
    height: 32px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--hy-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
.auth-tab.active {
    background: var(--hy-surface);
    color: var(--hy-text);
    font-weight: 600;
    box-shadow: var(--hy-shadow-sm);
}
.auth-field { display: grid; gap: 6px; color: var(--hy-text-2); font-size: 12.5px; font-weight: 500; }
.auth-field input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--hy-border-strong);
    border-radius: var(--hy-radius);
    background: var(--hy-surface);
    color: var(--hy-text);
    font-size: 14px;
    outline: none;
    box-shadow: var(--hy-shadow-xs);
    transition: border-color .12s, box-shadow .12s;
}
.auth-field input:focus { border-color: var(--hy-brand); box-shadow: 0 0 0 3px var(--hy-brand-ring); }
.auth-card .submit-btn { height: 40px; }

/* ---------------------------------------------------------------------
   弹窗
   --------------------------------------------------------------------- */
.password-change-modal,
.image-preview-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 24px;
}
.image-preview-modal { z-index: 990; }
.password-change-backdrop,
.image-preview-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(24, 24, 27, .5);
    backdrop-filter: blur(4px);
}
.password-change-card,
.image-preview-card {
    position: relative;
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius-lg);
    background: var(--hy-surface);
    box-shadow: var(--hy-shadow-lg);
    animation: hy-pop .14s ease-out;
}
.password-change-card {
    width: min(420px, 100%);
    display: grid;
    gap: 14px;
    padding: 24px;
}
.password-change-title { font-size: 18px; font-weight: 700; }
.password-change-subtitle { margin-top: -6px; color: var(--hy-muted); line-height: 1.6; }
.image-preview-card {
    width: min(88vw, 1320px);
    height: min(88vh, 960px);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
}
.image-preview-head,
.image-preview-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
}
.image-preview-head { border-bottom: 1px solid var(--hy-border); }
.image-preview-actions { justify-content: flex-end; border-top: 1px solid var(--hy-border); background: var(--hy-subtle); }
.image-preview-title { font-size: 14px; font-weight: 600; }
.image-preview-body {
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: auto;
    background:
        repeating-conic-gradient(#f4f4f5 0% 25%, #fafafa 0% 50%) 50% / 20px 20px;
}
.image-preview-body img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ---------------------------------------------------------------------
   工作台框架
   --------------------------------------------------------------------- */
.page-shell { min-height: 100vh; }

.wb {
    max-width: 1760px;
    margin: 0 auto;
    padding: 20px 24px 32px;
}
.wb-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}
.wb-head h1 {
    margin: 0 0 4px;
    font-size: 20px;
    font-weight: 650;
    letter-spacing: -.01em;
    color: var(--hy-text);
}
.wb-head p {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    margin: 0;
    color: var(--hy-muted);
    font-size: 13px;
}
.wb-kbd-hint { display: inline-flex; align-items: center; gap: 3px; color: var(--hy-faint); font-size: 12px; }
.wb-kbd-hint kbd:last-of-type { margin-right: 3px; }

/* 图片 / 视频 分段切换 */
.switch-card {
    display: inline-grid;
    grid-auto-flow: column;
    gap: 2px;
    padding: 3px;
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius);
    background: var(--hy-muted-bg);
}
.switch-tab {
    height: 30px;
    min-width: 88px;
    padding: 0 14px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--hy-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s, color .12s;
}
.switch-tab:hover { color: var(--hy-text); }
.switch-tab.active {
    background: var(--hy-surface);
    color: var(--hy-text);
    font-weight: 600;
    box-shadow: var(--hy-shadow-sm);
}
.switch-tab.disabled { opacity: .5; cursor: not-allowed; }

.workspace {
    display: grid;
    grid-template-columns: minmax(340px, 400px) minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}

.card {
    background: var(--hy-surface);
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius-lg);
    box-shadow: var(--hy-shadow-xs);
    color: var(--hy-text);
}

/* ---------------------------------------------------------------------
   左侧参数面板
   --------------------------------------------------------------------- */
.composer {
    position: sticky;
    top: calc(var(--hy-topbar-h) + 16px);
    max-height: calc(100vh - var(--hy-topbar-h) - 108px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.composer-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}
.composer-section {
    padding: 16px;
    border-bottom: 1px solid var(--hy-border);
}
.composer-section:last-child { border-bottom: 0; }
.composer-section-title,
.dynamic-option-title {
    margin-bottom: 12px;
    color: var(--hy-text);
    font-size: 13px;
    font-weight: 600;
}
.param-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}
.param-grid .span-2 { grid-column: 1 / -1; }

.field-card label,
.mode-card label,
.option-field-label {
    display: block;
    margin-bottom: 6px;
    color: var(--hy-text-2);
    font-size: 12.5px;
    font-weight: 500;
}
.mode-card label { color: var(--hy-text); font-size: 13px; font-weight: 600; }

select,
textarea,
#quantityInput,
.option-field input[type="text"],
.clip-segment-row input,
input[type="number"] {
    width: 100%;
    min-height: 36px;
    padding: 7px 11px;
    border: 1px solid var(--hy-border-strong);
    border-radius: var(--hy-radius);
    background-color: var(--hy-surface);
    color: var(--hy-text);
    font-size: 13px;
    outline: none;
    box-shadow: var(--hy-shadow-xs);
    transition: border-color .12s, box-shadow .12s;
}
select {
    appearance: none;
    padding-right: 32px;
    cursor: pointer;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2371717a' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-size: 14px;
}
select:hover,
textarea:hover,
#quantityInput:hover { border-color: #c4c4cc; }
select:focus,
textarea:focus,
#quantityInput:focus,
.option-field input[type="text"]:focus,
.clip-segment-row input:focus {
    border-color: var(--hy-brand);
    box-shadow: 0 0 0 3px var(--hy-brand-ring);
}
select:disabled,
textarea:disabled { color: var(--hy-faint); background-color: var(--hy-subtle); cursor: not-allowed; }
textarea { min-height: 88px; resize: vertical; line-height: 1.6; }
textarea::placeholder,
input::placeholder { color: #b4b4bb; }
.quantity-row { display: block; }
input[type="range"] { width: 100%; accent-color: var(--hy-brand); }
input[type="checkbox"],
input[type="radio"] { accent-color: var(--hy-brand); }

/* 底部常驻操作区 */
.composer-foot {
    flex: 0 0 auto;
    padding: 12px 16px 14px;
    border-top: 1px solid var(--hy-border);
    background: var(--hy-subtle);
}
.generation-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}
.submit-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 40px;
    padding: 0 16px;
    border: 1px solid var(--hy-brand-hover);
    border-radius: var(--hy-radius);
    background: var(--hy-brand);
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), var(--hy-shadow-xs);
    transition: background .12s, box-shadow .12s, opacity .12s;
}
.submit-btn:hover:not(:disabled) { background: var(--hy-brand-hover); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .16), var(--hy-shadow-sm); }
.submit-btn:disabled { opacity: .6; cursor: wait; }
.compressed-submit-btn {
    width: auto;
    padding: 0 14px;
    border-color: var(--hy-border-strong);
    background: var(--hy-surface);
    color: var(--hy-text-2);
    font-weight: 500;
    box-shadow: var(--hy-shadow-xs);
}
.compressed-submit-btn:hover:not(:disabled) { background: var(--hy-hover); color: var(--hy-text); box-shadow: var(--hy-shadow-xs); }
.compressed-generate-hint {
    margin: 8px 0 0;
    color: var(--hy-faint);
    font-size: 11.5px;
    line-height: 1.5;
}

/* ---------------------------------------------------------------------
   上传
   --------------------------------------------------------------------- */
.upload-card-header,
.result-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    color: var(--hy-text);
    font-size: 13px;
    font-weight: 600;
}
.upload-slots { display: grid; gap: 12px; }
.upload-slot { display: flex; flex-direction: column; gap: 6px; }
.upload-label { color: var(--hy-muted); font-size: 12px; font-weight: 500; }
.upload-dropzone {
    display: block;
    min-height: 116px;
    padding: 16px;
    border: 1px dashed var(--hy-border-strong);
    border-radius: var(--hy-radius-lg);
    background: var(--hy-subtle);
    cursor: pointer;
    transition: border-color .12s, background .12s, box-shadow .12s;
}
.upload-dropzone:hover,
.upload-dropzone.is-dragover {
    border-color: var(--hy-brand);
    background: var(--hy-brand-soft);
}
.upload-dropzone.is-dragover { box-shadow: 0 0 0 3px var(--hy-brand-ring); }
.upload-dropzone input { display: none; }
.upload-content {
    min-height: 84px;
    display: grid;
    justify-items: center;
    align-content: center;
    gap: 8px;
    text-align: center;
}
.folder-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius);
    background: var(--hy-surface);
    color: var(--hy-text-2);
    box-shadow: var(--hy-shadow-xs);
}
.folder-icon svg { width: 17px; height: 17px; }
.upload-dropzone:hover .folder-icon { color: var(--hy-brand); border-color: var(--hy-brand-soft-2); }
.upload-text { color: var(--hy-muted); font-size: 12.5px; }
.add-image-btn {
    height: 26px;
    padding: 0 10px;
    border: 1px solid var(--hy-border-strong);
    border-radius: var(--hy-radius-sm);
    background: var(--hy-surface);
    color: var(--hy-text-2);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}
.add-image-btn:hover { border-color: var(--hy-brand); color: var(--hy-brand-ink); }

.upload-preview {
    display: grid;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius-lg);
    background: var(--hy-subtle);
}
.upload-preview img {
    display: block;
    width: 100%;
    max-height: 200px;
    object-fit: contain;
    border-radius: var(--hy-radius);
    background: var(--hy-muted-bg);
}
.upload-preview video,
.upload-preview-item video {
    width: 100%;
    max-height: 180px;
    border-radius: var(--hy-radius);
    background: var(--hy-muted-bg);
}
.upload-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    color: var(--hy-muted);
    font-size: 12px;
}
.upload-filename { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-preview-item { position: relative; }
.upload-preview-item + .upload-preview-item { padding-top: 10px; border-top: 1px solid var(--hy-border); }
.upload-preview .upload-remove-icon {
    position: absolute;
    top: 6px;
    right: 6px;
    z-index: 2;
    width: 24px;
    height: 24px;
    padding: 0;
    display: grid;
    place-items: center;
    border: 1px solid var(--hy-border);
    border-radius: 6px;
    background: rgba(255, 255, 255, .95);
    color: var(--hy-text-2);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    box-shadow: var(--hy-shadow-sm);
}
.upload-preview .upload-remove-icon:hover { color: var(--hy-danger); border-color: rgba(220, 38, 38, .35); background: var(--hy-danger-soft); }

/* ---------------------------------------------------------------------
   模式专属参数
   --------------------------------------------------------------------- */
.option-fields { display: grid; gap: 14px; }
.option-field { display: grid; gap: 6px; }
.option-field-label { margin: 0; }
.option-range-row { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.option-range-value { min-width: 32px; color: var(--hy-brand-ink); font-weight: 600; text-align: right; }
.option-checkbox-list { display: flex; flex-wrap: wrap; gap: 6px; }
.option-checkbox-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid var(--hy-border);
    border-radius: 999px;
    background: var(--hy-surface);
    color: var(--hy-text-2);
    font-size: 12.5px;
    cursor: pointer;
    transition: border-color .12s, background .12s;
}
.option-checkbox-item:hover { border-color: var(--hy-border-strong); }
.option-checkbox-item:has(input:checked) { border-color: var(--hy-brand); background: var(--hy-brand-soft); color: var(--hy-brand-ink); }
.option-checkbox-item input { margin: 0; }

/* 水印编辑 */
.watermark-editor { display: grid; gap: 10px; padding-top: 6px; }
.watermark-editor-title { color: var(--hy-text); font-weight: 600; }
.watermark-editor-empty,
.watermark-position-text { color: var(--hy-muted); font-size: 12px; }
.watermark-stage {
    position: relative;
    overflow: hidden;
    width: 100%;
    aspect-ratio: 1 / 1;
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius-lg);
    background: var(--hy-subtle);
}
.watermark-base { width: 100%; height: 100%; object-fit: contain; display: block; }
.watermark-overlay {
    position: absolute;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-width: 42px;
    max-width: 80%;
    padding: 4px 6px;
    color: #fff;
    font-weight: 800;
    text-shadow: 0 1px 4px rgba(0, 0, 0, .45);
    transform: translate(-50%, -50%);
    cursor: grab;
    touch-action: none;
    user-select: none;
    outline: 1px dashed rgba(255, 255, 255, .8);
}
.watermark-overlay:active { cursor: grabbing; }
.watermark-overlay img { width: 100%; max-height: 92px; object-fit: contain; }
.watermark-overlay span { white-space: nowrap; font-size: clamp(12px, 2.4vw, 22px); }

/* ---------------------------------------------------------------------
   右侧结果舞台
   --------------------------------------------------------------------- */
.stage {
    min-width: 0;
    min-height: calc(100vh - var(--hy-topbar-h) - 120px);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.stage-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 16px;
    border-bottom: 1px solid var(--hy-border);
    background: var(--hy-surface);
}
.tabs { display: flex; gap: 4px; flex: 0 0 auto; }
.tab-btn {
    position: relative;
    height: 46px;
    padding: 0 12px;
    border: 0;
    background: transparent;
    color: var(--hy-muted);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: color .12s;
}
.tab-btn:hover { color: var(--hy-text); }
.tab-btn.active { color: var(--hy-text); font-weight: 600; }
.tab-btn.active::after {
    content: "";
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: -1px;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--hy-brand);
}

.queue-bar {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--hy-text-2);
    font-size: 12.5px;
}
.queue-title {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--hy-muted);
    font-weight: 500;
}
#queueCount {
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    display: inline-grid;
    place-items: center;
    border-radius: 999px;
    background: var(--hy-muted-bg);
    color: var(--hy-text);
    font-size: 11.5px;
    font-weight: 600;
}
.queue-list {
    min-width: 0;
    display: flex;
    gap: 6px;
    overflow-x: auto;
    color: var(--hy-faint);
    white-space: nowrap;
    scrollbar-width: none;
}
.queue-list::-webkit-scrollbar { display: none; }
.queue-item {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 24px;
    padding: 0 9px;
    border: 1px solid var(--hy-border);
    border-radius: 999px;
    background: var(--hy-surface);
    color: var(--hy-text-2);
    font-size: 12px;
}
.queue-item::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--hy-faint);
}
.queue-item.running { color: var(--hy-info-ink); border-color: rgba(37, 99, 235, .25); background: var(--hy-info-soft); }
.queue-item.running::before { background: var(--hy-info); animation: hy-pulse 1.2s ease-in-out infinite; }
.queue-item.success { color: var(--hy-success-ink); border-color: rgba(22, 163, 74, .25); background: var(--hy-success-soft); }
.queue-item.success::before { background: var(--hy-success); }
.queue-item.failed { color: var(--hy-danger-ink); border-color: rgba(220, 38, 38, .25); background: var(--hy-danger-soft); }
.queue-item.failed::before { background: var(--hy-danger); }
@keyframes hy-pulse { 50% { opacity: .35; } }

.tab-panel { display: none; flex: 1 1 auto; min-height: 0; }
.tab-panel.active { display: block; }
.prompt-panel,
.result-panel,
.history-panel { padding: 16px; }

.status-text {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--hy-text);
    font-weight: 600;
}
.status-text::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--hy-brand);
    box-shadow: 0 0 0 3px var(--hy-brand-ring);
}

.prompt-preview,
.host-script-text {
    margin: 0;
    padding: 14px;
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius-lg);
    background: var(--hy-subtle);
    color: var(--hy-text-2);
    font-family: var(--hy-mono);
    font-size: 12.5px;
    line-height: 1.7;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}
.prompt-preview { min-height: 320px; }

.result-grid {
    min-height: 460px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 12px;
    align-content: start;
}
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: var(--hy-muted);
    font-size: 13px;
}
.result-grid.empty-state,
.history-list.empty-state {
    border: 1px dashed var(--hy-border-strong);
    border-radius: var(--hy-radius-lg);
    background: var(--hy-subtle);
}
.result-grid.empty-state::before {
    content: "";
    width: 44px;
    height: 44px;
    margin-bottom: 12px;
    border-radius: var(--hy-radius-lg);
    background:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23e54d2e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'><rect x='3' y='3' width='18' height='18' rx='2'/><circle cx='9' cy='9' r='2'/><path d='M21 15l-3.1-3.1a2 2 0 0 0-2.8 0L6 21'/></svg>") center / 22px no-repeat,
        var(--hy-brand-soft);
}

.result-item,
.history-item {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius-lg);
    background: var(--hy-surface);
    transition: border-color .12s, box-shadow .12s;
}
.result-item:hover,
.history-item:hover { border-color: var(--hy-border-strong); box-shadow: var(--hy-shadow-sm); }
.result-item img,
.history-item img,
.history-item video {
    display: block;
    width: 100%;
    border-radius: var(--hy-radius);
    object-fit: cover;
    background: var(--hy-muted-bg);
}
.result-item img {
    height: clamp(300px, 52vh, 620px);
    object-fit: contain;
    cursor: zoom-in;
}
.result-item video {
    display: block;
    width: 100%;
    aspect-ratio: 9 / 16;
    max-height: 420px;
    border-radius: var(--hy-radius);
    background: var(--hy-muted-bg);
}
.video-result-item { max-width: 340px; }
.result-meta,
.history-meta { display: grid; gap: 6px; min-width: 0; margin-top: 8px; font-size: 12.5px; color: var(--hy-text-2); }
.history-meta { margin-top: 0; }
.result-links { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

.link-btn {
    display: inline-flex;
    align-items: center;
    height: 28px;
    padding: 0 10px;
    border: 1px solid var(--hy-border-strong);
    border-radius: var(--hy-radius-sm);
    background: var(--hy-surface);
    color: var(--hy-text-2);
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    box-shadow: var(--hy-shadow-xs);
    transition: background .12s, border-color .12s, color .12s;
}
.link-btn:hover { background: var(--hy-hover); color: var(--hy-text); border-color: #c4c4cc; }
.link-btn.primary { background: var(--hy-brand); border-color: var(--hy-brand-hover); color: #fff; }
.link-btn.primary:hover { background: var(--hy-brand-hover); color: #fff; }

.badge {
    display: inline-flex;
    align-items: center;
    height: 20px;
    padding: 0 7px;
    border: 1px solid var(--hy-border);
    border-radius: 999px;
    background: var(--hy-muted-bg);
    color: var(--hy-text-2);
    font-size: 11.5px;
    font-weight: 500;
}

/* 历史 */
.inline-history-panel {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--hy-border);
}
.history-list { min-height: 420px; display: grid; gap: 8px; align-content: start; }
.history-list.compact { min-height: 120px; max-height: 360px; overflow: auto; }
.history-item { display: grid; grid-template-columns: 88px 1fr; gap: 12px; align-items: start; }
.history-item img,
.history-item video { height: 88px; }
.history-list.compact .history-item { grid-template-columns: 64px 1fr; padding: 8px; }
.history-list.compact .history-item img,
.history-list.compact .history-item video,
.history-thumb-placeholder {
    width: 64px;
    height: 64px;
    border-radius: var(--hy-radius);
    object-fit: cover;
}
.history-thumb-placeholder {
    display: grid;
    place-items: center;
    border: 1px dashed var(--hy-border-strong);
    background: var(--hy-subtle);
    color: var(--hy-faint);
    font-size: 11px;
}
.history-pager {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 12px;
    color: var(--hy-muted);
    font-size: 12.5px;
}
.history-pager.compact { justify-content: space-between; }
.history-pager button:disabled { opacity: .45; cursor: not-allowed; }

/* 主播口播 / 剪辑 */
.host-script-panel {
    grid-column: 1 / -1;
    display: grid;
    gap: 12px;
    padding: 14px;
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius-lg);
    background: var(--hy-subtle);
}
.host-meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; }
.host-meta-grid > div { display: grid; gap: 2px; min-width: 0; }
.host-meta-grid span { color: var(--hy-muted); font-size: 12px; }
.host-meta-grid strong,
.host-background-note { color: var(--hy-text); overflow-wrap: anywhere; }
.host-background-note {
    padding: 10px 12px;
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius);
    background: var(--hy-surface);
}
.host-script-text { max-height: 220px; overflow: auto; }

.clip-draft-panel,
.clip-result-panel,
.clip-editor { display: grid; gap: 12px; }
.clip-draft-panel { gap: 16px; }
.clip-result-videos { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 340px)); gap: 12px; }
.clip-agent-steps { display: flex; flex-wrap: wrap; gap: 6px; }
.clip-agent-steps span {
    padding: 4px 10px;
    border: 1px solid var(--hy-border);
    border-radius: 999px;
    background: var(--hy-surface);
    color: var(--hy-text-2);
    font-size: 12px;
}
.clip-source-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.clip-source-card { display: grid; gap: 8px; }
.clip-source-card video {
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--hy-radius);
    background: var(--hy-muted-bg);
}
.clip-editor-header,
.clip-segment-row {
    padding: 12px;
    border: 1px solid var(--hy-border);
    border-radius: var(--hy-radius-lg);
    background: var(--hy-subtle);
}
.clip-editor-header { display: flex; justify-content: space-between; gap: 12px; color: var(--hy-muted); }
.clip-segment-row {
    display: grid;
    grid-template-columns: 36px 120px 1.4fr 0.7fr 0.7fr 0.8fr;
    gap: 10px;
    align-items: end;
}
.clip-segment-index {
    width: 26px;
    height: 26px;
    display: grid;
    place-items: center;
    border-radius: var(--hy-radius-sm);
    background: var(--hy-text);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
}
.clip-segment-row label { display: grid; gap: 6px; color: var(--hy-muted); font-size: 12px; }
.clip-segment-thumb {
    width: 120px;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--hy-radius);
    background: var(--hy-muted-bg);
}
.clip-segment-note {
    grid-column: 2 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    color: var(--hy-muted);
    font-size: 12px;
}
.clip-segment-note strong { color: var(--hy-brand-ink); }

/* ---------------------------------------------------------------------
   按钮
   --------------------------------------------------------------------- */
.ghost-btn,
.danger-outline,
.danger-btn,
.logout-btn,
.nav-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 32px;
    padding: 0 12px;
    border-radius: var(--hy-radius);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background .12s, border-color .12s, color .12s;
}
.ghost-btn,
.nav-pill {
    border: 1px solid var(--hy-border-strong);
    background: var(--hy-surface);
    color: var(--hy-text-2);
    box-shadow: var(--hy-shadow-xs);
}
.ghost-btn:hover,
.nav-pill:hover { background: var(--hy-hover); color: var(--hy-text); border-color: #c4c4cc; }
.danger-outline {
    border: 1px solid rgba(220, 38, 38, .28);
    background: var(--hy-surface);
    color: var(--hy-danger-ink);
}
.danger-outline:hover { background: var(--hy-danger-soft); }
.danger-btn,
.logout-btn {
    border: 1px solid var(--hy-danger-ink);
    background: var(--hy-danger);
    color: #fff;
}
.danger-btn:hover,
.logout-btn:hover { background: var(--hy-danger-ink); }
.small { height: 28px; padding: 0 10px; font-size: 12px; }

.text-btn {
    height: 26px;
    padding: 0 8px;
    border: 0;
    border-radius: var(--hy-radius-sm);
    background: transparent;
    color: var(--hy-muted);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
}
.text-btn:hover { background: var(--hy-hover); color: var(--hy-text); }
.text-btn.danger:hover { background: var(--hy-danger-soft); color: var(--hy-danger-ink); }

.error-box {
    margin-top: 12px;
    padding: 10px 12px;
    border: 1px solid rgba(220, 38, 38, .2);
    border-radius: var(--hy-radius);
    background: var(--hy-danger-soft);
    color: var(--hy-danger-ink);
    font-size: 13px;
    line-height: 1.6;
}

/* ---------------------------------------------------------------------
   响应式
   --------------------------------------------------------------------- */
@media (max-width: 1280px) {
    .workspace { grid-template-columns: minmax(320px, 360px) minmax(0, 1fr); }
}
@media (max-width: 1080px) {
    .workspace { grid-template-columns: 1fr; }
    .composer { position: static; max-height: none; }
    .composer-foot {
        position: sticky;
        bottom: 0;
        z-index: 20;
        box-shadow: 0 -6px 16px rgba(24, 24, 27, .06);
    }
    .composer { overflow: visible; }
    .stage-head { flex-wrap: wrap; padding-top: 4px; }
    .queue-bar { width: 100%; padding-bottom: 8px; }
}
@media (max-width: 860px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-brand { display: none; }
}
@media (max-width: 720px) {
    .wb { padding: 16px 12px 24px; }
    .wb-head { flex-direction: column; align-items: stretch; }
    .switch-card { grid-template-columns: 1fr 1fr; }
    .param-grid { grid-template-columns: 1fr; }
    .result-grid { grid-template-columns: 1fr; }
    .result-item img { height: min(70vh, 460px); }
    .clip-editor-header,
    .clip-segment-row { grid-template-columns: 1fr; }
    .clip-editor-header { display: grid; }
    .clip-segment-thumb { width: 100%; }
    .clip-segment-note { grid-column: 1; }
}

.history-list.empty-state,
.result-grid.empty-state { display: flex; }
.history-list.compact.empty-state { min-height: 96px; }
@media (max-width: 720px) {
    .wb-kbd-hint { display: none; }
}
