:root {
    --bg: #f4efe7;
    --surface: rgba(255, 252, 247, 0.88);
    --surface-strong: #fff8ee;
    --line: rgba(58, 41, 24, 0.12);
    --text: #1c140d;
    --muted: #6a5847;
    --accent: #d66d2c;
    --accent-2: #ffcb77;
    --teal: #1f6b66;
    --shadow: 0 20px 60px rgba(54, 36, 18, 0.12);
    --danger: #9f3a1f;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Noto Sans SC", sans-serif;
    color: var(--text);
    -webkit-user-select: text;
    user-select: text;
    background:
        radial-gradient(circle at top left, rgba(255, 203, 119, 0.55), transparent 32%),
        radial-gradient(circle at top right, rgba(31, 107, 102, 0.2), transparent 28%),
        linear-gradient(180deg, #fbf7f1 0%, #f0e8de 100%);
    min-height: 100vh;
}

::selection {
    color: var(--text);
    background: rgba(255, 203, 119, 0.72);
}

.auth-screen {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-card {
    width: min(460px, 100%);
    padding: 28px;
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(10px);
    border-radius: 28px;
    box-shadow: var(--shadow);
    display: grid;
    gap: 18px;
}

.auth-form {
    display: grid;
    gap: 14px;
}

.auth-card > .section-caption {
    margin: 0;
}

.auth-card input[readonly] {
    background: rgba(28, 20, 13, 0.04);
    color: var(--muted);
}

.auth-form label {
    display: grid;
    gap: 8px;
}

.auth-form span {
    color: var(--muted);
    font-size: 0.95rem;
}

button,
input,
select,
textarea {
    font: inherit;
}

.page-shell {
    width: min(1220px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 64px;
}

main {
    display: grid;
    gap: 24px;
}

.top-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    position: sticky;
    top: 12px;
    z-index: 10;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 22px;
    background: rgba(255, 248, 238, 0.86);
    backdrop-filter: blur(12px);
    box-shadow: var(--shadow);
}

.top-tab {
    border: 1px solid rgba(58, 41, 24, 0.12);
    border-radius: 999px;
    padding: 11px 18px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--muted);
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
    cursor: pointer;
    transition: transform 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.top-tab:hover {
    transform: translateY(-1px);
}

.top-tab.is-active {
    color: #fff7ef;
    background: linear-gradient(135deg, var(--teal), #2a827b);
    box-shadow: 0 14px 28px rgba(31, 107, 102, 0.22);
    border-color: rgba(31, 107, 102, 0.2);
}

.tab-panel {
    display: grid;
    gap: 24px;
}

.hero {
    display: block;
    margin-bottom: 28px;
}

.public-workspace-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
}

.public-workspace-header .header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 640px) {
    .public-workspace-header {
        align-items: stretch;
        flex-direction: column;
    }

    .public-workspace-header .header-actions {
        justify-content: flex-start;
    }
}

.hero-copy,
.card {
    border: 1px solid var(--line);
    background: var(--surface);
    backdrop-filter: blur(10px);
    border-radius: 28px;
    box-shadow: var(--shadow);
}

.hero-copy {
    padding: 32px;
}

.eyebrow,
.section-kicker,
.module-kicker,
.idea-rank,
.metric-label {
    font-family: "Space Grotesk", sans-serif;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--teal);
    margin: 0 0 12px;
    font-size: 0.85rem;
}

h1,
h2,
h3,
h4,
strong {
    font-family: "Space Grotesk", sans-serif;
}

h1 {
    margin: 0;
    font-size: clamp(2.5rem, 5vw, 4.6rem);
    line-height: 0.98;
}

.hero-text,
.section-caption,
.panel-note,
.video-insight,
.idea-hook,
.idea-grid p,
.status-summary,
.video-meta,
.feedback-banner {
    color: var(--muted);
}

.hero-text {
    font-size: 1.05rem;
    line-height: 1.8;
    max-width: 58ch;
    margin: 18px 0 0;
}

.hero-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 24px;
}

.version-strip {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.hero-pills span,
.count-pill,
.tag-row span,
.video-stats span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.74);
    border: 1px solid rgba(58, 41, 24, 0.08);
}

.control-grid {
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 24px;
    margin-bottom: 28px;
}

.downloads-panel {
    padding: 24px;
    margin-bottom: 24px;
}

.downloads-list {
    display: grid;
    gap: 14px;
}

.download-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
    justify-content: end;
}

.download-create-form {
    padding-block: 18px;
    margin-bottom: 18px;
    border-block: 1px solid var(--line);
}

.download-create-grid {
    display: grid;
    grid-template-columns: minmax(150px, 0.7fr) minmax(260px, 1.3fr) minmax(220px, 1fr);
    gap: 14px;
}

.download-create-grid label,
.download-create-form > label {
    display: grid;
    gap: 8px;
}

.download-create-notes {
    display: grid;
    gap: 4px;
}

.downloads-filter-bar {
    display: grid;
    grid-template-columns: minmax(220px, 1.6fr) repeat(2, minmax(140px, 0.8fr)) auto;
    gap: 14px;
    margin-bottom: 18px;
    align-items: end;
}

.downloads-filter-bar label {
    display: grid;
    gap: 8px;
}

.downloads-filter-bar span {
    font-size: 0.9rem;
    color: var(--muted);
}

.downloads-filter-actions,
.downloads-summary-row,
.downloads-pagination {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    align-items: center;
}

.downloads-filter-actions {
    justify-content: end;
}

.publish-create-form {
    display: grid;
    gap: 14px;
}

.publish-create-form label {
    display: grid;
    gap: 8px;
}

.publish-create-actions {
    justify-content: end;
}

.wechat-menu-stack {
    display: grid;
    gap: 20px;
}

.wechat-menu-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: grid;
    place-items: center;
    padding: 24px;
}

.wechat-menu-modal.hidden {
    display: none;
}

.wechat-menu-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(32, 24, 18, 0.42);
    backdrop-filter: blur(6px);
}

.wechat-menu-dialog {
    position: relative;
    z-index: 1;
    width: min(1360px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow: auto;
    padding: 24px;
    border-radius: 28px;
    box-shadow: 0 24px 72px rgba(32, 24, 18, 0.22);
}

.wechat-menu-modal-head {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
}

.wechat-menu-modal-open {
    overflow: hidden;
}

.wechat-menu-block {
    display: grid;
    gap: 14px;
    padding: 18px;
    border: 1px solid rgba(58, 41, 24, 0.08);
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.52);
}

.wechat-menu-caption {
    max-width: 42rem;
}

.wechat-menu-workspace {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    align-items: start;
}

.wechat-menu-subpanel {
    display: grid;
    gap: 12px;
    min-width: 0;
}

.wechat-menu-builder {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.wechat-menu-builder-single {
    grid-template-columns: 1fr;
}

.wechat-menu-builder-card {
    display: grid;
    gap: 10px;
    padding: 14px;
    border: 1px solid rgba(58, 41, 24, 0.09);
    border-radius: 16px;
    background: rgba(255, 252, 247, 0.88);
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.wechat-menu-builder-card.is-selected {
    border-color: rgba(31, 107, 102, 0.36);
    box-shadow: 0 10px 22px rgba(31, 107, 102, 0.12);
    transform: translateY(-1px);
}

.wechat-menu-builder-card-conditional.is-selected {
    border-color: rgba(179, 92, 11, 0.48);
    box-shadow: 0 0 0 3px rgba(179, 92, 11, 0.12), 0 12px 26px rgba(179, 92, 11, 0.18);
    background: linear-gradient(180deg, rgba(255, 247, 235, 0.98) 0%, rgba(255, 252, 247, 0.94) 100%);
}

.wechat-menu-builder-card-conditional.is-selected strong {
    color: rgba(140, 70, 8, 1);
}

.wechat-menu-builder-card-wide {
    grid-column: 1 / -1;
}

.wechat-menu-column {
    display: grid;
    gap: 14px;
}

.wechat-menu-field {
    display: grid;
    gap: 8px;
}

.wechat-menu-field input,
.wechat-menu-field textarea {
    width: 100%;
}

.wechat-token-row {
    display: grid;
    gap: 12px;
}

.wechat-token-field {
    max-width: 720px;
}

.wechat-token-actions {
    align-items: center;
}

.wechat-menu-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
}

@media (max-width: 1180px) {
    .wechat-menu-workspace {
        grid-template-columns: 1fr;
    }

    .wechat-menu-builder {
        grid-template-columns: 1fr;
    }

    .wechat-menu-modal {
        padding: 12px;
    }

    .wechat-menu-dialog {
        width: min(100vw - 16px, 100%);
        max-height: calc(100vh - 16px);
        padding: 18px;
        border-radius: 22px;
    }

    .wechat-menu-modal-head {
        align-items: stretch;
        flex-direction: column;
    }
}

.novel-agent-shell {
    display: grid;
    grid-template-columns: minmax(280px, 0.42fr) minmax(0, 1fr);
    gap: 24px;
    padding: 24px;
}

.novel-agent-sidebar,
.novel-agent-chat,
.novel-tip-card,
.novel-agent-message {
    border: 1px solid rgba(58, 41, 24, 0.09);
    background: rgba(255, 255, 255, 0.66);
    border-radius: 22px;
}

.novel-agent-sidebar {
    padding: 22px;
    display: grid;
    gap: 18px;
}

.novel-agent-chat {
    padding: 22px;
    display: grid;
    gap: 16px;
}

.novel-agent-tips {
    display: grid;
    gap: 14px;
}

.novel-tip-card {
    padding: 16px;
}

.novel-inline-field {
    display: grid;
    gap: 8px;
    margin-top: 10px;
}

.writing-session-list {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}

.writing-session-card {
    padding: 12px 14px;
    border: 1px solid rgba(58, 41, 24, 0.09);
    border-radius: 16px;
    background: rgba(255, 252, 247, 0.9);
    display: grid;
    gap: 8px;
    cursor: pointer;
}

.writing-session-card.is-active {
    border-color: rgba(31, 107, 102, 0.3);
    box-shadow: 0 8px 20px rgba(31, 107, 102, 0.12);
}

.writing-session-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.writing-session-card-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.writing-session-card-head strong {
    flex: 1;
    min-width: 0;
}

.compact-actions {
    margin-top: 10px;
}

.compact-empty-state {
    padding: 14px;
    border-radius: 16px;
    font-size: 0.92rem;
}

.novel-tip-card strong {
    display: block;
    margin-bottom: 8px;
}

.session-context-menu {
    position: fixed;
    z-index: 1000;
    display: grid;
    gap: 8px;
    min-width: 180px;
    padding: 10px;
    border-radius: 18px;
    border: 1px solid rgba(58, 41, 24, 0.12);
    background: rgba(255, 252, 247, 0.98);
    box-shadow: var(--shadow);
}

.session-context-menu .download-secondary-button {
    width: 100%;
    justify-content: center;
}

.novel-tip-card p {
    margin: 0;
    line-height: 1.7;
    color: var(--muted);
}

.novel-agent-message-list {
    display: grid;
    gap: 14px;
    min-height: 420px;
    max-height: 68vh;
    overflow-y: auto;
    padding-right: 6px;
}

.novel-agent-message {
    padding: 16px 18px;
}

.novel-agent-message.is-user {
    background: rgba(214, 109, 44, 0.1);
    border-color: rgba(214, 109, 44, 0.18);
}

.novel-agent-message.is-assistant {
    background: rgba(31, 107, 102, 0.08);
    border-color: rgba(31, 107, 102, 0.16);
}

.novel-agent-message-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 8px;
}

.novel-agent-message-head strong,
.novel-agent-message-head span {
    font-size: 0.9rem;
}

.novel-agent-message-head span,
.novel-agent-message p {
    color: var(--muted);
}

.novel-agent-message p {
    margin: 0;
    line-height: 1.8;
    white-space: pre-wrap;
}

.novel-agent-form {
    display: grid;
    gap: 12px;
}

.novel-agent-form label {
    display: grid;
    gap: 8px;
}

.novel-agent-actions {
    justify-content: end;
}

.downloads-summary-row {
    justify-content: space-between;
    margin-bottom: 14px;
}

.downloads-summary-row p {
    margin: 0;
}

.downloads-pagination {
    justify-content: end;
    margin-top: 14px;
}

.config-section {
    padding: 24px;
    margin-bottom: 28px;
}

.config-layout {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 24px;
}

.config-layout-single {
    grid-template-columns: 1fr;
}

.config-form,
.provider-status-panel {
    display: grid;
    gap: 16px;
}

.provider-catalog-list,
.config-slot-section,
.config-slot-grid,
.config-slot-status {
    display: grid;
    gap: 12px;
}

.provider-catalog-card {
    padding: 18px;
    border-radius: 20px;
    border: 1px solid rgba(58, 41, 24, 0.09);
    background: linear-gradient(180deg, rgba(255, 252, 247, 0.96), rgba(255, 248, 238, 0.82));
    display: grid;
    gap: 14px;
}

.provider-catalog-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.provider-catalog-toolbar,
.provider-catalog-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.provider-catalog-actions {
    justify-content: flex-end;
}

.provider-catalog-head strong {
    display: block;
    margin-bottom: 6px;
}

.provider-catalog-head p,
.provider-config-grid p,
.provider-model-block strong {
    margin: 0;
}

.provider-catalog-head p,
.provider-config-grid span {
    color: var(--muted);
}

.provider-config-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px 16px;
}

.provider-config-grid label {
    display: grid;
    gap: 6px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.62);
    border: 1px solid rgba(58, 41, 24, 0.06);
}

.provider-config-grid label span,
.provider-model-block label span {
    font-size: 0.88rem;
    color: var(--muted);
}

.provider-catalog-input[readonly] {
    background: rgba(244, 239, 231, 0.8);
    color: var(--muted);
}

.provider-config-wide {
    grid-column: 1 / -1;
}

.provider-model-block {
    display: grid;
    gap: 10px;
}

.provider-model-block label {
    display: grid;
    gap: 8px;
}

.config-slot-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

.config-slot-card {
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(58, 41, 24, 0.09);
    background: rgba(255, 255, 255, 0.72);
    display: grid;
    gap: 14px;
}

.slot-tone-writing {
    border-color: rgba(31, 107, 102, 0.24);
    box-shadow: 0 10px 24px rgba(31, 107, 102, 0.08);
}

.slot-tone-script {
    border-color: rgba(214, 109, 44, 0.24);
    box-shadow: 0 10px 24px rgba(214, 109, 44, 0.08);
}

.slot-tone-scan {
    border-color: rgba(64, 92, 164, 0.24);
    box-shadow: 0 10px 24px rgba(64, 92, 164, 0.08);
}

.slot-order-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    padding: 4px 8px;
    border-radius: 999px;
    margin-bottom: 8px;
    font-size: 0.76rem;
    letter-spacing: 0.04em;
    background: rgba(58, 41, 24, 0.08);
    color: var(--ink);
}

.config-slot-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.config-slot-card-head strong {
    display: block;
    margin-bottom: 6px;
}

.config-slot-card-head p,
.config-slot-status p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.config-slot-status {
    padding-top: 12px;
    border-top: 1px solid rgba(58, 41, 24, 0.08);
}

.compact-grid {
    margin-bottom: 0;
}

.provider-status-list,
.health-status {
    display: grid;
    gap: 12px;
}

.ops-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.trace-section,
.request-trace-list {
    display: grid;
    gap: 12px;
}

.compact-head h3 {
    font-size: 1.2rem;
}

.trace-card {
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(58, 41, 24, 0.09);
    background: rgba(255, 255, 255, 0.66);
}

.trace-card p {
    margin: 0;
    line-height: 1.6;
    color: var(--muted);
}

.trace-card strong {
    display: block;
    margin-bottom: 8px;
}

.provider-card,
.health-card {
    padding: 16px;
    border-radius: 18px;
    border: 1px solid rgba(58, 41, 24, 0.09);
    background: rgba(255, 255, 255, 0.66);
}

.provider-card strong,
.health-card strong {
    display: block;
    margin-bottom: 8px;
}

.provider-card .slot-order-badge {
    margin-bottom: 10px;
}

.provider-card p,
.health-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.status-chip-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.status-chip {
    display: inline-flex;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(31, 107, 102, 0.12);
    color: var(--teal);
    border: 1px solid rgba(31, 107, 102, 0.14);
    font-size: 0.85rem;
}

.status-chip.warning {
    background: rgba(214, 109, 44, 0.14);
    color: var(--accent);
    border-color: rgba(214, 109, 44, 0.18);
}

.toggle-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.toggle-row input {
    width: auto;
}

.config-submit {
    justify-self: start;
    padding: 12px 18px;
}

.control-panel,
.status-panel,
.report-card {
    padding: 24px;
}

.section-head {
    margin-bottom: 18px;
}

.section-head h2,
.module-head h3 {
    margin: 0;
    font-size: 1.8rem;
}

.control-panel label,
.source-switcher {
    display: grid;
    gap: 8px;
    margin-bottom: 18px;
}

.control-panel span,
.source-switcher legend,
.status-rail span,
.idea-grid span {
    font-size: 0.9rem;
    color: var(--muted);
}

.field-hint {
    font-size: 0.82rem;
    line-height: 1.5;
    color: var(--muted);
}

.media-source-field {
    display: grid;
    gap: 10px;
}

.media-source-picker-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px;
}

.media-source-picker-row .section-caption {
    margin: 0;
}

.media-storyboard-editor,
.media-subtitle-editor,
.media-clip-editor {
    display: grid;
    gap: 16px;
}

.media-storyboard-list,
.media-subtitle-list,
.media-clip-list {
    display: grid;
    gap: 14px;
}

.media-storyboard-segment,
.media-subtitle-segment {
    border: 1px solid rgba(58, 41, 24, 0.12);
    background: rgba(255, 255, 255, 0.72);
    border-radius: 20px;
    padding: 16px;
    display: grid;
    gap: 14px;
}

.media-storyboard-segment {
    cursor: grab;
}

.media-storyboard-segment.dragging {
    opacity: 0.55;
    transform: scale(0.985);
}

.media-storyboard-segment.insert-before,
.media-storyboard-segment.insert-after {
    position: relative;
}

.media-storyboard-segment.insert-before::before,
.media-storyboard-segment.insert-after::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    height: 4px;
    border-radius: 999px;
    background: rgba(214, 109, 44, 0.88);
    box-shadow: 0 0 0 4px rgba(214, 109, 44, 0.12);
}

.media-storyboard-segment.insert-before::before {
    top: -8px;
}

.media-storyboard-segment.insert-after::after {
    bottom: -8px;
}

.media-storyboard-headline {
    display: flex;
    align-items: center;
    gap: 10px;
}

.media-storyboard-timebar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px 14px;
    padding: 10px 12px;
    border-radius: 16px;
    background: rgba(255, 248, 235, 0.88);
}

.media-storyboard-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
}

.media-storyboard-summary-card {
    padding: 12px 14px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(255, 241, 219, 0.95), rgba(255, 255, 255, 0.82));
    border: 1px solid rgba(214, 109, 44, 0.16);
    color: var(--ink);
    font-weight: 600;
    display: grid;
    gap: 6px;
}

.media-storyboard-clean-rule {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 248, 235, 0.88);
    border: 1px solid rgba(58, 41, 24, 0.12);
    margin: 0;
}

.media-storyboard-clean-rule input {
    width: auto;
    margin: 0;
}

.media-storyboard-segment-range {
    font-size: 0.96rem;
    color: var(--ink);
}

.media-storyboard-drag-handle {
    border: 1px dashed rgba(58, 41, 24, 0.18);
    background: rgba(255, 248, 235, 0.88);
    color: var(--muted);
    border-radius: 999px;
    padding: 6px 10px;
    font: inherit;
    cursor: grab;
}

.media-storyboard-drag-handle:active {
    cursor: grabbing;
}

.media-storyboard-segment-head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
}

.media-storyboard-segment-file {
    word-break: break-all;
}

.media-clip-timebar {
    align-items: center;
    justify-content: space-between;
}

.media-clip-headline,
.media-clip-metrics {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.media-clip-range {
    color: var(--text);
}

.media-clip-duration {
    font-weight: 600;
}

.media-clip-segment.is-invalid {
    border-color: rgba(159, 58, 31, 0.38);
    background: rgba(255, 241, 238, 0.92);
    box-shadow: 0 0 0 3px rgba(159, 58, 31, 0.08);
}

.media-clip-segment.dragging {
    opacity: 0.55;
    transform: scale(0.985);
}

.media-clip-field-error {
    border-color: rgba(159, 58, 31, 0.64);
    background: rgba(255, 245, 243, 0.98);
    color: var(--danger);
}

.media-clip-field-error:focus {
    border-color: rgba(159, 58, 31, 0.8);
    box-shadow: 0 0 0 4px rgba(159, 58, 31, 0.14);
}

.media-clip-inline-error {
    margin: -4px 0 0;
    color: var(--danger);
    font-size: 0.92rem;
    font-weight: 600;
}

.media-clip-validation-error {
    color: var(--danger);
    font-weight: 700;
}

textarea[readonly],
input[readonly] {
    background: rgba(28, 20, 13, 0.04);
    color: var(--muted);
}

.media-storyboard-thumbnail-wrap {
    width: 100%;
    max-width: 220px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-radius: 18px;
    border: 1px solid rgba(58, 41, 24, 0.1);
    background: linear-gradient(135deg, rgba(255, 241, 219, 0.9), rgba(255, 255, 255, 0.7));
}

.media-storyboard-thumbnail {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-hidden-file-input {
    display: none;
}

    transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

.launch-button {
    width: 100%;
    padding: 16px 22px;
    background: linear-gradient(135deg, var(--accent), #ff934f);
    color: #fffaf3;
    font-weight: 700;
    box-shadow: 0 16px 30px rgba(214, 109, 44, 0.25);
}

.launch-button:hover,
.script-button:hover {
    transform: translateY(-1px);
}

.launch-button:disabled,
.script-button:disabled {
    opacity: 0.65;
    cursor: wait;
}

.status-summary {
    line-height: 1.8;
    min-height: 122px;
}

.feedback-banner {
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 16px;
    background: rgba(255, 203, 119, 0.22);
    border: 1px solid rgba(214, 109, 44, 0.18);
    line-height: 1.6;
}

.feedback-banner.error {
    background: rgba(159, 58, 31, 0.08);
    border-color: rgba(159, 58, 31, 0.2);
    color: var(--danger);
}

[hidden],
.hidden {
    display: none !important;
}

.status-rail {
    display: grid;
    gap: 14px;
}

.status-rail div,
.video-card,
.idea-card,
.script-block {
    border-radius: 20px;
    border: 1px solid rgba(58, 41, 24, 0.09);
    background: rgba(255, 255, 255, 0.66);
}

.status-rail div {
    padding: 16px;
}

.inline-head {
    display: flex;
    justify-content: space-between;
    align-items: end;
    gap: 20px;
}

.report-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
}

.wide-card {
    grid-column: span 2;
}

.module-head,
.video-topline,
.idea-headline {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: start;
}

.video-list,
.idea-list,
.script-panel {
    display: grid;
    gap: 16px;
}

.video-card,
.idea-card,
.script-block {
    padding: 18px;
}

.video-title,
.idea-title {
    margin: 4px 0 6px;
    font-size: 1.15rem;
}

.video-meta,
.idea-hook,
.idea-grid p,
.script-block p,
.script-block li {
    margin: 0;
    line-height: 1.7;
}

.video-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: end;
}

.video-actions {
    display: grid;
    gap: 10px;
    justify-items: end;
}

.download-format-field {
    display: grid;
    gap: 6px;
    justify-items: end;
}

.download-format-field span {
    font-size: 0.8rem;
    color: var(--muted);
}

.download-format-select {
    min-width: 148px;
}

.download-button {
    border: 0;
    border-radius: 999px;
    padding: 10px 16px;
    background: rgba(214, 109, 44, 0.12);
    color: var(--accent);
    font-weight: 700;
    cursor: pointer;
    transition: transform 160ms ease, opacity 160ms ease;
}

.download-secondary-button {
    border: 1px solid rgba(58, 41, 24, 0.12);
    border-radius: 999px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.8);
    color: var(--text);
    font-weight: 700;
    cursor: pointer;
    transition: transform 160ms ease, opacity 160ms ease;
}

.download-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.download-secondary-button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.media-clip-manual-add-button {
    opacity: 0.72;
    border-style: dashed;
}

.media-clip-manual-add-button:hover {
    opacity: 1;
}

.download-task-card {
    padding: 18px;
    border-radius: 20px;
    border: 1px solid rgba(58, 41, 24, 0.09);
    background: rgba(255, 255, 255, 0.66);
}

.download-task-card.is-new-task {
    border-color: rgba(218, 123, 64, 0.78);
    box-shadow: 0 0 0 3px rgba(243, 156, 107, 0.18), 0 14px 30px rgba(218, 123, 64, 0.14);
    animation: download-task-highlight 2.2s ease;
}

@keyframes download-task-highlight {
    0% {
        transform: translateY(-2px);
        box-shadow: 0 0 0 0 rgba(243, 156, 107, 0.32), 0 18px 36px rgba(218, 123, 64, 0.2);
    }
    45% {
        transform: translateY(0);
        box-shadow: 0 0 0 6px rgba(243, 156, 107, 0.16), 0 16px 32px rgba(218, 123, 64, 0.16);
    }
    100% {
        transform: translateY(0);
        box-shadow: 0 0 0 3px rgba(243, 156, 107, 0.18), 0 14px 30px rgba(218, 123, 64, 0.14);
    }
}

.download-task-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: start;
    margin-bottom: 12px;
}

.download-task-title {
    margin: 0 0 6px;
    font-size: 1.05rem;
}

.download-task-meta,
.download-task-progress,
.download-task-path,
.download-task-error,
.publish-task-meta,
.publish-task-progress,
.publish-task-file,
.publish-task-tags,
.publish-task-session,
.publish-task-review,
.publish-task-error {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.download-task-error,
.publish-task-error {
    color: var(--danger);
}

.publish-task-review {
    color: var(--accent);
}

.publish-task-card {
    background: rgba(255, 248, 241, 0.76);
}

.publish-session-card {
    background: rgba(238, 249, 246, 0.8);
}

.publish-session-form input[type="file"] {
    padding: 10px 0;
}

.publish-session-meta,
.publish-session-path,
.publish-session-message {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.publish-session-message {
    color: var(--teal);
}

.video-studio-shell {
    display: grid;
    gap: 20px;
}

.video-studio-head {
    padding: 24px 0 8px;
}

.video-studio-head h2,
.video-studio-view-head h3,
.video-studio-subhead h4 {
    margin: 0;
}

.video-studio-steps {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    border-block: 1px solid var(--line);
    background: rgba(255, 252, 247, 0.58);
}

.video-studio-step {
    min-height: 68px;
    border: 0;
    border-right: 1px solid var(--line);
    color: var(--muted);
    background: transparent;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: 700;
}

.video-studio-step:last-child {
    border-right: 0;
}

.video-studio-step span {
    color: var(--accent);
    font-family: "Space Grotesk", sans-serif;
}

.video-studio-step.is-active {
    color: #fff;
    background: var(--teal);
}

.video-studio-step.is-active span {
    color: var(--accent-2);
}

.video-studio-view {
    display: grid;
    gap: 20px;
    padding: 24px;
    border: 1px solid var(--line);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.video-studio-view-head,
.video-studio-subhead,
.video-shot-card-head,
.video-studio-actions,
.video-generation-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.video-studio-actions,
.video-generation-actions {
    justify-content: flex-end;
    flex-wrap: wrap;
}

.video-studio-split {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 20px;
}

.video-studio-split > section {
    display: grid;
    align-content: start;
    gap: 12px;
    padding: 18px;
    border-left: 3px solid var(--teal);
    background: rgba(238, 249, 246, 0.58);
}

.video-asset-list,
.video-shot-list,
.video-generation-list {
    display: grid;
    gap: 12px;
}

.video-asset-card,
.video-shot-card,
.video-generation-card {
    display: grid;
    gap: 12px;
    padding: 16px;
    border: 1px solid var(--line);
    background: rgba(255, 252, 247, 0.88);
}

.video-asset-card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.video-icon-button {
    width: 34px;
    height: 34px;
    border: 1px solid var(--line);
    color: var(--danger);
    background: transparent;
    cursor: pointer;
    font-size: 1.25rem;
}

.video-shot-index {
    color: var(--teal);
    font-family: "Space Grotesk", sans-serif;
    font-weight: 700;
}

.video-generation-card {
    grid-template-columns: 220px minmax(0, 1fr);
    padding: 0;
    overflow: hidden;
}

.video-generation-card.is-approved {
    border-color: rgba(31, 107, 102, 0.55);
    box-shadow: inset 4px 0 var(--teal);
}

.video-generation-preview {
    min-height: 220px;
    display: grid;
    place-items: center;
    color: var(--muted);
    background:
        linear-gradient(45deg, rgba(31, 107, 102, 0.08) 25%, transparent 25%),
        linear-gradient(-45deg, rgba(31, 107, 102, 0.08) 25%, transparent 25%),
        #edf3ef;
    background-size: 22px 22px;
}

.video-generation-preview img {
    width: 100%;
    height: 100%;
    min-height: 220px;
    object-fit: contain;
    background: #111;
}

.video-generation-body {
    display: grid;
    align-content: center;
    gap: 12px;
    padding: 20px;
}

.video-generation-body p,
.video-empty-copy {
    margin: 0;
    color: var(--muted);
    line-height: 1.6;
}

.video-gate-note {
    padding: 8px 12px;
    color: var(--danger);
    border-left: 3px solid var(--danger);
    background: rgba(159, 58, 31, 0.07);
    font-weight: 700;
}

.video-finish-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.video-finish-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px;
    border-block: 1px solid var(--line);
    color: var(--muted);
}

.video-finish-summary strong {
    color: var(--text);
}

.publish-panel .download-progress-bar {
    background: linear-gradient(135deg, var(--accent), #f39c6b);
}

.download-task-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: end;
    margin-top: 12px;
}

.download-progress-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: rgba(58, 41, 24, 0.08);
    overflow: hidden;
    margin-bottom: 10px;
}

.download-progress-bar {
    height: 100%;
    width: 0%;
    border-radius: inherit;
    background: linear-gradient(135deg, var(--teal), var(--accent));
    transition: width 180ms ease;
}

.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 14px;
}

.idea-headline {
    margin-bottom: 14px;
}

.script-button {
    padding: 10px 16px;
    background: rgba(31, 107, 102, 0.12);
    color: var(--teal);
    font-weight: 700;
}

.idea-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.script-panel {
    min-height: 380px;
}

.script-block h4,
.script-block h5 {
    margin: 0 0 10px;
}

.script-block ul {
    margin: 0;
    padding-left: 18px;
}

.script-block li + li {
    margin-top: 8px;
}

.empty-state {
    padding: 28px;
    border: 1px dashed rgba(58, 41, 24, 0.18);
    border-radius: 24px;
    color: var(--muted);
    line-height: 1.8;
    background: rgba(255, 255, 255, 0.38);
}

@media (max-width: 980px) {
    .hero-copy,
    .wide-card,
    .idea-grid {
        grid-template-columns: 1fr;
    }

    .config-slot-section .config-slot-grid {
        grid-template-columns: 1fr !important;
    }

    .wide-card {
        grid-column: auto;
    }

    .inline-head,
    .module-head,
    .video-topline,
    .idea-headline {
        flex-direction: column;
    }

    .video-stats {
        justify-content: start;
    }

    .video-actions {
        justify-items: start;
    }

    .download-format-field {
        justify-items: start;
    }

    .download-toolbar,
    .download-task-actions,
    .downloads-filter-actions,
    .downloads-pagination {
        justify-content: start;
    }

    .downloads-filter-bar {
        grid-template-columns: 1fr;
    }

    .download-create-grid {
        grid-template-columns: 1fr;
    }

    .wechat-menu-layout {
        grid-template-columns: 1fr;
    }

    .wechat-menu-builder {
        grid-template-columns: 1fr;
    }

    .downloads-summary-row {
        justify-content: start;
    }

    .top-tabs {
        top: 8px;
    }
}

@media (max-width: 640px) {
    .page-shell {
        width: min(100% - 20px, 1220px);
        padding-top: 20px;
    }

    .provider-config-grid {
        grid-template-columns: 1fr;
    }

    .provider-catalog-head {
        grid-template-columns: 1fr;
        display: grid;
    }
    .hero-copy,
    .control-panel,
    .status-panel,
    .report-card {
        padding: 20px;
        border-radius: 24px;
    }

    h1 {
        font-size: 2.3rem;
    }

    .grid-two,
    .idea-grid {
        grid-template-columns: 1fr;
    }

    .video-studio-steps {
        grid-template-columns: 1fr;
    }

    .video-studio-step {
        min-height: 48px;
        justify-content: flex-start;
        padding-inline: 16px;
        border-right: 0;
        border-bottom: 1px solid var(--line);
    }

    .video-studio-step:last-child {
        border-bottom: 0;
    }

    .video-studio-view,
    .video-studio-split > section {
        padding: 16px;
    }

    .video-studio-split,
    .video-finish-grid,
    .video-generation-card {
        grid-template-columns: 1fr;
    }

    .video-generation-preview {
        min-height: 160px;
    }

    .video-studio-view-head,
    .video-finish-summary {
        align-items: flex-start;
        flex-direction: column;
    }

    .media-source-picker-row {
        align-items: start;
        flex-direction: column;
    }

    .media-storyboard-summary {
        grid-template-columns: 1fr;
    }

    .top-tabs {
        gap: 10px;
        padding: 10px;
    }

    .top-tab {
        flex: 1 1 calc(50% - 10px);
        text-align: center;
    }
}

.public-auth-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(28, 20, 13, 0.42);
    backdrop-filter: blur(8px);
}

.public-auth-modal .auth-card {
    border-radius: 8px;
}

.public-auth-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
}

.public-auth-heading h1,
.public-auth-heading p {
    margin-top: 0;
}

.icon-button {
    width: 40px;
    height: 40px;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--surface-strong);
    color: var(--text);
    font-size: 1.6rem;
    line-height: 1;
    cursor: pointer;
}