/* Brikothèque – démo en ligne (page « Essayer ») : l'appli simplifiée, fausses données. */
.demo-wrap { display: flex; flex-wrap: wrap; gap: 40px; align-items: flex-start; padding: 28px 0 72px; }
.demo-side { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.demo-side h1 { font-size: clamp(34px, 6vw, 52px); }
.demo-side ul { margin: 0; padding-left: 20px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }
.demo-frame { flex: 0 0 auto; margin: 0 auto; width: 100%; max-width: 400px; }
@media (min-width: 860px) {
  .demo-frame { background: var(--ink); border-radius: 46px; padding: 12px; box-shadow: 0 24px 48px rgba(43, 33, 24, .25); position: sticky; top: 90px; }
}

/* ---------- l'appli */
.app {
  --a-bg: #FFF6EC; --a-card: #FFFFFF; --a-ink: #2B2118; --a-muted: #6E5A4A; --a-line: #F1DCC6;
  --a-pc: #FFE3D0; --a-onpc: #5A2600; --a-sc: #DCE8FF; --a-onsc: #0F2E66; --a-tc: #FFF0B8; --a-ontc: #4A3600;
  --a-orange: #F57C1F; --a-orange-d: #B84A0A; --a-blue: #2E6FD8; --a-blue-d: #1F4E9E; --a-yellow: #FFC21A; --a-yellow-d: #C99300;
  --a-nav: #FFFBF7; --a-halo: transparent;
  position: relative; height: min(780px, 82vh); min-height: 560px; background: var(--a-bg); color: var(--a-ink);
  border-radius: 34px; overflow: hidden; display: flex; flex-direction: column; font-size: 14px;
  border: 2px solid var(--line);
}
@media (min-width: 860px) { .app { border: 0; } }
.app[data-night] {
  --a-bg: #0E1430; --a-card: #19214A; --a-ink: #EEF1FF; --a-muted: #A9B1D6; --a-line: #2A3566;
  --a-pc: #3A2A1E; --a-onpc: #FFD9BF; --a-sc: #22305F; --a-onsc: #DCE6FF; --a-tc: #4A3A10; --a-ontc: #FFE9A8;
  --a-orange: #FF8A2A; --a-orange-d: #B84A0A; --a-blue: #5B8CFF; --a-blue-d: #2E4FA8; --a-yellow: #FFC94A;
  --a-nav: #0A0F25; --a-halo: rgba(255, 138, 42, .35);
}
.app * { box-sizing: border-box; }
.app button { font-family: inherit; color: inherit; }
.a-top { display: flex; align-items: center; gap: 8px; padding: 14px 16px 8px; }
.a-top h2 { font-size: 20px; flex: 1; margin: 0; }
.a-icon { width: 44px; height: 44px; border-radius: 14px; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.a-icon:hover { background: var(--a-line); }
.a-icon svg { width: 22px; height: 22px; }
.a-body { flex: 1; overflow-y: auto; padding: 0 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.a-nav { display: flex; background: var(--a-nav); border-top: 1px solid var(--a-line); }
.a-nav button { flex: 1; border: 0; background: none; padding: 8px 2px 10px; min-height: 60px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; font-weight: 800; cursor: pointer; color: var(--a-muted); }
.a-nav button svg { width: 22px; height: 22px; padding: 2px 14px; box-sizing: content-box; border-radius: 999px; }
.a-nav button[aria-current="page"] { color: var(--a-ink); }
.a-nav button[aria-current="page"] svg { background: var(--a-pc); color: var(--a-onpc); }
.a-banner { font-size: 11px; font-weight: 800; text-align: center; background: var(--a-tc); color: var(--a-ontc); padding: 5px 8px; }

.a-hello { display: flex; gap: 10px; align-items: center; background: var(--a-pc); color: var(--a-onpc); border-radius: 18px; padding: 10px 12px; }
.a-hello svg { width: 64px; height: 64px; flex: none; filter: drop-shadow(0 0 10px var(--a-halo)); }
.a-hello b { display: block; font-size: 16px; }
.a-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.a-stat { border-radius: 14px; padding: 10px 4px; text-align: center; font-weight: 700; }
.a-stat b { display: block; font-size: 22px; font-weight: 900; }
.a-stat.o { background: var(--a-orange); color: #1A1206; box-shadow: 0 3px 0 var(--a-orange-d); }
.a-stat.b { background: var(--a-blue); color: #fff; box-shadow: 0 3px 0 var(--a-blue-d); }
.a-stat.y { background: var(--a-yellow); color: #2B2118; box-shadow: 0 3px 0 var(--a-yellow-d); }
.a-fold { display: flex; align-items: center; justify-content: space-between; width: 100%; border: 0; background: var(--a-card); border-radius: 14px; padding: 12px; min-height: 48px; font-weight: 900; font-size: 14px; cursor: pointer; }
.a-fold svg { width: 20px; height: 20px; transition: transform .2s; }
.a-fold[aria-expanded="true"] svg { transform: rotate(180deg); }
.a-row { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.a-mini { flex: 0 0 110px; background: var(--a-card); border-radius: 12px; padding: 8px; border: 0; text-align: left; cursor: pointer; }
.a-mini .a-thumb { height: 60px; }
.a-mini b { display: block; font-size: 12px; margin-top: 6px; }
.a-search { display: flex; gap: 6px; }
.a-search input { flex: 1; min-width: 0; min-height: 44px; border-radius: 14px; border: 2px solid var(--a-line); background: var(--a-card); color: var(--a-ink); padding: 0 12px; font: inherit; }
.a-list { display: flex; flex-direction: column; gap: 8px; }
.a-list.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.a-set { display: flex; gap: 10px; align-items: center; background: var(--a-card); border-radius: 14px; padding: 8px; border: 0; text-align: left; cursor: pointer; width: 100%; min-height: 64px; }
.a-list.grid .a-set { flex-direction: column; align-items: stretch; }
.a-list.grid .a-thumb { width: 100%; height: 80px; }
.a-set b { display: block; font-size: 13px; }
.a-set small { display: block; color: var(--a-muted); font-size: 11px; margin-top: 2px; }
.a-thumb { width: 48px; height: 48px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; }
.a-thumb svg { width: 60%; height: 60%; }
.a-chip { display: inline-block; font-size: 10px; font-weight: 800; padding: 2px 8px; border-radius: 999px; margin-top: 4px; }
.a-chip.built { background: var(--a-sc); color: var(--a-onsc); }
.a-chip.sealed { background: var(--a-tc); color: var(--a-ontc); }
.a-empty { text-align: center; color: var(--a-muted); padding: 20px; }

.a-btn { border: 0; border-radius: 14px; min-height: 48px; padding: 0 16px; font-weight: 900; font-size: 15px; cursor: pointer; background: var(--a-orange); color: #1A1206; box-shadow: 0 4px 0 var(--a-orange-d); transition: transform .1s; }
.a-btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--a-orange-d); }
.a-btn.blue { background: var(--a-blue); color: #fff; box-shadow: 0 4px 0 var(--a-blue-d); }
.a-btn.ghost { background: var(--a-card); color: var(--a-ink); box-shadow: 0 4px 0 var(--a-line); }
.a-btn:disabled { opacity: .5; cursor: default; }
.a-card { background: var(--a-card); border-radius: 16px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.a-card h3 { font-size: 15px; margin: 0; }
.a-muted { color: var(--a-muted); }

/* Fiche d'un set */
.a-sheet { position: absolute; inset: 0; background: rgba(0, 0, 0, .35); display: flex; align-items: flex-end; z-index: 5; }
.a-sheet[hidden] { display: none; }
.a-sheet > div { background: var(--a-bg); width: 100%; border-radius: 24px 24px 0 0; padding: 16px; display: flex; flex-direction: column; gap: 10px; max-height: 85%; overflow-y: auto; animation: up .25s ease; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.a-sheet .a-thumb { width: 100%; height: 130px; }
.a-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.a-facts div { background: var(--a-card); border-radius: 12px; padding: 8px 10px; }
.a-facts small { display: block; color: var(--a-muted); font-size: 11px; }
.a-facts b { font-size: 15px; }

/* Ajouter */
.a-scan { position: relative; height: 210px; border-radius: 20px; background: #1d1712; overflow: hidden; display: flex; align-items: center; justify-content: center; }
.a-scan .frame { width: 190px; height: 100px; border: 3px solid var(--a-yellow); border-radius: 14px; display: flex; align-items: center; justify-content: center; gap: 4px; }
.a-scan .frame i { display: block; height: 56px; background: #FFF6EC; }
.a-scan .laser { position: absolute; left: 24px; right: 24px; height: 3px; background: #ff4d2e; box-shadow: 0 0 10px #ff4d2e; top: 50%; animation: laser 1.6s ease-in-out infinite; }
@keyframes laser { 0%, 100% { transform: translateY(-40px); } 50% { transform: translateY(40px); } }

/* Roulette */
.a-wheel-box { position: relative; display: flex; justify-content: center; align-items: center; padding: 10px 0; }
.a-wheel { width: 230px; height: 230px; border-radius: 50%; border: 8px solid var(--a-ink); transition: transform 3.2s cubic-bezier(.17, .67, .2, 1); }
.a-pointer { position: absolute; top: 2px; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 12px solid transparent; border-right: 12px solid transparent; border-top: 22px solid var(--a-ink); z-index: 2; }
.a-lever { display: flex; align-items: center; gap: 10px; }
.a-lever svg { width: 84px; height: 84px; flex: none; filter: drop-shadow(0 0 10px var(--a-halo)); }
.a-lever .stick { transform-origin: 50% 90%; transition: transform .35s ease; }
.a-lever.pulled .stick { transform: rotate(40deg); }

/* Stats */
.a-value b { font-size: 30px; font-weight: 900; }
.a-bars { display: flex; flex-direction: column; gap: 6px; }
.a-bar { display: grid; grid-template-columns: 90px 1fr 28px; gap: 8px; align-items: center; font-size: 12px; }
.a-bar span.track { height: 12px; border-radius: 6px; background: var(--a-line); overflow: hidden; }
.a-bar span.fill { display: block; height: 100%; background: var(--a-orange); border-radius: 6px; }

/* Minifigs */
.a-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.a-fig { border: 0; border-radius: 12px; background: var(--a-card); padding: 6px 2px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10px; font-weight: 700; min-height: 84px; }
.a-fig svg { width: 40px; height: 52px; }
.a-fig[aria-pressed="false"] svg { opacity: .28; filter: grayscale(1); }

.a-toast { position: absolute; left: 14px; right: 14px; bottom: 74px; background: var(--a-ink); color: var(--a-bg); border-radius: 14px; padding: 12px 14px; font-weight: 800; z-index: 6; animation: up .25s ease; }
.a-toast[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) { .a-wheel { transition: none; } .a-scan .laser { animation: none; } }
