body.app { display: flex; min-height: 100vh; }
.small { font-size: 13px; }
.center { text-align: center; }
.mono { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--muted); white-space: nowrap; }
.link-sm { color: var(--muted); font-size: 13px; text-decoration: underline; text-underline-offset: 3px; }
.link-sm:hover { color: var(--text); }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* Sidebar */
.sidebar { width: 240px; flex-shrink: 0; position: sticky; top: 0; height: 100vh; background: var(--bg2); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 24px; }
.sidebar .logo { padding: 0 8px; }
.side-nav { display: grid; gap: 4px; }
.side-nav button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; color: var(--muted); font-weight: 600; text-align: left; }
.side-nav button:hover { background: var(--card); color: var(--text); }
.side-nav button.active { background: var(--card2); color: var(--text); }
.side-nav .lock { margin-left: auto; }
.side-bottom { margin-top: auto; display: grid; gap: 12px; }
.credit-box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: grid; gap: 8px; }
.cb-row { display: flex; justify-content: space-between; font-size: 14px; }
.bar { height: 6px; border-radius: 99px; background: #23232f; overflow: hidden; position: relative; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: 99px; transition: width .3s; }
.bar.big { height: 10px; }
.bar s { position: absolute; top: 0; height: 100%; background: repeating-linear-gradient(45deg, #ff4655, #ff4655 4px, #b3202c 4px, #b3202c 8px); text-decoration: none; }

.main { flex: 1; min-width: 0; padding: 28px clamp(16px, 3vw, 40px) 60px; }
.view { max-width: 1240px; margin: 0 auto; }

/* Accueil */
.home-hero { text-align: center; padding: 50px 0 40px; background: radial-gradient(520px 200px at 50% 0%, rgba(145,70,255,.22), transparent); border-radius: 28px; }
.home-hero h1 { font-size: clamp(28px, 3.4vw, 42px); font-weight: 900; letter-spacing: -.03em; margin-bottom: 8px; }
.link-box.big { margin: 26px auto 0; max-width: 720px; align-items: center; }
.plat-ico { font-size: 20px; padding-left: 8px; }
.home-alt { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.drop-hint { margin-top: 12px; font-size: 13px; }
.sec-row { display: flex; align-items: baseline; gap: 12px; margin: 34px 0 16px; }
.sec-row h2 { font-size: 22px; }
.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.proj { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; cursor: pointer; transition: border-color .15s, transform .15s; position: relative; }
.proj:hover { border-color: var(--line2); transform: translateY(-2px); }
.proj canvas { width: 100%; aspect-ratio: 16/9; background: #000; }
.proj-b { padding: 12px 14px; }
.proj-b b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-b small { color: var(--muted); }
.proj .tag { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.7); padding: 3px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; }
.proj .tag.exp { left: auto; right: 10px; color: var(--yellow); }
.proj .tag.dead { left: auto; right: 10px; color: var(--red); }
.proj .del { position: absolute; bottom: 12px; right: 12px; color: var(--dim); font-size: 13px; }
.proj .del:hover { color: var(--red); }
.empty { grid-column: 1/-1; text-align: center; color: var(--muted); padding: 40px; border: 1px dashed var(--line2); border-radius: 16px; }

/* Barre du haut */
.top-row { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; flex-wrap: wrap; }
.top-row h2 { font-size: 22px; }
.top-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.title-input { flex: 1; min-width: 200px; background: transparent; border: 1px solid transparent; border-radius: 10px; padding: 8px 10px; font-size: 20px; font-weight: 800; }
.title-input:hover, .title-input:focus { border-color: var(--line); outline: 0; background: var(--card); }
.src-badge { font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 99px; background: var(--card2); border: 1px solid var(--line); }

/* Config */
.cfg-grid { display: grid; grid-template-columns: 1.15fr 1fr; gap: 20px; align-items: start; }
.cfg-left, .cfg-right { display: grid; gap: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 20px; }
.card-h { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; gap: 10px; }
.src-wrap { position: relative; border-radius: 12px; overflow: hidden; background: #000; touch-action: none; }
.src-wrap canvas { width: 100%; aspect-ratio: 16/9; }
.cam-rect { position: absolute; border: 2px dashed var(--pink); background: rgba(255,61,245,.12); cursor: move; border-radius: 6px; }
.cam-rect span { position: absolute; top: -1px; left: -1px; background: var(--pink); color: #fff; font-size: 11px; font-weight: 800; padding: 1px 6px; border-radius: 4px 0 4px 0; pointer-events: none; }
.cam-rect i { position: absolute; right: -7px; bottom: -7px; width: 14px; height: 14px; background: var(--pink); border-radius: 4px; cursor: nwse-resize; }
.cam-tools { display: flex; gap: 6px; align-items: center; margin-top: 12px; flex-wrap: wrap; font-size: 14px; }

.range { position: relative; height: 46px; margin: 10px 10px 0; touch-action: none; }
.range-track { position: absolute; left: 0; right: 0; top: 18px; height: 10px; border-radius: 99px; background: #262636; }
.range-locked { position: absolute; top: 14px; height: 18px; right: 0; border-radius: 0 99px 99px 0; background: repeating-linear-gradient(45deg, #2a2a3a, #2a2a3a 6px, #1d1d29 6px, #1d1d29 12px); cursor: pointer; display: grid; place-items: center; font-size: 11px; }
.range-sel { position: absolute; top: 18px; height: 10px; background: var(--grad); border-radius: 99px; }
.range-th { position: absolute; top: 9px; width: 28px; height: 28px; margin-left: -14px; border-radius: 50%; background: #fff; border: 4px solid var(--purple); box-shadow: 0 4px 14px rgba(0,0,0,.5); cursor: grab; }
.range-th:active { cursor: grabbing; }
#thB { border-color: var(--green); }
.range-labels { display: flex; justify-content: space-between; font-size: 14px; margin: 4px 0 12px; font-variant-numeric: tabular-nums; }
.range-labels b { font-size: 16px; }
.range-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.credit-sum { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 8px; gap: 10px; flex-wrap: wrap; }
.credit-sum b { font-size: 20px; margin-right: 8px; }
.credit-need { font-weight: 700; }
.credit-need .bad { color: var(--red); }

.opt { margin-bottom: 18px; }
.opt > label, .opt > div > label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.opt.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip, .chips button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 10px; background: var(--card2); border: 1px solid var(--line); font-size: 14px; font-weight: 600; color: var(--muted); }
.chip.sm { padding: 5px 10px; font-size: 13px; }
.chips button:hover, .chip:hover { color: var(--text); border-color: var(--line2); }
.chips button.on { background: rgba(83,252,24,.1); border-color: var(--green); color: var(--text); }
.cards2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.cards2 button { text-align: left; padding: 12px; border-radius: 12px; background: var(--card2); border: 1px solid var(--line); display: grid; gap: 4px; }
.cards2 button b { display: flex; align-items: center; gap: 6px; font-size: 14px; }
.cards2 button small { color: var(--muted); font-size: 12px; line-height: 1.35; }
.cards2 button.on { border-color: var(--green); background: rgba(83,252,24,.07); }
.select, .text { width: 100%; background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; outline: 0; }
.select:focus, .text:focus { border-color: var(--purple); }
textarea.text { resize: vertical; line-height: 1.5; }
.color { width: 60px; height: 40px; border: 1px solid var(--line); border-radius: 10px; background: var(--card2); padding: 3px; }

.style-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.style-grid button { border-radius: 12px; overflow: hidden; border: 2px solid var(--line); background: #000; position: relative; }
.style-grid button.on { border-color: var(--green); }
.style-grid canvas { width: 100%; aspect-ratio: 9/12; }
.style-grid span { position: absolute; bottom: 0; left: 0; right: 0; font-size: 12px; font-weight: 700; background: rgba(10,10,15,.85); padding: 3px; }

.toggles { display: grid; gap: 10px; }
.tg, .opt > label.tg { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; cursor: pointer; user-select: none; margin-bottom: 0; }
.modal-box > .tg { margin-top: 16px; }
.tg input { display: none; }
.tg span { width: 38px; height: 22px; border-radius: 99px; background: #2c2c3c; position: relative; flex-shrink: 0; transition: background .15s; }
.tg span::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; }
.tg input:checked + span { background: var(--green); }
.tg input:checked + span::after { transform: translateX(16px); }

/* Traitement */
.proc { max-width: 560px; margin: 40px auto; text-align: center; }
.ring { width: 150px; height: 150px; border-radius: 50%; margin: 0 auto 24px; display: grid; place-items: center; background: conic-gradient(var(--green) 0%, #23232f 0%); position: relative; }
.ring::before { content: ''; position: absolute; inset: 12px; border-radius: 50%; background: var(--bg); }
.ring b { position: relative; font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; }
.stages { list-style: none; text-align: left; margin: 26px auto; display: grid; gap: 10px; max-width: 420px; }
.stages li { display: flex; gap: 12px; align-items: center; color: var(--dim); font-weight: 600; }
.stages li::before { content: ''; width: 20px; height: 20px; border-radius: 50%; border: 2px solid #34344a; flex-shrink: 0; }
.stages li.run { color: var(--text); }
.stages li.run::before { border-color: var(--green); border-top-color: transparent; animation: spin .8s linear infinite; }
.stages li.done { color: var(--muted); }
.stages li.done::before { content: '\2713'; background: var(--green); border-color: var(--green); color: #061400; font-size: 12px; font-weight: 900; display: grid; place-items: center; }
@keyframes spin { to { transform: rotate(360deg); } }
.upsell { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; font-size: 14px; }

/* Résultats */
.banner { background: linear-gradient(90deg, rgba(255,212,0,.12), rgba(255,212,0,.03)); border: 1px solid rgba(255,212,0,.35); border-radius: 14px; padding: 12px 16px; margin-bottom: 18px; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-weight: 600; }
.banner .btn { margin-left: auto; }
.clip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.clip { background: var(--card); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; display: flex; flex-direction: column; }
.clip-thumb { position: relative; background: #000; cursor: pointer; }
.clip-thumb canvas { width: 100%; aspect-ratio: 9/16; }
.clip-thumb .play { position: absolute; inset: 0; display: grid; place-items: center; font-size: 40px; opacity: 0; transition: opacity .15s; background: rgba(0,0,0,.25); }
.clip-thumb:hover .play { opacity: 1; }
.score-b { position: absolute; top: 10px; left: 10px; background: rgba(0,0,0,.75); border-radius: 12px; padding: 5px 10px; font-weight: 900; font-size: 18px; line-height: 1; }
.score-b small { font-size: 11px; color: var(--muted); font-weight: 700; }
.dur-b { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,.75); border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 700; }
.rank-b { position: absolute; top: 10px; right: 10px; background: var(--green); color: #061400; border-radius: 8px; padding: 2px 8px; font-size: 12px; font-weight: 800; }
.clip-b { padding: 12px 14px; display: grid; gap: 6px; flex: 1; }
.clip-b b { font-size: 15px; line-height: 1.3; }
.clip-b .sub { display: flex; gap: 8px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.clip-act { display: flex; gap: 6px; padding: 0 14px 14px; }
.clip-act .btn { flex: 1; padding: 8px; font-size: 13px; }
.sc-hi { color: var(--green); } .sc-mid { color: var(--yellow); } .sc-lo { color: #ff9a5a; }

/* Éditeur */
.ed-grid { display: grid; grid-template-columns: minmax(280px, 440px) 1fr; gap: 24px; align-items: start; }
.ed-stage { position: sticky; top: 20px; }
.ed-canvas-wrap { position: relative; background: #000; border-radius: 20px; overflow: hidden; border: 1px solid var(--line); display: grid; place-items: center; }
.ed-canvas-wrap canvas { max-height: 72vh; width: auto; max-width: 100%; }
.ed-score { position: absolute; top: 12px; left: 12px; background: rgba(0,0,0,.7); border-radius: 10px; padding: 4px 10px; font-weight: 900; }
.ed-controls { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.ed-controls input[type=range] { flex: 1; }
input[type=range] { accent-color: var(--green); width: 100%; }
.ed-panel { background: var(--card); border: 1px solid var(--line); border-radius: 18px; padding: 18px; }
.tabs { display: flex; gap: 4px; background: var(--bg2); border-radius: 12px; padding: 4px; margin-bottom: 18px; overflow-x: auto; }
.tabs button { flex: 1; padding: 9px 12px; border-radius: 9px; font-weight: 700; font-size: 14px; color: var(--muted); white-space: nowrap; }
.tabs button.on { background: var(--card2); color: var(--text); }
.tab .style-grid { margin-bottom: 18px; }
.src-wrap.small { max-width: 480px; }
.trim { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stepper { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.stepper button { background: var(--card2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; font-weight: 700; }
.stepper span { flex: 1; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }
.score-big { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.score-big b { font-size: 54px; font-weight: 900; letter-spacing: -.04em; line-height: 1; }
.sbar { display: grid; grid-template-columns: 90px 1fr 36px; gap: 10px; align-items: center; font-size: 14px; margin-bottom: 8px; }
.sbar .bar { height: 8px; }
.reasons { list-style: none; display: grid; gap: 8px; }
.reasons li { background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; font-size: 14px; }

/* Modales */
.modal { position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.7); backdrop-filter: blur(6px); display: grid; place-items: center; padding: 16px; overflow-y: auto; }
.modal-box { position: relative; width: 100%; max-width: 520px; background: var(--bg2); border: 1px solid var(--line); border-radius: 22px; padding: 26px; margin: auto; }
.modal-box.wide { max-width: 980px; }
.modal-box h3 { font-size: 22px; margin-bottom: 4px; }
.modal-box h4 { margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.modal-box .opt { margin-top: 18px; }
.x { position: absolute; top: 12px; right: 16px; font-size: 28px; color: var(--muted); line-height: 1; }
.x:hover { color: var(--text); }
.ex-actions { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.ex-progress { margin-top: 18px; display: grid; gap: 6px; }
.pub-row { display: flex; gap: 10px; margin-top: 12px; }
.pay-head { text-align: center; margin-bottom: 24px; }
.pay-ico { font-size: 42px; margin-bottom: 6px; }
.pay-head p { max-width: 560px; margin: 6px auto 18px; }
.pay-head .bill-toggle { margin-bottom: 0; }
.pay-alt { text-align: center; margin-top: 18px; }
.topups { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }
.topups button { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 18px; text-align: center; }
.topups button:hover { border-color: var(--green); }
.topups b { display: block; font-size: 18px; }
.co-line { display: flex; justify-content: space-between; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin: 16px 0; gap: 10px; }
.co-demo { font-size: 13px; color: var(--yellow); background: rgba(255,212,0,.08); border: 1px solid rgba(255,212,0,.3); padding: 10px 12px; border-radius: 10px; margin-bottom: 16px; }
.cal-item { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px 16px; margin-bottom: 10px; flex-wrap: wrap; }
.cal-item .d { font-weight: 800; min-width: 160px; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text); color: var(--bg); font-weight: 700; padding: 12px 20px; border-radius: 12px; z-index: 200; box-shadow: 0 10px 30px rgba(0,0,0,.4); max-width: calc(100vw - 32px); }
.drop-overlay { position: fixed; inset: 0; z-index: 150; background: rgba(83,252,24,.12); border: 3px dashed var(--green); display: grid; place-items: center; font-size: 28px; font-weight: 900; pointer-events: none; }

@media (max-width: 1000px) {
  .cfg-grid, .ed-grid { grid-template-columns: 1fr; }
  .ed-stage { position: static; }
  .ed-canvas-wrap canvas { max-height: 60vh; }
}
@media (max-width: 800px) {
  body.app { flex-direction: column; }
  .sidebar { position: sticky; top: 0; z-index: 60; width: 100%; height: auto; flex-direction: row; align-items: center; padding: 10px 12px; gap: 10px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .logo { font-size: 0; padding: 0; } .sidebar .logo i { font-size: 15px; }
  .side-nav { display: flex; gap: 2px; }
  .side-nav button { padding: 8px 10px; } .side-nav button span, .side-nav .lock { display: none; }
  .side-bottom { margin: 0 0 0 auto; display: flex; }
  .credit-box { padding: 6px 10px; display: flex; align-items: center; gap: 8px; }
  .credit-box .bar, .credit-box small, #upgradeBtn, #resetDemo, #planName { display: none; }
  .style-grid { grid-template-columns: repeat(4, 1fr); }
  .opt.two, .cards2 { grid-template-columns: 1fr; }
  .main { padding-top: 16px; }
}

.quick-buy { margin-top: 12px; display: flex; }
#buyCreditsBtn { margin-top: 2px; }
@media (max-width: 800px) { #buyCreditsBtn { display: none; } }
.side-nav button .ic { opacity: .85; }
.plat-ico { display: inline-flex; align-items: center; color: var(--muted); }
.clip-thumb .play .ic { color: #fff; filter: drop-shadow(0 2px 6px rgba(0,0,0,.6)); }
.ed-controls .btn { min-width: 40px; }
.drop-overlay .ic.folder { width: 40px; height: 40px; }

/* Le titre du clip occupe le haut : badges déplacés en bas */
.clip-thumb .score-b { top: auto; bottom: 10px; left: 10px; }
.clip-thumb .rank-b { top: auto; bottom: 10px; left: auto; right: 64px; }
.ed-score { top: auto; bottom: 12px; }

/* Connexion */
.auth-screen { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px; background: radial-gradient(600px 300px at 50% 0%, rgba(145,70,255,.25), transparent), var(--bg); }
.auth-box { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 28px; display: grid; gap: 14px; }
.auth-box h2 { font-size: 24px; }
.auth-box label { display: grid; gap: 6px; font-weight: 600; font-size: 14px; }
/* Twitch */
.twitch-card { margin-top: 18px; }
.tw-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.tw-vods { display: grid; gap: 8px; margin-top: 14px; }
.tw-vod { display: flex; align-items: center; gap: 12px; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.tw-vod img { width: 96px; aspect-ratio: 16/9; border-radius: 8px; object-fit: cover; background: #000; }
.tw-vod div { flex: 1; min-width: 0; display: grid; }
.tw-vod b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 14px; }
/* Courbe de hype */
.hype-card { margin-bottom: 18px; }
.hype-card canvas { width: 100%; height: 90px; }

.auth-box .sms-optin { font-weight: 500; font-size: 13px; align-items: flex-start; }
.auth-box .sms-optin span { margin-top: 2px; }
