/* MON COCKPIT — style Dark Tech
   Pour changer les couleurs : modifier uniquement le bloc :root ci-dessous. */
:root {
  --bg: #0B1120;
  --card: #1E293B;
  --deep: #0F172A;
  --line: #334155;
  --primary: #6366F1;
  --primary-strong: #4F46E5; /* fond des boutons : contraste suffisant avec du texte blanc */
  --cyan: #22D3EE;
  --green: #34D399;
  --text: #F8FAFC;
  --muted: #A3B1C6;
  --warn: #FBBF24;
  --danger: #F87171;
  --r: 16px;
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 var(--font);
  background-image: radial-gradient(900px 500px at 85% -10%, rgba(99, 102, 241, .18), transparent 60%),
                    radial-gradient(700px 400px at -10% 10%, rgba(34, 211, 238, .08), transparent 60%);
  background-attachment: fixed; min-height: 100dvh;
}
h1, h2, h3, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
small, .muted { color: var(--muted); }
small { font-size: .82rem; }
:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; border-radius: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--primary-strong); color: #fff; padding: 8px 14px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }
.noscript { padding: 24px; text-align: center; }

.ic { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: -.18em; }
.grow { flex: 1; min-width: 0; }
.between { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.mt { margin-top: 14px; }
form .go { width: 100%; }
.budget-in { width: 130px !important; text-align: right; }
.pos { color: var(--green); } .neg { color: var(--danger); }

/* Bandeau démo + barre du haut */
.demo-banner { background: #3B2A05; color: #FDE68A; border-bottom: 1px solid #92400E; padding: 6px 16px; font-size: .85rem; text-align: center; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: rgba(11, 17, 32, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { font-weight: 800; letter-spacing: .12em; font-size: .95rem; display: flex; align-items: center; gap: 10px; margin-right: auto; white-space: nowrap; }
.logo { width: 22px; height: 22px; border-radius: 7px; background: linear-gradient(135deg, var(--primary), var(--cyan)); box-shadow: 0 0 16px rgba(99, 102, 241, .7); }
.nav { display: flex; gap: 4px; }
.nav button { background: none; border: 0; padding: 8px 10px; border-radius: 10px; color: var(--muted); display: flex; align-items: center; gap: 6px; font-size: .9rem; }
.nav button:hover { background: var(--card); color: var(--text); }
.pill { background: rgba(34, 211, 238, .12); border: 1px solid var(--cyan); color: var(--cyan); border-radius: 99px; padding: 4px 12px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* Écran d'accès (production) */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 20px; max-width: none; }
.login-card { width: min(440px, 100%); padding: 28px 24px; gap: 16px; }
.login-card .brand { margin: 0; }
.login-card .go { width: 100%; }
#sync-state:empty { display: none; }
a.go, a.btn { text-decoration: none; }

/* Accueil */
main { max-width: 1180px; margin: 0 auto; padding: 20px; }
.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.hero { grid-column: 1 / -1; padding: 8px 4px 4px; }
.hero h1 { font-size: clamp(1.6rem, 4vw, 2.3rem); line-height: 1.2; letter-spacing: -.02em; }
.eyebrow { color: var(--cyan); text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 700; }
.clock { color: var(--muted); font-variant-numeric: tabular-nums; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); display: flex; flex-direction: column; min-width: 0; transition: border-color .2s, transform .2s; }
.card:hover { border-color: #475569; }
.card-head { font-size: 1rem; }
.card-head button { width: 100%; display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 14px 16px 6px; text-align: left; font-weight: 700; border-radius: var(--r) var(--r) 0 0; }
.card-ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: rgba(99, 102, 241, .18); color: #A5B4FC; }
.more { color: var(--muted); font-weight: 500; font-size: .82rem; display: flex; align-items: center; gap: 2px; }
.card-head button:hover .more { color: var(--cyan); }
.card-body { padding: 8px 16px 16px; flex: 1; }
.card.wide { grid-column: 1 / -1; }
.empty { color: var(--muted); padding: 10px 0; }

/* Bouton principal */
.cta { justify-content: center; padding: 18px 16px; text-align: center; gap: 10px; background: linear-gradient(160deg, rgba(99, 102, 241, .22), var(--card) 60%); }
.go { border: 0; border-radius: 18px; padding: 20px 18px; font-size: 1.45rem; font-weight: 800; color: #fff; background: linear-gradient(135deg, var(--primary-strong), #4338CA); box-shadow: 0 10px 30px rgba(79, 70, 229, .45), inset 0 1px 0 rgba(255, 255, 255, .2); display: flex; align-items: center; justify-content: center; gap: 10px; transition: transform .15s, box-shadow .15s; }
.go:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(79, 70, 229, .6), inset 0 1px 0 rgba(255, 255, 255, .2); }
.go:active { transform: translateY(0); }

/* Boutons */
.btn { border: 1px solid transparent; border-radius: 10px; padding: 9px 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; background: var(--card); color: var(--text); min-height: 40px; }
.btn.primary { background: var(--primary-strong); color: #fff; }
.btn.primary:hover { background: #4338CA; }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.danger { background: #B91C1C; color: #fff; }
.btn.success { background: rgba(52, 211, 153, .15); border-color: var(--green); color: var(--green); }
.btn.small { padding: 5px 10px; min-height: 32px; font-size: .88rem; }
.btn:disabled, .icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn { background: none; border: 0; width: 34px; height: 34px; border-radius: 9px; display: inline-grid; place-items: center; color: var(--muted); flex: none; }
.icon-btn:hover:not(:disabled) { background: rgba(148, 163, 184, .15); color: var(--text); }
.icon-btn.del:hover { color: var(--danger); }
.link { background: none; border: 0; padding: 0; text-align: left; font-weight: 600; color: var(--text); }
.link:hover { color: var(--cyan); text-decoration: underline; }
.row-actions { display: flex; gap: 0; flex: none; }

/* Pastilles */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .76rem; font-weight: 600; padding: 2px 8px; border-radius: 99px; background: rgba(148, 163, 184, .14); color: #CBD5E1; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.chip.pro { background: rgba(99, 102, 241, .22); color: #C7D2FE; }
.chip.perso { background: rgba(34, 211, 238, .14); color: #A5F3FC; }
.chip.cyan { background: rgba(34, 211, 238, .14); color: var(--cyan); }
.chip.green { background: rgba(52, 211, 153, .15); color: var(--green); }
.chip.hot { background: rgba(251, 191, 36, .15); color: var(--warn); }
.chip.late { background: rgba(248, 113, 113, .16); color: #FCA5A5; }
.chip.demo { background: #3B2A05; color: #FDE68A; }
.meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }

/* Listes */
.list > li { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-top: 1px solid rgba(51, 65, 85, .7); }
.list > li:first-child { border-top: 0; }
.list .done .link { text-decoration: line-through; color: var(--muted); }
input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--green); margin: 3px 0 0; flex: none; }
.rank { width: 26px; height: 26px; border-radius: 8px; background: linear-gradient(135deg, var(--primary), var(--cyan)); color: #0B1120; font-weight: 800; display: grid; place-items: center; font-size: .85rem; flex: none; }
.time { font-variant-numeric: tabular-nums; color: var(--cyan); font-weight: 600; width: 96px; flex: none; font-size: .9rem; }
.day-title { font-size: .85rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; margin: 16px 0 2px; }

/* Barres de progression (la largeur vient de l'attribut data-p) */
.bar { height: 8px; border-radius: 99px; background: var(--deep); overflow: hidden; margin: 6px 0; }
.bar > i { display: block; height: 100%; width: var(--p, 0%); border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--cyan)); transition: width .3s; }
.bar.full > i { background: var(--green); }
.bar.near > i { background: var(--warn); }
.bar.over > i { background: var(--danger); }

.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.tile { background: var(--deep); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.tile b { display: block; font-size: 1.15rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tile span { color: var(--muted); font-size: .8rem; }

.alert { display: flex; gap: 10px; align-items: center; width: 100%; text-align: left; background: var(--deep); border: 1px solid var(--line); border-left-width: 4px; border-radius: 10px; padding: 9px 12px; margin-top: 8px; }
.alert.danger { border-left-color: var(--danger); } .alert.danger .ic { color: var(--danger); }
.alert.warn { border-left-color: var(--warn); } .alert.warn .ic { color: var(--warn); }
.alert.info { border-left-color: var(--cyan); } .alert.info .ic { color: var(--cyan); }
.alert:hover { border-color: var(--muted); }
.notice { background: #3B2A05; border: 1px solid #92400E; color: #FDE68A; border-radius: 12px; padding: 10px 14px; font-size: .9rem; }
.box { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.box h3 { font-size: 1.02rem; }

/* Formulaires */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: .85rem; font-weight: 600; color: #CBD5E1; margin-bottom: 4px; }
.field small { display: block; margin-top: 3px; }
input[type=text], input[type=number], input[type=date], input[type=time], input:not([type]), select, textarea {
  width: 100%; background: var(--deep); border: 1px solid #475569; border-radius: 10px; padding: 9px 11px; min-height: 40px;
}
input:focus, select:focus, textarea:focus { border-color: var(--cyan); outline: 2px solid rgba(34, 211, 238, .35); outline-offset: 0; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.inline { display: flex; gap: 8px; align-items: stretch; }
.inline input, .inline select { flex: 1; min-width: 0; }
.inline select { flex: 0 0 110px; }
.checkline { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.checkline input { margin: 0; }
fieldset.field { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
fieldset.field .checkline { margin: 0 6px 6px 0; }
.form-err { color: #FCA5A5; font-weight: 600; margin-top: 8px; }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--muted); font-size: .88rem; padding: 4px 0; }
details ul { font-size: .85rem; color: var(--muted); padding-left: 4px; }
details li { padding: 2px 0; }

.seg { display: inline-flex; background: var(--deep); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg button { background: none; border: 0; padding: 5px 12px; border-radius: 8px; color: var(--muted); font-weight: 600; font-size: .88rem; min-height: 32px; }
.seg button[aria-pressed=true] { background: var(--primary-strong); color: #fff; }

/* Fenêtres */
dialog { border: 1px solid var(--line); background: var(--bg); color: var(--text); padding: 0; border-radius: var(--r); max-width: none; }
dialog::backdrop { background: rgba(2, 6, 23, .72); backdrop-filter: blur(3px); }
.panel { margin: 0 0 0 auto; width: min(780px, 100vw); height: 100dvh; max-height: 100dvh; border-radius: var(--r) 0 0 var(--r); border-width: 0 0 0 1px; }
.panel[open] { display: flex; flex-direction: column; animation: slide .22s ease-out; }
#modal, #confirm { width: min(580px, calc(100vw - 20px)); max-height: calc(100dvh - 20px); }
#modal[open], #confirm[open] { animation: pop .16s ease-out; }
#modal form { display: flex; flex-direction: column; max-height: calc(100dvh - 22px); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font-size: 1.2rem; }
.dlg-body { overflow: auto; padding: 16px 20px 28px; flex: 1; }
.dlg-body:focus { outline: none; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--line); }
#confirm p { margin-top: 8px; color: #CBD5E1; }
@keyframes slide { from { transform: translateX(40px); opacity: 0; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }

#toasts, .toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 100; pointer-events: none; width: max-content; max-width: calc(100vw - 24px); }
.toast { background: #0F172A; border: 1px solid var(--green); color: var(--text); padding: 10px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); animation: pop .16s ease-out; }

/* Minuteur */
.focus { text-align: center; }
.focus h3 { font-size: 1.3rem; margin-top: 4px; }
.first { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--cyan); border-radius: 12px; padding: 10px 14px; margin: 12px 0; text-align: left; }
.ring { --p: 0%; width: min(240px, 70vw); aspect-ratio: 1; border-radius: 50%; margin: 22px auto; display: grid; place-content: center;
  background: radial-gradient(closest-side, var(--bg) 87%, transparent 88%), conic-gradient(var(--cyan) var(--p), var(--line) 0); }
.ring b { font-size: 3.2rem; font-variant-numeric: tabular-nums; line-height: 1; }
.focus-btns { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-bottom: 16px; }

/* Objectifs, habitudes */
.goal header, .habit header { display: flex; gap: 8px; align-items: flex-start; }
.pct { font-weight: 700; font-variant-numeric: tabular-nums; }
input[type=range] { width: 100%; accent-color: var(--primary); }
.sub { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 12px 0 2px; }
.steps li { display: flex; gap: 8px; align-items: center; padding: 3px 0; }
.steps input { margin: 0; }
.steps .done span { text-decoration: line-through; color: var(--muted); }
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin: 10px 0 6px; }
.week button { background: var(--deep); border: 1px solid var(--line); border-radius: 10px; padding: 6px 2px; font-size: .78rem; color: var(--muted); display: grid; gap: 2px; justify-items: center; min-height: 48px; }
.week button b { color: var(--text); font-size: .82rem; font-variant-numeric: tabular-nums; }
.week button.ok { background: rgba(52, 211, 153, .15); border-color: var(--green); color: var(--green); }
.week button.ok b { color: var(--green); }
.week button.today { box-shadow: 0 0 0 2px var(--primary); }
.week button:disabled { opacity: .35; cursor: default; }
.spark { display: inline-flex; gap: 3px; align-items: flex-end; height: 22px; vertical-align: middle; }
.spark i { width: 7px; height: max(2px, var(--p, 0%)); background: var(--cyan); border-radius: 2px; }
.qty { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.qty input { width: 110px; }

/* Finances */
.chart svg { width: 100%; height: auto; display: block; }
.chart text { fill: var(--muted); font-size: 13px; font-family: var(--font); }
.chart .axis { stroke: var(--line); }
.b-in { fill: var(--green); } .b-out { fill: var(--primary); } .b-task { fill: var(--cyan); }
.tile-btn { text-align: left; color: var(--text); width: 100%; }
.tile-btn:hover { border-color: var(--cyan); }
.tile-btn b { white-space: normal; font-size: 1.02rem; }
.tile span { display: block; }
.box h3 .ic { color: #A5B4FC; margin-right: 4px; }
.chart figcaption { font-size: .82rem; color: var(--muted); margin-top: 4px; }
.lg { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 4px 0 8px; }
.lg.in { background: var(--green); } .lg.out { background: var(--primary); }
table { width: 100%; border-collapse: collapse; font-size: .88rem; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tx .amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0 10px; }
.brow { padding: 6px 0; }

/* Écrans étroits : une colonne, navigation en bas */
@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
  main { padding: 14px 12px 90px; }
  /* pas de flou ici : il empêcherait la navigation de se fixer en bas de l'écran */
  .topbar { padding: 10px 14px; backdrop-filter: none; background: var(--bg); }
  .nav { position: fixed; bottom: 0; left: 0; right: 0; background: rgba(11, 17, 32, .96); border-top: 1px solid var(--line); justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); z-index: 10; }
  .nav button { flex-direction: column; gap: 2px; font-size: .64rem; padding: 6px 1px; flex: 1; min-width: 0; }
  .nav .ic { width: 22px; height: 22px; }
  .panel { border-radius: 0; border: 0; }
  .cols { grid-template-columns: 1fr; }
  #toasts, .toasts { bottom: 84px; }
  .time { width: 84px; }
}

/* =====================================================================
   Décor « Polynésie de nuit » et personnages (fichier assets/js/deco.js)
   ===================================================================== */

/* --- Ciel qui suit l'heure --- */
#scene { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
#scene .sky { position: absolute; inset: 0; background: var(--sky); }
#scene.sky-night { --sky: linear-gradient(180deg, #050915 0%, #0B1120 50%, #0F1E40 100%); }
#scene.sky-dawn  { --sky: linear-gradient(180deg, #0B1120 0%, #1E1B4B 48%, #4A2558 80%, #7E3B55 100%); }
#scene.sky-day   { --sky: linear-gradient(180deg, #0B1120 0%, #0C2340 55%, #0E4459 100%); }
#scene.sky-dusk  { --sky: linear-gradient(180deg, #0B1120 0%, #2A1748 52%, #5E2A57 80%, #93452F 100%); }

#scene .stars { position: absolute; inset: 0; opacity: 0; transition: opacity 2s; }
#scene.sky-night .stars { opacity: 1; }
#scene.sky-dawn .stars { opacity: .45; }
#scene.sky-dusk .stars { opacity: .3; }
#scene .stars i { position: absolute; left: var(--x); top: var(--y); width: var(--s); height: var(--s); border-radius: 50%; background: #F8FAFC; opacity: .75; animation: twinkle var(--t) ease-in-out infinite; animation-delay: var(--d); }

#scene .celestial { position: absolute; left: 42vw; top: 84px; width: 44px; height: 44px; border-radius: 50%; }
#scene.sky-night .celestial { box-shadow: inset -11px 7px 0 0 #F1F5F9; filter: drop-shadow(0 0 10px rgba(241, 245, 249, .35)); transform: rotate(-20deg); }
#scene.sky-day .celestial { background: radial-gradient(circle, #FEF3C7 0 40%, #FBBF24 72%); box-shadow: 0 0 40px 10px rgba(251, 191, 36, .22); }
#scene.sky-dawn .celestial { top: auto; bottom: 150px; right: auto; left: 9vw; background: radial-gradient(circle, #FFE4E6 0 35%, #FB923C 75%); box-shadow: 0 0 46px 12px rgba(251, 146, 60, .28); }
#scene.sky-dusk .celestial { top: auto; bottom: 110px; left: auto; right: 12vw; width: 54px; height: 54px; background: radial-gradient(circle, #FED7AA 0 35%, #F97316 75%); box-shadow: 0 0 50px 14px rgba(249, 115, 22, .3); }

#scene .shooting { position: absolute; top: 14%; left: 62%; width: 120px; height: 2px; border-radius: 2px; background: linear-gradient(90deg, rgba(248, 250, 252, .95), transparent); opacity: 0; animation: shoot 17s linear 4s infinite; }
#scene:not(.sky-night) .shooting { display: none; }

/* --- Palmiers, vagues, fleurs de tiaré --- */
#scene .palm { position: absolute; bottom: 36px; width: 170px; height: 276px; --sil: #02050C; opacity: .92; }
#scene .palm-l { left: -26px; }
#scene .palm-r { right: -26px; transform: scaleX(-1); }
#scene .palm-svg { width: 100%; height: 100%; display: block; overflow: visible; }
#scene .palm-sway { transform-box: fill-box; transform-origin: 40% 100%; animation: sway 7s ease-in-out infinite; }
#scene .palm path, #scene .palm circle { fill: var(--sil); }
#scene .palm .palm-trunk { fill: none; stroke: var(--sil); stroke-width: 9; stroke-linecap: round; }

#scene .wave { position: absolute; left: 0; right: 0; bottom: 0; height: 72px; overflow: hidden; }
#scene .wave svg { width: 200%; height: 100%; display: block; animation: drift 26s linear infinite; }
#scene .wave.w2 { height: 56px; }
#scene .wave.w2 svg { animation-duration: 19s; animation-direction: reverse; }
#scene .wave.w3 { height: 36px; }
#scene .wave.w3 svg { animation-duration: 34s; }
#scene .w1 path { fill: rgba(99, 102, 241, .24); }
#scene .w2 path { fill: rgba(34, 211, 238, .16); }
#scene .w3 path { fill: #0A1630; }

.tiare { width: 100%; height: 100%; display: block; }
.tiare-petals { fill: #FFFDF5; }
.tiare-heart { fill: #FCD34D; }
#scene .float-tiare { position: absolute; bottom: 30px; width: 22px; height: 22px; animation: bob 5s ease-in-out infinite; }
#scene .float-tiare.f1 { left: 22%; }
#scene .float-tiare.f2 { left: 69%; width: 16px; height: 16px; animation-delay: -2.2s; }

/* Fleur de tiaré posée sur le coin de certaines cartes */
.card.deco-tiare { position: relative; }
.card.deco-tiare::after {
  content: ""; position: absolute; top: -12px; right: -9px; width: 30px; height: 30px; pointer-events: none;
  transform: rotate(-14deg); filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .45));
  background: no-repeat center / contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='-22 -22 44 44'%3E%3Cg fill='%23FFFDF5'%3E%3Cpath d='M0 -2C7 -6 12 -14 6 -20C1 -18 -3 -10 0 -2Z'/%3E%3Cpath transform='rotate(72)' d='M0 -2C7 -6 12 -14 6 -20C1 -18 -3 -10 0 -2Z'/%3E%3Cpath transform='rotate(144)' d='M0 -2C7 -6 12 -14 6 -20C1 -18 -3 -10 0 -2Z'/%3E%3Cpath transform='rotate(216)' d='M0 -2C7 -6 12 -14 6 -20C1 -18 -3 -10 0 -2Z'/%3E%3Cpath transform='rotate(288)' d='M0 -2C7 -6 12 -14 6 -20C1 -18 -3 -10 0 -2Z'/%3E%3C/g%3E%3Ccircle r='3.5' fill='%23FCD34D'/%3E%3C/svg%3E");
}
.card { transition: border-color .2s, transform .2s, box-shadow .2s; }
.card:hover { box-shadow: 0 10px 30px rgba(2, 6, 23, .45); }
main { position: relative; padding-bottom: 120px; }

/* --- Pilo, le robot copilote --- */
#companion { position: absolute; top: 10px; right: 20px; display: flex; align-items: center; gap: 4px; z-index: 1; max-width: 380px; }
@media (min-width: 861px) { .hero { min-height: 136px; padding-right: 380px; } }
#companion .bubble { position: relative; background: #F8FAFC; color: #0B1120; border-radius: 16px; padding: 10px 14px; font-size: .92rem; font-weight: 600; line-height: 1.35; max-width: 250px; box-shadow: 0 8px 24px rgba(0, 0, 0, .4); }
#companion .bubble::after { content: ""; position: absolute; right: -7px; top: 50%; transform: translateY(-50%); border: 8px solid transparent; border-right: 0; border-left-color: #F8FAFC; }
#companion .bubble.pop { animation: pop .3s ease-out; }
.pilo-btn { background: none; border: 0; padding: 0; width: 104px; height: 130px; flex: none; border-radius: 20px; }
.pilo-btn svg { width: 100%; height: 100%; display: block; overflow: visible; }
.pilo-btn.hop svg { animation: hop .6s ease-out; }

.pilo .pilo-shell { fill: #E2E8F0; }
.pilo .pilo-visor { fill: #0B1120; }
.pilo .pilo-indigo { fill: #6366F1; }
.pilo .pilo-band { fill: none; stroke: #6366F1; stroke-width: 4; stroke-linecap: round; }
.pilo .pilo-stroke { stroke: #94A3B8; stroke-width: 3; }
.pilo .pilo-light { fill: #22D3EE; animation: blinklight 2.4s ease-in-out infinite; }
.pilo .pilo-check { fill: none; stroke: #F8FAFC; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.pilo .arm rect { fill: #CBD5E1; }
.pilo .arm { transform-box: fill-box; transition: transform .4s; }
.pilo .arm-l { transform-origin: 100% 50%; }
.pilo .arm-r { transform-origin: 0% 50%; }
.pilo .eyes { display: none; fill: #22D3EE; stroke: #22D3EE; stroke-width: 3.2; stroke-linecap: round; }
.pilo .eyes path { fill: none; }
.pilo .eyes-open { transform-box: fill-box; transform-origin: center; animation: blink 5s infinite; }
.pilo .pilo-mouth { fill: none; stroke: #22D3EE; stroke-width: 2.6; stroke-linecap: round; }
.pilo .pilo-cheek { fill: #F472B6; opacity: .45; }
.pilo .pilo-flame { fill: #FBBF24; transform-box: fill-box; transform-origin: 50% 0; animation: flame .35s ease-in-out infinite alternate; }
.pilo .pilo-body { animation: float 3.6s ease-in-out infinite; }
.pilo .pilo-headset, .pilo .pilo-z { display: none; }
.pilo .pilo-z { fill: #A5B4FC; font: 700 15px var(--font); transform-box: fill-box; }

.pilo.mood-wave .eyes-open, .pilo.mood-focus .eyes-focus, .pilo.mood-happy .eyes-happy,
.pilo.mood-proud .eyes-happy, .pilo.mood-sleep .eyes-sleep { display: inline; }
.pilo.mood-focus .pilo-headset { display: inline; }
.pilo.mood-focus .pilo-cheek, .pilo.mood-sleep .pilo-cheek { display: none; }
.pilo.mood-wave .arm-r { animation: wave 1.3s ease-in-out infinite; }
.pilo.mood-proud .arm-l { transform: rotate(55deg); }
.pilo.mood-proud .arm-r { transform: rotate(-55deg); }
.pilo.mood-proud .pilo-body { animation: cheer .8s ease-in-out infinite; }
.pilo.mood-sleep .pilo-z { display: inline; animation: zz 3s ease-in-out infinite; }
.pilo.mood-sleep .pilo-z.z2 { animation-delay: 1.5s; }
.pilo.mood-sleep .pilo-flame { display: none; }
.pilo.mood-sleep .pilo-body { animation-duration: 6s; }
.pilo.mood-sleep .pilo-light { animation: none; opacity: .3; }

/* --- Honu, la tortue des habitudes --- */
.honu-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.honu-row.big { background: rgba(16, 185, 129, .08); border: 1px solid rgba(52, 211, 153, .25); border-radius: 14px; padding: 8px 12px; margin-bottom: 14px; }
.honu-wrap { width: 78px; height: 48px; flex: none; }
.honu-row.big .honu-wrap { width: 104px; height: 64px; }
.honu-wrap svg { width: 100%; height: 100%; display: block; overflow: visible; }
.honu-say { font-size: .88rem; color: #CBD5E1; }
.honu .honu-shell { fill: #10B981; }
.honu .honu-pattern { fill: none; stroke: #A7F3D0; stroke-width: 2; opacity: .55; stroke-linejoin: round; }
.honu .honu-rim { fill: #047857; }
.honu .honu-skin, .honu .flip { fill: #6EE7B7; }
.honu .flip { transform-box: fill-box; transform-origin: 50% 0; animation: paddle 2.4s ease-in-out infinite; }
.honu .flip-back { animation-direction: reverse; }
.honu .honu-eye { display: none; fill: #0B1120; stroke: #0B1120; stroke-width: 2.2; stroke-linecap: round; }
.honu path.honu-eye { fill: none; }
.honu .honu-smile { fill: none; stroke: #0B1120; stroke-width: 2; stroke-linecap: round; }
.honu .honu-cheek { fill: #F472B6; opacity: .5; }
.honu .honu-swim { animation: float 4.5s ease-in-out infinite; }
.honu .honu-z { display: none; fill: #A5B4FC; font: 700 13px var(--font); transform-box: fill-box; }
.honu.mood-calm .eye-open, .honu.mood-happy .eye-happy, .honu.mood-cheer .eye-happy, .honu.mood-sleep .eye-sleep { display: inline; }
.honu.mood-cheer .honu-swim { animation: cheer .6s ease-in-out infinite; }
.honu.mood-cheer .flip { animation-duration: .6s; }
.honu.mood-sleep .flip { animation: none; }
.honu.mood-sleep .honu-swim { animation-duration: 8s; }
.honu.mood-sleep .honu-z { display: inline; animation: zz 3s ease-in-out infinite; }

/* --- Confettis et pétales --- */
.fx { position: fixed; inset: 0; pointer-events: none; z-index: 300; overflow: hidden; }
.fx i { position: absolute; left: var(--x); top: var(--y); width: 8px; height: 12px; border-radius: 2px; background: var(--c); opacity: 0; animation: fly 1.9s cubic-bezier(.2, .7, .4, 1) forwards; animation-delay: var(--d); }
.fx i.petal { width: 11px; height: 15px; border-radius: 70% 0 70% 0; }

@keyframes twinkle { 50% { opacity: .12; } }
@keyframes shoot { 0% { opacity: 0; transform: translate(0, 0) rotate(-20deg); } 1% { opacity: 1; } 6% { opacity: 0; transform: translate(-320px, 118px) rotate(-20deg); } 100% { opacity: 0; transform: translate(-320px, 118px) rotate(-20deg); } }
@keyframes sway { 50% { transform: rotate(1.6deg); } }
@keyframes drift { to { transform: translateX(-50%); } }
@keyframes bob { 50% { transform: translateY(-6px) rotate(18deg); } }
@keyframes float { 50% { transform: translateY(-5px); } }
@keyframes cheer { 50% { transform: translateY(-8px); } }
@keyframes hop { 40% { transform: translateY(-14px) rotate(-6deg); } }
@keyframes blinklight { 50% { opacity: .35; } }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 97% { transform: scaleY(.1); } }
@keyframes flame { from { transform: scaleY(.75); opacity: .8; } to { transform: scaleY(1.1); opacity: 1; } }
@keyframes wave { 0%, 100% { transform: rotate(-35deg); } 50% { transform: rotate(-72deg); } }
@keyframes zz { 0% { opacity: 0; transform: translate(0, 6px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(6px, -9px); } }
@keyframes paddle { 50% { transform: rotate(14deg); } }
@keyframes fly {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  60% { opacity: 1; transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + var(--fall))) rotate(calc(var(--rot) * 2)); }
}

@media (max-width: 860px) {
  #companion { position: static; flex-direction: row-reverse; justify-content: flex-end; max-width: none; margin: 0 0 6px; gap: 8px; }
  #companion .bubble { flex: 1; max-width: none; font-size: .86rem; }
  #companion .bubble::after { right: auto; left: -7px; border-right: 8px solid transparent; border-left: 0; border-right-color: #F8FAFC; }
  .pilo-btn { width: 64px; height: 80px; }
  #scene .palm { width: 96px; height: 156px; opacity: .55; bottom: 56px; }
  #scene .celestial { top: 64px; left: auto; right: 16px; width: 30px; height: 30px; }
  main { padding-bottom: 110px; }
}

/* =====================================================================
   Récompenses (assets/js/rewards.js) et Pomodoro
   ===================================================================== */
.xp-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.lvl-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid rgba(251, 191, 36, .55); background: linear-gradient(135deg, rgba(251, 191, 36, .18), rgba(99, 102, 241, .18)); color: #FDE68A; border-radius: 99px; padding: 4px 12px 4px 8px; font-size: .86rem; font-weight: 600; }
.lvl-chip b { color: #FEF3C7; }
.lvl-chip .ic { color: #FBBF24; }
.lvl-chip:hover { border-color: #FBBF24; }
.xp-bar { display: inline-flex; align-items: center; gap: 8px; min-width: 140px; }
.xp-bar .bar { width: 110px; margin: 0; height: 7px; }
.xp-bar .bar > i { background: linear-gradient(90deg, #FBBF24, #F472B6); }
.xp-bar small { font-variant-numeric: tabular-nums; }

/* Points qui jaillissent */
.xp-float { position: fixed; left: var(--x); top: var(--y); z-index: 320; pointer-events: none; transform: translate(-50%, -50%); font-weight: 800; font-size: 1.25rem; color: #FDE68A; text-shadow: 0 2px 10px rgba(251, 191, 36, .65), 0 1px 0 #78350F; animation: xpup 1.5s cubic-bezier(.2, .8, .3, 1) forwards; white-space: nowrap; }
.xp-float.habit { color: #A7F3D0; text-shadow: 0 2px 10px rgba(52, 211, 153, .65), 0 1px 0 #064E3B; }
.xp-float.session { color: #A5F3FC; text-shadow: 0 2px 10px rgba(34, 211, 238, .65), 0 1px 0 #164E63; }
.xp-float.combo { font-size: 1.05rem; color: #F9A8D4; text-shadow: 0 2px 10px rgba(244, 114, 182, .7); animation-name: comboup; }
@keyframes xpup { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -80%) scale(1.25); } 30% { transform: translate(-50%, -95%) scale(1); } 100% { opacity: 0; transform: translate(-50%, -260%) scale(1); } }
@keyframes comboup { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4) rotate(-8deg); } 20% { opacity: 1; transform: translate(-50%, -90%) scale(1.3) rotate(4deg); } 100% { opacity: 0; transform: translate(-50%, -230%) scale(1) rotate(0); } }

/* Grande célébration : niveau, badge, journée parfaite */
.reward-banner { position: fixed; left: 50%; top: 18%; z-index: 330; transform: translateX(-50%); display: flex; align-items: center; gap: 16px; width: min(440px, calc(100vw - 32px)); padding: 18px 22px; border-radius: 22px; color: #0B1120; cursor: pointer;
  background: linear-gradient(135deg, #FEF3C7, #FDE68A 45%, #FBCFE8); box-shadow: 0 20px 60px rgba(0, 0, 0, .55), 0 0 0 4px rgba(251, 191, 36, .35); animation: bannerin .55s cubic-bezier(.2, 1.4, .4, 1); }
.reward-banner.kind-badge { background: linear-gradient(135deg, #E0E7FF, #C7D2FE 45%, #A5F3FC); box-shadow: 0 20px 60px rgba(0, 0, 0, .55), 0 0 0 4px rgba(99, 102, 241, .4); }
.reward-banner.kind-perfect, .reward-banner.kind-goal { background: linear-gradient(135deg, #D1FAE5, #A7F3D0 45%, #FEF3C7); box-shadow: 0 20px 60px rgba(0, 0, 0, .55), 0 0 0 4px rgba(52, 211, 153, .4); }
.reward-banner.kind-pomo { background: linear-gradient(135deg, #CFFAFE, #A5F3FC 45%, #E0E7FF); }
.reward-banner.out { animation: bannerout .35s ease-in forwards; }
.rb-icon { width: 58px; height: 58px; flex: none; border-radius: 50%; display: grid; place-items: center; background: #0B1120; color: #FBBF24; animation: spinin .7s ease-out; }
.rb-icon .ic { width: 32px; height: 32px; }
.rb-kicker { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .1em; color: #92400E; }
.rb-title { font-size: 1.45rem; font-weight: 800; line-height: 1.15; }
.rb-sub { font-size: .9rem; color: #334155; margin-top: 2px; }
@keyframes bannerin { 0% { opacity: 0; transform: translateX(-50%) translateY(-30px) scale(.7); } 100% { opacity: 1; transform: translateX(-50%) scale(1); } }
@keyframes bannerout { to { opacity: 0; transform: translateX(-50%) translateY(-20px) scale(.9); } }
@keyframes spinin { 0% { transform: rotate(-200deg) scale(.3); } 100% { transform: rotate(0) scale(1); } }

/* Écran « Ma progression » */
.lvl-card { display: flex; align-items: center; gap: 18px; }
.lvl-big { width: 78px; height: 78px; flex: none; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(#FBBF24, #F472B6, #6366F1, #22D3EE, #FBBF24); padding: 4px; }
.lvl-big span { width: 100%; height: 100%; border-radius: 50%; background: var(--deep); display: grid; place-items: center; font-size: 2rem; font-weight: 800; color: #FDE68A; }
.lvl-card h3 { font-size: 1.4rem; }
.lvl-card .bar > i { background: linear-gradient(90deg, #FBBF24, #F472B6); }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-top: 10px; }
.badge { background: var(--deep); border: 1px solid var(--line); border-radius: 14px; padding: 12px; display: grid; gap: 4px; justify-items: center; text-align: center; opacity: .5; }
.badge.on { opacity: 1; border-color: rgba(251, 191, 36, .6); background: linear-gradient(160deg, rgba(251, 191, 36, .12), var(--deep)); }
.badge-ic { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #1E293B; color: #64748B; }
.badge.on .badge-ic { background: #FBBF24; color: #0B1120; }
.badge b { font-size: .9rem; }
.badge small { font-size: .74rem; }
.xp-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; margin-top: 10px; align-items: end; }
.xp-week li { display: grid; justify-items: center; gap: 4px; }
.wk-bar { width: 100%; height: 90px; background: var(--deep); border-radius: 8px; display: flex; align-items: flex-end; overflow: hidden; }
.wk-bar > i { display: block; width: 100%; height: var(--p, 0%); background: linear-gradient(0deg, #6366F1, #FBBF24); border-radius: 8px; }
.xp-week b { font-size: .8rem; font-variant-numeric: tabular-nums; }
.rules li { padding: 4px 0; color: #CBD5E1; font-size: .9rem; }

/* Pomodoro */
.mode-pick { display: grid; gap: 8px; }
.mode-opt { display: flex; gap: 10px; align-items: flex-start; background: var(--deep); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer; text-align: left; }
.mode-opt:has(input:checked) { border-color: var(--cyan); background: rgba(34, 211, 238, .08); }
.mode-opt input { margin-top: 3px; accent-color: var(--cyan); }
.mode-opt span { display: grid; gap: 2px; }
.pomo-dots { display: flex; justify-content: center; gap: 8px; margin: 10px 0 4px; flex-wrap: wrap; }
.pomo-dots span { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); }
.pomo-dots span.done { background: #F87171; border-color: #F87171; box-shadow: 0 0 10px rgba(248, 113, 113, .6); }
.pomo-dots span.now { border-color: #F87171; animation: pulse 1.6s ease-in-out infinite; }
.ring.break { background: radial-gradient(closest-side, var(--bg) 87%, transparent 88%), conic-gradient(var(--green) var(--p), var(--line) 0); }
.focus.is-break .eyebrow { color: var(--green); }
.pill.break { border-color: var(--green); color: var(--green); background: rgba(52, 211, 153, .12); }
@keyframes pulse { 50% { box-shadow: 0 0 0 5px rgba(248, 113, 113, .25); } }

@media (max-width: 860px) {
  .xp-bar .bar { width: 80px; }
  .rb-title { font-size: 1.2rem; }
  .lvl-big { width: 62px; height: 62px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
