/* === Editeasy V2 — REVILA Light Theme === */
* { margin: 0; padding: 0; box-sizing: border-box; }
[hidden] { display: none !important; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: #ffffff;
    color: #1a1a1a;
    min-height: 100vh;
}

.container {
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 20px;
}

/* --- Typography (serif titles) --- */
h1, h2, h3 {
    font-family: Georgia, 'Times New Roman', serif;
}

h1 {
    font-size: 2.4rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 4px;
    color: #1a1a1a;
}

h1 .v2 {
    color: #c4a57b;
    font-weight: 400;
    font-size: 1.4rem;
    vertical-align: super;
}

h2 {
    font-size: 1.15rem;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1a1a1a;
}

.subtitle {
    text-align: center;
    color: #666666;
    margin-bottom: 32px;
    font-size: 0.95rem;
}

/* --- Sections & Accordion --- */
section {
    margin-top: 16px;
    background: #f5f3f0;
    border-radius: 12px;
    padding: 24px;
}

/* Summary line (hidden by default, shown when collapsed) */
.section-summary {
    display: none;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 0.9rem;
}

.section-summary:hover .summary-edit {
    text-decoration: underline;
}

.summary-check {
    color: #22c55e;
    font-weight: bold;
    font-size: 1.1rem;
}

.summary-text {
    flex: 1;
    color: #666;
}

.summary-edit {
    color: #c4a57b;
    font-size: 0.85rem;
}

/* Collapsed state */
section.collapsed {
    padding: 16px 24px;
}

section.collapsed .section-summary {
    display: flex;
}

section.collapsed .section-content {
    display: none;
}

/* Reveal animation */
section.revealing {
    animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Section header (title + tooltip) */
.section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}

.section-header h2 {
    margin-bottom: 0;
}

/* Section nav (Suivant buttons) */
.section-nav {
    margin-top: 24px;
    text-align: right;
}

/* --- Dropzone --- */
.dropzone {
    border: 2px dashed #e0dcd7;
    border-radius: 12px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    background: #ffffff;
}

/* #6 : le padding est porté par le <label> interne pour que TOUTE la zone
   (et pas seulement le texte) déclenche l'ouverture du sélecteur via le label. */
.dropzone-content {
    display: block;
    padding: 40px 24px;
    cursor: pointer;
}

.dropzone:hover,
.dropzone.dragover {
    border-color: #c4a57b;
    background: rgba(196, 165, 123, 0.05);
}

.dropzone-content svg {
    color: #c4a57b;
    margin-bottom: 12px;
}

.dropzone-content p {
    margin: 4px 0;
    color: #1a1a1a;
}

.dropzone-content .hint {
    color: #666666;
    font-size: 0.85rem;
}

/* --- File Strip (horizontal scrollable) --- */
.file-strip-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0;
    margin-top: 16px;
}

.strip-scroll-btn {
    flex-shrink: 0;
    width: 36px;
    height: 60px;
    background: rgba(0,0,0,0.04);
    border: 1px solid #e0dcd7;
    border-radius: 8px;
    font-size: 1.5rem;
    color: #999;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.strip-scroll-btn:hover {
    background: rgba(196,165,123,0.12);
    color: #c4a57b;
    border-color: #c4a57b;
}

.strip-scroll-btn.hidden-arrow {
    opacity: 0;
    pointer-events: none;
}

.file-strip-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    flex: 1;
    min-width: 0;
    padding-bottom: 4px;
}

.file-strip-container::-webkit-scrollbar {
    height: 4px;
}

.file-strip-container::-webkit-scrollbar-track {
    background: transparent;
}

.file-strip-container::-webkit-scrollbar-thumb {
    background: #e0dcd7;
    border-radius: 2px;
}

.file-strip {
    display: flex;
    gap: 12px;
    padding: 8px 0;
}

.file-card {
    flex-shrink: 0;
    /* #10 (Henri 15/07) : capsule agrandie (120x100 -> 150x124) pour rendre les
       icônes ciseaux/croix plus faciles à viser au doigt comme à la souris. */
    width: 150px;
    height: 124px;
    position: relative;
    border-radius: 10px;
    overflow: hidden;
    background: #e0dcd7;
    cursor: grab;
    border: 2px solid transparent;
    transition: border-color 0.2s, opacity 0.2s;
}

.file-card:active {
    cursor: grabbing;
}

.file-card.dragging {
    opacity: 0.4;
}

.file-card.drag-over {
    border-color: #c4a57b;
}

.file-card.shift-right {
    transform: translateX(calc(100% + 12px));
    transition: transform 0.25s ease;
}

.file-card.shift-left {
    transform: translateX(calc(-100% - 12px));
    transition: transform 0.25s ease;
}

.file-card.drag-placeholder {
    width: 150px;
    flex-shrink: 0;
    transition: width 0.25s ease;
}

.file-card.swap-left {
    transform: translateX(calc(-100% - 12px));
    transition: transform 0.25s ease;
}

.file-card.swap-right {
    transform: translateX(calc(100% + 12px));
    transition: transform 0.25s ease;
}

.file-card img,
.file-card .video-thumb-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.file-card .video-thumb {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #e0dcd7;
    color: #999;
}

.file-index {
    position: absolute;
    bottom: 4px;
    left: 6px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    z-index: 2;
    pointer-events: none;
}

.file-remove {
    position: absolute;
    top: 5px;
    right: 5px;
    background: rgba(0,0,0,0.6);
    color: #fff;
    border: none;
    border-radius: 50%;
    /* #10 : croix agrandie 22 -> 30 px, cible de clic plus généreuse. */
    width: 30px;
    height: 30px;
    font-size: 20px;
    line-height: 1;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
}

.file-remove:hover {
    background: rgba(231, 76, 60, 0.8);
}

.file-arrows {
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    transform: translateY(-50%);
    display: flex;
    justify-content: space-between;
    padding: 0 2px;
    opacity: 0;
    transition: opacity 0.2s;
    z-index: 2;
    pointer-events: none;
}

.file-card:hover .file-arrows {
    opacity: 1;
    pointer-events: auto;
}

.file-arrows button {
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: none;
    /* #10 : flèches de réordonnancement agrandies 24 -> 30 px. */
    width: 30px;
    height: 30px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
}

.file-arrows button:hover {
    background: rgba(0,0,0,0.7);
}

/* --- File Gallery (grid view when order is off) --- */
.file-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
    gap: 10px;
    margin-top: 16px;
    max-height: 400px;
    overflow-y: auto;
    padding: 4px;
}

.file-gallery .file-card {
    width: auto;
    min-width: 0;
    cursor: default;
}

.file-gallery .file-card .file-arrows {
    display: none;
}

.file-gallery .file-card .file-index {
    display: none;
}

/* --- Buttons --- */
.btn {
    display: inline-block;
    padding: 12px 32px;
    border: none;
    border-radius: 30px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    text-align: center;
    transition: background 0.2s, opacity 0.2s;
    font-family: inherit;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    background: #c4a57b;
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: #b08f65;
}

.btn-secondary {
    background: transparent;
    color: #c4a57b;
    border: 1.5px solid #c4a57b;
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(196, 165, 123, 0.1);
}

.btn-wide {
    width: 100%;
}

.btn-small {
    padding: 8px 20px;
    font-size: 0.9rem;
}

/* --- Toggle Switch (iOS, gold) --- */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 26px;
    flex-shrink: 0;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ccc;
    border-radius: 26px;
    cursor: pointer;
    transition: background 0.3s;
}

.switch-slider::before {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 20px;
    height: 20px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.3s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.switch input:checked + .switch-slider {
    background: #c4a57b;
}

.switch input:checked + .switch-slider::before {
    transform: translateX(22px);
}

/* --- Toggle Row --- */
.toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    font-size: 0.95rem;
    color: #1a1a1a;
}

/* --- Music Options (3 icon cards) --- */
.music-options {
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

.music-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 16px 8px;
    background: #ffffff;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
}

.music-option:hover {
    border-color: #e0dcd7;
}

.music-option.selected {
    border-color: #c4a57b;
    background: rgba(196, 165, 123, 0.08);
}

.music-option svg {
    color: #c4a57b;
}

.music-option span {
    font-size: 0.9rem;
    font-weight: 600;
    color: #1a1a1a;
}

.music-option small {
    font-size: 0.75rem;
    color: #666;
}

/* --- Info Tooltip --- */
.info-tooltip {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: help;
}

.info-tooltip svg {
    color: #999;
}

.info-tooltip::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1a1a1a;
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    white-space: normal;
    width: max-content;
    max-width: 260px;
    line-height: 1.4;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 10;
}

.info-tooltip:hover::after {
    opacity: 1;
}

/* --- Music Track List --- */
.music-track-list {
    margin-top: 12px;
    max-height: 280px;
    overflow-y: auto;
}

.music-loading,
.music-empty {
    color: #666;
    text-align: center;
    padding: 24px;
    font-size: 0.9rem;
}

.music-track {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: #fff;
    border: 2px solid transparent;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.music-track:hover {
    background: #faf8f5;
}

.music-track.selected {
    border-color: #c4a57b;
    background: rgba(196, 165, 123, 0.08);
}

.music-track-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
    flex: 1;
}

.music-track-name {
    font-size: 0.9rem;
    color: #1a1a1a;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.music-track-meta {
    font-size: 0.75rem;
    color: #888;
}

.music-play-btn {
    background: #f5f3f0;
    border: 1px solid #e0dcd7;
    color: #c4a57b;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    margin-right: 8px;
    transition: background 0.2s, border-color 0.2s;
}

.music-play-btn:hover {
    background: #ece9e4;
    border-color: #c4a57b;
}

/* --- Music Waveform --- */
.music-waveform-container {
    flex: 1;
    height: 40px;
    position: relative;
    cursor: pointer;
    margin: 0 12px;
    border-radius: 4px;
    overflow: hidden;
}

.music-waveform-container canvas {
    width: 100%;
    height: 100%;
    display: block;
}

/* --- Custom Music Upload --- */
.music-custom-upload {
    margin-top: 12px;
}

.custom-music-label {
    cursor: pointer;
}

.custom-music-label input[type="file"] {
    display: none;
}

.custom-music-btn {
    display: inline-block;
    padding: 10px 20px;
    background: #fff;
    border: 1.5px dashed #c4a57b;
    border-radius: 8px;
    color: #c4a57b;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 0.2s;
}

.custom-music-btn:hover {
    background: rgba(196, 165, 123, 0.08);
}

.custom-music-name {
    margin-top: 8px;
    font-size: 0.85rem;
    color: #1a1a1a;
    font-weight: 500;
}

.hint {
    color: #666;
    font-size: 0.8rem;
    margin-top: 4px;
}

/* --- Options: Pace --- */
.options-group {
    margin-bottom: 20px;
}

.options-group:last-child {
    margin-bottom: 0;
}

.options-group-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 10px;
    font-family: Georgia, 'Times New Roman', serif;
}

.pace-options {
    display: flex;
    gap: 12px;
}

.pace-option {
    flex: 1;
    padding: 14px 10px;
    background: #fff;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    text-align: center;
}

.pace-option:hover {
    border-color: #e0dcd7;
}

.pace-option.selected {
    border-color: #c4a57b;
    background: rgba(196, 165, 123, 0.08);
}

.pace-option strong {
    display: block;
    font-size: 0.95rem;
    color: #1a1a1a;
    margin-bottom: 2px;
}

.pace-option small {
    font-size: 0.78rem;
    color: #666;
}

/* Zone d'animation en tête de carte (porte les anims Claude Design) */
.pace-anim {
    width: 100%;
    height: 124px;
    border-radius: 10px;
    background: linear-gradient(180deg, #fffdf9, #faf5ec);
    border: 1px solid rgba(26, 26, 26, 0.10);
    overflow: hidden;
    margin: 0 0 10px;
}
@media (max-width: 600px) {
    .pace-anim { height: 150px; }
}

.pace-estimate {
    font-size: 0.82rem;
    color: #999;
    font-weight: 400;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    margin-left: 8px;
}

/* --- Orientation --- */
.orient-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #fff;
    border-radius: 8px;
    font-size: 0.9rem;
    color: #1a1a1a;
}

.orient-info .checkmark {
    color: #22c55e;
    font-size: 1.2rem;
}

.orient-cards {
    display: flex;
    gap: 16px;
    margin-top: 8px;
}

.orient-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding: 16px;
    background: #fff;
    border: 2px solid #e0dcd7;
    border-radius: 12px;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    color: #1a1a1a;
}

.orient-card:hover {
    border-color: #c4a57b;
}

.orient-card.selected {
    border-color: #c4a57b;
    background: rgba(196, 165, 123, 0.08);
}

.orient-card svg {
    color: #999;
}

.orient-card.selected svg {
    color: #c4a57b;
}

.orient-card span {
    font-size: 0.85rem;
    font-weight: 500;
}

.orient-loading {
    text-align: center;
    padding: 20px;
    color: #666;
    font-size: 0.9rem;
}

/* --- Advanced Options --- */
.advanced-options {
    margin-top: 16px;
    border-top: 1px solid #e0dcd7;
    padding-top: 12px;
}

.advanced-options summary {
    font-size: 0.9rem;
    color: #666;
    cursor: pointer;
    padding: 4px 0;
    list-style: none;
    user-select: none;
}

.advanced-options summary::-webkit-details-marker {
    display: none;
}

.advanced-options summary::before {
    content: '\25B6';
    display: inline-block;
    margin-right: 8px;
    transition: transform 0.2s;
    font-size: 0.65rem;
}

.advanced-options[open] summary::before {
    transform: rotate(90deg);
}

.advanced-options .details-content {
    margin-top: 12px;
}

.advanced-options label {
    display: block;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 6px;
}

.style-select {
    width: 100%;
    padding: 10px 14px;
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #e0dcd7;
    border-radius: 8px;
    font-size: 0.9rem;
    font-family: inherit;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%23999' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 10px;
    transition: border-color 0.2s;
}

.style-select:hover,
.style-select:focus {
    border-color: #c4a57b;
    outline: none;
}

/* --- Consent --- */
.consent-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    font-size: 0.85rem;
    color: #666;
    line-height: 1.5;
    margin-bottom: 20px;
}

.consent-label input[type="checkbox"] {
    margin-top: 3px;
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    accent-color: #c4a57b;
}

/* --- Spinner --- */
.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e0dcd7;
    border-top-color: #c4a57b;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Progress Bar --- */
.progress-bar {
    width: 100%;
    height: 8px;
    background: #e0dcd7;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #c4a57b, #d4b88e);
    border-radius: 4px;
    transition: width 0.4s ease;
}

.progress-info {
    display: flex;
    justify-content: space-between;
    font-size: 0.9rem;
    color: #666;
}

/* --- Error --- */
.error-text {
    background: #fef2f2;
    color: #e74c3c;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 0.9rem;
}

/* --- Done Section --- */
#section-done {
    text-align: center;
}

#section-done h2 {
    color: #22c55e;
}

.duration-badge {
    display: inline-block;
    background: #f0fdf4;
    color: #16a34a;
    border: 1px solid #bbf7d0;
    border-radius: 999px;
    padding: 3px 12px;
    font-size: 0.82rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    margin-bottom: 12px;
}

.done-versions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.done-version {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.done-version h3 {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
    font-family: Georgia, 'Times New Roman', serif;
}

.video-preview {
    position: relative;
    display: flex;
    justify-content: center;
    background: #000;
    border-radius: 8px;
    overflow: hidden;
    min-height: 160px;
}

.video-preview video {
    width: 100%;
    max-width: 640px;
    display: block;
}

.ai-loading-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-radius: 8px;
    z-index: 2;
}

.ai-loading-overlay p {
    color: #ccc;
    font-size: 0.85rem;
}

.ai-failed-msg {
    text-align: center;
    padding: 12px;
    color: #666;
    font-size: 0.85rem;
}

#section-done .btn {
    margin-bottom: 12px;
}

/* --- Actions Row --- */
.actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
}

.file-count {
    color: #666;
    font-size: 0.9rem;
}

/* --- Media Info --- */
.media-info {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: #fff;
    border-radius: 8px;
    margin-top: 12px;
    font-size: 0.85rem;
    color: #1a1a1a;
}

.media-info .separator {
    color: #ccc;
}

/* --- Error Section --- */
#section-error {
    text-align: center;
}

/* --- Progress Section with Particles --- */
#section-progress {
    position: relative;
    overflow: hidden;
    min-height: 300px;
}

#particle-canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    cursor: pointer;
}

#game-score {
    position: absolute;
    top: 10px;
    right: 16px;
    z-index: 2;
    font-size: 0.85rem;
    color: rgba(180, 160, 220, 0.7);
    font-weight: 600;
    letter-spacing: 0.5px;
    pointer-events: none;
    user-select: none;
}
#game-score-val {
    color: #a78bfa;
    font-variant-numeric: tabular-nums;
}

.progress-content {
    position: relative;
    z-index: 1;
    pointer-events: none;
}

/* Le popup de notification est interactif : il doit reprendre les clics que
   .progress-content neutralise (pointer-events:none pour son fond animé).
   Sans ça, input email + boutons sont inertes (clics traversent). */
#notification-popup,
#notification-popup * {
    pointer-events: auto;
}

.notif-popup {
    max-width: 380px;
    margin: 20px auto 0;
    padding: 16px;
    background: #fff;
    border: 1px solid #1F1A1420;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(31, 26, 20, 0.12);
}

.notif-popup-buttons {
    display: flex;
    gap: 8px;
    justify-content: center;
}

/* Indication post-génération (où se trouve la vidéo téléchargée / comment
   l'enregistrer en galerie sur mobile). */
.save-hint {
    margin: 12px auto 0;
    max-width: 420px;
    font-size: 13px;
    line-height: 1.5;
    color: #5C544A;
    text-align: center;
}

/* --- Responsive --- */
@media (max-width: 640px) {
    .container {
        padding: 24px 12px;
    }

    h1 {
        font-size: 1.8rem;
    }

    section {
        padding: 20px 16px;
    }

    section.collapsed {
        padding: 14px 16px;
    }

    .music-options {
        flex-direction: column;
    }

    .pace-options {
        flex-direction: column;
    }

    .done-versions {
        grid-template-columns: 1fr;
    }

    /* min-width:0 : sans lui, la vidéo impose sa largeur intrinsèque à toute
       la chaîne grid/flex (min-content) et la colonne déborde du viewport
       même en 1 colonne. max-width:100% : la vidéo ne dépasse jamais sa case. */
    .done-version,
    .video-preview {
        min-width: 0;
    }

    .video-preview video {
        max-width: 100%;
    }

    .file-card {
        /* #10 : capsule mobile agrandie aussi (100x85 -> 124x104). */
        width: 124px;
        height: 104px;
    }

    .file-arrows {
        opacity: 1;
        pointer-events: auto;
    }

    .info-tooltip::after {
        left: auto;
        right: 0;
        transform: none;
    }
}

/* --- Intro Promo (vidéo plein écran 22s) ---
   Vidéo centrée dans un overlay sombre. Sur mobile portrait (ratio plus
   étroit que 16:9 de la vidéo), la vidéo prend max-width 100% et garde
   son ratio natif → bordures noires en haut/bas (letterbox), pas de crop.
   Sur desktop large, max-height la contraint pour garder un peu d'air.
   Le bg #0a0a0a matche le fond interne de l'animation source pour une
   continuité visuelle parfaite (pas de bord visible entre vidéo et page). */
.intro-animation {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #0a0a0a;
    transition: opacity 0.3s ease-out;
}

.intro-video {
    display: block;
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    background: #0a0a0a;
}

.intro-animation.hidden {
    opacity: 0;
    pointer-events: none;
}

.intro-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 32px;
}

.intro-photos {
    position: relative;
    width: 120px;
    height: 100px;
}

.intro-photo {
    position: absolute;
    width: 60px;
    height: 80px;
    border-radius: 8px;
    background: linear-gradient(135deg, #c4a57b 0%, #d4b88e 50%, #b08f65 100%);
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transform-origin: center bottom;
    left: calc(var(--i) * 12px);
    top: calc(var(--i) * 4px);
    z-index: calc(5 - var(--i));
}

/* Static state - photos stacked */
.intro-photo::before {
    content: '';
    position: absolute;
    inset: 6px;
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 4px;
}

.intro-arrow {
    font-size: 2.5rem;
    color: #c4a57b;
    opacity: 0.8;
}

.intro-video-result {
    width: 100px;
    height: 80px;
    background: linear-gradient(135deg, #1a1a1a 0%, #333 100%);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    color: #c4a57b;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.intro-skip-btn {
    position: absolute;
    bottom: 24px;
    right: 24px;
    padding: 10px 24px;
    background: rgba(255,255,255,0.10);
    border: 1px solid rgba(255,255,255,0.25);
    border-radius: 20px;
    cursor: pointer;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.85);
    z-index: 1001;
    font-family: inherit;
    backdrop-filter: blur(6px);
    transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.intro-skip-btn:hover {
    background: rgba(255,255,255,0.18);
    color: #fff;
    border-color: rgba(255,255,255,0.4);
}

.intro-skip-btn:focus {
    outline: 2px solid #c4a57b;
    outline-offset: 2px;
}

/* --- Intro Animation Keyframes (only if motion allowed) --- */
@media (prefers-reduced-motion: no-preference) {
    .intro-photo {
        opacity: 0;
        transform: translateY(30px) rotate(calc((var(--i) - 2) * 5deg));
        animation: photo-stack 0.5s ease-out forwards;
        animation-delay: calc(var(--i) * 0.12s);
    }

    .intro-arrow {
        opacity: 0;
        animation: arrow-pulse 0.6s ease-out 0.8s forwards;
    }

    .intro-video-result {
        opacity: 0;
        transform: scale(0.8);
        animation: video-reveal 0.6s ease-out 1.2s forwards;
    }

    @keyframes photo-stack {
        from {
            opacity: 0;
            transform: translateY(30px) rotate(calc((var(--i) - 2) * 5deg));
        }
        to {
            opacity: 1;
            transform: translateY(0) rotate(calc((var(--i) - 2) * 3deg));
        }
    }

    @keyframes arrow-pulse {
        0% {
            opacity: 0;
            transform: translateX(-10px);
        }
        60% {
            opacity: 1;
            transform: translateX(3px);
        }
        100% {
            opacity: 0.8;
            transform: translateX(0);
        }
    }

    @keyframes video-reveal {
        from {
            opacity: 0;
            transform: scale(0.8);
        }
        to {
            opacity: 1;
            transform: scale(1);
        }
    }
}

/* === Upload Overlay === */
.upload-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.upload-overlay-content {
    text-align: center;
    padding: 48px;
    max-width: 400px;
}

.upload-spinner {
    width: 56px;
    height: 56px;
    border: 3px solid #f0ebe3;
    border-top-color: #c4a57b;
    border-radius: 50%;
    margin: 0 auto 24px;
    animation: upload-spin 1s linear infinite;
}

@keyframes upload-spin {
    to { transform: rotate(360deg); }
}

.upload-overlay-title {
    font-family: Georgia, 'Times New Roman', serif;
    font-size: 1.4rem;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.upload-overlay-subtitle {
    font-size: 1rem;
    color: #666;
    margin-bottom: 24px;
}

.upload-progress-container {
    width: 100%;
    height: 6px;
    background: #f0ebe3;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 16px;
}

.upload-progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #c4a57b, #d4b88a);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.upload-overlay-hint {
    font-size: 0.85rem;
    color: #999;
    font-style: italic;
}

/* === AI Editor Summary === */
.editor-summary {
    background: linear-gradient(135deg, #faf8f5 0%, #f5f0e8 100%);
    border: 1px solid #e8e0d5;
    border-radius: 12px;
    margin-bottom: 24px;
    overflow: hidden;
}

.editor-summary-short {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    cursor: pointer;
    transition: background 0.2s;
}

.editor-summary-short:hover {
    background: rgba(196, 165, 123, 0.1);
}

.editor-avatar {
    font-size: 1.5rem;
    flex-shrink: 0;
}

.editor-summary-short p {
    flex: 1;
    margin: 0;
    font-size: 0.95rem;
    color: #444;
    line-height: 1.5;
}

.editor-expand-icon {
    color: #999;
    font-size: 0.75rem;
    transition: transform 0.3s;
}

.editor-summary.expanded .editor-expand-icon {
    transform: rotate(180deg);
}

.editor-summary-details {
    border-top: 1px solid #e8e0d5;
    padding: 20px;
    background: #fff;
}

.summary-detail-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

.summary-detail-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.detail-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.detail-value {
    font-size: 0.9rem;
    color: #333;
    font-weight: 500;
}

/* ===== Musique "Par style" : cartes catégories ===== */
.music-categories {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 10px;
}
.music-cat-card {
    border: 1px solid #eee2d6;
    border-radius: 12px;
    padding: 10px 12px;
    background: #fff;
}
.music-cat-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
}
.music-cat-label {
    font-weight: 600;
    color: #1a1a1a;
    font-size: 0.95rem;
}
.music-cat-count {
    font-size: 0.72rem;
    color: #b0a48f;
}
.music-cat-more {
    margin-top: 8px;
    background: none;
    border: none;
    color: #c4a57b;
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 0;
}
.music-cat-more:hover {
    text-decoration: underline;
}
.music-cat-expand {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    max-height: 232px;       /* ~3-4 pistes visibles, le reste au scroll */
    overflow-y: auto;
    padding-right: 4px;
}

/* Sélecteur "Par style" : chips toggle + liste unique (UX mobile-friendly) */
.music-style-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 4px 0 12px;
}
.music-chip {
    border: 1px solid #eee2d6;
    background: #fff;
    color: #5a4f43;
    border-radius: 999px;
    padding: 7px 15px;
    font-size: 0.85rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, color .15s, border-color .15s;
}
.music-chip:hover { border-color: #c4a57b; }
.music-chip.selected {
    background: #c4a57b;
    color: #fff;
    border-color: #c4a57b;
}
.music-style-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Stepper durée d'affichage des photos (options avancées) */
.duration-stepper {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 8px;
}
.duration-stepper-btn {
    width: 36px;
    height: 36px;
    border: 1px solid #d0d0d0;
    border-radius: 50%;
    background: #fff;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    color: #333;
    display: flex;
    align-items: center;
    justify-content: center;
}
.duration-stepper-btn:hover { background: #f3f3f3; }
.duration-stepper-btn:active { transform: scale(0.94); }
.duration-stepper-value {
    min-width: 56px;
    text-align: center;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

/* ===== Rognage vidéo (montage phase 1) ===== */
.file-edit {
    position: absolute;
    top: 5px;
    /* #10 : décalé pour laisser la place à la croix (30px) et agrandi 26 -> 32. */
    right: 42px;
    background: var(--rev-seal, #B63A2E);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    cursor: pointer;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.file-edit:hover {
    background: var(--rev-seal-dark, #9E3227);
}

.trim-badge {
    position: absolute;
    bottom: 4px;
    left: 4px;
    right: 4px;
    background: rgba(0, 0, 0, 0.65);
    color: #fff;
    font-size: 10px;
    line-height: 1;
    padding: 3px 4px;
    border-radius: 7px;
    text-align: center;
    z-index: 2;
    pointer-events: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

body:has(#trim-overlay:not([hidden])) {
    overflow: hidden;
}

.trim-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 22, 18, 0.72);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overscroll-behavior: contain;
}

.trim-modal {
    background: var(--rev-cream, #FAF3E7);
    border-radius: 20px;
    max-width: 620px;
    width: 100%;
    max-height: calc(100dvh - 32px);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 22px;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.4);
}

.trim-modal h3 {
    margin: 0 0 4px;
}

.trim-hint {
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--rev-graphite, #6B6156);
}

.trim-video {
    width: 100%;
    max-height: 58vh;
    background: #000;
    border-radius: 12px;
    display: block;
    object-fit: contain;
}

/* Transport : bouton lecture carré collé à la timeline (croquis Henri) */
.trim-transport {
    display: flex;
    align-items: stretch;
    gap: 12px;
    margin: 18px 0 8px;
}

.trim-play-btn {
    flex: 0 0 auto;
    width: 52px;
    border: none;
    border-radius: 12px;
    background: var(--rev-seal, #B63A2E);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.trim-play-btn:hover {
    background: var(--rev-seal-dark, #9E3227);
}

.trim-timeline {
    position: relative;
    flex: 1 1 auto;
    min-width: 0;
    height: 52px;
    margin: 0;
    border-radius: 10px;
    background: var(--rev-kraft, #E8DCC8);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
}

.trim-window {
    position: absolute;
    top: 0;
    bottom: 0;
    background: rgba(182, 58, 46, 0.18);
    border-top: 2px solid var(--rev-seal, #B63A2E);
    border-bottom: 2px solid var(--rev-seal, #B63A2E);
    pointer-events: none;
}

.trim-handle {
    position: absolute;
    top: -6px;
    bottom: -6px;
    width: 28px;
    margin-left: -14px;
    cursor: ew-resize;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: none;
    background: transparent;
}

.trim-handle::before {
    content: '';
    width: 10px;
    height: 100%;
    border-radius: 6px;
    background: var(--rev-seal, #B63A2E);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.trim-playhead {
    position: absolute;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--rev-ink, #2A241D);
    z-index: 2;
    pointer-events: none;
}

.trim-times {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    color: var(--rev-graphite, #6B6156);
    margin-bottom: 16px;
    font-variant-numeric: tabular-nums;
}

/* Liens discrets sous la timeline : ajouter/supprimer un passage reste possible
   (multi-sections) mais ne domine plus le design épuré voulu par Henri. */
.trim-chips-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 14px;
    margin-bottom: 16px;
}

.trim-chips-row .trim-chips {
    margin: 0;
}

.trim-link {
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    font-size: 13px;
    color: var(--rev-seal, #B63A2E);
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.trim-link:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    text-decoration: none;
}

.trim-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

/* Valider en rouge sceau dans ce modal (le btn-primary global est beige) */
.trim-actions .btn-primary {
    background: var(--rev-seal, #B63A2E);
}

.trim-actions .btn-primary:hover:not(:disabled) {
    background: var(--rev-seal-dark, #9E3227);
}

@media (max-width: 560px) {
    .trim-modal {
        padding: 16px;
    }
    .trim-handle {
        width: 34px;
        margin-left: -17px;
    }
    .trim-actions .btn {
        flex: 1 1 40%;
    }
}

/* ===== Rognage phase 2 : multi-sections ===== */
#trim-windows {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

.trim-window--active {
    background: rgba(182, 58, 46, 0.32);
}

.trim-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 2px 0 10px;
}

.trim-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1px solid var(--rev-border, #D9CDB8);
    background: var(--rev-paper, #FFFDF8);
    color: var(--rev-graphite, #6B6156);
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    font-variant-numeric: tabular-nums;
}

.trim-chip--active {
    border-color: var(--rev-seal, #B63A2E);
    color: var(--rev-seal, #B63A2E);
    background: rgba(182, 58, 46, 0.08);
}

.trim-chip-x {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.12);
    font-size: 12px;
    line-height: 1;
}

.trim-chip-x:hover {
    background: var(--rev-seal, #B63A2E);
    color: #fff;
}

#trim-add:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

/* ===== #8 (Henri 15/07) : réorganisation plein écran (timeline + banque) ===== */
.ro-overlay {
    position: fixed;
    inset: 0;
    background: rgba(26, 22, 18, 0.72);
    z-index: 1100;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.ro-overlay[hidden] { display: none; }

.ro-modal {
    background: var(--rev-cream, #FAF3E7);
    border-radius: 20px;
    width: 100%;
    max-width: 560px;
    max-height: 92vh;
    display: flex;
    flex-direction: column;
    padding: 18px 18px 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.ro-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}
.ro-head h3 {
    margin: 0;
    font-family: 'Cormorant Garamond', Georgia, serif;
    font-style: italic;
    font-size: 22px;
    color: #1a1a1a;
}
.ro-close {
    background: none;
    border: none;
    font-size: 30px;
    line-height: 1;
    color: #6B655D;
    cursor: pointer;
    padding: 2px 8px;
}
.ro-hint {
    margin: 6px 0 12px;
    font-size: 13px;
    color: #6B655D;
    line-height: 1.4;
}

/* Timeline horizontale (ordre courant) */
.ro-timeline-wrap {
    background: rgba(26, 22, 18, 0.05);
    border: 1px solid rgba(26, 22, 18, 0.1);
    border-radius: 12px;
    padding: 10px;
}
.ro-timeline {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-behavior: smooth;
    -webkit-overflow-scrolling: touch;
    min-height: 96px;
    align-items: center;
}
.ro-cell {
    position: relative;
    flex: 0 0 auto;
    width: 76px;
}
.ro-num {
    position: absolute;
    top: -6px;
    left: -6px;
    z-index: 3;
    background: var(--rev-seal, #B63A2E);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    min-width: 22px;
    height: 22px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.ro-arrows {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
}
.ro-arrows button {
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 1.15rem;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.ro-arrows button:active { background: rgba(0, 0, 0, 0.75); }

/* Banque de fichiers (grille, en bas) */
.ro-bank-label {
    margin: 14px 0 8px;
    font-size: 11px;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: #6B655D;
}
.ro-bank {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 10px;
    overflow-y: auto;
    padding: 2px;
    flex: 1 1 auto;
    min-height: 88px;
}
.ro-bank-item {
    position: relative;
    padding: 0;
    border: 2px solid transparent;
    border-radius: 10px;
    overflow: hidden;
    background: #e0dcd7;
    cursor: pointer;
    aspect-ratio: 1 / 1;
}
.ro-bank-item:active { border-color: var(--rev-gold, #c4a57b); }
.ro-bank-num {
    position: absolute;
    bottom: 4px;
    right: 4px;
    z-index: 3;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    padding: 0 5px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Vignette commune (timeline + banque) */
.ro-thumb {
    width: 100%;
    height: 76px;
    border-radius: 8px;
    overflow: hidden;
    background: #e0dcd7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #999;
}
.ro-bank-item .ro-thumb {
    height: 100%;
    border-radius: 0;
}
.ro-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.ro-actions {
    display: flex;
    gap: 10px;
    margin-top: 14px;
}
.ro-actions .btn { flex: 1; }

/* Plein écran sur mobile */
@media (max-width: 640px) {
    .ro-overlay { padding: 0; }
    .ro-modal {
        max-width: none;
        max-height: none;
        height: 100%;
        border-radius: 0;
        padding: 16px 14px calc(14px + env(safe-area-inset-bottom));
    }
}
