/* =====================================================================
   Composants réutilisables.
   ===================================================================== */

/* ---------------------------------------------------------------- panneaux */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 18px 0; }
.panel-head h2, .panel-head h3 { font-size: calc(15px * var(--fs)); font-weight: 680; }
.panel-body { padding: 16px 18px 18px; }
.section-title { font-size: calc(11.5px * var(--fs)); font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 10px; }
.empty { color: var(--muted); font-size: calc(13.5px * var(--fs)); padding: 12px 0; }
.empty-state { text-align: center; padding: 56px 20px; }
.empty-state h3 { font-size: calc(18px * var(--fs)); margin-bottom: 6px; }
.empty-state p { color: var(--text-2); margin-bottom: 16px; }

/* ---------------------------------------------------------------- boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 620; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s, transform .06s, opacity .12s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.btn.lg { height: 50px; padding: 0 26px; font-size: calc(15.5px * var(--fs)); border-radius: 13px; }
.btn.sm { height: 30px; padding: 0 11px; font-size: calc(13px * var(--fs)); border-radius: 8px; }
.btn.block { width: 100%; }

/* ---------------------------------------------------------------- formulaires */
.input, .select {
  height: 38px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--bg-elevated); padding: 0 12px; color: var(--text); min-width: 0;
}
.select { padding-right: 32px; appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
.input:focus, .select:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
.field { display: grid; gap: 6px; }
.field label, .field .label { font-size: calc(12.5px * var(--fs)); font-weight: 620; color: var(--text-2); }
.field .hint { font-size: calc(12px * var(--fs)); color: var(--muted); }
.search { position: relative; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search .input { padding-left: 34px; width: 100%; }
.form-error { color: var(--danger); font-size: calc(13px * var(--fs)); min-height: 18px; }

.segmented { display: inline-flex; background: var(--surface-solid-2); border: 1px solid var(--border); border-radius: 11px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.segmented button { border: 0; background: transparent; height: 32px; padding: 0 14px; border-radius: 8px; cursor: pointer; font-weight: 620; color: var(--text-2); font-size: calc(13px * var(--fs)); display: inline-flex; align-items: center; gap: 6px; }
.segmented button:hover { color: var(--text); }
.segmented button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: calc(13px * var(--fs)); font-weight: 580; color: var(--text-2); cursor: pointer; }
.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

.toggle { position: relative; width: 38px; height: 22px; flex: none; display: inline-block; }
.toggle input { opacity: 0; width: 0; height: 0; position: absolute; }
.toggle span { position: absolute; inset: 0; background: var(--surface-3); border-radius: 99px; transition: background .15s; cursor: pointer; }
.toggle span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s; }
.toggle input:checked + span { background: var(--accent); }
.toggle input:checked + span::after { transform: translateX(16px); }
.toggle input:disabled + span { opacity: .45; cursor: not-allowed; }
.toggle input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------------------------------------------------------------- éléments d'information */
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: calc(11px * var(--fs)); font-weight: 720; padding: 2px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.badge.accent { background: var(--accent-soft); color: var(--accent); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.success { background: var(--success-soft); color: var(--success); }
.badge.coin { background: var(--coin-soft); color: var(--coin-ink); }
.badge.shiny { background: linear-gradient(90deg, #ffd1f4, #fff3b0, #c7fff1, #d6d0ff); color: #4b1d6b; }
.rc-common { color: var(--r-common); } .rc-uncommon { color: var(--r-uncommon); } .rc-rare { color: var(--r-rare); }
.rc-epic { color: var(--r-epic); } .rc-legendary { color: var(--r-legendary); }

.progress { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; transition: width .4s; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; min-width: 0; }
.kpi .label { font-size: calc(12px * var(--fs)); color: var(--muted); font-weight: 620; display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: calc(24px * var(--fs)); font-weight: 760; letter-spacing: -0.02em; margin-top: 4px; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; }
.kpi .value small { font-size: calc(14px * var(--fs)); color: var(--muted); font-weight: 620; }
.kpi .hint { font-size: calc(12px * var(--fs)); color: var(--text-2); margin-top: 2px; }

table.table { width: 100%; border-collapse: collapse; font-size: calc(13.5px * var(--fs)); }
.table th { text-align: left; font-size: calc(12px * var(--fs)); color: var(--muted); font-weight: 620; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table .r { text-align: right; font-variant-numeric: tabular-nums; }
.table tbody tr.link { cursor: pointer; }
.table tbody tr.link:hover { background: var(--surface-solid-2); }
.table-wrap { overflow-x: auto; }

.flag { width: 20px; height: 15px; border-radius: 3px; object-fit: cover; box-shadow: 0 0 0 1px rgba(127,127,127,.25); display: inline-block; vertical-align: -3px; }
.flag.lg { width: 40px; height: 30px; border-radius: 5px; }

.list-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: calc(13.5px * var(--fs)); }
.list-row:last-child { border-bottom: 0; }
.list-row .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; overflow-x: auto; }
.tabs button, .tabs a { border: 0; background: none; padding: 10px 14px; font-weight: 620; color: var(--text-2); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.tabs button:hover, .tabs a:hover { color: var(--text); text-decoration: none; }
.tabs .active { color: var(--text); border-bottom-color: var(--accent); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .search { flex: 1 1 220px; max-width: 320px; }
.toolbar .spacer { flex: 1; }

.completion { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; padding: 12px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); margin-bottom: 18px; font-size: calc(13.5px * var(--fs)); }
.completion b { font-variant-numeric: tabular-nums; }
.completion .sep { width: 1px; height: 16px; background: var(--border-strong); }

/* ---------------------------------------------------------------- modales */
.modal-backdrop { position: fixed; inset: 0; z-index: 90; background: rgba(4, 8, 16, .72); display: grid; place-items: center; padding: 20px; animation: fade-in .18s ease; }
.modal { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 20px; box-shadow: var(--shadow-lg); width: min(980px, 100%); max-height: calc(100vh - 40px); overflow: auto; position: relative; }
.modal.narrow { width: min(520px, 100%); }
.modal-body { padding: 26px; }
.modal-title { font-size: calc(20px * var(--fs)); font-weight: 740; margin-bottom: 4px; }
.modal-close { position: absolute; top: 12px; right: 12px; z-index: 2; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
@keyframes fade-in { from { opacity: 0; } }

/* ---------------------------------------------------------------- notifications */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: grid; gap: 8px; }
.toast { background: var(--surface-3); color: var(--text); border: 1px solid var(--border-strong); padding: 11px 14px; border-radius: 12px; box-shadow: var(--shadow-lg); font-size: calc(13.5px * var(--fs)); max-width: 380px; animation: toast-in .25s ease; display: flex; gap: 10px; align-items: center; }
.toast.danger { border-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.toast.success { border-color: color-mix(in srgb, var(--success) 55%, transparent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
@media (max-width: 960px) { .toasts { bottom: 78px; left: 14px; right: 14px; } .toast { max-width: none; } }

/* pastille de rareté : forme propre à chaque rareté, dans sa couleur */
.rmark { display: inline-flex; vertical-align: -2px; }
.rmark .ri { width: 13px; height: 13px; }

/* champ mot de passe avec bouton « œil » */
.password-field { position: relative; display: block; }
.password-field .input { width: 100%; padding-right: 44px; }
.password-field .reveal { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; display: grid; place-items: center;
  border: 0; background: none; color: var(--muted); border-radius: 8px; cursor: pointer; }
.password-field .reveal:hover { color: var(--text); background: var(--surface-3); }

/* tutoriel : zone éclairée + bulle d'explication */
.tour { position: fixed; inset: 0; z-index: 2000; }
.tour-spot { position: fixed; border-radius: 14px; box-shadow: 0 0 0 9999px rgba(5, 8, 15, .72); outline: 2px solid var(--accent);
  transition: left .25s, top .25s, width .25s, height .25s; pointer-events: none; }
.tour-bubble { position: fixed; width: min(380px, calc(100vw - 24px)); background: var(--surface-solid, var(--surface)); border: 1px solid var(--border-strong);
  border-radius: 16px; padding: 16px 18px; box-shadow: var(--shadow-lg); display: grid; gap: 8px; }
.tour-bubble h3 { font-size: calc(16px * var(--fs)); }
.tour-bubble p { font-size: calc(13.5px * var(--fs)); color: var(--text-2); line-height: 1.55; }
.tour-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: -4px; }
.tour-actions { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; }

/* série de connexion */
/* série de connexion : badge flamme + compteur, puis frise des 7 jours */
.flame-mark { width: 1em; height: 1em; flex: none; }
.flame-mark.sm { width: 16px; height: 16px; }
.streak-hero { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; padding-right: 32px; }
.streak-head .modal-title { margin: 0 0 4px; }
.streak-head p { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; color: var(--text-2); font-weight: 600; }
.streak-best { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: calc(12px * var(--fs)); }
.streak-flame { position: relative; width: 68px; height: 68px; flex: none; border-radius: 22px; display: grid; place-items: center;
  background: radial-gradient(circle at 50% 35%, #ffd9a8, #ff8a3d 55%, #ff4f2a); box-shadow: 0 8px 22px rgba(255,100,40,.38), inset 0 -3px 0 rgba(0,0,0,.12); }
.streak-flame .flame-mark { width: 30px; height: 30px; margin-top: -18px; color: #fff; filter: drop-shadow(0 2px 3px rgba(150,40,0,.35)); }
.streak-flame b { position: absolute; bottom: 8px; left: 0; right: 0; text-align: center; color: #fff; font-size: calc(17px * var(--fs)); font-weight: 850; line-height: 1; text-shadow: 0 1px 2px rgba(120,30,0,.45); }

/* calendrier : 4 colonnes, le 7e jour (jackpot) prend deux cases */
.streak-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.sd { position: relative; display: grid; justify-items: center; align-content: start; gap: 6px; padding: 10px 6px 12px; min-height: 112px;
  border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface-2); text-align: center; overflow: hidden; }
.sd-day { font-size: calc(11.5px * var(--fs)); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.sd-val { font-size: calc(13px * var(--fs)); font-weight: 780; color: var(--text); line-height: 1.2; overflow-wrap: anywhere; hyphens: auto; }
.sd-coins { position: relative; display: block; height: 40px; width: 52px; }
.sd-coins .coin { position: absolute; width: 30px; height: 30px; filter: drop-shadow(0 2px 2px rgba(120,70,0,.25)); }
.sd-coins.n1 .coin { left: 11px; top: 6px; }
.sd-coins.n2 .coin:nth-child(1) { left: 4px; top: 9px; } .sd-coins.n2 .coin:nth-child(2) { left: 18px; top: 2px; }
.sd-coins.n3 .coin:nth-child(1) { left: 0; top: 10px; } .sd-coins.n3 .coin:nth-child(2) { left: 22px; top: 10px; } .sd-coins.n3 .coin:nth-child(3) { left: 11px; top: 0; }
.sd-pack { display: grid; place-items: center; width: 32px; height: 40px; border-radius: 6px; color: #fff; transform: rotate(-6deg);
  background: linear-gradient(160deg, #6a8bff, #3a4fd6); box-shadow: 0 3px 8px rgba(40,60,180,.35), inset 0 0 0 1.5px rgba(255,255,255,.35); }
.sd-pack .i { width: 18px; height: 18px; }
.sd-pack.pk-continent { background: linear-gradient(160deg, #2ed1b0, #128a8a); box-shadow: 0 3px 8px rgba(18,138,138,.35), inset 0 0 0 1.5px rgba(255,255,255,.35); }
.sd-pack.pk-country { background: linear-gradient(160deg, #ffcf5a, #e8890c); box-shadow: 0 3px 8px rgba(200,110,0,.35), inset 0 0 0 1.5px rgba(255,255,255,.45); }
.sd.jackpot { grid-column: span 2; background: linear-gradient(150deg, rgba(255,207,90,.22), rgba(255,138,61,.14)); border-color: rgba(255,170,70,.55); }
.sd.jackpot .sd-pack { width: 44px; height: 54px; transform: rotate(-8deg); }
.sd.jackpot .sd-pack .i { width: 24px; height: 24px; }
.sd.jackpot .sd-val { font-size: calc(14.5px * var(--fs)); }
.sd-check { position: absolute; inset: 0; display: none; place-items: center; background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.sd-check .i { width: 30px; height: 30px; padding: 6px; border-radius: 50%; color: #fff; background: linear-gradient(180deg, #ff9a4d, #ff5a2e); box-shadow: 0 3px 10px rgba(255,90,46,.45); }
.sd.done { border-color: transparent; }
.sd.done > :not(.sd-check) { opacity: .5; }
.sd.done .sd-check { display: grid; }
.sd.today { border-color: #ff8a3d; background: linear-gradient(180deg, rgba(255,138,61,.16), var(--surface)); animation: sd-glow 1.8s ease-in-out infinite; }
.sd.today .sd-day { color: #ff6a2e; }
.sd.next { border-style: dashed; border-color: rgba(255,138,61,.6); }
.sd.next .sd-day { color: #ff6a2e; }
.sd.just .sd-check .i { animation: sd-pop .6s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes sd-glow { 0%, 100% { box-shadow: 0 0 0 3px rgba(255,138,61,.16); } 50% { box-shadow: 0 0 0 6px rgba(255,138,61,.08), 0 0 20px rgba(255,138,61,.4); } }
@keyframes sd-pop { from { transform: scale(0); } to { transform: scale(1); } }
:root[data-animations="off"] .sd.today, :root[data-animations="off"] .sd.just .sd-check .i { animation: none; }
.streak-foot { margin: 14px 0 0; display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--muted); font-size: calc(12.5px * var(--fs)); font-weight: 600; min-height: 1.4em; }
.streak .modal-actions { justify-content: stretch; }
.streak .modal-actions .btn { flex: 1; justify-content: center; }
.btn.primary.streak-claim { background: linear-gradient(180deg, #ff9a4d, #ff5a2e); border-color: transparent; box-shadow: 0 6px 18px rgba(255,90,46,.35); }
.btn.primary.streak-claim .flame-mark { color: #fff; }
@media (max-width: 520px) { .streak-grid { gap: 6px; } .sd { min-height: 100px; padding: 8px 2px 10px; } .sd-val { font-size: 11px; } .sd.jackpot .sd-val { font-size: 13px; } .sd-day { font-size: 10px; letter-spacing: 0; } .sd-coins { transform: scale(.85); } .streak-flame { width: 58px; height: 58px; } }

/* Bouton favori : étoile pleine quand la ville est favorite */

/* Aperçu de l'image de partage */
.share-preview { display: block; width: min(100%, 360px); margin: 6px auto 4px; border-radius: 14px; box-shadow: var(--shadow); }
