/* Layout: "agency window" — the photo is the shop window, the listing card
   (fiche) hangs beside it, and the price arrives on a yellow sign that drops
   into the window. */
:root {
  --ground: #e9edf1;       /* cool pavement grey */
  --paper: #fbfcfd;        /* the listing card */
  --ink: #15213a;          /* navy ink */
  --ink-soft: #5b6679;
  --rule: #d3d9e1;
  --sign: #ffc61a;         /* French "À LOUER" signboard yellow */
  --sign-ink: #15213a;
  --glass: #0e1626;        /* behind the photos */
  --good: #1f9d63;
  --mid: #d48a00;
  --bad: #d4422f;
  --you: #3a63d8;
  /* player colours: mid-tones that carry white initials in both themes */
  --p0: #3a63d8; --p1: #d4422f; --p2: #1f9d63; --p3: #8e44c9;
  --p4: #c46f00; --p5: #0e8a96; --p6: #c2397a; --p7: #5f6b7d;

  --f-display: "Archivo", "Arial Narrow", system-ui, sans-serif;
  --f-body: "Archivo", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-data: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --r: 10px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --ground: #0f1522; --paper: #182133; --ink: #e8edf5; --ink-soft: #95a1b5;
    --rule: #2a3549; --glass: #060a12; --you: #7b9cff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --ground: #0f1522; --paper: #182133; --ink: #e8edf5; --ink-soft: #95a1b5;
  --rule: #2a3549; --glass: #060a12; --you: #7b9cff; color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--you); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- top bar ---------------------------------------------------- */
.topbar {
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 14px clamp(16px, 3vw, 32px);
  border-bottom: 1px solid var(--rule);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-sign {
  width: 30px; height: 30px; display: grid; place-items: center;
  background: var(--sign); color: var(--sign-ink); border-radius: 4px;
  font: 900 15px/1 var(--f-display); font-stretch: 125%;
  transform: rotate(-6deg); transition: transform .4s var(--ease-spring);
}
.brand:hover .brand-sign { transform: rotate(4deg) scale(1.08); }
.brand-name { font: 500 19px/1 var(--f-display); font-stretch: 112%; letter-spacing: -.01em; }
.brand-name b { font-weight: 900; }

.mode {
  position: relative; display: grid; grid-template-columns: 1fr 1fr;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 999px; padding: 3px;
}
.mode button {
  position: relative; z-index: 1; border: 0; background: none; cursor: pointer;
  padding: 7px 18px; border-radius: 999px;
  font: 800 12px/1 var(--f-display); font-stretch: 118%; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-soft); transition: color .25s;
}
.mode button[aria-selected="true"] { color: var(--sign-ink); }
.mode-pill {
  position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px);
  background: var(--sign); border-radius: 999px;
  transition: transform .35s var(--ease-spring);
}
.mode[data-mode="buy"] .mode-pill { transform: translateX(100%); }

/* place search (combobox) */
.place { position: relative; width: min(320px, 100%); }
.place-icon { position: absolute; left: 11px; top: 50%; translate: 0 -50%; width: 17px; height: 17px; color: var(--ink-soft); pointer-events: none; }
.place input {
  width: 100%; padding: 9px 36px 9px 36px; border-radius: 999px;
  border: 1px solid var(--rule); background: var(--paper); outline: none;
  font-weight: 600; transition: border-color .2s, box-shadow .2s;
}
.place input::placeholder { color: var(--ink); opacity: .85; }
.place input:focus { border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sign) 55%, transparent); }
.place input:focus::placeholder { color: var(--ink-soft); opacity: 1; }
.place.selected input { background: color-mix(in srgb, var(--sign) 30%, var(--paper)); border-color: color-mix(in srgb, var(--sign) 70%, var(--ink)); }
.place-clear {
  position: absolute; right: 6px; top: 50%; translate: 0 -50%;
  width: 26px; height: 26px; border: 0; border-radius: 50%; padding: 4px; cursor: pointer;
  background: none; color: var(--ink-soft); display: grid; place-items: center;
}
.place-clear:hover { background: var(--rule); color: var(--ink); }
.place-clear svg { width: 14px; height: 14px; }
.place-list {
  position: absolute; z-index: 1200; top: calc(100% + 6px); left: 0; width: max(100%, 340px); max-width: calc(100vw - 32px);
  margin: 0; padding: 6px; list-style: none; max-height: min(420px, 60vh); overflow-y: auto;
  background: var(--paper); border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: 0 18px 40px -16px rgba(10, 20, 40, .45);
  transform-origin: top left; animation: drop-in .18s var(--ease-out) both;
}
.place-list li {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 2px 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.place-list li[aria-selected="true"] { background: color-mix(in srgb, var(--sign) 35%, var(--paper)); }
.place-list .kind {
  grid-row: span 2; width: 30px; height: 30px; border-radius: 7px; display: grid; place-items: center;
  font: 800 10px/1 var(--f-data); background: var(--ground); color: var(--ink-soft);
}
.place-list .kind.department { background: var(--ink); color: var(--paper); }
.place-list .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-list .name mark { background: none; color: inherit; text-decoration: underline; text-decoration-color: var(--sign); text-decoration-thickness: 3px; text-underline-offset: 2px; }
.place-list .sub { grid-column: 2; font-size: 12px; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.place-list .count { grid-row: span 2; font: 600 12px/1 var(--f-data); color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.place-list .empty { display: block; color: var(--ink-soft); cursor: default; }
.place-list .section { display: block; padding: 8px 10px 4px; cursor: default; font: 700 10px/1 var(--f-display); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }

.scoreboard { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.pips { display: flex; gap: 6px; }
.pip {
  width: 26px; height: 6px; border-radius: 3px; background: var(--rule);
  position: relative; overflow: hidden;
}
.pip::after {
  content: ""; position: absolute; inset: 0; background: var(--pip, var(--ink));
  transform: scaleX(var(--fill, 0)); transform-origin: left; transition: transform .6s var(--ease-out);
}
.pip.current { background: color-mix(in srgb, var(--sign) 55%, var(--rule)); }
.total { display: flex; align-items: baseline; gap: 8px; }
.label, .total .label {
  font: 700 11px/1 var(--f-display); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft);
}
.total b { font: 600 22px/1 var(--f-data); font-variant-numeric: tabular-nums; min-width: 5ch; text-align: right; }
.total b.bump { animation: bump .5s var(--ease-spring); }

/* ---------- stage ------------------------------------------------------ */
.stage {
  display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 24px;
  padding: 24px clamp(16px, 3vw, 32px) 40px; max-width: 1560px; margin: 0 auto;
}

/* the window */
.vitrine { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.photo-main {
  position: relative; aspect-ratio: 3 / 2; max-width: 100%;
  background: var(--glass); border-radius: var(--r); overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 18px 40px -24px rgba(10, 20, 40, .55);
}
.photo-main img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  opacity: 0; transform: scale(1.015); transition: opacity .45s ease, transform .45s ease;
}
.photo-main img.loaded { opacity: 1; transform: scale(1); animation: drift 16s ease-out .45s forwards; }
.photo-loading {
  position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity .2s;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.07) 50%, transparent 70%) 0 0 / 250% 100%;
  animation: shimmer 1.2s linear infinite;
}
.photo-main.loading .photo-loading { opacity: 1; }

.nav {
  position: absolute; top: 50%; translate: 0 -50%; z-index: 2;
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(8, 12, 22, .5); color: #fff; backdrop-filter: blur(6px);
  display: grid; place-items: center; opacity: .75;
  transition: opacity .2s, transform .2s var(--ease-spring), background .2s;
}
.nav svg { width: 22px; height: 22px; }
.nav:hover { opacity: 1; background: rgba(8, 12, 22, .75); transform: scale(1.08); }
.nav.prev { left: 14px; } .nav.next { right: 14px; }
.counter {
  position: absolute; bottom: 12px; left: 14px; z-index: 2; padding: 4px 10px; border-radius: 999px;
  background: rgba(8, 12, 22, .6); color: #fff; font: 600 12px/1 var(--f-data);
}

.thumbs { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.thumbs button {
  flex: none; padding: 0; border: 0; background: var(--glass); cursor: pointer;
  width: 92px; height: 64px; border-radius: 7px; overflow: hidden;
  outline: 2px solid transparent; outline-offset: 2px;
  opacity: .55; transition: opacity .2s, outline-color .2s, transform .2s var(--ease-out);
  animation: rise .4s var(--ease-out) both; animation-delay: calc(var(--i) * 35ms);
}
.thumbs button:hover { opacity: .9; transform: translateY(-2px); }
.thumbs button.active { opacity: 1; outline-color: var(--sign); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* the sign */
.sign {
  position: absolute; top: 0; right: 9%; z-index: 3; display: flex; flex-direction: column; align-items: center;
  transform-origin: 50% 0; animation: sign-drop 1.1s var(--ease-out) both;
}
.sign-string {
  width: 64%; height: 44px;
  background:
    linear-gradient(to bottom right, transparent calc(50% - 1px), rgba(255,255,255,.75) 50%, transparent calc(50% + 1px)) left / 50% 100% no-repeat,
    linear-gradient(to bottom left, transparent calc(50% - 1px), rgba(255,255,255,.75) 50%, transparent calc(50% + 1px)) right / 50% 100% no-repeat;
}
.sign-board {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  min-width: 230px; padding: 14px 22px 16px;
  background: var(--sign); color: var(--sign-ink); border-radius: 6px;
  box-shadow: 0 2px 0 rgba(0,0,0,.12), 0 18px 30px -12px rgba(0,0,0,.6);
  border: 3px solid var(--sign-ink); outline: 4px solid var(--sign);
}
.sign-kicker { font: 900 15px/1 var(--f-display); font-stretch: 125%; letter-spacing: .14em; text-transform: uppercase; }
.sign-price { font: 600 40px/1 var(--f-data); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.sign-unit { font: 700 11px/1 var(--f-display); letter-spacing: .12em; text-transform: uppercase; }

/* ---------- the listing card ------------------------------------------- */
.fiche {
  display: flex; flex-direction: column; gap: 18px; min-width: 0;
  background: var(--paper); border: 1px solid var(--rule); border-radius: var(--r);
  padding: 20px;
}
.fiche-head { display: flex; flex-direction: column; gap: 6px; }
.ref { font: 400 11px/1 var(--f-data); color: var(--ink-soft); letter-spacing: .04em; }
.fiche-head h2 {
  margin: 0; font: 800 24px/1.1 var(--f-display); font-stretch: 112%; letter-spacing: -.015em;
  text-wrap: balance;
}
.facts {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin: 0;
  background: var(--rule); border: 1px solid var(--rule); border-radius: 8px; overflow: hidden;
}
.facts div {
  display: flex; flex-direction: column; gap: 4px; padding: 10px 12px; background: var(--paper);
  animation: rise .45s var(--ease-out) both; animation-delay: calc(80ms + var(--i) * 45ms);
}
.facts dt { font: 700 10px/1 var(--f-display); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.facts dd { margin: 0; font: 600 17px/1.15 var(--f-data); font-variant-numeric: tabular-nums; }
.facts .hero dd { font-size: 22px; }
.facts .text dd { font: 700 15px/1.25 var(--f-body); overflow-wrap: anywhere; }

.map-wrap { position: relative; }
#map {
  height: 210px; border-radius: 8px; border: 1px solid var(--rule); z-index: 0;
  background: var(--ground);
}
.map-note {
  position: absolute; left: 8px; bottom: 8px; z-index: 500; pointer-events: none;
  padding: 3px 8px; border-radius: 4px; background: var(--paper); color: var(--ink-soft);
  font: 400 11px/1.2 var(--f-data); box-shadow: 0 1px 4px rgba(0,0,0,.15);
}
:root:not([data-theme="light"]) .leaflet-tile-pane { transition: filter .3s; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) saturate(.6); }
}
:root[data-theme="dark"] .leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.9) saturate(.6); }

/* guess form */
.guess { display: flex; flex-direction: column; gap: 12px; animation: rise .4s var(--ease-out) both; }
.guess label { font: 800 13px/1.2 var(--f-display); letter-spacing: .06em; text-transform: uppercase; }
.guess-row {
  display: flex; align-items: center; gap: 10px;
  border: 2px solid var(--ink); border-radius: 8px; padding: 4px 14px;
  transition: box-shadow .2s;
}
.guess-row:focus-within { box-shadow: 0 0 0 4px color-mix(in srgb, var(--sign) 60%, transparent); }
.guess-row input {
  flex: 1; min-width: 0; border: 0; background: none; outline: none; padding: 8px 0;
  font: 600 30px/1 var(--f-data); font-variant-numeric: tabular-nums; letter-spacing: -.02em;
  -moz-appearance: textfield;
}
.guess-row input::-webkit-outer-spin-button, .guess-row input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.unit { font: 600 14px/1 var(--f-data); color: var(--ink-soft); white-space: nowrap; }
input[type=range] { width: 100%; accent-color: var(--ink); cursor: pointer; }
.per-m2 { margin: -4px 0 0; color: var(--ink-soft); font-size: 13px; }
.per-m2 b { font: 600 13px/1 var(--f-data); color: var(--ink); }

.cta {
  border: 0; border-radius: 8px; padding: 14px 18px; cursor: pointer;
  background: var(--ink); color: var(--paper);
  font: 800 14px/1 var(--f-display); font-stretch: 115%; letter-spacing: .06em; text-transform: uppercase;
  transition: transform .15s var(--ease-out), box-shadow .2s, background .2s;
  box-shadow: 0 4px 0 color-mix(in srgb, var(--ink) 55%, black);
}
.cta:hover { transform: translateY(-1px); box-shadow: 0 5px 0 color-mix(in srgb, var(--ink) 55%, black); }
.cta:active { transform: translateY(3px); box-shadow: 0 1px 0 color-mix(in srgb, var(--ink) 55%, black); }
.cta:disabled { opacity: .6; cursor: progress; }

/* result */
.result { display: flex; flex-direction: column; gap: 18px; animation: rise .45s var(--ease-out) both; }
.result-top { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.result-score { display: flex; align-items: baseline; gap: 8px; }
.result-score b { font: 600 46px/1 var(--f-data); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.result-score span { color: var(--ink-soft); font: 400 13px/1 var(--f-data); }
.verdict {
  padding: 6px 10px; border-radius: 999px; color: #fff; background: var(--tone, var(--ink));
  font: 800 11px/1 var(--f-display); letter-spacing: .1em; text-transform: uppercase;
  animation: pop .5s var(--ease-spring) .5s both;
}

.gauge { position: relative; height: 54px; margin: 0 6px; }
.gauge-track {
  position: absolute; left: 0; right: 0; top: 30px; height: 4px; border-radius: 2px;
  background: repeating-linear-gradient(90deg, var(--rule) 0 2px, transparent 2px 10%), var(--rule);
}
.gauge-gap {
  position: absolute; top: 29px; height: 6px; border-radius: 3px; background: var(--tone, var(--bad));
  left: 50%; width: 0; opacity: .85; transition: left .9s var(--ease-out) .15s, width .9s var(--ease-out) .15s;
}
.gauge-mark {
  position: absolute; top: 0; left: 50%; translate: -50% 0;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  transition: left .9s var(--ease-out) .15s;
}
.gauge-mark span {
  font: 800 10px/1 var(--f-display); letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 6px; border-radius: 4px;
}
.gauge-mark::after { content: ""; width: 14px; height: 14px; border-radius: 50%; border: 3px solid var(--paper); }
.gauge-mark.real span { background: var(--sign); color: var(--sign-ink); }
.gauge-mark.real::after { background: var(--sign-ink); box-shadow: 0 0 0 2px var(--sign); }
.gauge-mark.you span { background: var(--you); color: #fff; }
.gauge-mark.you::after { background: var(--you); }
.gauge-mark.you { top: 0; }

.result-lines { margin: 0; display: flex; flex-direction: column; border-top: 1px solid var(--rule); }
.result-lines div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--rule);
}
.result-lines dt { color: var(--ink-soft); font-size: 13px; }
.result-lines dd { margin: 0; font: 600 15px/1.2 var(--f-data); font-variant-numeric: tabular-nums; text-align: right; }
.delta { font-size: 12px; color: var(--tone, var(--ink-soft)); }
.result-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.link { color: var(--ink); font-weight: 600; text-underline-offset: 3px; }
.link:hover { color: var(--you); }

/* ---------- overlays --------------------------------------------------- */
.overlay {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; padding: 16px;
  background: color-mix(in srgb, var(--glass) 70%, transparent); backdrop-filter: blur(4px);
  animation: fade .3s ease both;
}
.card {
  width: min(460px, 100%); background: var(--paper); border-radius: 14px; padding: 28px;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 30px 60px -20px rgba(0,0,0,.5);
  animation: card-in .55s var(--ease-spring) both;
}
.eyebrow { margin: 0; font: 800 12px/1 var(--f-display); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.card h2 { margin: 0; font: 600 54px/1 var(--f-data); letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.card h2 small { font-size: 16px; color: var(--ink-soft); letter-spacing: 0; }
.sum-rank { margin: 0; font: 800 18px/1.2 var(--f-display); font-stretch: 112%; }
.sum-rounds { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.sum-rounds li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; padding: 10px 0;
  border-bottom: 1px solid var(--rule);
  animation: rise .4s var(--ease-out) both; animation-delay: calc(250ms + var(--i) * 90ms);
}
.sum-rounds .city { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sum-rounds .pts { font: 600 15px/1.2 var(--f-data); color: var(--tone); text-align: right; }
.sum-rounds .detail { grid-column: 1 / -1; color: var(--ink-soft); font: 400 12px/1.3 var(--f-data); }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 1100;
  translate: -50% 0; max-width: calc(100% - 32px);
  padding: 12px 18px; border-radius: 8px; background: var(--ink); color: var(--paper);
  box-shadow: 0 10px 30px -10px rgba(0,0,0,.4); animation: rise .35s var(--ease-out) both;
}

/* ---------- footer & legal page ----------------------------------------- */
.credits {
  padding: 0 clamp(16px, 3vw, 32px) 28px; max-width: 1560px; margin: 0 auto;
  font-size: 12px; color: var(--ink-soft);
}
.credits a, .legal a { color: inherit; text-underline-offset: 3px; }
.legal { max-width: 70ch; margin: 0 auto; padding: 32px 16px 64px; display: flex; flex-direction: column; gap: 22px; }
.legal h1 { margin: 12px 0 0; font: 800 34px/1.1 var(--f-display); font-stretch: 112%; letter-spacing: -.015em; text-wrap: balance; }
.legal h2 { margin: 0 0 6px; font: 800 13px/1.2 var(--f-display); letter-spacing: .08em; text-transform: uppercase; }
.legal p { margin: 0 0 8px; line-height: 1.6; }

/* ---------- multiplayer ------------------------------------------------- */
.mp-open, .mp-chip {
  display: flex; align-items: center; gap: 8px; height: 38px;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--paper);
}
.mp-open {
  padding: 0 14px 0 10px; cursor: pointer; font-weight: 700;
  transition: border-color .2s, transform .2s var(--ease-spring);
}
.mp-open svg { width: 20px; height: 20px; }
.mp-open:hover { border-color: var(--ink); transform: translateY(-1px); }
.mp-chip { padding: 0 4px 0 14px; background: var(--sign); border-color: var(--sign); color: var(--sign-ink); animation: pop .4s var(--ease-spring) both; }
.mp-chip .label { color: inherit; opacity: .7; }
.mp-chip b { font: 600 16px/1 var(--f-data); letter-spacing: .12em; }
.icon-btn {
  width: 30px; height: 30px; border: 0; border-radius: 50%; padding: 6px; cursor: pointer;
  background: none; color: inherit; display: grid; place-items: center; flex: none;
}
.icon-btn:hover { background: color-mix(in srgb, currentColor 14%, transparent); }
.icon-btn svg { width: 100%; height: 100%; }
.mp-leave {
  border: 0; border-radius: 999px; padding: 7px 12px; cursor: pointer;
  background: var(--sign-ink); color: var(--sign); font: 700 12px/1 var(--f-display); letter-spacing: .04em;
}
body.multi .mode, body.multi .place { opacity: .6; pointer-events: none; }

.avatar {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: var(--pc, var(--p7)); color: #fff; font: 800 12px/1 var(--f-display); letter-spacing: .02em;
  position: relative;
}
.avatar.off { filter: grayscale(1); opacity: .45; }

/* in-game bar: timer + who has answered */
.mp-bar { display: flex; flex-direction: column; gap: 10px; animation: rise .35s var(--ease-out) both; }
.mp-timer {
  position: relative; height: 26px; border-radius: 6px; overflow: hidden; background: var(--ground);
  border: 1px solid var(--rule);
}
.mp-timer-fill {
  position: absolute; inset: 0; transform-origin: left; background: color-mix(in srgb, var(--sign) 75%, var(--paper));
}
.mp-timer.urgent .mp-timer-fill { background: color-mix(in srgb, var(--bad) 55%, var(--paper)); }
.mp-timer.urgent { animation: urgent 1s ease-in-out infinite; }
.mp-timer span {
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 600 13px/1 var(--f-data); font-variant-numeric: tabular-nums;
}
.mp-players { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.mp-players li { position: relative; }
.mp-players li .avatar { transition: transform .3s var(--ease-spring), box-shadow .3s; }
.mp-players li.done .avatar { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--good); }
.mp-players li.done::after {
  content: "✓"; position: absolute; right: -4px; bottom: -4px; width: 15px; height: 15px; border-radius: 50%;
  display: grid; place-items: center; background: var(--good); color: #fff; font: 800 9px/1 var(--f-body);
  animation: pop .35s var(--ease-spring) both;
}
.mp-players li.me .avatar { outline: 2px dashed var(--ink-soft); outline-offset: 3px; }
.mp-wait { margin: 0; color: var(--ink-soft); font-size: 13px; text-align: center; }
.mp-wait:empty { display: none; }
.guess.sent .guess-row, .guess.sent input[type=range] { opacity: .5; pointer-events: none; }

/* round result */
.mp-gauge { position: relative; height: 64px; margin: 0 14px; }
.mp-gauge .track { position: absolute; left: 0; right: 0; top: 30px; height: 4px; border-radius: 2px; background: var(--rule); }
.mp-gauge .mk {
  position: absolute; left: 50%; translate: -50% 0; transition: left .9s var(--ease-out) .15s;
}
.mp-gauge .mk.real { top: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; z-index: 2; }
.mp-gauge .mk.real span {
  font: 800 10px/1 var(--f-display); letter-spacing: .1em; text-transform: uppercase;
  padding: 4px 6px; border-radius: 4px; background: var(--sign); color: var(--sign-ink);
}
.mp-gauge .mk.real::after {
  content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--sign-ink);
  border: 3px solid var(--paper); box-shadow: 0 0 0 2px var(--sign);
}
.mp-gauge .mk.player { top: 40px; }
.mp-gauge .mk.player .avatar { width: 22px; height: 22px; font-size: 10px; border: 2px solid var(--paper); }
.mp-truth { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.mp-truth span:first-child { font: 700 11px/1 var(--f-display); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.mp-truth b { font: 600 22px/1 var(--f-data); font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-soft); font-size: 13px; }
.mp-ranking { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; border-top: 1px solid var(--rule); }
.mp-ranking li {
  display: grid; grid-template-columns: 20px auto minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 8px 0; border-bottom: 1px solid var(--rule);
  animation: rise .4s var(--ease-out) both; animation-delay: calc(500ms + var(--i) * 90ms);
}
.mp-ranking .pos { font: 600 13px/1 var(--f-data); color: var(--ink-soft); }
.mp-ranking .who { display: flex; flex-direction: column; min-width: 0; }
.mp-ranking .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-ranking .who small { font: 400 12px/1.3 var(--f-data); color: var(--ink-soft); }
.mp-ranking .pts { font: 600 15px/1 var(--f-data); color: var(--tone); font-variant-numeric: tabular-nums; }
.mp-ranking li.me { background: color-mix(in srgb, var(--sign) 16%, transparent); }
.mp-ranking li.missed .pts { color: var(--ink-soft); }

/* dialogs */
.mp-card { gap: 16px; text-align: left; }
.mp-card-head { display: flex; align-items: center; justify-content: space-between; }
.card .mp-title, .mp-title { margin: 0; font: 800 24px/1.1 var(--f-display); font-stretch: 112%; letter-spacing: -.01em; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--rule); }
.tabs button {
  border: 0; background: none; padding: 10px 4px; cursor: pointer; font-weight: 700; color: var(--ink-soft);
  border-bottom: 3px solid transparent; margin-bottom: -1px; transition: color .2s, border-color .2s;
}
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--sign); }
.mp-form { display: flex; flex-direction: column; gap: 14px; animation: rise .3s var(--ease-out) both; }
.field { display: flex; flex-direction: column; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > span, .field legend { font: 700 11px/1 var(--f-display); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); padding: 0; margin-bottom: 6px; }
.field input:not([type=radio]) {
  padding: 11px 12px; border-radius: 8px; border: 1px solid var(--rule); background: var(--ground);
  font-weight: 600; outline: none; transition: border-color .2s, box-shadow .2s;
}
.field input:focus { border-color: var(--ink); box-shadow: 0 0 0 4px color-mix(in srgb, var(--sign) 55%, transparent); }
.code-input { font: 600 24px/1 var(--f-data) !important; letter-spacing: .3em; text-transform: uppercase; text-align: center; }
.seg { display: flex; border: 1px solid var(--rule); border-radius: 8px; overflow: hidden; }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.seg span {
  display: block; text-align: center; padding: 9px 4px; font-weight: 700; font-size: 14px;
  border-left: 1px solid var(--rule); transition: background .2s, color .2s;
}
.seg label:first-child span { border-left: 0; }
.seg input:checked + span { background: var(--ink); color: var(--paper); }
.seg input:focus-visible + span { outline: 3px solid var(--you); outline-offset: -3px; }
.mp-settings { margin: 0; font-size: 13px; color: var(--ink-soft); }
.mp-settings:empty { display: none; }
.mp-settings b { color: var(--ink); }
.mp-settings.error { color: var(--bad); }

.code-sign {
  align-self: center; padding: 14px 28px; border-radius: 8px; background: var(--sign); color: var(--sign-ink);
  border: 3px solid var(--sign-ink); outline: 4px solid var(--sign);
  font: 600 44px/1 var(--f-data); letter-spacing: .22em; padding-right: calc(28px - .22em);
  animation: sign-drop 1s var(--ease-out) both; transform-origin: 50% -40px;
}
.invite { display: flex; gap: 8px; }
.invite input {
  flex: 1; min-width: 0; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--rule);
  background: var(--ground); font: 400 13px/1 var(--f-data); color: var(--ink-soft);
}
.cta.small { padding: 10px 14px; font-size: 12px; white-space: nowrap; }
.mp-roster { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.mp-roster li {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; background: var(--ground);
  animation: rise .35s var(--ease-out) both;
}
.mp-roster .name { font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag {
  padding: 3px 7px; border-radius: 999px; font: 800 10px/1 var(--f-display); letter-spacing: .08em; text-transform: uppercase;
  background: var(--rule); color: var(--ink-soft);
}
.tag.host { background: var(--sign); color: var(--sign-ink); }
.link-btn { align-self: center; border: 0; background: none; color: var(--ink-soft); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: 13px; }
.link-btn:hover { color: var(--bad); }

.podium { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.podium li {
  display: grid; grid-template-columns: 34px auto minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px; background: var(--ground);
  animation: rise .45s var(--ease-out) both; animation-delay: calc(200ms + var(--i) * 120ms);
}
.podium .place-n { font: 600 20px/1 var(--f-data); color: var(--ink-soft); text-align: center; }
.podium li:first-child { background: var(--sign); color: var(--sign-ink); transform-origin: center; animation-name: winner; }
.podium li:first-child .place-n, .podium li:first-child small { color: var(--sign-ink); }
.podium .name { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium small { display: block; font-weight: 400; color: var(--ink-soft); font-size: 12px; }
.podium .total-pts { font: 600 18px/1 var(--f-data); font-variant-numeric: tabular-nums; }

@keyframes urgent { 50% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 35%, transparent); } }
@keyframes winner { 0% { opacity: 0; transform: scale(.85); } 60% { opacity: 1; transform: scale(1.04); } 100% { transform: none; } }

/* ---------- motion ------------------------------------------------------ */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes drop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.6); } to { opacity: 1; transform: none; } }
@keyframes bump { 40% { transform: scale(1.18); color: var(--good); } }
@keyframes drift { to { transform: scale(1.05); } }
@keyframes shimmer { to { background-position: -150% 0; } }
@keyframes card-in { from { opacity: 0; transform: translateY(24px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes sign-drop {
  0%   { transform: translateY(-120%) rotate(0); }
  45%  { transform: translateY(0) rotate(7deg); }
  65%  { transform: rotate(-4deg); }
  82%  { transform: rotate(2deg); }
  100% { transform: rotate(-1deg); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
}

/* ---------- small screens ---------------------------------------------- */
@media (max-width: 980px) {
  .stage { grid-template-columns: 1fr; padding-top: 16px; gap: 16px; }
  .scoreboard { margin-left: 0; width: 100%; justify-content: space-between; }
  .sign { right: 50%; translate: 50% 0; }
  .sign-board { min-width: 190px; padding: 10px 16px 12px; }
  .sign-price { font-size: 30px; }
  .sign-string { height: 24px; }
}
/* ---------- phones ------------------------------------------------------
   Two-row header, edge-to-edge photo with swipe, the guess bar pinned to the
   bottom of the screen, and the result right under the photo. */
@media (max-width: 700px) {
  .topbar {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-areas: "brand score mp" "mode place place";
    align-items: center; gap: 10px; padding: 10px 16px;
  }
  .brand { grid-area: brand; gap: 8px; }
  .brand-sign { width: 26px; height: 26px; font-size: 13px; }
  .brand-name { font-size: 17px; }
  .scoreboard { grid-area: score; margin-left: 0; width: auto; justify-content: flex-end; gap: 10px; }
  .pips { gap: 4px; }
  .pip { width: 12px; height: 5px; }
  .total .label { display: none; }
  .total b { font-size: 18px; min-width: 0; }
  .mp-open { grid-area: mp; width: 38px; padding: 0; justify-content: center; flex: none; }
  .mp-open-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .mode { grid-area: mode; }
  .mode button { padding: 8px 10px; font-size: 11px; letter-spacing: .06em; }
  .place { grid-area: place; width: auto; }
  .place input, .field input:not([type=radio]), .invite input { font-size: 16px; } /* < 16px makes iOS zoom in */
  .place input { padding: 8px 10px 8px 32px; }
  .place.selected input { padding-right: 34px; }
  .place-icon { left: 10px; }
  .place-list { left: auto; right: 0; width: calc(100vw - 32px); max-width: none; }
  body.multi .mode, body.multi .place { display: none; }
  .mp-chip { grid-column: 1 / -1; grid-row: 2; justify-content: space-between; }

  .stage { padding: 0 16px 24px; gap: 12px; }
  .vitrine { margin-inline: -16px; gap: 0; }
  .photo-main { aspect-ratio: 4 / 3; border-radius: 0; box-shadow: none; touch-action: pan-y; }
  .thumbs { display: none; }
  .nav { width: 34px; height: 34px; opacity: .6; }
  .nav.prev { left: 8px; } .nav.next { right: 8px; }
  .counter { left: 50%; translate: -50% 0; bottom: 10px; }

  .fiche { padding: 14px; gap: 14px; }
  .fiche-head { order: -3; }
  .mp-bar { order: -2; }
  .result { order: -1; }
  .fiche-head h2 { font-size: 20px; }
  .facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .facts div { padding: 8px 10px; }
  .facts dt { font-size: 9px; }
  .facts dd { font-size: 15px; }
  .facts .hero dd { font-size: 18px; }
  .facts .text dd { font-size: 13px; overflow-wrap: normal; hyphens: auto; }
  #map { height: 170px; }

  /* the guess bar */
  .guess {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "label label" "row cta" "slider slider" "m2 m2";
    gap: 6px 10px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
    background: var(--paper); border-top: 1px solid var(--rule);
    box-shadow: 0 -12px 30px -18px rgba(10, 20, 40, .5);
    animation: bar-in .35s var(--ease-out) both;
  }
  .guess label { grid-area: label; font-size: 11px; }
  .guess-row { grid-area: row; padding: 0 12px; }
  .guess-row input { font-size: 24px; padding: 6px 0; }
  .guess .cta { grid-area: cta; max-width: 128px; padding: 8px 14px; font-size: 12px; line-height: 1.15; white-space: normal; }
  .guess input[type=range] { grid-area: slider; height: 28px; }
  .guess .per-m2 { grid-area: m2; margin: 0; font-size: 12px; }
  .guess .mp-wait { grid-area: m2; text-align: left; }
  body:has(#guess-form:not([hidden])) .stage { padding-bottom: 170px; }
  body:has(#guess-form:not([hidden])) .credits { display: none; }
  body:has(#guess-form:not([hidden])) .toast { bottom: calc(160px + env(safe-area-inset-bottom, 0px)); }

  .result-score b { font-size: 38px; }
  .result-actions .cta { flex: 1 1 100%; }
  .gauge, .mp-gauge { margin-inline: 10px; }

  /* dialogs become bottom sheets */
  .overlay { place-items: end center; padding: 0; }
  .card {
    width: 100%; max-height: 92vh; overflow-y: auto; border-radius: 16px 16px 0 0;
    padding: 22px 16px calc(22px + env(safe-area-inset-bottom, 0px));
  }
  .card h2 { font-size: 42px; }
  .code-sign { font-size: 34px; }
  .seg span { padding: 10px 2px; font-size: 13px; }
}
@keyframes bar-in { from { transform: translateY(100%); } to { transform: none; } }
}
