:root {
    --ink: #0f172a;
    --muted: #64748b;
    --line: #d9e2ee;
    --panel: #ffffff;
    --page: #eef3f8;
    --blue: #2563eb;
    --blue-dark: #1d4ed8;
}

* { box-sizing: border-box; }
body {
    margin: 0; color: var(--ink); background: var(--page);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

.video-header { background: #111827; border-bottom: 1px solid rgba(255,255,255,.08); }
.video-header-inner {
    min-height: 62px; max-width: 1440px; margin: 0 auto; padding: 0 28px;
    display: flex; align-items: center; gap: 28px;
}
.video-brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.video-brand-mark {
    width: 28px; height: 28px; display: grid; place-items: center; border: 1px solid #475569;
    border-radius: 7px; color: #fff; background: #1e293b; font-size: 11px; font-weight: 800;
}
.video-brand strong, .video-brand small { display: block; }
.video-brand strong { font-size: 14px; }
.video-brand small { margin-top: 2px; color: #94a3b8; font-size: 11px; }
.video-nav { display: flex; align-self: stretch; align-items: center; gap: 6px; }
.video-nav a {
    height: 30px; padding: 0 10px; display: inline-flex; align-items: center; border-radius: 6px;
    color: #94a3b8; font-size: 12px; text-decoration: none;
}
.video-nav a:hover, .video-nav a.active { color: #fff; background: rgba(255,255,255,.1); }
.video-key-control { margin-left: auto; display: flex; align-items: center; gap: 5px; }
.video-key-control input {
    width: 205px; height: 29px; padding: 0 9px; border: 1px solid rgba(148,163,184,.35);
    border-radius: 6px; outline: 0; color: #e2e8f0; background: rgba(255,255,255,.06); font-size: 12px;
}
.video-key-control input::placeholder { color: #94a3b8; }
.video-key-control button, .video-key-control a {
    height: 27px; padding: 0 8px; display: inline-flex; align-items: center; border: 1px solid rgba(148,163,184,.28);
    border-radius: 5px; color: #cbd5e1; background: rgba(15,23,42,.35); font-size: 11px; text-decoration: none; cursor: pointer;
}
.video-key-control span {
    padding: 5px 8px; border: 1px solid rgba(248,113,113,.25); border-radius: 999px;
    color: #fecaca; font-size: 11px; white-space: nowrap;
}
.video-key-control span.ready { border-color: rgba(74,222,128,.3); color: #bbf7d0; background: rgba(22,163,74,.16); }

.video-shell { max-width: 1440px; margin: 0 auto; padding: 30px 28px 48px; }
.video-title-row { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.video-eyebrow { margin: 0 0 8px; color: var(--blue); font-size: 11px; font-weight: 800; letter-spacing: .08em; }
.video-title-row h1 { margin: 0; font-size: 27px; line-height: 1.2; }
.video-title-row p:not(.video-eyebrow) { margin: 9px 0 0; color: var(--muted); font-size: 13px; }
.model-lock {
    min-width: 160px; padding: 10px 14px; display: grid; gap: 2px; border: 1px solid #c7d8ff;
    border-radius: 8px; background: #eaf1ff;
}
.model-lock span { color: #4f6fae; font-size: 10px; font-weight: 700; }
.model-lock strong { color: #1d4ed8; font-size: 13px; }
.model-lock small { color: #4f6fae; font-size: 11px; }

.video-workspace { display: grid; grid-template-columns: 380px minmax(0,1fr); gap: 20px; align-items: start; }
.video-config-panel, .video-preview-panel {
    border: 1px solid var(--line); border-radius: 8px; background: var(--panel); box-shadow: 0 2px 8px rgba(15,23,42,.04);
}
.video-config-panel { padding: 16px; }
.video-panel-section { padding: 18px 0; border-bottom: 1px solid #edf1f6; }
.video-panel-section:first-child { padding-top: 2px; }
.section-heading { display: flex; align-items: center; gap: 9px; margin-bottom: 12px; }
.section-heading.compact { margin-bottom: 10px; }
.section-index {
    width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%;
    color: #1d4ed8; background: #eaf1ff; font-size: 10px; font-weight: 800;
}
.section-heading h2 { margin: 0; font-size: 13px; }
.section-heading p { margin: 2px 0 0; color: var(--muted); font-size: 11px; }
textarea {
    width: 100%; min-height: 114px; padding: 10px; resize: vertical; border: 1px solid #cbd5e1;
    border-radius: 7px; outline: 0; color: var(--ink); font: inherit; font-size: 12px; line-height: 1.55;
}
textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.video-prompt-wrapper { position: relative; }
.video-at-dropdown {
    width: min(100%, 260px); position: absolute; left: 0; top: calc(100% + 6px); z-index: 20;
    padding: 5px; display: grid; gap: 3px; border: 1px solid #cbd5e1; border-radius: 7px;
    background: #fff; box-shadow: 0 10px 24px rgba(15,23,42,.16);
}
.video-at-option {
    width: 100%; min-height: 42px; padding: 5px; display: flex; align-items: center; gap: 8px;
    border: 0; border-radius: 5px; color: #334155; background: transparent; font: inherit; font-size: 11px; text-align: left; cursor: pointer;
}
.video-at-option:hover, .video-at-option.active { background: #eff6ff; color: #1d4ed8; }
.video-at-option img { width: 32px; height: 32px; border-radius: 4px; object-fit: cover; background: #f1f5f9; }
.reference-upload {
    min-height: 100px; padding: 14px; display: grid; place-items: center; gap: 5px; border: 1px dashed #b8c7d9;
    border-radius: 8px; color: #64748b; background: #f8fafc; cursor: pointer; text-align: center;
}
.reference-upload:hover { border-color: var(--blue); background: #f4f8ff; }
.reference-upload input { display: none; }
.reference-upload b {
    width: 27px; height: 27px; display: grid; place-items: center; border-radius: 50%;
    color: #2563eb; background: #dbeafe; font-size: 21px; font-weight: 400;
}
.reference-upload span { color: #334155; font-size: 12px; font-weight: 700; }
.reference-upload small { color: var(--muted); font-size: 10px; }
.reference-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 9px; }
.reference-thumb { position: relative; overflow: hidden; aspect-ratio: 1 / 1; border: 1px solid #dbe3ee; border-radius: 6px; background: #f8fafc; }
.reference-thumb img { width: 100%; height: 100%; display: block; object-fit: cover; }
.reference-thumb button {
    width: 22px; height: 22px; position: absolute; top: 5px; right: 5px; border: 0; border-radius: 50%;
    color: #fff; background: rgba(15,23,42,.75); cursor: pointer;
}
.motion-grid, .ratio-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.motion-grid button, .ratio-grid button {
    min-height: 34px; display: flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid #d7e0eb;
    border-radius: 6px; color: #475569; background: #fff; font-size: 11px; cursor: pointer;
}
.motion-grid button:hover, .ratio-grid button:hover { border-color: #93b4f7; }
.motion-grid button.selected, .ratio-grid button.selected {
    border-color: var(--blue); color: #1d4ed8; background: #f2f7ff; box-shadow: 0 0 0 2px rgba(37,99,235,.1); font-weight: 700;
}
.ratio-grid { grid-template-columns: repeat(3, 1fr); }
.ratio-icon { display: block; border: 1.5px solid currentColor; border-radius: 2px; }
.ratio-vertical { width: 8px; height: 14px; }
.ratio-square { width: 12px; height: 12px; }
.ratio-wide { width: 16px; height: 9px; }
.generate-video-btn {
    width: 100%; height: 44px; margin-top: 16px; display: flex; align-items: center; justify-content: center; gap: 10px;
    border: 0; border-radius: 7px; color: #fff; background: var(--blue); box-shadow: 0 8px 18px rgba(37,99,235,.2); font-weight: 800; cursor: pointer;
}
.generate-video-btn b { font-size: 18px; }
.generate-video-btn:disabled { background: #cbd5e1; box-shadow: none; cursor: not-allowed; }
.history-heading {
    display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px;
}
.history-heading h2 { margin: 0; font-size: 13px; }
.history-heading button {
    height: 24px; padding: 0 8px; border: 1px solid #d7e0eb; border-radius: 5px;
    color: #64748b; background: #fff; font-size: 11px; cursor: pointer;
}
.media-history-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.media-history-empty {
    grid-column: 1 / -1; padding: 10px; border: 1px dashed #d7e0eb; border-radius: 6px;
    color: #64748b; background: #f8fafc; font-size: 11px; line-height: 1.45;
}
.media-history-item {
    min-width: 0; overflow: hidden; border: 1px solid #dbe3ee; border-radius: 6px;
    color: #334155; background: #fff; text-decoration: none;
}
.media-history-item img, .media-history-item video {
    width: 100%; aspect-ratio: 1 / 1; display: block; object-fit: cover; background: #eef2f7;
}
.media-history-item span {
    display: block; padding: 5px 6px; overflow: hidden; color: #64748b;
    font-size: 10px; text-overflow: ellipsis; white-space: nowrap;
}

.video-preview-panel { min-height: 680px; padding: 20px; display: flex; flex-direction: column; }
.preview-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.preview-kicker { color: var(--blue); font-size: 10px; font-weight: 800; letter-spacing: .08em; }
.preview-toolbar h2 { margin: 4px 0 0; font-size: 16px; }
.preview-status { padding: 5px 9px; border-radius: 999px; color: #64748b; background: #eef2f7; font-size: 11px; font-weight: 700; }
.preview-status.ready { color: #0f766e; background: #dff8ef; }
.task-empty {
    min-height: 360px; display: grid; place-content: center; justify-items: center; gap: 8px;
    color: #64748b; text-align: center; border: 1px dashed #b8c7d9; border-radius: 8px; background: #f8fafc;
}
.task-empty strong { color: #334155; font-size: 14px; }
.task-empty small { font-size: 12px; }
.task-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px;
}
.task-card {
    min-width: 0; overflow: hidden; border: 1px solid #dbe3ee; border-radius: 7px; background: #fff;
}
.task-card-main {
    min-height: 150px; position: relative; display: grid; place-items: center; border-bottom: 1px solid #e8eef5; background: #f8fafc;
}
.task-card-main video { width: 100%; height: 180px; display: block; object-fit: cover; background: #0f172a; }
.task-card.is-failed .task-card-main { background: #fff8f7; }
.task-progress { display: grid; justify-items: center; gap: 7px; color: #64748b; text-align: center; }
.task-progress i {
    width: 27px; height: 27px; border: 3px solid #c8d5e7; border-top-color: #2563eb; border-radius: 50%;
    animation: task-spin .9s linear infinite;
}
.task-progress strong { color: #334155; font-size: 12px; }
.task-progress small { max-width: 90%; overflow: hidden; color: #94a3b8; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.task-failure { display: grid; justify-items: center; gap: 7px; padding: 16px; color: #991b1b; text-align: center; }
.task-failure b {
    width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid #fca5a5; border-radius: 50%;
    color: #dc2626; font-size: 15px;
}
.task-failure span { max-width: 100%; overflow: hidden; font-size: 11px; line-height: 1.4; text-overflow: ellipsis; }
.task-download {
    position: absolute; right: 9px; bottom: 9px; min-height: 28px; padding: 0 8px; display: inline-flex; align-items: center;
    border: 1px solid rgba(255,255,255,.3); border-radius: 5px; color: #fff; background: rgba(15,23,42,.78); font-size: 11px; text-decoration: none;
}
.task-download:hover { background: #1d4ed8; }
.task-card-info { padding: 10px 11px 11px; }
.task-card-heading { display: flex; align-items: center; gap: 8px; }
.task-card-heading strong { flex: 1; min-width: 0; overflow: hidden; color: #334155; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.task-card-heading button {
    width: 22px; height: 22px; border: 0; border-radius: 4px; color: #94a3b8; background: transparent; cursor: pointer; font-size: 18px; line-height: 1;
}
.task-card-heading button:hover { color: #dc2626; background: #fef2f2; }
.task-card-info > span, .task-card-info > small { display: block; margin-top: 5px; color: #64748b; font-size: 10px; }
.task-card-info > small { overflow: hidden; color: #94a3b8; text-overflow: ellipsis; white-space: nowrap; }
@keyframes task-spin { to { transform: rotate(360deg); } }
.video-canvas {
    width: min(100%, 790px); margin: auto; display: grid; place-items: center; overflow: hidden;
    aspect-ratio: 16 / 9; border: 1px dashed #b8c7d9; border-radius: 8px; background: #f8fafc;
}
.video-canvas.ratio-9-16 { width: min(100%, 380px); aspect-ratio: 9 / 16; max-height: 490px; }
.video-canvas.ratio-1-1 { width: min(100%, 560px); aspect-ratio: 1 / 1; }
.video-canvas.ratio-16-9 { aspect-ratio: 16 / 9; }
.canvas-empty { display: grid; justify-items: center; gap: 8px; color: #64748b; text-align: center; }
.canvas-empty strong { color: #334155; font-size: 14px; }
.canvas-empty small { font-size: 12px; }
.canvas-play {
    width: 45px; height: 45px; padding-left: 3px; display: grid; place-items: center; border-radius: 50%;
    color: #2563eb; background: #dbeafe; font-size: 18px;
}
.canvas-image-mode { width: 100%; height: 100%; padding: 22px; }
.canvas-image-grid { width: 100%; height: calc(100% - 34px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.canvas-image-grid img { width: 100%; height: 100%; display: block; object-fit: contain; border: 1px solid #dbe3ee; border-radius: 7px; background: #fff; }
.canvas-image-mode p { margin: 10px 0 0; color: #64748b; font-size: 11px; text-align: center; }
.canvas-result { display: none; width: 100%; height: 100%; position: relative; background: #0f172a; }
.video-canvas.has-video .canvas-empty, .video-canvas.has-video .canvas-image-mode { display: none; }
.video-canvas.has-video .canvas-result { display: grid; place-items: center; }
.canvas-result video { width: 100%; height: 100%; object-fit: contain; }
.download-video-link {
    position: absolute; right: 12px; bottom: 12px; min-height: 32px; padding: 0 10px; display: inline-flex; align-items: center;
    border: 1px solid rgba(255,255,255,.25); border-radius: 6px; color: #fff; background: rgba(15,23,42,.82); font-size: 12px; font-weight: 700; text-decoration: none;
}
.download-video-link:hover { background: #1d4ed8; }
.generation-summary {
    width: min(100%, 790px); margin: 18px auto 0; display: grid; grid-template-columns: repeat(3, 1fr);
    border: 1px solid #e2e8f0; border-radius: 7px; overflow: hidden;
}
.generation-summary div { min-height: 55px; padding: 10px 12px; border-right: 1px solid #e2e8f0; }
.generation-summary div:last-child { border-right: 0; }
.generation-summary span, .generation-summary strong { display: block; }
.generation-summary span { color: #64748b; font-size: 10px; }
.generation-summary strong { margin-top: 4px; color: #334155; font-size: 12px; }
.video-guidance {
    width: min(100%, 790px); margin: auto auto 0; padding: 12px; display: flex; gap: 11px;
    border: 1px solid #c7d8ff; border-radius: 7px; background: #f3f7ff;
}
.video-guidance span { color: #1d4ed8; font-size: 11px; font-weight: 800; white-space: nowrap; }
.video-guidance p { margin: 0; color: #4f6385; font-size: 11px; line-height: 1.5; }
.video-toast {
    position: fixed; bottom: 22px; left: 50%; z-index: 10; transform: translate(-50%,20px); padding: 10px 14px;
    opacity: 0; border-radius: 7px; color: #fff; background: #0f172a; font-size: 12px; pointer-events: none; transition: .2s ease;
}
.video-toast.show { opacity: 1; transform: translate(-50%,0); }

@media (max-width: 1000px) {
    .video-header-inner { flex-wrap: wrap; padding: 12px 20px; gap: 12px; }
    .video-key-control { width: 100%; margin-left: 0; }
    .video-key-control input { flex: 1; }
    .video-workspace { grid-template-columns: 1fr; }
    .video-preview-panel { min-height: 560px; }
}
@media (max-width: 640px) {
    .video-shell { padding: 22px 14px 34px; }
    .video-title-row { align-items: start; flex-direction: column; }
    .video-nav { order: 3; width: 100%; }
    .video-header-inner { padding: 11px 14px; }
    .video-key-control span { display: none; }
    .video-canvas.ratio-9-16 { width: min(100%, 300px); }
    .generation-summary div { padding: 9px 7px; }
    .task-grid { grid-template-columns: 1fr; }
}

/* Final three-column video workspace: controls / tasks / key history */
.video-workspace {
    grid-template-columns: 360px minmax(0, 1fr) 260px;
}

.video-history-panel {
    position: sticky;
    top: 18px;
    padding: 16px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: 0 2px 8px rgba(15,23,42,.04);
}

.video-history-panel .history-heading small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.video-history-panel .media-history-grid {
    grid-template-columns: 1fr;
}

@media (max-width: 1240px) {
    .video-workspace {
        grid-template-columns: 360px minmax(0, 1fr);
    }
    .video-history-panel {
        grid-column: 1 / -1;
        position: static;
    }
    .video-history-panel .media-history-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

@media (max-width: 1000px) {
    .video-workspace {
        grid-template-columns: 1fr;
    }
    .video-history-panel .media-history-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .video-history-panel .media-history-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

/* Lotus AI Studio theme */
:root {
    --ink: #111111;
    --muted: #6f6a61;
    --line: #111111;
    --panel: #fffdf8;
    --page: #f5f2ec;
    --blue: #4c6fff;
    --blue-dark: #111111;
    --lime: #d9ff63;
    --coral: #ff6d4d;
}

body {
    color: var(--ink);
    background:
        linear-gradient(90deg, rgba(17,17,17,.04) 1px, transparent 1px),
        linear-gradient(rgba(17,17,17,.035) 1px, transparent 1px),
        var(--page);
    background-size: 42px 42px;
}

.video-header {
    position: sticky;
    top: 0;
    z-index: 50;
    background: #111;
    border-bottom: 1px solid #111;
}

.video-header-inner {
    max-width: 1480px;
}

.video-brand-mark {
    width: 36px;
    height: 36px;
    border: 1px solid #fff;
    border-radius: 8px;
    color: #111;
    background: var(--lime);
    box-shadow: 3px 3px 0 #fff;
    font-weight: 950;
}

.video-brand strong {
    font-size: 15px;
}

.video-brand small {
    color: rgba(255,255,255,.62);
}

.video-nav a,
.video-key-control button,
.video-key-control a {
    border-radius: 999px;
}

.video-nav a {
    border: 1px solid rgba(255,255,255,.18);
    color: rgba(255,255,255,.72);
    font-weight: 800;
}

.video-nav a:hover,
.video-nav a.active {
    color: #111;
    background: #fff;
    border-color: #fff;
}

.video-key-control input {
    height: 34px;
    color: #fff;
    border-radius: 999px;
    border: 1px solid rgba(255,255,255,.22);
    background: rgba(255,255,255,.08);
}

.video-key-control button {
    height: 32px;
    color: #fff;
    background: transparent;
}

.video-key-control a {
    height: 32px;
    color: #111;
    background: var(--lime);
    border-color: var(--lime);
    font-weight: 850;
}

.video-key-control span {
    border-radius: 999px;
    color: #ffd7d0;
    border-color: rgba(255,109,77,.5);
    background: rgba(255,109,77,.12);
}

.video-key-control span.ready {
    color: #111;
    background: var(--lime);
    border-color: var(--lime);
}

.video-shell {
    max-width: 1480px;
}

.video-title-row {
    min-height: 170px;
    align-items: center;
}

.video-eyebrow,
.preview-kicker {
    color: #111;
    letter-spacing: 0;
}

.video-title-row h1 {
    max-width: 780px;
    font-size: clamp(44px, 6vw, 86px);
    line-height: .92;
    letter-spacing: 0;
    font-weight: 950;
}

.video-title-row p:not(.video-eyebrow) {
    max-width: 660px;
    color: var(--muted);
    font-size: 17px;
}

.model-lock,
.video-config-panel,
.video-preview-panel,
.video-history-panel,
.task-card,
.generation-summary,
.video-guidance {
    border: 1px solid #111;
    border-radius: 18px;
    background: var(--panel);
    box-shadow: 5px 5px 0 #111;
}

.model-lock {
    background: var(--lime);
}

.model-lock span,
.model-lock strong,
.model-lock small {
    color: #111;
}

.video-workspace {
    grid-template-columns: 370px minmax(0, 1fr) 270px;
    gap: 18px;
}

.video-config-panel,
.video-history-panel {
    position: sticky;
    top: 88px;
}

.section-index {
    color: #111;
    background: var(--lime);
    border: 1px solid #111;
}

.section-heading h2,
.preview-toolbar h2,
.history-heading h2 {
    color: #111;
    font-weight: 950;
}

textarea,
.reference-upload,
.motion-grid button,
.ratio-grid button,
.task-empty,
.media-history-empty {
    border: 1px solid #111;
    border-radius: 16px;
    background: #fff;
    color: #111;
}

textarea:focus {
    border-color: #111;
    box-shadow: 0 0 0 4px rgba(217,255,99,.65);
}

.reference-upload:hover {
    border-color: #111;
    background: #f4ffd5;
}

.reference-upload b,
.canvas-play {
    color: #111;
    background: var(--lime);
    border: 1px solid #111;
}

.motion-grid button.selected,
.ratio-grid button.selected {
    border-color: #111;
    color: #111;
    background: var(--lime);
    box-shadow: 3px 3px 0 #111;
}

.generate-video-btn {
    height: 48px;
    border: 1px solid #111;
    border-radius: 999px;
    color: #111;
    background: var(--lime);
    box-shadow: 4px 4px 0 #111;
    font-weight: 950;
}

.generate-video-btn:disabled {
    color: #777;
    background: #e5e0d7;
    box-shadow: none;
}

.preview-status {
    color: #111;
    background: var(--lime);
    border: 1px solid #111;
}

.task-empty {
    min-height: 410px;
    background:
        radial-gradient(circle at 50% 38%, rgba(76,111,255,.14), transparent 30%),
        #fff;
}

.task-card {
    box-shadow: 4px 4px 0 #111;
}

.task-card-main {
    border-bottom: 1px solid #111;
    background: #fff;
}

.task-progress i {
    border-color: #d8d1c4;
    border-top-color: #111;
}

.task-download,
.download-video-link {
    border-radius: 999px;
    color: #111;
    background: var(--lime);
    border: 1px solid #111;
    font-weight: 850;
}

.history-heading button {
    border: 1px solid #111;
    border-radius: 999px;
    color: #111;
    background: #fff;
    font-weight: 850;
}

.media-history-item {
    border: 1px solid #111;
    border-radius: 14px;
}

.video-guidance {
    background: #fff7c7;
}

.video-guidance span,
.video-guidance p {
    color: #111;
}

@media (max-width: 1240px) {
    .video-workspace {
        grid-template-columns: 1fr;
    }

    .video-config-panel,
    .video-history-panel {
        position: static;
    }

    .video-history-panel .media-history-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .video-shell {
        padding: 18px 14px 34px;
    }

    .video-header-inner {
        padding: 12px 14px;
    }

    .video-workspace {
        grid-template-columns: minmax(0, 1fr);
    }

    .video-history-panel .media-history-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .video-key-control {
        flex-wrap: wrap;
    }

    .video-key-control input {
        min-width: 0;
    }
}
/* Task-grouped media history kept from the latest functional build */
.video-history-panel .media-history-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.media-history-section-title {
    margin-top: 2px;
    color: var(--muted, #68645d);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.media-history-task {
    overflow: hidden;
    border: 1px solid var(--line, rgba(17, 17, 17, 0.14));
    border-radius: 18px;
    background: #fff;
}

.media-history-task-head {
    padding: 10px 12px 8px;
    border-bottom: 1px solid rgba(17, 17, 17, 0.08);
}

.media-history-task-head strong,
.media-history-task-head span {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.media-history-task-head strong {
    color: var(--ink, #111);
    font-size: 12px;
}

.media-history-task-head span {
    margin-top: 3px;
    color: var(--muted, #68645d);
    font-size: 10px;
}

.media-history-preview-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1px;
    background: rgba(17, 17, 17, 0.1);
}

.media-history-thumb {
    display: grid;
    place-items: center;
    min-width: 0;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    color: #68645d;
    background: #f5f2ec;
    font-size: 10px;
    font-weight: 850;
    text-decoration: none;
}

.media-history-thumb img,
.media-history-thumb video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.media-history-thumb.is-pending {
    background: repeating-linear-gradient(135deg, #fff, #fff 7px, #f5f2ec 7px, #f5f2ec 14px);
}

.media-history-thumb.is-failed {
    color: #b91c1c;
    background: #fff1f1;
}

.media-history-thumb.is-more {
    color: #111;
    background: var(--lime, #d9ff63);
}

.header-language-select {
    height: 38px;
    min-width: 116px;
    padding: 0 12px;
    border: 1px solid #111;
    border-radius: 999px;
    outline: 0;
    color: #111;
    background: #fff;
    font-size: 13px;
    font-weight: 850;
}
