/* Style « Pokémon GO » : ciel bleu clair, cartes blanches translucides */
:root {
  --bg: #9fe3ec;
  --card: rgba(255,255,255,.45);
  --card-caught: rgba(255,255,255,.88);
  --deep: #ffffff;
  --line: #c6ebf1;
  --soft: #e3f6f9;
  --accent: #1b8fb0;
  --accent2: #1b8fb0;
  --warn: #d64545;
  --gold: #f0b429;
  --text: #1f5f7a;
  --strong: #1b7a9b;
  --muted: #5c9bb0;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* En-tête compact */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(180deg, var(--deep), #16213e);
  padding: 14px 20px 0;
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
}
/* Bascule Normal / Shiny */
.mode {
  margin-left: auto; flex: none;
  display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
}
.mode button {
  background: none; border: 0; padding: 5px 8px; white-space: nowrap;
  color: var(--muted); font: inherit; font-size: .85rem; cursor: pointer;
}
.mode button.on { background: var(--line); color: var(--text); }
.mode button.on.gold { color: #f7d84a; }
.globe {
  flex: none; background: none; border: 0; padding: 2px 4px;
  color: var(--text); cursor: pointer; display: flex; align-items: center;
}
.globe svg { width: 20px; height: 20px; }
.more { flex: none; margin-left: 0; }
@media (max-width: 400px) {
  .top { gap: 4px; }
  h1 { font-size: 1.05rem; }
  .mode button { padding: 4px 4px; font-size: .76rem; }
  .globe { padding: 2px; }
}
#nowBtn { margin-left: auto; position: relative; }
/* Point : un Pokémon qui te manque est disponible, et tu ne l'as pas encore vu dans la feuille */
#nowDot { position: absolute; top: 0; right: 1px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); border: 1.5px solid var(--deep); }
.now-row.missing img { filter: grayscale(1) opacity(.45); }
.now-row.missing span { color: var(--muted); }
.now-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); flex: none; }
.now-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 2px; content-visibility: auto; contain-intrinsic-size: auto 60px; }
.now-cell { position: relative; cursor: pointer; }
.now-cell img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; }
.now-cell.missing img { filter: grayscale(1) opacity(.45); }
.now-cell b { display: block; text-align: center; font-size: .68rem; color: #b7791f; white-space: nowrap; }
.now-cell .now-dot { position: absolute; top: 2px; right: 2px; }
#langMenu { min-width: 160px; }
#acctMenu { min-width: 200px; }
#acctMenu button { display: flex; }
#acctMenu [hidden] { display: none; }
/* Installer sur iPhone : la fenêtre descend près de la barre de Safari, une flèche montre où toucher */
#installDialog { margin-bottom: 84px; }
#installDialog .steps { list-style: none; margin: 0 0 6px; padding: 0; counter-reset: st; }
#installDialog .steps li {
  display: flex; align-items: center; gap: 10px; padding: 10px 0; font-size: .95rem;
  border-top: 1px solid var(--soft); counter-increment: st;
}
#installDialog .steps li:first-child { border-top: 0; }
#installDialog .steps li::before {
  content: counter(st); width: 22px; height: 22px; border-radius: 50%; flex: none;
  display: grid; place-items: center; background: var(--soft); color: var(--strong); font-weight: 700; font-size: .8rem;
}
#installDialog .steps svg { width: 20px; height: 20px; color: var(--accent); flex: none; }
.install-arrow {
  position: fixed; bottom: 6px; left: 50%; transform: translateX(-50%);
  color: #fff; font-size: 2rem; line-height: 1; text-shadow: 0 2px 6px rgba(0,0,0,.35);
  animation: install-bob 1s ease-in-out infinite;
}
.install-arrow.right { left: auto; right: 14px; transform: none; animation-name: install-bob-r; }
.install-arrow[hidden] { display: none; }
@keyframes install-bob { 50% { transform: translate(-50%, 8px); } }
@keyframes install-bob-r { 50% { transform: translateY(8px); } }
#acctMenu b { margin-left: auto; padding-left: 12px; font-weight: 400; color: var(--muted); }
#acct .av {
  display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); color: #fff; font-weight: 700; font-size: .78rem;
}
#acctMenu .who {
  padding: 8px 12px 6px; font-size: .85rem; color: var(--muted);
  max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
#loginDialog form + form { margin-top: 8px; }
#loginDialog .google { display: flex; align-items: center; justify-content: center; gap: 8px; }
#loginDialog .google svg { width: 18px; height: 18px; background: #fff; border-radius: 50%; padding: 2px; box-sizing: content-box; }
#loginDialog input {
  padding: 10px; border: 2px solid var(--line); border-radius: 10px; font: inherit; color: var(--text);
}
#loginDialog input:focus { border-color: var(--accent); outline: none; }
.toast {
  position: fixed; left: 12px; right: 12px; bottom: 14px; z-index: 30; max-width: 480px; margin: 0 auto;
  background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px;
  font-size: .88rem; color: var(--text); box-shadow: 0 8px 24px rgba(31,95,122,.3);
}
.toast b { color: var(--warn); }
/* Feuille « En ce moment » : onglets Maintenant / Bientôt, rangée par source */
dialog.now {
  width: 100%; max-width: 480px; height: min(86vh, 720px); margin: auto auto 0;
  border-radius: 14px 14px 0 0; border-bottom: 0; padding: 0; flex-direction: column;
}
dialog.now[open] { display: flex; }
.now-head { display: flex; align-items: center; padding: 16px 16px 6px; }
.now-head h2 { margin: 0; flex: 1; }
dialog .now-x { background: none; border: 0; color: var(--muted); font-size: 1.2rem; padding: 4px 8px; }
.now-tabs { display: flex; gap: 18px; padding: 0 16px; border-bottom: 1px solid var(--soft); }
dialog .now-tabs button {
  background: none; border: 0; border-bottom: 2px solid transparent; border-radius: 0; padding: 8px 0 9px;
  font: inherit; font-weight: 700; font-size: .82rem; text-transform: uppercase; color: var(--muted);
}
dialog .now-tabs button.on { color: var(--strong); border-bottom-color: var(--accent); }
body.shiny dialog .now-tabs button.on { border-bottom-color: var(--gold); }
dialog .now-tabs.sub button { font-size: .74rem; }
dialog .now-tabs.sub { gap: 14px; }
.now-sub { display: flex; align-items: center; gap: 8px; margin: 14px 0 4px; font-size: .82rem; font-weight: 700; color: var(--strong); }
.now-sub svg { width: 22px; height: 22px; flex: none; }
.now-scroll { flex: 1; overflow-y: auto; padding: 0 16px 24px; min-height: 0; }
.now-scroll h3 { margin: 16px 0 6px; font-size: .8rem; text-transform: uppercase; color: var(--muted); }
.now-row { display: flex; align-items: center; gap: 10px; padding: 4px 0; font-size: .95rem; }
.now-row img { width: 40px; height: 40px; object-fit: contain; }
.now-row b { margin-left: auto; padding-left: 8px; font-size: .78rem; color: var(--accent); white-space: nowrap; }
.now-row b.later { color: #b7791f; }
.now-empty { margin: 18px 0; color: var(--muted); }
.now-more { color: var(--accent); text-decoration: none; }
.types .how { color: var(--accent); }
.types .how.off { color: var(--muted); font-weight: 500; }
#shinyCheck { display: inline-block; width: 1.2em; color: var(--gold); }
#langMenu button.on { color: var(--accent2); }
body.shiny .bar > div { background: linear-gradient(90deg, #f7d84a, #f59a52); }
body.shiny #count { color: #f7d84a; }
body.shiny .card.caught { background: #3a3416; border-color: #f7d84a; }
body.shiny .tab.done span { color: #f7d84a; }

.top {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
  position: relative;
}
h1 { margin: 0; font-size: 1.15rem; }
.ball {
  width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(#e94560 50%, #fff 50%);
  border: 2px solid #222;
  position: relative;
  flex: none;
}
.ball::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 6px; height: 6px; border-radius: 50%;
  background: #fff; border: 2px solid #222;
}
.more {
  margin-left: 0;
  background: none; border: 0;
  color: var(--text);
  font-size: 1.3rem; line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
}
.menu {
  position: absolute; right: 0; top: 32px;
  background: var(--deep);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-width: 170px;
  padding: 4px 0;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
}
.menu[hidden] { display: none; }
.menu button, .menu a {
  display: block; width: 100%;
  padding: 10px 14px;
  background: none; border: 0;
  color: var(--text); text-align: left; text-decoration: none;
  font: inherit; font-size: .92rem;
  cursor: pointer;
}
.menu button:hover, .menu a:hover { background: #1c2747; }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

.controls { display: flex; gap: 8px; margin-bottom: 10px; }
input[type="search"], select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--deep);
  color: var(--text);
  font-size: .95rem;
}
input[type="search"] { flex: 1; min-width: 0; }
select { cursor: pointer; }
select:hover { border-color: var(--accent); }

.stats {
  display: flex; align-items: center; gap: 10px;
  font-size: .85rem; color: var(--muted);
  margin-bottom: 8px;
}
.bar { flex: 1; height: 5px; background: var(--deep); border-radius: 3px; overflow: hidden; }
.bar > div {
  height: 100%; width: 0;
  background: linear-gradient(90deg, var(--accent2), #4e9cca);
  transition: width .3s;
}

/* Onglets des régions : une seule ligne qui défile */
.tabs {
  display: flex; gap: 20px;
  overflow-x: auto; scrollbar-width: none;
  margin: 0 -20px; padding: 0 20px;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  padding: 6px 0 9px;
  background: none; border: 0;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: inherit; font-size: .88rem;
  white-space: nowrap;
  cursor: pointer;
}
.tab span { margin-left: 5px; font-size: .8rem; opacity: .8; }
.tab.done span { color: var(--accent2); opacity: 1; }
.tab:hover { color: var(--text); }
.tab.active { color: #fff; border-bottom-color: var(--accent); }

/* Grille */
main { padding: 16px 20px 60px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.card {
  background: var(--card);
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 10px 6px 11px;
  text-align: center;
  cursor: pointer;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  position: relative;
  transition: border-color .2s, background .2s;
  content-visibility: auto; contain-intrinsic-size: auto 190px; /* cartes hors écran non dessinées */
}
.card:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.card img {
  width: 104px; height: 104px;
  object-fit: contain;
  filter: grayscale(1) opacity(.4);
  transition: filter .2s;
  pointer-events: none;
}
.card.caught { background: var(--card-caught); border-color: var(--accent2); }
.card.caught img { filter: none; }
.card.locked { cursor: default; opacity: .5; background: #12121f; }
.card.locked img { filter: grayscale(1) brightness(.5); }
.card .dex { font-size: .72rem; color: var(--muted); }
.card .name {
  font-size: .9rem; font-weight: 600; line-height: 1.2;
  margin-top: 1px;
  word-break: break-word;
}
.types { font-size: .74rem; font-weight: 600; margin-top: 3px; }
.types span + span { margin-left: 6px; }
.types .na { color: var(--accent); }

@media (max-width: 600px) {
  header { padding: 12px 14px 0; }
  .tabs { margin: 0 -14px; padding: 0 14px; gap: 18px; }
  main { padding: 12px 12px 48px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
  .card { padding: 8px 4px 9px; }
  .card img { width: 76px; height: 76px; }
  .card .name { font-size: .84rem; }
  .types { font-size: .72rem; }
}

.status {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
}
.spinner {
  width: 40px; height: 40px;
  margin: 0 auto 16px;
  border: 4px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.retry { margin-top: 14px; }
.retry button {
  padding: 9px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--deep); color: var(--text);
  font-size: .95rem; cursor: pointer;
}

/* Fenêtre d'import */
dialog {
  width: min(360px, calc(100% - 48px));
  background: var(--deep);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}
dialog::backdrop { background: rgba(5,5,12,.7); }
dialog h2 { margin: 0 0 8px; font-size: 1.05rem; }
dialog p { margin: 0 0 16px; font-size: .9rem; color: var(--muted); }
dialog form { display: flex; flex-direction: column; gap: 8px; margin: 0; }
dialog button {
  padding: 11px; border-radius: 8px;
  border: 1px solid var(--line); background: #16213e; color: var(--text);
  font-size: .95rem; cursor: pointer;
}
dialog .primary { background: var(--accent2); border-color: var(--accent2); color: var(--deep); font-weight: 600; }
dialog .danger { color: var(--accent); border-color: #5a2738; }
dialog .quiet { background: none; border-color: transparent; color: var(--muted); }

/* Import : choix de la source en bas de l'écran, puis liste des nouveaux */
dialog.sheet {
  width: 100%; max-width: 480px;
  margin: auto auto 0; border-radius: 14px 14px 0 0; border-bottom: 0;
}
dialog.review {
  width: min(440px, 100%); max-height: min(640px, 92vh);
  flex-direction: column; padding: 0;
}
dialog.review[open] { display: flex; }
dialog.review h2 { padding: 18px 18px 4px; margin: 0; }
dialog.review p { padding: 0 18px; margin: 0 0 8px; }
/* Hauteur du contenu, rognée par la fenêtre : avec flex: 1, Safari la mettait à zéro */
.rv-list { flex: 1 1 auto; overflow-y: auto; padding: 0 12px; min-height: 0; }
.rv-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 4px; border-bottom: 1px solid #1c2747; cursor: pointer;
  user-select: none; -webkit-user-select: none;
}
.rv-row img { width: 44px; height: 44px; object-fit: contain; }
.rv-row .rv-name { flex: 1; font-size: .92rem; font-weight: 600; }
.rv-row .rv-dex { font-size: .72rem; color: var(--muted); }
.rv-box {
  width: 22px; height: 22px; flex: none; border-radius: 5px;
  border: 2px solid var(--accent2); background: var(--accent2); color: var(--deep);
  font-weight: 800; font-size: 14px; display: flex; align-items: center; justify-content: center;
}
.rv-row.off .rv-box { background: none; color: transparent; border-color: var(--line); }
.rv-row.off img { filter: grayscale(1) opacity(.4); }
.rv-row.doubt .rv-name::after { content: " ?"; color: var(--accent); }
dialog.review form { padding: 12px 18px 18px; }
/* ---------- Style « Pokémon GO » (maquettes/design/v1, D1) ---------- */
body {
  font-family: "Baloo 2", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(180deg, #9fe3ec, #5cc6db) fixed;
  min-height: 100vh;
}
header {
  top: 10px;
  margin: 10px 10px 0;
  padding: 12px 12px 0;
  border-radius: 14px;
  background: rgba(255,255,255,.78);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  box-shadow: 0 4px 14px rgba(31,95,122,.15);
}
/* Bande de ciel au-dessus de l'en-tête : les cartes y disparaissent au défilement,
   sous l'heure de l'iPhone comprise (maquettes/haut-defilement/v1, H1) */
header::before {
  content: ""; position: absolute; left: -10px; right: -10px; bottom: 100%; height: 200px;
  background: #9fe3ec; pointer-events: none;
}
button, input, select, textarea { font-family: inherit; }
/* Titre en Rubik, tout le reste en Baloo 2 (maquettes/polices/v1, P5) */
h1 { font-family: "Rubik", system-ui, sans-serif; font-weight: 800; color: var(--strong); text-transform: uppercase; letter-spacing: .02em; font-size: 1.05rem; }
.mode { border: 0; background: var(--soft); border-radius: 10px; }
.mode button { color: var(--muted); font-weight: 500; }
.mode button.on { background: var(--accent); color: #fff; }
.mode button.on.gold { background: var(--gold); color: #fff; }
.globe, .more { color: var(--strong); }
input[type="search"], select {
  background: #fff; border: 2px solid var(--line); border-radius: 10px; color: var(--text); font-family: inherit;
}
input[type="search"]::placeholder { color: #8fc0cf; }
select { font-weight: 700; }
select:hover, input[type="search"]:focus { border-color: var(--accent); outline: none; }
.stats { color: var(--strong); font-weight: 800; }
.bar { height: 8px; background: #d4f0f5; border-radius: 4px; }
.bar > div { background: var(--accent); border-radius: 4px; }
.tabs { margin: 0 -12px; padding: 0 12px; }
.tab { color: var(--muted); font-weight: 700; text-transform: uppercase; font-size: .78rem; }
.tab span { opacity: 1; }
.tab:hover { color: var(--strong); }
.tab.active { color: var(--strong); border-bottom-color: var(--accent); }
.tab.done span { color: var(--accent); }
main { padding: 12px 10px 48px; }
.card { background: var(--card); border: 2px solid rgba(255,255,255,.7); border-radius: 12px; }
.card:focus-visible { outline: 2px solid var(--accent); }
.card img { filter: brightness(0) opacity(.12); }
.card.caught { background: var(--card-caught); border-color: rgba(255,255,255,.95); }
.card.locked { background: rgba(255,255,255,.2); opacity: .6; }
.card.locked img { filter: brightness(0) opacity(.08); }
.card .dex { color: #4b8fa5; font-weight: 500; font-size: .95rem; }
.card .name { font-weight: 700; color: var(--text); }
.types { font-weight: 700; }
.types .na { color: var(--warn); }
body.shiny .bar > div { background: var(--gold); }
body.shiny #count { color: #b7791f; }
body.shiny .card.caught { background: rgba(255,248,214,.94); border-color: var(--gold); }
body.shiny .tab.done span { color: #b7791f; }
.menu { background: #fff; border-color: var(--line); box-shadow: 0 8px 24px rgba(31,95,122,.25); }
.menu button, .menu a { color: var(--text); }
.menu button:hover, .menu a:hover { background: var(--soft); }
.status { color: var(--strong); }
.spinner { border-color: #d4f0f5; border-top-color: var(--accent); }
.retry button { background: #fff; border-color: var(--line); color: var(--text); }
dialog { background: #fff; color: var(--text); border-color: var(--line); box-shadow: 0 12px 40px rgba(31,95,122,.3); }
dialog::backdrop { background: rgba(20,60,80,.45); }
dialog h2 { color: var(--strong); }
dialog button { background: var(--soft); border-color: var(--line); color: var(--text); font-family: inherit; }
dialog .primary { background: var(--accent); border-color: var(--accent); color: #fff; }
dialog .danger { color: var(--warn); border-color: #f3c4c4; background: #fff; }
dialog .quiet { background: none; border-color: transparent; color: var(--muted); }
dialog button:focus-visible, .menu button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
dialog button:focus:not(:focus-visible) { outline: none; }
.rv-row { border-bottom-color: var(--soft); }
.rv-box { color: #fff; }
.rv-row.doubt .rv-name::after { color: var(--warn); }
@media (max-width: 600px) {
  .card .dex { font-size: .88rem; }
}
/* Retours aux gestes : rebond et Poké Ball en cochant, secousse en décochant, onglet doré en fin de région */
.card .ball-mark {
  position: absolute; top: 7px; right: 7px; width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(var(--warn) 50%, #fff 50%); border: 1.5px solid var(--text);
  opacity: 0; transform: scale(0); pointer-events: none;
}
.card.caught .ball-mark { opacity: 1; transform: none; }
.card.pop { animation: card-pop .35s cubic-bezier(.3,1.6,.5,1); }
.card.pop .ball-mark { animation: ball-in .55s cubic-bezier(.3,1.5,.5,1); }
.card.shake { animation: card-shake .3s; }
.card.found { animation: card-pop .35s cubic-bezier(.3,1.6,.5,1); }
@keyframes card-pop { 40% { transform: scale(.9); } }
@keyframes ball-in { 0% { opacity: 1; transform: scale(0) rotate(-200deg); } 60% { transform: scale(1.4) rotate(15deg); } }
@keyframes card-shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.tab.gold, .tab.gold span { color: #b7791f !important; }
.tab.gold.active { border-bottom-color: var(--gold); }
.bar.shine { position: relative; }
.bar.shine::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.95), transparent); animation: bar-shine .9s ease-out;
}
@keyframes bar-shine { to { transform: translateX(100%); } }
.toast .undo { float: right; background: none; border: 0; padding: 0; font: inherit; font-weight: 700; text-transform: uppercase; font-size: .8rem; color: var(--accent); cursor: pointer; }
@media (prefers-reduced-motion: reduce) { .card.found, .card.pop, .card.pop .ball-mark, .card.shake, .bar.shine::after { animation: none; } }

/* Grand écran : les feuilles flottent au centre, plus collées en bas */
@media (min-width: 601px) {
  dialog.now, dialog.sheet { margin: auto; border-radius: 14px; border-bottom: 1px solid var(--line); }
}

/* Fiche d'un Pokémon : le nom de la carte l'ouvre */
.card .name { cursor: pointer; text-decoration: underline; text-decoration-color: rgba(27,143,176,.35); text-underline-offset: 3px; }
dialog.fiche { padding: 16px; max-height: 88vh; overflow-y: auto; }
dialog.fiche > form { position: absolute; top: 8px; right: 8px; }
.fiche-hero { display: flex; align-items: center; gap: 14px; }
.fiche-hero img { width: 96px; height: 96px; object-fit: contain; }
.fiche-hero h2 { margin: 0; }
.fiche-hero .dex { color: var(--muted); font-weight: 700; font-size: .85rem; }
.fiche-types { font-weight: 700; font-size: .9rem; margin-top: 2px; }
dialog.fiche h3 { margin: 16px 0 6px; font-size: .8rem; text-transform: uppercase; color: var(--muted); }
.fiche-how div { display: flex; padding: 6px 0; border-bottom: 1px solid var(--soft); }
.fiche-how b { margin-left: auto; padding-left: 8px; font-size: .8rem; color: #b7791f; white-space: nowrap; }
.fiche-how .off { color: var(--muted); }
.fiche-forms { display: flex; gap: 10px; flex-wrap: wrap; }
dialog .fiche-forms button { background: none; border: 0; padding: 0; width: 76px; font-size: .78rem; color: var(--text); display: flex; flex-direction: column; align-items: center; }
.fiche-forms img { width: 56px; height: 56px; object-fit: contain; }
.fiche-forms .miss img { filter: grayscale(1) opacity(.45); }
.fiche-forms .on { font-weight: 700; color: var(--strong); }
.fiche-forms small { color: var(--muted); font-size: .72rem; }
.fiche-btns { display: flex; gap: 8px; margin: 18px 0 12px; }
dialog .fiche-btns button { flex: 1; padding: 11px; font-weight: 700; border-radius: 10px; }
dialog .fiche-btns button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
dialog .fiche-btns button.gold.on { background: var(--gold); border-color: var(--gold); }
.types .zone { color: #b7791f; }

/* Interrupteur des notifications, dans le menu */
#notifBtn { display: flex; align-items: center; gap: 10px; }
#notifBtn .sw { margin-left: auto; width: 34px; height: 20px; border-radius: 10px; background: var(--line); position: relative; transition: background .2s; flex: none; }
#notifBtn .sw::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .2s; }
#notifBtn .sw.on { background: var(--accent); }
#notifBtn .sw.on::after { left: 16px; }

/* Comparaison avec un ami */
.friend-band { display: flex; align-items: center; margin: 8px 0 0; background: var(--accent); color: #fff; border-radius: 10px; padding: 8px 12px; font-size: .88rem; }
.friend-band b { flex: 1; }
.friend-band[hidden] { display: none; }
.friend-band button { background: none !important; border: 0 !important; box-shadow: none !important; color: #fff; font-size: 1rem; cursor: pointer; padding: 0 4px; }

/* Pseudo, dans le menu du compte : aligné sur l'e-mail et les lignes du menu */
.pseudo { display: block; padding: 2px 12px 10px; font-size: .78rem; color: var(--muted); }
.pseudo[hidden] { display: none; }
.pseudo input {
  display: block; width: 100%; box-sizing: border-box; margin-top: 4px; padding: 7px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--soft);
  font: inherit; font-size: .92rem; color: var(--text); outline: none;
}
.pseudo input:focus { border-color: var(--accent); background: #fff; }

/* Collections Méga / Obscurs / Purifiés : choix à gauche du filtre ; un halo de couleur sur les cochés */
#coll { flex: none; }
body[data-coll="shadow"] .card.caught img { filter: drop-shadow(0 0 6px #7b3fb8); }
body[data-coll="purified"] .card.caught img { filter: drop-shadow(0 0 6px #f6e27a); }
body[data-coll="mega"] .card.caught img { filter: drop-shadow(0 0 6px #e0731f); }

/* Téléphone : la recherche sur sa ligne, les deux choix dessous */
@media (max-width: 600px) {
  .controls { flex-wrap: wrap; }
  .controls input[type="search"] { flex: 1 1 100%; order: -1; }
  .controls select { flex: 1 1 0; }
}

/* --- Mode sombre : bleu nuit foncé (maquettes/mode-sombre v3, N3) --- */
#themeBtn b { margin-left: auto; padding-left: 12px; font-weight: 400; color: var(--muted); }
#themeBtn { display: flex; }
html[data-theme="dark"] {
  --bg: #0b2130; --card: rgba(255,255,255,.04); --card-caught: rgba(46,104,130,.45); --deep: #0f2734;
  --line: #1f4659; --soft: #12303f; --text: #cfeaf2; --strong: #8fdcef; --muted: #6a9aac; --accent: #3fb6d8;
  color-scheme: dark;
}
html[data-theme="dark"] body { background: linear-gradient(180deg, #0b2130, #08161f) fixed; color: var(--text); }
html[data-theme="dark"] header { background: rgba(18,42,57,.92); box-shadow: 0 4px 14px rgba(0,0,0,.35); }
html[data-theme="dark"] header::before { background: #0b2130; }
html[data-theme="dark"] input[type="search"], html[data-theme="dark"] select,
html[data-theme="dark"] .retry button, html[data-theme="dark"] #loginDialog input { background: var(--deep); color: var(--text); border-color: var(--line); }
html[data-theme="dark"] input[type="search"]::placeholder { color: var(--muted); }
html[data-theme="dark"] .bar, html[data-theme="dark"] .spinner { background: var(--soft); }
html[data-theme="dark"] .card { border-color: rgba(120,190,215,.14); }
html[data-theme="dark"] .card.caught { border-color: rgba(120,190,215,.35); }
html[data-theme="dark"] .card img { filter: brightness(0) invert(1) opacity(.1); }
html[data-theme="dark"] .card.caught img { filter: none; }
html[data-theme="dark"] .card.locked { background: rgba(255,255,255,.02); }
html[data-theme="dark"] .card .dex { color: var(--muted); }
html[data-theme="dark"] body.shiny .card.caught { background: rgba(240,180,41,.18); }
html[data-theme="dark"] .menu, html[data-theme="dark"] dialog { background: var(--deep); color: var(--text); border-color: var(--line); box-shadow: 0 12px 40px rgba(0,0,0,.5); }
html[data-theme="dark"] dialog .danger { background: var(--deep); border-color: #6b2a2a; }
html[data-theme="dark"] .pseudo input:focus { background: var(--deep); }
html[data-theme="dark"] .now-row b.later, html[data-theme="dark"] .now-cell b, html[data-theme="dark"] .fiche-how b, html[data-theme="dark"] .types .zone { color: #e0a84a; }

/* Écran de lancement : Poké Ball qui tremble puis s'ouvre en deux */
#splash { position: fixed; inset: 0; z-index: 1000; pointer-events: none; --sp: #9fe3ec; }
html[data-theme="dark"] #splash { --sp: #0a1c28; }
#splash .sp-half { position: absolute; left: 0; right: 0; height: 50%; background: var(--sp);
  animation: var(--open) .45s cubic-bezier(.5,0,.75,0) .6s forwards; }
#splash .sp-t { top: 0; --open: sp-up; }
#splash .sp-b { bottom: 0; --open: sp-down; }
#splash .sp-half::after { content: ""; position: absolute; left: 50%; width: 96px; height: 48px; margin-left: -48px;
  border: 5px solid #222; box-sizing: border-box; animation: sp-shake .5s ease-in-out .1s; }
#splash .sp-t::after { bottom: 0; background: #e94560; border-radius: 48px 48px 0 0; border-bottom-width: 3px; }
#splash .sp-b::after { top: 0; background: #fff; border-radius: 0 0 48px 48px; border-top-width: 3px; }
#splash .sp-b::before { content: ""; position: absolute; top: -15px; left: 50%; margin-left: -15px; width: 30px; height: 30px;
  border-radius: 50%; background: #fff; border: 5px solid #222; box-sizing: border-box; z-index: 1;
  animation: sp-fade .1s linear .6s forwards; }
@keyframes sp-shake { 0%,50%,100% { transform: none; } 15%,65% { transform: rotate(-8deg); } 35%,85% { transform: rotate(8deg); } }
#splash .sp-t::after { transform-origin: 50% 100%; } #splash .sp-b::after { transform-origin: 50% 0; }
@keyframes sp-up { to { transform: translateY(-100%); } }
@keyframes sp-down { to { transform: translateY(100%); } }
@keyframes sp-fade { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #splash { display: none; } }

/* --- Animations v1 : A2, B2, D2, F1, G1, H1, I1 --- */
.card { position: relative; }
/* A2 : reflet doré quand on coche un shiny */
.card.glint::after {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(100deg, transparent 35%, rgba(255,255,255,.95) 50%, transparent 65%) no-repeat;
  background-size: 300% 100%; animation: glint .7s ease-in .15s both;
}
@keyframes glint { from { background-position: 100% 0; } to { background-position: -50% 0; } }
/* B2 : barre dorée quand la collection est complète */
.bar.full > div { background: linear-gradient(90deg, #f7d84a, var(--gold)); }
/* D2 : Poké Ball qui tourne au premier chargement */
.spinner { width: 44px; height: 44px; border: 3px solid #222 !important; border-radius: 50%; position: relative;
  background: linear-gradient(#e94560 50%, #fff 50%); animation: spin .9s linear infinite; }
.spinner::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 3px; margin-top: -1.5px; background: #222; }
.spinner::after { content: ""; position: absolute; inset: 0; margin: auto; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid #222; }
/* F1 : cascade au changement de collection */
.card.arrive { animation: arrive .35s ease-out both; }
@keyframes arrive { from { opacity: 0; transform: translateY(14px); } }
/* G1 : aura violette des Obscurs, lueur blanche des Purifiés */
body[data-coll="shadow"] .card::before, body[data-coll="purified"] .card::before {
  content: ""; position: absolute; top: 12px; left: 50%; width: 64px; height: 64px; margin-left: -32px; border-radius: 50%;
  pointer-events: none; animation: aura 1.6s ease-in-out infinite alternate;
}
body[data-coll="shadow"] .card::before { background: radial-gradient(#a35ce0, rgba(106,47,176,.7) 50%, transparent 75%); }
body[data-coll="purified"] .card::before { background: radial-gradient(#fff6c8, rgba(246,226,122,.5) 45%, transparent 75%); }
body[data-coll="shadow"] .card img, body[data-coll="purified"] .card img { position: relative; }
@keyframes aura { from { transform: scale(.9) translateY(2px); opacity: .6; } to { transform: scale(1.15, 1.25) translateY(-4px); opacity: .95; } }
/* H1 : le soleil descend, la lune monte ; l'écran passe en fondu */
body { transition: background-color .4s, color .4s; }
#themeBtn b { display: flex; align-items: center; gap: 6px; }
.sky { width: 20px; height: 20px; position: relative; overflow: hidden; display: inline-block; }
.sky i { position: absolute; inset: 0; font-style: normal; line-height: 20px; text-align: center; font-size: 15px; transition: transform .5s cubic-bezier(.5,1.5,.5,1); }
.sky i + i { transform: translateY(22px); }
html[data-theme="dark"] .sky i { transform: translateY(-22px); }
html[data-theme="dark"] .sky i + i { transform: none; }
/* I1 : l'icône calendrier sautille quand un événement t'attend */
#nowBtn:has(#nowDot:not([hidden])) { animation: hop 6s ease-out 2s infinite; }
@keyframes hop { 0%, 8%, 16%, 100% { transform: none; } 4%, 12% { transform: translateY(-5px); } }
@media (prefers-reduced-motion: reduce) {
  .card.glint::after, .card.arrive, .card::before, #nowBtn, .spinner { animation: none !important; }
  .sky i, body { transition: none; }
}

/* --- Effets du calendrier (calendrier-effets v1 : A2, B1, B2, C1, D1, E1, E2, F2, G2) --- */
dialog.now.before-open { transform: translateY(100%); }
dialog.now.opening { animation: now-up .45s cubic-bezier(.3,.6,.35,1) both; }
dialog.now.opening .now-cell { animation: now-casc .25s ease-out both; }
@keyframes now-up { from { transform: translateY(100%); } }
@keyframes now-casc { from { opacity: 0; transform: translateY(10px) scale(.8); } }
dialog.now.closing { animation: now-down .25s ease-in forwards; }
@keyframes now-down { to { transform: translateY(100%); } }
#nowBody.fade { animation: now-fade .6s ease-out; }
@keyframes now-fade { from { opacity: 0; } }
/* B1 : halo qui respire derrière les boss ; B2 : l'icône de raid brille */
.now-grid.boss .now-cell::before { content: ""; position: absolute; inset: -4px; border-radius: 50%;
  background: radial-gradient(rgba(138,143,163,.6), transparent 68%); animation: now-breath 2s ease-in-out infinite alternate; }
.now-grid.boss .now-cell img { position: relative; }
@keyframes now-breath { from { transform: scale(.8); opacity: .5; } to { transform: scale(1.15); opacity: 1; } }
.now-sub.boss svg { animation: now-shine 4s ease-in-out infinite; }
@keyframes now-shine { 0%, 80%, 100% { filter: none; transform: none; } 88% { filter: brightness(1.6) drop-shadow(0 0 4px #fff); transform: scale(1.15); } }
/* C1 : l'œuf tremble de temps en temps */
.now-sub.egg svg { animation: now-wob 3s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes now-wob { 0%, 70%, 100% { transform: none; } 75% { transform: rotate(-14deg); } 80% { transform: rotate(12deg); } 85% { transform: rotate(-8deg); } 90% { transform: rotate(4deg); } }
/* D1 : flammes violettes des raids obscurs */
.now-grid.shadow .now-cell::before { content: ""; position: absolute; inset: 12% 14% 4%; border-radius: 50% 50% 45% 45%;
  background: radial-gradient(ellipse at 50% 70%, #a35ce0, rgba(106,47,176,.7) 50%, transparent 75%);
  animation: aura 1.4s ease-in-out infinite alternate; }
.now-grid.shadow .now-cell img { position: relative; }
/* E1 : les nouveaux sautillent à l'ouverture ; E2 : leur point pulse */
.now-cell.fresh img { animation: now-hop .7s ease-out .6s both; }
@keyframes now-hop { 0%, 50%, 100% { transform: none; } 25%, 75% { transform: translateY(-8px); } }
.now-cell .now-dot { animation: now-pulse 1.4s ease-in-out infinite; z-index: 1; }
@keyframes now-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(214,69,69,.6); } 50% { box-shadow: 0 0 0 6px rgba(214,69,69,0); } }
/* G2 : la carte du Pokémon s'allume deux fois */
.card.lit { animation: lit .9s; }
@keyframes lit { 25%, 75% { box-shadow: 0 0 0 4px #fff, 0 0 18px 6px #fff; } 50% { box-shadow: none; } }
@media (prefers-reduced-motion: reduce) {
  dialog.now.opening, dialog.now.opening .now-cell, dialog.now.before-open, dialog.now.closing, #nowBody.fade, .now-cell::before, .now-sub svg,
  .now-cell.fresh img, .now-cell .now-dot, .card.lit { animation: none !important; }
}

/* Menu ☰ : tiroir qui glisse du bord droit (maquettes/menu-droite/v1, M3 + C2) */
.more svg { width: 22px; height: 22px; display: block; }
.menu-veil { position: fixed; inset: 0; z-index: 40; background: rgba(8,30,45,.35); opacity: 0; transition: opacity .25s; }
.menu-veil.open { opacity: 1; }
.menu-veil[hidden] { display: none; }
.menu.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; left: auto; width: min(270px, 82vw);
  border-radius: 0; border-width: 0 0 0 1px; z-index: 41; overflow-y: auto;
  padding: calc(env(safe-area-inset-top) + 10px) 0 calc(env(safe-area-inset-bottom) + 10px);
  transform: translateX(100%); transition: transform .25s ease-in;
}
.menu.drawer.open { transform: none; transition: transform .3s cubic-bezier(.3,.6,.35,1); }
.menu.drawer button, .menu.drawer a { display: flex; align-items: center; gap: 8px; padding: 12px 16px; }
.menu.drawer b { margin-left: auto; padding-left: 12px; font-weight: 400; color: var(--muted); }
.acct-head { display: flex; align-items: center; gap: 10px; padding: 8px 16px 4px; font-weight: 800; color: var(--strong); text-transform: uppercase; font-size: .9rem; }
.acct-head svg { width: 20px; height: 20px; display: block; }
#acctMenu [hidden] { display: none; }
#langMenu { position: fixed; top: calc(env(safe-area-inset-top) + 60px); right: 12px; z-index: 42; }
@media (prefers-reduced-motion: reduce) { .menu.drawer, .menu.drawer.open, .menu-veil { transition: none; } }

/* Guide du premier lancement : 3 écrans à glisser (maquettes/avant-reddit/v1, G3) */
#onboard { position: fixed; inset: 0; z-index: 60; background: linear-gradient(180deg, #9fe3ec, #5cc6db); display: flex; flex-direction: column; align-items: center; padding: calc(env(safe-area-inset-top) + 20px) 0 calc(env(safe-area-inset-bottom) + 28px); color: var(--text); }
#onboard[hidden] { display: none; }
html[data-theme="dark"] #onboard { background: linear-gradient(180deg, #0b2130, #08161f); }
.ob-track { flex: 1; width: 100%; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.ob-track::-webkit-scrollbar { display: none; }
.ob-page { flex: 0 0 100%; scroll-snap-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 0 32px; text-align: center; }
.ob-page h2 { margin: 0; font-family: "Rubik", system-ui, sans-serif; font-weight: 800; text-transform: uppercase; color: var(--strong); font-size: 1.3rem; }
.ob-page img { width: 170px; height: 170px; object-fit: contain; }
.ob-page p { margin: 0; font-size: 1.15rem; max-width: 300px; }
.ob-dots { display: flex; gap: 7px; margin: 10px 0 16px; }
.ob-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--strong); opacity: .3; transition: opacity .2s; }
.ob-dots i.on { opacity: 1; }
.ob-next { background: var(--accent); color: #fff; border: 0; border-radius: 12px; padding: 10px 34px; font-weight: 700; font-size: 1.05rem; cursor: pointer; }
.ob-skip { position: absolute; top: calc(env(safe-area-inset-top) + 12px); right: 14px; background: none; border: 0; color: var(--muted); font-size: .95rem; cursor: pointer; }
/* Mention « appli de fan » en bas du menu ☰ (M1) */
.menu .fan { margin: 6px 16px 0; font-size: .75rem; color: var(--muted); line-height: 1.3; }
#reportDialog textarea { width: 100%; box-sizing: border-box; margin-bottom: 10px; padding: 10px; border: 2px solid var(--line); border-radius: 10px; font-size: 1rem; resize: vertical; background: #fff; color: var(--text); }
html[data-theme="dark"] #reportDialog textarea { background: var(--bg, #0f2734); }
#reportDialog form { display: flex; flex-direction: column; gap: 6px; }
#reportMsg { margin: 0 0 6px; color: var(--strong); }
/* Calendrier : source muette ou liste trop vieille */
.now-stale { margin: 4px 0 6px; font-size: .85rem; color: var(--warn); display: inline-block; }
.now-retry { margin: 0 0 10px 8px; background: var(--soft); color: var(--strong); border: 1px solid var(--line); border-radius: 8px; padding: 4px 12px; font: inherit; font-size: .85rem; cursor: pointer; }
.now-empty + .now-retry { margin-left: 0; }
