/*
 * Design « Court » : bleu terrain de padel, pensé d'abord pour la tablette
 * (saisie des scores par le personnel), puis le téléphone et l'ordinateur.
 */
:root {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --fg: #14213d;
  --muted: #64708a;
  --line: #dde4ee;
  --accent: #1d5fd1;
  --accent-fg: #ffffff;
  --accent-soft: #e4edfc;
  --win: #f1f9d2;
  --lime: #d8f03c;
  --lime-strong: #9bb515;
  --coral: #ff6b4a;
  --error: #c0392b;
  --warn-bg: #fff4dc;
  --warn-fg: #7a5200;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(20, 33, 61, .05), 0 8px 24px rgba(20, 33, 61, .06);
  --border-w: 1px;
  --font: ui-rounded, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --heading-weight: 700;
  --label-transform: uppercase;
  --label-spacing: .07em;
  color-scheme: light;
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}
#app {
  max-width: 680px;
  margin: 0 auto;
  padding-block: 20px 32px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
#app[data-view="home"] { max-width: 920px; }
#app[data-view="tournament"] { max-width: 1120px; }

h1 { font-size: 1.6rem; font-weight: var(--heading-weight); line-height: 1.2; margin: 6px 0 4px; }
h2 { font-size: 1.1rem; font-weight: var(--heading-weight); margin: 28px 0 12px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); font-size: .9rem; margin: 8px 0 0; }
.error { color: var(--error); font-weight: 600; min-height: 1.4em; }
.back { display: inline-block; padding: 6px 0; color: var(--muted); text-decoration: none; font-weight: 600; }

input, button, select { font: inherit; color: inherit; }
input:not([type=radio]):not([type=checkbox]) {
  min-height: 44px;
  min-width: 0;
  padding: 8px 12px;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
}
input[type=number] { appearance: textfield; -moz-appearance: textfield; }
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
input[type=radio], input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--accent); flex: none; }
input.invalid { border-color: var(--error) !important; color: var(--error); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 20px;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--fg);
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-fg);
  box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 28%, transparent);
}
.btn.big { min-height: 56px; padding: 0 26px; font-size: 1.05rem; border-radius: 16px; }
.btn.link { border-color: transparent; background: none; color: var(--muted); text-decoration: underline; }
.btn.danger { color: var(--error); }
.btn.danger-fill { background: var(--error); border-color: var(--error); color: var(--surface); }
.btn:disabled { opacity: .4; cursor: default; }
.btn:not(:disabled):active { transform: translateY(1px); }
.wide { display: flex; width: 100%; margin-top: 16px; }

/* ---------- En-tête ---------- */

.topbar {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--surface);
  border-bottom: var(--border-w) solid var(--line);
}
/* Bande au-dessus de l'en-tête collant (encoche, barre d'état) peinte de la même couleur. */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: var(--surface);
}
/* Logo (raquettes croisées) et nom de l'outil, le même dans toutes les langues. */
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  margin-right: auto;
  font-weight: var(--heading-weight);
  font-size: 1.05rem;
  color: inherit;
  text-decoration: none;
}
.brand .logo { flex: none; width: 34px; height: 34px; }
.brand span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.langs { display: flex; gap: 4px; flex: none; }
.langs button {
  min-height: 36px;
  padding: 0 10px;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: .8rem;
  cursor: pointer;
}
.langs button.on { border-color: var(--accent); background: var(--accent-soft); font-weight: 700; }
.account {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  max-width: 10em;
  min-height: 38px;
  padding: 0 12px 0 4px;
  border: var(--border-w) solid var(--line);
  border-radius: 999px;
  color: inherit;
  font-size: .85rem;
  font-weight: 600;
  text-decoration: none;
}
.account[hidden] { display: none; }
.account .name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
/* Initiale du compte, avec la pastille d'enregistrement : vert = sur le serveur, orange = en cours, gris = hors ligne. */
.avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 700;
  font-size: .85rem;
}
.avatar.big { width: 64px; height: 64px; font-size: 1.6rem; }
.avatar .sync { position: absolute; right: -2px; bottom: -2px; border: 2px solid var(--surface); }
.avatar.big .sync { display: none; }
.sync { flex: none; width: 11px; height: 11px; border-radius: 50%; background: #2e9d5b; }
.sync.pending { background: #e6a23c; }
.sync.offline { background: var(--muted); }

/* ---------- Accueil public et comptes ---------- */

#app[data-view="landing"] { max-width: 1040px; }
#app[data-view="auth"] { max-width: 440px; }
.hero { display: grid; gap: 8px; align-items: center; }
.hero-art { order: -1; width: 100%; max-width: 420px; height: auto; margin: 0 auto; }
.hero h1 { font-size: 2rem; }
.lead { font-size: 1.1rem; color: var(--muted); margin: 8px 0 20px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 32px; }
.feature {
  padding: 16px 18px;
  border-top: 4px solid var(--accent);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.feature strong { display: block; margin-bottom: 4px; }
.panel {
  margin-top: 20px;
  padding: 20px;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.panel h2 { margin-top: 0; }
.panel h3 { font-size: 1rem; margin: 28px 0 0; }
.auth { margin-top: 12px; }
.auth h1 { margin-bottom: 8px; }
.msg { min-height: 1.4em; margin: 12px 0 0; font-weight: 600; }
.msg.error { color: var(--error); }
.msg.ok { color: #2e7d4f; }
.team { margin-top: 12px; border-top: var(--border-w) solid var(--line); }
.member {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 12px 0;
  border-bottom: var(--border-w) solid var(--line);
}
.member-actions { display: flex; gap: 6px; }
.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-fg);
  font-size: .75rem;
  font-weight: 700;
}
.tag.soft { background: var(--accent-soft); color: var(--fg); }
.btn.small { min-height: 38px; padding: 0 12px; font-size: .9rem; }
.dialog-input { display: block; width: 100%; margin-top: 12px; }

/* ---------- Questionnaire de création ---------- */

.steps { display: flex; gap: 6px; padding: 0; margin: 12px 0 0; list-style: none; }
.steps li { flex: 1; min-width: 0; }
.steps li.on { flex: 2.2; }
.steps li > * {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 8px 0 0;
  border: 0;
  border-top: 4px solid var(--line);
  background: none;
  color: var(--muted);
  font-size: .8rem;
  text-align: left;
}
.steps button { cursor: pointer; }
.steps b {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--line);
  color: var(--fg);
  font-size: .75rem;
}
/* Sur téléphone, seul le nom de l'étape en cours s'affiche. */
.steps span { display: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.steps li.done > *, .steps li.on > * { border-top-color: var(--accent); color: var(--fg); }
.steps li.done b, .steps li.on b { background: var(--accent); color: var(--accent-fg); }
.steps li.on span { display: inline; font-weight: 700; }
.step-count { margin: 18px 0 0; color: var(--muted); font-size: .85rem; font-weight: 600; }
.wizard-nav { justify-content: space-between; }
.wizard-nav .btn.primary { margin-left: auto; min-width: 9em; }
fieldset.bare { padding: 0; border: 0; background: none; }
/* Questionnaire et pages de connexion : titres, aides et blocs centrés. */
#app[data-view="form"] { max-width: 640px; }
#app[data-view="form"] .step-count,
#app[data-view="form"] h1,
#app[data-view="form"] .hint,
#app[data-view="form"] .error,
#app[data-view="form"] .recap { text-align: center; }
#app[data-view="form"] .field { max-width: 420px; margin-inline: auto; text-align: center; }
#app[data-view="form"] .field input { text-align: center; }
#app[data-view="form"] .row { justify-content: center; }
#app[data-view="form"] .stepper > span { text-align: center; }
#app[data-view="form"] fieldset { max-width: 560px; margin-inline: auto; }
#app[data-view="form"] .presets { justify-content: center; }
#app[data-view="form"] .warning { text-align: center; }
#app[data-view="form"] .wizard-nav { justify-content: center; }
#app[data-view="form"] .wizard-nav .btn.primary { margin-left: 0; }
.auth h1, .auth > p { text-align: center; }
/* Type et niveau : petites pastilles discrètes sous le nom du tournoi. */
.choice-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px; margin-top: 10px; }
.choice-row + .choice-row { margin-top: 6px; }
.choice-row > span { color: var(--muted); font-size: .85rem; margin-right: 2px; }
.choice-row button {
  min-height: 30px;
  padding: 0 12px;
  border: var(--border-w) solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: .82rem;
  cursor: pointer;
}
.choice-row button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--fg); font-weight: 600; }
.recap { margin: 12px 0 0; padding: 10px 14px; border-radius: var(--radius-sm); background: var(--accent-soft); font-weight: 600; }

/* ---------- Accueil ---------- */

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.card {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  color: inherit;
  text-decoration: none;
}
.card > :not(.card-emoji) { grid-column: 2; }
.card strong { display: block; font-size: 1.05rem; margin-bottom: 2px; }
.card > span { display: block; }
.card-emoji {
  grid-row: 1 / span 3;
  display: grid !important;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 16px;
  background: var(--accent-soft);
  font-size: 1.6rem;
}
.card .status { margin-top: 8px; font-weight: 600; color: var(--accent); }

/* ---------- Formulaire ---------- */

.field { display: block; margin-top: 20px; font-weight: 600; }
.field input { display: block; width: 100%; margin-top: 8px; font-weight: normal; }
fieldset {
  min-width: 0;
  margin: 20px 0 0;
  padding: 16px;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}
legend {
  padding: 0 6px;
  margin-left: -6px;
  font-size: .8rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: var(--label-transform);
  letter-spacing: var(--label-spacing);
}
.option, .check { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.option input, .check input { margin-top: 2px; }
.option small { display: block; color: var(--muted); }
fieldset .option {
  padding: 12px 14px;
  margin-top: 8px;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-sm);
}
fieldset .option:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.row { display: flex; flex-wrap: wrap; gap: 16px 32px; margin-top: 20px; }
.stepper > span { display: block; font-weight: 600; margin-bottom: 8px; }
.stepper div { display: flex; gap: 6px; }
.stepper button, .presets button {
  min-width: 48px;
  min-height: 48px;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 600;
  cursor: pointer;
}
.stepper button { font-size: 1.3rem; }
.stepper input { width: 72px; text-align: center; font-size: 1.2rem; font-weight: 700; }
.presets { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.presets button { padding: 0 14px; }
.presets button.on { border-color: var(--accent); background: var(--accent); color: var(--accent-fg); }
.presets button small { opacity: .7; }
.presets input { width: 80px; text-align: center; font-weight: 700; }
/* Valeur libre : discrète, c'est l'option de dernier recours. */
.presets input.custom { width: 64px; min-height: 36px; font-size: .9rem; font-weight: 600; }
.presets .custom-link {
  min-height: 32px;
  padding: 0 10px;
  border: 0;
  background: none;
  color: var(--muted);
  font-size: .82rem;
  text-decoration: underline;
  cursor: pointer;
}
#rounds-presets { display: contents; }

.names { counter-reset: n; display: grid; gap: 8px 16px; padding: 0; margin: 4px 0 0; list-style: none; }
.names li { counter-increment: n; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.names li::before { content: counter(n); width: 1.6em; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.person { display: flex; gap: 6px; flex: 1 1 200px; min-width: 0; }
.person input { flex: 1; }

/* Choix du drapeau : le <select> natif, invisible, recouvre l'emoji affiché. */
.flag-pick {
  position: relative;
  flex: none;
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-size: 1.2rem;
  cursor: pointer;
}
.flag-pick .none { filter: grayscale(1); opacity: .45; }
.flag-pick { min-height: 44px; padding: 0; font: inherit; font-size: 1.2rem; color: inherit; }

/* Fenêtre de choix du drapeau : recherche en haut, liste qui défile. */
.dialog.countries { display: flex; flex-direction: column; max-height: min(640px, 85vh); }
.country-list { flex: 1; min-height: 0; overflow-y: auto; margin: 10px 0 14px; }
.country-list h3 {
  margin: 12px 0 4px;
  font-size: .75rem;
  color: var(--muted);
  text-transform: var(--label-transform);
  letter-spacing: var(--label-spacing);
}
.country-list p { margin: 12px 0; font-size: 1rem; font-weight: 400; }
.country {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 6px 8px;
  border: 0;
  border-bottom: var(--border-w) solid var(--line);
  background: none;
  font-size: 1rem;
  text-align: left;
  cursor: pointer;
}
.country:hover, .country:focus-visible { background: var(--accent-soft); }
.country .flag { font-size: 1.3rem; }

.warning { margin-top: 12px; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--warn-bg); color: var(--warn-fg); }
.warning p { margin: 0; }
.warning p + p { margin-top: 8px; }
.warning button {
  min-height: 40px;
  margin: 4px 4px 0 0;
  padding: 0 14px;
  border: var(--border-w) solid currentColor;
  border-radius: var(--radius-sm);
  background: transparent;
  font-weight: 700;
  cursor: pointer;
}

/* ---------- Tournoi ---------- */

.tabs {
  display: inline-flex;
  gap: 4px;
  margin: 16px 0 4px;
  padding: 4px;
  border: var(--border-w) solid var(--line);
  border-radius: calc(var(--radius-sm) + 4px);
  background: var(--surface);
}
.tabs button {
  min-height: 44px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}
.tabs button.on { background: var(--accent); color: var(--accent-fg); }

.rounds { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 4px; }
.rounds button {
  min-width: 48px;
  min-height: 48px;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.rounds button.done { background: var(--accent-soft); }
.rounds button.on { border-color: var(--accent); background: var(--accent); color: var(--accent-fg); }

.matches { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.match {
  padding: 12px 16px 6px;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.match.done { border-color: var(--lime-strong); }
.court {
  display: flex;
  justify-content: space-between;
  font-size: .75rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: var(--label-transform);
  letter-spacing: var(--label-spacing);
}
.match.done .court::after { content: '✅'; }
.side { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.side + .side { border-top: var(--border-w) solid var(--line); }
.names-line { flex: 1; font-size: 1.05rem; }
.names-line .player { display: block; }
.names-line .player + .player { margin-top: 2px; }
/* Bloc de match : un terrain de padel vertical vu de haut, en lignes très claires. Chaque équipe occupe
   une moitié (le filet au milieu) : les noms dans le carré de service de gauche, le score dans celui de droite. */
.pitch {
  display: grid;
  grid-template-rows: 44px 1fr 1fr 44px;
  height: 300px;
  margin: 8px 0 6px;
  border-radius: 4px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100' preserveAspectRatio='none'%3E%3Cg fill='none' stroke='%231d5fd1' stroke-opacity='.18' stroke-width='1.5'%3E%3Crect x='1' y='1' width='98' height='98' fill='%231d5fd1' fill-opacity='.035' vector-effect='non-scaling-stroke'/%3E%3Cpath d='M1 14.7H99M1 85.3H99M50 14.7V85.3' vector-effect='non-scaling-stroke'/%3E%3C/g%3E%3C/svg%3E") center / 100% 100% no-repeat;
}
.pitch .side { grid-row: 2; gap: 0; padding: 0 10px; }
.pitch .side + .side { grid-row: 3; border-top: 2px dashed color-mix(in srgb, var(--accent) 35%, transparent); }
.pitch .names-line { flex: 0 0 50%; padding-right: 8px; font-size: 1rem; overflow-wrap: anywhere; }
.pitch .side input { margin-inline: auto; }
.side.win .names-line { font-weight: 700; }
.side input {
  width: 84px;
  min-height: 60px;
  text-align: center;
  font-size: 1.75rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.side.win input { background: var(--win); border-color: var(--lime-strong); }
.rests { margin: 16px 0 0; color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 24px; }
.actions.sticky {
  --gutter-l: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  position: sticky;
  bottom: 0;
  margin: 24px calc(-1 * var(--gutter-r)) 0 calc(-1 * var(--gutter-l));
  padding: 12px var(--gutter-r) calc(12px + env(safe-area-inset-bottom, 0px)) var(--gutter-l);
  border-top: var(--border-w) solid var(--line);
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.actions.sticky:empty { display: none; }
.actions .hint { margin: 0; }

.dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px))
    max(16px, env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: color-mix(in srgb, var(--fg) 40%, transparent);
}
.dialog {
  width: min(420px, 100%);
  padding: 20px;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 12px 40px rgba(0, 0, 0, .25);
}
.dialog p { margin: 0 0 20px; font-size: 1.1rem; font-weight: 600; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }

.ranking-card {
  margin-top: 16px;
  overflow-x: auto;
  border: var(--border-w) solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}
.ranking { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.ranking th, .ranking td { padding: 10px 6px; text-align: right; border-bottom: var(--border-w) solid var(--line); }
.ranking tr:last-child td { border-bottom: 0; }
.ranking th:first-child, .ranking td:first-child { padding-left: 12px; }
.ranking th:last-child, .ranking td:last-child { padding-right: 12px; }
.ranking th:nth-child(2), .ranking td:nth-child(2) { width: 100%; text-align: left; }
.ranking th {
  white-space: nowrap;
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: var(--label-transform);
  letter-spacing: var(--label-spacing);
}
.rank {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  font-weight: 700;
}
.rank-1 .rank, .rank-2 .rank, .rank-3 .rank { font-size: 1.4rem; }

/* ---------- Emojis, profil, podium, partage ---------- */

.emoji-hero { margin-bottom: 4px; font-size: 2.6rem; line-height: 1.1; text-align: center; }
.step-emoji { margin-top: 14px; font-size: 2.2rem; line-height: 1; text-align: center; }
.feature .emoji { display: block; margin-bottom: 6px; font-size: 1.8rem; }
.hello { margin-top: 4px; }
.empty { margin-top: 40px; text-align: center; }
.profile { display: flex; align-items: center; gap: 16px; margin-top: 8px; }
.profile h1 { margin: 0; }
.profile p { margin: 2px 0 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 0; }
.chip {
  padding: 4px 12px;
  border: var(--border-w) solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: .88rem;
}
.chip.ok { border-color: #bfe5cb; background: #e9f7ee; font-weight: 600; }
.finished-banner { margin: 22px 0 0; font-size: 1.5rem; font-weight: 800; text-align: center; }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; max-width: 560px; margin: 18px auto 0; }
.podium .place { flex: 1; min-width: 0; text-align: center; }
.podium .who { font-weight: 700; overflow-wrap: anywhere; }
.podium .pts { margin: 2px 0 8px; color: var(--muted); font-size: .9rem; }
.podium .block { display: grid; place-items: start center; padding-top: 10px; border-radius: 14px 14px 6px 6px; font-size: 2rem; }
.podium .p1 .block { height: 118px; background: #ffe27a; }
.podium .p2 .block { height: 88px; background: #e3e8ef; }
.podium .p3 .block { height: 68px; background: #f3c39b; }
.share-row { margin: 18px 0 8px; text-align: center; }
.share-row .msg { min-height: 0; }
.dialog.share { text-align: center; }
.dialog.share h2 { margin: 4px 0 6px; }
.dialog.share p { margin: 0 0 12px; font-size: .95rem; font-weight: 400; }
.dialog.share input { text-align: center; color: var(--muted); }
.share-actions { display: grid; gap: 8px; margin: 14px 0 6px; }
.btn.whatsapp { border-color: #25d366; background: #25d366; color: #fff; }

/* Téléphone : le logo seul dans l'en-tête, pour laisser la place aux langues et au compte. */
@media (max-width: 480px) {
  .brand span { display: none; }
}

/* ---------- Tablette et plus ---------- */

@media (min-width: 768px) {
  body { font-size: 17px; }
  #app {
    padding-block: 28px 40px;
    padding-left: max(32px, env(safe-area-inset-left, 0px));
    padding-right: max(32px, env(safe-area-inset-right, 0px));
  }
  h1 { font-size: 2rem; }
  .topbar {
    padding-block: 12px;
    padding-left: max(32px, env(safe-area-inset-left, 0px));
    padding-right: max(32px, env(safe-area-inset-right, 0px));
  }
  fieldset { padding: 20px 24px; }
  .steps span { display: inline; }
  .hero { grid-template-columns: 1.1fr 1fr; gap: 40px; padding-top: 24px; }
  .hero-art { order: 0; max-width: none; }
  .hero h1 { font-size: 2.6rem; }
  .panel { padding: 24px 28px; }
  .names { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
  .actions.sticky {
    --gutter-l: max(32px, env(safe-area-inset-left, 0px));
    --gutter-r: max(32px, env(safe-area-inset-right, 0px));
    margin-top: 28px;
  }
  .ranking th, .ranking td { padding: 14px 12px; font-size: 1.05rem; }
  .ranking th { font-size: .78rem; }
  .ranking th:first-child, .ranking td:first-child { padding-left: 20px; }
  .ranking th:last-child, .ranking td:last-child { padding-right: 20px; }
}
