/* iPomme : même design que le téléphone en jeu (qs-smartphone). Thème clair ou sombre selon le réglage du téléphone. */
:root {
  --bg: #f0f0f5;
  --card: #ffffff;
  --text: #111827;
  --text2: #1f2937;
  --muted: #8e8e99;
  --sep: rgba(60, 60, 67, .2);
  --fill: rgba(118, 118, 128, .12);
  --glass: rgba(255, 255, 255, .82);
  --glass-line: rgba(255, 255, 255, .95);
  --glass-shadow: 0 4px 16px rgba(17, 24, 39, .1), inset 0 1px 0 rgba(255, 255, 255, .9);
  --blue: #0a84ff;
  --green: #22c55e;
  --red: #ff3b30;
  --orange: #ff9500;
  --purple: #8b5cf6;
  --bubble-them: #e9e9ef;
  --bar: rgba(240, 240, 245, .86);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000; --card: #1c1c1e; --text: #f5f5f7; --text2: #e5e5ea; --muted: #8e8e93; --sep: rgba(84, 84, 88, .6);
    --fill: rgba(118, 118, 128, .24); --glass: rgba(44, 44, 46, .82); --glass-line: rgba(255, 255, 255, .08);
    --glass-shadow: 0 4px 16px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .06);
    --bubble-them: #26262a; --bar: rgba(0, 0, 0, .8); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000; --card: #1c1c1e; --text: #f5f5f7; --text2: #e5e5ea; --muted: #8e8e93; --sep: rgba(84, 84, 88, .6);
  --fill: rgba(118, 118, 128, .24); --glass: rgba(44, 44, 46, .82); --glass-line: rgba(255, 255, 255, .08);
  --glass-shadow: 0 4px 16px rgba(0, 0, 0, .4), inset 0 1px 0 rgba(255, 255, 255, .06);
  --bubble-them: #26262a; --bar: rgba(0, 0, 0, .8); color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 16px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
img { -webkit-user-drag: none; }

#app { min-height: 100%; display: flex; flex-direction: column; max-width: 640px; margin: 0 auto; position: relative; }
#app.boot { align-items: center; justify-content: center; }
.boot-logo { width: 96px; height: 96px; border-radius: 22px; animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.94); opacity: .7; } }
.view { flex: 1; display: flex; flex-direction: column; min-height: 100%; background: var(--bg); }

/* --- Transitions entre écrans (fluides comme un téléphone) -------------------------
   « backwards » et non « both » : une fois l'animation finie, plus aucune transformation ne reste
   appliquée. Sinon l'écran deviendrait le repère des éléments « fixes » (accueil, verrouillage),
   et sur téléphone ils prenaient la hauteur nulle de l'écran : écran blanc. */
.anim-open { animation: app-open .38s var(--ease) backwards; transform-origin: var(--ox, 50%) var(--oy, 50%); }
.anim-close { animation: app-close .3s var(--ease) backwards; }
.anim-push { animation: push .32s var(--ease) backwards; }
.anim-pop { animation: pop .32s var(--ease) backwards; }
.anim-fade { animation: fade-in .22s ease backwards; }
body:not(.framed) .view { min-height: 100vh; min-height: 100dvh; }
@keyframes app-open { from { transform: scale(.25); opacity: 0; border-radius: 40px; } to { transform: none; opacity: 1; } }
@keyframes app-close { from { transform: scale(1.06); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes push { from { transform: translateX(32%); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes pop { from { transform: translateX(-24%); opacity: .4; } to { transform: none; opacity: 1; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .anim-open, .anim-close, .anim-push, .anim-pop, .anim-fade { animation: none; } }

/* --- En-têtes ----------------------------------------------------------------------- */
.hdr { position: sticky; top: 0; z-index: 8; padding: calc(var(--safe-top) + 6px) 16px 0; background: var(--bg); }
.hdr-row { display: flex; align-items: center; justify-content: space-between; min-height: 46px; gap: 10px; position: relative; }
.hdr-side { display: flex; gap: 8px; align-items: center; min-width: 44px; }
.hdr-side.right { justify-content: flex-end; }
.hdr-title { position: absolute; left: 50%; transform: translateX(-50%); font-size: 17px; font-weight: 600; white-space: nowrap;
  max-width: 60%; overflow: hidden; text-overflow: ellipsis; transition: opacity .2s; }
.hdr.large .hdr-title { opacity: 0; }
.hdr.large.scrolled .hdr-title { opacity: 1; }
.hdr.scrolled { background: var(--bar); -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 .5px 0 var(--sep); }
.big-title { font-size: 34px; font-weight: 800; letter-spacing: -.01em; color: var(--text); margin: 4px 16px 12px; line-height: 1.1; }
.hdr-below { padding: 0 0 10px; }

.glass-btn {
  height: 44px; min-width: 44px; padding: 0 14px; border-radius: 22px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--glass); box-shadow: var(--glass-shadow); border: 1px solid var(--glass-line); font-size: 14px; font-weight: 500; color: var(--text);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); transition: transform .12s;
}
.glass-btn.icon { padding: 0; width: 44px; }
.glass-btn svg { width: 20px; height: 20px; }
.glass-btn:active { transform: scale(.92); }
.glass-btn.blue { color: var(--blue); }
.glass-btn:disabled { opacity: .45; }

.search {
  display: flex; align-items: center; gap: 8px; margin: 0 16px; height: 44px; padding: 0 14px; border-radius: 22px;
  background: var(--glass); box-shadow: var(--glass-shadow); border: 1px solid var(--glass-line); color: var(--muted);
}
.search svg { width: 16px; height: 16px; flex: none; }
.search input { border: 0; background: none; outline: none; flex: 1; min-width: 0; font-size: 16px; color: var(--text); }
.search input::placeholder { color: var(--muted); }

.section-title { font-size: 17px; font-weight: 600; color: var(--muted); margin: 18px 20px 8px; }
.caps { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; margin: 14px 20px 8px; }
.small { color: var(--muted); font-size: 13px; }
.empty-note { text-align: center; color: var(--muted); font-size: 14px; padding: 34px 24px; }
.content { flex: 1; padding-bottom: calc(var(--safe-bottom) + 96px); }

/* --- Cartes et lignes ----------------------------------------------------------------- */
.card { background: var(--card); border-radius: 18px; margin: 0 16px 12px; overflow: hidden; }
.card.pad { padding: 16px; }
.cards { display: grid; gap: 10px; margin: 0 16px 12px; }
.row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px 16px; position: relative; min-height: 52px; }
.card > .row + .row::before, .plain > .row + .row::before { content: ""; position: absolute; top: 0; right: 0; left: var(--inset, 16px); border-top: .5px solid var(--sep); }
.row:active { background: var(--fill); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-size: 16px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub.wrap { white-space: normal; }
.row .side { color: var(--muted); font-size: 13px; flex: none; }
.chev { width: 14px; height: 14px; color: var(--muted); opacity: .7; flex: none; display: inline-flex; }
.plain { margin: 0 16px; }
.plain > .row { padding-left: 0; padding-right: 0; }
.plain > .row:active { background: none; opacity: .7; }

.avatar { width: 44px; height: 44px; border-radius: 50%; flex: none; display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 15px; background: #e4e4ea; color: #3a3a3c; overflow: hidden; }
.avatar.dark { background: #1c1c1e; color: #fff; font-size: 12px; }
.avatar.sm { width: 36px; height: 36px; font-size: 13px; }
.avatar.lg { width: 112px; height: 112px; font-size: 40px; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
:root[data-theme="dark"] .avatar:not(.dark) { background: #3a3a3c; color: #f2f2f7; }
.badge-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--blue); flex: none; }

/* --- Barre d'onglets flottante, bouton flottant, interrupteurs ------------------------ */
.float-tabs {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-bottom) + 22px); z-index: 12;
  display: flex; gap: 4px; padding: 4px; border-radius: 30px; width: min(92%, 420px);
  background: var(--glass); box-shadow: 0 8px 28px rgba(17, 24, 39, .14), inset 0 1px 0 var(--glass-line); border: 1px solid var(--glass-line);
  -webkit-backdrop-filter: blur(22px) saturate(160%); backdrop-filter: blur(22px) saturate(160%);
}
.ftab { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 4px 6px; border-radius: 24px;
  font-size: 11px; font-weight: 500; color: var(--text); transition: background .2s, color .2s; white-space: nowrap; }
.ftab svg { width: 22px; height: 22px; }
.ftab.on { background: var(--tab-tint, rgba(10, 132, 255, .12)); color: var(--tab-color, var(--blue)); }
.fab { position: fixed; right: 20px; bottom: calc(var(--safe-bottom) + 30px); z-index: 12; width: 50px; height: 50px; border-radius: 50%;
  background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 18px rgba(10, 132, 255, .4);
  transition: transform .15s; }
.fab svg { width: 24px; height: 24px; }
.fab:active { transform: scale(.9); }
.switch { width: 51px; height: 31px; border-radius: 16px; background: var(--fill); position: relative; flex: none; transition: background .25s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, .25); transition: transform .25s var(--ease); }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(20px); }
.pills { display: flex; gap: 2px; padding: 3px; margin: 0 16px; border-radius: 18px; background: var(--fill); overflow-x: auto; scrollbar-width: none; }
.pill { flex: 1; padding: 6px 12px; border-radius: 15px; font-size: 13px; font-weight: 500; white-space: nowrap; text-align: center; transition: background .2s; }
.pill.on { background: var(--card); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); }
.btn { display: flex; align-items: center; justify-content: center; width: calc(100% - 32px); margin: 0 16px 12px; min-height: 50px; border-radius: 25px;
  font-weight: 600; font-size: 17px; background: var(--blue); color: #fff; box-shadow: 0 6px 18px rgba(10, 132, 255, .3); }
.btn.soft { background: rgba(10, 132, 255, .15); color: var(--blue); box-shadow: none; font-size: 15px; min-height: 44px; }
.btn.danger { background: rgba(255, 59, 48, .12); color: var(--red); box-shadow: none; }

/* --- Panneau qui glisse du bas --------------------------------------------------------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .28); animation: fade-in .2s ease both; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; top: calc(var(--safe-top) + 34px); z-index: 41; background: var(--bg);
  border-radius: 28px 28px 0 0; display: flex; flex-direction: column; animation: rise .38s var(--ease) both; overflow: hidden;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .18); max-width: 640px; margin: 0 auto; }
.sheet.closing { animation: rise .25s ease reverse both; }
.sheet-grab { width: 38px; height: 5px; border-radius: 3px; background: var(--muted); opacity: .5; margin: 8px auto 2px; flex: none; }
.sheet-body { flex: 1; overflow-y: auto; padding-bottom: calc(var(--safe-bottom) + 24px); }
.sheet .hdr { position: relative; background: transparent; padding-top: 4px; }

/* --- Formulaires ------------------------------------------------------------------------ */
.form-card { background: var(--card); border-radius: 18px; margin: 0 16px 14px; padding: 2px 16px; }
.field { display: block; padding: 11px 0; }
.field + .field { border-top: .5px solid var(--sep); }
.field small { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.field input, .field textarea, .field select { width: 100%; border: 0; background: none; outline: none; font-size: 16px; padding: 2px 0; color: var(--text); resize: none; }
.field input::placeholder, .field textarea::placeholder { color: #b8b8c0; }

/* --- Messages ----------------------------------------------------------------------------- */
.thread-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border-radius: 18px; margin: 0 16px 10px; position: relative; }
.thread-card:active { transform: scale(.985); }
.thread-card .name { font-size: 16px; color: var(--text); font-weight: 500; }
.thread-card.unread .name { font-weight: 700; }
.thread-card .prev { font-size: 13px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-card .when { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; flex: none; }
.thread-card .unread-dot { position: absolute; left: 4px; top: 50%; margin-top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--blue); }

.conv-hdr .hdr-title { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 12px; font-weight: 500; top: -4px; transform: translateX(-50%); }
.conv-hdr .hdr-title .avatar { width: 34px; height: 34px; font-size: 12px; }
.bubbles { flex: 1; padding: 8px 12px 12px; display: flex; flex-direction: column; gap: 2px; }
.stamp { text-align: center; color: var(--muted); font-size: 12px; margin: 14px 0 6px; }
.stamp b { font-weight: 600; }
.sender-label { color: var(--muted); font-size: 12px; margin: 8px 12px 2px; }
.bubble { max-width: 76%; padding: 8px 13px 9px; border-radius: 20px; font-size: 16px; line-height: 1.3; white-space: pre-wrap; overflow-wrap: anywhere;
  background: var(--bubble-them); color: var(--text); align-self: flex-start; animation: fade-in .2s ease both; }
.bubble.me { background: var(--blue); color: #fff; align-self: flex-end; }
.bubble.tail { margin-bottom: 6px; }
.bubble.tail.me { border-bottom-right-radius: 6px; }
.bubble.tail:not(.me) { border-bottom-left-radius: 6px; }
.bubble.pending { opacity: .55; }
.bubble.special { font-style: italic; }
.bubble.media { padding: 0; background: none; overflow: hidden; line-height: 0; position: relative; }
.bubble.media img { display: block; max-width: min(240px, 100%); max-height: 320px; border-radius: 18px; background: var(--fill); }
.bubble.media .play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 34px; text-shadow: 0 2px 8px rgba(0,0,0,.6); line-height: 1; }
.delivery { align-self: flex-end; color: var(--muted); font-size: 11px; margin: -2px 4px 6px; }
.composer-wrap { position: sticky; bottom: 0; z-index: 6; padding: 8px 10px calc(var(--safe-bottom) + 8px); background: linear-gradient(transparent, var(--bg) 30%); }
.composer { display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { flex: 1; resize: none; border-radius: 22px; padding: 10px 16px; min-height: 44px; max-height: 140px; outline: none; line-height: 1.3; font-size: 16px;
  background: var(--glass); box-shadow: var(--glass-shadow); border: 1px solid var(--glass-line); }
.composer .glass-btn { flex: none; }
.send-btn { width: 44px; height: 44px; border-radius: 50%; flex: none; background: var(--blue); color: #fff; display: flex; align-items: center; justify-content: center; transition: transform .15s, opacity .15s; }
.send-btn svg { width: 20px; height: 20px; }
.send-btn:disabled { opacity: .35; }
.send-btn:not(:disabled):active { transform: scale(.9); }
.gif-btn { font-size: 12px; font-weight: 800; letter-spacing: .04em; }
.picker { margin: 0 0 8px; padding: 10px; border-radius: 22px; background: var(--glass); box-shadow: var(--glass-shadow); border: 1px solid var(--glass-line); }
.picker .search { margin: 0 0 8px; box-shadow: none; background: var(--fill); }
.picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; height: min(38vh, 300px); overflow-y: auto; border-radius: 12px; overscroll-behavior: contain; }
.picker-grid > .empty-note { grid-column: 1 / -1; }
.picker-item { aspect-ratio: 1; background: var(--fill); border-radius: 10px; overflow: hidden; }
.picker-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.picker-credit { text-align: right; color: var(--muted); font-size: 10px; padding: 6px 2px 0; }
.radio { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid #a9c8f5; flex: none; transition: background .15s; }
.radio.on { background: var(--blue); border-color: var(--blue); box-shadow: inset 0 0 0 4px var(--card); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 16px; background: rgba(10, 132, 255, .12); color: var(--blue); font-size: 14px; margin: 0 6px 6px 0; }

/* --- Téléphone : clavier, appels, fiche contact -------------------------------------------- */
.keypad { display: grid; grid-template-columns: repeat(3, 76px); gap: 16px 26px; justify-content: center; margin: 10px 0 18px; }
.key { width: 76px; height: 76px; border-radius: 50%; background: var(--fill); display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 32px; font-weight: 400; line-height: 1; transition: background .1s; }
.key small { font-size: 10px; font-weight: 600; letter-spacing: .12em; color: var(--muted); margin-top: 2px; min-height: 12px; }
.key:active { background: var(--sep); }
.dial-number { text-align: center; font-size: 36px; font-weight: 400; min-height: 52px; margin-top: 14px; letter-spacing: .02em; overflow-wrap: anywhere; padding: 0 20px; }
.dial-actions { display: flex; justify-content: center; align-items: center; gap: 30px; }
.call-dir { width: 18px; height: 18px; color: var(--muted); flex: none; display: inline-flex; }
.missed .title, .missed .call-dir { color: var(--red); }
.profile-head { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 8px 16px 18px; text-align: center; }
.profile-head .name { font-size: 26px; font-weight: 700; }
.quick-actions { display: flex; gap: 10px; justify-content: center; margin: 0 16px 16px; }
.quick-actions .qa { flex: 1; max-width: 110px; background: var(--card); border-radius: 16px; padding: 10px 6px; display: flex; flex-direction: column; align-items: center;
  gap: 4px; color: var(--blue); font-size: 12px; font-weight: 500; }
.quick-actions .qa svg { width: 22px; height: 22px; }

/* --- Galerie -------------------------------------------------------------------------------- */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; }
.photo-item { position: relative; aspect-ratio: 1; background: var(--fill); overflow: hidden; display: block; }
.photo-item img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.photo-item:active img { transform: scale(.96); }
.photo-item .play { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 26px; text-shadow: 0 2px 8px rgba(0,0,0,.6); }
.date-head { font-size: 17px; font-weight: 600; color: var(--muted); margin: 16px 16px 8px; }
.album-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 0 16px; }
.album img, .album .ph { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 14px; display: block; background: var(--fill); }
.album b { display: block; font-size: 15px; margin-top: 6px; font-weight: 500; }
.album span { font-size: 13px; color: var(--muted); }
.viewer { position: fixed; inset: 0; z-index: 45; background: #000; display: flex; align-items: center; justify-content: center; animation: fade-in .2s ease both; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer .glass-btn { position: absolute; top: calc(var(--safe-top) + 10px); left: 16px; }

/* --- Actualités / Chirpy -------------------------------------------------------------------- */
.news-card { display: block; background: var(--card); border-radius: 18px; overflow: hidden; margin: 0 16px 12px; }
.news-img { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; display: block; background: var(--fill); }
.news-txt { padding: 12px 16px 14px; }
.news-title { font-size: 18px; font-weight: 700; line-height: 1.2; margin: 4px 0; color: var(--text); }
.news-flash { display: inline-block; background: var(--red); color: #fff; font-size: 11px; font-weight: 800; letter-spacing: .06em; padding: 2px 6px; border-radius: 4px; }
.article { padding: 4px 16px 40px; }
.article-title { font-size: 28px; line-height: 1.15; margin: 6px 0; font-weight: 800; }
.article-sub { color: var(--muted); font-size: 17px; margin: 0 0 8px; }
.article-img { width: 100%; border-radius: 16px; margin: 6px 0 16px; display: block; background: var(--fill); }
.article-body { white-space: pre-wrap; font-size: 17px; line-height: 1.55; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 14px; line-height: 1.5; margin: 4px 0 12px; overflow-wrap: anywhere; }
.meta b { color: var(--text); }
.tweet { display: flex; gap: 10px; padding: 14px 16px; background: var(--card); border-radius: 18px; margin: 0 16px 10px; }
.tw-head { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-user { color: var(--muted); }
.tw-text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 3px; font-size: 15px; }
.tw-media { width: 100%; max-height: 320px; object-fit: cover; border-radius: 14px; margin-top: 8px; display: block; background: var(--fill); }
.tw-stats { color: var(--muted); font-size: 13px; margin-top: 8px; display: flex; gap: 16px; }

/* --- Outils : rappels, calendrier, santé, wallet, crypto, horloge, calculatrice, météo ---------- */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 16px 8px; }
.stat { background: var(--card); border-radius: 18px; padding: 14px 16px; min-height: 86px; display: flex; flex-direction: column; justify-content: space-between;
  border: 1.5px solid transparent; text-align: left; transition: border-color .2s; }
.stat.wide { grid-column: 1 / -1; }
.stat.on { border-color: var(--blue); }
.stat small { font-size: 14px; color: var(--muted); }
.stat b { font-size: 20px; font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.todo { display: flex; align-items: flex-start; gap: 12px; }
.todo .check { margin-top: 1px; width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--muted); flex: none; display: flex; align-items: center; justify-content: center; color: #fff; }
.todo .check.on { background: var(--blue); border-color: var(--blue); }
.todo .check svg { width: 14px; height: 14px; }
.todo.done .title { color: var(--muted); text-decoration: line-through; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; margin: 0 16px 10px; font-size: 17px; }
.cal-nav button { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; }
.cal-nav svg { width: 20px; height: 20px; }
.cal-month { font-weight: 700; font-size: 18px; margin: 4px 0 8px 66px; }
.cal-head, .cal-days { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; margin: 0 30px; }
.cal-head span { font-size: 11px; color: var(--muted); font-weight: 600; padding: 6px 0 10px; }
.cal-days button { aspect-ratio: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 16px; border-radius: 50%; margin: 2px; position: relative; }
.cal-days button.out { color: #b8b8c0; }
.cal-days button.today { background: var(--blue); color: #fff; font-weight: 700; }
.cal-days button.sel:not(.today) { background: rgba(10, 132, 255, .14); color: var(--blue); font-weight: 600; }
.cal-days button.has::after { content: ""; position: absolute; bottom: 4px; width: 5px; height: 5px; border-radius: 50%; background: var(--red); }
.cal-days button.today.has::after { background: #fff; }
.event-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.empty-card { background: var(--fill); border-radius: 18px; margin: 14px 16px; padding: 16px; text-align: center; }
.empty-card b { display: block; font-weight: 500; font-size: 15px; margin-bottom: 4px; }
.empty-card span { font-size: 12px; color: var(--muted); }
.wallet-card { margin: 4px 16px 16px; border-radius: 22px; padding: 20px; color: #fff; aspect-ratio: 1.586; display: flex; flex-direction: column;
  background: linear-gradient(135deg, #1f2937, #0f172a 55%, #312e81); box-shadow: 0 14px 30px rgba(15, 23, 42, .35); }
.wallet-card .bank { font-weight: 700; letter-spacing: .04em; }
.wallet-card .amount { margin-top: auto; font-size: 34px; font-weight: 700; }
.wallet-card .holder { font-size: 13px; letter-spacing: .1em; opacity: .85; margin-top: 4px; }
.money-in { color: var(--green); font-weight: 600; }
.money-out { color: var(--text); font-weight: 600; }
.calc { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; background: #000; color: #fff; padding: 0 18px calc(var(--safe-bottom) + 36px); }
.calc-out { text-align: right; font-size: min(22vw, 88px); font-weight: 300; line-height: 1; padding: 0 8px 14px; overflow: hidden; white-space: nowrap; }
.calc-keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.ck { aspect-ratio: 1; border-radius: 50%; background: #333; font-size: min(8vw, 32px); display: flex; align-items: center; justify-content: center; transition: filter .1s; }
.ck:active { filter: brightness(1.5); }
.ck.fn { background: #a5a5a5; color: #000; }
.ck.op { background: #ff9f0a; color: #fff; }
.ck.op.on { background: #fff; color: #ff9f0a; }
.ck.zero { grid-column: span 2; aspect-ratio: auto; border-radius: 999px; justify-content: flex-start; padding-left: 13%; }
.clock-row .time { font-size: 46px; font-weight: 300; line-height: 1; }
.chrono { text-align: center; font-size: 76px; font-weight: 200; font-variant-numeric: tabular-nums; margin: 60px 0 40px; }
.round-btns { display: flex; justify-content: space-between; margin: 0 28px; }
.round { width: 84px; height: 84px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 500;
  background: var(--fill); box-shadow: 0 0 0 3px var(--bg), 0 0 0 5px var(--fill); }
.round.go { background: rgba(48, 209, 88, .2); color: #30d158; }
.round.stop { background: rgba(255, 69, 58, .2); color: #ff453a; }
.weather-view { background: linear-gradient(180deg, #0f2a44, #1b2a3e 40%, #23243a); color: #fff; }
.weather-view .hdr { background: transparent; }
.w-card { margin: 0 16px 14px; padding: 18px 20px; border-radius: 22px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); }
.w-card .caps { margin: 0 0 6px; color: rgba(255, 255, 255, .65); }
.w-temp { font-size: 64px; font-weight: 200; line-height: 1; margin-top: 18px; }
.tips-icon { width: 44px; height: 44px; border-radius: 50%; background: var(--fill); display: flex; align-items: center; justify-content: center; color: #0aa0e6; flex: none; }
.tips-icon svg { width: 20px; height: 20px; }
.slide { background: var(--card); border-radius: 22px; margin: 0 16px 14px; padding: 20px; }
.slide h3 { margin: 10px 0 8px; font-size: 20px; }
.slide p { margin: 0; color: var(--text2); line-height: 1.55; font-size: 15px; }
.settings-icon { width: 30px; height: 30px; border-radius: 8px; display: flex; align-items: center; justify-content: center; color: #fff; flex: none; }
.settings-icon svg { width: 18px; height: 18px; }
.wall-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 16px; }
.wall-grid button { aspect-ratio: 9 / 19; border-radius: 14px; overflow: hidden; border: 3px solid transparent; background: var(--fill); }
.wall-grid button.on { border-color: var(--blue); }
.wall-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* --- Connexion ------------------------------------------------------------------------------ */
.welcome { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: calc(var(--safe-top) + 40px) 24px calc(var(--safe-bottom) + 32px); text-align: center; }
.welcome .logo { width: 108px; height: 108px; border-radius: 24px; box-shadow: 0 10px 30px rgba(0,0,0,.2); margin-bottom: 12px; }
.welcome h1 { font-size: 34px; margin: 0; font-weight: 800; }
.welcome p { color: var(--muted); margin: 0 0 18px; max-width: 320px; }
.login-btn { width: 100%; max-width: 340px; min-height: 52px; border-radius: 26px; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 10px; }
.login-btn svg { width: 22px; height: 22px; }
.login-btn.steam { background: #171a21; color: #fff; }
.login-btn.cfx { background: #f40552; color: #fff; }
.error-box { background: rgba(255, 59, 48, .12); color: var(--red); border-radius: 14px; padding: 10px 14px; font-size: 15px; max-width: 340px; }

#toast { position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 100px); transform: translate(-50%, 20px); background: rgba(30, 30, 30, .92); color: #fff;
  padding: 10px 16px; border-radius: 16px; font-size: 14px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
  max-width: calc(100% - 32px); text-align: center; z-index: 70; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.spinner { width: 24px; height: 24px; border: 2.5px solid var(--fill); border-top-color: var(--muted); border-radius: 50%; animation: spin .8s linear infinite; margin: 40px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.home-indicator { position: fixed; left: 50%; bottom: calc(var(--safe-bottom) + 6px); transform: translateX(-50%); z-index: 30; width: 150px; height: 26px;
  display: flex; align-items: flex-end; justify-content: center; touch-action: none; }
.home-indicator span { width: 134px; height: 5px; border-radius: 3px; background: var(--text); opacity: .9; }
.dark-chrome .home-indicator span, .phone .home-indicator span { background: #fff; }
.view.calc-view { background: #000; }
.view.weather-view .hdr-title, .view.weather-view .small { color: #fff; }
.sheet-grab { padding: 6px 0; background-clip: content-box; height: 17px; }

/* --- Cartes ---------------------------------------------------------------------------- */
.view.map-view { background: #143d55; }
.map-wrap { position: fixed; inset: 0; z-index: 5; background: #143d55; }
.map-host { position: absolute; inset: 0; background: #143d55; }
.map-host.leaflet-container { background: #143d55; font: inherit; }
.map-ctrl { position: absolute; right: 14px; top: calc(var(--safe-top) + 12px); z-index: 500; display: flex; flex-direction: column; border-radius: 16px; overflow: hidden;
  background: var(--glass); box-shadow: var(--glass-shadow); border: 1px solid var(--glass-line); -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.map-btn { width: 46px; height: 46px; display: flex; align-items: center; justify-content: center; color: var(--text); }
.map-btn + .map-btn { border-top: .5px solid var(--sep); }
.map-btn svg { width: 21px; height: 21px; }
.map-btn.off { opacity: .4; }
.map-btn:active { background: var(--fill); }
.map-style-label { position: absolute; top: calc(var(--safe-top) + 14px); left: 50%; transform: translateX(-50%); z-index: 500; padding: 8px 14px; border-radius: 16px;
  background: rgba(0,0,0,.65); color: #fff; font-size: 13px; font-weight: 600; pointer-events: none; animation: fade-in .2s ease backwards; }
.me-dot { border-radius: 50%; background: #0a84ff; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.2), 0 2px 8px rgba(0,0,0,.35); }
.me-dot.live { animation: me-pulse 2s ease-out infinite; }
@keyframes me-pulse { 0% { box-shadow: 0 0 0 0 rgba(10,132,255,.55), 0 2px 8px rgba(0,0,0,.35); } 100% { box-shadow: 0 0 0 16px rgba(10,132,255,0), 0 2px 8px rgba(0,0,0,.35); } }
.map-popup .leaflet-popup-content-wrapper { border-radius: 14px; background: var(--card); color: var(--text); box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.map-popup .leaflet-popup-content { margin: 9px 14px; font-size: 14px; }
.map-popup .leaflet-popup-tip { background: var(--card); }
.blip-icon span { display: block; width: 22px; height: 22px; -webkit-mask: var(--blip) center / contain no-repeat; mask: var(--blip) center / contain no-repeat;
  filter: drop-shadow(0 0 1px rgba(0,0,0,.9)) drop-shadow(0 1px 2px rgba(0,0,0,.5)); }
.zone-label span { display: inline-block; padding: 4px 10px; border-radius: 12px; background: rgba(185,28,28,.85); color: #fff; font-size: 12px; font-weight: 700;
  letter-spacing: .04em; white-space: nowrap; box-shadow: 0 2px 8px rgba(0,0,0,.35); }
