/* ============================================
   CHANTS D'ESPÉRANCE - CSS PRO FINAL
   ============================================ */

/* ---------- VARIABLES ---------- */
:root {
  color-scheme: dark;
  --bg: #0e0b22;
  --panel: #171335;
  --side: #120e2c;
  --line: #2a2456;
  --ink: #f0ecff;
  --mut: #9a95c8;
  --acc: #ffb36b;
  --accbg: rgba(255, 179, 107, .13);
  --glass: rgba(14, 11, 34, .8);
  --blur: saturate(1.6) blur(18px);
  --go: linear-gradient(135deg, #d93f6a, #e9803a);
  --card: #1d1840;
  --shadow: 0 4px 20px rgba(0, 0, 0, .35);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .25);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --font-sans: system-ui, "Segoe UI", Roboto, Arial, sans-serif;
  --font-bold: "Arial Black", "Segoe UI Black", system-ui, sans-serif;
  --t: .2s cubic-bezier(.4, 0, .2, 1);
}
@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #f4f2fb;
    --panel: #fff;
    --side: #eae7f6;
    --line: #dcd8ee;
    --ink: #1c1844;
    --mut: #6a6890;
    --acc: #5a3fd6;
    --accbg: #e7e2fb;
    --glass: rgba(244, 242, 251, .8);
    --card: #fff;
    --shadow: 0 4px 20px rgba(28, 24, 68, .1);
    --shadow-sm: 0 2px 8px rgba(28, 24, 68, .08);
  }
}

/* ---------- RESET ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.35 var(--font-ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}
button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  touch-action: manipulation;
  transition: opacity var(--t), background var(--t), transform var(--t), color var(--t), border-color var(--t);
}
button:active { opacity: .65; transform: scale(.97); }
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
}
svg {
  width: 1.3em;
  height: 1.3em;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

/* ---------- APP GRID ---------- */
#app {
  height: 100dvh;
  display: grid;
  grid-template-columns: 220px 340px minmax(0, 1fr);
  grid-template-rows: auto auto 1fr auto;
  grid-template-areas:
    "tb tb tb"
    "side lh pv"
    "side list pv"
    "sbar sbar sbar";
}

/* ---------- TITLEBAR ---------- */
#tb {
  grid-area: tb;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: env(titlebar-area-height, 46px);
  padding: 0 12px 0 max(14px, env(titlebar-area-x, 0px));
  background: var(--side);
  border-bottom: 1px solid var(--line);
  -webkit-app-region: drag;
  app-region: drag;
}
#tb button { -webkit-app-region: no-drag; app-region: no-drag; }
.mark { width: 26px; height: 26px; }
.bt { font: 700 1.05rem var(--font-serif); }
.sp { flex: 1; }
.pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px;
  border-radius: 99px;
  background: var(--bg);
  border: 1px solid var(--line);
  font-size: .8rem;
  color: var(--mut);
  transition: color var(--t), border-color var(--t);
}
.pill i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mut);
  transition: background var(--t), box-shadow var(--t);
}
.pill.on { color: var(--ink); border-color: var(--acc); }
.pill.on i { background: #e9503f; box-shadow: 0 0 0 3px rgba(233, 80, 63, .28); }
.tbtn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  font-size: .85rem;
  font-weight: 500;
}
.tbtn:hover { border-color: var(--acc); color: var(--acc); }
.tbtn.on { background: var(--go); color: #fff; border-color: transparent; }

/* ---------- SIDEBAR ---------- */
#side {
  grid-area: side;
  background: var(--side);
  border-right: 1px solid var(--line);
  padding: 12px 8px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
#chips { display: contents; }
.nv, .chip {
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  font-size: .9rem;
  transition: background var(--t), color var(--t);
}
.nv:hover, .chip:hover { background: var(--accbg); }
.nv.on, .chip.on {
  background: var(--accbg);
  color: var(--acc);
  font-weight: 600;
}
.sep { height: 1px; background: var(--line); margin: 10px 6px; }

/* ---------- LIST HEADER ---------- */
#lh {
  grid-area: lh;
  padding: 14px 12px 8px;
  border-right: 1px solid var(--line);
}
#lrow { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
#lrow #vt { margin: 0 !important; flex: 1; }
#vt {
  font: 700 1.5rem var(--font-serif);
  margin: 0 0 10px;
  transition: font-size var(--t);
}
#newb {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--go);
  color: #fff;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
}
#newb:hover { transform: scale(1.08); }
#sw {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px;
  height: 36px;
  border-radius: var(--r-sm);
  background: var(--side);
  color: var(--mut);
  transition: background var(--t);
}
#sw:focus-within { background: var(--panel); border: 1px solid var(--acc); }
#q {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-size: .95rem;
  outline: 0;
  -webkit-user-select: text;
  user-select: text;
}
#q::placeholder { color: var(--mut); }
#pacts { display: flex; gap: 8px; margin-top: 6px; }

/* ---------- LIST ---------- */
#list {
  grid-area: list;
  overflow: auto;
  border-right: 1px solid var(--line);
  padding-bottom: 12px;
  -webkit-overflow-scrolling: touch;
}
#cnt { color: var(--mut); font-size: .78rem; padding: 6px 16px; }
ul { list-style: none; margin: 0; padding: 0; }
li {
  display: flex;
  align-items: center;
  margin: 0 6px;
  border-radius: var(--r-sm);
  min-height: 50px;
  transition: background var(--t);
}
li.on { background: var(--accbg); }
.row {
  flex: 1;
  display: flex;
  gap: 10px;
  align-items: center;
  text-align: left;
  padding: 6px 8px;
  min-width: 0;
  border-radius: var(--r-sm);
}
.row:hover { background: var(--accbg); }
.num {
  flex: none;
  min-width: 2.4em;
  text-align: center;
  color: var(--acc);
  font: 700 1.02rem var(--font-serif);
  font-variant-numeric: tabular-nums;
}
.tt { min-width: 0; }
.tt b, .tt small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tt b { font-weight: 600; }
.tt small { color: var(--mut); font-size: .8rem; }
.add {
  flex: none;
  width: 32px;
  height: 32px;
  margin: 0 6px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  font-size: 1rem;
  color: var(--mut);
  display: grid;
  place-items: center;
  transition: background var(--t), color var(--t), border-color var(--t), transform var(--t);
}
.add:hover { border-color: var(--acc); color: var(--acc); transform: scale(1.1); }
.add.in {
  background: var(--go);
  border-color: transparent;
  color: #fff;
}

/* ============================================
   ZONE D'APERÇU AVEC ONGLETS
   ============================================ */
#pv {
  grid-area: pv;
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0;
}

/* En-tête sticky avec titre + onglets segmentés */
#pv-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px 10px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  flex: none;
  z-index: 3;
}
#pv-title {
  font: 600 .82rem var(--font-ui);
  color: var(--mut);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: right;
  flex: 1;
  min-width: 0;
}

/* Segmenté iOS */
#pv-tabs {
  position: relative;
  display: inline-flex;
  background: var(--side);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 3px;
  flex: none;
}
#pv-tabs button {
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 7px;
  font-size: .82rem;
  font-weight: 500;
  color: var(--mut);
  transition: color var(--t);
  white-space: nowrap;
}
#pv-tabs button svg { width: 15px; height: 15px; }
#pv-tabs button.on { color: var(--ink); }
#pv-tab-ind {
  position: absolute;
  z-index: 1;
  top: 3px;
  bottom: 3px;
  left: 3px;
  background: var(--panel);
  border-radius: 7px;
  box-shadow: var(--shadow-sm);
  transition: transform .28s cubic-bezier(.4, 0, .2, 1), width .28s cubic-bezier(.4, 0, .2, 1);
  pointer-events: none;
}

/* Vues (crossfade) */
.pv-view {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px 22px 22px;
  animation: pvFadeIn .22s ease;
}
@keyframes pvFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.pv-view[hidden] { display: none !important; }

/* Vue Direct */
#pv-direct {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
#mon {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  background: #000;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1.5px solid var(--line);
  transition: border-color var(--t), box-shadow var(--t);
  flex: none;
}
#mon.live {
  border-color: #e9503f;
  box-shadow: 0 0 0 3px rgba(233, 80, 63, .2);
}
#pvf {
  position: absolute;
  left: 0;
  top: 0;
  width: 1280px;
  height: 720px;
  border: 0;
  transform-origin: 0 0;
  pointer-events: none;
}

/* Contrôles */
#ctl {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
#ctl button {
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px;
  background: var(--panel);
  min-width: 40px;
  min-height: 40px;
  position: relative;
  transition: border-color var(--t), color var(--t), background var(--t), transform var(--t);
}
#ctl button:hover { border-color: var(--acc); color: var(--acc); }
#ctl button.on { background: var(--acc); color: var(--bg); border-color: var(--acc); }
#ctl button.ctl-main {
  min-width: 56px;
  min-height: 56px;
  background: var(--go);
  color: #fff;
  border-color: transparent;
  border-radius: 50%;
  box-shadow: var(--shadow-sm);
  margin: 0 4px;
}
#ctl button.ctl-main svg { width: 1.7em; height: 1.7em; }
#ctl button[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: -34px;
  left: 50%;
  transform: translateX(-50%) scale(.9);
  background: var(--ink);
  color: var(--bg);
  padding: 4px 8px;
  border-radius: 6px;
  font-size: .7rem;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t), transform var(--t);
  z-index: 10;
}
#ctl button[data-tip]:hover::after {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}
#meta {
  color: var(--mut);
  font-size: .82rem;
  margin-top: 2px;
}

/* Vue Diapositives */
#pv-slides {
  padding-top: 18px;
}
#pv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
}
.pv-card {
  position: relative;
  display: flex;
  flex-direction: column;
  aspect-ratio: 16/9;
  border-radius: var(--r-md);
  overflow: hidden;
  background: #0b1624;
  border: 1.5px solid var(--line);
  color: #f5f1e6;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color var(--t), transform var(--t), box-shadow var(--t);
  text-align: center;
  font-family: var(--font-serif);
}
.pv-card:hover {
  border-color: var(--acc);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.pv-card:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.pv-card.r { font-style: italic; }
.pv-card.live {
  border-color: #e9503f;
  box-shadow: 0 0 0 2px rgba(233, 80, 63, .3);
}
.pv-card-type {
  position: absolute;
  top: 6px;
  left: 6px;
  z-index: 2;
  font: 600 .62rem var(--font-ui);
  padding: 2px 7px;
  border-radius: 5px;
  background: rgba(0, 0, 0, .55);
  color: rgba(255, 255, 255, .85);
  letter-spacing: .02em;
}
.pv-card.live .pv-card-type { background: #e9503f; color: #fff; }
.pv-card-live {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 5px;
  font: 700 .6rem var(--font-ui);
  padding: 2px 7px 2px 5px;
  border-radius: 5px;
  background: #e9503f;
  color: #fff;
  letter-spacing: .04em;
}
.pv-card-live::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  animation: pvPulse 2s ease-in-out infinite;
}
@keyframes pvPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .5; transform: scale(.8); }
}
.pv-card-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 6px 0;
}
.pv-card-text {
  white-space: pre-line;
  font-size: clamp(9px, 1.4vw, 13px);
  line-height: 1.3;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pv-card-title {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.pv-card-title .pv-n {
  font: 700 1.4rem var(--font-ui);
  color: #e9c46a;
  line-height: 1;
}
.pv-card-title .pv-t {
  font: 700 .72rem var(--font-serif);
  color: #f5f1e6;
}
.pv-card-title .pv-c {
  font: .55rem var(--font-ui);
  opacity: .65;
  margin-top: 2px;
}
.pv-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--mut);
  padding: 40px 20px;
  font-size: .9rem;
}

/* ---------- STATUS BAR ---------- */
#sbar {
  grid-area: sbar;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 5px 14px;
  background: var(--side);
  border-top: 1px solid var(--line);
  font-size: .75rem;
  color: var(--mut);
}

/* ---------- TABS (mobile) ---------- */
#tabs { display: none; }

/* ---------- SETTINGS PANEL ---------- */
#set {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  pointer-events: none;
  background: rgba(0, 0, 0, .45);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}
#set.on { display: block; }
#sh {
  pointer-events: auto;
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 420px;
  max-width: 100%;
  background: var(--bg);
  padding: 18px;
  overflow: auto;
  box-shadow: 8px 0 30px rgba(0, 0, 0, .35);
  border-right: 1px solid var(--line);
  animation: slideIn var(--t);
}
@keyframes slideIn {
  from { transform: translateX(-100%); }
  to { transform: none; }
}
#sh h2 { font: 700 1.2rem var(--font-serif); margin: 0 0 6px; }
#sh .lb {
  font-weight: 600;
  margin: 18px 0 8px;
  display: block;
  font-size: .9rem;
  color: var(--mut);
  text-transform: uppercase;
  letter-spacing: .04em;
}
#sh .fr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 10px 0;
  padding: 8px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: .9rem;
}
#sh .fr input[type=range] {
  flex: 1;
  max-width: 180px;
  accent-color: var(--acc);
}
#sh .fr select,
#sh .fr input[type=color] {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
}
#sh .fr input[type=color] {
  width: 44px;
  height: 34px;
  padding: 2px;
  cursor: pointer;
}
#sh .fr input[type=checkbox] {
  width: 20px;
  height: 20px;
  accent-color: var(--acc);
  cursor: pointer;
}
#bgs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.th {
  position: relative;
  height: 64px;
  border-radius: var(--r-sm);
  border: 2px solid var(--line);
  color: #fff;
  font-size: .78rem;
  text-shadow: 0 1px 3px #000;
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 5px;
  text-align: left;
  background: #333;
  overflow: hidden;
  transition: border-color var(--t), transform var(--t);
}
.th:hover { transform: scale(1.03); }
.th.on {
  border-color: var(--acc);
  outline: 2px solid var(--acc);
  outline-offset: 1px;
}
.th.add {
  background: var(--card);
  color: var(--ink);
  text-shadow: none;
  align-items: center;
  justify-content: center;
  border-style: dashed;
  cursor: pointer;
  font-weight: 500;
}
.th.add:hover { border-color: var(--acc); color: var(--acc); }
.th i {
  position: absolute;
  top: 2px;
  right: 4px;
  font-style: normal;
  background: rgba(0, 0, 0, .7);
  border-radius: 50%;
  width: 22px;
  height: 22px;
  line-height: 22px;
  text-align: center;
  font-size: .8rem;
  cursor: pointer;
  transition: background var(--t);
}
.th i:hover { background: #e9503f; }
.in {
  width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  font: 16px/1.4 var(--font-ui);
  -webkit-user-select: text;
  user-select: text;
  transition: border-color var(--t);
}
.in:focus { border-color: var(--acc); outline: 0; }
textarea.in {
  resize: vertical;
  font-family: var(--font-serif);
  line-height: 1.5;
  min-height: 120px;
}
label.lb { display: block; }
.eacts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.hint {
  color: var(--mut);
  font-size: .8rem;
  margin: 8px 0;
  line-height: 1.5;
}
.go {
  background: var(--go);
  color: #fff;
  border-radius: var(--r-md);
  padding: 10px 18px;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}
.go:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.ghost {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 10px 16px;
  background: var(--panel);
}
.ghost:hover { border-color: var(--acc); color: var(--acc); }
.empty { color: var(--mut); padding: 30px 0; text-align: center; }

/* ---------- STAGE ---------- */
#stage {
  --sb: #0b1624;
  --st: #f5f1e6;
  --sa: #e9c46a;
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  flex-direction: column;
  background: var(--sb);
  color: var(--st);
}
#stage.on { display: flex; }
#bgl {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: var(--sb);
  transition: filter .4s;
}
#bgl > * {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#dim {
  position: absolute;
  inset: 0;
  background: #000;
  pointer-events: none;
  transition: opacity .3s;
}
#slide {
  position: relative;
  z-index: 1;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6vh 6vw;
  overflow: hidden;
  text-align: center;
  font-family: var(--font-serif);
}
#lab {
  font: 600 max(14px, 2.4vh) var(--font-ui);
  color: var(--sa);
  letter-spacing: .04em;
  margin-bottom: 1.6vh;
  min-height: 1em;
}
#txt {
  white-space: pre-line;
  line-height: 1.3;
  max-width: 100%;
  transition: opacity .22s ease, transform .26s cubic-bezier(.4, 0, .2, 1);
  will-change: opacity, transform;
}
#txt.swap-out { opacity: 0; transform: translateY(-6px); }
#txt.swap-in { opacity: 0; transform: translateY(6px); }
#txt.r { font-style: italic; }
#txt .tn {
  font: 700 1.6em var(--font-ui);
  color: var(--sa);
  line-height: 1.1;
  margin-bottom: .25em;
}
#txt .tc {
  font: .45em var(--font-ui);
  opacity: .6;
  margin-top: .9em;
}
#foot, #bar { z-index: 2; }
#foot {
  position: absolute;
  left: 3vw;
  right: 3vw;
  bottom: 1.4vh;
  display: flex;
  justify-content: space-between;
  font: 14px var(--font-ui);
  opacity: .4;
}
#bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  padding: 10px;
  background: linear-gradient(rgba(0, 0, 0, .65), transparent);
  transition: opacity .3s;
}
#bar button {
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border-radius: var(--r-sm);
  padding: 7px 12px;
  font-size: .9rem;
  border: 1px solid rgba(255, 255, 255, .1);
}
#bar button:hover { background: rgba(255, 255, 255, .25); }
#bar button.on { background: #e9c46a; color: #10203a; }
#stage.idle #bar { opacity: 0; pointer-events: none; }
#stage.idle { cursor: none; }
#stage.blank #slide, #stage.blank #foot { visibility: hidden; }

/* ---------- SPLASH ---------- */
#splash {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: grid;
  place-items: center;
  transition: opacity .4s ease, visibility .4s;
}
#splash.off { opacity: 0; visibility: hidden; pointer-events: none; }
#splash-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
  animation: splashIn .5s cubic-bezier(.2, .8, .2, 1);
}
@keyframes splashIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
#splash-logo {
  width: 110px;
  height: 110px;
  stroke: var(--ink);
  stroke-width: 1.4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 6px 24px rgba(232, 86, 124, .25));
}
#splash-logo .sp-dome { stroke: none; }
#splash-logo .sp-rays {
  stroke: var(--ink);
  stroke-dasharray: 200;
  stroke-dashoffset: 200;
  animation: drawRay 1.1s .3s ease forwards;
}
@keyframes drawRay { to { stroke-dashoffset: 0; } }
#splash-title {
  margin: 0;
  font: 700 1.5rem var(--font-serif);
  letter-spacing: .01em;
  color: var(--ink);
}
#splash-word {
  margin: 0;
  font: italic 400 .9rem/1.5 var(--font-serif);
  color: var(--mut);
  max-width: 280px;
  min-height: 2.7em;
  opacity: 0;
  animation: fadeWord .6s .8s ease forwards;
}
@keyframes fadeWord {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: .9; transform: none; }
}
#splash-notes {
  position: relative;
  width: 140px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--acc);
  font-size: 1.1rem;
  margin-top: 6px;
}
#splash-notes svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  stroke: var(--line);
  stroke-width: 1;
  opacity: .5;
}
#splash-notes .note {
  position: relative;
  z-index: 1;
  opacity: 0;
  transform: translateY(6px) scale(.8);
  animation: notePop .45s ease forwards;
  animation-delay: calc(1.2s + var(--d));
}
@keyframes notePop {
  to { opacity: 1; transform: none; }
}

/* ---------- DIALOG ---------- */
#dlg {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  padding: 20px;
}
#dlg.on { display: grid; }
#dlg-card {
  background: var(--panel);
  color: var(--ink);
  border-radius: var(--r-lg);
  padding: 24px;
  max-width: 420px;
  width: 100%;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  animation: popIn var(--t);
}
@keyframes popIn {
  from { transform: scale(.92); opacity: 0; }
  to { transform: none; opacity: 1; }
}
#dlg-t { margin: 0 0 8px; font: 700 1.15rem var(--font-serif); }
#dlg-m { margin: 0 0 20px; color: var(--mut); line-height: 1.5; white-space: pre-line; }
#dlg-a { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- TOAST ---------- */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--panel);
  color: var(--ink);
  padding: 12px 20px;
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  font-size: .9rem;
  z-index: 50;
  opacity: 0;
  pointer-events: none;
  transition: transform .3s cubic-bezier(.4, 0, .2, 1), opacity .3s;
  max-width: 90vw;
}
#toast.on {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ---------- MODAL DON ---------- */
#don {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  background: rgba(0, 0, 0, .55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  padding: 20px;
}
#don.on { display: grid; }
#don-card {
  position: relative;
  background: var(--panel);
  color: var(--ink);
  border-radius: var(--r-lg);
  padding: 26px 24px 22px;
  max-width: 440px;
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  animation: popIn var(--t);
}
#don-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--mut);
  transition: background var(--t), color var(--t);
}
#don-x:hover { background: var(--accbg); color: var(--acc); }
#don-x svg { width: 18px; height: 18px; }
#don-t {
  margin: 0 0 6px;
  font: 700 1.25rem var(--font-serif);
  padding-right: 30px;
}
.don-sub {
  margin: 0 0 14px;
  color: var(--acc);
  font: 600 .78rem var(--font-ui);
  letter-spacing: .02em;
}
.don-intro {
  margin: 0 0 18px;
  color: var(--mut);
  font-size: .85rem;
  line-height: 1.55;
}
.don-lb {
  display: block;
  font: 600 .82rem var(--font-ui);
  color: var(--ink);
  margin: 16px 0 6px;
}
.don-opt {
  font-weight: 400;
  color: var(--mut);
  font-size: .75rem;
}
.don-amounts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}
.don-amt {
  flex: 1 1 auto;
  min-width: 60px;
  padding: 9px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  font: 600 .9rem var(--font-ui);
  transition: background var(--t), border-color var(--t), color var(--t);
}
.don-amt:hover { border-color: var(--acc); color: var(--acc); }
.don-amt.on {
  background: var(--accbg);
  border-color: var(--acc);
  color: var(--acc);
}
.don-custom { margin-top: 4px; }
#don-card .in { margin-bottom: 4px; }
.don-note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin: 16px 0 18px;
  padding: 10px 12px;
  background: var(--accbg);
  border-radius: var(--r-sm);
  color: var(--ink);
  font-size: .8rem;
  line-height: 1.5;
}
.don-note svg {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--acc);
  margin-top: 1px;
}
.don-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
}
.don-actions .go {
  display: flex;
  align-items: center;
  gap: 8px;
}
.don-actions .go svg { width: 16px; height: 16px; }

/* ---------- À PROPOS ---------- */
.about-sep {
  height: 1px;
  background: var(--line);
  margin: 24px 0 16px;
}
.about-title {
  font: 700 1rem var(--font-serif);
  margin: 0 0 10px;
}
.about-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 14px 16px;
  font-size: .85rem;
  line-height: 1.65;
  color: var(--mut);
}
.about-card b { color: var(--ink); font-weight: 600; }
.about-card a {
  color: var(--acc);
  text-decoration: none;
  -webkit-user-select: text;
  user-select: text;
}
.about-card a:hover { text-decoration: underline; }
.about-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.about-actions .ghost {
  padding: 7px 12px;
  font-size: .82rem;
}
.donate-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--go);
  color: #fff;
  font-weight: 600;
  font-size: .9rem;
  justify-content: center;
  box-shadow: var(--shadow-sm);
  transition: transform var(--t), box-shadow var(--t);
}
.donate-btn:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.donate-btn svg { width: 18px; height: 18px; }

/* ---------- BANNIÈRE MAJ ---------- */
#update-banner {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 55;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--panel);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow);
  font-size: .85rem;
  animation: slideUpBanner .3s cubic-bezier(.2, .8, .2, 1);
  max-width: calc(100vw - 32px);
}
@keyframes slideUpBanner {
  from { transform: translateX(-50%) translateY(20px); opacity: 0; }
  to { transform: translateX(-50%) translateY(0); opacity: 1; }
}
#update-banner button {
  padding: 6px 12px;
  border-radius: var(--r-sm);
  font-size: .82rem;
  font-weight: 600;
}
#update-go { background: var(--go); color: #fff; border: 0; }
#update-x { color: var(--mut); padding: 6px 8px; font-size: .9rem; }
#update-x:hover { color: var(--ink); }

/* ---------- OUT MODE ---------- */
body.out #app,
body.out #set,
body.out #bar,
body.out #foot,
body.out #tabs { display: none !important; }
body.out { cursor: none; }

/* ---------- RESPONSIVE MOBILE ---------- */
@media (max-width: 859px) {
  #tb, #sbar { display: none; }
  #app {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto auto 1fr auto;
    grid-template-areas: "lh" "side" "list" "tabs";
  }
  #side {
    flex-direction: row;
    overflow-x: auto;
    padding: 2px 16px 10px;
    border: 0;
    background: none;
    gap: 8px;
    scrollbar-width: none;
  }
  #side::-webkit-scrollbar { display: none; }
  .nv, .sep { display: none; }
  .chip {
    flex: none;
    border: 1px solid var(--line);
    border-radius: 99px;
    padding: 7px 14px;
    white-space: nowrap;
    background: var(--panel);
  }
  .chip.on {
    background: var(--ink);
    color: var(--bg);
    border-color: var(--ink);
  }
  #lh {
    border: 0;
    padding: calc(12px + env(safe-area-inset-top)) 16px 8px;
  }
  #vt {
    font-size: 2.1rem;
    margin-bottom: 8px;
    transition: font-size .2s, margin .2s;
  }
  .scrolled #vt {
    font-size: 1.05rem;
    text-align: center;
    margin-bottom: 6px;
  }
  #sw { height: 40px; border-radius: var(--r-md); }
  #q { font-size: 1rem; }
  #list { border: 0; padding: 0 16px 12px; }
  #ul {
    background: var(--panel);
    border-radius: var(--r-lg);
    overflow: hidden;
    border: 1px solid var(--line);
  }
  li {
    margin: 0;
    border-radius: 0;
    min-height: 60px;
    border-bottom: 1px solid var(--line);
  }
  li:last-child { border: 0; }
  li.on { background: none; }
  .row { border-radius: 0; }
  .tt b { font-size: 1rem; }
  .num { font-size: 1.1rem; }
  .add { width: 36px; height: 36px; }
  #tabs {
    grid-area: tabs;
    display: flex;
    background: var(--glass);
    -webkit-backdrop-filter: var(--blur);
    backdrop-filter: var(--blur);
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  #tabs button {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 0 6px;
    font-size: .68rem;
    color: var(--mut);
    position: relative;
  }
  #tabs button svg { width: 24px; height: 24px; }
  #tabs button.on { color: var(--acc); }
  #tabs button.on::before {
    content: "";
    position: absolute;
    top: 0;
    left: 25%;
    right: 25%;
    height: 2px;
    background: var(--acc);
    border-radius: 0 0 2px 2px;
  }
  #pv {
    position: fixed;
    inset: 0;
    z-index: 15;
    background: var(--bg);
    padding: 0;
    transform: translateX(100%);
    transition: transform .3s cubic-bezier(.2, .8, .2, 1);
  }
  #pv.open { transform: none; }
  #pv-head {
    padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
    flex-wrap: wrap;
  }
  #pv-title { display: none; }
  #pv-tabs { flex: 1; }
  #pv-tabs button { flex: 1; justify-content: center; padding: 8px 10px; }
  .pv-view { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); }
  #pv-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  #ctl { justify-content: center; }
  #ctl button.ctl-main { order: -1; }
  #set {
    pointer-events: auto;
    background: rgba(0, 0, 0, .45);
  }
  #sh {
    top: auto;
    left: 0;
    right: 0;
    width: 100%;
    max-height: 92dvh;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    border: 0;
    padding: 10px 18px calc(18px + env(safe-area-inset-bottom));
    box-shadow: none;
    animation: slideUp var(--t);
  }
  @keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: none; }
  }
  #sh::before {
    content: "";
    display: block;
    width: 38px;
    height: 5px;
    border-radius: 3px;
    background: var(--line);
    margin: 0 auto 14px;
  }
  #sh.ed > .acts { display: none; }
  #dlg-card { max-width: 100%; }
  #toast { bottom: calc(24px + env(safe-area-inset-bottom)); }
  #don-card { padding: 22px 18px 18px; }
  .don-actions { flex-direction: column-reverse; }
  .don-actions .go { justify-content: center; }
  .don-actions .ghost { order: 2; }
  #update-banner {
    bottom: calc(16px + env(safe-area-inset-bottom));
    left: 16px;
    right: 16px;
    transform: none;
  }
  @keyframes slideUpBanner {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: none; opacity: 1; }
  }
  #bar {
    top: auto;
    bottom: 0;
    background: linear-gradient(transparent, rgba(0, 0, 0, .72));
    padding: 36px 10px calc(10px + env(safe-area-inset-bottom));
  }
  #bm, #bg, #bt, #br, #bf { display: none; }
}

/* ---------- REDUCED MOTION ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    transition-duration: .01ms !important;
  }
  #pv-tab-ind { transition: none; }
  .pv-view { animation: none; }
  .pv-card-live::before { animation: none; opacity: 1; }
  #txt { transition: opacity .12s linear; }
  #txt.swap-out, #txt.swap-in { transform: none; }
  #splash-inner, #splash-logo .sp-rays, #splash-word, #splash-notes .note {
    animation: none !important;
  }
  #splash-logo .sp-rays { stroke-dashoffset: 0; }
  #splash-word, #splash-notes .note { opacity: 1; transform: none; }
}

/* ---------- SCROLLBAR ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 5px;
  border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: var(--mut); }

/* ---------- PRINT ---------- */
@media print {
  #tb, #side, #lh, #list, #regie, #sbar, #tabs, #set, #dlg, #toast, #pv-head { display: none !important; }
  #app { display: block; }
  #pv { padding: 0; }
  body { background: #fff; color: #000; }
}
/* ============================================
   INDICATEUR "EN DIRECT" DANS L'EN-TÊTE
   ============================================ */
#pv-live-ind {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  background: rgba(233, 80, 63, .15);
  color: #e9503f;
  font: 600 .72rem var(--font-ui);
  letter-spacing: .03em;
  border: 1px solid rgba(233, 80, 63, .35);
  flex: none;
  margin-left: 8px;
}
#pv-live-ind i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e9503f;
  animation: pvPulse 1.6s ease-in-out infinite;
}
#pv-live-ind[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) {
  #pv-live-ind i { animation: none; }
}


/* ============================================
   v1.1 — indications (bis), langue, actions de l'aperçu
   ============================================ */
.rp { font-size: .55em; font-style: italic; opacity: .65; white-space: nowrap; letter-spacing: .01em; }
.pv-card-text .rp { font-size: .9em; }

#lg { display: flex; gap: 6px; margin: 8px 0 2px; }
#lg button {
  flex: 1;
  padding: 6px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--mut);
  font: 600 .78rem var(--font-ui);
  cursor: pointer;
  transition: background var(--t, .2s), color var(--t, .2s), border-color var(--t, .2s);
}
#lg button:hover { color: var(--ink); }
#lg button.on { background: var(--accbg); border-color: var(--acc); color: var(--ink); }

.tt small .lg {
  display: inline-block;
  margin-right: 6px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--accbg);
  color: var(--acc);
  font: 700 .66rem/1.5 var(--font-ui);
  font-style: normal;
  letter-spacing: .04em;
  vertical-align: 1px;
}
#ul li.more { display: block; padding: 10px 12px; }
#ul li.more button { width: 100%; }

#pv-acts { display: inline-flex; gap: 6px; flex: none; }
#pv-acts button { padding: 6px 10px; font-size: .78rem; }
#pv-acts button.on { color: var(--acc); border-color: var(--acc); }
#pv-acts button[hidden] { display: none; }
#pvx { display: none; padding: 6px 10px; font-size: .85rem; }
@media (max-width: 859px) {
  #pvx { display: inline-flex; }
  #pv-acts { order: 3; width: 100%; }
  #pv-acts button { flex: 1; }
}

.pv-card-text { padding-top: 16px; }
@media (max-width: 859px) { #cw, #tw { display: none; } }
