/* ============================================================
   SEEDANCE STUDIO — Themed UI (Light / Dark)
   ============================================================ */

html { overscroll-behavior: none; }

/* === CSS Custom Properties === */

:root {
    /* Backgrounds */
    --bg-page: #f7f7fc;
    --bg-page-gradient: radial-gradient(ellipse at 20% 0%, #ede8ff 0%, #f7f7fc 55%);
    --bg-header: rgba(247, 247, 252, 0.88);
    --bg-form-col: #ffffff;
    --bg-history-col: #f3f3f9;
    --bg-input: #f9f9fd;
    --bg-history-card: #ffffff;
    --bg-drop: #f9f9fd;
    --bg-modal: #ffffff;
    --bg-credit-pack: #f7f7fc;
    --bg-btn-secondary: #ededf5;
    --bg-prev-toggle: #e8e8f2;
    --bg-thumb-input: #f4f4f9;
    --bg-download-btn: #f0f0f8;
    --bg-download-btn-hover: #e6e6f4;
    --bg-slider-track: #e0e0f0;
    --bg-history-h3: #f3f3f9;
    --bg-prev-section: #f0f0f8;

    /* Borders */
    --border-header: rgba(0, 0, 0, 0.07);
    --border-panel: #e2e2ee;
    --border-input: #d4d4e8;
    --border-card: #e2e2ee;
    --border-modal: #e2e2ee;
    --border-drop: rgba(124, 58, 237, 0.3);

    /* Text */
    --text-primary: #111;
    --text-secondary: #555;
    --text-muted: #999;
    --text-label: #555;
    --text-hint: #888;
    --text-credits: #6d28d9;

    /* Accent */
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-subtle: rgba(124, 58, 237, 0.07);
    --accent-border: rgba(124, 58, 237, 0.25);
    --accent-text: #7c3aed;
    --accent-drop-text: #7c3aed;

    /* Status colors */
    --destructive: #dc2626;
    --destructive-subtle: rgba(220, 38, 38, 0.08);
    --destructive-text: #dc2626;
    --success-bg: rgba(22, 163, 74, 0.1);
    --success-text: #15803d;
    --success-border: rgba(22, 163, 74, 0.2);
    --validation-color: #dc2626;

    /* Misc */
    --scrollbar-thumb: #c8c8dc;
    --scrollbar-thumb-hover: #b0b0cc;
    --slider-thumb-border: #f7f7fc;
    --modal-backdrop: rgba(0, 0, 0, 0.35);
    --card-bin-bg: rgba(0, 0, 0, 0.35);
    --card-bin-hover: rgba(220, 38, 38, 0.75);
    --btn-secondary-text: #444;
    --btn-secondary-border: #d4d4e8;
    --btn-secondary-hover-bg: #e0e0ef;
    --prev-toggle-text: #666;
    --thumb-border: #d4d4e8;
    --status-color: #888;
    --download-btn-text: #555;
    --download-btn-border: #d4d4e8;
    --download-btn-hover-text: #111;
    --charcount-color: #999;
    --pack-price-color: #7c3aed;
    --pack-note-color: #999;
    --history-card-border: #e2e2ee;
    --recreate-btn-bg: #e8e8f0;
    --recreate-btn-color: #555;
}

html[data-theme="dark"] {
    /* Backgrounds */
    --bg-page: #0d0d12;
    --bg-page-gradient: radial-gradient(ellipse at 20% 0%, #1a1025 0%, #0d0d12 60%);
    --bg-header: rgba(13, 13, 18, 0.85);
    --bg-form-col: #13131a;
    --bg-history-col: #0f0f15;
    --bg-input: #1c1c26;
    --bg-history-card: #1c1c26;
    --bg-drop: #1c1c26;
    --bg-modal: #1a1a24;
    --bg-credit-pack: #13131a;
    --bg-btn-secondary: #2a2a38;
    --bg-prev-toggle: #2a2a38;
    --bg-thumb-input: #1c1c26;
    --bg-download-btn: #1e1e2e;
    --bg-download-btn-hover: #2a2a3a;
    --bg-slider-track: #2a2a38;
    --bg-history-h3: #0f0f15;
    --bg-prev-section: #0a0a10;

    /* Borders */
    --border-header: rgba(255, 255, 255, 0.07);
    --border-panel: rgba(255, 255, 255, 0.08);
    --border-input: rgba(255, 255, 255, 0.1);
    --border-card: rgba(255, 255, 255, 0.07);
    --border-modal: rgba(255, 255, 255, 0.1);
    --border-drop: rgba(124, 58, 237, 0.4);

    /* Text */
    --text-primary: #f0f0f0;
    --text-secondary: #888;
    --text-muted: #555;
    --text-label: #aaa;
    --text-hint: #666;
    --text-credits: #a78bfa;

    /* Accent */
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-subtle: rgba(124, 58, 237, 0.08);
    --accent-border: rgba(124, 58, 237, 0.3);
    --accent-text: #a78bfa;
    --accent-drop-text: #a78bfa;

    /* Status colors */
    --destructive: #dc2626;
    --destructive-subtle: rgba(220, 38, 38, 0.15);
    --destructive-text: #f87171;
    --success-bg: rgba(22, 163, 74, 0.15);
    --success-text: #4ade80;
    --success-border: rgba(22, 163, 74, 0.2);
    --validation-color: #f87171;

    /* Misc */
    --scrollbar-thumb: #2a2a38;
    --scrollbar-thumb-hover: #3a3a4a;
    --slider-thumb-border: #0d0d12;
    --modal-backdrop: rgba(0, 0, 0, 0.7);
    --card-bin-bg: rgba(0, 0, 0, 0.6);
    --card-bin-hover: rgba(220, 38, 38, 0.8);
    --btn-secondary-text: #888;
    --btn-secondary-border: rgba(255, 255, 255, 0.08);
    --btn-secondary-hover-bg: #333345;
    --prev-toggle-text: #888;
    --thumb-border: rgba(255, 255, 255, 0.1);
    --status-color: #666;
    --download-btn-text: #aaa;
    --download-btn-border: rgba(255, 255, 255, 0.08);
    --download-btn-hover-text: #f0f0f0;
    --charcount-color: #aaa;
    --pack-price-color: #a78bfa;
    --pack-note-color: #555;
    --history-card-border: rgba(255, 255, 255, 0.07);
    --recreate-btn-bg: #2a2a3a;
    --recreate-btn-color: #888;
}

/* === Reset & Base === */

* { box-sizing: border-box; }

body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    padding-top: 56px;
    background: var(--bg-page);
    background-image: var(--bg-page-gradient);
    background-attachment: fixed;
    color: var(--text-primary);
    font-size: 14px;
    min-height: 100vh;
}

/* === Scrollbar === */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar-thumb); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-thumb-hover); }

/* === Global Typography === */

label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    font-size: 13px;
    color: var(--text-label);
    letter-spacing: 0.02em;
}

/* === Global Inputs === */

textarea,
input[type="text"],
input[type="email"] {
    background: var(--bg-input);
    border: 1px solid var(--border-input);
    border-radius: 10px;
    color: var(--text-primary);
    padding: 10px 12px;
    font-family: inherit;
    font-size: 14px;
    line-height: 1.5;
    transition: border-color 0.15s ease;
}

textarea:focus,
input[type="text"]:focus {
    outline: none;
    border-color: var(--accent-border);
}

textarea { width: 100%; resize: vertical; }

input[type="checkbox"] {
    accent-color: var(--accent);
    width: 15px;
    height: 15px;
}

/* === Global Buttons === */

button {
    padding: 9px 18px;
    background: var(--accent);
    color: white;
    border: none;
    cursor: pointer;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    transition: background 0.15s ease, opacity 0.15s ease;
}

button:disabled { background: var(--bg-btn-secondary); color: var(--text-muted); cursor: default; }

/* === Header === */

#app-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 56px;
    background: var(--bg-header);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border-header);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 100;
}

#header-logo {
    color: var(--text-primary);
    font-family: 'DM Serif Display', serif;
    font-size: 20px;
    font-weight: 400;
    letter-spacing: 0;
}

#header-auth {
    display: flex;
    align-items: center;
    gap: 12px;
}

#header-user-email { color: var(--text-hint); font-size: 13px; }
#header-credits { color: var(--text-credits); font-weight: 600; font-size: 13px; }

#header-sign-in-btn {
    background: var(--accent);
    padding: 7px 16px;
    font-size: 13px;
    font-weight: 500;
}
#header-sign-in-btn:hover { background: var(--accent-hover); }

#header-sign-out-btn {
    background: var(--bg-btn-secondary);
    color: var(--text-secondary);
    font-size: 13px;
    padding: 7px 16px;
}

#header-buy-credits-btn {
    background: var(--accent-subtle);
    color: var(--accent-text);
    border: 1px solid var(--accent-border);
    font-size: 13px;
    padding: 7px 14px;
}
#header-buy-credits-btn:hover { background: rgba(124, 58, 237, 0.15); }

/* === Theme Toggle === */

#theme-toggle {
    background: none;
    border: 1px solid var(--border-input);
    color: var(--text-secondary);
    padding: 5px 9px;
    font-size: 14px;
    border-radius: 8px;
    line-height: 1;
}
#theme-toggle:hover {
    background: var(--accent-subtle);
    border-color: var(--accent-border);
}

/* === Payment Banner === */

#payment-banner {
    position: fixed;
    top: 56px;
    left: 0;
    right: 0;
    background: var(--success-bg);
    color: var(--success-text);
    text-align: center;
    padding: 10px;
    font-size: 14px;
    z-index: 99;
    border-bottom: 1px solid var(--success-border);
}

/* === Modals (shared) === */

#auth-modal,
#buy-credits-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

#auth-modal-backdrop,
#buy-credits-backdrop {
    position: absolute;
    inset: 0;
    background: var(--modal-backdrop);
}

/* === Sign-in Modal === */

#auth-modal-dialog {
    position: relative;
    background: var(--bg-modal);
    border: 1px solid var(--border-modal);
    border-radius: 16px;
    padding: 32px 28px 24px;
    width: 360px;
    max-width: calc(100vw - 40px);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
}

#auth-modal-dialog h3 {
    margin: 0 0 10px;
    font-family: 'DM Serif Display', serif;
    font-size: 22px;
    font-weight: 400;
    color: var(--text-primary);
}

#auth-modal-dialog p {
    margin: 0 0 24px;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

#auth-modal-actions {
    display: flex;
    gap: 10px;
}

#auth-modal-actions button {
    flex: 1;
    padding: 10px;
    font-size: 15px;
}

/* === Buy Credits Modal === */

#buy-credits-dialog {
    position: relative;
    background: var(--bg-modal);
    border: 1px solid var(--border-modal);
    border-radius: 16px;
    padding: 28px 24px 20px;
    width: 520px;
    max-width: calc(100vw - 40px);
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5);
    color: var(--text-primary);
}

#buy-credits-dialog h3 {
    margin: 0 0 6px;
    font-family: 'DM Serif Display', serif;
    font-size: 22px;
    font-weight: 400;
    color: var(--text-primary);
}

#buy-credits-dialog > p {
    margin: 0 0 20px;
    font-size: 14px;
    color: var(--text-secondary);
}

#credit-pack-cards {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
}

.credit-pack-card {
    flex: 1;
    background: var(--bg-credit-pack);
    border: 1px solid var(--border-panel);
    border-radius: 12px;
    padding: 16px 12px;
    text-align: center;
}

.pack-label {
    font-size: 13px;
    font-weight: bold;
    color: var(--text-label);
    margin-bottom: 6px;
}

.pack-credits {
    font-size: 15px;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.pack-price {
    font-size: 22px;
    font-weight: bold;
    color: var(--pack-price-color);
    margin-bottom: 12px;
}

.pack-buy-btn { width: 100%; padding: 8px; background: var(--accent); font-size: 14px; }
.pack-buy-btn:hover { background: var(--accent-hover); }

#pack-note {
    font-size: 12px;
    color: var(--pack-note-color);
    margin: 0 0 16px;
}

#buy-credits-cancel-btn { width: 100%; padding: 10px; font-size: 14px; }

/* === Secondary button === */

.btn-secondary {
    background: var(--bg-btn-secondary) !important;
    color: var(--btn-secondary-text) !important;
    border: 1px solid var(--btn-secondary-border) !important;
}
.btn-secondary:hover {
    background: var(--btn-secondary-hover-bg) !important;
    color: var(--text-label) !important;
}

/* === Layout === */

#layout {
    display: grid;
    grid-template-columns: minmax(480px, 1fr) minmax(340px, 1fr);
    gap: 24px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    align-items: start;
}

/* === Form Column === */

#form-col {
    background: var(--bg-form-col);
    border: 1px solid var(--border-panel);
    border-radius: 16px;
    padding: 28px;
}

.form-group { margin-bottom: 28px; }

/* === Generate Button === */

#generateBtn {
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    background: var(--accent);
    border-radius: 8px;
    letter-spacing: 0.01em;
    transition: background 0.15s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
}
#generateBtn:hover:not(:disabled) { background: var(--accent-hover); }
#generateBtn:disabled { background: var(--bg-btn-secondary); color: var(--text-muted); }

#cost-estimate {
    font-size: 13px;
    opacity: 0.75;
    font-weight: 400;
    margin-left: 6px;
}

#validation-msg { color: var(--validation-color); font-size: 13px; margin-top: 8px; }

/* === Duration Slider === */

#duration {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    background: linear-gradient(to right, var(--accent) 0%, var(--accent) var(--val, 70%), var(--bg-slider-track) var(--val, 70%), var(--bg-slider-track) 100%);
    border-radius: 2px;
    outline: none;
    margin: 8px 0;
}
#duration::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--slider-thumb-border);
    box-shadow: 0 0 0 3px var(--accent-border);
}
#duration::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid var(--slider-thumb-border);
}

/* === Drop Zones === */

#ref-images-row,
#ref-videos-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
    margin-bottom: 10px;
}

#dropZone,
#videoDropZone {
    width: 90px;
    height: 90px;
    background: var(--bg-drop);
    border: 2px dashed var(--border-drop);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--drop-text);
    transition: all 0.2s ease;
    flex-shrink: 0;
    gap: 4px;
}

.drop-icon {
    font-size: 18px;
    line-height: 1;
}

.drop-label {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.03em;
}

#dropZone.drag-over,
#videoDropZone.drag-over {
    background: var(--accent-subtle);
    border-color: var(--accent);
    color: var(--accent-drop-text);
}

/* === Image Thumbnails === */

#thumbnails { display: contents; }

.thumb-wrapper { position: relative; width: 90px; }

.thumb-wrapper img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--thumb-border);
}

.thumb-wrapper::before {
    content: 'IMG';
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 1;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 3px;
    letter-spacing: 0.06em;
    pointer-events: none;
}

.thumb-remove {
    position: absolute; top: -6px; right: -6px;
    background: var(--destructive); color: white; border: none; border-radius: 50%;
    width: 20px; height: 20px; font-size: 12px; cursor: pointer;
    padding: 0; line-height: 20px; text-align: center;
}

.thumb-status {
    font-size: 10px; text-align: center; margin-top: 2px; color: var(--status-color);
    width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.thumb-name, .thumb-state {
    width: 90px; font-size: 11px !important; padding: 2px 4px;
    background: var(--bg-thumb-input);
    border: 1px solid var(--border-input);
    color: var(--text-label);
    border-radius: 4px; display: block;
}
.thumb-name { margin-top: 3px; }
.thumb-state { margin-top: 2px; }

#uploadStatus { color: var(--status-color); font-size: 13px; margin-bottom: 6px; }
#imageCount { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
#status { margin-top: 20px; font-weight: bold; color: var(--status-color); }

/* === Previously Used References Panel === */

#prev-images-section,
#prev-videos-section {
    background: var(--bg-prev-section);
    border: 1px solid var(--border-card);
    border-radius: 10px;
    padding: 10px 12px;
    margin-top: 8px;
    margin-bottom: 0;
}

.prev-refs-sub {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#prev-images-header,
#prev-videos-header {
    display: flex;
    align-items: center;
    gap: 8px;
}

#prev-images-toggle,
#prev-videos-toggle {
    background: var(--bg-prev-toggle);
    color: var(--prev-toggle-text);
    border-radius: 6px;
    font-size: 11px;
    padding: 3px 7px;
    line-height: 1;
}

#prev-images-title,
#prev-videos-title {
    font-size: 12px;
    color: var(--text-muted);
    flex: 1;
}

#prev-images-clear,
#prev-videos-clear {
    display: none;
    background: var(--destructive-subtle);
    color: var(--destructive-text);
    border-radius: 6px;
    border: 1px solid transparent;
    font-size: 11px;
    padding: 3px 8px;
}
#prev-images-clear:hover,
#prev-videos-clear:hover {
    background: rgba(220, 38, 38, 0.2);
}

#prev-images-grid,
#prev-videos-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    max-height: 230px;
    overflow-y: auto;
}

.prev-thumb-wrapper {
    position: relative;
    width: 90px;
    cursor: pointer;
}

.prev-thumb-wrapper img {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--thumb-border);
    display: block;
}

.prev-thumb-wrapper img,
.prev-video-thumb-wrapper video {
    transition: border-color 0.15s ease;
}

.prev-thumb-wrapper:hover img,
.prev-video-thumb-wrapper:hover video {
    opacity: 1;
    filter: saturate(1);
    border-color: var(--accent);
}

.prev-thumb-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 90px;
}

.prev-thumb-bin {
    position: absolute;
    top: -6px;
    left: -6px;
    background: var(--destructive);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    line-height: 20px;
    text-align: center;
    display: none;
}
.prev-thumb-wrapper:hover .prev-thumb-bin { display: block; }

/* === Video Thumbnails === */

#videoCount { font-size: 13px; color: var(--text-muted); margin-bottom: 10px; }
#videoUploadStatus { color: var(--status-color); font-size: 13px; margin-bottom: 6px; }

#videoThumbnails { display: contents; }

.video-thumb-wrapper { position: relative; width: 90px; }

.video-thumb-wrapper video {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--thumb-border);
}

.video-thumb-wrapper::before {
    content: 'VID';
    position: absolute;
    top: 4px;
    left: 4px;
    z-index: 1;
    background: rgba(124, 58, 237, 0.75);
    color: #fff;
    font-size: 9px;
    font-weight: 600;
    padding: 2px 5px;
    border-radius: 3px;
    letter-spacing: 0.06em;
    pointer-events: none;
}

.video-thumb-remove {
    position: absolute; top: -6px; right: -6px;
    background: var(--destructive); color: white; border: none; border-radius: 50%;
    width: 20px; height: 20px; font-size: 12px; cursor: pointer;
    padding: 0; line-height: 20px; text-align: center;
}

.video-thumb-status {
    font-size: 10px; text-align: center; margin-top: 2px; color: var(--status-color);
    width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.video-thumb-name, .video-thumb-state {
    width: 90px; font-size: 11px !important; padding: 2px 4px;
    background: var(--bg-thumb-input);
    border: 1px solid var(--border-input);
    color: var(--text-label);
    border-radius: 4px; display: block;
}
.video-thumb-name { margin-top: 3px; }
.video-thumb-state { margin-top: 2px; }


.prev-video-thumb-wrapper {
    position: relative;
    width: 90px;
    cursor: pointer;
}

.prev-video-thumb-wrapper video {
    width: 90px;
    height: 90px;
    object-fit: cover;
    border-radius: 8px;
    border: 1px solid var(--thumb-border);
    display: block;
}


.prev-video-thumb-label {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    width: 90px;
}

.prev-video-thumb-bin {
    position: absolute;
    top: -6px;
    left: -6px;
    background: var(--destructive);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 11px;
    cursor: pointer;
    padding: 0;
    line-height: 20px;
    text-align: center;
    display: none;
}
.prev-video-thumb-wrapper:hover .prev-video-thumb-bin { display: block; }

/* === History Column === */

#history-col {
    background: var(--bg-history-col);
    border: 1px solid var(--border-card);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 80px;
    max-height: calc(100vh - 104px);
}

#history-col h3 {
    font-family: 'DM Serif Display', serif;
    font-size: 20px;
    font-weight: 400;
    color: var(--text-primary);
    margin: 0 0 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border-card);
    position: sticky;
    top: 0;
    background: var(--bg-history-h3);
    z-index: 1;
}

#history-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* === History Card === */

.history-card {
    border: 1px solid var(--history-card-border);
    border-radius: 12px;
    background: var(--bg-history-card);
    position: relative;
    padding: 12px 36px 12px 12px;
}

.history-card video {
    width: 100%;
    border-radius: 8px;
    display: block;
    margin-bottom: 10px;
}

.history-card .card-bin {
    position: absolute;
    top: 10px;
    right: 10px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 4px;
    line-height: 1;
    border-radius: 4px;
}
.history-card .card-bin:hover { color: var(--destructive); background: none; }

.history-card .card-prompt-row {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 6px;
}

.history-card .card-prompt {
    font-size: 12px;
    color: var(--text-secondary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.history-card .card-prompt.expanded {
    white-space: pre-wrap;
    overflow: visible;
    text-overflow: unset;
}

.card-prompt-toggle {
    flex-shrink: 0;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 10px;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}
.card-prompt-toggle:hover { color: var(--text-label); background: none; }

.history-card .card-status {
    font-size: 13px;
    font-weight: bold;
    color: var(--status-color);
    padding: 20px 0;
    text-align: center;
}

.history-card .card-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 8px;
}
.history-card .card-meta span { margin-right: 12px; }

/* === History Card: buttons === */

.creating-recreate-btn {
    width: 100%;
    padding: 7px;
    font-size: 13px;
    background: var(--recreate-btn-bg);
    color: var(--recreate-btn-color);
    border-radius: 6px;
    margin-top: 6px;
}

.history-card a {
    display: block;
    text-decoration: none;
    margin-top: 4px;
}

.history-card a button {
    width: 100%;
    padding: 7px;
    font-size: 13px;
    background: var(--bg-download-btn);
    color: var(--download-btn-text);
    border: 1px solid var(--download-btn-border);
    border-radius: 6px;
}
.history-card a button:hover {
    background: var(--bg-download-btn-hover);
    color: var(--download-btn-hover-text);
}
