/* Écrans HTML de Dr Barbisson (V6) — style « Immeuble de nuit », pixel art.
   Téléphone (doigt) et ordinateur (souris, clavier). */
@font-face { font-family: "Pixelify Sans"; src: url("fonts/pixelify-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Pixelify Sans"; src: url("fonts/pixelify-600.woff2") format("woff2"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: "Pixelify Sans"; src: url("fonts/pixelify-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --nuit: #1a1533; --facade: #2a2352; --panneau: #1f1a40; --bord: #3a3170; --bord2: #4a3f8f;
  --profond: #0f0c22; --laiton: #f5b942; --laiton-ombre: #b07a14; --vert: #4fd27a;
  --blouse: #f6f3ff; --doux: #d8d2ff; --gris: #b8b0e6; --pale: #9a92c9; --alarme: #ff8a9a;
  --coins: polygon(0 6px,6px 6px,6px 0,calc(100% - 6px) 0,calc(100% - 6px) 6px,100% 6px,100% calc(100% - 6px),calc(100% - 6px) calc(100% - 6px),calc(100% - 6px) 100%,6px 100%,6px calc(100% - 6px),0 calc(100% - 6px));
}

#ui { position: fixed; inset: 0; z-index: 4; font-family: "Pixelify Sans", monospace; color: var(--blouse);
  -webkit-user-select: none; user-select: none; touch-action: manipulation; }
#ui[hidden] { display: none; }
#ui.voile { background: rgba(15, 12, 34, 0.62); }
#ui.plein { background: var(--nuit); }
#ui.transparent { pointer-events: none; }
#ui img { image-rendering: pixelated; }
#ui button, #ui input { font-family: inherit; }
#ui :focus-visible { outline: 3px solid var(--blouse); outline-offset: 3px; }

.ecran { box-sizing: border-box; width: 100%; max-width: 440px; min-height: 100%; margin: 0 auto;
  display: flex; flex-direction: column; gap: 14px; padding: 20px 24px 24px; }
.ecran.defile { height: 100%; overflow-y: auto; }

.entete { display: flex; align-items: center; gap: 12px; min-height: 52px; }
.entete h1 { margin: 0; font-size: 28px; font-weight: 700; }
.retour { display: flex; align-items: center; justify-content: center; width: 48px; height: 48px; border: 0;
  background: var(--facade); box-shadow: inset 0 -4px 0 #120e2a; cursor: pointer; flex-shrink: 0; }

.btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 56px; padding: 6px 14px; border: 0; cursor: pointer; clip-path: var(--coins);
  font-size: 21px; font-weight: 600; color: var(--blouse); background: var(--facade);
  box-shadow: inset 0 0 0 3px var(--bord2), inset 0 -6px 0 #120e2a; }
.btn:active { transform: translateY(2px); }
.btn.principal { min-height: 66px; font-size: 23px; font-weight: 700; color: var(--nuit); background: var(--laiton);
  box-shadow: inset 0 -6px 0 var(--laiton-ombre); }
.btn.principal small { font-size: 15px; font-weight: 500; }
.btn.lien { background: none; box-shadow: none; clip-path: none; color: var(--laiton); font-size: 18px; min-height: 48px; }
.btn.danger { color: var(--alarme); }
.btn:hover { filter: brightness(1.08); }
.pied { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.note { margin: 0; font-size: 14px; color: var(--pale); text-align: center; }
.texte { margin: 0; font-size: 17px; line-height: 1.35; color: var(--doux); }

/* Accueil */
.scene { position: relative; height: 330px; flex-shrink: 0; margin: -20px -24px 0; background: #1f1a40; overflow: hidden; }
.scene h1 { position: absolute; left: 0; right: 0; top: 40px; margin: 0; text-align: center; font-size: 52px; line-height: 1;
  font-weight: 700; color: var(--laiton); text-shadow: 4px 4px 0 var(--profond); }
.scene p { position: absolute; left: 0; right: 0; top: 104px; margin: 0; text-align: center; font-size: 17px; color: var(--doux); }
.etoile-ciel { position: absolute; width: 4px; height: 4px; background: var(--gris); }
.facade { position: absolute; left: 50%; transform: translateX(-50%); top: 140px; width: 300px; height: 126px; background: var(--facade);
  box-shadow: inset 0 0 0 4px var(--bord); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; padding: 16px; box-sizing: border-box; }
.facade div { background: var(--bord); display: flex; align-items: flex-end; justify-content: center; overflow: hidden; }
.facade .allume { background: var(--laiton); }
.facade img { width: 30px; height: 30px; }
.sol { position: absolute; left: 0; right: 0; bottom: 0; height: 64px; background: url("sprites/sol0.png") repeat-x; background-size: 64px 64px; }
.marcheur { position: absolute; left: 10px; bottom: 4px; width: 64px; height: 64px; animation: marche 6s linear infinite; }
.marcheur img { position: absolute; inset: 0; width: 64px; height: 64px; }
.marcheur .p1 { animation: pas 0.5s steps(1) infinite reverse; }
.marcheur .p0 { animation: pas 0.5s steps(1) infinite; }
.escalier { position: absolute; right: 8px; bottom: 0; width: 64px; height: 64px; }
@keyframes marche { from { transform: translateX(0); } to { transform: translateX(calc(min(100vw, 440px) - 150px)); } }
@keyframes pas { 0% { opacity: 1; } 50% { opacity: 0; } }
.tuiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tuile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; height: 80px; border: 0;
  cursor: pointer; background: #241e4a; color: var(--doux); font-size: 15px; }
.tuile:hover { background: #2f2763; }

/* Cartes (mode) */
.carte { display: flex; gap: 16px; align-items: flex-start; text-align: left; padding: 18px; border: 0; cursor: pointer; clip-path: var(--coins);
  color: var(--blouse); background: #241e4a; box-shadow: inset 0 0 0 3px var(--bord); }
.carte[aria-pressed="true"] { background: #2f2763; box-shadow: inset 0 0 0 4px var(--laiton); }
.carte[aria-pressed="true"] .titre { color: var(--laiton); }
.carte img { width: 60px; height: 60px; flex-shrink: 0; }
.carte .titre { display: block; font-size: 25px; font-weight: 700; }
.carte .desc { display: block; margin-top: 6px; font-size: 16px; line-height: 1.35; color: var(--doux); }
.puces { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.puces span { font-size: 14px; padding: 4px 8px; background: var(--nuit); color: var(--gris); }

/* Ascenseur */
.cadran { display: flex; align-items: center; gap: 16px; padding: 12px 16px; background: var(--profond); box-shadow: inset 0 0 0 4px var(--laiton-ombre); }
.cadran .num { width: 68px; height: 56px; display: flex; align-items: center; justify-content: center; background: #2a0f16; color: #ff8a3d; font-size: 34px; font-weight: 700; }
.cadran .nom { font-size: 20px; font-weight: 600; }
.cadran .rec { font-size: 15px; color: var(--gris); }
.etages { display: flex; flex-direction: column; gap: 4px; }
.etage { display: flex; align-items: center; gap: 14px; min-height: 48px; padding: 0 12px 0 6px; border: 0; cursor: pointer; text-align: left;
  color: var(--blouse); background: transparent; font-size: 18px; }
.etage[aria-pressed="true"] { background: #2f2763; }
.etage .bouton { width: 40px; height: 40px; flex-shrink: 0; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700; background: var(--bord); color: var(--doux); box-shadow: inset 0 -3px 0 rgba(0,0,0,0.35); }
.etage.ouvert .bouton { background: #1f5a3a; }
.etage[aria-pressed="true"] .bouton { background: var(--laiton); color: var(--nuit); }
.etage .nom { flex-grow: 1; }
.etage .rec { font-size: 15px; color: var(--laiton); display: flex; align-items: center; gap: 6px; }
.etage .rec.a-jouer { color: var(--vert); }
.etage:disabled { cursor: not-allowed; color: #6f679f; }
.etage:disabled .bouton { background: #241e4a; color: #6f679f; }

/* Étoiles */
.etoiles { display: inline-flex; gap: 2px; }
.etoiles svg { width: 14px; height: 14px; }
.etoiles.grandes { gap: 10px; }
.etoiles.grandes svg { width: 44px; height: 44px; }
.etoiles.grandes svg.on { animation: surgit 0.45s steps(3) both; }
.etoiles.grandes svg:nth-child(2).on { animation-delay: 0.35s; }
.etoiles.grandes svg:nth-child(3).on { animation-delay: 0.7s; }
@keyframes surgit { from { transform: scale(0); } to { transform: scale(1); } }

/* Panneaux de jeu */
.carton { margin: auto 0; display: flex; flex-direction: column; gap: 16px; padding: 24px; background: var(--panneau);
  box-shadow: inset 0 0 0 4px var(--bord), 0 8px 0 var(--profond); clip-path: polygon(0 8px,8px 8px,8px 0,calc(100% - 8px) 0,calc(100% - 8px) 8px,100% 8px,100% calc(100% - 8px),calc(100% - 8px) calc(100% - 8px),calc(100% - 8px) 100%,8px 100%,8px calc(100% - 8px),0 calc(100% - 8px)); }
.carton .haut { display: flex; justify-content: space-between; align-items: center; font-size: 16px; color: var(--gris); }
.puce { font-size: 15px; padding: 4px 10px; background: #2f2763; color: var(--laiton); }
.carton h2 { margin: 0; font-size: 44px; line-height: 1; font-weight: 700; color: var(--laiton); text-shadow: 3px 3px 0 var(--profond); }
.ligne { display: flex; align-items: center; gap: 14px; font-size: 17px; color: var(--doux); }
.ligne img, .ligne svg { width: 40px; height: 40px; flex-shrink: 0; }
.ligne .fond { background: #b9c4d6; }
.bas { display: flex; justify-content: space-between; gap: 10px; padding-top: 14px; box-shadow: inset 0 3px 0 var(--bord); font-size: 15px; color: var(--gris); }
.invite { margin: 18px 0 0; text-align: center; font-size: 21px; font-weight: 600; text-shadow: 2px 2px 0 var(--profond); animation: clignote 1.1s steps(1) infinite; }
@keyframes clignote { 0% { opacity: 1; } 55% { opacity: 0.35; } }

.feuille { margin-top: auto; display: flex; flex-direction: column; gap: 14px; padding: 14px 24px 28px; margin-left: -24px; margin-right: -24px; margin-bottom: -24px;
  background: var(--panneau); box-shadow: inset 0 4px 0 var(--bord); }
.poignee { align-self: center; width: 48px; height: 6px; background: var(--bord); }
.feuille .titre { display: flex; justify-content: space-between; align-items: baseline; }
.feuille h2 { margin: 0; font-size: 30px; }
.compteurs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.compteurs div { display: flex; align-items: center; gap: 8px; padding: 10px; background: #241e4a; font-size: 19px; font-weight: 600; }
.compteurs img, .compteurs svg { width: 26px; height: 26px; }
.deux { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }

.tableau { display: flex; flex-direction: column; padding: 6px 16px; background: var(--panneau); box-shadow: inset 0 0 0 3px var(--bord); }
.tableau .l { display: flex; align-items: center; gap: 12px; min-height: 40px; font-size: 17px; }
.tableau .l img, .tableau .l svg { width: 26px; height: 26px; }
.tableau .l span:nth-child(2) { flex-grow: 1; }
.tableau .l b { color: var(--laiton); font-weight: 600; }
.tableau .total { min-height: 52px; box-shadow: inset 0 3px 0 var(--bord); justify-content: space-between; font-size: 20px; }
.tableau .total b { font-size: 28px; font-weight: 700; }
.bravo { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: #173a2a; color: #9ff0bd; font-size: 16px; }
.titre-fin { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.titre-fin h2 { margin: 0; font-size: 34px; font-weight: 700; text-shadow: 3px 3px 0 var(--profond); }
.titre-fin.gagne h2 { color: var(--vert); }
.titre-fin.perdu h2 { color: var(--alarme); }

/* Pseudo */
.medaille { width: 112px; height: 112px; margin: 0 auto; display: flex; align-items: center; justify-content: center; background: #2f2763;
  box-shadow: inset 0 0 0 4px var(--laiton); font-size: 46px; font-weight: 700; color: var(--laiton); }
.champ { display: flex; flex-direction: column; gap: 8px; }
.champ label { font-size: 17px; font-weight: 600; }
.champ input { height: 56px; padding: 0 16px; border: 0; font-size: 22px; color: var(--nuit); background: var(--blouse);
  box-shadow: inset 0 -5px 0 var(--gris); -webkit-user-select: text; user-select: text; }

/* Classement */
.onglets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 4px; background: var(--profond); }
.onglets button { min-height: 44px; border: 0; cursor: pointer; font-size: 18px; font-weight: 600; background: transparent; color: var(--doux); }
.onglets button[aria-selected="true"], .onglets button[aria-checked="true"] { background: var(--laiton); color: var(--nuit); }
.podium { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 8px; min-height: 160px; }
.podium > div { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.podium img { width: 48px; height: 48px; }
.podium .nom { font-size: 16px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .socle { width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; color: var(--nuit); }
.podium .socle b { font-size: 22px; }
.podium .socle span { font-size: 14px; font-weight: 600; }
.rangs { display: flex; flex-direction: column; gap: 4px; }
.rang { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 0 12px; background: #241e4a; }
.rang .n { width: 30px; font-size: 18px; font-weight: 700; color: var(--gris); }
.rang .qui { flex-grow: 1; display: flex; flex-direction: column; font-size: 17px; font-weight: 600; }
.rang .qui small { font-size: 13px; font-weight: 400; color: var(--pale); }
.rang .pts { font-size: 18px; font-weight: 600; color: var(--laiton); }
.vide { padding: 24px 12px; text-align: center; color: var(--doux); background: #241e4a; font-size: 17px; }

/* Réglages */
.groupe { margin: 4px 0 0; font-size: 16px; font-weight: 600; color: var(--gris); }
.boite { display: flex; flex-direction: column; background: var(--panneau); }
.volume { display: flex; flex-direction: column; gap: 12px; padding: 14px 16px; background: var(--panneau); }
.volume .haut { display: flex; justify-content: space-between; font-size: 18px; }
.volume .haut b { color: var(--laiton); font-weight: 400; }
.barres { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 4px; }
.barres button { height: 30px; border: 0; padding: 0; cursor: pointer; background: var(--bord); }
.barres button.on { background: var(--laiton); }
.interrupteur { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 8px 16px; border: 0; cursor: pointer; text-align: left;
  color: var(--blouse); background: transparent; box-shadow: inset 0 -2px 0 var(--facade); }
.interrupteur .txt { flex-grow: 1; display: flex; flex-direction: column; gap: 2px; font-size: 18px; }
.interrupteur small { font-size: 13px; color: var(--pale); }
.interrupteur .piste { width: 52px; height: 28px; flex-shrink: 0; display: flex; align-items: center; padding: 3px; box-sizing: border-box; background: var(--bord); }
.interrupteur .piste i { width: 22px; height: 22px; background: var(--blouse); }
.interrupteur[aria-checked="true"] .piste { background: var(--vert); justify-content: flex-end; }

/* Fin */
.fin-texte { margin-top: 12vh; display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.fin-texte h2 { margin: 0; font-size: 46px; font-weight: 700; color: var(--laiton); text-shadow: 4px 4px 0 var(--profond); }
.fin-texte .gros { margin-top: 6px; font-size: 38px; font-weight: 700; }
.fin-texte p { margin: 0; font-size: 18px; color: var(--doux); }

@media (min-width: 900px) {
  .ecran { max-width: 480px; }
}
@media (prefers-reduced-motion: reduce) {
  .marcheur, .marcheur img, .invite, .etoiles.grandes svg.on { animation: none; }
  .marcheur .p1 { opacity: 0; }
}
