/* C1-109 / C1-117 */
:root {
  --bg: #0E0F14; --surface: #191B23; --surface2: #15161C; --line: #2A2D38; --line2: #4A4E5C;
  --text: #F2F2F5; --muted: #A3A7B5; --accent: #7CFF6B; --twitch: #9146FF;
  --t1: #C9A6FF; --t2: #FFB86B; --t3: #FF8A8A;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: Manrope, system-ui, sans-serif; }
body { min-height: 100dvh; }
main { max-width: 480px; margin: 0 auto; padding: 20px 20px calc(96px + env(safe-area-inset-bottom)); }
h1, h2 { font-family: Unbounded, system-ui, sans-serif; font-weight: 600; margin: 0; }
h1 { font-size: 22px; } h2 { font-size: 16px; }
.muted { color: var(--muted); } .center { text-align: center; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; gap: 8px; align-items: center; }
.between { justify-content: space-between; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 16px; }
.btn { height: 52px; border-radius: 16px; border: 0; padding: 0 18px; font: 700 15px Manrope, sans-serif; cursor: pointer; width: 100%; }
.btn-accent { background: var(--accent); color: #0E0F14; }
.btn-twitch { background: var(--twitch); color: #fff; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; cursor: default; }
.badge { font-size: 12px; font-weight: 700; padding: 6px 10px; border-radius: 999px; background: var(--line); color: var(--muted); }
.badge.t1 { background: #2A2140; color: var(--t1); } .badge.t2 { background: #3A2A18; color: var(--t2); } .badge.t3 { background: #3A1E1E; color: var(--t3); }
/* Catégories : défilement au doigt avec flèches sur mobile, tout visible sur ordinateur */
.chips-wrap { position: relative; display: flex; align-items: center; gap: 6px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scroll-behavior: smooth; scrollbar-width: none; flex: 1; min-width: 0; }
.chips::-webkit-scrollbar { display: none; }
.chips-arrow { flex-shrink: 0; width: 44px; height: 44px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 700 18px Manrope, sans-serif; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.chips-arrow[hidden] { display: none; }
@media (min-width: 900px) {
  main { max-width: 1040px; }
  .chips { flex-wrap: wrap; overflow: visible; }
  .chips-arrow { display: none; }
  .editor-layout { display: grid; grid-template-columns: 340px minmax(0, 1fr); gap: 24px; align-items: start; }
  .editor-layout .preview-col { position: sticky; top: 20px; }
  .editor-layout .preview.cabine { height: 580px; }
  .editor-layout .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .swatches { max-width: 440px; }
}
.chip { flex-shrink: 0; min-height: 44px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); font: 600 14px Manrope, sans-serif; cursor: pointer; }
.chip[aria-pressed="true"] { background: var(--accent); color: #0E0F14; border-color: var(--accent); }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tile { min-height: 72px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); color: var(--text); font: 600 12px Manrope, sans-serif; padding: 8px; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; text-align: center; }
.tile[aria-pressed="true"] { border: 2px solid var(--accent); }
.tile.locked { background: var(--surface2); border-style: dashed; border-color: var(--line2); }
.tile .lock { font-size: 11px; font-weight: 700; display: flex; gap: 4px; align-items: center; }
.swatches { display: grid; grid-template-columns: repeat(8, minmax(0, 1fr)); gap: 6px; }
.swatch { aspect-ratio: 1; min-height: 36px; border-radius: 999px; border: 1px solid var(--line); cursor: pointer; }
.swatch[aria-pressed="true"] { outline: 3px solid var(--text); outline-offset: 1px; }
.preview { height: 240px; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; }
.preview.cabine { height: min(58dvh, 460px); padding: 0; overflow: hidden; position: relative; display: block; background: #191B23; }
.preview.cabine canvas { width: 100%; height: 100%; display: block; touch-action: pan-y; outline: none; }
.cabine-overlay { position: absolute; left: 0; right: 0; bottom: 12px; text-align: center; font-size: 13px; color: var(--muted); pointer-events: none; }
.cabine-overlay[hidden] { display: none; }
.preview-col { display: flex; flex-direction: column; gap: 6px; }
label.slider { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
input[type=range] { width: 100%; accent-color: var(--accent); min-height: 32px; }
.switch { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; background: #0B0C10EE; border-top: 1px solid var(--line); display: flex; justify-content: center; gap: 4px; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); backdrop-filter: blur(8px); }
nav.tabs button { flex: 1; max-width: 160px; min-height: 48px; border: 0; border-radius: 12px; background: transparent; color: var(--muted); font: 700 13px Manrope, sans-serif; cursor: pointer; }
nav.tabs button[aria-current="page"] { background: var(--surface); color: var(--text); }
.modal { position: fixed; inset: 0; background: #000A; display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.modal > .card { width: 100%; max-width: 480px; border-radius: 24px 24px 0 0; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); }
#toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--surface); border: 1px solid var(--line); padding: 12px 16px; border-radius: 12px; font-size: 14px; z-index: 20; max-width: 90vw; }
a { color: var(--accent); }

.tile .thumb { width: 96px; height: 96px; max-width: 100%; border-radius: 10px; object-fit: cover; background: #191B23; }
.tile .thumb.none { display: flex; align-items: center; justify-content: center; font-size: 28px; color: var(--muted, #8a8f9c); }

.emotes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.emote { background: var(--surface2); border: 1px dashed var(--line2); border-radius: 14px; padding: 14px 6px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; position: relative; opacity: .8; }
.emote .em { font-size: 34px; filter: grayscale(.6); }
.emote .lk { position: absolute; top: 6px; right: 8px; font-size: 12px; }
.quick { gap: 8px; align-items: center; flex-wrap: wrap; }
.quick .btn { padding: 8px 14px; }

/* C1-137 — écran de chargement de la cabine */
.cabine { position: relative; }
.cabine-loading { position: absolute; inset: 0; z-index: 2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 12px; background: var(--surface2); border-radius: inherit; transition: opacity .4s; --p: 0; }
.cabine-loading.done { opacity: 0; pointer-events: none; }
.cabine-loading svg { width: min(78%, 280px); height: auto; overflow: visible; }
.ak-stars circle { fill: #fff; opacity: .7; animation: ak-twinkle 2.4s ease-in-out infinite; }
.ak-stars circle:nth-child(2n) { animation-delay: .8s; } .ak-stars circle:nth-child(3n) { animation-delay: 1.5s; }
.ak-saucer { animation: ak-float 3s ease-in-out infinite; }
.ak-lights circle { fill: #7CFF6B; animation: ak-blink 1.2s steps(2) infinite; }
.ak-lights circle:nth-child(2n) { animation-delay: .6s; fill: #FFB86B; }
.ak-beam { animation: ak-beam 1.6s ease-in-out infinite; }
.ak-cow { transform: translateY(calc(var(--p) * -76px)); transition: transform .5s ease-out; }
.ak-cow-in { transform-box: fill-box; transform-origin: center; animation: ak-wobble 1.4s ease-in-out infinite; }
.ak-msg { min-height: 20px; font-size: 13px; color: var(--muted); text-align: center; }
.ak-bar { width: min(78%, 280px); height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; }
.ak-bar i { display: block; height: 100%; width: calc(var(--p) * 100%); background: var(--accent); border-radius: 99px; transition: width .4s ease-out; }
.ak-pct { font: 700 12px Manrope, sans-serif; color: var(--text); }
@keyframes ak-float { 0%,100% { transform: translateY(0) rotate(-1deg); } 50% { transform: translateY(-5px) rotate(1deg); } }
@keyframes ak-twinkle { 0%,100% { opacity: .2; } 50% { opacity: .9; } }
@keyframes ak-blink { 50% { opacity: .15; } }
@keyframes ak-beam { 0%,100% { opacity: .75; } 50% { opacity: 1; } }
@keyframes ak-wobble { 0%,100% { transform: rotate(-7deg); } 50% { transform: rotate(7deg); } }
@media (prefers-reduced-motion: reduce) { .cabine-loading * { animation: none !important; } .ak-cow, .ak-bar i { transition: none; } }
