

:root {
  --papier: #f3efe2;
  --papier-2: #fffdf6;
  --encre: #14110d;
  --encre-2: #55504a;
  --encre-3: #8a837a;

  --orange: #ff8a1f;
  --bleu: #2d6cdf;
  --vert: #35b34a;
  --rouge: #e5342a;
  --jaune: #ffcc00;
  --violet: #8b4fd8;

  --trait: 3px;
  --rayon: 6px;
  --ombre: 5px 5px 0 var(--encre);
  --ombre-mini: 3px 3px 0 var(--encre);

  --titre: "Permanent Marker", "Comic Sans MS", cursive;
  --texte: "Nunito", system-ui, -apple-system, sans-serif;
  --mono: "Space Mono", ui-monospace, monospace;

  --haut: env(safe-area-inset-top, 0px);
  --bas: env(safe-area-inset-bottom, 0px);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  overflow: hidden;
  background: var(--papier);

  background-image:
    linear-gradient(rgba(20, 17, 13, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 17, 13, .05) 1px, transparent 1px);
  background-size: 34px 34px;
  color: var(--encre);
  font-family: var(--texte);
  font-size: 15px;
  font-weight: 600;
  -webkit-font-smoothing: antialiased;

  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

input { -webkit-user-select: text; user-select: text; }

h1, h2, h3 { font-family: var(--titre); font-weight: 400; letter-spacing: 0; }
button { font-family: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

::selection { background: var(--jaune); color: var(--encre); }
:focus-visible { outline: var(--trait) solid var(--bleu); outline-offset: 2px; }

.voile {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--haut)) 16px calc(16px + var(--bas));
  background: rgba(20, 17, 13, .35);
  overflow-y: auto;
}
.voile[hidden] { display: none; }

.panneau {
  width: min(420px, 100%);
  padding: 22px;
  background: var(--papier-2);
  border: var(--trait) solid var(--encre);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
}

.surtitre {
  display: inline-block;
  padding: 2px 8px;
  background: var(--jaune);
  border: 2px solid var(--encre);
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.pitch { margin: 12px 0 18px; font-size: 14px; font-weight: 600; line-height: 1.55; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 18px;
  min-height: 46px;
  background: var(--papier-2);
  border: var(--trait) solid var(--encre);
  border-radius: var(--rayon);
  box-shadow: var(--ombre-mini);
  font-family: var(--titre);
  font-size: 16px;
  cursor: pointer;

  transition: transform .08s, box-shadow .08s;
}
.btn:active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--encre); }
.btn-or { background: var(--orange); }
.btn-or:disabled { opacity: .5; cursor: default; }
.btn-mini {
  padding: 6px 12px;
  min-height: 34px;
  font-family: var(--texte);
  font-weight: 800;
  font-size: 12px;
}

.btn-carre {
  width: 42px; height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--papier-2);
  border: var(--trait) solid var(--encre);
  border-radius: var(--rayon);
  box-shadow: var(--ombre-mini);
  font-size: 19px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: transform .08s, box-shadow .08s, opacity .15s;
}
.btn-carre:disabled { opacity: .3; box-shadow: 0 0 0 var(--encre); cursor: default; }
.btn-carre:not(:disabled):active { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--encre); }

.lien {
  display: inline-block;
  margin-top: 14px;
  color: var(--encre-2);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
  text-decoration-thickness: 2px;
  background: none;
  border: 0;
  cursor: pointer;
}

.porte h1 { font-size: 40px; margin: 10px 0 0; }
.porte .btn-or { width: 100%; }

.champ { display: block; margin-bottom: 12px; }
.champ span { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.champ input {
  width: 100%;
  padding: 11px 13px;
  background: #fff;
  border: var(--trait) solid var(--encre);
  border-radius: 4px;
  color: var(--encre);

  font-size: 16px;
  font-family: var(--mono);
  font-weight: 700;
}
.champ input:focus { outline: none; background: #fffbe8; }

.erreur {
  margin: -4px 0 12px;
  padding: 6px 10px;
  background: var(--rouge);
  border: 2px solid var(--encre);
  border-radius: 4px;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
}
.secoue { animation: secoue .4s; }
@keyframes secoue {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px) rotate(-1deg); }
  50% { transform: translateX(7px) rotate(1deg); }
  80% { transform: translateX(-3px); }
}

#hall {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: calc(18px + var(--haut)) 18px calc(28px + var(--bas));
}
#hall[hidden] { display: none; }
#hall > * { max-width: 780px; margin-inline: auto; }

.hall-tete { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.hall-tete h1 { font-size: 36px; line-height: 1.1; }
.hall-tete .surtitre { margin-bottom: 5px; }
.hall-tete > div { flex: 1; min-width: 0; }
.hall-tete #btn-sortir { margin-left: auto; background: var(--papier-2); }

.retour {
  width: 42px; height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--papier-2);
  border: var(--trait) solid var(--encre);
  border-radius: var(--rayon);
  box-shadow: var(--ombre-mini);
  font-size: 19px;
  font-weight: 800;
}

.hall-lede, .hall-note { font-size: 14px; font-weight: 600; line-height: 1.55; margin-bottom: 18px; }
.hall-note { margin: 22px 0 0; color: var(--encre-2); font-size: 12.5px; }

.grille-jeux {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr));
}

.carte-jeu {
  display: block;
  width: 100%;
  padding: 14px;
  text-align: left;
  background: var(--papier-2);
  border: var(--trait) solid var(--encre);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  cursor: pointer;
  transition: transform .1s, box-shadow .1s;
}
.carte-jeu:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--encre); }
@media (hover: hover) {
  .carte-jeu:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--encre); }
}

.carte-tete { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.carte-icone {
  width: 46px; height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  background: var(--teinte);
  border: var(--trait) solid var(--encre);
  border-radius: var(--rayon);
  color: var(--encre);
}
.carte-icone svg { width: 24px; height: 24px; }
.carte-nom { display: block; font-family: var(--titre); font-size: 24px; line-height: 1.15; }
.carte-kicker {

  display: block;
  width: fit-content;
  padding: 1px 6px;
  margin-bottom: 3px;
  background: var(--teinte);
  border: 2px solid var(--encre);
  border-radius: 3px;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.carte-pitch { font-size: 13.5px; font-weight: 600; line-height: 1.5; }
.carte-pied {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--encre-2);
}
.carte-pied .fleche { margin-left: auto; font-family: var(--titre); font-size: 16px; color: var(--encre); }

#scene {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding-top: var(--haut);
  padding-bottom: var(--bas);
}
#scene[hidden] { display: none; }

.barre {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--papier-2);
  border-bottom: var(--trait) solid var(--encre);
  z-index: 2;
}
.barre-titre { flex: 1; min-width: 0; line-height: 1.2; }
.barre-titre b { display: block; font-family: var(--titre); font-weight: 400; font-size: 19px; }
.barre-titre span { display: block; font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--encre-2); }

.plateau { flex: 1; min-height: 0; position: relative; }

canvas#jeu {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;

  touch-action: none;
  -webkit-user-drag: none;
}

.voile-fin { background: rgba(20, 17, 13, .45); }
.panneau-fin { text-align: center; }
.panneau-fin h2 { font-size: 30px; line-height: 1.15; }
.panneau-fin p { margin: 10px 0 18px; font-size: 14px; font-weight: 600; line-height: 1.5; }
.fin-boutons { display: flex; gap: 12px; }
.fin-boutons .btn { flex: 1; }

.rondelle {
  width: 44px; height: 44px;
  background: var(--orange);
  border: var(--trait) solid var(--encre);
  border-radius: 4px;
  animation: tourne 1.1s steps(8) infinite;
}

@keyframes tourne { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .secoue, .rondelle { animation: none; }
}
