/* =====================================================================
   transcription.page — feuille de style
   Concept : le son (champ d'ondes nocturne) devient une page imprimée lumineuse.
   ===================================================================== */

:root {
    /* Nuit */
    --night: #080C26;
    --night-2: #0E1438;
    --night-3: #161E4D;
    --line: rgba(170, 182, 255, 0.14);
    --line-strong: rgba(170, 182, 255, 0.26);
    --text: #ECEEFF;
    --text-2: #A9B0DA;
    --text-3: #727AAE;

    /* Signal (par défaut) — remplacé par la couleur de la plateforme détectée */
    --acc1: #8C7CFF;
    --acc2: #47D7E6;

    /* Page */
    --paper: #F4F5FB;
    --paper-2: #E8EAF5;
    --ink: #151A3E;
    --ink-2: #4E557F;
    --ink-3: #868BAD;
    --mark: #FFE38A;

    --ok: #3BD69B;
    --err: #FF5D73;

    /* Typo */
    --f-ui: "Readex Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
    --f-read: "Fraunces", "Noto Naskh Arabic", Georgia, serif;
    --f-mono: "IBM Plex Mono", ui-monospace, monospace;

    --r-s: 10px;
    --r-m: 16px;
    --r-l: 26px;

    --ease: cubic-bezier(.16, 1, .3, 1);
    --topbar-h: 68px;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--topbar-h) + 16px); }

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(1200px 700px at 50% -10%, #1A2263 0%, transparent 60%),
        radial-gradient(900px 600px at 100% 100%, #120E3A 0%, transparent 60%),
        var(--night);
    color: var(--text);
    font-family: var(--f-ui);
    font-size: 16px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

[dir="rtl"] body { --f-ui: "IBM Plex Sans Arabic", "Readex Pro", system-ui, sans-serif; }
[dir="rtl"] .brand-name { font-family: "Readex Pro", system-ui, sans-serif; }

button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: not-allowed; }
img { display: block; max-width: 100%; }
[hidden] { display: none !important; }

:focus-visible {
    outline: 2px solid var(--acc2);
    outline-offset: 3px;
    border-radius: 8px;
}

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

/* Icônes */
.ico { display: inline-flex; width: 18px; height: 18px; flex: none; }
.ico svg { width: 100%; height: 100%; }
.ico-sm { width: 15px; height: 15px; }
.plogo { display: inline-flex; width: 22px; height: 22px; flex: none; }
.plogo svg { width: 100%; height: 100%; }
.flag { display: inline-flex; width: 24px; height: 16px; border-radius: 3px; overflow: hidden; flex: none; box-shadow: 0 0 0 1px rgba(255,255,255,.18); }
.flag svg { width: 100%; height: 100%; display: block; }

/* =====================================================================
   Fond
   ===================================================================== */
#wave-canvas {
    position: fixed; inset: 0;
    width: 100vw; height: 100vh;
    z-index: 0;
    pointer-events: none;
    transition: opacity 1.2s var(--ease);
}
body.past-hero #wave-canvas { opacity: 0.35; }

.grain {
    position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .07; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

main, .topbar, .footer { position: relative; z-index: 2; }

/* =====================================================================
   En-tête
   ===================================================================== */
.topbar {
    position: sticky; top: 0;
    height: var(--topbar-h);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 clamp(16px, 4vw, 40px);
    z-index: 20;
    transition: background .4s var(--ease), border-color .4s var(--ease), backdrop-filter .4s;
    border-bottom: 1px solid transparent;
}
.topbar.scrolled {
    background: rgba(8, 12, 38, 0.72);
    backdrop-filter: blur(16px) saturate(140%);
    -webkit-backdrop-filter: blur(16px) saturate(140%);
    border-bottom-color: var(--line);
}

.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); }
.brand-mark {
    display: inline-flex; align-items: center; gap: 3px; height: 30px; padding: 0 7px;
    border-radius: 10px; background: linear-gradient(140deg, var(--night-3), #222B6A);
    box-shadow: inset 0 0 0 1px var(--line-strong);
}
.brand-mark i {
    display: block; width: 3px; border-radius: 3px;
    background: linear-gradient(var(--acc2), var(--acc1));
    transition: background .6s;
}
.brand-mark i:nth-child(1) { height: 8px; }
.brand-mark i:nth-child(2) { height: 16px; }
.brand-mark i:nth-child(3) { height: 11px; }
.brand-mark i:nth-child(4) { height: 18px; }
.brand-mark i:nth-child(5) { height: 7px; }
.brand:hover .brand-mark i, body:has(.primary-btn.busy) .brand-mark i { animation: bar-dance .8s ease-in-out infinite; }
.brand-mark i:nth-child(2n) { animation-delay: -.3s !important; }
.brand-mark i:nth-child(3n) { animation-delay: -.55s !important; }

.brand-name { font-weight: 600; font-size: 1.06rem; letter-spacing: -0.01em; direction: ltr; }
.brand-tld { color: var(--text-3); font-weight: 400; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

.icon-btn {
    position: relative;
    display: inline-flex; align-items: center; gap: 8px;
    height: 40px; padding: 0 14px;
    border-radius: 12px;
    color: var(--text-2);
    background: rgba(255,255,255,.03);
    box-shadow: inset 0 0 0 1px var(--line);
    font-size: .9rem;
    transition: color .25s, background .25s, box-shadow .25s, transform .25s var(--ease);
}
.icon-btn:hover { color: var(--text); background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px var(--line-strong); }
.icon-btn:active { transform: scale(.96); }
.icon-btn.icon-only { width: 40px; padding: 0; justify-content: center; }
.lang-code { font-weight: 500; font-size: .82rem; letter-spacing: .04em; }

.count-dot {
    min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
    display: inline-grid; place-items: center;
    font-size: .72rem; font-weight: 600; color: var(--night);
    background: linear-gradient(120deg, var(--acc2), var(--acc1));
}

/* Menus */
.lang-switch, .menu-wrap { position: relative; }
.menu {
    position: absolute; top: calc(100% + 8px); inset-inline-end: 0;
    min-width: 230px; margin: 0; padding: 6px; list-style: none;
    background: rgba(17, 23, 64, .96);
    backdrop-filter: blur(18px);
    border-radius: 14px;
    box-shadow: 0 0 0 1px var(--line-strong), 0 24px 60px -12px rgba(0,0,0,.6);
    opacity: 0; visibility: hidden; transform: translateY(-6px) scale(.98); transform-origin: top right;
    transition: opacity .22s var(--ease), transform .3s var(--ease), visibility .22s;
    z-index: 30;
}
[dir="rtl"] .menu { transform-origin: top left; }
.menu.open { opacity: 1; visibility: visible; transform: none; }
.menu button {
    width: 100%; display: flex; align-items: center; gap: 12px;
    padding: 10px 12px; border-radius: 9px; text-align: start;
    color: var(--text-2); font-size: .92rem;
    transition: background .2s, color .2s;
}
.menu button:hover, .menu button:focus-visible { background: rgba(255,255,255,.07); color: var(--text); outline: none; }
.menu-label { flex: 1; }
.menu-hint { font-size: .75rem; color: var(--text-3); }
.menu button.current { color: var(--text); background: rgba(140,124,255,.14); }
.menu button.current .menu-hint::after { content: " ✓"; color: var(--acc2); }
.fmt {
    width: 42px; text-align: center; padding: 3px 0; border-radius: 6px;
    font: 500 .7rem var(--f-mono); color: var(--text);
    background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px var(--line);
}

/* =====================================================================
   Héros
   ===================================================================== */
.hero {
    min-height: calc(100vh - var(--topbar-h));
    display: flex; align-items: center; justify-content: center;
    padding: clamp(24px, 6vh, 72px) 16px clamp(80px, 14vh, 160px);
}
.hero-inner { width: 100%; max-width: 860px; text-align: center; }

.hero-title {
    margin: 0 auto;
    max-width: 15ch;
    font-size: clamp(2.5rem, 7.2vw, 5.6rem);
    line-height: 1.02;
    font-weight: 500;
    letter-spacing: -0.035em;
    text-wrap: balance;
    color: #fff;
}
[dir="rtl"] .hero-title { letter-spacing: 0; line-height: 1.3; font-weight: 600; max-width: 13ch; font-size: clamp(2.4rem, 6.6vw, 5rem); }
.hero-title .w { display: inline-block; overflow: hidden; padding-bottom: .08em; margin-bottom: -.08em; vertical-align: top; }
.hero-title .wi {
    display: inline-block;
    background: linear-gradient(180deg, #FFFFFF 35%, #AEB4E8 110%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
body:not(.ready) .hero-inner { visibility: hidden; }

.hero-sub {
    max-width: 56ch; margin: 22px auto 40px;
    font-size: clamp(1rem, 1.6vw, 1.18rem);
    color: var(--text-2);
    font-weight: 300;
    text-wrap: pretty;
}

/* Omnibar */
.omnibar {
    --acc1: #8C7CFF; --acc2: #47D7E6;
    position: relative;
    text-align: start;
    border-radius: var(--r-l);
    padding: 10px;
    background: rgba(14, 20, 58, .72);
    backdrop-filter: blur(20px) saturate(150%);
    -webkit-backdrop-filter: blur(20px) saturate(150%);
    box-shadow: 0 30px 80px -30px rgba(0,0,0,.8), inset 0 1px 0 rgba(255,255,255,.06);
    transition: box-shadow .5s var(--ease), transform .5s var(--ease);
}
.omnibar::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1px;
    background: linear-gradient(120deg, color-mix(in srgb, var(--acc1) 70%, transparent), rgba(255,255,255,.08) 40%, rgba(255,255,255,.08) 60%, color-mix(in srgb, var(--acc2) 70%, transparent));
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    pointer-events: none;
    transition: background .6s;
}
.omnibar-glow {
    position: absolute; inset: -30px -10px auto; height: 120px; z-index: -1;
    background: radial-gradient(closest-side, color-mix(in srgb, var(--acc1) 45%, transparent), transparent);
    filter: blur(30px); opacity: .35;
    transition: opacity .6s, background .6s;
}
.omnibar.focus .omnibar-glow, .omnibar:not([data-platform="none"]) .omnibar-glow { opacity: .75; }
.omnibar.focus { box-shadow: 0 30px 90px -26px color-mix(in srgb, var(--acc1) 50%, rgba(0,0,0,.7)), inset 0 1px 0 rgba(255,255,255,.08); }

.omnibar[data-platform="youtube"] { --acc1: #FF2D4F; --acc2: #FF8A5C; }
.omnibar[data-platform="instagram"] { --acc1: #F9A34A; --acc2: #C13584; }
.omnibar[data-platform="tiktok"] { --acc1: #25F4EE; --acc2: #FE2C55; }
body:has(.omnibar[data-platform="youtube"]) { --acc1: #FF2D4F; --acc2: #FF8A5C; }
body:has(.omnibar[data-platform="instagram"]) { --acc1: #F9A34A; --acc2: #C13584; }
body:has(.omnibar[data-platform="tiktok"]) { --acc1: #25F4EE; --acc2: #FE2C55; }

.omnibar-row { display: flex; align-items: center; gap: 6px; }
.platform-slot {
    width: 52px; height: 52px; flex: none;
    display: grid; place-items: center;
    border-radius: 16px;
    color: var(--text-3);
    background: rgba(255,255,255,.04);
    box-shadow: inset 0 0 0 1px var(--line);
}
.platform-slot svg { width: 26px; height: 26px; }
.platform-slot .ico svg, .platform-slot > svg[stroke] { width: 22px; height: 22px; }

#url-input {
    flex: 1; min-width: 0; height: 52px;
    background: transparent; border: 0; outline: none;
    font-size: 1.05rem; padding: 0 8px;
    color: var(--text);
    text-align: left;
}
#url-input::placeholder { color: var(--text-3); }

.ghost-btn {
    height: 44px; min-width: 44px; padding: 0 12px;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    border-radius: 12px; color: var(--text-2); font-size: .92rem;
    transition: background .2s, color .2s, transform .2s var(--ease);
}
.ghost-btn:hover { background: rgba(255,255,255,.07); color: var(--text); }
.ghost-btn:active { transform: scale(.95); }
.paste-btn { box-shadow: inset 0 0 0 1px var(--line); }

.primary-btn {
    position: relative; overflow: hidden; isolation: isolate;
    height: 52px; padding: 0 26px;
    border-radius: 16px;
    color: #fff; font-weight: 600; font-size: 1rem;
    background: linear-gradient(120deg, var(--acc1), var(--acc2));
    box-shadow: 0 10px 30px -10px color-mix(in srgb, var(--acc1) 80%, transparent), inset 0 1px 0 rgba(255,255,255,.35);
    transition: box-shadow .4s var(--ease), filter .3s, background .6s;
    flex: none;
}
.primary-btn-fill {
    position: absolute; inset: 0; z-index: -1;
    background: radial-gradient(140px circle at var(--mx, 50%) var(--my, 50%), rgba(255,255,255,.45), transparent 60%);
    opacity: 0; transition: opacity .3s;
}
.primary-btn:hover .primary-btn-fill { opacity: 1; }
.primary-btn:hover { box-shadow: 0 16px 40px -10px color-mix(in srgb, var(--acc1) 90%, transparent), inset 0 1px 0 rgba(255,255,255,.4); }
.primary-btn-label { display: inline-flex; align-items: center; gap: 9px; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
.primary-btn.busy { filter: saturate(.8); }
.primary-btn.busy .ico { animation: spin 1.4s linear infinite; }
.primary-btn.busy::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent);
    animation: shimmer 1.3s infinite;
}

.omnibar-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 10px 10px 2px 14px;
    font-size: .84rem; color: var(--text-3);
}
.detect-label { transition: color .3s; }
.omnibar:not([data-platform="none"]) .detect-label { color: var(--text); }
.omnibar:not([data-platform="none"]):not([data-platform="unknown"]) .detect-label::before {
    content: ""; display: inline-block; width: 7px; height: 7px; margin-inline-end: 8px; border-radius: 50%;
    background: var(--ok); box-shadow: 0 0 0 3px rgba(59,214,155,.2); vertical-align: 1px;
}

.text-btn {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 10px; border-radius: 9px;
    color: var(--text-2); font-size: .85rem;
    transition: color .2s, background .2s;
}
.text-btn:hover { color: var(--text); background: rgba(255,255,255,.06); }

/* Réglages */
.settings { height: 0; opacity: 0; overflow: hidden; }
.settings.open { height: auto; opacity: 1; }
.settings-grid {
    display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px;
    padding: 16px 12px 12px;
    margin-top: 10px;
    border-top: 1px solid var(--line);
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: .78rem; color: var(--text-3); }
.field select {
    appearance: none; height: 44px; padding: 0 36px 0 12px;
    border-radius: 11px; border: 0;
    background: rgba(255,255,255,.05) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23A9B0DA' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center / 14px;
    box-shadow: inset 0 0 0 1px var(--line);
    font-size: .9rem; cursor: pointer;
}
[dir="rtl"] .field select { padding: 0 12px 0 36px; background-position: left 12px center; }
.field select:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.field select option { background: var(--night-2); }
.toggle { grid-column: 1 / -1; display: inline-flex; align-items: center; gap: 12px; font-size: .9rem; color: var(--text-2); cursor: pointer; }
.toggle input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { width: 40px; height: 24px; border-radius: 12px; background: rgba(255,255,255,.1); box-shadow: inset 0 0 0 1px var(--line); position: relative; transition: background .3s; flex: none; }
.toggle-thumb { position: absolute; top: 3px; inset-inline-start: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .35s var(--ease); }
.toggle input:checked + .toggle-track { background: linear-gradient(120deg, var(--acc1), var(--acc2)); }
.toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(16px); }
[dir="rtl"] .toggle input:checked + .toggle-track .toggle-thumb { transform: translateX(-16px); }
.toggle input:focus-visible + .toggle-track { outline: 2px solid var(--acc2); outline-offset: 2px; }

/* Exemples */
.platform-row { margin-top: 40px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.platform-row-label { font-size: .88rem; color: var(--text-3); }
.demo-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.demo-chip {
    display: inline-flex; align-items: center; gap: 12px;
    padding: 9px 18px 9px 10px;
    border-radius: 16px;
    background: rgba(255,255,255,.035);
    box-shadow: inset 0 0 0 1px var(--line);
    text-align: start;
    transition: background .3s, box-shadow .3s, transform .4s var(--ease);
}
[dir="rtl"] .demo-chip { padding: 9px 10px 9px 18px; }
.demo-chip .plogo {
    width: 38px; height: 38px; padding: 8px; border-radius: 11px;
    background: rgba(255,255,255,.06);
    transition: transform .5s var(--ease);
}
.demo-chip[data-platform="tiktok"] .plogo { background: #000; }
.demo-text { display: flex; flex-direction: column; line-height: 1.25; }
.demo-text strong { font-weight: 500; font-size: .92rem; }
.demo-text small { font-size: .78rem; color: var(--text-3); }
.demo-chip:hover { background: rgba(255,255,255,.07); box-shadow: inset 0 0 0 1px var(--line-strong); transform: translateY(-2px); }
.demo-chip:hover .plogo { transform: rotate(-8deg) scale(1.08); }
.demo-chip.lit { box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--acc1) 70%, transparent), 0 10px 30px -14px var(--acc1); background: rgba(255,255,255,.06); }
.demo-chip:disabled { opacity: .5; transform: none; }

/* Progression */
.progress {
    overflow: hidden;
    margin-top: 28px;
    padding: 22px 24px;
    border-radius: var(--r-m);
    background: rgba(14, 20, 58, .6);
    backdrop-filter: blur(16px);
    box-shadow: inset 0 0 0 1px var(--line);
    text-align: start;
}
.progress-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 12px; }
.progress-title { font-weight: 500; }
.progress-pct { font-family: var(--f-mono); color: var(--text-2); font-size: .9rem; font-variant-numeric: tabular-nums; }
.progress-bar { height: 4px; border-radius: 4px; background: rgba(255,255,255,.08); overflow: hidden; }
.progress-bar span {
    display: block; height: 100%; transform: scaleX(0); transform-origin: left;
    background: linear-gradient(90deg, var(--acc1), var(--acc2));
    transition: transform .4s var(--ease);
    box-shadow: 0 0 16px var(--acc1);
}
[dir="rtl"] .progress-bar span { transform-origin: right; }
.steps {
    list-style: none; margin: 20px 0 0; padding: 0;
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
}
.step {
    position: relative; display: flex; align-items: center; gap: 10px;
    font-size: .84rem; color: var(--text-3);
    transition: color .4s;
}
.step-dot {
    position: relative; width: 30px; height: 30px; flex: none; border-radius: 50%;
    display: grid; place-items: center;
    background: rgba(255,255,255,.05); box-shadow: inset 0 0 0 1px var(--line);
    transition: background .4s, color .4s, box-shadow .4s;
}
.step.active { color: var(--text); }
.step.active .step-dot { color: #fff; background: color-mix(in srgb, var(--acc1) 35%, transparent); box-shadow: inset 0 0 0 1px var(--acc1); }
.step.active .step-dot::after {
    content: ""; position: absolute; inset: 0; border-radius: 50%;
    box-shadow: 0 0 0 1px var(--acc1); animation: ping 1.3s infinite;
}
.step.done { color: var(--text-2); }
.step.done .step-dot { color: var(--night); background: var(--ok); box-shadow: none; }
.progress.done .progress-title { color: var(--ok); }

/* =====================================================================
   Résultat
   ===================================================================== */
.result {
    max-width: 1260px; margin: 0 auto;
    padding: 24px clamp(16px, 3vw, 32px) 80px;
    scroll-margin-top: calc(var(--topbar-h) + 8px);
}
.notice {
    display: flex; gap: 12px; align-items: flex-start;
    margin-bottom: 20px; padding: 14px 18px;
    border-radius: var(--r-m);
    background: rgba(255, 197, 90, .08);
    box-shadow: inset 0 0 0 1px rgba(255, 197, 90, .3);
    color: #FFD991; font-size: .9rem;
}
.notice p { margin: 0; }

.result-grid {
    display: grid;
    grid-template-columns: 320px minmax(0, 1fr);
    gap: clamp(20px, 3vw, 40px);
    align-items: start;
}

/* Colonne média */
.media { position: sticky; top: calc(var(--topbar-h) + 16px); display: flex; flex-direction: column; }
.media-thumb {
    position: relative; aspect-ratio: 4 / 3; border-radius: var(--r-m); overflow: hidden;
    background: linear-gradient(140deg, var(--night-3), #2A2370);
    box-shadow: 0 0 0 1px var(--line), 0 30px 60px -30px rgba(0,0,0,.9);
}
.media-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s var(--ease); }
.media-thumb:hover img { transform: scale(1.05); }
.media-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 50%, rgba(8,12,38,.75)); pointer-events: none; }
.media-thumb.no-thumb img { display: none; }
.media-thumb.no-thumb::before {
    content: ""; position: absolute; inset: 0;
    background: radial-gradient(circle at 30% 30%, color-mix(in srgb, var(--acc1) 50%, transparent), transparent 60%),
                radial-gradient(circle at 80% 80%, color-mix(in srgb, var(--acc2) 40%, transparent), transparent 55%);
}
.media-badge {
    position: absolute; top: 12px; inset-inline-start: 12px; z-index: 2;
    display: inline-flex; align-items: center; gap: 7px;
    padding: 5px 10px 5px 6px; border-radius: 10px;
    background: rgba(8,12,38,.7); backdrop-filter: blur(10px);
    font-size: .8rem; font-weight: 500;
}
.media-badge .plogo { width: 20px; height: 20px; }
.media-duration {
    position: absolute; bottom: 12px; inset-inline-end: 12px; z-index: 2;
    padding: 3px 8px; border-radius: 7px;
    background: rgba(8,12,38,.75); font: 500 .78rem var(--f-mono);
}
.media-title { margin: 18px 0 4px; font-size: 1.12rem; line-height: 1.35; font-weight: 500; text-wrap: balance; }
.media-author { margin: 0; color: var(--text-3); font-size: .9rem; }
.media-link {
    align-self: flex-start; margin-top: 10px;
    display: inline-flex; align-items: center; gap: 6px;
    color: var(--acc2); font-size: .88rem; text-decoration: none;
}
.media-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.stats {
    display: grid; grid-template-columns: 1fr 1fr; gap: 1px;
    margin: 22px 0 18px;
    border-radius: var(--r-m); overflow: hidden;
    background: var(--line);
    box-shadow: 0 0 0 1px var(--line);
}
.stat { margin: 0; padding: 14px 16px; background: rgba(12, 17, 50, .92); }
.stat dt { font-size: .76rem; color: var(--text-3); margin-bottom: 2px; }
.stat dd { margin: 0; font-size: 1.45rem; font-weight: 500; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat dd small { font-size: .74rem; color: var(--text-3); font-weight: 400; letter-spacing: 0; }

.outline-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 46px; border-radius: 13px;
    box-shadow: inset 0 0 0 1px var(--line-strong);
    color: var(--text-2); font-size: .92rem;
    transition: background .25s, color .25s;
}
.outline-btn:hover { background: rgba(255,255,255,.06); color: var(--text); }

/* Barre d'outils */
.sheet-wrap { perspective: 1400px; min-width: 0; }
.toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    margin-bottom: 14px;
}
.tabs {
    position: relative; display: inline-flex; padding: 4px;
    border-radius: 14px; background: rgba(255,255,255,.04);
    box-shadow: inset 0 0 0 1px var(--line);
    max-width: 100%; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab-ink {
    position: absolute; top: 4px; left: 0; bottom: 4px; width: 0;
    border-radius: 10px;
    background: linear-gradient(120deg, color-mix(in srgb, var(--acc1) 40%, var(--night-3)), color-mix(in srgb, var(--acc2) 30%, var(--night-3)));
    box-shadow: inset 0 0 0 1px rgba(255,255,255,.14), 0 6px 18px -8px var(--acc1);
}
.tab {
    position: relative; z-index: 1;
    height: 38px; padding: 0 16px; border-radius: 10px;
    color: var(--text-3); font-size: .9rem; white-space: nowrap;
    transition: color .3s;
}
.tab:hover { color: var(--text-2); }
.tab.active { color: #fff; }

.toolbar-actions { display: flex; gap: 8px; }
.tool-btn {
    height: 42px; padding: 0 16px;
    display: inline-flex; align-items: center; gap: 8px;
    border-radius: 12px; font-size: .9rem; color: var(--text);
    background: rgba(255,255,255,.05);
    box-shadow: inset 0 0 0 1px var(--line-strong);
    transition: background .25s, transform .2s var(--ease), box-shadow .3s;
}
.tool-btn:hover { background: rgba(255,255,255,.1); }
.tool-btn:active { transform: scale(.96); }
.tool-btn.primary {
    color: var(--night); font-weight: 600;
    background: #fff;
    box-shadow: 0 8px 24px -10px rgba(255,255,255,.4);
}
.tool-btn.primary:hover { background: #EDEFFF; }
#btn-copy { border-start-end-radius: 0; border-end-end-radius: 0; }
.tool-btn.split {
    padding: 0 10px; margin-inline-start: -8px;
    border-start-start-radius: 0; border-end-start-radius: 0;
    border-inline-start: 1px solid rgba(8,12,38,.15);
}
.menu-wrap { display: inline-flex; }
.tool-btn.copied { background: var(--ok); color: var(--night); }
.tool-btn.copied .ico { animation: none; }

/* La page */
.sheet {
    position: relative;
    background: var(--paper);
    color: var(--ink);
    border-radius: 22px;
    min-height: 420px;
    box-shadow:
        0 0 0 1px rgba(255,255,255,.6) inset,
        0 2px 0 rgba(255,255,255,.9) inset,
        0 50px 120px -40px rgba(0,0,0,.9),
        0 0 80px -30px color-mix(in srgb, var(--acc1) 60%, transparent);
    transform-origin: 50% 0;
}
.sheet::before {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; opacity: .5;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.75' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.08 0 0 0 0 0.1 0 0 0 0 0.25 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.sheet-bar {
    position: sticky; top: var(--topbar-h); z-index: 3;
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 14px clamp(16px, 3vw, 28px);
    background: color-mix(in srgb, var(--paper) 92%, transparent);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--paper-2);
    border-radius: 22px 22px 0 0;
}
.search {
    flex: 1; min-width: 200px; max-width: 360px;
    display: flex; align-items: center; gap: 8px;
    height: 40px; padding: 0 12px; border-radius: 11px;
    background: #fff; box-shadow: inset 0 0 0 1px var(--paper-2), 0 1px 2px rgba(21,26,62,.05);
    color: var(--ink-3);
    transition: box-shadow .25s;
}
.search:focus-within { box-shadow: inset 0 0 0 1.5px var(--ink-2), 0 0 0 4px rgba(21,26,62,.06); color: var(--ink); }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: none; background: none; color: var(--ink); font-size: .92rem; }
.search input::placeholder { color: var(--ink-3); }
.search-count { font-size: .75rem; color: var(--ink-2); white-space: nowrap; }
.search-count.none { color: #C2334A; }

.seg-toggle {
    display: inline-flex; padding: 3px; border-radius: 11px;
    background: var(--paper-2);
}
.seg-toggle button {
    display: inline-flex; align-items: center; gap: 6px;
    height: 34px; padding: 0 12px; border-radius: 8px;
    color: var(--ink-2); font-size: .84rem;
    transition: background .25s, color .25s, box-shadow .25s;
}
.seg-toggle button:hover { color: var(--ink); }
.seg-toggle button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(21,26,62,.12); }

.sheet:not([data-tab="text"]):not([data-tab="segments"]) .sheet-bar .search { visibility: hidden; }
.sheet:not([data-tab="text"]) #layout-toggle { visibility: hidden; }
.sheet[data-tab="subs"] .sheet-bar, .sheet[data-tab="summary"] .sheet-bar { display: none; }

.view { display: none; position: relative; z-index: 1; padding: clamp(22px, 4vw, 48px) clamp(18px, 5vw, 64px) clamp(32px, 5vw, 56px); }
.view.active { display: block; }

/* Texte en lecture */
.reading {
    max-width: 68ch;
    font-family: var(--f-read);
    font-size: clamp(1.08rem, 1.5vw, 1.24rem);
    line-height: 1.8;
    font-variation-settings: "opsz" 20;
    color: var(--ink);
}
.reading:dir(rtl), .reading[dir="rtl"] { font-size: clamp(1.2rem, 1.7vw, 1.38rem); line-height: 2; }
.reading .para { margin: 0 0 1.25em; text-wrap: pretty; }
.reading .para:first-child::first-letter {
    font-size: 3.3em; float: left; line-height: .9; padding: .06em .1em 0 0;
    font-weight: 500; color: var(--ink);
}
.reading:dir(rtl) .para:first-child::first-letter { float: none; font-size: inherit; padding: 0; }
.reading .line { border-radius: 4px; transition: opacity .3s, background .3s; }
.reading .line:hover { background: rgba(21,26,62,.05); }
.reading.lines .line { display: block; padding: 2px 0; }
.reading.lines .para { padding-inline-start: 16px; border-inline-start: 2px solid var(--paper-2); }
.reading.lines .para:first-child::first-letter { font-size: inherit; float: none; padding: 0; font-weight: inherit; }
.reading .line.dim, .seg.dim { opacity: .3; }
mark { background: var(--mark); color: var(--ink); border-radius: 3px; padding: 0 2px; box-shadow: 0 0 0 1px rgba(200,150,0,.2); }
.empty { color: var(--ink-3); font-family: var(--f-ui); font-size: .95rem; }

/* Segments */
.segments { list-style: none; margin: 0; padding: 0; max-width: 78ch; }
.seg {
    position: relative;
    display: grid; grid-template-columns: 64px 1fr 32px; gap: 14px; align-items: baseline;
    padding: 10px 10px; margin: 0 -10px; border-radius: 10px;
    transition: background .2s, opacity .3s;
}
.seg:hover { background: rgba(21,26,62,.045); }
.seg.flash { animation: flash .7s ease-out; }
.stamp {
    font: 500 .8rem var(--f-mono); color: var(--ink-2);
    padding: 3px 7px; border-radius: 6px;
    background: var(--paper-2); text-align: center; text-decoration: none;
    direction: ltr;
}
a.stamp:hover { background: var(--ink); color: var(--paper); }
.seg-text { font-family: var(--f-read); font-size: 1.06rem; line-height: 1.65; }
.seg-copy {
    width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px;
    color: var(--ink-3); opacity: 0; transition: opacity .2s, background .2s, color .2s;
    align-self: center;
}
.seg-copy svg { width: 15px; height: 15px; }
.seg:hover .seg-copy, .seg-copy:focus-visible { opacity: 1; }
.seg-copy:hover { background: var(--paper-2); color: var(--ink); }

/* Résumé */
.summary { max-width: 66ch; }
.summary h3 { margin: 0 0 10px; font-size: .86rem; font-weight: 500; color: var(--ink-3); }
.summary h3:not(:first-child) { margin-top: 34px; }
.summary-lead { margin: 0; font-family: var(--f-read); font-size: clamp(1.25rem, 2vw, 1.55rem); line-height: 1.5; font-weight: 400; text-wrap: pretty; }
.takeaways { list-style: none; margin: 0; padding: 0; }
.takeaways li {
    position: relative; padding: 12px 0; padding-inline-start: 28px;
    border-bottom: 1px solid var(--paper-2);
    font-family: var(--f-read); font-size: 1.05rem; line-height: 1.55;
}
.takeaways li::before {
    content: ""; position: absolute; inset-inline-start: 4px; top: 1.15em;
    width: 9px; height: 9px; border-radius: 3px; transform: rotate(45deg);
    background: linear-gradient(120deg, var(--acc1), var(--acc2));
}
.topics { display: flex; flex-wrap: wrap; gap: 8px; }
.topic { padding: 6px 12px; border-radius: 9px; background: var(--paper-2); color: var(--ink-2); font-size: .86rem; }

/* Sous-titres */
.subs-switch { margin-bottom: 16px; }
.subs-code {
    margin: 0; padding: 20px 22px; border-radius: 14px;
    background: var(--ink); color: #D7DBFF;
    font: .84rem/1.7 var(--f-mono);
    max-height: 560px; overflow: auto; white-space: pre-wrap;
    text-align: left;
}

/* =====================================================================
   Pied de page
   ===================================================================== */
.footer {
    display: flex; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap;
    padding: 36px 16px 44px; color: var(--text-3); font-size: .84rem;
}
.footer-logos { display: inline-flex; gap: 10px; }
.footer-logos .plogo { width: 18px; height: 18px; opacity: .75; filter: saturate(.6); transition: opacity .3s, filter .3s; }
.footer:hover .footer-logos .plogo { opacity: 1; filter: none; }

/* =====================================================================
   Historique
   ===================================================================== */
.drawer-scrim {
    position: fixed; inset: 0; z-index: 40;
    background: rgba(4, 6, 20, .55); backdrop-filter: blur(4px);
    opacity: 0; visibility: hidden; transition: opacity .35s, visibility .35s;
}
.drawer-scrim.open { opacity: 1; visibility: visible; }
.drawer {
    position: fixed; top: 0; bottom: 0; inset-inline-end: 0; z-index: 41;
    width: min(420px, 92vw);
    display: flex; flex-direction: column;
    background: rgba(12, 17, 50, .97);
    box-shadow: -1px 0 0 var(--line), -30px 0 80px -20px rgba(0,0,0,.7);
    transform: translateX(105%);
    transition: transform .55s var(--ease);
}
[dir="rtl"] .drawer { transform: translateX(-105%); box-shadow: 1px 0 0 var(--line), 30px 0 80px -20px rgba(0,0,0,.7); }
.drawer.open, [dir="rtl"] .drawer.open { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 18px 18px 14px 22px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { flex: 1; margin: 0; font-size: 1.1rem; font-weight: 500; }
.drawer-list { flex: 1; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 4px; }
.drawer-empty { margin: auto; max-width: 260px; text-align: center; color: var(--text-3); font-size: .9rem; }
.drawer-empty .ico { width: 34px; height: 34px; margin-bottom: 10px; opacity: .6; }
.h-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px; border-radius: 12px; cursor: pointer;
    transition: background .2s;
}
.h-item:hover, .h-item:focus-visible { background: rgba(255,255,255,.06); }
.h-thumb { position: relative; width: 64px; height: 48px; flex: none; border-radius: 9px; overflow: hidden; background: var(--night-3); }
.h-thumb img { width: 100%; height: 100%; object-fit: cover; }
.h-logo { position: absolute; bottom: 3px; inset-inline-end: 3px; width: 18px; height: 18px; padding: 2px; border-radius: 5px; background: rgba(8,12,38,.8); display: grid; }
.h-logo svg { width: 100%; height: 100%; }
.h-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.h-title { font-size: .9rem; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.h-meta { font-size: .76rem; color: var(--text-3); display: inline-flex; align-items: center; gap: 8px; }
.h-meta .sep { width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.h-del { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; color: var(--text-3); opacity: 0; transition: opacity .2s, background .2s, color .2s; }
.h-del svg { width: 16px; height: 16px; }
.h-item:hover .h-del, .h-del:focus-visible { opacity: 1; }
.h-del:hover { background: rgba(255,93,115,.12); color: var(--err); }

/* =====================================================================
   Toast
   ===================================================================== */
.toast {
    position: fixed; left: 50%; bottom: 28px; z-index: 60;
    display: flex; align-items: center; gap: 10px;
    max-width: min(560px, calc(100vw - 32px));
    padding: 10px 18px 10px 10px; border-radius: 14px;
    background: rgba(17, 23, 64, .96); backdrop-filter: blur(14px);
    box-shadow: 0 0 0 1px var(--line-strong), 0 20px 50px -12px rgba(0,0,0,.7);
    font-size: .9rem;
    transform: translate(-50%, 140%); opacity: 0;
    transition: transform .55s var(--ease), opacity .35s;
}
[dir="rtl"] .toast { padding: 10px 10px 10px 18px; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast-icon { width: 28px; height: 28px; flex: none; border-radius: 9px; display: grid; place-items: center; }
.toast-icon svg { width: 16px; height: 16px; }
.toast-icon.ok { background: rgba(59,214,155,.16); color: var(--ok); }
.toast-icon.error { background: rgba(255,93,115,.16); color: var(--err); }
.toast-icon.info { background: rgba(140,124,255,.18); color: #B9AFFF; }

/* =====================================================================
   Adaptatif
   ===================================================================== */
@media (max-width: 1020px) {
    .result-grid { grid-template-columns: 1fr; }
    .media {
        position: static;
        display: grid; grid-template-columns: 180px 1fr; column-gap: 20px; align-items: start;
    }
    .media-thumb { grid-row: span 4; }
    .media-title { margin-top: 0; }
    .stats { grid-column: 1 / -1; grid-template-columns: repeat(4, 1fr); }
    .outline-btn { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
    :root { --topbar-h: 60px; }
    .btn-text, .lang-code { display: none; }
    .topbar-actions { gap: 6px; }
    .brand { gap: 9px; }
    .brand-name { font-size: .98rem; }
    .media-badge #media-platform { display: none; }
    .media-badge { padding: 5px; }
    .stat { padding: 12px 14px; }
    .stat dd { font-size: 1.25rem; }
    #btn-history { width: 40px; padding: 0; justify-content: center; }
    #btn-history .count-dot { position: absolute; top: -5px; inset-inline-end: -5px; min-width: 18px; height: 18px; font-size: .66rem; }
    .lang-btn { padding: 0 10px; }

    .hero { align-items: flex-start; padding-top: 36px; }
    .hero-sub { margin-bottom: 28px; }
    .omnibar { padding: 8px; border-radius: 22px; }
    .omnibar-row { flex-wrap: wrap; }
    .platform-slot { width: 46px; height: 46px; }
    #url-input { height: 46px; flex: 1 1 calc(100% - 60px); }
    .omnibar-row:has(#btn-clear:not([hidden])) #url-input { flex-basis: calc(100% - 110px); }
    .paste-btn { order: 3; flex: 1; height: 48px; }
    .primary-btn { order: 4; flex: 2; height: 48px; padding: 0 16px; }
    .omnibar-foot { flex-direction: column; align-items: flex-start; gap: 4px; padding: 10px 6px 2px; }
    .settings-grid { grid-template-columns: 1fr; }
    .demo-list { flex-direction: column; width: 100%; }
    .demo-chip { width: 100%; }
    .steps { grid-template-columns: 1fr 1fr; }

    .media { grid-template-columns: 110px 1fr; column-gap: 14px; }
    .media-thumb { grid-row: span 3; aspect-ratio: 1; }
    .media-title { font-size: 1rem; }
    .stats { grid-template-columns: 1fr 1fr; }
    .toolbar { flex-direction: column; align-items: stretch; }
    .tabs { width: 100%; }
    .tab { flex: 1; padding: 0 10px; font-size: .85rem; }
    .toolbar-actions { justify-content: stretch; }
    .toolbar-actions .menu-wrap { flex: 1; }
    .toolbar-actions .menu-wrap .tool-btn:not(.split) { flex: 1; justify-content: center; }
    .search { max-width: none; min-width: 0; flex-basis: 100%; }
    .seg-toggle { width: 100%; }
    .seg-toggle button { flex: 1; justify-content: center; }
    .seg { grid-template-columns: 56px 1fr; }
    .seg-copy { display: none; }
    .sheet-bar { top: var(--topbar-h); }
    .reading .para:first-child::first-letter { font-size: 2.6em; }
}
