@font-face { font-family: "Bloc"; src: url("polices/Archivo-900.ttf") format("truetype"); font-display: block; }
:root {
  --encre: #14131a; --papier: #ffffff; --jaune: #ffd23f; --jaune-fonce: #e0a800; --ciel: #8fd3ff; --vert: #14612a;
  --r: 22px; --pilule: 999px;
  --ombre: 0 2px 0 var(--encre), 0 18px 34px -16px rgba(20, 60, 110, .55);
  --haut-sur: env(safe-area-inset-top, 0px); --bas-sur: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--ciel); color: var(--encre); font-family: "Bloc", system-ui, sans-serif; -webkit-tap-highlight-color: transparent;
  touch-action: manipulation; overscroll-behavior: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-text-size-adjust: 100%; }
input { -webkit-user-select: text; user-select: text; }
/* à pied, plus aucun geste du navigateur (zoom, défilement, sélection) : chaque doigt appartient au jeu */
body.apied, body.apied * { touch-action: none; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#scene:active { cursor: grabbing; }
button, input { font: inherit; color: inherit; }

.haut { position: fixed; top: calc(12px + var(--haut-sur)); left: 12px; right: 12px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; justify-items: center; pointer-events: none; z-index: 5; }
.haut > * { pointer-events: auto; }
.titre { display: flex; gap: 10px; align-items: center; background: var(--papier); border: 3px solid var(--encre); border-radius: var(--pilule); padding: 6px 8px 6px 16px; box-shadow: var(--ombre); }
.titre-nom { font-size: 15px; letter-spacing: .08em; }
.titre-compte { font-size: 12px; letter-spacing: .06em; background: var(--jaune); border: 2px solid var(--encre); border-radius: var(--pilule); padding: 4px 10px; }

.cherche { position: relative; width: min(520px, 100%); }
.cherche-etiquette { display: block; text-align: center; font-size: clamp(20px, 5.4vw, 30px); letter-spacing: .02em; text-transform: uppercase; color: var(--papier);
  -webkit-text-stroke: 6px var(--encre); paint-order: stroke fill; margin-bottom: 6px; }
.cherche-ligne { display: flex; align-items: center; background: var(--papier); border: 3px solid var(--encre); border-radius: var(--pilule); box-shadow: var(--ombre); padding: 5px 5px 5px 16px; }
.cherche-arobase { font-size: 22px; margin-right: 2px; }
.cherche-ligne input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 18px; padding: 8px 4px; }
.cherche-ligne input::placeholder { color: #8a8794; }
.cherche-ligne:focus-within { outline: 4px solid var(--jaune); outline-offset: 2px; }
.cherche-ok { border: 0; background: linear-gradient(180deg, #ffe373, var(--jaune) 55%, var(--jaune-fonce)); border: 2px solid var(--encre); border-radius: var(--pilule); padding: 10px 16px; font-size: 15px; cursor: pointer; min-height: 44px; }
.propositions { list-style: none; margin: 8px 0 0; padding: 6px; background: var(--papier); border: 3px solid var(--encre); border-radius: var(--r); box-shadow: var(--ombre); max-height: 40vh; overflow: auto; }
.propositions li { display: flex; justify-content: space-between; gap: 10px; padding: 11px 12px; border-radius: 14px; cursor: pointer; font-size: 16px; }
.propositions li small { font-size: 11px; letter-spacing: .06em; opacity: .7; align-self: center; }
.propositions li[aria-selected="true"], .propositions li:hover { background: #fff3b8; }

.astuce { position: fixed; left: 50%; bottom: calc(92px + var(--bas-sur)); transform: translateX(-50%); margin: 0; background: rgba(20, 19, 26, .78); color: #fff; font-size: 13px; letter-spacing: .02em;
  padding: 9px 16px; border-radius: var(--pilule); white-space: nowrap; transition: opacity .6s ease; pointer-events: none; z-index: 4; }
.astuce.parti { opacity: 0; }

.modes { position: fixed; left: 50%; bottom: calc(18px + var(--bas-sur)); transform: translateX(-50%); display: flex; background: var(--papier); border: 3px solid var(--encre); border-radius: var(--pilule); padding: 4px; box-shadow: var(--ombre); z-index: 5; }
.mode { white-space: nowrap; border: 0; background: transparent; border-radius: var(--pilule); padding: 10px 18px; font-size: 15px; cursor: pointer; min-height: 44px; }
.mode.actif { background: var(--encre); color: var(--papier); }

/* les emotes : quatre petits ronds au-dessus de la bascule de vue, discrets mais lisibles */
.emotes { position: fixed; left: 50%; bottom: calc(86px + var(--bas-sur)); transform: translateX(-50%); display: flex; gap: 8px; z-index: 5; }
.emote { width: 44px; height: 44px; border-radius: 50%; border: 2.5px solid var(--encre); background: rgba(255, 255, 255, .88); color: var(--encre);
  box-shadow: 0 2px 0 var(--encre), 0 10px 20px -12px rgba(20, 60, 110, .6); display: grid; place-items: center; cursor: pointer; padding: 0; transition: transform .15s ease, background .15s ease; }
.emote svg { width: 22px; height: 22px; }
@media (hover: hover) { .emote:hover { transform: translateY(-2px); } }
.emote.appuye { transform: translateY(1px) scale(.92); box-shadow: 0 1px 0 var(--encre); }
.emote:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--encre); }
.emote.actif { background: radial-gradient(circle at 35% 30%, #fff6c4, var(--jaune) 55%, var(--jaune-fonce)); }
.emote:focus-visible { outline: 3px solid var(--encre); outline-offset: 2px; }
.apied .astuce { bottom: calc(146px + var(--bas-sur)); }

/* le fondu quand on passe la porte, et le bouton pour ressortir de chez soi */
.rideau { position: fixed; inset: 0; background: radial-gradient(circle at 50% 55%, #3a2a1a, #14131a 70%); opacity: 0; pointer-events: none; transition: opacity .4s ease; z-index: 8; }
.rideau.ferme { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .rideau { transition: none; } }
.dehors { position: fixed; left: calc(12px + env(safe-area-inset-left, 0px)); top: calc(12px + var(--haut-sur)); z-index: 6; border: 3px solid var(--encre); border-radius: var(--pilule);
  background: var(--papier); padding: 10px 16px; font: inherit; font-size: 14px; min-height: 44px; cursor: pointer; box-shadow: var(--ombre); white-space: nowrap; }
.dedans .haut { display: none; }
.astuce { white-space: normal; text-align: center; width: max-content; max-width: min(92vw, 520px); }

.fiche { position: fixed; left: 12px; right: 12px; bottom: calc(86px + var(--bas-sur)); margin: 0 auto; max-width: 460px; background: var(--papier); border: 3px solid var(--encre); border-radius: var(--r);
  box-shadow: var(--ombre); padding: 18px 18px 16px; z-index: 6; animation: monte .35s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes monte { from { transform: translateY(30px); opacity: 0; } }
.fiche-fermer { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; border: 0; background: transparent; font-size: 28px; cursor: pointer; }
.fiche-rang { margin: 0; display: inline-block; font-size: 11px; letter-spacing: .1em; padding: 5px 10px; border: 2px solid var(--encre); border-radius: var(--pilule); }
.fiche-rang.fondateur { background: linear-gradient(180deg, #ffe58a, #f2c94c 60%, #c8961a); }
.fiche-rang.pionnier { background: linear-gradient(180deg, #ffffff, #e6eaf0 60%, #a9b2bf); }
.fiche-rang.habitant { background: #fff; }
.fiche-nom { margin: 10px 0 2px; font-size: clamp(24px, 7vw, 32px); line-height: 1.05; word-break: break-word; padding-right: 30px; }
.fiche-num { margin: 0 0 2px; font-size: 14px; letter-spacing: .01em; }
.fiche-lieu { margin: 0; font-size: 13px; opacity: .7; letter-spacing: .02em; }
.fiche-com { margin: 14px 0 4px; padding: 12px 14px; background: #f3f6fa; border-radius: 16px; font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-weight: 500; font-size: 16px; line-height: 1.4; }
.fiche-com:empty { display: none; }
.fiche-source { margin: 0 0 14px; font-size: 11px; letter-spacing: .04em; opacity: .6; font-family: system-ui, sans-serif; font-weight: 600; }
.fiche-boutons { display: flex; gap: 8px; flex-wrap: wrap; }
.fiche-lien { display: block; margin: 10px auto 0; border: 0; background: none; font: inherit; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px 10px; min-height: 32px; color: var(--encre); opacity: .75; }
.fiche-lien:hover { opacity: 1; }
.bouton { flex: 1 1 auto; min-height: 48px; border: 3px solid var(--encre); border-radius: var(--pilule); padding: 10px 16px; font-size: 15px; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease; }
.bouton:hover { transform: translateY(-2px); }
.bouton:active { transform: translateY(1px); }
.bouton-plein { background: linear-gradient(180deg, #ffe373, var(--jaune) 55%, var(--jaune-fonce)); box-shadow: 0 3px 0 var(--encre); }
.bouton-contour { background: var(--papier); }
.bouton:disabled { opacity: .55; cursor: default; transform: none; }

.absent { position: fixed; left: 12px; right: 12px; bottom: calc(86px + var(--bas-sur)); margin: 0 auto; max-width: 460px; background: var(--papier); border: 3px solid var(--encre); border-radius: var(--r);
  padding: 14px 16px; font-size: 15px; line-height: 1.35; box-shadow: var(--ombre); z-index: 6; font-family: system-ui, sans-serif; font-weight: 600; }

/* deux petits joysticks : discrets au repos dans les coins bas, ils sautent sous le pouce quand on touche sa moitié d'écran */
.joy { position: fixed; width: 88px; height: 88px; margin: -44px 0 0 -44px; border-radius: 50%; z-index: 5; pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, .22), rgba(255, 255, 255, .08) 70%); border: 2px solid rgba(255, 255, 255, .8);
  box-shadow: 0 0 0 1.5px rgba(20, 19, 26, .3); opacity: .5; transition: opacity .25s ease; top: calc(100% - 22px - 44px - var(--bas-sur)); }
.joy-g { left: calc(22px + 44px + env(safe-area-inset-left, 0px)); }
.joy-d { left: calc(100% - 22px - 44px - env(safe-area-inset-right, 0px)); }
.joy.actif { opacity: .95; transition: none; }
.joy-bouton { position: absolute; left: 50%; top: 50%; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; border: 2px solid var(--encre);
  background: radial-gradient(circle at 35% 30%, #fff6c4, var(--jaune) 55%, var(--jaune-fonce)); box-shadow: 0 2px 0 var(--encre); display: grid; place-items: center; }
.joy-bouton svg { width: 20px; height: 20px; fill: var(--encre); }

.tourne { position: fixed; inset: 0; z-index: 30; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 24px; text-align: center;
  background: radial-gradient(circle at 50% 35%, #bfe6ff, var(--ciel) 60%, #6cbcf0); }
.tourne-geste { position: relative; width: 150px; height: 150px; display: grid; place-items: center; }
.tourne-tel { width: 62px; height: 110px; border: 5px solid var(--encre); border-radius: 14px; background: var(--papier); box-shadow: 0 6px 0 var(--encre); display: grid; place-items: center;
  animation: pivote 2.4s cubic-bezier(.6, 0, .3, 1) infinite; }
.tourne-ecran { width: 40px; height: 76px; border-radius: 6px; background: linear-gradient(180deg, #8fd3ff 0 55%, #8fd16a 55%); }
.tourne-fleche { position: absolute; right: -6px; top: -4px; width: 64px; height: 64px; stroke: var(--jaune); filter: drop-shadow(0 0 0 var(--encre)) drop-shadow(2px 2px 0 var(--encre)); animation: fleche 2.4s ease-in-out infinite; }
@keyframes fleche { 0%, 20% { opacity: 1; transform: rotate(0); } 50%, 85% { opacity: .25; transform: rotate(-30deg); } 100% { opacity: 1; transform: rotate(0); } }
@keyframes pivote { 0%, 25% { transform: rotate(0); } 55%, 85% { transform: rotate(-90deg); } 100% { transform: rotate(0); } }
.tourne-titre { margin: 18px 0 0; font-size: 28px; text-transform: uppercase; color: var(--papier); -webkit-text-stroke: 6px var(--encre); paint-order: stroke fill; }
.tourne-texte { margin: 0 0 8px; max-width: 280px; font-family: system-ui, sans-serif; font-weight: 600; font-size: 16px; line-height: 1.35; }
.tourne .bouton { flex: none; }

.bulle { position: fixed; left: 0; top: 0; z-index: 4; max-width: min(300px, 76vw); background: var(--papier); border: 3px solid var(--encre); border-radius: 18px; padding: 10px 14px;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif; font-weight: 600; font-size: 15px; line-height: 1.3; box-shadow: var(--ombre); pointer-events: none; transform-origin: 50% 100%; }
.bulle::after { content: ""; position: absolute; left: 50%; bottom: -13px; width: 18px; height: 18px; background: var(--papier); border-right: 3px solid var(--encre); border-bottom: 3px solid var(--encre); transform: translateX(-50%) rotate(45deg); }
.bulle b { display: block; font-family: "Bloc", sans-serif; font-weight: 400; font-size: 12px; letter-spacing: .06em; margin-bottom: 3px; }

.chargement { position: fixed; inset: 0; display: grid; place-items: center; background: var(--ciel); font-size: 22px; z-index: 20; transition: opacity .5s ease; }
.chargement.fini { opacity: 0; pointer-events: none; }
.sansjs { position: fixed; inset: auto 16px 40%; text-align: center; font-size: 18px; z-index: 30; }

@media (max-width: 899px) {
  .choisi .cherche-etiquette, .choisi .titre { display: none; }
  .fiche { padding: 14px 14px 12px; bottom: calc(80px + var(--bas-sur)); }
  .fiche-nom { margin-top: 6px; }
  .fiche-com { margin: 10px 0 4px; font-size: 15px; padding: 10px 12px; }
  .fiche-source { margin-bottom: 10px; }
  .fiche-boutons { flex-wrap: nowrap; }
  .bouton { padding: 10px 12px; font-size: 14px; }
  .bouton-contour { flex: 0 0 auto; }
}
@media (min-width: 900px) {
  .haut { justify-items: start; left: 24px; top: 24px; right: auto; width: 440px; }
  .cherche-etiquette { text-align: left; }
  .fiche, .absent { left: auto; right: 24px; bottom: 24px; margin: 0; width: 400px; }
  .astuce { bottom: 96px; }
}
/* téléphone couché, à pied : l'écran entier sert à marcher, seule la bascule de vue reste */
@media (pointer: coarse) and (orientation: landscape) {
  .apied .haut { display: none; }
  .apied .modes { left: auto; right: calc(12px + env(safe-area-inset-right, 0px)); top: 12px; bottom: auto; transform: none; }
  .apied .astuce { bottom: 64px; }
  .emotes { bottom: calc(12px + var(--bas-sur)); gap: 6px; }
  .emote { width: 40px; height: 40px; }
}
@media (prefers-reduced-motion: reduce) { .tourne-tel { animation: none; transform: rotate(-90deg); } .tourne-fleche { animation: none; } .fiche { animation: none; } .bouton { transition: none; } }

/* qui tu es : la pastille dans le titre (on change de perso en la touchant) */
.qui { border: 2px solid var(--encre); background: var(--papier); border-radius: var(--pilule); padding: 4px 10px; font: inherit; font-size: 12px; letter-spacing: .02em; cursor: pointer; max-width: 38vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 30px; }
.qui:hover { background: var(--jaune); }
/* « Qui es-tu ? » : la seule question, à l'arrivée */
.accueil { position: fixed; inset: 0; display: grid; place-items: center; background: rgba(20, 19, 26, .42); z-index: 20; padding: 16px; }
.accueil-carte { width: min(460px, 100%); background: var(--papier); border: 3px solid var(--encre); border-radius: 26px; box-shadow: var(--ombre); padding: 22px 20px 16px; text-align: center; }
.accueil-titre { margin: 0 0 6px; font-size: clamp(30px, 8vw, 40px); text-transform: uppercase; color: var(--jaune); -webkit-text-stroke: 7px var(--encre); paint-order: stroke fill; }
.accueil-texte { margin: 0 0 14px; font-size: 16px; line-height: 1.35; }
.accueil-form { position: relative; text-align: left; }
.accueil-form .propositions { position: absolute; left: 0; right: 0; top: 100%; z-index: 2; }
.accueil-absent { margin: 12px 0 0; font-size: 14px; line-height: 1.4; background: #fff6d0; border: 2px solid var(--encre); border-radius: 14px; padding: 10px 12px; text-align: left; }
.accueil-visite { margin-top: 14px; }
/* devant une porte, à pied : un gros bouton pour entrer */
.toquer { position: fixed; left: 50%; bottom: calc(150px + var(--bas-sur)); transform: translateX(-50%); z-index: 6; border: 3px solid var(--encre); border-radius: var(--pilule);
  background: linear-gradient(180deg, #ffe373, var(--jaune) 55%, var(--jaune-fonce)); box-shadow: var(--ombre); font: inherit; font-size: 17px; padding: 12px 22px; cursor: pointer; min-height: 48px; max-width: 90vw; }
.toquer:active { transform: translateX(-50%) translateY(2px); }
@media (pointer: coarse) and (orientation: landscape) { .toquer { bottom: calc(64px + var(--bas-sur)); } }

.accueil-sans { margin-top: 16px; padding-top: 14px; border-top: 2px dashed rgba(20, 19, 26, .25); }
.accueil-sans-titre { margin: 0 0 4px; font-size: 18px; text-transform: uppercase; }
.accueil-sans-texte { margin: 0 0 10px; font-size: 15px; line-height: 1.35; }
.accueil-reseaux { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.accueil-reseau { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; min-height: 44px; }

/* le pouvoir « voler » (gagné par le parrainage) : la bulle dorée */
.emote-voler { background: linear-gradient(180deg, #ffe373, var(--jaune) 55%, var(--jaune-fonce)); }
.emote-voler.actif { background: var(--encre); color: var(--jaune); }
/* écran bas (téléphone couché) : l'en-tête se fait petit dans son coin, pour laisser voir le village */
@media (max-height: 520px) {
  .haut { justify-items: start; left: calc(10px + env(safe-area-inset-left, 0px)); right: auto; top: calc(8px + var(--haut-sur)); width: min(330px, 46vw); gap: 6px; }
  .cherche-etiquette { display: none; }
  .titre { padding: 3px 4px 3px 10px; gap: 6px; } .titre-nom { font-size: 12px; } .titre-compte { font-size: 10px; padding: 2px 7px; } .qui { font-size: 10px; min-height: 24px; padding: 2px 8px; }
  .cherche-ligne { padding: 3px 3px 3px 10px; } .cherche-ligne input { font-size: 15px; padding: 4px 2px; } .cherche-arobase { font-size: 17px; } .cherche-ok { padding: 6px 12px; min-height: 36px; font-size: 13px; }
  .modes:not(.apied .modes) { transform: translateX(-50%) scale(.85); transform-origin: 50% 100%; }
}

/* le titre tient sur une ligne, même avec « Toi : @… » */
.titre-nom, .titre-compte { white-space: nowrap; }
.titre .qui { max-width: 150px; }

/* « Qui es-tu ? » : la carte ne dépasse jamais d un téléphone étroit (390 px) */
.accueil { grid-template-columns: minmax(0, 1fr); }

/* téléphone : le gros bouton de saut sous le pouce droit, comme dans les jeux mobiles ; le petit rond de saut des emotes disparaît (une action, un bouton) */
.saut-gros { position: fixed; right: calc(26px + env(safe-area-inset-right, 0px)); bottom: calc(30px + var(--bas-sur)); z-index: 6; width: 74px; height: 74px; border-radius: 50%;
  border: 3px solid var(--encre); background: radial-gradient(circle at 35% 30%, #ffffff, #e9f6ff 60%, #bfe3ff); color: var(--encre); display: grid; place-items: center; padding: 0;
  box-shadow: 0 3px 0 var(--encre), 0 16px 28px -14px rgba(20, 60, 110, .6); opacity: .92; }
.saut-gros svg { width: 34px; height: 34px; }
.saut-gros.appuye { transform: translateY(2px) scale(.93); box-shadow: 0 1px 0 var(--encre); }
body.tactile .emote[data-emote="saut"] { display: none; }
/* téléphone : la bulle reste petite et ne cache jamais la scène (les longs commentaires passent par morceaux) */
@media (pointer: coarse) {
  .bulle { max-width: min(330px, 44vw); font-size: 13px; padding: 7px 11px; border-radius: 14px; }
  .bulle b { font-size: 10.5px; }
}
/* le joystick droit se repose à gauche du bouton de saut, jamais dessous */
.joy-d { left: calc(100% - 26px - 74px - 26px - 44px - env(safe-area-inset-right, 0px)); }
/* téléphone : l'astuce est courte et étroite, elle ne barre plus l'écran */
@media (pointer: coarse) { .astuce { font-size: 11.5px; max-width: min(56vw, 400px); padding: 6px 12px; } }
/* l'accueil défile s'il est trop haut, et sur téléphone couché il passe sur deux colonnes : tout tient sans défiler */
.accueil { overflow-y: auto; place-items: safe center; }
@media (max-height: 520px) and (min-width: 560px) {
  .accueil { padding: 10px; }
  .accueil-carte { width: min(760px, 100%); display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); column-gap: 18px; padding: 14px 16px 12px; text-align: center; }
  .accueil-carte > * { grid-column: 1; }
  .accueil-carte > .accueil-sans { grid-column: 2; grid-row: 1 / span 8; align-self: center; margin: 0; padding: 0 0 0 16px; border-top: 0; border-left: 2px dashed rgba(20, 19, 26, .25); }
  .accueil-titre { font-size: 30px; -webkit-text-stroke-width: 6px; margin-bottom: 2px; }
  .accueil-texte { font-size: 13.5px; margin-bottom: 10px; }
  .accueil-sans-titre { font-size: 15px; }
  .accueil-sans-texte { font-size: 13px; }
  .accueil-visite { margin-top: 10px; }
}
