/* ==========================================================================
   Free Story Maker — light, high-legibility UI (feature/story-maker-ui-revamp)
   Design source: docs/plans/2026-09-24-story-maker-ui-revamp-design.md §2
   Page-scoped `fsm-*` classes on shared id8 tokens (id8-ui.css, ADR-018), plain CSS on
   purpose: this page loads the compiled tailwind-output.css, and new utility
   classes would silently die without `npm run build:css` (LEARNINGS #1, #13).
   ========================================================================== */

:root {
    --fsm-bg: var(--id8-bg);
    --fsm-surface: var(--id8-surface);
    --fsm-surface-sunken: var(--id8-surface-sunken);
    --fsm-surface-drop: var(--id8-surface-drop);
    --fsm-ink: var(--id8-ink);
    --fsm-ink-muted: var(--id8-ink-muted);
    --fsm-border: var(--id8-border);
    --fsm-border-strong: var(--id8-border-strong);
    --fsm-border-drop: #A9A59B;
    --fsm-step-idle: #A6A9B2;
    --fsm-radio: #8A8F9C;
    --fsm-wave-idle: #C7C3B8;
    --fsm-range-empty: #CFCAC0;
    --fsm-primary: var(--id8-primary);
    --fsm-primary-hover: var(--id8-primary-hover);
    --fsm-primary-tint: var(--id8-primary-tint);
    --fsm-chosen: var(--id8-chosen);
    --fsm-chosen-tint: var(--id8-chosen-tint);
    --fsm-chosen-ink: var(--id8-chosen-ink); /* teal text on the teal tint: design #0E7C73 is 4.41:1, this is 5.33:1 */
    --fsm-warn-bg: var(--id8-warn-bg);
    --fsm-warn-border: var(--id8-warn-border);
    --fsm-warn-ink: var(--id8-warn-ink);
    --fsm-error: var(--id8-error);
    --fsm-error-halo: var(--id8-error-halo);
    --fsm-logo-teal: var(--id8-logo-teal);
    --fsm-scrim: var(--id8-scrim);
    --fsm-dim: var(--id8-dim);
    --fsm-backdrop: var(--id8-backdrop);

    --fsm-font: var(--id8-font);
    --fsm-shadow-card: 0 2px 8px rgba(22, 24, 29, 0.05);
    --fsm-shadow-cta: 0 4px 14px rgba(107, 47, 214, 0.28);
    --fsm-shadow-hero: 0 6px 18px rgba(107, 47, 214, 0.3);
    --fsm-bar-h: 96px;
}

/* ---------- Base --------------------------------------------------------- */
.fsm-body {
    margin: 0;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background: var(--fsm-bg);
    color: var(--fsm-ink);
    font-family: var(--fsm-font);
    font-size: 18px;
    line-height: 1.45;
    -webkit-font-smoothing: antialiased;
}

.fsm-body button,
.fsm-body input,
.fsm-body select,
.fsm-body textarea {
    font-family: inherit;
}

.fsm-body h1,
.fsm-body h2,
.fsm-body h3 {
    font-weight: 700; /* Tailwind preflight resets heading weight to inherit */
}

.fsm-body :focus-visible {
    outline: 3px solid var(--fsm-primary);
    outline-offset: 3px;
}

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

.fsm-sr-only {
    position: absolute !important;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Hide-only helpers (never force a display value, so components keep their own flex/grid). */
@media (min-width: 768px) {
    .fsm-mob-only { display: none !important; }
}

@media (max-width: 767px) {
    .fsm-desk-only { display: none !important; }
}

.fsm {
    flex-grow: 1;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 0 16px calc(var(--fsm-bar-h) + env(safe-area-inset-bottom, 0px) + 48px);
    box-sizing: border-box;
}

/* ---------- App shell: pinned top (header + stepper) ---------------------- */
/* The design is a fixed-height app shell (header + stepper on top, action bar at
   the bottom, content scrolling between). We keep native page scrolling (address
   bar collapse, find-in-page, SEO content below) and get the same look with a
   sticky top + a fixed bottom bar. --fsm-top-h is measured in JS. */
.fsm-top { position: sticky; top: 0; z-index: 30; }

.fsm-stepbar {
    width: 100%;
    display: flex;
    justify-content: center;
    background: var(--fsm-surface);
    border-bottom: 1px solid var(--fsm-border);
    box-shadow: 0 2px 8px rgba(22, 24, 29, 0.05);
    padding: 0 16px;
    box-sizing: border-box;
}

.fsm i[class*="ph-"] { line-height: 1; }

/* Light header (.id8-hl*) moved to assets/css/id8-ui.css (ADR-018). */

/* ---------- Hero ---------------------------------------------------------- */
.fsm-hero {
    width: 100%;
    max-width: 1000px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    padding-top: 32px;
    text-align: center;
}

.fsm-hero h1 { margin: 0; font-size: 46px; line-height: 1.1; font-weight: 700; }
.fsm-hero__lead { margin: 0; font-size: 21px; color: var(--fsm-ink-muted); max-width: 720px; }

.fsm-trust {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px 24px;
    font-size: 17px;
}

.fsm-trust li { display: flex; align-items: center; gap: 6px; }
.fsm-trust i { color: var(--fsm-chosen); font-size: 20px; }

.fsm-supported {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1px solid var(--fsm-border);
    border-radius: 999px;
    background: var(--fsm-surface);
    font-size: 15px;
    color: var(--fsm-ink-muted);
    text-decoration: none;
}

.fsm-supported strong { display: flex; align-items: center; gap: 4px; color: var(--fsm-ink); }
.fsm-supported .ph-heart { color: #C2410C; }
.fsm-supported .ph-youtube-logo { color: #CC0000; font-size: 17px; }

@media (max-width: 767px) {
    .fsm { padding: 0 0 calc(var(--fsm-bar-h) + env(safe-area-inset-bottom, 0px) + 24px); }
    .fsm-stepbar { padding: 0; box-shadow: none; }
    .fsm-hero { padding: 22px 16px 18px; gap: 10px; box-sizing: border-box; }
    .fsm-hero h1 { font-size: 29px; line-height: 1.15; }
    .fsm-hero__lead { font-size: 17px; line-height: 1.4; }
    .fsm-trust { gap: 8px 14px; font-size: 15px; }
    .fsm-supported { font-size: 14px; }
}

/* ---------- Stepper -------------------------------------------------------- */
.fsm-stepper { width: 100%; max-width: 1000px; padding: 16px 0; }

.fsm-stepper__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.fsm-stepper__line {
    flex-grow: 1;
    min-width: 24px;
    height: 3px;
    border-radius: 2px;
    background: var(--fsm-border);
}

.fsm-stepper__line.is-done { background: var(--fsm-chosen); }

.fsm-stepper__btn {
    display: flex;
    align-items: center;
    gap: 12px;
    background: none;
    border: 0;
    padding: 0;
    color: var(--fsm-ink);
    text-align: left;
    font: inherit;
}

button.fsm-stepper__btn:not(:disabled) { cursor: pointer; }
button.fsm-stepper__btn:not(:disabled):hover .fsm-stepper__name { text-decoration: underline; }

.fsm-stepper__dot {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    box-sizing: border-box;
    font-size: 19px;
    font-weight: 700;
    background: var(--fsm-surface);
    border: 2px solid var(--fsm-step-idle);
    color: var(--fsm-ink-muted);
}

.fsm-stepper__dot i { font-size: 24px; }
.fsm-stepper__text { display: flex; flex-direction: column; gap: 2px; }
.fsm-stepper__state { font-size: 14px; font-weight: 700; color: var(--fsm-ink-muted); }
.fsm-stepper__name { font-size: 19px; }
.is-done .fsm-stepper__dot { background: var(--fsm-chosen); border-color: var(--fsm-chosen); color: #fff; }
.is-done .fsm-stepper__state { color: var(--fsm-chosen); }
.is-current .fsm-stepper__dot { background: var(--fsm-primary); border-color: var(--fsm-primary); color: #fff; box-shadow: 0 0 0 5px var(--fsm-primary-tint); }
.is-current .fsm-stepper__state { color: var(--fsm-primary); }
.is-current .fsm-stepper__name { font-weight: 700; }

@media (max-width: 767px) {
    .fsm-stepper { padding: 12px 8px 10px; box-sizing: border-box; }
    .fsm-stepper__list { align-items: flex-start; gap: 0; }
    .fsm-stepper__item { width: 80px; flex-shrink: 0; }
    .fsm-stepper__line { min-width: 0; margin-top: 16px; }
    .fsm-stepper__btn { flex-direction: column; gap: 6px; width: 100%; align-items: center; }
    .fsm-stepper__dot { width: 34px; height: 34px; font-size: 15px; }
    .fsm-stepper__dot i { font-size: 18px; }
    .fsm-stepper__state { display: none; }
    .fsm-stepper__name { font-size: 14px; text-align: center; color: var(--fsm-ink-muted); }
    .is-done .fsm-stepper__name { color: var(--fsm-chosen); }
    .is-current .fsm-stepper__name { color: var(--fsm-primary); }
}

/* ---------- Card + step head ---------------------------------------------- */
.fsm-card {
    width: 100%;
    max-width: 1000px;
    margin-top: 28px;
    box-sizing: border-box;
    background: var(--fsm-surface);
    border: 1px solid var(--fsm-border);
    border-radius: 22px;
    padding: 40px;
    box-shadow: var(--fsm-shadow-card);
}

.fsm-view { display: flex; flex-direction: column; gap: 28px; }
.fsm-step-head { display: flex; flex-direction: column; gap: 8px; }
.fsm-eyebrow { font-size: 17px; font-weight: 700; color: var(--fsm-chosen); }
.fsm-step-head h2 { margin: 0; font-size: 34px; line-height: 1.15; font-weight: 700; }
.fsm-step-head p { margin: 0; font-size: 19px; color: var(--fsm-ink-muted); text-wrap: pretty; }
.fsm-step-head strong, .fsm-muted strong { color: var(--fsm-ink); }
.fsm-view h2:focus { outline: none; }
.fsm-muted { color: var(--fsm-ink-muted); font-weight: 400; }

.fsm-error {
    margin: 0;
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--fsm-error-halo);
    border: 2px solid #E9B98A;
    color: #7A3A05;
    font-size: 17px;
}

@media (max-width: 767px) {
    .fsm-card {
        margin-top: 0;
        border: 0;
        border-radius: 0;
        padding: 20px 16px 16px;
        box-shadow: none;
        background: transparent;
    }
    .fsm-view { gap: 16px; }
    .fsm-step-head h2 { font-size: 27px; }
    .fsm-step-head p { font-size: 17px; }
}

/* ---------- Buttons -------------------------------------------------------- */
.fsm-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    height: 60px;
    padding: 0 24px;
    box-sizing: border-box;
    border-radius: 14px;
    border: 2px solid transparent;
    font-size: 19px;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    white-space: nowrap;
    transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.fsm-btn i { font-size: 22px; }

.fsm-btn--primary { background: var(--fsm-primary); color: #fff; box-shadow: var(--fsm-shadow-cta); padding: 0 32px; font-size: 20px; }
.fsm-btn--primary:hover { background: var(--fsm-primary-hover); }
.fsm-btn--secondary { background: var(--fsm-surface); color: var(--fsm-ink); border-color: var(--fsm-border-strong); }
.fsm-btn--secondary:hover { border-color: var(--fsm-ink-muted); }
.fsm-btn--outline-primary { background: var(--fsm-surface); color: var(--fsm-primary); border-color: var(--fsm-primary); }
.fsm-btn--outline-primary:hover { background: var(--fsm-primary-tint); }

.fsm-btn--hero {
    height: 72px;
    border-radius: 16px;
    background: var(--fsm-primary);
    color: #fff;
    font-size: 23px;
    gap: 12px;
    box-shadow: var(--fsm-shadow-hero);
}

.fsm-btn--hero i { font-size: 28px; }
.fsm-btn--hero:hover { background: var(--fsm-primary-hover); }
.fsm-btn--block { width: 100%; }
.fsm-btn[aria-disabled="true"] { background: #7B58D0; box-shadow: none; cursor: not-allowed; }
.fsm-btn:disabled { opacity: 0.55; cursor: not-allowed; }

.fsm-link-btn {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    font-weight: 700;
    color: var(--fsm-primary);
    text-decoration: underline;
    cursor: pointer;
}

@media (max-width: 767px) {
    .fsm-btn { height: 56px; font-size: 18px; padding: 0 16px; }
    .fsm-btn--primary { font-size: 19px; }
    .fsm-btn--hero { height: 64px; font-size: 20px; }
}

/* ---------- Chips ---------------------------------------------------------- */
.fsm-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.fsm-chips__label { font-size: 17px; color: var(--fsm-ink-muted); }

.fsm-chip {
    height: 44px;
    padding: 0 18px;
    border-radius: 999px;
    border: 2px solid var(--fsm-border);
    background: var(--fsm-surface);
    color: var(--fsm-ink);
    font-size: 17px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    cursor: pointer;
}

.fsm-chip:hover { border-color: var(--fsm-border-strong); }
.fsm-chip[aria-pressed="true"] { border-color: var(--fsm-chosen); background: var(--fsm-chosen-tint); color: var(--fsm-chosen-ink); font-weight: 700; }
.fsm-chip[aria-pressed="true"]::before { content: ''; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--fsm-check-mask) center / contain no-repeat; mask: var(--fsm-check-mask) center / contain no-repeat; }
.fsm-chips--sm .fsm-chip { height: 40px; font-size: 16px; }

:root {
    --fsm-check-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5 9-10'/%3E%3C/svg%3E");
}

@media (max-width: 767px) {
    .fsm-chips--scroll {
        flex-wrap: nowrap;
        overflow-x: auto;
        margin: 0 -16px;
        padding: 2px 16px;
        scrollbar-width: none;
    }
    .fsm-chips--scroll::-webkit-scrollbar { display: none; }
    .fsm-chips--scroll .fsm-chips__label { display: none; }
    .fsm-chip { font-size: 16px; }
}

/* ---------- Inputs --------------------------------------------------------- */
.fsm-input {
    width: 100%;
    min-width: 0;
    height: 58px;
    box-sizing: border-box;
    padding: 0 16px;
    font-size: 19px;
    color: var(--fsm-ink);
    background: var(--fsm-surface);
    border: 2px solid var(--fsm-border-strong);
    border-radius: 12px;
}

.fsm-input::placeholder { color: #767B87; }
.fsm-input:focus { outline: none; border-color: var(--fsm-primary); box-shadow: 0 0 0 3px var(--fsm-primary-tint); }
.fsm-search { display: flex; gap: 10px; margin: 0; }
.fsm-search .fsm-input { flex-grow: 1; }
.fsm-search .fsm-btn { height: 58px; padding: 0 22px; border-radius: 12px; box-shadow: none; font-size: 19px; }

.fsm-field { display: flex; flex-direction: column; gap: 8px; }
.fsm-field__top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.fsm-label { font-size: 18px; font-weight: 700; }
.fsm-field__meta { font-size: 15px; color: var(--fsm-ink-muted); }
.fsm-field__warn { margin: 0; font-size: 15px; color: var(--fsm-warn-ink); }

@media (max-width: 767px) {
    .fsm-input { height: 54px; font-size: 17px; padding: 0 14px; }
    .fsm-search { gap: 8px; }
    .fsm-search .fsm-btn { height: 54px; width: 56px; padding: 0; flex-shrink: 0; }
    .fsm-label { font-size: 17px; }
}

/* ---------- Step 1: sources ----------------------------------------------- */
.fsm-sources { display: grid; grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr); align-items: stretch; }

.fsm-source {
    border: 2px solid var(--fsm-primary);
    border-radius: 18px;
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 18px;
    background: var(--fsm-surface);
}

.fsm-source--own { border: 2px dashed var(--fsm-border-drop); background: var(--fsm-surface-drop); transition: background-color 0.15s, border-color 0.15s; }
.fsm-source--own.is-dragover { border-color: var(--fsm-primary); background: var(--fsm-primary-tint); }
.fsm-source__head { display: flex; align-items: center; gap: 14px; }
.fsm-source__head h3 { margin: 0; font-size: 23px; }
.fsm-source__head p { margin: 0; font-size: 17px; color: var(--fsm-ink-muted); }
.fsm-source__hint { margin: 0; font-size: 17px; color: var(--fsm-ink-muted); text-align: center; }
.fsm-source .fsm-btn--outline-primary { height: 58px; }

.fsm-icon-tile {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    background: var(--fsm-primary-tint);
    color: var(--fsm-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 28px;
}

.fsm-mix { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; font-size: 14px; font-weight: 700; color: var(--fsm-ink-muted); text-align: center; line-height: 1.2; }
.fsm-mix__disc { width: 44px; height: 44px; border-radius: 50%; background: var(--fsm-ink); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 22px; }

.fsm-own-m {
    height: 80px;
    border-radius: 16px;
    border: 2px solid var(--fsm-border-drop);
    background: var(--fsm-surface);
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 16px;
    text-align: left;
    width: 100%;
    cursor: pointer;
    color: var(--fsm-ink);
}

.fsm-own-m .fsm-icon-tile { width: 50px; height: 50px; border-radius: 12px; font-size: 26px; }
.fsm-own-m__text { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; }
.fsm-own-m__text strong { font-size: 19px; }
.fsm-own-m__text span { font-size: 15px; color: var(--fsm-ink-muted); }
.fsm-own-m > i { font-size: 22px; color: var(--fsm-ink-muted); }

.fsm-or {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--fsm-ink-muted);
}

.fsm-or::before, .fsm-or::after { content: ''; flex-grow: 1; height: 1px; background: var(--fsm-border); }

@media (max-width: 767px) {
    .fsm-sources { display: flex; flex-direction: column; gap: 10px; }
    .fsm-source { padding: 14px; gap: 12px; border-radius: 16px; }
    .fsm-source--own, .fsm-mix { display: none !important; }
    .fsm-source__head h3 { font-size: 19px; }
    .fsm-source__head p { font-size: 15px; }
    .fsm-source .fsm-icon-tile { width: 50px; height: 50px; border-radius: 12px; }
}

/* ---------- Step 1: search results ---------------------------------------- */
.fsm-results {
    background: var(--fsm-surface-sunken);
    border-radius: 18px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.fsm-results__head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.fsm-results__head h3 { margin: 0; font-size: 21px; }
.fsm-results__head p { margin: 0; font-size: 17px; color: var(--fsm-ink-muted); }
.fsm-results__grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.fsm-results__status { margin: 0; font-size: 17px; color: var(--fsm-ink-muted); text-align: center; padding: 24px 0; }

.fsm-result {
    position: relative;
    height: 300px;
    border-radius: 14px;
    overflow: hidden;
    background: #D9D5CB;
}

.fsm-result img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fsm-result.is-added { box-shadow: 0 0 0 4px var(--fsm-chosen); }

.fsm-result__check {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--fsm-chosen);
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.fsm-result.is-added .fsm-result__check { display: flex; }

.fsm-result__btn {
    position: absolute;
    left: 10px;
    right: 10px;
    bottom: 10px;
    height: 50px;
    border: 0;
    border-radius: 10px;
    background: #fff;
    color: var(--fsm-primary);
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(22, 24, 29, 0.2);
}

.fsm-result__btn i { font-size: 20px; }
.fsm-result.is-added .fsm-result__btn { background: var(--fsm-chosen); color: #fff; }
.fsm-result__btn[aria-busy="true"] { color: var(--fsm-ink-muted); cursor: progress; }

.fsm-more-tile {
    height: 300px;
    border-radius: 14px;
    border: 2px dashed var(--fsm-border-strong);
    background: var(--fsm-surface);
    color: var(--fsm-ink);
    font-size: 18px;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
}

.fsm-more-tile i { font-size: 30px; color: var(--fsm-primary); }

@media (max-width: 767px) {
    .fsm-results { padding: 14px; border-radius: 16px; gap: 12px; }
    .fsm-results__head h3 { font-size: 18px; }
    .fsm-results__head p { font-size: 16px; }
    .fsm-results__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .fsm-result, .fsm-more-tile { height: 250px; }
    .fsm-result__btn { font-size: 17px; }
}

/* ---------- Step 1: "Your video" strip ------------------------------------ */
.fsm-strip { display: flex; flex-direction: column; gap: 16px; }

/* Finished-size meter (only shown when the video has clips) */
.fsm-meter { display: flex; flex-direction: column; gap: 8px; --fsm-meter-near: #9A5B00; --fsm-meter-track: #E3DFD6; }
.fsm-meter[hidden] { display: none; }
.fsm-meter__text { margin: 0; font-size: 17px; color: var(--fsm-ink-muted); }
.fsm-meter__text strong { color: var(--fsm-ink); }
.fsm-meter__track { height: 8px; border-radius: 4px; background: var(--fsm-meter-track); overflow: hidden; }
.fsm-meter__bar { height: 100%; width: 0; border-radius: 4px; background: var(--fsm-chosen); transition: width 0.2s; }
.fsm-meter.is-near .fsm-meter__bar, .fsm-meter.is-full .fsm-meter__bar { background: var(--fsm-meter-near); }
.fsm-meter.is-near .fsm-meter__text strong, .fsm-meter.is-full .fsm-meter__text strong { color: var(--fsm-meter-near); }
.fsm-meter__full { margin: 0; display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--fsm-warn-bg); border: 2px solid var(--fsm-warn-border); font-size: 17px; line-height: 1.4; }
.fsm-meter__full[hidden] { display: none; }
.fsm-meter__full i { font-size: 22px; color: var(--fsm-warn-ink); flex-shrink: 0; }
.fsm-add-tile:disabled { opacity: 0.5; cursor: not-allowed; }

/* Video length line + slider panel */
.fsm-length { display: flex; flex-direction: column; gap: 12px; }
.fsm-length[hidden] { display: none; }
.fsm-length__row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 18px; color: var(--fsm-ink-muted); }
.fsm-length__line { display: flex; align-items: center; gap: 8px; }
.fsm-length__line strong { color: var(--fsm-ink); }
.fsm-length__row .fsm-link-btn { min-height: 44px; padding: 0 6px; font-size: 18px; }
.fsm-length__panel { display: flex; flex-direction: column; gap: 6px; padding: 16px; border-radius: 16px; background: var(--fsm-surface-sunken); }
.fsm-length__panel[hidden] { display: none; }
.fsm-length__total { margin: 0; font-size: 30px; font-weight: 700; line-height: 1.1; color: var(--fsm-ink); }
.fsm-length__each { margin: 0; font-size: 17px; line-height: 1.4; color: var(--fsm-ink-muted); }
.fsm-length__each strong { color: var(--fsm-ink); }
.fsm-length__hint { align-self: flex-start; min-height: 44px; font-size: 17px; }
.fsm-length__reset { align-self: flex-start; margin-top: 6px; }
.fsm-strip__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.fsm-strip__title { display: flex; align-items: center; gap: 12px; }
.fsm-strip__title h3 { margin: 0; font-size: 24px; }
.fsm-pill { padding: 4px 12px; border-radius: 999px; background: var(--fsm-chosen-tint); color: var(--fsm-chosen-ink); font-weight: 700; font-size: 17px; }
.fsm-strip__len { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 18px; color: var(--fsm-ink-muted); }
.fsm-strip__len strong { color: var(--fsm-ink); }
.fsm-hint { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 17px; color: var(--fsm-ink-muted); }
.fsm-hint i { font-size: 20px; flex-shrink: 0; }

.fsm-strip__list {
    list-style: none;
    margin: 0;
    padding: 4px 2px 8px;
    display: flex;
    gap: 16px;
    overflow-x: auto;
    scrollbar-width: thin;
}

.fsm-thumb {
    position: relative;
    width: 132px;
    height: 220px;
    border-radius: 14px;
    overflow: hidden;
    flex-shrink: 0;
    border: 1px solid var(--fsm-border);
    background: #D9D5CB;
    cursor: grab;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
    transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s;
}

.fsm-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; pointer-events: none; }
/* Fit: the whole picture over a blurred, darkened copy of itself (matches the finished video). */
.fsm-thumb.is-fit .fsm-thumb__bg,
.fsm-isheet__phone.is-fit .fsm-thumb__bg {
    position: absolute;
    inset: -12px;
    width: calc(100% + 24px);
    height: calc(100% + 24px);
    object-fit: cover;
    filter: blur(10px) brightness(0.7);
}
.fsm-thumb.is-fit .fsm-thumb__fg,
.fsm-isheet__phone.is-fit .fsm-thumb__fg { position: absolute; inset: 0; object-fit: contain; }
.fsm-thumb { cursor: pointer; }
/* Video tiles: length badge (bottom-left), one-tap sound button (bottom-right) */
.fsm-thumb__badge {
    position: absolute;
    left: 6px;
    bottom: 8px;
    padding: 4px 9px;
    border-radius: 999px;
    background: var(--fsm-scrim);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 5px;
    pointer-events: none;
}
.fsm-thumb__badge i { font-size: 13px; }
.fsm-thumb__sound {
    position: absolute;
    right: 0;
    bottom: 0;
    width: 48px;
    height: 48px;
    border: 0;
    background: transparent;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.fsm-thumb__sound span { width: 34px; height: 34px; border-radius: 50%; background: #fff; color: var(--fsm-ink); font-size: 18px; display: flex; align-items: center; justify-content: center; }
.fsm-thumb__sound[aria-pressed="false"] span { background: var(--fsm-ink); color: #fff; }
@media (max-width: 767px) {
    .fsm-thumb__badge { left: 4px; bottom: 7px; padding: 3px 7px; font-size: 13px; gap: 3px; }
    .fsm-thumb__badge i { font-size: 11px; }
    .fsm-thumb__sound { width: 40px; height: 44px; }
    .fsm-thumb__sound span { width: 30px; height: 30px; font-size: 16px; }
}
.fsm-thumb.is-reading { cursor: default; background: var(--fsm-surface-sunken); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 8px; box-sizing: border-box; text-align: center; }
.fsm-thumb__spin { width: 30px; height: 30px; border-radius: 50%; border: 3px solid var(--fsm-border); border-top-color: var(--fsm-primary); animation: fsm-spin 0.9s linear infinite; }
.fsm-thumb__reading { font-size: 15px; color: var(--fsm-ink-muted); }
.fsm-note--plain { background: var(--fsm-surface-sunken); }
.fsm-note--plain > i { color: var(--fsm-ink-muted); }
.fsm-note[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .fsm-thumb__spin { animation: none; } }
.fsm-thumb.is-dragging { opacity: 0.4; }
.fsm-thumb.is-lifted { transform: scale(1.06); box-shadow: 0 10px 24px rgba(22, 24, 29, 0.3); z-index: 2; }
.fsm-thumb.is-drop-target { box-shadow: 0 0 0 4px var(--fsm-primary); }

.fsm-thumb__num {
    position: absolute;
    top: 8px;
    left: 8px;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    color: var(--fsm-ink);
    font-weight: 700;
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.fsm-thumb__remove {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 44px;
    height: 44px;
    border: 0;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
}

.fsm-thumb__remove span {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--fsm-ink);
    font-size: 18px;
}

.fsm-thumb__remove:hover span { background: var(--fsm-error-halo); color: var(--fsm-error); }

.fsm-thumb__src {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 8px;
    background: var(--fsm-scrim);
    color: #fff;
    font-size: 15px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.fsm-add-tile {
    width: 132px;
    height: 220px;
    border-radius: 14px;
    border: 2px dashed var(--fsm-border-strong);
    background: var(--fsm-surface);
    color: var(--fsm-primary);
    font-size: 16px;
    font-weight: 700;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
}

.fsm-add-tile i { font-size: 30px; }

@media (max-width: 767px) {
    .fsm-strip { gap: 10px; }
    .fsm-strip__title h3 { font-size: 22px; }
    .fsm-pill { font-size: 16px; padding: 3px 10px; }
    .fsm-strip__len { font-size: 16px; }
    .fsm-hint { font-size: 15px; }
    .fsm-strip__list { gap: 10px; margin: 0 -16px; padding: 4px 16px 8px; }
    .fsm-thumb, .fsm-add-tile { width: 104px; height: 172px; }
    .fsm-thumb__src { font-size: 13px; }
    .fsm-add-tile { font-size: 15px; }
}

/* ---------- Fixed bottom action bar (all widths) ------------------------- */
.fsm-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    min-height: var(--fsm-bar-h);
    box-sizing: border-box;
    padding: 0 16px env(safe-area-inset-bottom, 0px);
    display: flex;
    justify-content: center;
    background: var(--fsm-surface);
    border-top: 1px solid var(--fsm-border);
    box-shadow: 0 -4px 16px rgba(22, 24, 29, 0.08);
}

.fsm-nav__in { width: 100%; max-width: 1000px; min-height: var(--fsm-bar-h); display: flex; align-items: center; }
.fsm-nav__group { width: 100%; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.fsm-nav__left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.fsm-nav__status { margin: 0; display: flex; align-items: center; gap: 10px; font-size: 19px; font-weight: 700; color: var(--fsm-ink-muted); }
.fsm-nav__status.is-ready { color: var(--fsm-chosen); }
.fsm-nav__status i { font-size: 24px; }
.fsm-nav__status-m { display: none; }
.fsm-nav__status-m strong { font-size: 17px; }
.fsm-nav__status-m span { font-size: 14px; color: var(--fsm-ink-muted); }
.fsm-nav__status.is-ready .fsm-nav__status-m strong { color: var(--fsm-chosen); }
.fsm-nav__status.is-alert { color: #7A3A05; }
.fsm-nav__note { margin: 0; font-size: 18px; color: var(--fsm-ink-muted); }
.fsm-nav__done { margin: 0; display: flex; align-items: center; gap: 8px; font-size: 19px; font-weight: 700; color: var(--fsm-chosen); }
.fsm-nav__done i { font-size: 24px; }
.fsm-nav__actions { display: flex; gap: 12px; }
.fsm-nav.is-step4 #next-btn { height: 64px; padding: 0 40px; font-size: 22px; }
.fsm-nav.is-step4 #next-btn i { font-size: 26px; }
.fsm-btn--icon { width: 60px; padding: 0; flex-shrink: 0; }
.fsm-btn--icon .fsm-btn__label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }

@media (max-width: 767px) {
    .fsm-nav { padding: 0 16px env(safe-area-inset-bottom, 0px); }
    .fsm-nav__in { padding: 12px 0 20px; min-height: var(--fsm-bar-h); box-sizing: border-box; }
    .fsm-nav__group { gap: 10px; }
    .fsm-nav__left { flex-shrink: 0; }
    .fsm-nav #next-btn { flex-grow: 1; padding: 0 12px; box-shadow: none; }
    .fsm-nav__status { font-size: 17px; }
    .fsm-nav__status > i, .fsm-nav__status-d { display: none; }
    .fsm-nav__status-m { display: flex; flex-direction: column; line-height: 1.25; }
    .fsm-nav.is-step4 #prev-btn { width: 60px; height: 64px; padding: 0; }
    .fsm-nav.is-step4 #prev-btn .fsm-nav__back-label { display: none; }
    .fsm-nav.is-step4 #next-btn { height: 64px; font-size: 20px; padding: 0 12px; }
    .fsm-nav__group[data-for="making"] #cancel-btn { width: 100%; }
    .fsm-nav__actions { width: 100%; gap: 10px; }
    .fsm-nav__actions .fsm-btn { height: 60px; }
    .fsm-nav__actions .fsm-btn:not(.fsm-btn--icon) { flex-grow: 1; }
    .fsm-nav__group[data-for="failed"] .fsm-btn { height: 60px; }
    .fsm-nav__group[data-for="failed"] #failed-primary { flex-grow: 1; }
    .fsm-nav__group[data-for="failed"] .fsm-btn { padding: 0 14px; font-size: 17px; }
}

/* ---------- Step 2: music ------------------------------------------------- */
.fsm-music-controls { display: flex; flex-direction: column; gap: 14px; }
.fsm-tracks { display: flex; flex-direction: column; gap: 12px; }
.fsm-empty { margin: 0; padding: 20px; border-radius: 16px; background: var(--fsm-surface-sunken); text-align: center; font-size: 17px; color: var(--fsm-ink-muted); }
.fsm-empty.is-error { background: var(--fsm-error-halo); color: #7A3A05; }

.fsm-track {
    border: 2px solid var(--fsm-border);
    border-radius: 16px;
    padding: 18px 22px;
    background: var(--fsm-surface);
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.fsm-track.is-selected { border: 3px solid var(--fsm-chosen); background: var(--fsm-chosen-tint); padding: 20px 22px; }
.fsm-track__row { display: flex; align-items: center; gap: 18px; }

.fsm-track__play {
    height: 52px;
    min-width: 116px;
    padding: 0 18px;
    border-radius: 999px;
    border: 2px solid var(--fsm-primary);
    background: var(--fsm-surface);
    color: var(--fsm-primary);
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex-shrink: 0;
    cursor: pointer;
}

.fsm-track__play i { font-size: 20px; }
.fsm-track.is-selected .fsm-track__play { background: var(--fsm-chosen); border-color: var(--fsm-chosen); color: #fff; }
.fsm-track__meta { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.fsm-track__name { font-size: 21px; font-weight: 700; overflow-wrap: anywhere; }
.fsm-track__by { font-size: 17px; color: var(--fsm-ink-muted); }
.fsm-track__use { height: 52px; padding: 0 20px; border-radius: 12px; font-size: 18px; flex-shrink: 0; }

.fsm-selected-badge {
    height: 52px;
    padding: 0 20px;
    border-radius: 12px;
    background: var(--fsm-chosen);
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.fsm-selected-line { display: none; }

.fsm-radio-card {
    width: 100%;
    border: 2px solid var(--fsm-border);
    border-radius: 16px;
    padding: 18px 22px;
    background: var(--fsm-surface);
    display: flex;
    align-items: center;
    gap: 16px;
    text-align: left;
    cursor: pointer;
    color: var(--fsm-ink);
}

.fsm-radio-card__dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--fsm-radio); box-sizing: border-box; flex-shrink: 0; display: flex; align-items: center; justify-content: center; }
.fsm-radio-card__text { display: flex; flex-direction: column; gap: 2px; }
.fsm-radio-card__text strong { font-size: 19px; }
.fsm-radio-card__text span { font-size: 17px; color: var(--fsm-ink-muted); }
.fsm-radio-card[aria-pressed="true"] { border: 3px solid var(--fsm-chosen); background: var(--fsm-chosen-tint); padding: 17px 21px; }
.fsm-radio-card[aria-pressed="true"] .fsm-radio-card__dot { border-color: var(--fsm-chosen); }
.fsm-radio-card[aria-pressed="true"] .fsm-radio-card__dot::after { content: ''; width: 14px; height: 14px; border-radius: 50%; background: var(--fsm-chosen); }

/* Crop control */
.fsm-crop { background: var(--fsm-surface); border-radius: 12px; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
/* Own audio */
.fsm-own-audio {
    width: 100%;
    min-height: 76px;
    border-radius: 16px;
    border: 2px dashed var(--fsm-primary);
    background: var(--fsm-primary-tint);
    color: var(--fsm-ink);
    font: inherit;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    text-align: left;
    cursor: pointer;
}
.fsm-own-audio[hidden] { display: none; }
.fsm-own-audio__icon { width: 48px; height: 48px; border-radius: 12px; background: var(--fsm-primary); color: #fff; font-size: 26px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.fsm-own-audio__text { display: flex; flex-direction: column; gap: 2px; flex-grow: 1; }
.fsm-own-audio__text strong { font-size: 20px; }
.fsm-own-audio__text > span { font-size: 16px; line-height: 1.3; color: var(--fsm-ink-muted); }
.fsm-own-audio > i { font-size: 22px; color: var(--fsm-primary); flex-shrink: 0; }
.fsm-rights { margin: 0; font-size: 16px; line-height: 1.4; color: var(--fsm-ink-muted); }
.fsm-divider { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 700; color: var(--fsm-ink-muted); }
.fsm-divider::before, .fsm-divider::after { content: ''; flex-grow: 1; height: 1px; background: var(--fsm-border); }
.fsm-track__own-actions { display: flex; gap: 20px; }
.fsm-track__own-actions .fsm-link-btn { min-height: 44px; font-size: 17px; }
#own-audio-card:empty { display: none; }
#own-audio-error .fsm-link-btn { margin-left: 4px; }
.fsm-crop__repeat { margin: 0; display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--fsm-chosen-tint); font-size: 17px; line-height: 1.4; }
.fsm-crop__repeat[hidden], .fsm-crop__pick[hidden] { display: none; }
.fsm-crop__repeat i { font-size: 20px; color: var(--fsm-chosen); flex-shrink: 0; margin-top: 2px; }
.fsm-crop__pick { display: flex; flex-direction: column; gap: inherit; }
.fsm-crop__opt { margin-left: 6px; padding: 2px 8px; border-radius: 999px; background: var(--fsm-surface-sunken); font-size: 14px; font-weight: 400; color: var(--fsm-ink-muted); }
.fsm-crop__head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.fsm-crop__title { font-size: 18px; font-weight: 700; }
.fsm-crop__hint { font-size: 17px; color: var(--fsm-ink-muted); }

.fsm-crop__wave {
    position: relative;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    touch-action: none;
    cursor: pointer;
    user-select: none;
}

.fsm-crop__bar { width: 5px; border-radius: 2px; background: var(--fsm-wave-idle); flex-shrink: 0; }
.fsm-crop__bar.is-on { background: var(--fsm-chosen); }

.fsm-crop__window {
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    min-width: 56px;
    box-sizing: border-box;
    border: 3px solid var(--fsm-chosen);
    border-radius: 8px;
    background: rgba(14, 124, 115, 0.08);
    cursor: grab;
    touch-action: none;
}

.fsm-crop__window:active { cursor: grabbing; }
.fsm-crop__window:focus-visible { outline: 3px solid var(--fsm-primary); outline-offset: 3px; }
.fsm-crop__labels { display: flex; justify-content: space-between; gap: 8px; font-size: 16px; color: var(--fsm-ink-muted); }
.fsm-crop__labels .is-on { color: var(--fsm-chosen); font-weight: 700; }

@media (max-width: 767px) {
    .fsm-track { padding: 12px 14px; gap: 10px; }
    .fsm-track.is-selected { padding: 14px; gap: 12px; }
    .fsm-track__row { gap: 12px; }
    .fsm-track__play { width: 52px; min-width: 52px; padding: 0; border-radius: 50%; }
    .fsm-track__play .fsm-track__play-label { display: none; }
    .fsm-track__name { font-size: 18px; }
    .fsm-track__by { font-size: 15px; }
    .fsm-track__use { width: 100%; height: 46px; font-size: 17px; }
    .fsm-track > .fsm-track__use { display: flex; }
    .fsm-track__row .fsm-track__use, .fsm-track__row .fsm-selected-badge { display: none; }
    .fsm-selected-line { display: flex; align-items: center; gap: 8px; font-size: 16px; font-weight: 700; color: var(--fsm-chosen-ink); }
    .fsm-crop { padding: 12px; gap: 8px; }
    .fsm-crop__title { font-size: 16px; }
    .fsm-crop__hint { display: none; }
    .fsm-crop__wave { height: 48px; }
    .fsm-crop__bar { width: 4px; }
    .fsm-crop__labels { font-size: 14px; }
    .fsm-radio-card { padding: 16px 18px; }
    .fsm-radio-card__text strong { font-size: 18px; }
    .fsm-radio-card__text span { font-size: 16px; }
}

@media (min-width: 768px) {
    .fsm-track > .fsm-track__use { display: none; }
}

/* ---------- Phone preview frames + stage ---------------------------------- */
.fsm-preview-panel {
    background: var(--fsm-surface-sunken);
    border-radius: 18px;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}

.fsm-preview-panel > p { margin: 0; font-size: 16px; color: var(--fsm-ink-muted); }

.fsm-phone {
    position: relative;
    width: 290px;
    height: 516px;
    border-radius: 26px;
    border: 7px solid var(--fsm-ink);
    box-sizing: border-box;
    overflow: hidden;
    background: #000;
    flex-shrink: 0;
}

.fsm-phone--dim::after { content: ''; position: absolute; inset: 0; background: var(--fsm-dim); z-index: 20; pointer-events: none; }
.fsm-phone video { width: 100%; height: 100%; object-fit: cover; display: block; background: #000; }

.fsm-phone__play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 25;
    width: 76px;
    height: 76px;
    border-radius: 50%;
    border: 0;
    background: rgba(255, 255, 255, 0.92);
    color: var(--fsm-ink);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.preview-stage {
    position: absolute;
    inset: 0;
    overflow: hidden;
    background: #000;
    container-type: inline-size;
}

.preview-stage.is-static .preview-text-overlay,
.preview-stage.is-static .preview-sticker-overlay { pointer-events: none; }

.preview-stage.is-static .draggable-glow { animation: none; box-shadow: none; }

.preview-slide {
    position: absolute;
    inset: -15%;
    width: 130%;
    height: 130%;
    background-size: cover;
    background-position: center;
    animation: kenburns-tl 3s ease-in-out infinite alternate;
    opacity: 0;
    transition: opacity 0.5s ease-in-out;
}

.preview-slide.active { opacity: 1; }
.preview-slide.is-clip { inset: 0; width: 100%; height: 100%; animation: none; overflow: hidden; background: #000; }
.preview-slide__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.preview-slide.is-fit .preview-slide__video { object-fit: contain; }
.preview-clip-badge { position: absolute; top: 10px; left: 10px; z-index: 3; padding: 4px 10px; border-radius: 999px; background: rgba(22, 24, 29, 0.75); color: #fff; font-size: 14px; font-weight: 700; display: flex; align-items: center; gap: 6px; pointer-events: none; }
.preview-clip-badge[hidden] { display: none; }
.preview-clip-badge i { font-size: 11px; }
.preview-slide.is-fit { inset: 0; width: 100%; height: 100%; animation: none; overflow: hidden; }
.preview-slide__bg,
.preview-slide__fg { position: absolute; background-position: center; background-repeat: no-repeat; }
.preview-slide__bg { inset: -8%; background-size: cover; filter: blur(12px) brightness(0.7); }
.preview-slide__fg { inset: 0; background-size: contain; }
.preview-stage.is-still .preview-slide { animation: none; }

@keyframes kenburns-tl {
    from { transform: scale(1) translate(0, 0); }
    to { transform: scale(1.15) translate(-2%, -3%); }
}

/* Text overlay: same fonts as the FFmpeg drawtext output (Noto Sans / Noto Sans
   Devanagari, preinstalled on Android) and the same size ratio (52px on a 720px
   frame = 7.2% of width) so the preview matches the rendered video. */
.preview-text-overlay {
    position: absolute;
    cursor: grab;
    user-select: none;
    -webkit-user-select: none;
    touch-action: none;
    white-space: pre-wrap;
    text-align: center;
    font-family: 'Noto Sans', 'Noto Sans Devanagari', system-ui, sans-serif;
    font-size: 16px;
    font-size: 7.2cqw;
    font-weight: 700;
    line-height: 1.25;
    max-width: 92%;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
    -webkit-text-stroke: 0.35cqw rgba(0, 0, 0, 0.8);
    paint-order: stroke fill;
    z-index: 10;
    padding: 2px 4px;
}

.preview-text-overlay:active { cursor: grabbing; }
.preview-text-overlay:empty { display: none; }

/* The overlay is centred with translate(-50%,-50%) (see markup); keep that
   translate inside the keyframes or the animation would un-centre it. */
.anim-fadein { animation: preview-fadein 1.5s ease backwards; }
@keyframes preview-fadein { from { opacity: 0; } to { opacity: 1; } }
.anim-slideup { animation: preview-slideup 1.5s ease-out backwards; }
@keyframes preview-slideup {
    from { transform: translate(-50%, calc(-50% + 30px)); opacity: 0; }
    to { transform: translate(-50%, -50%); opacity: 1; }
}
.anim-typewriter { animation: preview-typing 2s linear forwards; }
@keyframes preview-typing { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }

.preview-sticker-overlay {
    position: absolute;
    cursor: grab;
    user-select: none;
    touch-action: none;
    z-index: 11;
    transform: translate(-50%, -50%);
    overflow: hidden;
}

.preview-sticker-overlay:active { cursor: grabbing; }

@keyframes glow-pulse {
    0%, 100% { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.55); }
    50% { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.95); }
}

.draggable-glow { outline: 2px dashed rgba(255, 255, 255, 0.8); outline-offset: 3px; border-radius: 6px; animation: glow-pulse 1.6s ease-in-out infinite; }

@media (max-width: 767px) {
    .fsm-preview-panel { padding: 16px; }
    .fsm-phone--lg { width: 200px; height: 356px; border-width: 4px; border-radius: 18px; }
    .fsm-phone--lg .fsm-phone__play { width: 53px; height: 53px; font-size: 24px; }
}

/* ---------- Step 3 --------------------------------------------------------- */
.fsm-s3 { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 40px; align-items: start; }
.fsm-s3__aside { position: sticky; top: calc(var(--fsm-top-h, 153px) + 24px); }
.fsm-s3__aside-title { align-self: flex-start; font-size: 18px; font-weight: 700; }
.fsm-s3__main { display: flex; flex-direction: column; gap: 26px; min-width: 0; }

.fsm-jump { display: flex; gap: 10px; }

.fsm-jump a {
    flex: 1;
    height: 50px;
    border-radius: 12px;
    border: 2px solid var(--fsm-border);
    box-sizing: border-box;
    color: var(--fsm-ink);
    text-decoration: none;
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.fsm-jump a.is-active { background: var(--fsm-ink); border-color: var(--fsm-ink); color: #fff; }
.fsm-s3__panel { display: flex; flex-direction: column; gap: 18px; scroll-margin-top: calc(var(--fsm-top-h, 153px) + 24px); }
.fsm-sec-head { display: flex; align-items: center; gap: 12px; }
.fsm-sec-head h3 { margin: 0; font-size: 23px; }
.fsm-num { width: 34px; height: 34px; border-radius: 50%; background: var(--fsm-ink); color: #fff; font-size: 17px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.fsm-opt { font-size: 16px; color: var(--fsm-ink-muted); }
.fsm-divider { height: 1px; background: var(--fsm-border); }

.fsm-stickers { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }

.fsm-sticker-tile {
    position: relative;
    height: 96px;
    border-radius: 14px;
    border: 2px solid var(--fsm-border);
    background: var(--fsm-surface);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    box-sizing: border-box;
    padding: 0;
    cursor: pointer;
    color: var(--fsm-ink);
}

.fsm-sticker-tile__art { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.fsm-sticker-tile__art i { font-size: 32px; color: var(--fsm-ink-muted); }
.fsm-sticker-tile__name { font-size: 14px; }
.fsm-sticker-tile[aria-pressed="true"] { border: 3px solid var(--fsm-chosen); background: var(--fsm-chosen-tint); }
.fsm-sticker-tile[aria-pressed="true"] .fsm-sticker-tile__name { font-weight: 700; }
.fsm-sticker-tile__check { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%; background: var(--fsm-chosen); color: #fff; display: none; align-items: center; justify-content: center; font-size: 14px; }
.fsm-sticker-tile[aria-pressed="true"] .fsm-sticker-tile__check { display: flex; }

.fsm-sticker-opts { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; background: var(--fsm-surface-sunken); border-radius: 14px; padding: 18px; }
.fsm-sticker-opts__group { display: flex; flex-direction: column; gap: 10px; min-width: 0; }

.fsm-range-row { display: flex; align-items: center; gap: 10px; }
.fsm-range-btn { width: 48px; height: 48px; border-radius: 12px; border: 2px solid var(--fsm-border-strong); background: var(--fsm-surface); display: flex; align-items: center; justify-content: center; flex-shrink: 0; cursor: pointer; color: var(--fsm-ink); font-size: 22px; padding: 0; }
.fsm-range-ends { display: flex; justify-content: space-between; font-size: 15px; color: var(--fsm-ink-muted); padding: 0 58px; margin-top: -8px; }

.fsm-range {
    -webkit-appearance: none;
    appearance: none;
    flex-grow: 1;
    min-width: 0;
    height: 8px;
    border-radius: 4px;
    margin: 20px 0;
    background: linear-gradient(90deg, var(--fsm-chosen) var(--fill, 50%), var(--fsm-range-empty) var(--fill, 50%));
    cursor: pointer;
}

.fsm-range::-webkit-slider-thumb { -webkit-appearance: none; width: 32px; height: 32px; border-radius: 50%; background: #fff; border: 3px solid var(--fsm-chosen); box-shadow: 0 2px 6px rgba(22, 24, 29, 0.2); }
.fsm-range::-moz-range-thumb { width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 3px solid var(--fsm-chosen); box-shadow: 0 2px 6px rgba(22, 24, 29, 0.2); }
.fsm-range:focus-visible { outline-offset: 8px; }

.fsm-option-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.fsm-option-grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

.fsm-option {
    height: 54px;
    border-radius: 12px;
    border: 2px solid var(--fsm-border);
    background: var(--fsm-surface);
    color: var(--fsm-ink);
    font-size: 17px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
    padding: 0 8px;
}

.fsm-option[aria-pressed="true"] { border: 3px solid var(--fsm-chosen); background: var(--fsm-chosen-tint); color: var(--fsm-chosen-ink); font-weight: 700; }
.fsm-option[aria-pressed="true"]::before { content: ''; width: 16px; height: 16px; background: currentColor; -webkit-mask: var(--fsm-check-mask) center / contain no-repeat; mask: var(--fsm-check-mask) center / contain no-repeat; flex-shrink: 0; }
.fsm-sticker-opts .fsm-option { height: 52px; }

.fsm-swatches { display: flex; gap: 16px; flex-wrap: wrap; }
.fsm-swatch { border: 0; background: transparent; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; color: var(--fsm-ink); min-width: 48px; }
.fsm-swatch__dot { width: 48px; height: 48px; border-radius: 50%; border: 2px solid var(--fsm-step-idle); box-sizing: border-box; display: flex; align-items: center; justify-content: center; }
.fsm-swatch__name { font-size: 15px; }
.fsm-swatch[aria-pressed="true"] .fsm-swatch__dot { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--fsm-chosen); }
.fsm-swatch[aria-pressed="true"] .fsm-swatch__dot::after { content: ''; width: 20px; height: 20px; background: var(--fsm-ink); -webkit-mask: var(--fsm-check-mask) center / contain no-repeat; mask: var(--fsm-check-mask) center / contain no-repeat; }
.fsm-swatch[aria-pressed="true"] .fsm-swatch__name { font-weight: 700; }

.fsm-s3__mhead { display: none; }

.fsm-seg { display: flex; gap: 4px; padding: 4px; background: var(--fsm-surface-sunken); border-radius: 14px; }

.fsm-seg button {
    flex: 1;
    height: 52px;
    border-radius: 10px;
    border: 0;
    background: transparent;
    color: var(--fsm-ink-muted);
    font-size: 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    cursor: pointer;
}

.fsm-seg button[aria-selected="true"] { background: var(--fsm-surface); color: var(--fsm-ink); box-shadow: 0 1px 4px rgba(22, 24, 29, 0.15); }

@media (max-width: 767px) {
    .fsm-s3 { grid-template-columns: 128px minmax(0, 1fr); gap: 14px; }
    .fsm-s3__aside { position: static; background: none; padding: 0; grid-column: 1; grid-row: 1; }
    .fsm-s3__aside .fsm-phone { width: 128px; height: 228px; border-width: 4px; border-radius: 11px; }
    .fsm-s3__mhead { display: flex; flex-direction: column; gap: 8px; justify-content: center; grid-column: 2; grid-row: 1; }
    .fsm-s3__mhead .fsm-eyebrow { font-size: 15px; }
    .fsm-s3__mhead h2 { margin: 0; font-size: 23px; line-height: 1.15; }
    .fsm-s3__mhead p { margin: 0; font-size: 15px; line-height: 1.35; color: var(--fsm-ink-muted); }
    .fsm-s3__mhead .fsm-btn { height: 44px; border-radius: 10px; font-size: 16px; gap: 6px; padding: 0 10px; }
    .fsm-s3__main { grid-column: 1 / -1; gap: 16px; }
    .fsm-s3__panel { gap: 14px; }
    .fsm-s3__panel.is-m-hidden { display: none; }
    .fsm-stickers { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
    .fsm-sticker-tile { height: 84px; }
    .fsm-sticker-tile__name { font-size: 13px; }
    .fsm-sticker-opts { grid-template-columns: 1fr; gap: 16px; padding: 14px; }
    .fsm-range-ends { font-size: 14px; }
    .fsm-option-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fsm-option { height: 50px; font-size: 16px; }
    .fsm-swatches { gap: 10px; }
    .fsm-swatch__dot { width: 44px; height: 44px; }
    .fsm-swatch__name { font-size: 13px; }
    .fsm-swatch { min-width: 44px; }
}

/* ---------- Full-preview + account dialogs --------------------------------- */
.fsm-dialog {
    border: 0;
    padding: 0;
    background: transparent;
    color: var(--fsm-ink);
    font-family: var(--fsm-font);
    max-width: none;
    max-height: none;
}

.fsm-dialog::backdrop { background: var(--fsm-backdrop); }

.fsm-pdialog__inner {
    width: min(360px, calc(100vw - 32px));
    max-height: calc(100vh - 32px);
    overflow: auto;
    box-sizing: border-box;
    background: var(--fsm-surface);
    border-radius: 22px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.fsm-pdialog__head { width: 100%; display: flex; justify-content: space-between; align-items: center; }
.fsm-pdialog__head h2 { margin: 0; font-size: 22px; }
.fsm-pdialog .fsm-phone { width: min(290px, calc((100vh - 260px) * 0.5625)); height: auto; aspect-ratio: 9 / 16; border-width: 5px; border-radius: 20px; }

.fsm-close {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--fsm-surface-sunken);
    border: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    color: var(--fsm-ink);
    cursor: pointer;
    flex-shrink: 0;
}

.fsm-sheet {
    margin: auto auto 0;
    width: 100%;
    max-width: 480px;
}

.fsm-sheet__inner {
    background: var(--fsm-surface);
    border-radius: 24px 24px 0 0;
    padding: 10px 20px calc(32px + env(safe-area-inset-bottom, 0px));
    display: flex;
    flex-direction: column;
    gap: 18px;
    box-shadow: 0 -8px 30px rgba(22, 24, 29, 0.25);
}

/* Item sheet */
.fsm-isheet .fsm-sheet__inner { gap: 16px; max-height: calc(100vh - 24px); overflow-y: auto; box-sizing: border-box; }
.fsm-isheet h2 { margin: 0; font-size: 24px; line-height: 1.2; }
.fsm-isheet__sub { margin: 4px 0 0; font-size: 17px; color: var(--fsm-ink-muted); }
.fsm-isheet__body { display: flex; gap: 16px; align-items: flex-start; }
.fsm-isheet__phone {
    position: relative;
    width: 120px;
    aspect-ratio: 9 / 16;
    border-radius: 14px;
    overflow: hidden;
    flex-shrink: 0;
    background: #16181D;
    border: 1px solid var(--fsm-border);
}
.fsm-isheet__phone img,
.fsm-isheet__phone video { width: 100%; height: 100%; object-fit: cover; display: block; }
.fsm-isheet__controls { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.fsm-isheet__group { display: flex; flex-direction: column; gap: 8px; }
.fsm-isheet__label { font-size: 17px; font-weight: 700; }
.fsm-fitopts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.fsm-fitopt {
    min-height: 76px;
    padding: 10px 12px;
    border-radius: 14px;
    border: 2px solid var(--fsm-border-strong);
    background: var(--fsm-surface);
    color: var(--fsm-ink);
    font: inherit;
    text-align: left;
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
}
.fsm-fitopt strong { font-size: 18px; }
.fsm-fitopt span { font-size: 15px; line-height: 1.3; color: var(--fsm-ink-muted); }
.fsm-fitopt[aria-pressed="true"] { border: 3px solid var(--fsm-chosen); background: var(--fsm-chosen-tint); padding: 9px 11px; }
.fsm-isheet__phone video.fsm-thumb__fg { position: absolute; inset: 0; object-fit: contain; }
.fsm-isheet__play {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    width: 52px;
    height: 52px;
    border-radius: 50%;
    border: 0;
    background: rgba(22, 24, 29, 0.72);
    color: #fff;
    font-size: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.fsm-isheet__play.is-playing { opacity: 0; }
.fsm-isheet__play.is-playing:focus-visible, .fsm-isheet__phone:hover .fsm-isheet__play.is-playing { opacity: 1; }
#isheet-clip { display: flex; flex-direction: column; gap: 16px; }
#isheet-clip[hidden] { display: none; }
.fsm-isheet__hint { display: block; font-size: 16px; color: var(--fsm-ink-muted); }
.fsm-isheet__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fsm-trim__head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.fsm-trim__range { font-size: 16px; color: var(--fsm-chosen-ink); font-weight: 700; }
.fsm-trim { position: relative; height: 56px; border-radius: 10px; background: var(--fsm-surface-sunken); touch-action: none; user-select: none; -webkit-user-select: none; }
.fsm-trim__frames { position: absolute; inset: 0; display: flex; border-radius: 10px; overflow: hidden; }
.fsm-trim__frames img { flex: 1 1 0; min-width: 0; height: 100%; object-fit: cover; display: block; }
.fsm-trim__shade { position: absolute; top: 0; bottom: 0; background: rgba(246, 244, 239, 0.72); }
.fsm-trim__shade--l { left: 0; border-radius: 10px 0 0 10px; }
.fsm-trim__shade--r { right: 0; border-radius: 0 10px 10px 0; }
.fsm-trim__window { position: absolute; top: -3px; bottom: -3px; border: 3px solid var(--fsm-chosen); border-radius: 12px; box-sizing: border-box; min-width: 8px; pointer-events: none; }
.fsm-trim__handle {
    position: absolute;
    top: 50%;
    width: 44px;
    height: 64px;
    transform: translate(-50%, -50%);
    border: 0;
    background: transparent;
    padding: 0;
    cursor: ew-resize;
    pointer-events: auto;
    touch-action: none;
}
.fsm-trim__handle::before { content: ''; position: absolute; left: 50%; top: 50%; width: 16px; height: 44px; transform: translate(-50%, -50%); border-radius: 8px; background: var(--fsm-chosen); box-shadow: 0 1px 4px rgba(22, 24, 29, 0.3); }
.fsm-trim__handle::after { content: ''; position: absolute; left: 50%; top: 50%; width: 3px; height: 18px; transform: translate(-50%, -50%); border-radius: 2px; background: #fff; }
.fsm-trim__handle--l { left: 0; }
.fsm-trim__handle--r { left: 100%; }
.fsm-trim__ends { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; color: var(--fsm-ink-muted); }
.fsm-switch { width: 60px; height: 36px; border-radius: 999px; border: 2px solid var(--fsm-border-strong); background: var(--fsm-range-empty); padding: 0; position: relative; cursor: pointer; flex-shrink: 0; }
.fsm-switch span { position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(22, 24, 29, 0.3); transition: transform 0.15s; }
.fsm-switch[aria-checked="true"] { background: var(--fsm-chosen); border-color: var(--fsm-chosen); }
.fsm-switch[aria-checked="true"] span { transform: translateX(24px); }
.fsm-switch[hidden] { display: none; }
@media (max-width: 767px) {
    .fsm-isheet__body { flex-direction: column; align-items: stretch; }
    .fsm-isheet__phone { align-self: center; width: 132px; }
}
.fsm-isheet__foot { display: flex; gap: 12px; justify-content: space-between; }
.fsm-isheet__foot .fsm-btn--primary { flex: 1; }
@media (min-width: 768px) {
    .fsm-isheet { margin: auto; max-width: 600px; }
    .fsm-isheet .fsm-sheet__inner { border-radius: 22px; padding: 24px; }
    .fsm-isheet .fsm-sheet__grabber { display: none; }
    .fsm-isheet__phone { width: 168px; }
    .fsm-isheet__foot .fsm-btn--primary { flex: 0 0 auto; min-width: 160px; }
}
@media (max-width: 420px) {
    .fsm-fitopts { grid-template-columns: 1fr; }
}

.fsm-sheet__grabber { width: 48px; height: 5px; border-radius: 3px; background: var(--fsm-wave-idle); align-self: center; }
.fsm-sheet__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.fsm-sheet__title { display: flex; align-items: center; gap: 14px; }
.fsm-sheet__title .fsm-icon-tile { width: 52px; height: 52px; border-radius: 50%; font-size: 26px; }
.fsm-sheet__title h2 { margin: 0; font-size: 24px; line-height: 1.2; }
.fsm-sheet__actions { display: flex; flex-direction: column; gap: 12px; }
.fsm-sheet__actions .fsm-btn--hero { height: 60px; font-size: 20px; }
.fsm-note { display: flex; align-items: flex-start; gap: 10px; padding: 14px; border-radius: 14px; background: var(--fsm-chosen-tint); font-size: 16px; line-height: 1.4; }
.fsm-note > i { color: var(--fsm-chosen); font-size: 22px; flex-shrink: 0; }

/* ---------- Step 4 --------------------------------------------------------- */
.fsm-s4 { display: grid; grid-template-columns: 330px minmax(0, 1fr); gap: 40px; align-items: start; }
.fsm-s4__main { display: flex; flex-direction: column; gap: 24px; min-width: 0; }
.fsm-summary { list-style: none; margin: 0; border: 2px solid var(--fsm-border); border-radius: 18px; padding: 6px 22px; }
.fsm-summary li { display: flex; align-items: flex-start; gap: 14px; padding: 18px 0; }
.fsm-summary li + li { border-top: 1px solid var(--fsm-border); }
.fsm-summary .fsm-icon-tile { width: 44px; height: 44px; border-radius: 12px; font-size: 22px; }
.fsm-summary__body { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.fsm-summary__label { font-size: 16px; font-weight: 700; color: var(--fsm-ink-muted); }
.fsm-summary__value { font-size: 19px; font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.fsm-summary__meta { font-size: 17px; color: var(--fsm-ink-muted); }
.fsm-summary__thumbs { display: flex; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.fsm-summary__thumbs img { width: 34px; height: 52px; object-fit: cover; border-radius: 6px; display: block; }

.fsm-change {
    height: 44px;
    padding: 0 12px;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 17px;
    font-weight: 700;
    color: var(--fsm-primary);
    background: none;
    border: 0;
    flex-shrink: 0;
    cursor: pointer;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.fsm-reassure { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 17px; color: var(--fsm-ink-muted); }
.fsm-reassure li { display: flex; align-items: center; gap: 10px; }
.fsm-reassure i { font-size: 20px; flex-shrink: 0; }

@media (max-width: 767px) {
    .fsm-s4 { grid-template-columns: 1fr; gap: 16px; }
    .fsm-s4__main { gap: 16px; }
    .fsm-summary { padding: 2px 14px; border-radius: 16px; }
    .fsm-summary li { padding: 14px 0; }
    .fsm-summary__label { font-size: 14px; }
    .fsm-summary__value { font-size: 17px; }
    .fsm-summary__meta { font-size: 15px; }
    .fsm-change { font-size: 15px; }
    .fsm-reassure { font-size: 15px; gap: 8px; }
}

/* ---------- Making / Ready / Failed ---------------------------------------- */
.fsm-result-grid {
    display: grid;
    grid-template-columns: 330px minmax(0, 1fr);
    column-gap: 48px;
    row-gap: 24px;
    align-items: start;
}

.fsm-result-grid > .fsm-preview-panel { grid-column: 1; grid-row: 1 / span 6; }
.fsm-result-grid > :not(.fsm-preview-panel) { grid-column: 2; }
.fsm-making { align-content: center; }
.fsm-making > .fsm-preview-panel { align-self: center; }

.fsm-making__head { display: flex; flex-direction: column; gap: 8px; }
.fsm-making__head h2, .fsm-done-head h2, .fsm-failed h2 { margin: 0; font-size: 36px; line-height: 1.15; }
.fsm-making__head p { margin: 0; font-size: 19px; color: var(--fsm-ink-muted); }

.fsm-progress { display: flex; flex-direction: column; gap: 10px; }
.fsm-progress__row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.fsm-progress__pct { font-size: 28px; font-weight: 700; color: var(--fsm-primary); font-variant-numeric: tabular-nums; }
.fsm-progress__eta { font-size: 18px; color: var(--fsm-ink-muted); }
.fsm-progress__track { height: 20px; border-radius: 20px; background: var(--fsm-surface-sunken); border: 1px solid var(--fsm-border); overflow: hidden; }
.fsm-progress__fill { width: 0; height: 100%; border-radius: 20px; background: var(--fsm-primary); transition: width 0.3s ease; }

.fsm-stages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.fsm-stage { display: flex; align-items: center; gap: 12px; font-size: 18px; color: var(--fsm-ink-muted); }
.fsm-stage__icon { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--fsm-border); box-sizing: border-box; flex-shrink: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 16px; }
.fsm-stage.is-done { color: var(--fsm-ink); }
.fsm-stage.is-done .fsm-stage__icon { background: var(--fsm-chosen); border-color: var(--fsm-chosen); }
.fsm-stage.is-active { color: var(--fsm-ink); font-weight: 700; }
.fsm-stage.is-active .fsm-stage__icon { border-color: var(--fsm-border); border-top-color: var(--fsm-primary); border-right-color: var(--fsm-primary); animation: fsm-spin 0.9s linear infinite; }
.fsm-stage__icon i { display: none; }
.fsm-stage.is-done .fsm-stage__icon i { display: block; }

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

.fsm-callout { display: flex; align-items: flex-start; gap: 12px; padding: 16px; border-radius: 14px; background: var(--fsm-warn-bg); border: 2px solid var(--fsm-warn-border); font-size: 17px; line-height: 1.4; }
.fsm-callout > i { color: var(--fsm-warn-ink); font-size: 24px; flex-shrink: 0; }
.fsm-making .fsm-btn--secondary { justify-self: start; }

.fsm-done-head { display: flex; align-items: center; gap: 22px; }
.fsm-done-head > div { display: flex; flex-direction: column; gap: 6px; }
.fsm-done-head p { margin: 0; font-size: 18px; color: var(--fsm-ink-muted); }

.fsm-disc { width: 64px; height: 64px; border-radius: 50%; background: var(--fsm-chosen); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 36px; box-shadow: 0 0 0 8px var(--fsm-chosen-tint); flex-shrink: 0; }
.fsm-disc--error { width: 72px; height: 72px; background: var(--fsm-error); box-shadow: 0 0 0 8px var(--fsm-error-halo); font-size: 40px; }

.fsm-actions { display: flex; flex-direction: column; gap: 12px; }
.fsm-actions .fsm-btn--hero { height: 68px; font-size: 22px; }
.fsm-actions .fsm-btn--outline-primary { height: 60px; }

.fsm-failed__clip { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 16px; border: 2px solid var(--fsm-border); background: var(--fsm-surface); text-align: left; align-self: stretch; }
.fsm-failed__clip[hidden] { display: none; }
.fsm-failed__clip img { width: 54px; height: 96px; border-radius: 10px; object-fit: cover; flex-shrink: 0; background: var(--fsm-surface-sunken); }
.fsm-failed__clip > span { display: flex; flex-direction: column; gap: 2px; font-size: 17px; }
.fsm-failed__clip > span span { color: var(--fsm-ink-muted); }
.fsm-box[hidden] { display: none; }
.fsm-box { background: var(--fsm-surface-sunken); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 12px; }
.fsm-box h3 { margin: 0; font-size: 19px; }
.fsm-box ol, .fsm-box ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.fsm-box li { display: flex; align-items: flex-start; gap: 12px; font-size: 17px; line-height: 1.4; }
.fsm-box li > i { font-size: 22px; color: var(--fsm-ink-muted); flex-shrink: 0; }
.fsm-box__n { width: 28px; height: 28px; border-radius: 50%; background: var(--fsm-ink); color: #fff; font-size: 15px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: -2px; }

.fsm-ready-foot { display: flex; gap: 12px; flex-wrap: wrap; }

.fsm-failed { width: 100%; max-width: 680px; align-self: center; display: flex; flex-direction: column; align-items: center; gap: 24px; text-align: center; padding: 12px 0; }
.fsm-failed > div { display: flex; flex-direction: column; gap: 10px; }
.fsm-failed p { margin: 0; font-size: 19px; color: var(--fsm-ink-muted); }
.fsm-failed .fsm-actions { width: 100%; }
.fsm-failed .fsm-box { width: 100%; box-sizing: border-box; text-align: left; }
.fsm-failed__contact { font-size: 17px; color: var(--fsm-ink-muted); }
.fsm-failed__contact a { font-weight: 700; color: var(--fsm-primary); }

@media (max-width: 767px) {
    .fsm-result-grid { grid-template-columns: 1fr; row-gap: 18px; }
    .fsm-result-grid > .fsm-preview-panel, .fsm-result-grid > :not(.fsm-preview-panel) { grid-column: 1; grid-row: auto; }
    .fsm-making { grid-template-columns: 96px minmax(0, 1fr); column-gap: 16px; row-gap: 20px; }
    .fsm-making > .fsm-preview-panel { grid-column: 1; grid-row: 1; background: none; padding: 0; }
    .fsm-making > .fsm-making__head { grid-column: 2; grid-row: 1; align-self: center; }
    .fsm-making > :not(.fsm-preview-panel):not(.fsm-making__head) { grid-column: 1 / -1; }
    .fsm-making .fsm-phone { width: 96px; height: 170px; border-width: 4px; border-radius: 9px; }
    .fsm-making__head h2, .fsm-done-head h2, .fsm-failed h2 { font-size: 26px; }
    .fsm-making__head p { font-size: 16px; }
    .fsm-progress__pct { font-size: 26px; }
    .fsm-progress__eta { font-size: 16px; }
    .fsm-progress__track { height: 18px; }
    .fsm-stage { font-size: 17px; }
    .fsm-callout { font-size: 16px; }
    .fsm-making .fsm-btn--secondary { justify-self: stretch; }
    .fsm-ready { display: flex; flex-direction: column; align-items: stretch; }
    .fsm-ready > .fsm-done-head { order: 1; }
    .fsm-ready > .fsm-preview-panel { order: 2; }
    .fsm-ready > .fsm-actions { order: 3; }
    .fsm-ready > .fsm-box { order: 4; }
    .fsm-ready > .fsm-ready-foot { order: 5; }
    .fsm-done-head { gap: 16px; }
    .fsm-done-head p { font-size: 15px; }
    .fsm-disc { width: 52px; height: 52px; font-size: 30px; }
    .fsm-disc--error { width: 60px; height: 60px; }
    .fsm-actions .fsm-btn--hero { height: 64px; font-size: 20px; }
    .fsm-actions .fsm-btn--outline-primary { height: 56px; font-size: 18px; }
    .fsm-box li { font-size: 16px; }
    .fsm-ready-foot { border: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .fsm-ready-foot .fsm-btn { height: 52px; font-size: 16px; padding: 0 8px; }
    .fsm-failed { gap: 20px; padding: 8px 0; }
    .fsm-failed p { font-size: 17px; }
    .fsm-failed__contact { font-size: 16px; }
}

/* ---------- Below-the-fold content (SEO sections, restyled) -------------- */
.fsm-content { width: 100%; max-width: 1000px; margin-top: 56px; color: var(--fsm-ink); }
.fsm-content section { padding-top: 32px; margin-top: 32px; border-top: 1px solid var(--fsm-border); }
.fsm-content h2 { margin: 0 0 20px; font-size: 30px; line-height: 1.2; }
.fsm-content h3 { margin: 28px 0 10px; font-size: 22px; line-height: 1.3; }
.fsm-content p { margin: 0 0 16px; font-size: 18px; line-height: 1.6; color: #2F333C; }
.fsm-content a { color: var(--fsm-primary); text-decoration: underline; text-underline-offset: 3px; }
.fsm-content a.fsm-related-card, .fsm-related a { text-decoration: none; }
.fsm-info { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.fsm-info article { background: var(--fsm-surface); border: 1px solid var(--fsm-border); border-radius: 18px; padding: 22px; }
.fsm-info h3 { margin: 0 0 8px; font-size: 20px; color: var(--fsm-chosen); }
.fsm-info p { font-size: 16px; margin: 0; }
.fsm-faq-q { margin-bottom: 6px !important; font-weight: 700; color: var(--fsm-ink) !important; }
.fsm-related { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }

.fsm-related a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 16px;
    border-radius: 12px;
    border: 1px solid var(--fsm-border);
    background: var(--fsm-surface);
    color: var(--fsm-ink);
    text-decoration: none;
    font-size: 16px;
}

.fsm-related a:hover { border-color: var(--fsm-primary); color: var(--fsm-primary); }
.fsm-related-label { font-size: 14px !important; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--fsm-ink-muted) !important; margin-bottom: 10px !important; }
.fsm-related-card { display: block; padding: 18px; border-radius: 16px; border: 1px solid var(--fsm-border); background: var(--fsm-surface); text-decoration: none; margin-bottom: 24px; max-width: 480px; }
.fsm-related-card h3 { margin: 0 0 4px; font-size: 19px; color: var(--fsm-ink); }
.fsm-related-card p { margin: 0; font-size: 16px; }

@media (max-width: 767px) {
    .fsm-content { padding: 0 16px; box-sizing: border-box; margin-top: 32px; }
    .fsm-content h2 { font-size: 24px; }
    .fsm-content h3 { font-size: 20px; }
    .fsm-content p { font-size: 17px; }
    .fsm-info { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .preview-slide, .draggable-glow, .fsm-stage.is-active .fsm-stage__icon { animation: none !important; }
    .fsm-progress__fill, .fsm-thumb { transition: none; }
}
