:root {
  --bg: #0b0b10;
  --bg-2: #14141c;
  --bg-3: #1d1d28;
  --line: #2a2a38;
  --text: #f4f2ee;
  --text-2: #b9b6c3;
  --text-3: #7d7a8a;
  --accent: #ff7a50;
  --accent-2: #ffb547;
  --good: #4fd08a;
  --bad: #ff5d6c;
  --tab-h: 62px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --serif: "Iowan Old Style", "Palatino Linotype", "Noto Serif", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--sans); overscroll-behavior: none; }
body { overflow: hidden; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: var(--accent-2); }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.muted { color: var(--text-3); font-weight: 400; }
.small { font-size: 12px; }

#app { position: fixed; inset: 0; overflow: hidden; }
.view { position: absolute; inset: 0 0 calc(var(--tab-h) + var(--safe-b)) 0; display: none; }
.view.active { display: block; }

/* ---------- Barre d'onglets ---------- */
.tabbar {
  position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--tab-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: flex; background: var(--bg); border-top: 1px solid var(--line); z-index: 20;
}
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-3); font-size: 11px; }
.tabbar button.on { color: var(--text); }
.tabbar button.on svg { stroke: var(--accent); }

/* ---------- Fil ---------- */
.feed-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  padding: calc(var(--safe-t) + 8px) 10px 18px; background: linear-gradient(rgba(0,0,0,.55), transparent); pointer-events: none;
}
.feed-top > * { pointer-events: auto; }
.feed-tabs { flex: 1; display: flex; justify-content: center; gap: 22px; }
.feed-tabs button { font-weight: 600; font-size: 16px; color: rgba(255,255,255,.62); padding: 6px 2px; position: relative; text-shadow: 0 1px 6px rgba(0,0,0,.5); max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-tabs button.on { color: #fff; }
.feed-tabs button.on::after { content: ""; position: absolute; left: 30%; right: 30%; bottom: 0; height: 2.5px; border-radius: 2px; background: #fff; }
.icon-btn { width: 40px; height: 40px; display: inline-grid; place-items: center; border-radius: 50%; color: var(--text); }
.icon-btn.ghost { background: rgba(0,0,0,.25); backdrop-filter: blur(6px); }
.icon-btn.small { width: 30px; height: 30px; }
.icon-btn.small svg { width: 18px; height: 18px; }

.feeds { position: absolute; inset: 0; }
.feed {
  position: absolute; inset: 0; overflow-y: scroll; scroll-snap-type: y mandatory; scrollbar-width: none; overscroll-behavior: contain;
}
.feed::-webkit-scrollbar, .slides::-webkit-scrollbar { display: none; }

.card { position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; background: var(--bg); }
.card.loading { display: grid; place-items: center; }
.slides { display: flex; height: 100%; overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none; overscroll-behavior-x: contain; }
.slide { flex: 0 0 100%; height: 100%; scroll-snap-align: start; position: relative; overflow: hidden; }

.slide .bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .5s; }
.slide .bg.ok { opacity: 1; }
.card.active .slide.cover .bg.ok { animation: kenburns 18s ease-out both; }
@keyframes kenburns { from { transform: scale(1.02); } to { transform: scale(1.14) translate(-1.5%, -1%); } }
.slide .blur { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); object-fit: cover; filter: blur(30px) brightness(.45) saturate(1.2); }
.shade { position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,.25) 0%, transparent 25%, transparent 38%, rgba(0,0,0,.6) 62%, rgba(0,0,0,.92) 100%); }

.cover .content { position: absolute; left: 0; right: 74px; bottom: 0; padding: 0 18px 22px; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 99px; background: hsla(var(--h, 20), 80%, 55%, .9); color: #fff; letter-spacing: .02em; }
.chip.soft { background: rgba(255,255,255,.14); backdrop-filter: blur(8px); }
.cover h2 { font-family: var(--serif); font-size: clamp(28px, 8.4vw, 42px); line-height: 1.05; margin: 10px 0 6px; text-wrap: balance; text-shadow: 0 2px 16px rgba(0,0,0,.45); }
.cover .desc { color: var(--accent-2); font-size: 14px; font-weight: 600; margin: 0 0 10px; }
.cover .lead { font-size: 16px; line-height: 1.5; color: #ece9e3; margin: 0; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.why { margin-top: 12px; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255,255,255,.7); max-width: 100%; }
.why svg { width: 15px; height: 15px; }
.why span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.swipe-hint { position: absolute; right: 80px; bottom: 26px; font-size: 12px; color: rgba(255,255,255,.55); display: flex; align-items: center; gap: 2px; }
.swipe-hint svg { width: 16px; height: 16px; transform: rotate(180deg); }

/* Diapositive de section */
.slide.text { background: hsl(var(--h, 20), 28%, 9%); display: flex; flex-direction: column; }
.slide.text .pic { position: relative; height: 40%; flex: none; overflow: hidden; background: hsl(var(--h, 20), 25%, 14%); }
.slide.text .pic img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .4s; }
.slide.text .pic img.ok { opacity: 1; }
.slide.text .pic::after { content: ""; position: absolute; inset: auto 0 0 0; height: 45%; background: linear-gradient(transparent, hsl(var(--h, 20), 28%, 9%)); }
.slide.text .pic .cap { position: absolute; z-index: 1; left: 18px; right: 18px; bottom: 6px; font-size: 11px; color: rgba(255,255,255,.6); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slide.text.nopic .pic { height: calc(var(--safe-t) + 80px); }
.slide.text .body { flex: 1; padding: 6px 76px 18px 18px; display: flex; flex-direction: column; min-height: 0; }
.kicker { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: hsl(var(--h, 20), 85%, 68%); font-weight: 700; }
.slide.text h3 { font-family: var(--serif); font-size: clamp(22px, 6.4vw, 30px); line-height: 1.12; margin: 6px 0 12px; text-wrap: balance; }
.slide.text p { font-size: 16.5px; line-height: 1.55; color: #e9e6e0; margin: 0 0 10px; }
.slide.text .clip { flex: 1; min-height: 0; overflow: hidden; -webkit-mask-image: linear-gradient(#000 82%, transparent); mask-image: linear-gradient(#000 82%, transparent); }
.more-link { align-self: flex-start; margin-top: 6px; font-size: 14px; font-weight: 600; color: hsl(var(--h, 20), 85%, 70%); display: inline-flex; gap: 6px; align-items: center; padding: 6px 0; }
.more-link svg { width: 18px; height: 18px; }

/* Diapositive finale */
.slide.end { background: radial-gradient(120% 70% at 50% 0%, hsl(var(--h, 20), 40%, 16%), var(--bg)); padding: calc(var(--safe-t) + 70px) 76px 20px 18px; display: flex; flex-direction: column; gap: 12px; }
.slide.end h3 { font-family: var(--serif); font-size: 26px; margin: 0; }
.rel { display: flex; gap: 12px; align-items: center; padding: 8px; border-radius: 14px; background: rgba(255,255,255,.06); text-align: left; width: 100%; }
.rel img, .rel .ph { width: 54px; height: 54px; border-radius: 10px; object-fit: cover; flex: none; background: var(--bg-3); }
.rel b { display: block; font-size: 15px; }
.rel small { color: var(--text-3); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.end-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: auto; }

/* Progression des diapositives */
.progress { position: absolute; z-index: 5; left: 14px; right: 14px; top: calc(var(--safe-t) + 58px); display: flex; gap: 4px; pointer-events: none; }
.progress i { flex: 1; height: 3px; border-radius: 3px; background: rgba(255,255,255,.28); overflow: hidden; }
.progress i.done { background: rgba(255,255,255,.95); }

/* Rail d'actions */
.rail { position: absolute; z-index: 6; right: 8px; bottom: 22px; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.rail button { display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 11px; color: #fff; text-shadow: 0 1px 4px rgba(0,0,0,.6); width: 58px; }
.rail button .disc { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: rgba(0,0,0,.32); backdrop-filter: blur(8px); transition: transform .15s; }
.rail button:active .disc { transform: scale(.88); }
.rail svg { width: 25px; height: 25px; }
.rail .on svg { fill: currentColor; }
.rail .like.on { color: var(--bad); }
.rail .save.on { color: var(--accent-2); }

.burst { position: absolute; z-index: 8; width: 110px; height: 110px; margin: -55px 0 0 -55px; color: var(--bad); pointer-events: none; animation: burst .8s ease-out forwards; }
.burst svg { width: 100%; height: 100%; fill: currentColor; stroke: none; filter: drop-shadow(0 4px 20px rgba(0,0,0,.4)); }
@keyframes burst { 0% { transform: scale(.2) rotate(-12deg); opacity: 0; } 25% { transform: scale(1.15) rotate(0); opacity: 1; } 60% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.3) translateY(-40px); opacity: 0; } }

.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255,255,255,.15); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.card.error { display: grid; place-items: center; text-align: center; padding: 30px; color: var(--text-2); }

/* ---------- Pages (Explorer, Biblio, Réglages) ---------- */
.view-page { overflow-y: auto; }
.page { max-width: 720px; margin: 0 auto; padding: calc(var(--safe-t) + 14px) 16px 40px; }
.title { font-family: var(--serif); font-size: 32px; margin: 8px 0 14px; }
.h { font-size: 17px; margin: 26px 0 12px; display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.searchbar { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; gap: 10px; padding: 0 8px 0 14px; height: 48px; border-radius: 14px; background: var(--bg-3); border: 1px solid var(--line); }
.searchbar svg { color: var(--text-3); width: 20px; height: 20px; }
.searchbar input { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; color: var(--text); font: inherit; font-size: 16px; }
.searchbar input::-webkit-search-cancel-button { display: none; }

.hscroll { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px 4px; scroll-snap-type: x proximity; }
.tile { position: relative; flex: 0 0 62%; max-width: 280px; aspect-ratio: 4/5; border-radius: 18px; overflow: hidden; background: var(--bg-3); scroll-snap-align: start; text-align: left; }
.tile img { width: 100%; height: 100%; object-fit: cover; }
.tile .t { position: absolute; inset: auto 0 0 0; padding: 40px 12px 12px; background: linear-gradient(transparent, rgba(0,0,0,.9)); }
.tile .t small { color: var(--accent-2); font-weight: 700; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.tile .t b { display: block; font-family: var(--serif); font-size: 19px; line-height: 1.15; margin-top: 3px; }

.list { display: flex; flex-direction: column; gap: 8px; }
.row { display: flex; gap: 12px; align-items: center; padding: 10px; border-radius: 14px; background: var(--bg-2); text-align: left; width: 100%; }
.row img, .row .ph { width: 58px; height: 58px; border-radius: 10px; object-fit: cover; flex: none; background: var(--bg-3); display: grid; place-items: center; color: var(--text-3); }
.row .tx { flex: 1; min-width: 0; }
.row b { display: block; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--text-3); font-size: 13px; line-height: 1.35; }
.row .year { font-family: var(--serif); font-size: 20px; color: var(--accent-2); min-width: 54px; text-align: center; }
.row .end { flex: none; }

.topic-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.topic { position: relative; display: flex; align-items: center; gap: 10px; padding: 12px 12px; border-radius: 14px; background: var(--bg-2); border: 1.5px solid transparent; text-align: left; font-size: 14px; font-weight: 600; min-height: 54px; }
.topic .dot { width: 12px; height: 12px; border-radius: 50%; background: hsl(var(--h), 80%, 60%); flex: none; box-shadow: 0 0 12px hsla(var(--h), 80%, 60%, .6); }
.topic .lbl { flex: 1; line-height: 1.2; }
.topic.on { border-color: hsl(var(--h), 80%, 60%); background: hsla(var(--h), 60%, 40%, .18); }
.topic .tog { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.08); flex: none; }
.topic .tog svg { width: 16px; height: 16px; }
.topic.on .tog { background: hsl(var(--h), 80%, 60%); color: #111; }

.seg { display: flex; padding: 4px; border-radius: 12px; background: var(--bg-2); margin-bottom: 14px; }
.seg button { flex: 1; padding: 8px 6px; border-radius: 9px; font-size: 14px; color: var(--text-2); }
.seg button.on { background: var(--bg-3); color: var(--text); font-weight: 600; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 10px 16px; border-radius: 12px; background: var(--bg-3); border: 1px solid var(--line); font-weight: 600; font-size: 14px; color: var(--text); text-decoration: none; }
.btn svg { width: 18px; height: 18px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #1a0d07; }
.btn.primary:disabled { opacity: .4; }
.btn.big { padding: 15px 28px; font-size: 16px; border-radius: 16px; width: 100%; }
.btn.danger { color: var(--bad); }
.btn.glass { background: rgba(255,255,255,.1); border-color: rgba(255,255,255,.14); backdrop-filter: blur(8px); }

.empty { text-align: center; color: var(--text-3); padding: 50px 20px; }
.empty svg { width: 40px; height: 40px; margin-bottom: 8px; }

.skeleton { background: linear-gradient(90deg, var(--bg-2), var(--bg-3), var(--bg-2)); background-size: 200% 100%; animation: shimmer 1.4s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Réglages ---------- */
.panel { background: var(--bg-2); border-radius: 18px; padding: 16px; margin-bottom: 14px; }
.panel h2 { font-size: 16px; margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.panel h2 svg { width: 20px; height: 20px; color: var(--accent); }
.panel .sub { color: var(--text-3); font-size: 13px; margin: 0 0 14px; line-height: 1.4; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: var(--bg-3); border-radius: 14px; padding: 12px 10px; }
.stat b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--text-3); }
.mixbar { display: flex; height: 12px; border-radius: 8px; overflow: hidden; margin: 6px 0 14px; }
.mixbar i { display: block; height: 100%; transition: flex .2s; }
.field { margin: 14px 0; }
.field .lab { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 14px; font-weight: 600; }
.field .lab span { color: var(--text-2); font-weight: 500; font-variant-numeric: tabular-nums; }
.field .help { font-size: 12.5px; color: var(--text-3); margin-top: 3px; line-height: 1.4; }
.field .lab i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 8px; }
input[type=range] { width: 100%; accent-color: var(--accent); margin: 8px 0 0; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; font-size: 14px; font-weight: 600; }
.switch .help { font-weight: 400; }
.switch input[type=checkbox] { appearance: none; width: 46px; height: 28px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: background .2s; cursor: pointer; }
.switch input[type=checkbox]::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch input[type=checkbox]:checked { background: var(--accent); }
.switch input[type=checkbox]:checked::after { transform: translateX(18px); }
select, input[type=time] { background: var(--bg-3); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font: inherit; font-size: 14px; }
.wrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.wrow:last-child { border-bottom: 0; }
.wrow .name { flex: 0 0 38%; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wrow .bar { flex: 1; height: 8px; border-radius: 6px; background: var(--bg-3); overflow: hidden; position: relative; }
.wrow .bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; }
.wrow .val { width: 34px; text-align: right; font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.wrow .icon-btn { width: 30px; height: 30px; background: var(--bg-3); }
.wrow .icon-btn svg { width: 16px; height: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cchip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 6px 6px 6px 10px; border-radius: 99px; background: var(--bg-3); }
.cchip.neg { color: var(--bad); }
.cchip button { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.08); }
.cchip button svg { width: 12px; height: 12px; }
.signals { width: 100%; border-collapse: collapse; font-size: 13px; }
.signals td { padding: 6px 0; border-bottom: 1px solid var(--line); color: var(--text-2); }
.signals td:last-child { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.pos { color: var(--good) !important; } .neg { color: var(--bad) !important; }
.btns { display: flex; gap: 8px; flex-wrap: wrap; }
.apk-banner { display: flex; gap: 14px; align-items: center; padding: 16px; border-radius: 18px; margin-bottom: 14px; background: linear-gradient(135deg, #3a1d14, #2a1a3d); border: 1px solid rgba(255,122,80,.35); }
.apk-banner svg.logo { width: 44px; height: 44px; stroke: var(--accent); fill: var(--accent); flex: none; }
.apk-banner .tx { flex: 1; font-size: 13px; color: var(--text-2); line-height: 1.4; }
.apk-banner .tx b { display: block; color: var(--text); font-size: 15px; margin-bottom: 2px; }

/* ---------- Lecteur ---------- */
.sheet { position: fixed; inset: 0; z-index: 40; background: var(--bg); display: flex; flex-direction: column; animation: up .28s cubic-bezier(.2,.8,.2,1); }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.sheet-bar { display: flex; align-items: center; gap: 8px; padding: calc(var(--safe-t) + 6px) 8px 6px; border-bottom: 1px solid var(--line); }
.sheet-title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; }
.sheet-body { flex: 1; overflow-y: auto; padding: 0 0 60px; }
.reader-hero { width: 100%; max-height: 46vh; object-fit: cover; display: block; }
.reader { max-width: 680px; margin: 0 auto; padding: 18px 18px 0; }
.reader h1 { font-family: var(--serif); font-size: 34px; line-height: 1.1; margin: 4px 0 6px; }
.reader .desc { color: var(--accent-2); font-weight: 600; margin: 0 0 16px; }
.reader h2 { font-family: var(--serif); font-size: 24px; margin: 30px 0 10px; }
.reader h3 { font-size: 18px; margin: 22px 0 8px; }
.reader h4, .reader h5 { font-size: 16px; margin: 18px 0 6px; color: var(--text-2); }
.reader p { font-size: 17px; line-height: 1.65; color: #e7e4de; margin: 0 0 14px; }
.reader figure { margin: 18px -18px; }
.reader figure img { width: 100%; display: block; max-height: 60vh; object-fit: contain; background: var(--bg-2); }
.reader figcaption { font-size: 12.5px; color: var(--text-3); padding: 6px 18px 0; }
.toc { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 4px 0 8px; }
.toc button { flex: none; font-size: 13px; padding: 6px 12px; border-radius: 99px; background: var(--bg-2); color: var(--text-2); }
.license { font-size: 12px; color: var(--text-3); border-top: 1px solid var(--line); margin-top: 30px; padding-top: 14px; line-height: 1.5; }

/* ---------- Accueil ---------- */
.onboarding { position: fixed; inset: 0; z-index: 50; background: radial-gradient(100% 60% at 50% 0%, #2a1610, var(--bg)); overflow-y: auto; }
.ob-inner { max-width: 720px; margin: 0 auto; padding: calc(var(--safe-t) + 40px) 16px 120px; }
.ob-logo { width: 64px; height: 64px; stroke: var(--accent); fill: var(--accent); }
.onboarding h1 { font-family: var(--serif); font-size: 46px; margin: 6px 0 8px; }
.onboarding .lead { color: var(--text-2); font-size: 17px; line-height: 1.5; margin: 0 0 26px; }
.onboarding h2 { font-size: 17px; margin: 0 0 12px; }
.ob-foot { position: fixed; left: 0; right: 0; bottom: 0; padding: 16px 16px calc(16px + var(--safe-b)); background: linear-gradient(transparent, var(--bg) 35%); }
.ob-foot .btn { max-width: 688px; margin: 0 auto; display: flex; }

/* ---------- Modale & toast ---------- */
.modal { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal-card { width: 100%; max-width: 560px; background: var(--bg-2); border-radius: 22px 22px 0 0; padding: 20px 18px calc(20px + var(--safe-b)); animation: up .25s cubic-bezier(.2,.8,.2,1); }
.modal-card h3 { margin: 0 0 6px; font-size: 18px; }
.modal-card p { color: var(--text-2); font-size: 14px; line-height: 1.5; margin: 0 0 14px; }
.menu-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 4px; font-size: 15px; border-bottom: 1px solid var(--line); text-align: left; }
.menu-item:last-child { border-bottom: 0; }
.menu-item svg { color: var(--text-2); }
.toast { position: fixed; z-index: 70; left: 50%; bottom: calc(var(--tab-h) + var(--safe-b) + 16px); transform: translateX(-50%); background: #f4f2ee; color: #111; padding: 11px 16px; border-radius: 14px; font-size: 14px; font-weight: 600; box-shadow: 0 8px 30px rgba(0,0,0,.4); max-width: calc(100vw - 32px); display: flex; gap: 8px; align-items: center; animation: toast .25s ease-out; }
.toast svg { width: 18px; height: 18px; color: var(--accent); }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 10px); } }

/* Crédits */
.credits summary { list-style: none; cursor: pointer; }
.credits summary::-webkit-details-marker { display: none; }
.credits summary h2 { margin: 0; }
.credits ul { margin: 0 0 12px; padding-left: 18px; color: var(--text-2); font-size: 13.5px; line-height: 1.5; }
.credits li { margin-bottom: 8px; }

/* Flèches de navigation (souris) */
.nav-arrows { display: none; }

/* ---------- Ordinateur et tablette ---------- */
@media (min-width: 900px) {
  :root { --side: 232px; }
  .view { inset: 0 0 0 var(--side); }
  .tabbar {
    top: 0; right: auto; width: var(--side); height: auto; padding: 22px 14px; flex-direction: column; justify-content: flex-start; gap: 4px;
    border-top: 0; border-right: 1px solid var(--line);
  }
  .tabbar::before { content: "Curio"; font-family: var(--serif); font-size: 28px; font-weight: 700; padding: 0 12px 22px; }
  .tabbar button { flex: none; flex-direction: row; justify-content: flex-start; gap: 14px; padding: 12px 14px; border-radius: 12px; font-size: 15px; font-weight: 600; }
  .tabbar button:hover { background: var(--bg-2); color: var(--text); }
  .tabbar button.on { background: var(--bg-2); }
  .toast { bottom: 24px; left: calc(50% + var(--side) / 2); }
  .feed-top { left: 50%; right: auto; width: min(100%, calc((100vh - 40px) * 0.62)); transform: translateX(-50%); padding-top: 26px; background: none; }
  .feed { padding: 20px 0; scroll-padding: 20px 0; }
  .feed .card {
    height: calc(100% - 40px); margin: 0 auto 40px; width: min(100%, calc((100vh - 40px) * 0.62));
    border-radius: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
  }
  .feed .card.loading, .feed .card.error { background: var(--bg-2); }
  .progress { top: 64px; }
  .nav-arrows { display: flex; flex-direction: column; gap: 10px; position: absolute; z-index: 12; top: 50%; transform: translateY(-50%); left: calc(50% + min(50%, (100vh - 40px) * 0.31) + 22px); }
  .nav-arrows button { width: 48px; height: 48px; border-radius: 50%; background: var(--bg-2); border: 1px solid var(--line); display: grid; place-items: center; }
  .nav-arrows button:hover { background: var(--bg-3); }
  .nav-arrows svg { transform: rotate(90deg); }
  .nav-arrows button + button svg { transform: rotate(-90deg); }
  .slide-arrow { position: absolute; z-index: 6; top: 50%; width: 40px; height: 40px; margin-top: -20px; border-radius: 50%; background: rgba(0,0,0,.45); backdrop-filter: blur(6px); display: grid; place-items: center; opacity: 0; transition: opacity .2s; }
  .card:hover .slide-arrow { opacity: 1; }
  .slide-arrow.prev { left: 10px; }
  .slide-arrow.next { right: 74px; }
  .slide-arrow.next svg { transform: rotate(180deg); }
  .slide-arrow[disabled] { display: none; }
  .modal { align-items: center; }
  .modal-card { border-radius: 22px; }
  .sheet { left: var(--side); }
  .onboarding .topic-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
}
@media (hover: hover) {
  .topic:hover, .row:hover, .rel:hover { filter: brightness(1.15); }
  .btn:hover { filter: brightness(1.1); }
}
@media (prefers-reduced-motion: reduce) {
  .card.active .slide.cover .bg.ok { animation: none; }
}

/* ---------- Catégories ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.cat { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 14px; border-radius: 18px; background: var(--bg-2); border: 1.5px solid transparent; text-align: left; min-height: 104px; transition: transform .12s; }
.cat:active { transform: scale(.97); }
.cat .ic { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; color: hsl(var(--h), 85%, 68%); background: hsla(var(--h), 70%, 50%, .16); }
.cat .ic svg { width: 24px; height: 24px; }
.cat .lbl { font-weight: 650; font-size: 14.5px; line-height: 1.2; }
.cat .tick { position: absolute; top: 10px; right: 10px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.08); color: transparent; }
.cat .tick svg { width: 15px; height: 15px; }
.cat.on { border-color: hsl(var(--h), 80%, 60%); background: hsla(var(--h), 60%, 40%, .16); }
.cat.on .tick { background: hsl(var(--h), 80%, 60%); color: #111; }
.cat-grid.small .cat { min-height: 0; flex-direction: row; align-items: center; padding: 10px; }
.cat-grid.small .cat .ic { width: 34px; height: 34px; border-radius: 10px; }
.cat-grid.small .cat .ic svg { width: 19px; height: 19px; }
.cat-grid.small .cat .lbl { font-size: 13px; padding-right: 24px; }
.cat-grid.small .cat .tick { top: 50%; margin-top: -12px; }

/* ---------- Accueil en étapes ---------- */
.ob-h { font-family: var(--serif); font-size: 32px !important; line-height: 1.1; margin: 10px 0 10px !important; }
.how { display: grid; gap: 10px; margin: 0 0 22px; }
.how > div { display: flex; gap: 14px; align-items: flex-start; padding: 14px; border-radius: 16px; background: rgba(255,255,255,.04); border: 1px solid var(--line); }
.how .ic { width: 42px; height: 42px; border-radius: 12px; flex: none; display: grid; place-items: center; background: rgba(255,122,80,.14); color: var(--accent); }
.how p { margin: 0; font-size: 14px; color: var(--text-2); line-height: 1.45; }
.how b { display: block; color: var(--text); font-size: 15px; margin-bottom: 2px; }
.ob-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 12px; }
.ob-dots i { width: 7px; height: 7px; border-radius: 99px; background: var(--line); transition: width .2s; }
.ob-dots i.on { width: 22px; background: var(--accent); }
.ob-dots i.done { background: var(--text-3); }
.ob-foot { display: flex; flex-direction: column; align-items: center; }
.ob-foot .btn { width: 100%; }
.zone { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 18px; }
.zchoice { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px; border-radius: 18px; background: var(--bg-2); border: 1.5px solid transparent; text-align: left; }
.zchoice svg { color: var(--accent); width: 28px; height: 28px; }
.zchoice b { font-size: 17px; }
.zchoice span { font-size: 12.5px; color: var(--text-3); line-height: 1.35; }
.zchoice.on { border-color: var(--accent); background: rgba(255,122,80,.1); }
.field-lab { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.area-row { display: flex; gap: 8px; flex-wrap: wrap; }
.area-row select { flex: 1; min-width: 180px; }

/* ---------- Formulaire de compte ---------- */
.acc-form { display: flex; flex-direction: column; gap: 14px; }
.acc-form label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; font-weight: 600; color: var(--text-2); }
.acc-form input { height: 50px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg-3); color: var(--text); font: inherit; font-size: 16px; outline: none; }
.acc-form input:focus { border-color: var(--accent); }
.acc-err { margin: 0; color: var(--bad); font-size: 14px; }
.acc-alt { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.linkish { color: var(--accent-2); font-size: 14px; font-weight: 600; padding: 6px 0; }

/* Textes plus courts, plus lisibles */
.slide.text p { font-size: 19px; line-height: 1.5; }
.cover .lead { font-size: 17px; -webkit-line-clamp: 4; }

/* ---------- Cartes spéciales du fil ---------- */
.cover.quote { background: radial-gradient(120% 80% at 20% 10%, hsl(var(--h, 280), 45%, 22%), var(--bg)); }
.cover.quote .bg { opacity: .28 !important; filter: grayscale(.4); }
.cover.quote .content { top: 0; display: flex; flex-direction: column; justify-content: center; }
.cover blockquote { font-family: var(--serif); font-size: clamp(22px, 6.2vw, 32px); line-height: 1.3; margin: 16px 0 14px; position: relative; text-wrap: pretty; }
.cover blockquote::before { content: "\201C"; position: absolute; left: -6px; top: -54px; font-size: 110px; color: var(--accent); opacity: .5; font-family: Georgia, serif; }

/* ---------- Accueil (première visite) ---------- */
.ob-top { display: flex; align-items: center; justify-content: space-between; margin: -16px 0 22px; }
.ob-brand { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-size: 22px; font-weight: 700; }
.ob-brand svg { width: 30px; height: 30px; stroke: var(--accent); fill: var(--accent); }
.ob-signin { border-radius: 99px; border: 1.5px solid var(--accent); color: var(--text); padding: 8px 14px; font-weight: 600; }
.ob-signin svg { width: 16px; height: 16px; color: var(--accent); }
.ob-hero { font-family: var(--serif); font-size: clamp(36px, 10vw, 54px); line-height: 1.02; margin: 0 0 10px; letter-spacing: -.01em; }
.ob-hero span { color: var(--accent); }
.ob-sub { color: var(--text-2); font-size: 16px; margin: 0 0 18px; }
@keyframes dgood { 0%, 35% { background: var(--bg); border-color: var(--line); } 45%, 90% { background: rgba(79,208,138,.18); border-color: var(--good); } 100% { background: var(--bg); } }
@keyframes dtick { 0%, 40% { opacity: 0; } 48%, 90% { opacity: 1; } 100% { opacity: 0; } }
.ob-feats { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 18px; }
.ob-feats span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 11px; border-radius: 99px; background: var(--bg-2); font-size: 13px; color: var(--text-2); }
.ob-feats svg { width: 15px; height: 15px; color: var(--accent); }
.seg.mini { margin: 0; }
.seg.mini button { font-size: 13px; }
.cat .ic.flag { font-size: 26px; background: none; }

/* Arabe débutant : un mot à la fois */
.oral-card { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 14px; margin: 8px 0 14px; border-radius: 22px; background: var(--bg-2); border: 1px solid var(--line); text-align: center; }
.oral-ar { font-size: 56px; line-height: 1.3; margin: 0; }
.oral-tl { font-size: 26px; font-weight: 700; color: var(--accent-2); margin: 0; }
.oral-fr { font-size: 19px; margin: 0 0 6px; }
.tl { color: var(--accent-2); font-weight: 700; font-size: 18px; margin: 4px 0 0; text-align: center; }
.tl.big { font-size: 24px; }
.ar-opts .opt { font-size: 22px; text-align: center; }
.acc-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.acc-btns .btn { justify-content: center; }

/* ---------- Lien vers Kalima (les langues ont leur app) ---------- */
.kalima-banner { display: flex; align-items: center; gap: 12px; padding: 14px; margin: 14px 0; border-radius: 18px; text-decoration: none; color: var(--text);
  background: linear-gradient(135deg, #0f3d3a, #16544f); border: 1px solid rgba(231,162,58,.35); }
.kalima-banner .k-logo { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 12px; background: #f6f3ec; color: #0f3d3a;
  font: 600 28px/1 "Noto Naskh Arabic", "Amiri", serif; }
.kalima-banner .tx { flex: 1; font-size: 14px; color: rgba(255,255,255,.82); line-height: 1.4; }
.kalima-banner .tx b:first-child { display: block; color: #fff; font-size: 15px; }
.kalima-banner svg { transform: rotate(180deg); color: #e7a23a; flex: none; }

/* ---------- Administration ---------- */
.adm { max-height: 60vh; overflow-y: auto; }
.adm-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.adm-row > span { flex: 1; min-width: 0; } .adm-row small, .adm-acc small { display: block; color: var(--text-3); font-size: 12px; }
.adm-row.off { opacity: .55; }
.adm-acc { padding: 8px 0; border-bottom: 1px solid var(--line); } .adm-acc summary { cursor: pointer; list-style: none; }
.btn.small { padding: 6px 10px; font-size: 12.5px; }

/* ---------- Réglages : profil, notifications (repris de la 1.4) ---------- */
.modal-card { max-height: 90vh; overflow-y: auto; }
.small-seg { margin: 6px 0 10px; }
.times { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }
.time-chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border-radius: 12px; background: var(--bg-3); }
.time-chip input { border: 0; background: transparent; padding: 6px 8px; }
.time-chip button { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.time-chip button svg { width: 14px; height: 14px; }
.range-t { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; }
.perm-warn { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 14px; background: rgba(255,93,108,.12); margin-bottom: 10px; font-size: 14px; }
.perm-warn span { flex: 1; }
#settings .panel { padding: 14px; margin-bottom: 10px; }
#settings .panel .sub { margin-bottom: 10px; }
.prof-row { display: flex; align-items: center; gap: 12px; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,122,80,.15); color: var(--accent); flex: none; }
.prof-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.prof-tx b { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-stats { display: flex; gap: 16px; margin-top: 12px; font-size: 13px; color: var(--text-3); flex-wrap: wrap; }
.mini-stats b { color: var(--text); font-size: 15px; margin-right: 3px; }
.mini-stats svg { width: 15px; height: 15px; color: var(--accent); vertical-align: -2px; }
.fold summary { list-style: none; cursor: pointer; display: flex; align-items: center; }
.fold summary::-webkit-details-marker { display: none; }
.fold summary h2 { margin: 0; flex: 1; }
.fold summary::after { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--text-3); border-bottom: 2px solid var(--text-3); transform: rotate(45deg); transition: transform .2s; margin-right: 6px; }
.fold[open] summary::after { transform: rotate(-135deg); }
.fold[open] summary { margin-bottom: 8px; }
.fold-h { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--text-3); margin: 16px 0 8px; }
.chip { align-self: flex-start; }
.swipe-hint { top: calc(var(--safe-t) + 70px); bottom: auto; right: 16px; }
@media (min-width: 900px) { .swipe-hint { top: 76px; } }
.nlist { display: flex; flex-direction: column; gap: 8px; margin: 6px 0 4px; }
.nrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-radius: 14px; background: var(--bg-3); }
.ncheck { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 150px; cursor: pointer; }
.ncheck input { width: 20px; height: 20px; accent-color: var(--accent); }
.ncheck span { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.ncheck svg { width: 18px; height: 18px; color: var(--accent); }
.stepper { display: inline-flex; align-items: center; gap: 6px; }
.stepper button { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-2); }
.stepper button svg { width: 15px; height: 15px; }
.stepper b { min-width: 16px; text-align: center; }
.stepper small { color: var(--text-3); }
.nrow .times { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.nplan { line-height: 1.7; margin: 8px 2px 0; }
.nplan svg { width: 14px; height: 14px; vertical-align: -2px; }
.range-t input { background: var(--bg-3); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: 6px 8px; font: inherit; }
