/* Un ciel du soir sur le lac de Neuchâtel : nuit bleue en haut, rose du couchant en bas.
   Une seule ambiance (sombre) assumée : c'est une app du soir. */
:root {
  --nuit: #0f1a23;
  --nuit-2: #162633;
  --prune: #22131d;
  --ivoire: #f5f0e8;
  --ivoire-2: rgba(245, 240, 232, .68);
  --ivoire-3: rgba(245, 240, 232, .42);
  --verre: rgba(255, 255, 255, .06);
  --verre-2: rgba(255, 255, 255, .11);
  --trait: rgba(255, 255, 255, .09);
  --rose: #e0587f;
  --rose-doux: rgba(224, 88, 127, .18);
  --lac-clair: #7cc3dc;
  --menthe: #74cf9f;
  --menthe-doux: rgba(116, 207, 159, .16);
  --display: "Young Serif", Georgia, "Times New Roman", serif;
  --body: "Figtree", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { background: var(--nuit); }
body {
  margin: 0; min-height: 100dvh; color: var(--ivoire); font-family: var(--body); font-size: 16px; line-height: 1.5;
  background: linear-gradient(180deg, #13263a 0%, var(--nuit) 45%, var(--prune) 100%) fixed;
  -webkit-font-smoothing: antialiased;
}
.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.sky canvas { width: 100%; height: 100%; display: block; }
.wrap {
  position: relative; z-index: 1; max-width: 32rem; margin: 0 auto;
  padding-top: max(28px, calc(env(safe-area-inset-top, 0px) + 16px));
  padding-bottom: max(40px, calc(env(safe-area-inset-bottom, 0px) + 24px));
  padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: max(18px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 26px;
}
h1, h2, h3 { font-family: var(--display); font-weight: 400; margin: 0; text-wrap: balance; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
button:focus-visible, input:focus-visible, summary:focus-visible { outline: 3px solid var(--lac-clair); outline-offset: 3px; border-radius: 12px; }
.muted { color: var(--ivoire-3); margin: 0; }

/* En-tête */
.eyebrow { margin: 0 0 6px; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--ivoire-3); }
.top h1 { font-size: clamp(2.2rem, 9vw, 2.8rem); line-height: 1.05; }
.love { margin: 8px 0 0; color: var(--ivoire-2); }

/* Carte principale */
.hero {
  display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px;
  padding: 26px 20px 24px; border-radius: 32px; background: var(--verre); border: 1px solid var(--trait);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.dial { position: relative; width: min(230px, 64vw); aspect-ratio: 1; max-width: 100%; display: grid; place-items: center; margin-bottom: 8px; }
.ring { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring .track { fill: none; stroke: var(--trait); stroke-width: 12; }
.ring .prog { fill: none; stroke-width: 12; stroke-linecap: round; stroke-dasharray: 603.2; stroke-dashoffset: 603.2; transition: stroke-dashoffset 1s ease; }
.ring .tick { stroke: var(--ivoire-3); stroke-width: 2; stroke-linecap: round; }
.ring .tick.major { stroke: var(--ivoire-2); }

.pill { width: 96px; height: 44px; border-radius: 22px; position: relative; overflow: hidden; transform: rotate(-32deg);
  background: linear-gradient(90deg, var(--rose) 50%, var(--ivoire) 50%);
  box-shadow: 0 10px 30px rgba(224, 88, 127, .35), inset 0 -4px 8px rgba(0,0,0,.12);
  animation: sway 3.2s ease-in-out infinite alternate; }
.pill span { position: absolute; left: 12px; top: 8px; width: 34px; height: 7px; border-radius: 4px; background: rgba(255,255,255,.35); }
.pill.done { background: linear-gradient(90deg, var(--menthe) 50%, var(--ivoire) 50%); box-shadow: 0 10px 30px rgba(116, 207, 159, .35); }
.pill.alarming { animation: shake .45s ease-in-out infinite alternate; box-shadow: 0 0 40px rgba(224, 88, 127, .8); }
@keyframes sway { from { transform: rotate(-40deg) translateY(2px); } to { transform: rotate(-24deg) translateY(-3px); } }
@keyframes shake { from { transform: rotate(-14deg) scale(1.04); } to { transform: rotate(-34deg) scale(1.12); } }

.burst { position: absolute; inset: 0; pointer-events: none; }
.burst i { position: absolute; left: 50%; top: 50%; width: 18px; height: 18px; margin: -9px; opacity: 0; }
.burst i svg { width: 100%; height: 100%; }
.burst.go i { animation: fly 1.3s cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes fly {
  0% { opacity: 0; transform: translate(0,0) scale(.3); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--x), var(--y)) scale(1.2); }
}

.badge { font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; background: rgba(124,195,220,.15); color: var(--lac-clair); }
.badge.dose { background: var(--rose-doux); color: var(--rose); }
.badge.done { background: var(--menthe-doux); color: var(--menthe); }
.when { font-size: clamp(1.5rem, 6.4vw, 1.9rem); line-height: 1.2; margin-top: 4px; }
.count { font-size: clamp(2.8rem, 15vw, 4rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.count small { font-size: .38em; font-weight: 600; color: var(--ivoire-3); letter-spacing: 0; margin: 0 .25em 0 .08em; }
.sub { margin: 0; color: var(--ivoire-2); max-width: 26rem; }

.take { margin-top: 10px; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 17px 22px; border-radius: 999px; font-weight: 800; font-size: 1.06rem; color: #fff;
  background: linear-gradient(180deg, #ea6a8f, var(--rose)); box-shadow: 0 12px 30px rgba(224, 88, 127, .4);
  transition: transform .15s ease; }
.take:active { transform: scale(.97); }
.take svg { width: 22px; height: 22px; }

/* Carte notifications */
.card { border-radius: 24px; background: var(--verre); border: 1px solid var(--trait); }
.notify { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; padding: 16px 18px; }
.notify-icon { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--rose-doux); color: var(--rose); }
.notify.on .notify-icon { background: var(--menthe-doux); color: var(--menthe); }
.notify-icon svg { width: 24px; height: 24px; }
.notify-text { display: flex; flex-direction: column; min-width: 0; }
.notify-text span { color: var(--ivoire-2); font-size: .92rem; }
.notify-actions { grid-column: 1 / -1; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.soft { padding: 12px 18px; border-radius: 999px; background: var(--verre-2); font-weight: 700; }
.notify .soft { background: var(--rose); color: #fff; }
.link { color: var(--lac-clair); font-weight: 600; padding: 8px 2px; text-decoration: underline; text-underline-offset: 3px; }
.link.light { color: var(--ivoire-2); }

/* Semaine */
.block { display: flex; flex-direction: column; gap: 12px; }
.block h3 { font-size: 1.3rem; }
.strip { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.day { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 0 12px; border-radius: 16px; background: var(--verre); border: 1px solid transparent; }
.day.today { background: var(--verre-2); border-color: rgba(124,195,220,.6); }
.day .dn { font-size: .66rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--ivoire-3); }
.day .dd { font-weight: 800; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.day .mk { width: 22px; height: 22px; display: grid; place-items: center; }
.day .mk svg { width: 20px; height: 20px; }
.day .mk .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ivoire-3); opacity: .6; }
.day.dose .mk { color: var(--rose); }
.day.taken .mk { color: var(--menthe); }

/* Carnet */
.log { list-style: none; margin: 0; padding: 0; }
.log li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--trait); }
.log li:last-child { border-bottom: 0; }
.log li span:first-child::first-letter { text-transform: uppercase; }
.log .t { color: var(--ivoire-3); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Réglages */
.settings { padding: 2px 18px; }
.settings summary { cursor: pointer; padding: 14px 0; font-weight: 700; list-style: none; display: flex; justify-content: space-between; }
.settings summary::-webkit-details-marker { display: none; }
.settings summary::after { content: "+"; color: var(--ivoire-3); font-size: 1.3rem; line-height: 1; }
.settings[open] summary::after { content: "–"; }
.form { display: grid; gap: 14px; padding: 4px 0 18px; }
.form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: .82rem; font-weight: 700; color: var(--ivoire-3); min-width: 0; }
.form input { font: inherit; font-size: 16px; color: var(--ivoire); background: rgba(0,0,0,.25); border: 1px solid var(--trait); border-radius: 12px; padding: 11px 12px; width: 100%; min-width: 0; }
.foot { text-align: center; color: var(--ivoire-3); font-size: .85rem; }

/* Guide d'installation */
.sheet { position: fixed; inset: 0; z-index: 40; display: flex; align-items: flex-end; justify-content: center; background: rgba(5, 10, 14, .6); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sheet-card { width: 100%; max-width: 32rem; margin: 0 auto; background: var(--nuit-2); border-radius: 28px 28px 0 0; border: 1px solid var(--trait); border-bottom: 0;
  padding: 26px max(22px, env(safe-area-inset-right, 0px)) max(26px, calc(env(safe-area-inset-bottom, 0px) + 18px)) max(22px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 14px; animation: rise .45s cubic-bezier(.2,.8,.2,1); }
@keyframes rise { from { transform: translateY(40px); opacity: .4; } }
.sheet-icon { width: 64px; height: 64px; border-radius: 15px; }
.sheet-card h2 { font-size: 1.7rem; }
.sheet-card p { margin: 0; color: var(--ivoire-2); }
.steps { list-style: none; margin: 4px 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.steps li { display: flex; gap: 12px; align-items: center; }
.steps .n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--rose-doux); color: var(--rose); font-weight: 800; font-size: .9rem; }
.share { width: 20px; height: 20px; vertical-align: -4px; color: var(--lac-clair); }

/* Alarme */
.alarm { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; text-align: center;
  padding: max(24px, env(safe-area-inset-top, 0px)) max(24px, env(safe-area-inset-right, 0px)) max(24px, env(safe-area-inset-bottom, 0px)) max(24px, env(safe-area-inset-left, 0px));
  background: radial-gradient(circle at 50% 40%, #3a1a29 0%, var(--nuit) 70%); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { background-color: #2a1520; } }
.alarm h2 { font-size: clamp(2.1rem, 9vw, 2.8rem); }
.alarm p { margin: 0; color: var(--ivoire-2); max-width: 22rem; }
.alarm .take { max-width: 22rem; }
.halo { width: 170px; height: 170px; display: grid; place-items: center; position: relative; margin-bottom: 8px; }
.halo::before, .halo::after { content: ""; position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--rose); animation: ripple 2.4s ease-out infinite; }
.halo::after { animation-delay: 1.2s; }
.pill.big { width: 112px; height: 52px; border-radius: 26px; animation: shake .45s ease-in-out infinite alternate; }
@keyframes ripple { from { transform: scale(.55); opacity: 1; } to { transform: scale(1.6); opacity: 0; } }

.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(22px + env(safe-area-inset-bottom, 0px)); z-index: 60;
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 999px; background: var(--ivoire); color: var(--nuit); font-weight: 700; text-align: center;
  box-shadow: 0 10px 30px rgba(0,0,0,.4); }

@media (prefers-reduced-motion: reduce) {
  .pill, .pill.alarming, .pill.big, .halo::before, .halo::after, .alarm, .sheet-card { animation: none; }
  .burst.go i { animation-duration: .01s; }
}

/* Signature */
.sign { margin: 6px 0 0; font-family: var(--display); font-size: 1.05rem; color: var(--rose); letter-spacing: .04em; }
.initials { font-family: var(--display); color: var(--ivoire-2); letter-spacing: .06em; }
