/* ==========================================================================
   Jalon - one stylesheet, shared by the app shell and the public share page.

   Mobile first, and unapologetically so: every size below is chosen for a
   thumb on a phone, and the desktop rules at the bottom do nothing but stop
   the layout from sprawling. There is no dashboard chrome anywhere in here.
   ========================================================================== */

/* ------------------------------------------------------------- 1. tokens */

:root {
  color-scheme: light dark;

  --bg: #f6f5f3;
  --bg-tint: #ffffff;
  --surface: #ffffff;
  --surface-2: #f1efec;
  --fg: #14141a;
  --fg-soft: #55555f;
  --fg-mute: #8a8a95;
  --line: rgba(20, 20, 26, 0.10);
  --line-strong: rgba(20, 20, 26, 0.18);
  --accent: #e8593f;
  --accent-fg: #ffffff;
  --danger: #d1344b;
  --ok: #2f9e6a;
  --warn: #d99114;

  --shadow-sm: 0 1px 2px rgba(18, 18, 26, .05), 0 4px 14px rgba(18, 18, 26, .05);
  --shadow-md: 0 2px 6px rgba(18, 18, 26, .06), 0 18px 44px rgba(18, 18, 26, .10);
  --shadow-card: 0 10px 24px rgba(18, 18, 26, .12), 0 40px 80px rgba(18, 18, 26, .16);

  --r-card: 30px;
  --r-box: 20px;
  --r-ctl: 15px;
  --r-pill: 999px;

  --pad: 20px;
  --maxw: 520px;

  --ease: cubic-bezier(.22, 1, .36, 1);
  --dur: .34s;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
  --font-emoji: "Apple Color Emoji", "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-scheme="light"]) {
    --bg: #0d0d11;
    --bg-tint: #131319;
    --surface: #17171e;
    --surface-2: #1f1f28;
    --fg: #f4f4f7;
    --fg-soft: #b3b3c0;
    --fg-mute: #7c7c8b;
    --line: rgba(255, 255, 255, 0.10);
    --line-strong: rgba(255, 255, 255, 0.20);
    --accent: #ff7358;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 2px 6px rgba(0, 0, 0, .4), 0 18px 44px rgba(0, 0, 0, .5);
    --shadow-card: 0 10px 24px rgba(0, 0, 0, .45), 0 40px 90px rgba(0, 0, 0, .55);
  }
}

:root[data-scheme="dark"] {
  --bg: #0d0d11;
  --bg-tint: #131319;
  --surface: #17171e;
  --surface-2: #1f1f28;
  --fg: #f4f4f7;
  --fg-soft: #b3b3c0;
  --fg-mute: #7c7c8b;
  --line: rgba(255, 255, 255, 0.10);
  --line-strong: rgba(255, 255, 255, 0.20);
  --accent: #ff7358;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, .4), 0 18px 44px rgba(0, 0, 0, .5);
  --shadow-card: 0 10px 24px rgba(0, 0, 0, .45), 0 40px 90px rgba(0, 0, 0, .55);
}

/* --------------------------------------------------------------- 2. base */

*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overscroll-behavior-y: none;
}

/* A very quiet wash of colour, so the page is never a flat slab of grey. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(60% 40% at 85% -5%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
    radial-gradient(50% 40% at 5% 0%, color-mix(in srgb, #6a8bff 10%, transparent), transparent 70%);
  pointer-events: none;
}

h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
a { color: inherit; }

:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0);
  white-space: nowrap; border: 0;
}

/* ---------------------------------------------------------- 3. app shell */

.app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--pad);
  padding-top: max(14px, env(safe-area-inset-top));
  padding-bottom: calc(120px + env(safe-area-inset-bottom));
  min-height: 100%;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  height: 56px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 680;
  font-size: 1.06rem;
  letter-spacing: -.02em;
  text-decoration: none;
}

/* The same clock face the app icon carries, drawn in CSS so the wordmark and
   the home-screen icon are recognisably the same mark. */
.brand-mark {
  width: 26px; height: 26px;
  flex: none;
  border-radius: 9px;
  background: linear-gradient(145deg, #ff9d5c, #e8593f 55%, #b93a86);
  position: relative;
  box-shadow: var(--shadow-sm);
}
.brand-mark::before {
  content: "";
  position: absolute;
  inset: 5px;
  border: 2px solid rgba(255, 255, 255, .95);
  border-radius: 50%;
}
.brand-mark::after {
  content: "";
  position: absolute;
  left: 50%; top: 7px;
  width: 2px; height: 7px;
  border-radius: 1px;
  background: rgba(255, 255, 255, .95);
  transform: translateX(-50%);
}

.icon-btn {
  width: 44px; height: 44px;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: var(--r-pill);
  background: transparent;
  color: var(--fg-soft);
  cursor: pointer;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }
.icon-btn svg { width: 21px; height: 21px; }

/* --------------------------------------------------------------- 4. hero */

.hero { padding: 26px 2px 22px; }

.hero h1 {
  font-size: clamp(1.9rem, 8.4vw, 2.5rem);
  line-height: 1.05;
  letter-spacing: -.035em;
  font-weight: 700;
}

.hero p {
  margin-top: 12px;
  color: var(--fg-soft);
  font-size: 1.03rem;
  line-height: 1.5;
  max-width: 30ch;
}

/* --------------------------------------------------- 5. activity summary */

.pulse {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 4px 0 0;
  padding: 2px 0 14px;
}
.pulse::-webkit-scrollbar { display: none; }

.pulse-pill {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-size: .855rem;
  color: var(--fg-soft);
  white-space: nowrap;
}
.pulse-pill b { color: var(--fg); font-weight: 640; }

.dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex: none;
  background: var(--fg-mute);
}
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.late { background: var(--danger); }

/* ------------------------------------------------------- 6. section head */

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 18px 2px 12px;
}
.section-head h2 {
  font-size: .78rem;
  font-weight: 640;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--fg-mute);
}

/* --------------------------------------------------------------- 7. list */

.list { display: grid; gap: 11px; }

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 15px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-box);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: left;
  cursor: pointer;
  transition: transform .18s var(--ease), box-shadow var(--dur) var(--ease),
              border-color var(--dur) var(--ease);
}
.row:hover { box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.row:active { transform: scale(.985); }

.row-emoji {
  width: 46px; height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  font-family: var(--font-emoji);
  font-size: 1.5rem;
  border-radius: 15px;
  background: var(--gradient, var(--surface-2));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22);
}

.row-main { flex: 1 1 auto; min-width: 0; }

.row-title {
  font-weight: 580;
  font-size: 1rem;
  letter-spacing: -.012em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
}

.row-meta {
  margin-top: 3px;
  font-size: .82rem;
  color: var(--fg-mute);
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row-value {
  flex: none;
  text-align: right;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.03em;
}
.row-value b {
  display: block;
  font-size: 1.5rem;
  font-weight: 680;
  line-height: 1;
}
.row-value span {
  display: block;
  margin-top: 3px;
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--fg-mute);
}
.row-value.is-late b { color: var(--danger); }
.row-value.is-warn b { color: var(--warn); }

/* -------------------------------------------------------- 8. empty state */

.suggestions {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 10px;
}

.suggestion {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-size: .9rem;
  font-weight: 520;
  text-align: left;
  cursor: pointer;
  transition: transform .18s var(--ease), border-color var(--dur) var(--ease);
}
.suggestion:hover { border-color: var(--line-strong); }
.suggestion:active { transform: scale(.97); }
.suggestion em {
  font-family: var(--font-emoji);
  font-style: normal;
  font-size: 1.18rem;
}
.suggestion.is-own {
  background: var(--fg);
  color: var(--bg);
  border-color: transparent;
  justify-content: center;
}

/* The pair of example cards: the answer to "what do I get?", one of each
   direction so that depuis/jusqu'a is shown rather than explained. They are
   illustrations, not counters - no date on them, so they cannot go stale.

   The block lives outside #view in the shell, because app.js repaints #view
   wholesale. Hidden by default and revealed only while the empty-state hero is
   up: that is the one screen where an example is worth the space, and a browser
   without :has() simply never shows it, which costs nothing. */
.demo-block { display: none; }
.app:has(#view .hero) .demo-block { display: block; }

.demo {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.demo .card.is-mini {
  min-height: 176px;
  padding: 20px 14px;
  border-radius: 22px;
}
.demo .card.is-mini .card-emoji { font-size: 1.5rem; margin-bottom: 8px; }
.demo .card.is-mini .card-value { font-size: 2.3rem; }
.demo .card.is-mini .card-unit { margin-top: 6px; font-size: .6rem; }
.demo .card.is-mini .card-title { margin-top: 10px; font-size: .84rem; }

.demo-note {
  margin: 12px 4px 0;
  color: var(--fg-mute);
  font-size: .88rem;
  line-height: 1.45;
}

/* ------------------------------------------------------------- 9. THE CARD

   The one object the whole product is about. It carries its own palette, so it
   looks the same in a light app, a dark app and a screenshot in a group chat.

   The height is capped so that on a phone the card AND its actions fit above
   the fold: a "Partager" button you have to scroll to find is a share that
   does not happen. */

.card {
  position: relative;
  isolation: isolate;
  border-radius: var(--r-card);
  padding: clamp(26px, 7vw, 38px) clamp(22px, 6vw, 32px);
  min-height: min(62vh, 520px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  overflow: hidden;
  background: var(--gradient);
  color: var(--card-fg);
  box-shadow: var(--shadow-card);
  -webkit-tap-highlight-color: transparent;
}

/* A soft light source at the top, which is what stops a flat gradient from
   reading as a coloured rectangle. */
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: radial-gradient(120% 70% at 50% -10%, rgba(255, 255, 255, .34), transparent 62%);
  pointer-events: none;
}

.card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .3), inset 0 0 0 1px rgba(255, 255, 255, .12);
  pointer-events: none;
}

.card-emoji {
  font-family: var(--font-emoji);
  font-size: clamp(2.4rem, 11vw, 3.3rem);
  line-height: 1;
  margin-bottom: clamp(14px, 4vw, 24px);
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .22));
}

.card-number {
  border: 0;
  background: none;
  color: inherit;
  padding: 6px 10px;
  cursor: pointer;
  border-radius: 22px;
  display: block;
  transition: transform .2s var(--ease);
}
.card-number:active { transform: scale(.97); }
div.card-number { cursor: default; }

.card-value {
  display: block;
  font-size: clamp(3.8rem, 20vw, 6rem);
  font-weight: 700;
  line-height: .92;
  letter-spacing: -.05em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 4px 24px rgba(0, 0, 0, .18);
}
.card-value.is-long { font-size: clamp(2.4rem, 12vw, 3.8rem); }

.card-unit {
  display: block;
  margin-top: 11px;
  font-size: clamp(.76rem, 3.2vw, .9rem);
  font-weight: 620;
  letter-spacing: .3em;
  text-transform: uppercase;
  opacity: .82;
}
.card-unit:empty { margin-top: 0; }

.card-title {
  margin-top: clamp(18px, 5vw, 26px);
  font-size: clamp(1.08rem, 4.6vw, 1.3rem);
  font-weight: 500;
  line-height: 1.35;
  max-width: 18ch;
  text-wrap: balance;
  opacity: .95;
}

.card-sub {
  margin-top: 9px;
  font-size: .875rem;
  opacity: .62;
  letter-spacing: .01em;
}
.card-sub:empty { margin: 0; }

.card-foot {
  margin-top: clamp(18px, 5vw, 26px);
  font-size: .8rem;
  opacity: .55;
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-badge {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 13px;
  border-radius: var(--r-pill);
  font-size: .72rem;
  font-weight: 620;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, .17);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, .22);
}
.card-badge.is-late { background: rgba(209, 52, 75, .82); border-color: transparent; }
.card-badge.is-warn { background: rgba(217, 145, 20, .82); border-color: transparent; }
.card-badge.is-ok { background: rgba(47, 158, 106, .8); border-color: transparent; }

.card-hint {
  margin-top: 12px;
  font-size: .7rem;
  letter-spacing: .08em;
  opacity: .34;
  text-transform: uppercase;
}

/* The compact card: the live preview inside the create form. */
.card.is-mini {
  min-height: 230px;
  padding: 26px 20px;
  border-radius: 26px;
}
.card.is-mini .card-emoji { font-size: 2rem; margin-bottom: 12px; }
.card.is-mini .card-value { font-size: 3.1rem; }
.card.is-mini .card-value.is-long { font-size: 2rem; }
.card.is-mini .card-unit { margin-top: 8px; font-size: .68rem; }
.card.is-mini .card-title { margin-top: 14px; font-size: .98rem; }
.card.is-mini .card-sub,
.card.is-mini .card-foot,
.card.is-mini .card-hint { display: none; }

/* ------------------------------------------------------------ 10. themes */

.t-minimal {
  --gradient: linear-gradient(168deg, #ffffff, #f2f0ec);
  --card-fg: #16161c;
}
:root[data-scheme="dark"] .t-minimal,
.t-minimal.is-dark {
  --gradient: linear-gradient(168deg, #24242c, #15151a);
  --card-fg: #f4f4f7;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-scheme="light"]) .t-minimal {
    --gradient: linear-gradient(168deg, #24242c, #15151a);
    --card-fg: #f4f4f7;
  }
}

.t-sunset {
  --gradient: linear-gradient(158deg, #ffb35c 2%, #ff7a59 38%, #ef4e6f 72%, #b4407f 100%);
  --card-fg: #fffaf6;
}

.t-ocean {
  --gradient: linear-gradient(160deg, #63d3d8 0%, #2c8fd0 42%, #1b4f9c 100%);
  --card-fg: #f4fbff;
}

.t-forest {
  --gradient: linear-gradient(162deg, #9dc98a 0%, #4d9a6a 45%, #1f4d3e 100%);
  --card-fg: #f6fbf5;
}

.t-night {
  --gradient: linear-gradient(170deg, #2a3566 0%, #161c3c 45%, #070914 100%);
  --card-fg: #eef1ff;
}
/* Stars, drawn as layers of tiny dots rather than an image request. */
.t-night::before {
  background:
    radial-gradient(1.4px 1.4px at 18% 22%, rgba(255, 255, 255, .9), transparent),
    radial-gradient(1.2px 1.2px at 72% 14%, rgba(255, 255, 255, .75), transparent),
    radial-gradient(1.6px 1.6px at 42% 8%, rgba(255, 255, 255, .8), transparent),
    radial-gradient(1.1px 1.1px at 88% 34%, rgba(255, 255, 255, .65), transparent),
    radial-gradient(1.3px 1.3px at 8% 46%, rgba(255, 255, 255, .6), transparent),
    radial-gradient(1.1px 1.1px at 60% 40%, rgba(255, 255, 255, .5), transparent),
    radial-gradient(1.5px 1.5px at 30% 66%, rgba(255, 255, 255, .55), transparent),
    radial-gradient(1.2px 1.2px at 80% 74%, rgba(255, 255, 255, .45), transparent),
    radial-gradient(120% 70% at 50% -10%, rgba(120, 150, 255, .22), transparent 62%);
}

.t-love {
  --gradient: linear-gradient(158deg, #ffc2d6 0%, #ff8fa8 34%, #f0526f 68%, #c3325f 100%);
  --card-fg: #fff7f9;
}

/* ------------------------------------------------------------ 11. buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 52px;
  padding: 0 22px;
  border: 1px solid transparent;
  border-radius: var(--r-ctl);
  background: var(--fg);
  color: var(--bg);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -.01em;
  cursor: pointer;
  text-decoration: none;
  transition: transform .16s var(--ease), opacity var(--dur) var(--ease),
              background var(--dur) var(--ease);
}
.btn:active { transform: scale(.975); }
.btn[disabled] { opacity: .45; cursor: not-allowed; }
.btn svg { width: 19px; height: 19px; }

.btn-full { width: 100%; }

.btn-ghost {
  background: var(--surface);
  color: var(--fg);
  border-color: var(--line);
  box-shadow: var(--shadow-sm);
}

.btn-quiet {
  background: transparent;
  color: var(--fg-soft);
  border-color: transparent;
  min-height: 46px;
  box-shadow: none;
}
.btn-quiet:hover { color: var(--fg); }

.btn-danger { background: var(--danger); color: #fff; }

.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1 1 0; }

/* The one big affordance on the home screen. Absent on the empty screen,
   where the suggestions are already the call to action. */
.fab {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 40;
  min-height: 56px;
  padding: 0 26px;
  border: 0;
  border-radius: var(--r-pill);
  background: var(--fg);
  color: var(--bg);
  font-size: 1rem;
  font-weight: 620;
  box-shadow: 0 8px 30px rgba(0, 0, 0, .28);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  white-space: nowrap;
  transition: transform .2s var(--ease);
}
.fab:active { transform: translateX(-50%) scale(.96); }
.fab svg { width: 20px; height: 20px; }

/* ------------------------------------------------------------- 12. forms */

.field { margin-bottom: 18px; }

.label {
  display: block;
  margin-bottom: 9px;
  font-size: .82rem;
  font-weight: 600;
  color: var(--fg-soft);
  letter-spacing: -.005em;
}

.input, .select {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
  color: var(--fg);
  font-size: 1.05rem;
  font-family: inherit;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
.input::placeholder { color: var(--fg-mute); }
.input:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}

.select {
  background-image: linear-gradient(45deg, transparent 50%, var(--fg-mute) 50%),
                    linear-gradient(135deg, var(--fg-mute) 50%, transparent 50%);
  background-position: calc(100% - 21px) 23px, calc(100% - 15px) 23px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.hint { margin-top: 8px; font-size: .82rem; color: var(--fg-mute); line-height: 1.45; }

.field-row { display: flex; gap: 10px; }
.field-row > * { flex: 1 1 0; min-width: 0; }

/* Segmented control: the "depuis / jusqu'a" choice, made hard to miss. */
.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.seg {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 16px;
  border: 1.5px solid var(--line);
  border-radius: var(--r-ctl);
  background: var(--surface);
  cursor: pointer;
  text-align: left;
  transition: border-color .2s var(--ease), background .2s var(--ease),
              transform .16s var(--ease);
}
.seg:active { transform: scale(.98); }
.seg[aria-pressed="true"] {
  border-color: var(--fg);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--fg) 10%, transparent);
}
.seg-icon { font-size: 1.15rem; line-height: 1; }
.seg-title { font-weight: 620; font-size: .98rem; }
.seg-desc { font-size: .78rem; color: var(--fg-mute); line-height: 1.3; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
  min-height: 44px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--surface);
  font-size: .9rem;
  font-weight: 520;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: border-color .2s var(--ease), transform .16s var(--ease);
}
.chip:active { transform: scale(.96); }
.chip[aria-pressed="true"] {
  border-color: var(--fg);
  box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--fg) 12%, transparent);
}

.emoji-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 8px;
}

.emoji-btn {
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  font-family: var(--font-emoji);
  font-size: 1.4rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform .16s var(--ease), border-color .2s var(--ease);
}
.emoji-btn:hover { transform: translateY(-2px); }
.emoji-btn:active { transform: scale(.92); }
.emoji-btn[aria-pressed="true"] {
  border-color: var(--fg);
  box-shadow: 0 0 0 2.5px color-mix(in srgb, var(--fg) 12%, transparent);
}

.theme-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
}

.theme-btn {
  border: 2px solid transparent;
  border-radius: var(--r-ctl);
  padding: 0;
  cursor: pointer;
  background: none;
  transition: transform .16s var(--ease);
}
.theme-btn:active { transform: scale(.95); }
.theme-swatch {
  display: block;
  height: 52px;
  border-radius: 12px;
  background: var(--gradient);
  box-shadow: var(--shadow-sm), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.theme-name {
  display: block;
  margin-top: 6px;
  font-size: .74rem;
  color: var(--fg-mute);
  text-align: center;
}
.theme-btn[aria-pressed="true"] { border-color: var(--fg); }
.theme-btn[aria-pressed="true"] .theme-name { color: var(--fg); font-weight: 600; }

/* One-time-code boxes */
.otp {
  display: flex;
  gap: 8px;
  justify-content: space-between;
}
.otp input {
  flex: 1 1 0;
  min-width: 0;
  height: 60px;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 620;
  font-variant-numeric: tabular-nums;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--fg);
  -webkit-appearance: none;
  appearance: none;
}
.otp input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}

/* ------------------------------------------------------------ 13. sheets */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(8, 8, 12, .5);
  backdrop-filter: blur(3px);
  opacity: 0;
  animation: fade-in .22s var(--ease) forwards;
}

.sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 51;
  max-height: 92vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: var(--bg-tint);
  border-radius: 28px 28px 0 0;
  border-top: 1px solid var(--line);
  box-shadow: 0 -12px 50px rgba(0, 0, 0, .3);
  padding: 8px var(--pad) calc(24px + env(safe-area-inset-bottom));
  transform: translateY(100%);
  animation: sheet-up .38s var(--ease) forwards;
}
@media (min-width: 560px) {
  .sheet {
    left: 50%;
    right: auto;
    bottom: 24px;
    width: min(480px, calc(100vw - 48px));
    transform: translate(-50%, 20px);
    border-radius: 26px;
    border: 1px solid var(--line);
    animation: sheet-pop .34s var(--ease) forwards;
  }
}

.sheet-grip {
  width: 40px; height: 4px;
  border-radius: 999px;
  background: var(--line-strong);
  margin: 6px auto 14px;
}
@media (min-width: 560px) { .sheet-grip { display: none; } }

.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.sheet-head h2 {
  font-size: 1.28rem;
  font-weight: 680;
  letter-spacing: -.025em;
}

.menu { display: grid; gap: 2px; }
.menu-item {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  min-height: 54px;
  padding: 10px 14px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  font-size: 1rem;
  font-weight: 520;
  text-align: left;
  cursor: pointer;
  transition: background .2s var(--ease);
}
.menu-item:hover { background: var(--surface-2); }
.menu-item svg { width: 20px; height: 20px; flex: none; color: var(--fg-soft); }
.menu-item.is-danger { color: var(--danger); }
.menu-item.is-danger svg { color: var(--danger); }
.menu-item small { display: block; font-weight: 400; color: var(--fg-mute); font-size: .8rem; }

/* The how-to inside the install sheet. Numbered, because on iOS this really
   is a sequence of taps the person has to perform themselves. */
.steps {
  margin: 0;
  padding-left: 22px;
  display: grid;
  gap: 12px;
  font-size: .93rem;
  line-height: 1.5;
  color: var(--fg-soft);
}
.steps li::marker { color: var(--fg-mute); font-weight: 640; }
.steps b { color: var(--fg); font-weight: 620; }

/* ------------------------------------------- 14. transfer between devices */

/* The QR always sits on white, whatever the app's colour scheme: a camera
   reads dark-on-light, and an inverted code in dark mode simply will not scan. */
.qr-frame {
  width: min(244px, 62vw);
  margin: 0 auto 18px;
  padding: 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}
.qr-frame svg { display: block; }

.qr-code {
  text-align: center;
  font-size: 1.45rem;
  font-weight: 680;
  letter-spacing: .16em;
  font-variant-numeric: tabular-nums;
}

.qr-timer {
  margin-top: 12px;
  text-align: center;
  font-size: .82rem;
  color: var(--fg-mute);
}
.qr-timer.is-expired { color: var(--danger); font-weight: 600; }

.input.is-code {
  text-align: center;
  text-transform: uppercase;
  font-size: 1.25rem;
  font-weight: 620;
  letter-spacing: .18em;
}

/* The confirmation page the receiving device lands on. */
.claim { text-align: center; padding: 18px 0; }
.claim-emoji { font-size: 2.6rem; line-height: 1; }
.claim h1 {
  margin-top: 16px;
  font-size: 1.45rem;
  font-weight: 680;
  letter-spacing: -.02em;
}
.claim p { margin-top: 10px; color: var(--fg-soft); line-height: 1.5; }
.claim .btn { margin-top: 22px; }
.claim .claim-code {
  margin-top: 18px;
  font-size: 1.45rem;
  font-weight: 680;
  letter-spacing: .16em;
  color: var(--fg);
}
.claim .hint { margin-top: 14px; }

/* ------------------------------------------------------------ 15. notices */

.notice {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  padding: 16px;
  border-radius: var(--r-box);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  margin: 16px 0;
}
.notice-icon { font-size: 1.2rem; line-height: 1.3; flex: none; }
.notice h3 { font-size: .96rem; font-weight: 620; margin-bottom: 4px; }
.notice p { font-size: .87rem; color: var(--fg-soft); line-height: 1.45; }
.notice .btn-row { margin-top: 13px; }
.notice .btn { min-height: 44px; font-size: .92rem; }

/* The primary label here is a full sentence ("Sauvegarder mes compteurs"); an
   even 50/50 split breaks it over three lines. Give the quiet button its
   natural width and hand every remaining pixel to the primary one. */
.notice .btn-row { flex-wrap: wrap; }
.notice .btn-row .btn { flex: 1 1 auto; }
.notice .btn-row .btn-quiet { flex: 0 0 auto; padding: 0 14px; }

.banner {
  padding: 11px 14px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--warn) 14%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--warn) 34%, transparent);
  font-size: .82rem;
  color: var(--fg-soft);
  line-height: 1.4;
  margin-bottom: 14px;
}

/* The toast lives at the TOP. At the bottom it lands squarely on the primary
   action of whatever screen raised it - "Partager", right after creating a
   counter, being the worst possible case. */
.toast {
  position: fixed;
  left: 50%;
  top: calc(12px + env(safe-area-inset-top));
  transform: translateX(-50%);
  z-index: 90;
  padding: 12px 20px;
  border-radius: var(--r-pill);
  background: var(--fg);
  color: var(--bg);
  font-size: .92rem;
  font-weight: 560;
  box-shadow: var(--shadow-md);
  animation: toast-in .3s var(--ease);
  max-width: calc(100vw - 40px);
  text-align: center;
}
.toast.is-out { animation: toast-out .25s var(--ease) forwards; }
/* Clear the offline banner when both are on screen. */
body:has(.offline-bar) .toast { top: calc(46px + env(safe-area-inset-top)); }

.offline-bar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 80;
  padding: calc(6px + env(safe-area-inset-top)) 14px 6px;
  background: var(--fg);
  color: var(--bg);
  font-size: .8rem;
  font-weight: 560;
  text-align: center;
}

/* ------------------------------------------------------- 16. detail view */

.detail { padding-top: 6px; }
.detail-actions { margin-top: 18px; display: grid; gap: 10px; }

.link-box {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  border-radius: var(--r-ctl);
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: .85rem;
  color: var(--fg-soft);
  word-break: break-all;
  margin-bottom: 14px;
}

/* -------------------------------------------------- 17. the public page */

.public {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: max(20px, env(safe-area-inset-top)) var(--pad)
           calc(24px + env(safe-area-inset-bottom));
}
.public .card { animation: card-in .7s var(--ease) both; }

.public-cta { margin-top: 26px; text-align: center; }
.public-cta .btn { width: 100%; }
.public-cta p {
  margin-top: 14px;
  font-size: .85rem;
  color: var(--fg-mute);
}

/* A visitor who wants to pass the card on should not have to reach for the
   address bar: the same share action the owner gets, minus everything that
   would only make sense if the counter were theirs. */
.public-share {
  margin-top: 10px;
  display: flex;
  justify-content: center;
}
.public-share .btn { width: 100%; }

.public-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 22px;
  font-size: .9rem;
  font-weight: 620;
  color: var(--fg-soft);
  text-decoration: none;
}

.gone {
  text-align: center;
  padding: 40px 0;
}
.gone-emoji { font-size: 3rem; }
.gone h1 { margin-top: 18px; font-size: 1.5rem; font-weight: 680; letter-spacing: -.02em; }
.gone p { margin-top: 10px; color: var(--fg-soft); line-height: 1.5; }
.gone .btn { margin-top: 24px; }

/* --------------------------------------------------------- 18. animation */

@keyframes fade-in { to { opacity: 1; } }
@keyframes sheet-up { to { transform: translateY(0); } }
@keyframes sheet-pop { to { transform: translate(-50%, 0); } }
@keyframes toast-in {
  from { opacity: 0; transform: translate(-50%, -14px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
@keyframes toast-out {
  to { opacity: 0; transform: translate(-50%, -10px); }
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(22px) scale(.96); }
  to { opacity: 1; transform: none; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}
@keyframes tick {
  50% { transform: translateY(-3px); }
}

.rise { animation: rise .45s var(--ease) both; }
.rise-1 { animation-delay: .04s; }
.rise-2 { animation-delay: .09s; }
.rise-3 { animation-delay: .14s; }

.card-value.is-ticking { animation: tick .28s var(--ease); }

.skeleton {
  border-radius: var(--r-box);
  background: linear-gradient(100deg, var(--surface-2) 30%,
              color-mix(in srgb, var(--surface-2) 60%, var(--surface)) 50%, var(--surface-2) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.3s linear infinite;
  height: 78px;
}
@keyframes shimmer { to { background-position: -200% 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .card, .scrim, .toast { animation: none !important; opacity: 1 !important; }
  .toast { transform: translateX(-50%) !important; }
  .sheet { animation: none !important; opacity: 1 !important; transform: translateY(0) !important; }
}
@media (prefers-reduced-motion: reduce) and (min-width: 560px) {
  .sheet { transform: translate(-50%, 0) !important; }
}

/* ---------------------------------------------------------- 19. desktop

   Deliberately minimal: the phone layout, centred, with a little more air.
   Nothing here turns the app into a two-column console. */

@media (min-width: 720px) {
  :root { --pad: 24px; }
  .app { padding-top: 20px; }
  .hero { padding: 34px 2px 26px; }
  .fab { bottom: 30px; }
}
