body.atelier-active:not(.atelier-result) .feature-hero.tool-hero {
    --bg: var(--night);            --bg-main: var(--night);      --bg-primary: var(--night);
    --bg-secondary: var(--night-2); --bg-card: var(--night-2);   --surface-2: var(--night-2);
    --bg-input: var(--night-3);
    --text: #E8EDF7;              --text-primary: #E8EDF7;      --text-main: #E8EDF7;
    --text-muted: var(--muted-d);  --text-3: var(--muted-d);     --text-muted-strong: #C0CADB;
    --border: var(--line-d);       --border-strong: rgba(77,130,243,.28);
    --primary-ink: #8AB4F8;        --accent-ink: #C4B5FD;
    --warning-ink: #FBBF24;        --error-ink: #FCA5A5;
    --primary-hover: var(--beam-bright);
}
body.atelier-result .feature-hero.tool-hero {
    --bg: var(--night);            --bg-main: var(--night);      --bg-primary: var(--night);
    --bg-secondary: var(--night-2); --bg-card: var(--night-2);   --surface-2: var(--night-2);
    --bg-input: var(--night-3);
    --text: #E8EDF7;              --text-primary: #E8EDF7;      --text-main: #E8EDF7;
    --text-muted: var(--muted-d);  --text-3: var(--muted-d);     --text-muted-strong: #C0CADB;
    --border: var(--line-d);       --border-strong: rgba(77,130,243,.28);
    --primary-ink: #8AB4F8;        --accent-ink: #C4B5FD;
    --warning-ink: #FBBF24;        --error-ink: #FCA5A5;
    --primary-hover: var(--beam-bright);
}
body.atelier-result { --bg: var(--night); }
.klat-shell[x-cloak] { display: none; }
.klat-bar {
    position: sticky;
    top: 66px;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 56px;
    padding: 8px 16px;
    margin: 0 0 12px;
    background: rgba(7, 11, 20, .97);
    border: 1px solid var(--line-d, rgba(77, 130, 243, .14));
    border-radius: var(--radius);
    box-shadow: none;
}
.klat-bar-meta { flex: 1; min-width: 0; }
.klat-bar-tool {
    margin: 0;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--mono, ui-monospace, "SF Mono", Menlo, monospace);
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--kick-d, #8FB0F9);
    line-height: 1.15;
}
.klat-bar-file {
    margin: 2px 0 0;
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
body.atelier-active main > *:not(.tool-hero) { display: none; }
body.atelier-on [x-data*="klHeader"],
body.atelier-on .klx-header { display: none; }
body.atelier-on .klat-bar { top: 0; }
body.atelier-active .feature-hero.tool-hero { padding-top: 16px; }
body.atelier-active .feature-hero.tool-hero .feature-hero-title,
body.atelier-active .feature-hero.tool-hero .feature-hero-subtitle,
body.atelier-active .feature-hero.tool-hero .tool-compat-notice,
body.atelier-active .feature-hero.tool-hero .tho-title,
body.atelier-active .feature-hero.tool-hero .tho-subtitle,
body.atelier-active .feature-hero.tool-hero .tho-warn,
body.atelier-active .feature-hero.tool-hero .tho-visual { display: none; }
@media (max-width: 640px) {
    .klat-bar { top: 0; }
    .klat-shell { max-width: 100%; }
}
@media (min-width: 900px) {
    body.atelier-active .feature-hero.tool-hero .container {
        max-width: 1500px;
        align-items: stretch;
    }
    body.atelier-active .rf-grid { grid-template-columns: minmax(0, 1fr) 380px; }
    body.atelier-active .rf-player { max-width: 100%; }
    body.atelier-active .rf-formats-col { position: sticky; top: 134px; align-self: start; }
    body.atelier-active .rfr-grid { grid-template-columns: minmax(0, 360px) 1fr; }
    body.atelier-active .klsa-card,
    body.atelier-active .klsa-card.klsa-wide { max-width: none; }
    body.atelier-active .klsa-tools { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    body.atelier-active .tool-options-panel.atelier-split {
        max-width: 100%;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 380px;
        column-gap: 32px;
        align-items: start;
        padding: 20px 32px 28px;
    }
    body.atelier-active .tool-options-panel.atelier-split > .tool-preview {
        grid-column: 1; grid-row: 2 / span 50;
        align-self: start; position: sticky; top: 134px; margin: 0;
    }
    body.atelier-active .tool-options-panel.atelier-split > .options-section-title,
    body.atelier-active .tool-options-panel.atelier-split > .options-section-sub,
    body.atelier-active .tool-options-panel.atelier-split > .options-choices,
    body.atelier-active .tool-options-panel.atelier-split > .options-start-btn,
    body.atelier-active .tool-options-panel.atelier-split > .options-hint { grid-column: 2; }
    body.atelier-active .tool-options-panel.atelier-split > .options-choices { padding-left: 0; padding-right: 0; }
    body.atelier-active .feature-hero.tool-hero[data-tool-type="rotate"] .tool-options-panel { max-width: 100%; }
    body.atelier-active .feature-hero.tool-hero[data-tool-type="rotate"] .options-choices {
        display: grid; grid-template-columns: minmax(0, 1fr) 380px;
        column-gap: 32px; align-items: start; text-align: left;
    }
    body.atelier-active .feature-hero.tool-hero[data-tool-type="rotate"] .options-choices > .options-hint { grid-column: 1 / -1; }
    body.atelier-active .feature-hero.tool-hero[data-tool-type="rotate"] .options-choices > .wysiwyg-stage {
        grid-column: 1; grid-row: 2 / span 20; align-self: start; position: sticky; top: 134px; margin: 0;
    }
    body.atelier-active .feature-hero.tool-hero[data-tool-type="rotate"] .options-choices > .rotate-dirs,
    body.atelier-active .feature-hero.tool-hero[data-tool-type="rotate"] .options-choices > .rotate-result { grid-column: 2; margin: 0; }
    body.atelier-active .feature-hero.tool-hero[data-tool-type="add_watermark"] .tool-options-panel,
    body.atelier-active .feature-hero.tool-hero[data-tool-type="logo_overlay"] .tool-options-panel { max-width: 100%; }
}
body.atelier-fit {
    height: 100dvh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
body.atelier-fit > main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.atelier-fit { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
body.atelier-fit .feature-hero.tool-hero {
    flex: 1;
    min-height: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
body.atelier-fit .feature-hero.tool-hero > .container {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    padding-top: 8px;
    padding-bottom: calc(6px + env(safe-area-inset-bottom, 0px));
}
body.atelier-fit .klat-shell { flex: 0 0 auto; margin-bottom: 8px; }
body.atelier-fit .tool-options-panel,
body.atelier-fit .rf-block { flex: 1; min-height: 0; display: flex; flex-direction: column; }
body.atelier-fit .options-section-title,
body.atelier-fit .options-section-sub { display: none; }
body.atelier-fit .rf-grid { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
body.atelier-fit .rf-preview-col {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
}
body.atelier-fit .rf-preview-col { container-type: size; width: 100%; }
body.atelier-fit .rf-player {
    flex: 0 0 auto;
    margin: 0 auto;
    --rf-cap: calc(100cqh * var(--rf-ar, 1));
}
body.atelier-fit .rf-noblack { display: none; }
body.atelier-fit .rf-formats-col {
    flex: 0 0 auto;
    max-height: 46dvh;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
}
body.atelier-fit .options-start-btn { display: none; }
.klat-go {
    position: relative;
    flex: 0 0 auto;
    min-height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: 12px;
    background: var(--beam, #2563EB);
    box-shadow: var(--lisere), var(--lift-primary-strong);
    color: #fff;
    font-family: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
    max-width: 46vw;
    overflow: hidden;
    text-overflow: ellipsis;
}
.klat-go:hover { background: #1D4ED8; }
.klat-go-fill {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 100%;
    background: #1D4ED8;
    transform-origin: left center;
    transform: scaleX(0);
    transition: transform .24s ease;
    pointer-events: none;
}
.klat-go-in {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.klat-go.is-done {
    background: transparent;
    box-shadow: inset 0 0 0 1.5px var(--beam-bright, #4D82F3);
    color: var(--beam-bright, #4D82F3);
}
.klat-go.is-done .klat-go-fill { background: none; }
@media (min-width: 900px) {
    body.atelier-fit .rf-grid {
        flex-direction: row;
        display: grid;
        grid-template-columns: minmax(0, 1fr) 380px;
        gap: 20px;
    }
    body.atelier-fit .rf-formats-col { max-height: 100%; align-self: stretch; position: static; }
    .klat-go { max-width: none; min-height: 44px; font-size: 14px; }
}
@media (max-width: 899px) and (max-height: 520px) {
    body.atelier-fit .rf-grid {
        flex-direction: row;
        display: grid;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
        gap: 8px;
    }
    body.atelier-fit .rf-formats-col { max-height: 100%; }
}
@media (max-width: 899px) {
    body.atelier-fit .rf-formats-label { font-size: 12px; margin: 0 0 6px; }
    body.atelier-fit .rf-cards {
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 6px;
    }
    body.atelier-fit .rf-card { width: auto; min-width: 0; }
    body.atelier-fit .rz-sub { margin-top: 8px; }
    body.atelier-fit .rz-modes { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 0; }
    body.atelier-fit .cvf-mode-opt { padding: 8px 6px; text-align: center; min-height: 46px; }
    body.atelier-fit .cvf-mode-note { display: none; }
    body.atelier-fit .cvf-mode-top { display: flex; flex-direction: column; align-items: center; gap: 2px; }
    body.atelier-fit .cvf-mode-top b { font-size: 12px; line-height: 1.15; }
    body.atelier-fit .cvf-mode-badge { font-size: 10px; padding: 1px 4px; }
    body.atelier-fit .rz-mode-outcome { margin-top: 8px; font-size: 12px; }
}
body.atelier-fit .klat-bar {
    position: static;
    min-height: 0;
    padding: 6px 12px;
    margin: 0;
    gap: 8px;
    box-shadow: none;
}
body.atelier-fit .klat-bar-tool { display: none; }
body.atelier-fit .rf-help { margin: 0; padding: 4px 0 0; font-size: 12px; }
body.atelier-fit .rf-help svg { width: 15px; height: 15px; }
body.atelier-fit .rf-warn { margin: 4px 0 0; padding: 5px 8px; font-size: 12px; }
@media (max-width: 899px) {
    body.atelier-fit .klx-header { display: none; }
}
@media (min-width: 900px) { .klat-back, .klat-dock { display: none; } }
html.kl-feuille .klat-dock { display: none; }
.klat-back {
    width: 36px; height: 36px; flex: 0 0 auto;
    border: 1px solid var(--line-d, rgba(77, 130, 243, .14));
    border-radius: 8px;
    background: var(--night-2, #0C1322);
    color: var(--muted-d, #94A3BE);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.klat-back svg { width: 17px; height: 17px; }
.klat-back:hover { background: rgba(77, 130, 243, .1); color: #fff; }
body.atelier-fit .rf-help {
    background: none;
    border: 0;
    margin: 0;
    padding: 3px 0 0;
    font-size: 12px;
    line-height: 1.3;
    gap: 6px;
}
body.atelier-fit .rf-help p { margin: 0; }
body.atelier-fit .rf-warn { display: none; }
body.atelier-fit .rz-mode-outcome {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
@media (max-width: 899px) {
    body.atelier-fit .rf-cards { --rf-shape-side: 26px; }
    body.atelier-fit .rf-card { padding: 6px 2px; gap: 4px; min-height: 0; }
    body.atelier-fit .rf-shape-box { margin: 0; padding: 0; min-height: 0; }
    body.atelier-fit .rf-card-lab { gap: 0; }
    body.atelier-fit .rf-card-lab b { font-size: 12px; line-height: 1.15; }
    body.atelier-fit .rf-card-lab span { display: none; }
    body.atelier-fit .rz-current { font-size: 10px; padding: 1px 3px; }
    body.atelier-fit .rf-formats-label { font-size: 12px; margin: 0 0 5px; }
}
body.atelier-fit .rf-formats-col .rz-mode-outcome {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    padding: 7px 8px;
}
body.atelier-fit { height: auto; overflow: visible; display: block; padding-bottom: 0; }
body.atelier-fit > main { display: block; }
body.atelier-fit .feature-hero.tool-hero { flex: none; min-height: 0; display: block; overflow: visible; }
body.atelier-fit .feature-hero.tool-hero > .container {
    display: block;
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
}
body.atelier-fit .tool-options-panel,
body.atelier-fit .rf-block,
body.atelier-fit .rf-grid { display: block; flex: none; min-height: 0; }
body.atelier-fit .rf-preview-col { display: block; container-type: normal; }
body.atelier-fit .rf-formats-col { max-height: none; overflow: visible; }
body.atelier-fit .rf-player { --rf-cap: 58dvh; }
@media (max-width: 899px) {
    body.atelier-fit .rf-cards { --rf-shape-side: 30px; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
    body.atelier-fit .rf-card-lab span { display: block; font-size: 10px; line-height: 1.3; }
    body.atelier-fit .rf-card { padding: 8px 4px; gap: 6px; }
}
body.atelier-fit .rf-formats-col .rz-mode-outcome {
    display: block;
    -webkit-line-clamp: none;
    overflow: visible;
}
body.atelier-fit .rf-help { background: none; border: 0; }
.klat-dock {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 45;
    padding: 8px 12px;
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--bar-paper, #ffffff);
    border-top: 1px solid var(--bar-line, #e1e4e9);
    box-shadow: 0 -4px 20px rgba(17, 20, 23, .05);
}
.klat-dock .klat-go {
    display: flex;
    width: 100%;
    max-width: 520px;
    margin: 0 auto;
    min-height: 50px;
    align-items: center;
    justify-content: center;
    font-size: 16px;
}
@media (min-width: 900px) {
    .klat-dock { padding: 12px 24px; }
    body.atelier-fit .feature-hero.tool-hero > .container { padding-bottom: 96px; }
}
body.atelier-fit .rf-preview-col {
    --rf-h: 46dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--rf-h);
    margin-bottom: 8px;
}
body.atelier-fit .rf-player {
    --rf-cap: calc(var(--rf-h, 46dvh) * var(--rf-ar, 1));
    margin: 0 auto;
    flex: 0 0 auto;
}
@media (min-width: 900px) {
    body.atelier-fit .rf-preview-col { --rf-h: 58dvh; }
}
body.atelier-fit .rf-player {
    margin: 0 auto;
    --rf-cap: calc((var(--rf-h, 46dvh) - 4px) * var(--rf-ar, 1));
    transition: max-width .24s ease, aspect-ratio .24s ease;
}
@media (prefers-reduced-motion: reduce) {
    body.atelier-fit .rf-player { transition: none; }
}
@media (max-width: 899px) {
    body.atelier-fit .rf-cards { --rf-shape-side: 46px; }
    body.atelier-fit .rf-card { padding: 12px 6px; gap: 8px; }
}
@media (min-width: 900px) {
    body.atelier-fit .rf-cards { --rf-shape-side: 58px; }
}
body.atelier-fit .rf-player { --rf-mb: 0px; }
body.atelier-fit .rf-cards { --rf-shape-side: 75px; }
body.atelier-fit .rf-player {
    --rf-cap: initial;
    flex: 0 0 auto;
    transition: aspect-ratio .24s ease, width .24s ease, height .24s ease;
}
@media (prefers-reduced-motion: reduce) { body.atelier-fit .rf-player { transition: none; } }
body.atelier-fit {
    overscroll-behavior: none;
}
body.atelier-fit > main {
    height: auto;
    overflow: visible;
}
body.atelier-fit > main {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
body.atelier-fit .feature-hero.tool-hero { overflow: visible; }
body.atelier-fit .rf-preview-col { --rf-h: 44dvh; }
body.atelier-fit .rf-preview-col { container-type: size; }
body.atelier-fit .rf-player {
    width: 100%;
    height: auto;
    margin: 0 auto;
    max-width: min(100%, calc(100cqh * var(--rf-ar, 0.5)));
    transition: max-width .24s ease, aspect-ratio .24s ease;
}
body.atelier-fit .rf-help {
    margin: 0 0 16px;
    font-size: 12px;
    color: var(--muted-d, #94A3BE);
    align-items: flex-start;
}
body.atelier-fit .rf-help svg { width: 15px; height: 15px; flex-shrink: 0; margin-top: 1px; }
body.atelier-fit .rf-formats-label {
    margin: 0 0 8px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--c-ink);
}
body.atelier-fit .rf-player { max-width: none; height: auto; }
@media (max-width: 899px) {
    body.atelier-fit .rf-help { display: none; }
}
body.rf-full { overflow: hidden; }
body.rf-full::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: 99999;
    background: #000;
}
body.atelier-fit { --klat-dock-h: 74px; }
body.atelier-fit > main {
    padding-bottom: calc(var(--klat-dock-h) + env(safe-area-inset-bottom, 0px) + 16px);
    box-sizing: border-box;
}
body.atelier-fit .feature-hero.tool-hero > .container { padding-bottom: 8px; }
@media (min-width: 900px) { body.atelier-fit { --klat-dock-h: 80px; } }
body.atelier-fit { --klat-dock-h: 76px; }
body.atelier-fit > main { padding-bottom: 0; }
body.atelier-fit > main::after {
    content: "";
    display: block;
    width: 100%;
    height: calc(var(--klat-dock-h) + env(safe-area-inset-bottom, 0px) + 20px);
    flex: 0 0 auto;
    pointer-events: none;
}
body.atelier-fit .feature-hero.tool-hero > .container { padding-bottom: 0; }
@media (min-width: 900px) { body.atelier-fit { --klat-dock-h: 82px; } }
body.atelier-fit .rf-preview-col { --rf-h: 42svh; }
.klat-dock { padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px)); }
body.rf-full::before { content: none; }
.klat-dock {
    bottom: var(--klat-dock-bas, 0px);
    top: auto;
    display: flex;
    align-items: center;
    box-sizing: border-box;
}
body.atelier-fit { --klat-dock-h: 72px; }
@media (min-width: 900px) { body.atelier-fit { --klat-dock-h: 80px; } }
body.atelier-fit .rf-formats-col {
    margin-bottom: calc(var(--klat-dock-h, 72px) + env(safe-area-inset-bottom, 0px) + 28px);
}
.rf-fsclose {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgba(5, 7, 10, .62);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: none;
}
.rf-fsclose svg { width: 20px; height: 20px; }
.rf-fsclose:hover { background: rgba(5, 7, 10, .8); }
@supports (top: env(safe-area-inset-top)) {
    .rf-fsclose { top: calc(12px + env(safe-area-inset-top, 0px)); }
}
@media (min-width: 900px) {
    body .klat-dock,
    body .klat-back { display: none; }
}
@media (min-width: 900px) {
    body.atelier-active .rf-player { transition: max-width .24s ease, aspect-ratio .24s ease; }
}
@media (min-width: 900px) and (prefers-reduced-motion: reduce) {
    body.atelier-active .rf-player { transition: none; }
}
@media (max-width: 767px) {
    body.atelier-fit .rf-formats-col { margin-bottom: 0; }
    body.atelier-fit > main::after {
        height: calc(var(--klat-dock-h) / 2 + env(safe-area-inset-bottom, 0px));
    }
}
