/* Rio ♥ — romantique épuré, pensé pour iPhone. Thème clair + sombre, animations. */

/* =================================================================== */
/* Couleurs                                                             */
/* =================================================================== */
:root {
  --bg: #FBF7F2;
  --card: #FFFFFF;
  --card-hi: #FFFFFF;
  --paper: #FFFDF9;
  --field: #FFFCFA;
  --ink: #3A2E2C;
  --ink-soft: #5C4D4A;
  --muted: #8A7A76;
  --line: #EFE5DE;
  --rose: #E8C4C0;
  --rose-soft: #F6E7E3;
  --accent: #C97B84;
  --accent-ink: #A85D67;
  --on-accent: #FFFFFF;
  --danger: #B24A4A;
  --danger-soft: #FBE9E7;
  --hero-a: #FFFFFF;
  --hero-b: #FBEDEA;
  --glass: rgba(255, 255, 255, .78);
  --bar: rgba(251, 247, 242, .86);
  --tabbar: rgba(255, 255, 255, .9);
  --shadow: 0 1px 2px rgba(58, 46, 44, .04), 0 8px 24px rgba(58, 46, 44, .06);
  --glow: rgba(201, 123, 132, .35);
  --tile-filter: saturate(.55) sepia(.12) brightness(1.03);
  --radius: 20px;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --tab-h: 64px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161113; --card: #211A1C; --card-hi: #2C2326; --paper: #241C1E; --field: #1B1517;
    --ink: #F3E9E4; --ink-soft: #D8C9C3; --muted: #A8968F; --line: #3A2D30;
    --rose: #6E4148; --rose-soft: #3A2629; --accent: #E3A1A9; --accent-ink: #EDB8BF; --on-accent: #2A1A1D;
    --danger: #F08C8C; --danger-soft: #3D2224; --hero-a: #261D20; --hero-b: #33222A;
    --glass: rgba(255, 255, 255, .06); --bar: rgba(22, 17, 19, .82); --tabbar: rgba(28, 22, 24, .9);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35); --glow: rgba(227, 161, 169, .3);
    --tile-filter: invert(1) hue-rotate(180deg) brightness(.82) saturate(.45) contrast(.92);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161113; --card: #211A1C; --card-hi: #2C2326; --paper: #241C1E; --field: #1B1517;
  --ink: #F3E9E4; --ink-soft: #D8C9C3; --muted: #A8968F; --line: #3A2D30;
  --rose: #6E4148; --rose-soft: #3A2629; --accent: #E3A1A9; --accent-ink: #EDB8BF; --on-accent: #2A1A1D;
  --danger: #F08C8C; --danger-soft: #3D2224; --hero-a: #261D20; --hero-b: #33222A;
  --glass: rgba(255, 255, 255, .06); --bar: rgba(22, 17, 19, .82); --tabbar: rgba(28, 22, 24, .9);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35); --glow: rgba(227, 161, 169, .3);
  --tile-filter: invert(1) hue-rotate(180deg) brightness(.82) saturate(.45) contrast(.92);
  color-scheme: dark;
}

/* =================================================================== */
/* Base                                                                 */
/* =================================================================== */
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--sans);
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 16px);
  min-height: 100vh;
  transition: background-color .4s ease, color .4s ease;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 600; }
.serif { font-family: var(--serif); letter-spacing: .01em; }
.italic { font-style: italic; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.right { float: right; }
.pad { padding: 32px 16px; }
.big { font-size: 22px; margin: 4px 0; }
.accent { color: var(--accent); }
code { font-size: 12px; background: var(--rose-soft); padding: 1px 5px; border-radius: 6px; word-break: break-all; }
.ic { width: 22px; height: 22px; flex: none; }

/* =================================================================== */
/* Barre du haut                                                        */
/* =================================================================== */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: 44px 1fr 44px; align-items: center;
  padding: calc(env(safe-area-inset-top) + 6px) 12px 6px;
  background: var(--bar); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
  view-transition-name: topbar;
}
.brand { font-size: 20px; font-weight: 600; white-space: nowrap; }
.brand .accent { display: inline-block; animation: beat 2.4s ease-in-out infinite; }
.top-title { text-align: center; font-size: 21px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%;
  background: transparent; border: 0; color: var(--ink); cursor: pointer; padding: 0;
  transition: transform .2s var(--spring), background .2s;
}
.icon-btn:active { background: var(--rose-soft); transform: scale(.88); }
.topbar .icon-btn:last-child { justify-self: end; }
.topbar .icon-btn:last-child .ic { transition: transform .6s var(--ease); }
.topbar .icon-btn:last-child:active .ic { transform: rotate(90deg); }

/* =================================================================== */
/* Contenu & cartes                                                     */
/* =================================================================== */
.content { padding: 14px 16px; max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.card {
  background: var(--card); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  border: 1px solid var(--line);
  transition: transform .25s var(--ease), box-shadow .25s, background-color .4s;
}
a.card:active { transform: scale(.985); }
.card h2 { font-size: 22px; display: flex; align-items: center; gap: 8px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.pill {
  font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--rose-soft); color: var(--accent-ink); white-space: nowrap;
  transition: transform .2s var(--spring);
}
.pill.link:active { transform: scale(.94); }
.pill.new { background: var(--accent); color: var(--on-accent); animation: pop .5s var(--spring) both .3s; }
.eyebrow { margin: 0 0 6px; color: var(--accent-ink); font-size: 13px; letter-spacing: .08em; text-transform: uppercase; text-align: center; }

/* =================================================================== */
/* Hero : compte à rebours, horloges, statut                            */
/* =================================================================== */
.hero { position: relative; overflow: hidden; background: linear-gradient(160deg, var(--hero-a) 0%, var(--hero-b) 100%); text-align: center; padding: 22px 18px; }
.hero > * { position: relative; z-index: 1; }
.cd-label { font-size: 26px; line-height: 1.15; margin-bottom: 14px; }
.cd-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.cd-grid div { background: var(--glass); border-radius: 14px; padding: 10px 4px; border: 1px solid var(--line); overflow: hidden; }
.cd-grid b { display: block; font: 600 28px/1 var(--serif); font-variant-numeric: tabular-nums; }
.cd-grid b.flip { animation: flip .45s var(--ease); }
.cd-grid span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.clocks { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 18px; }
.clock { display: flex; flex-direction: column; align-items: center; }
.clock b { font: 600 24px/1.1 var(--serif); font-variant-numeric: tabular-nums; }
.clock small { color: var(--muted); font-size: 12px; }
.flag { font-size: 18px; }
.clock-sep { color: var(--accent); font-size: 20px; cursor: pointer; animation: beat 1.8s ease-in-out infinite; user-select: none; }
.status-pill {
  display: inline-flex; align-items: center; gap: 8px; margin: 2px auto 12px; padding: 7px 14px;
  background: var(--glass); border: 1px solid var(--line); border-radius: 999px; font-size: 14px; font-weight: 500;
}
.status-pill .st-emo { font-size: 18px; display: inline-block; animation: bob 3s ease-in-out infinite; }
.status-pill small { color: var(--muted); font-weight: 400; font-size: 12px; }
.status-pill.stale { opacity: .7; }
.night-hint { margin: -4px 0 10px; font-size: 13px; color: var(--muted); }
.float-heart {
  position: absolute; bottom: -20px; z-index: 0; color: var(--accent); opacity: 0; pointer-events: none;
  animation: floatUp var(--dur, 9s) linear infinite; animation-delay: var(--delay, 0s); font-size: var(--size, 14px);
}

/* =================================================================== */
/* Statut (admin)                                                       */
/* =================================================================== */
.status-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.st-chip {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--field); color: var(--ink); font: 500 14px var(--sans); cursor: pointer; text-align: left;
  transition: transform .2s var(--spring), background .2s, border-color .2s;
}
.st-chip span { font-size: 18px; }
.st-chip:active { transform: scale(.94); }
.st-chip.on { background: var(--rose-soft); border-color: var(--accent); color: var(--accent-ink); box-shadow: 0 0 0 3px var(--glow); }
.st-chip.on span { animation: bob 2s ease-in-out infinite; }
.st-custom { display: flex; gap: 8px; margin: 10px 0 6px; align-items: center; }
.st-custom .btn.small { margin-top: 0; }

/* =================================================================== */
/* Carte                                                                */
/* =================================================================== */
.map { height: 220px; border-radius: 14px; overflow: hidden; margin: 8px 0 10px; background: var(--rose-soft); z-index: 0; }
.map .leaflet-tile-pane { filter: var(--tile-filter); transition: filter .4s; }
.map .leaflet-container { background: var(--rose-soft); }
.loc-label { margin: 0; font-weight: 500; }
.heart-marker { position: relative; font-size: 28px; line-height: 1; text-shadow: 0 2px 6px rgba(0,0,0,.2); animation: drop .8s var(--spring) both .3s; }
.heart-marker::after {
  content: ""; position: absolute; left: 50%; top: 60%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  border: 2px solid var(--accent); animation: ping 2s ease-out infinite 1.1s; opacity: 0;
}

/* =================================================================== */
/* Météo                                                                */
/* =================================================================== */
.w-now { display: flex; align-items: center; gap: 14px; }
.w-icon { font-size: 44px; display: inline-block; animation: bob 3.5s ease-in-out infinite; }
.w-now b { font: 600 34px/1 var(--serif); display: block; }
.w-now small { color: var(--muted); }
.w-days { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 14px; }
.w-day { text-align: center; background: var(--bg); border-radius: 12px; padding: 8px 2px; font-size: 12px; min-height: 86px; }
.w-day .e { font-size: 20px; display: block; }
.w-day b { font-weight: 600; }
.skel, .weather.loading [data-w-temp], .weather.loading [data-w-desc] {
  background: linear-gradient(90deg, var(--rose-soft) 25%, var(--card-hi) 50%, var(--rose-soft) 75%);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite; color: transparent !important; border-radius: 8px;
}

/* =================================================================== */
/* Agenda                                                               */
/* =================================================================== */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); align-items: flex-start; }
.timeline li:first-child { border-top: 0; }
.timeline .t { width: 46px; flex: none; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 14px; color: var(--accent-ink); }
.timeline .t small { display: block; font-weight: 400; color: var(--muted); }
.timeline .emo { font-size: 18px; width: 24px; flex: none; }
.timeline b { display: block; font-weight: 600; }
.timeline small { color: var(--muted); }
.grow { flex: 1; min-width: 0; }
.ev-notes { margin: 4px 0 0; font-size: 14px; color: var(--ink-soft); }
.day.is-today { border: 1.5px solid var(--rose); box-shadow: var(--shadow), 0 0 0 4px var(--glow); }
.day-chips { display: flex; gap: 8px; overflow-x: auto; padding: 2px 16px 6px; margin: 0 -16px; scrollbar-width: none; scroll-behavior: smooth; }
.day-chips::-webkit-scrollbar { display: none; }
.chip { flex: none; width: 50px; padding: 8px 0; border-radius: 16px; background: var(--card); text-align: center; box-shadow: var(--shadow); transition: transform .2s var(--spring); }
.chip:active { transform: scale(.9); }
.chip small { display: block; font-size: 11px; color: var(--muted); text-transform: capitalize; }
.chip b { font: 600 20px/1 var(--serif); }
.chip.today { background: var(--accent); color: var(--on-accent); }
.chip.today small { color: inherit; opacity: .85; }
section[id^="j-"], article[id^="mot-"] { scroll-margin-top: 80px; }

/* =================================================================== */
/* Photos                                                               */
/* =================================================================== */
.segmented { position: relative; display: grid; grid-template-columns: 1fr 1fr; background: var(--rose-soft); border-radius: 14px; padding: 4px; }
.segmented a { text-align: center; padding: 9px; border-radius: 11px; font-weight: 500; color: var(--accent-ink); font-size: 14px; transition: background .25s, color .25s; }
.segmented a.active { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.count { background: var(--accent); color: var(--on-accent); border-radius: 999px; padding: 0 7px; font-size: 11px; margin-left: 4px; display: inline-block; animation: pop .5s var(--spring) both .4s; }
.day-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.day-tile { position: relative; aspect-ratio: 4/5; border-radius: 18px; overflow: hidden; background: var(--rose-soft); box-shadow: var(--shadow); transition: transform .25s var(--ease); }
.day-tile:active { transform: scale(.96); }
.day-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 6s ease; }
.day-tile:hover img { transform: scale(1.06); }
.day-tile-cap { position: absolute; inset: auto 0 0 0; padding: 30px 12px 10px; background: linear-gradient(transparent, rgba(40,25,22,.6)); color: #fff; }
.day-tile.empty .day-tile-cap { background: none; color: var(--ink); }
.day-tile.empty small { color: var(--muted); }
.day-tile-cap b { display: block; font-size: 20px; }
.day-tile-cap small { font-size: 12px; opacity: .9; }
.day-tile.is-today { outline: 2px solid var(--accent); outline-offset: 2px; }
.masonry { columns: 2; column-gap: 8px; }
.m-item { display: block; position: relative; break-inside: avoid; margin-bottom: 8px; border-radius: 14px; overflow: hidden; background: var(--rose-soft); transition: transform .25s var(--ease); }
.m-item:active { transform: scale(.96); }
.m-item img { width: 100%; height: 100%; object-fit: cover; }
.m-badge { position: absolute; left: 8px; bottom: 8px; background: rgba(255,255,255,.9); color: #3A2E2C; border-radius: 999px; padding: 2px 8px; font-size: 11px; }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.thumbs a { display: block; border-radius: 10px; overflow: hidden; background: var(--rose-soft); }
.thumbs img { aspect-ratio: 1; object-fit: cover; width: 100%; transition: transform .3s var(--ease); }
.thumbs a:active img { transform: scale(.94); }
.pager { display: flex; justify-content: space-between; align-items: center; }
.viewer { margin: 0 -16px; position: relative; background: #0F0B0C; }
.viewer img { width: 100%; height: auto; max-height: 78vh; object-fit: contain; margin: 0 auto; }
.nav-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: rgba(255,255,255,.75); color: #3A2E2C; font-size: 26px; line-height: 1; transition: transform .2s var(--spring); }
.nav-arrow:active { transform: translateY(-50%) scale(.85); }
.nav-arrow.left { left: 10px; } .nav-arrow.right { right: 10px; }
.caption { font-size: 21px; margin: 0 0 6px; }
.love-preview { display: block; border-radius: 14px; overflow: hidden; }
.love-preview img { width: 100%; max-height: 320px; object-fit: cover; }
.cta { display: flex; align-items: center; gap: 14px; background: linear-gradient(135deg, var(--hero-b), var(--hero-a)); }
.cta-emo { font-size: 36px; display: inline-block; animation: wiggle 3s ease-in-out infinite; }
.cta b { display: block; font-size: 22px; }
.cta small { color: var(--muted); }

/* Apparition douce des photos une fois chargées */
html.anim .fade-img { opacity: 0; transform: scale(1.03); transition: opacity .6s ease, transform .9s var(--ease); }
html.anim .fade-img.loaded { opacity: 1; transform: none; }

/* =================================================================== */
/* Upload                                                               */
/* =================================================================== */
.uploader { display: flex; flex-direction: column; gap: 10px; }
.drop { position: relative; display: grid; place-items: center; border: 1.5px dashed var(--rose); border-radius: 16px; padding: 22px; color: var(--accent-ink); font-weight: 500; text-align: center; background: var(--field); transition: background .25s, border-color .25s, transform .2s var(--spring); }
.drop:active { transform: scale(.98); }
.drop span { display: flex; align-items: center; gap: 6px; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop.has-files { border-style: solid; background: var(--rose-soft); animation: pop .4s var(--spring); }
.progress { height: 6px; background: var(--rose-soft); border-radius: 99px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--rose), var(--accent)); background-size: 200% 100%; animation: shimmer 1.2s linear infinite; transition: width .3s var(--ease); }

/* =================================================================== */
/* Mots                                                                 */
/* =================================================================== */
.letter { background: var(--paper); }
.letter.fresh { animation: glow 2.6s ease-in-out 3; }
.note-title { font-size: 26px; margin: 2px 0 8px; }
.letter-body { font-size: 20px; line-height: 1.55; }
.signature { text-align: right; font-size: 20px; margin: 10px 0 0; color: var(--accent-ink); }
.right-row { justify-content: flex-end; }
.note-preview .excerpt { margin: 0; color: var(--ink-soft); }
.note-preview .note-title { font-size: 22px; margin: 0 0 4px; }
.note-preview.fresh { border-color: var(--rose); box-shadow: var(--shadow), 0 0 0 4px var(--glow); }
.next-note { margin: 10px 0 0; }
.envelope { text-align: center; background: linear-gradient(160deg, var(--hero-a), var(--hero-b)); }
.env-emo { font-size: 54px; display: inline-block; animation: wiggle 2.8s ease-in-out infinite; }
.env-title { font-size: 26px; margin: 6px 0 2px; }
.unlock { font: 600 22px/1.2 var(--serif); color: var(--accent-ink); margin: 10px 0 0; font-variant-numeric: tabular-nums; }
.schedule { display: flex; flex-direction: column; gap: 10px; }
.schedule .label { margin: 0; font-size: 13px; color: var(--muted); font-weight: 500; }
.date-chips { display: flex; gap: 6px; overflow-x: auto; margin: 0 -18px; padding: 2px 18px 4px; scrollbar-width: none; }
.date-chips::-webkit-scrollbar { display: none; }
.dchip {
  position: relative; flex: none; min-width: 46px; padding: 7px 8px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--field); color: var(--ink); font: 500 13px var(--sans); cursor: pointer; text-align: center;
  transition: transform .2s var(--spring), background .2s;
}
.dchip small { display: block; font-size: 10px; color: var(--muted); text-transform: capitalize; }
.dchip b { font: 600 18px/1 var(--serif); }
.dchip i { position: absolute; top: -5px; right: -4px; font-style: normal; font-size: 10px; background: var(--accent); color: var(--on-accent); border-radius: 50%; width: 16px; height: 16px; display: grid; place-items: center; }
.dchip:active { transform: scale(.9); }
.dchip.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.dchip.on small { color: inherit; opacity: .85; }
.sched-list { list-style: none; margin: 0; padding: 0; }
.sched-list li { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.sched-list li:first-child { border-top: 0; }
.sched-list b { display: block; }
.sched-date { width: 46px; flex: none; text-align: center; background: var(--rose-soft); border-radius: 12px; padding: 6px 0; color: var(--accent-ink); }
.sched-date b { font-size: 22px; line-height: 1; }
.sched-date small { font-size: 11px; }

/* =================================================================== */
/* Fil de réponses                                                      */
/* =================================================================== */
.thread { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; clear: both; }
.bubble { max-width: 85%; align-self: flex-start; }
.bubble.mine { align-self: flex-end; text-align: right; }
.bubble-body { display: inline-block; text-align: left; background: var(--bg); border-radius: 18px 18px 18px 6px; padding: 8px 13px; }
.bubble.mine .bubble-body { background: var(--rose-soft); border-radius: 18px 18px 6px 18px; }
.bubble-meta { font-size: 11px; color: var(--muted); margin-top: 2px; }
.reply { display: flex; gap: 6px; align-items: flex-end; margin-top: 4px; }
.reply textarea { flex: 1; resize: none; min-height: 42px; border-radius: 21px !important; padding: 10px 14px !important; transition: height .15s ease; }
.reply .send { background: var(--accent); color: var(--on-accent); flex: none; }
.reply .send:active .ic { transform: translate(3px, -3px); }
.reply .send .ic { transition: transform .2s var(--spring); }

/* =================================================================== */
/* Infos                                                                */
/* =================================================================== */
.sum-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.sum-grid small { display: block; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.sum-grid b { font-size: 19px; }
.info-item { padding: 10px 0; border-top: 1px solid var(--line); }
.info-item:first-of-type { border-top: 0; }
.info-item p { margin: 4px 0 0; color: var(--ink-soft); word-break: break-word; }

/* =================================================================== */
/* Formulaires & boutons                                                */
/* =================================================================== */
.stack { display: flex; flex-direction: column; gap: 12px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); font-weight: 500; }
input, select, textarea {
  font: 16px/1.4 var(--sans); color: var(--ink); width: 100%;
  border: 1px solid var(--line); background: var(--field); border-radius: 12px; padding: 11px 12px;
  appearance: none; -webkit-appearance: none; transition: border-color .2s, box-shadow .2s, background-color .4s;
}
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }
textarea { resize: vertical; }
textarea.code { font: 11px/1.4 ui-monospace, Menlo, monospace; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--glow); }
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 30px; }
details > summary { list-style: none; cursor: pointer; font-size: 20px; display: flex; align-items: center; gap: 6px; color: var(--accent-ink); }
details > summary::-webkit-details-marker { display: none; }
details > summary .ic { transition: transform .35s var(--spring); }
details[open] > summary .ic { transform: rotate(45deg); }
details[open] > summary { margin-bottom: 14px; }
details[open] > :not(summary) { animation: fadeUp .4s var(--ease) both; }
.admin-details > summary { font-size: 13px; font-family: var(--sans); }
.btn {
  font: 600 15px/1 var(--sans); border: 0; border-radius: 14px; padding: 14px 18px; cursor: pointer;
  background: var(--rose-soft); color: var(--accent-ink); display: inline-flex; justify-content: center; align-items: center; gap: 6px;
  transition: transform .18s var(--spring), background .2s, box-shadow .2s;
}
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 16px -6px var(--glow); }
.btn.primary:active { background: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn.small { padding: 10px 14px; font-size: 14px; margin-top: 8px; }
.btn.danger, .link-btn.danger { color: var(--danger); }
.btn:disabled { opacity: .55; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-size: 12px; color: var(--accent-ink); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.inline { display: inline; }
.admin-row { display: flex; gap: 14px; margin-top: 6px; }
.alert { background: var(--danger-soft); color: var(--danger); border-radius: 12px; padding: 10px 12px; font-size: 14px; animation: shake .4s ease; }

/* Sélecteur de thème */
.theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; background: var(--rose-soft); padding: 4px; border-radius: 14px; margin-top: 10px; }
.theme-switch button { border: 0; background: transparent; color: var(--accent-ink); font: 500 14px var(--sans); padding: 10px 4px; border-radius: 11px; cursor: pointer; transition: background .25s, color .25s, transform .2s var(--spring); }
.theme-switch button:active { transform: scale(.94); }
.theme-switch button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* =================================================================== */
/* Toast                                                                */
/* =================================================================== */
.toast {
  position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 64px); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 50;
  box-shadow: var(--shadow); animation: toast 3.4s var(--ease) forwards; max-width: calc(100% - 32px); text-align: center;
}

/* =================================================================== */
/* Barre d'onglets                                                      */
/* =================================================================== */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tab-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--tabbar); backdrop-filter: saturate(1.4) blur(16px); -webkit-backdrop-filter: saturate(1.4) blur(16px);
  border-top: 1px solid var(--line);
  view-transition-name: tabbar;
}
.tabbar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 500; transition: color .25s; }
.tabbar a .ic { transition: transform .25s var(--spring); }
.tabbar a:active .ic { transform: scale(.8); }
.tabbar a.active { color: var(--accent-ink); }
.tabbar a.active .ic { fill: var(--rose-soft); animation: pop .5s var(--spring); }
.tabbar a.active::before {
  content: ""; position: absolute; top: 0; left: 50%; width: 22px; height: 3px; margin-left: -11px;
  border-radius: 0 0 3px 3px; background: var(--accent); animation: grow .4s var(--ease);
}

/* =================================================================== */
/* Connexion / installation                                             */
/* =================================================================== */
body.auth { display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 50% 0%, var(--hero-b) 0%, var(--bg) 60%); }
.auth-card { width: 100%; max-width: 380px; background: var(--card); border-radius: 26px; padding: 30px 22px; box-shadow: var(--shadow); text-align: center; animation: fadeUp .7s var(--ease) both; border: 1px solid var(--line); }
.auth-card.wide { max-width: 520px; text-align: left; }
.auth-card h1 { font-size: 34px; }
.auth-card h2 { font-size: 22px; margin-top: 10px; }
.auth-card form { text-align: left; margin-top: 18px; }
.auth-heart { font-size: 40px; color: var(--accent); animation: beat 1.6s ease-in-out infinite; }

/* Leaflet */
.leaflet-control-attribution { font-size: 9px !important; background: var(--glass) !important; color: var(--muted) !important; }
.leaflet-control-attribution a { color: var(--accent-ink) !important; }
.leaflet-div-icon { background: none !important; border: 0 !important; }

/* Cœurs qui jaillissent (tap sur le ♥) */
.burst-heart { position: fixed; z-index: 60; pointer-events: none; font-size: 18px; color: var(--accent); animation: burst .9s var(--ease) forwards; }

/* =================================================================== */
/* Apparition au défilement (activée par JS uniquement)                */
/* =================================================================== */
html.anim .rv { opacity: 0; }
html.anim .rv.in { animation: fadeUp .6s var(--ease) both; animation-delay: var(--d, 0ms); }
html.anim .rv.in.pop-in { animation-name: popIn; }

/* =================================================================== */
/* Transitions entre pages (Safari 18.2+, Chrome)                       */
/* =================================================================== */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
  ::view-transition-old(root) { animation: vtOut .2s ease both; }
  ::view-transition-new(root) { animation: vtIn .32s var(--ease) both; }
}

/* =================================================================== */
/* Keyframes                                                            */
/* =================================================================== */
@keyframes fadeUp { from { opacity: 0; transform: translateY(18px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes popIn { 0% { opacity: 0; transform: scale(.85); } 70% { opacity: 1; transform: scale(1.03); } 100% { opacity: 1; transform: none; } }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.15); } 100% { transform: scale(1); } }
@keyframes grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes flip { 0% { transform: translateY(-60%); opacity: 0; filter: blur(2px); } 100% { transform: none; opacity: 1; filter: none; } }
@keyframes beat { 0%, 100% { transform: scale(1); } 15% { transform: scale(1.18); } 30% { transform: scale(1); } 45% { transform: scale(1.1); } }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes wiggle { 0%, 60%, 100% { transform: rotate(0); } 70% { transform: rotate(-9deg); } 80% { transform: rotate(8deg); } 90% { transform: rotate(-4deg); } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes drop { 0% { transform: translateY(-50px); opacity: 0; } 60% { transform: translateY(4px); opacity: 1; } 80% { transform: translateY(-4px); } 100% { transform: none; } }
@keyframes ping { 0% { transform: scale(.6); opacity: .9; } 100% { transform: scale(3.2); opacity: 0; } }
@keyframes floatUp { 0% { transform: translateY(0) rotate(0) scale(.6); opacity: 0; } 12% { opacity: .35; } 100% { transform: translateY(-260px) rotate(var(--r, 20deg)) scale(1); opacity: 0; } }
@keyframes burst { 0% { transform: translate(0, 0) scale(.4); opacity: 1; } 100% { transform: translate(var(--x), var(--y)) scale(1.2) rotate(var(--r)); opacity: 0; } }
@keyframes glow { 0%, 100% { box-shadow: var(--shadow); } 50% { box-shadow: var(--shadow), 0 0 0 5px var(--glow); } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, -12px) scale(.95); } 8%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; visibility: hidden; transform: translate(-50%, -8px); } }
@keyframes vtOut { to { opacity: 0; transform: translateY(-6px); } }
@keyframes vtIn { from { opacity: 0; transform: translateY(10px); } }

@media (min-width: 700px) {
  .day-grid { grid-template-columns: repeat(3, 1fr); }
  .masonry { columns: 3; }
  .status-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html.anim .rv, html.anim .fade-img { opacity: 1 !important; transform: none !important; }
}
