/* ============================================================
   Alerte Météo TN — interface inspirée de l'app Météo iOS
   ============================================================ */
:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI Variable Display", "Segoe UI", Roboto, system-ui, sans-serif;
  --glass: rgba(10, 30, 60, 0.18);
  --glass-line: rgba(255, 255, 255, 0.14);
  --on-sky: #ffffff;
  --on-sky-dim: rgba(255, 255, 255, 0.62);
  --toolbar-h: 64px;

  /* feuilles (style réglages iOS) */
  --sheet-bg: #f2f2f7;
  --group-bg: #ffffff;
  --text: #000000;
  --muted: #6c6c70;
  --sep: rgba(60, 60, 67, 0.18);
  --tint: #007aff;
  --danger: #ff3b30;
  --ok: #34c759;
  --fill: rgba(118, 118, 128, 0.12);
  --switch-off: #e9e9eb;
  --seg-on: #ffffff;
  --callout-bg: #fff4d6;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --sheet-bg: #1c1c1e;
    --group-bg: #2c2c2e;
    --text: #ffffff;
    --muted: #98989f;
    --sep: rgba(84, 84, 88, 0.6);
    --tint: #0a84ff;
    --danger: #ff453a;
    --ok: #30d158;
    --fill: rgba(118, 118, 128, 0.24);
    --switch-off: #39393d;
    --seg-on: #636366;
    --callout-bg: #3a3017;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 16px/1.35 var(--font);
  background: #2f80d1;
  color: var(--on-sky);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; }
svg { fill: currentColor; }

/* ---------------- ciels ---------------- */
.sky-clear-day    { background: linear-gradient(180deg, #2a78cc 0%, #4f9be3 50%, #86c0ef 100%); --theme: #2a78cc; }
.sky-clear-night  { background: linear-gradient(180deg, #070d24 0%, #15224a 55%, #2a3a6b 100%); --theme: #070d24; }
.sky-partly-day   { background: linear-gradient(180deg, #3c73b0 0%, #6896c6 55%, #9ab9da 100%); --theme: #3c73b0; }
.sky-partly-night { background: linear-gradient(180deg, #0f1730 0%, #232f50 55%, #3a4766 100%); --theme: #0f1730; }
.sky-cloudy-day   { background: linear-gradient(180deg, #56697f 0%, #7a8ca0 55%, #a3b1c0 100%); --theme: #56697f; }
.sky-cloudy-night { background: linear-gradient(180deg, #1a212c 0%, #2c3542 55%, #434d5b 100%); --theme: #1a212c; }
.sky-rain         { background: linear-gradient(180deg, #333f4d 0%, #4d5b6a 55%, #6c7987 100%); --theme: #333f4d; }
.sky-storm        { background: linear-gradient(180deg, #1b1c29 0%, #33354a 55%, #4c4f69 100%); --theme: #1b1c29; }
.sky-fog          { background: linear-gradient(180deg, #6f7984 0%, #8e979f 55%, #b3b9bf 100%); --theme: #6f7984; }

/* ---------------- pager horizontal ---------------- */
.pager {
  display: flex;
  height: 100dvh;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.pager::-webkit-scrollbar { display: none; }
.page {
  position: relative;
  flex: 0 0 100%;
  height: 100dvh;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  scrollbar-width: none;
}
.page::-webkit-scrollbar { display: none; }
.content {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 40px) 16px calc(var(--toolbar-h) + env(safe-area-inset-bottom) + 24px);
  display: grid;
  gap: 10px;
}
.content > * { min-width: 0; }

/* ---------------- effets d'ambiance ---------------- */
.fx {
  position: sticky; top: 0; z-index: 0;
  height: 100dvh; margin-bottom: -100dvh;
  pointer-events: none; overflow: hidden;
}
.fx::before, .fx::after { content: ""; position: absolute; inset: 0; }
/* étoiles */
.sky-clear-night .fx::before, .sky-partly-night .fx::before {
  background-image:
    radial-gradient(1.2px 1.2px at 12% 18%, #fff 50%, transparent),
    radial-gradient(1px 1px at 32% 8%, #fff 50%, transparent),
    radial-gradient(1.4px 1.4px at 58% 22%, #fff 50%, transparent),
    radial-gradient(1px 1px at 78% 12%, #fff 50%, transparent),
    radial-gradient(1.2px 1.2px at 88% 32%, #fff 50%, transparent),
    radial-gradient(1px 1px at 22% 38%, #fff 50%, transparent),
    radial-gradient(1px 1px at 44% 44%, #fff 50%, transparent),
    radial-gradient(1.3px 1.3px at 66% 52%, #fff 50%, transparent),
    radial-gradient(1px 1px at 8% 58%, #fff 50%, transparent),
    radial-gradient(1px 1px at 92% 62%, #fff 50%, transparent);
  opacity: .7;
  animation: twinkle 6s ease-in-out infinite alternate;
}
.sky-clear-night .fx::after {
  background-image:
    radial-gradient(1px 1px at 18% 28%, #fff 50%, transparent),
    radial-gradient(1px 1px at 48% 14%, #fff 50%, transparent),
    radial-gradient(1.2px 1.2px at 70% 36%, #fff 50%, transparent),
    radial-gradient(1px 1px at 36% 60%, #fff 50%, transparent),
    radial-gradient(1px 1px at 82% 48%, #fff 50%, transparent);
  opacity: .4;
  animation: twinkle 4s ease-in-out infinite alternate-reverse;
}
@keyframes twinkle { from { opacity: .25; } to { opacity: .85; } }
/* soleil */
.sky-clear-day .fx::before, .sky-partly-day .fx::before {
  background: radial-gradient(circle at 85% 4%, rgba(255, 244, 200, .55) 0, rgba(255, 220, 120, .18) 18%, transparent 42%);
  animation: glow 8s ease-in-out infinite alternate;
}
@keyframes glow { to { transform: scale(1.06); opacity: .85; } }
/* nuages qui dérivent */
.sky-partly-day .fx::after, .sky-partly-night .fx::after,
.sky-cloudy-day .fx::after, .sky-cloudy-night .fx::after, .sky-fog .fx::after {
  inset: 0 -50% 0 -50%;
  background:
    radial-gradient(ellipse 22% 7% at 30% 14%, rgba(255,255,255,.22), transparent 70%),
    radial-gradient(ellipse 28% 8% at 62% 26%, rgba(255,255,255,.16), transparent 70%),
    radial-gradient(ellipse 20% 6% at 80% 9%, rgba(255,255,255,.18), transparent 70%),
    radial-gradient(ellipse 26% 9% at 14% 34%, rgba(255,255,255,.12), transparent 70%);
  animation: drift 60s linear infinite alternate;
}
.sky-fog .fx::after { filter: blur(12px); opacity: 1; }
@keyframes drift { from { transform: translateX(-12%); } to { transform: translateX(12%); } }
/* pluie */
.sky-rain .fx::before, .sky-storm .fx::before {
  inset: -100px 0 0;
  background-image:
    linear-gradient(100deg, transparent 0 49.6%, rgba(255,255,255,.28) 49.8% 50.2%, transparent 50.4%),
    linear-gradient(100deg, transparent 0 49.6%, rgba(255,255,255,.18) 49.8% 50.2%, transparent 50.4%);
  background-size: 23px 90px, 37px 130px;
  animation: rain .55s linear infinite;
}
@keyframes rain { to { background-position: -16px 90px, -23px 130px; } }
/* éclairs */
.sky-storm .fx::after { background: rgba(220, 230, 255, .5); opacity: 0; animation: flash 9s infinite; }
@keyframes flash { 0%, 91%, 94%, 100% { opacity: 0; } 92%, 95.5% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) {
  .fx::before, .fx::after { animation: none !important; }
}

/* ---------------- en-tête ville ---------------- */
.hero { text-align: center; padding: 8px 0 22px; text-shadow: 0 1px 8px rgba(0,0,0,.12); }
.hero .loc { font-size: .8rem; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--on-sky-dim); margin: 0 0 2px; }
.hero h1 { font-size: 2.1rem; font-weight: 400; margin: 0; letter-spacing: .01em; }
.hero .big { font-size: 6rem; font-weight: 200; line-height: 1; margin: 2px 0 2px 0.3em; letter-spacing: -.02em; }
.hero .cond { font-size: 1.25rem; font-weight: 500; margin: 0; color: rgba(255,255,255,.9); }
.hero .hl { font-size: 1.15rem; font-weight: 500; margin: 2px 0 0; }

/* ---------------- cartes « verre » ---------------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: 16px;
  padding: 12px 14px;
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  backdrop-filter: blur(24px) saturate(140%);
}
.glass-title {
  display: flex; align-items: center; gap: 6px;
  font-size: .78rem; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  color: var(--on-sky-dim); margin: 0 0 8px;
}
.glass-title svg { width: 14px; height: 14px; }
.summary { margin: 0 0 10px; padding-bottom: 10px; border-bottom: 1px solid var(--glass-line); font-size: .95rem; }

/* BMS + appel à l'action */
.glass.bms { background: rgba(255, 140, 30, .28); border-color: rgba(255, 190, 120, .45); }
.glass.bms h3 { margin: 0 0 4px; font-size: 1.05rem; }
.glass.bms p { margin: 3px 0; font-size: .92rem; }
.glass.bms a { color: #fff; font-weight: 600; }
.glass.cta { display: flex; gap: 12px; align-items: center; }
.glass.cta p { margin: 0; flex: 1; font-size: .92rem; }
.glass.cta button {
  border: 0; border-radius: 999px; padding: 9px 14px; font-weight: 600; cursor: pointer;
  background: #fff; color: #0b3b7a; white-space: nowrap;
}
body.subscribed .cta { display: none; }

/* heures */
.hours { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; margin: 0 -6px; padding: 0 2px; }
.hours::-webkit-scrollbar { display: none; }
.hour { flex: 0 0 52px; display: grid; justify-items: center; gap: 8px; padding: 2px 0; font-size: .95rem; font-weight: 500; }
.hour .t { font-size: .85rem; }
.hour .i { font-size: 1.45rem; line-height: 1; height: 1.6rem; display: grid; align-content: center; justify-items: center; }
.hour .p { font-size: .68rem; font-weight: 700; color: #8fd0ff; margin-top: -4px; }
.hour.sun .t { font-size: .78rem; }

/* 7 jours */
.days { list-style: none; margin: 0; padding: 0; }
.days li {
  display: grid; grid-template-columns: 3.4em 2.2em 2.4em 1fr 2.4em;
  align-items: center; gap: 8px; padding: 9px 0; border-top: 1px solid var(--glass-line);
  font-size: 1.05rem; font-weight: 500;
}
.days li:first-child { border-top: 0; }
.days .i { text-align: center; font-size: 1.35rem; line-height: 1; display: grid; justify-items: center; }
.days .i small { font-size: .62rem; font-weight: 700; color: #8fd0ff; margin-top: 2px; }
.days .min { color: var(--on-sky-dim); text-align: right; }
.days .max { text-align: right; }
.bar { position: relative; height: 5px; border-radius: 3px; background: rgba(0,0,0,.18); }
.bar .fill { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.bar .now { position: absolute; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.25); }

/* tuiles */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tile { min-height: 150px; display: flex; flex-direction: column; }
.tile .v { font-size: 2rem; font-weight: 500; line-height: 1.1; }
.tile .s { font-size: 1.05rem; font-weight: 600; }
.tile .d { font-size: .85rem; margin-top: auto; padding-top: 8px; }
.uvbar { position: relative; height: 5px; border-radius: 3px; margin: 10px 0 0;
  background: linear-gradient(90deg, #3ec46d, #f7d23b 30%, #f6923a 55%, #e8453c 78%, #a35bd1); }
.uvbar .now { position: absolute; top: 50%; width: 7px; height: 7px; margin: -3.5px 0 0 -3.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px rgba(0,0,0,.3); }
.compass { width: 108px; height: 108px; margin: 0 auto; display: block; }
.compass text { fill: var(--on-sky-dim); font: 600 11px var(--font); text-anchor: middle; }
.compass .speed { fill: #fff; font-size: 20px; font-weight: 600; }
.compass .unit { fill: #fff; font-size: 10px; }
.sunarc { width: 100%; height: 54px; margin-top: 6px; }

.credits { text-align: center; font-size: .75rem; color: var(--on-sky-dim); margin: 10px 0 0; }
.credits a { color: inherit; }

/* squelette */
.skel { height: 120px; border-radius: 16px; background: linear-gradient(90deg, rgba(255,255,255,.08), rgba(255,255,255,.16), rgba(255,255,255,.08)); background-size: 200% 100%; animation: sk 1.3s infinite; }
@keyframes sk { to { background-position: -200% 0; } }

/* ---------------- barre d'outils ---------------- */
.toolbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  height: calc(var(--toolbar-h) + env(safe-area-inset-bottom));
  padding: 0 12px env(safe-area-inset-bottom);
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(10, 20, 40, .18);
  border-top: 1px solid rgba(255, 255, 255, .12);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  backdrop-filter: blur(24px) saturate(150%);
}
.tool { position: relative; width: 44px; height: 44px; display: grid; place-items: center; border: 0; background: none; cursor: pointer; border-radius: 12px; }
.tool svg { width: 26px; height: 26px; }
.tool-dot { position: absolute; top: 8px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: #ff9f0a; box-shadow: 0 0 0 2px rgba(0,0,0,.2); }
.dots { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; max-width: 60%; }
.dots button { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 50%; background: rgba(255,255,255,.4); cursor: pointer; }
.dots button[aria-selected="true"] { background: #fff; }
.dots button::after { content: ""; display: block; width: 24px; height: 24px; margin: -8px; } /* zone tactile */

:focus-visible { outline: 2px solid #ffd60a; outline-offset: 2px; }

/* ---------------- feuilles (dialog) ---------------- */
.sheet {
  width: 100%; max-width: 560px; max-height: 94dvh; height: 94dvh;
  margin: auto auto 0; padding: 0; border: 0; border-radius: 14px 14px 0 0;
  background: var(--sheet-bg); color: var(--text);
  display: none; flex-direction: column;
}
.sheet[open] { display: flex; animation: up .32s cubic-bezier(.2, .9, .3, 1); }
.sheet::backdrop { background: rgba(0, 0, 0, .35); }
@keyframes up { from { transform: translateY(100%); } }
@media (min-width: 700px) {
  .sheet { margin: auto; height: 86dvh; border-radius: 16px; }
}
.sheet-head {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 14px 16px 8px; border-bottom: 1px solid transparent;
}
.sheet-head h2 { margin: 0; font-size: 1.05rem; font-weight: 600; }
.sheet-head > :first-child { justify-self: start; }
.sheet-head > :last-child { justify-self: end; }
.link { border: 0; background: none; color: var(--tint); font-size: 1.05rem; cursor: pointer; padding: 6px 0; }
.link.strong { font-weight: 600; }
.sheet-body { overflow-y: auto; padding: 8px 16px calc(24px + env(safe-area-inset-bottom)); flex: 1; }

.search { display: flex; align-items: center; gap: 6px; background: var(--fill); border-radius: 10px; padding: 0 10px; height: 38px; color: var(--muted); }
.search svg { width: 18px; height: 18px; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: none; font: inherit; color: var(--text); height: 100%; outline: none; }

.group { list-style: none; margin: 10px 0; padding: 0; background: var(--group-bg); border-radius: 12px; overflow: hidden; }
.group-title { margin: 22px 16px 6px; font-size: .8rem; font-weight: 400; text-transform: uppercase; color: var(--muted); letter-spacing: .02em; }
.group-btn { display: block; width: 100%; margin: 10px 0; padding: 12px 16px; border: 0; border-radius: 12px; background: var(--group-bg); color: var(--tint); text-align: left; cursor: pointer; }
.results li button {
  display: flex; justify-content: space-between; width: 100%; padding: 12px 16px;
  border: 0; border-top: 1px solid var(--sep); background: none; color: var(--text); text-align: left; cursor: pointer;
}
.results li:first-child button { border-top: 0; }
.results li span { color: var(--muted); }
.results li.empty { padding: 12px 16px; color: var(--muted); }
.note { color: var(--muted); font-size: .82rem; margin: 6px 16px; }
.note.error { color: var(--danger); }

/* cartes villes */
.city-cards { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 10px; }
.city-card { display: flex; align-items: stretch; gap: 8px; }
.city-card .card {
  position: relative; flex: 1; min-width: 0; display: grid; grid-template-columns: 1fr auto; gap: 2px 8px;
  padding: 12px 14px; border: 0; border-radius: 16px; color: #fff; text-align: left; cursor: pointer; overflow: hidden;
  text-shadow: 0 1px 4px rgba(0,0,0,.15);
}
.city-card .name { font-size: 1.35rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.city-card .gov { font-size: .82rem; font-weight: 500; opacity: .85; }
.city-card .temp { grid-row: 1 / 3; grid-column: 2; font-size: 2.6rem; font-weight: 300; line-height: 1; align-self: start; }
.city-card .desc { font-size: .85rem; font-weight: 500; margin-top: 16px; }
.city-card .hl { font-size: .85rem; font-weight: 500; margin-top: 16px; text-align: right; }
.city-card .flag { position: absolute; right: 12px; bottom: 34px; font-size: .9rem; }
.city-card .edit { display: none; flex-direction: column; gap: 6px; justify-content: center; }
.editing .city-card .edit { display: flex; }
.edit button { width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer; font-size: 1rem; background: var(--group-bg); color: var(--text); }
.edit button.del { background: var(--danger); color: #fff; }
.edit button:disabled { opacity: .3; cursor: default; }

/* installation + notifications */
.install { display: flex; align-items: center; gap: 12px; padding: 10px 14px; }
.install img { border-radius: 10px; }
.install div { flex: 1; display: grid; }
.install span, .notif-status span { color: var(--muted); font-size: .85rem; }
.pill { border: 0; border-radius: 999px; padding: 6px 14px; background: var(--tint); color: #fff; font-weight: 600; cursor: pointer; }
/* encadré d'information : fond teinté, JAMAIS de barre de couleur sur le côté (préférence de l'utilisateur) */
.callout { background: var(--callout-bg); border-radius: 12px; padding: 12px 14px; margin: 10px 0; font-size: .9rem; }
.callout svg.inline { width: 16px; height: 16px; vertical-align: -3px; color: var(--tint); }
.notif-status { display: flex; gap: 12px; align-items: center; padding: 14px 16px; }
.notif-status div { display: grid; }
.status-ico { font-size: 1.6rem; }
.btn-tint { display: block; width: calc(100% - 32px); margin: 0 16px 14px; min-height: 48px; border: 0; border-radius: 12px; background: var(--tint); color: #fff; font-weight: 600; font-size: 1.02rem; cursor: pointer; }
.btn-tint:disabled { opacity: .45; cursor: default; }
.row-btns { display: flex; border-top: 1px solid var(--sep); }
.btn-plain { flex: 1; padding: 13px; border: 0; background: none; color: var(--tint); cursor: pointer; }
.btn-plain + .btn-plain { border-left: 1px solid var(--sep); }
.btn-plain.danger { color: var(--danger); }

/* contrôle segmenté iOS */
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 2px; border-radius: 9px; background: var(--fill); }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented span { display: block; text-align: center; padding: 7px 4px; border-radius: 7px; font-size: .9rem; font-weight: 500; }
.segmented input:checked + span { background: var(--seg-on); box-shadow: 0 3px 8px rgba(0,0,0,.12), 0 0 1px rgba(0,0,0,.2); font-weight: 600; }
.segmented input:focus-visible + span { outline: 2px solid var(--tint); }

/* liste d'alertes avec interrupteurs */
.alert-list li { padding: 0 16px; }
.alert-list li + li .alert-row { border-top: 1px solid var(--sep); }
.alert-row { display: flex; align-items: center; gap: 12px; min-height: 52px; cursor: pointer; }
.alert-row .ico { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; font-size: 1.05rem; background: var(--fill); }
.alert-row .name { flex: 1; }
.alert-row .th { color: var(--muted); font-size: .9rem; }
.switch { appearance: none; -webkit-appearance: none; position: relative; width: 51px; height: 31px; margin: 0; border-radius: 999px; background: var(--switch-off); cursor: pointer; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 3px 8px rgba(0,0,0,.15); transition: transform .2s; }
.switch:checked { background: var(--ok); }
.switch:checked::after { transform: translateX(20px); }
.all-mode .switch { opacity: .45; pointer-events: none; }
.alert-list input[type="range"] { width: 100%; margin: 0 0 14px; accent-color: var(--tint); }
.alert-list li.off input[type="range"] { display: none; }

.toast {
  position: fixed; left: 50%; z-index: 100; transform: translateX(-50%);
  bottom: calc(var(--toolbar-h) + env(safe-area-inset-bottom) + 14px);
  background: rgba(30, 30, 32, .92); color: #fff; padding: 10px 16px; border-radius: 12px;
  font-size: .92rem; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0,0,0,.3);
}

/* ---------------- bouton « Alertes » de l'en-tête ---------------- */
.hero { position: relative; }
/* Pilule en verre, collée au bord droit de l'écran, au niveau de « conditions / max. min. » */
.hero-alert {
  position: absolute; bottom: 15px; /* centré sur la ligne « max. min. » */
  /* sort de la colonne centrale pour se placer à 16 px du bord droit de la fenêtre */
  right: calc((min(560px, 100vw) - 100vw) / 2);
  display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px 0 12px;
  border: 1px solid rgba(255, 255, 255, .22); border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, .14); color: #fff; font-size: .9rem; font-weight: 600; text-shadow: none;
  -webkit-backdrop-filter: blur(20px) saturate(140%); backdrop-filter: blur(20px) saturate(140%);
  transition: background .2s;
}
.hero-alert:hover { background: rgba(255, 255, 255, .22); }
.hero-alert:active { transform: scale(.96); }
.hero-alert svg { width: 18px; height: 18px; }
.hero-alert::after { /* pastille : notifications pas encore activées */
  content: ""; position: absolute; top: 5px; left: 24px; width: 8px; height: 8px; border-radius: 50%;
  background: #ff9f0a; box-shadow: 0 0 0 2px rgba(0, 0, 0, .25);
}
body.subscribed .hero-alert::after { display: none; }
.hero-alert.warn::after { display: block; background: #ff453a; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.4); } }
/* Téléphones : même emplacement, cloche seule (ronde) pour ne pas chevaucher « max. min. » */
@media (max-width: 480px) {
  .hero-alert { width: 38px; padding: 0; justify-content: center; }
  .hero-alert .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .hero-alert::after { left: auto; right: 7px; }
}
.credits.contact { margin-top: 2px; }

/* ---------------- guide d'installation ---------------- */
.steps { list-style: none; margin: 10px 0; padding: 0; background: var(--group-bg); border-radius: 12px; overflow: hidden; counter-reset: step; }
.steps li { display: grid; grid-template-columns: 32px 1fr; gap: 12px; padding: 14px 16px; border-top: 1px solid var(--sep); counter-increment: step; }
.steps li:first-child { border-top: 0; }
.steps li::before {
  content: counter(step); width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--tint); color: #fff; font-weight: 700; font-size: .9rem;
}
.steps li > div > b:first-child { display: block; margin-bottom: 2px; }
.steps li > div > span { display: block; color: var(--muted); font-size: .9rem; }
.steps li > div > span b { color: var(--text); font-weight: 600; }
.ios-key {
  display: inline-flex !important; align-items: center; gap: 4px; padding: 3px 9px; margin: 4px 0 6px;
  border-radius: 8px; background: var(--fill); color: var(--text) !important; font-size: .85rem !important; font-weight: 600; white-space: nowrap;
}
.ios-key svg { width: 16px; height: 16px; color: var(--tint); }
.guide-tabs { margin: 4px 0 6px; grid-template-columns: repeat(3, 1fr); }
.guide-panel[hidden] { display: none; }
.callout .pill { margin-top: 10px; }

/* icône lever / coucher du soleil */
.sunico { width: 26px; height: 26px; display: block; }
.glass-title .sunico { width: 16px; height: 16px; }

/* ---------------- nouveautés : partage, heures calmes, historique, langue ---------------- */
.bms-source { opacity: .8; font-size: .82rem; }
.share-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 7px 14px;
  border: 1px solid rgba(255, 255, 255, .35); border-radius: 999px; cursor: pointer;
  background: rgba(255, 255, 255, .16); color: #fff; font-weight: 600; font-size: .88rem;
}
.share-btn svg { width: 16px; height: 16px; }
.share-btn:hover { background: rgba(255, 255, 255, .26); }

.alert-row .name small { display: block; color: var(--muted); font-size: .8rem; }
.tile .v small { font-size: .9rem; font-weight: 600; opacity: .8; }

.lang-switch { margin: 4px 0 6px; }
.quiet .alert-row { padding: 0 16px; }
.quiet-times { display: flex; gap: 16px; flex-wrap: wrap; padding: 0 16px 14px 58px; }
.quiet-times.off { opacity: .4; pointer-events: none; }
.quiet-times label { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.quiet-times input {
  font: inherit; color: var(--text); background: var(--fill); border: 0; border-radius: 8px; padding: 6px 10px;
}

.history li + li button { border-top: 1px solid var(--sep); }
.history button {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: start; width: 100%;
  padding: 11px 16px; border: 0; background: none; color: var(--text); text-align: start; cursor: pointer; font: inherit;
}
.history .h-ico { font-size: 1.05rem; line-height: 1.3; }
.history .h-txt { min-width: 0; display: grid; }
.history .h-txt b { font-size: .92rem; font-weight: 600; }
.history .h-txt small { color: var(--muted); font-size: .82rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history .h-time { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.history .empty { padding: 12px 16px; color: var(--muted); font-size: .9rem; }

/* ---------------- arabe : écriture de droite à gauche ---------------- */
html[dir="rtl"] body { font-family: -apple-system, "SF Arabic", "Segoe UI", "Noto Sans Arabic", Tahoma, system-ui, sans-serif; }
html[dir="rtl"] .pager { direction: ltr; } /* les pages défilent toujours de la même façon ; leur contenu est en RTL */
html[dir="rtl"] .page { direction: rtl; }
/* le bouton « Alertes » reste à droite, y compris en arabe ; la pastille suit l'icône (à droite en RTL) */
html[dir="rtl"] .hero-alert::after { left: auto; right: 24px; }
html[dir="rtl"] .bar, html[dir="rtl"] .uvbar { transform: scaleX(-1); } /* min à droite, max à gauche */
html[dir="rtl"] .quiet-times { padding: 0 58px 14px 16px; }
html[dir="rtl"] .switch:checked::after { transform: translateX(-20px); }
html[dir="rtl"] .switch::after { left: auto; right: 2px; }
html[dir="rtl"] .city-card .flag { right: auto; left: 12px; }
@media (max-width: 480px) {
  html[dir="rtl"] .hero-alert::after { right: 7px; }
}

/* ---------------- carte « Alerte officielle » ----------------
   Couleur OPAQUE (pas de transparence : un orange transparent sur le ciel bleu nuit donne du marron).
   Ambre uni, sans dégradé ni effet, texte foncé pour la lisibilité. */
.alert-card {
  --ac-ink: #2b1a00;          /* texte principal */
  --ac-ink-2: #5c3a00;        /* texte secondaire */
  --ac-line: rgba(43, 26, 0, .18);
  display: grid; gap: 12px; padding: 14px 16px 12px;
  border-radius: 16px; color: var(--ac-ink);
  background: rgba(255, 236, 170, .92); /* jaune pâle, légèrement transparent (plus transparent, il vire au gris kaki sur le ciel de nuit) */
  -webkit-backdrop-filter: blur(24px); backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 214, 120, .9);
  text-shadow: none;
}
.ac-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ac-badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: .8rem; font-weight: 800; letter-spacing: .03em; text-transform: uppercase; color: var(--ac-ink);
}
.ac-warn { font-size: 1.25rem; line-height: 1; }
.ac-status { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 700; color: var(--ac-ink); }
.ac-status .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ac-ink); }

.ac-title { display: flex; gap: 12px; align-items: center; }
.ac-icon { flex: none; display: grid; place-items: center; font-size: 2.2rem; line-height: 1; }
.ac-title h3 { margin: 0; font-size: 1.45rem; font-weight: 800; line-height: 1.15; }
.ac-hint { margin: 2px 0 0; font-size: .92rem; font-weight: 600; color: var(--ac-ink); }
.ac-rel { margin: 3px 0 0; font-size: .9rem; font-weight: 600; color: var(--ac-ink-2); }

.ac-facts { margin: 0; display: grid; border-top: 1px solid var(--ac-line); }
.ac-facts div { display: grid; grid-template-columns: 28px 1fr; gap: 8px; align-items: start; padding: 9px 0; border-bottom: 1px solid var(--ac-line); }
.ac-facts dt { font-size: 1rem; text-align: center; line-height: 1.35; }
.ac-facts dt svg { width: 18px; height: 18px; margin-top: 1px; fill: var(--ac-ink); }
.ac-facts dd { margin: 0; font-size: .95rem; line-height: 1.35; font-weight: 500; }

.ac-time { display: grid; gap: 6px; }
.ac-track { position: relative; height: 5px; border-radius: 3px; background: rgba(43, 26, 0, .18); }
.ac-fill { position: absolute; inset-block: 0; inset-inline-start: 0; border-radius: 3px; background: var(--ac-ink); }
.ac-now { position: absolute; top: 50%; width: 13px; height: 13px; margin-top: -6.5px; margin-inline-start: -6.5px; border-radius: 50%; background: #fff; box-shadow: 0 0 0 2px var(--ac-ink); }
.ac-ends { display: flex; justify-content: space-between; gap: 12px; font-size: .84rem; font-weight: 700; }
.ac-ends span { display: grid; }
.ac-ends span:last-child { text-align: end; }
.ac-ends small { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--ac-ink-2); }

.ac-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 2px; }
.ac-link { color: var(--ac-ink); font-size: .86rem; font-weight: 700; text-decoration: none; }
.ac-link:hover { text-decoration: underline; }
.alert-card .share-btn { margin-top: 0; background: var(--ac-ink); color: #fff; border-color: transparent; }
.alert-card .share-btn:hover { background: #4a2e00; }
.ac-source { margin: -4px 0 0; font-size: .74rem; color: var(--ac-ink-2); }

/* carte repliable : résumé visible, détails au clic */
.alert-card { display: block; }
.ac-details > summary { list-style: none; cursor: pointer; display: grid; gap: 12px; }
.ac-details > summary::-webkit-details-marker { display: none; }
.ac-details > summary:focus-visible { outline: 2px solid var(--ac-ink); outline-offset: 4px; border-radius: 8px; }
.ac-body { display: grid; gap: 12px; margin-top: 12px; }
.ac-details:not([open]) > .ac-body { display: none; }
.ac-toggle { display: inline-flex; align-items: center; gap: 4px; justify-self: right; /* toujours à droite, sous le pouce (y compris en arabe) */ font-size: .84rem; font-weight: 700; color: var(--ac-ink-2); }
.ac-toggle svg { width: 16px; height: 16px; flex: none; transition: transform .2s; }
.ac-toggle .less, .ac-details[open] .ac-toggle .more { display: none; }
.ac-details[open] .ac-toggle .less { display: inline; }
.ac-details[open] .ac-toggle svg { transform: rotate(180deg); }

.ac-svg { width: 40px; height: 40px; color: var(--ac-ink); display: block; }

/* date du jour sous la température */
.hero .date { margin: -2px 0 6px; font-size: .9rem; font-weight: 500; color: var(--on-sky-dim); }

/* à l'ouverture d'un panneau, le focus va sur le titre (pas de cadre de focus sur « OK » ou « Modifier ») */
.sheet-head h2:focus { outline: none; }

/* bouton de validation des panneaux, comme sur iPhone : rond bleu avec une coche */
.done-btn {
  width: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center; background: var(--tint); color: #fff;
}
.done-btn svg { width: 20px; height: 20px; }
.done-btn:active { transform: scale(.94); }

/* choix de la langue, en haut à gauche de l'écran d'accueil (y compris en arabe) */
.lang-pill {
  position: absolute; top: -30px; z-index: 2;
  left: calc((min(560px, 100vw) - 100vw) / 2);
  display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px;
  background: rgba(255, 255, 255, .14); border: 1px solid rgba(255, 255, 255, .22);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  direction: ltr;
}
.lang-pill button {
  min-width: 40px; height: 28px; padding: 0 10px; border: 0; border-radius: 999px; cursor: pointer;
  background: none; color: rgba(255, 255, 255, .85); font: 700 .8rem var(--font); letter-spacing: .03em; text-shadow: none;
}
.lang-pill button[aria-pressed="true"] { background: #fff; color: #15224a; }
html[dir="rtl"] .lang-pill { left: calc((min(560px, 100vw) - 100vw) / 2); right: auto; }
