:root {
  color-scheme: light;
  --ink: #202923;
  --muted: #586158;
  --paper: #f7f5ed;
  --white: #fffdf6;
  --line: #c9cec0;
  --green: #b5f2b0;
  --orange: #d85832;
  --yellow: #ffde71;
  --mono: "IBM Plex Mono",Consolas,"Courier New",monospace;
  font-family: "DM Sans","Segoe UI",Arial,sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 250px;
}

button,input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

button:disabled {
  cursor: default;
  opacity: .48;
}

button:focus-visible,input:focus-visible {
  outline: 3px solid #1c7291;
  outline-offset: 4px;
}

button svg,.record svg,.medal svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: none;
}

.symbols,[hidden] {
  display: none!important;
}

.mast {
  border-bottom: 1px solid var(--line);
}

.mast-inner {
  max-width: 1272px;
  margin: auto;
  padding: 0 clamp(20px,5vw,76px);
  height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
  font-size: 21px;
  letter-spacing: -1.2px;
}

.brand img {
  width: 35px;
  height: 35px;
}

.quiet,.back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 0;
  background: none;
  padding: 8px 0;
  font-size: 14px;
  font-weight: 650;
}

.quiet:hover,.back:hover {
  text-decoration: underline;
}

.quiet svg,.back svg {
  width: 17px;
  height: 17px;
}

main {
  max-width: 1272px;
  margin: auto;
  padding: 0 clamp(20px,5vw,76px);
}

h1,h2,h3,p {
  margin: 0;
}

h1,h2 {
  letter-spacing: -.055em;
  line-height: 1.04;
}

h1 {
  font-weight: 800;
}

.accent {
  color: var(--orange);
}

.home {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(38px,7vw,110px);
  align-items: center;
  padding: clamp(48px,9vh,96px) 0 55px;
}

.intro h1 {
  font-size: clamp(66px,7.7vw,112px);
  letter-spacing: -.055em;
  line-height: 1.1;
  margin-left: -.045em;
}

.lead {
  margin-top: 17px;
  max-width: 420px;
  font-size: clamp(17px,1.55vw,22px);
  line-height: 1.52;
  color: #49554b;
}

.mode-list {
  display: grid;
  gap: 13px;
  margin: 30px 0 24px;
  max-width: 365px;
}

.mode,.action {
  border: 1.5px solid var(--ink);
  border-radius: 12px;
  font-weight: 700;
  background: var(--white);
  transition: transform .13s,background .13s,box-shadow .13s;
}

.mode:hover,.action:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 3px 0 var(--ink);
}

.mode:active,.action:not(:disabled):active {
  transform: translateY(1px);
  box-shadow: none;
}

.mode {
  display: flex;
  align-items: center;
  gap: 15px;
  min-height: 60px;
  padding: 9px 18px 9px 11px;
  text-align: left;
  font-size: 18px;
}

.primary,.solid {
  background: var(--ink);
  color: var(--white);
}

.mode-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 9px;
  background: var(--green);
  color: var(--ink);
}

.secondary .mode-icon {
  background: var(--yellow);
}

.go {
  margin-left: auto;
}

.record {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--muted);
}

.record svg {
  width: 16px;
  height: 16px;
}

.record strong {
  border-left: 1px solid var(--line);
  padding-left: 10px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 13px;
}

.poster {
  position: relative;
  display: grid;
  place-items: center;
  isolation: isolate;
  aspect-ratio: 1/.98;
  border: 2px solid var(--ink);
  border-radius: 25px;
  background-color: #b5e7b2;
  background-image: radial-gradient(#6d987447 .85px,transparent .95px);
  background-size: 8px 8px;
  box-shadow: 4px 5px 0 var(--ink);
  padding: clamp(32px,4vw,62px);
}

.corner {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 1.5px solid #54775b;
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.corner:after {
  content: "";
  height: 1px;
  background: #54775b;
  width: 6px;
  transform: rotate(-40deg);
}

.tl,.bl {
  left: 15px;
}

.tr,.br {
  right: 15px;
}

.tl,.tr {
  top: 15px;
}

.bl,.br {
  bottom: 15px;
}

.instrument {
  width: 100%;
  max-width: 355px;
  background: var(--ink);
  padding: clamp(13px,2vw,26px);
  border: 2px solid #16221b;
  border-radius: 19px;
  box-shadow: 0 7px 0 #5f8766;
  color: var(--white);
  transform: rotate(-2deg);
}

.instrument-head,.instrument-foot,.play-top,.board-info,.code-header,.dialog-top,.watch-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.instrument-head {
  margin-bottom: 15px;
}

.mono,.overline,.instrument-foot {
  font: 600 11px/1.4 var(--mono);
  text-transform: uppercase;
  letter-spacing: .085em;
}

.instrument-head .mono {
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}

.instrument-head .mono:last-child {
  color: #d3dcce;
  font-size: 10px;
}

.lamp {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--yellow);
}

.demo-grid,.board,.mini-grid {
  display: grid;
  grid-template: repeat(3,minmax(0,1fr))/repeat(3,minmax(0,1fr));
  aspect-ratio: 1;
  gap: 8px;
}

.demo-tile,.pad {
  border-radius: 10px;
  border: 1px solid #566559;
  background: #3b4941;
  position: relative;
}

.demo-tile {
  box-shadow: inset 0 -3px 0 #2e3d32;
}

.demo-tile:after {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #738676;
  position: absolute;
  left: calc(50% - 2px);
  top: calc(50% - 2px);
}

.demo-tile.lit,.pad.lit {
  background: var(--yellow);
  border-color: #ffe899;
  box-shadow: inset 0 -3px 0 #d7b852;
}

.demo-tile.lit:after {
  background: #8b7439;
}

.instrument-foot {
  margin-top: 14px;
}

.meters {
  display: flex;
  gap: 4px;
}

.meters i {
  width: 15px;
  height: 5px;
  background: #59695c;
  border-radius: 2px;
}

.meters i.on {
  background: var(--yellow);
}

.instrument-foot button {
  font: inherit;
  display: flex;
  align-items: center;
  gap: 5px;
  border: 0;
  background: none;
  color: #e1eade;
  padding: 3px 0;
}

.instrument-foot svg {
  width: 13px;
  height: 13px;
}

.screen {
  padding: clamp(24px,5vh,52px) 0 36px;
}

.narrow {
  max-width: 555px;
  margin: auto;
}

.screen h1 {
  font-size: clamp(42px,5.1vw,68px);
}

.narrow>.back {
  margin-bottom: 21px;
}

.paper {
  border: 1.5px solid var(--ink);
  border-radius: 19px;
  background: var(--white);
  padding: clamp(20px,3.5vw,36px);
  margin-top: 24px;
  box-shadow: 3px 4px 0 #c5cfbd;
}

.paper label,.subhead,small {
  display: block;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0;
}

.paper input,dialog input {
  display: block;
  width: 100%;
  border: 1px solid #9aa398;
  background: #fffefb;
  border-radius: 9px;
  padding: 13px;
  margin: 8px 0 14px;
  font-size: 16px;
  min-width: 0;
}

.action {
  min-height: 44px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.form-paper>.action,.lobby-paper>.action,.results-paper>.action {
  width: 100%;
}

.joined {
  display: flex;
  align-items: stretch;
  gap: 8px;
  margin-top: 8px;
}

.joined input {
  margin: 0;
}

.code-input,.big-code {
  font: 700 1.15rem var(--mono);
  letter-spacing: .17em;
  text-transform: uppercase;
}

.or {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
  margin: 24px 0;
}

.or:before,.or:after {
  content: "";
  height: 1px;
  flex: 1;
  background: var(--line);
}

.error:not(:empty) {
  margin-top: 13px;
  color: #942d18;
}

.hint,dialog p {
  line-height: 1.5;
  color: var(--muted);
}

.hint {
  font-size: 14px;
}

.hint:empty {
  display: none;
}

.big-code {
  display: block;
  font-size: clamp(27px,5vw,40px);
  margin-top: 4px;
}

.subhead {
  margin-top: 24px;
}

.subtle {
  background: var(--green);
}

.roster {
  list-style: none;
  margin: 6px 0 23px;
  padding: 0;
}

.roster li,.rank {
  display: flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  overflow-wrap: anywhere;
}

.roster li:before {
  content: "";
  width: 8px;
  height: 8px;
  background: #528657;
  border-radius: 50%;
}

.roster li.off:before {
  background: #9b9d93;
}

.roster small,.rank small {
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.lobby-paper>.hint {
  margin-top: 10px;
}

.play {
  max-width: 740px;
  margin: auto;
}

.play-top {
  margin-bottom: 15px;
}

.play-zone {
  width: min(100%,clamp(245px,49vh,450px));
  margin: auto;
  text-align: center;
}

.play-zone h1 {
  font-size: clamp(36px,6vh,60px);
}

.phase {
  font-size: 17px;
  margin: 9px 0 15px;
  min-height: 25px;
  color: var(--muted);
}

.board {
  padding: clamp(8px,1.2vw,16px);
  background: var(--ink);
  border-radius: 17px;
  box-shadow: 0 4px 0 #9fa996;
}

.pad {
  padding: 0;
  touch-action: manipulation;
  opacity: 1!important;
}

.pad.tap {
  background: var(--green);
  border-color: #d8ffcd;
}

.pad.wrong {
  background: #ff927b;
  border-color: #ffe0cd;
}

.pad:not(:disabled):hover {
  border-color: #a5b4a5;
}

.board-info {
  padding-top: 15px;
  font: 600 12px/1.45 var(--mono);
  color: var(--muted);
}

.overline {
  color: var(--muted);
  margin-bottom: 4px;
}

.watch {
  display: flex;
  flex-direction: column;
  height: calc(100dvh - 76px);
  min-height: 340px;
  padding: 18px 0;
}

.watch h1 {
  font-size: clamp(32px,4vw,54px);
}

.watch-title>span {
  font-size: 14px;
  font-weight: 650;
}

.watch-tip {
  color: var(--muted);
  font-size: 14px;
  margin: 8px 0 12px;
}

.wall {
  min-height: 0;
  flex: 1;
  display: grid;
  gap: var(--gap,8px);
  justify-content: center;
  align-content: start;
  grid-template-columns: repeat(var(--cols,2),var(--card-width,145px));
  grid-auto-rows: var(--card-height,170px);
}

.watch-card {
  container-type: inline-size;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid #8e9b8d;
  border-radius: 9px;
  padding: var(--pad,6px);
  background: var(--white);
  display: grid;
  grid-template-rows: auto minmax(0,1fr);
  gap: 2px;
}

.watch-card:hover {
  border-color: var(--ink);
  background: #e9f4e4;
}

.card-head {
  display: flex;
  gap: 3px;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  line-height: 1.15;
}

.card-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--label,13px);
}

@container (max-width: 97px) {
  .card-head small {
    display: none;
  }
}

.card-head svg {
  width: var(--label,13px);
  height: var(--label,13px);
}

.mini-grid {
  height: 100%;
  max-width: 100%;
  justify-self: center;
  background: var(--ink);
  gap: 2px;
  padding: 3px;
  border-radius: 5px;
}

.mini-grid .pad {
  border-radius: 3px;
}

.results-paper {
  text-align: center;
}

.medal {
  width: 55px;
  height: 55px;
  display: grid;
  place-items: center;
  background: var(--yellow);
  border: 1.5px solid var(--ink);
  border-radius: 17px;
  margin: 0 auto 18px;
}

.medal svg {
  width: 28px;
  height: 28px;
}

.results-paper h2 {
  font-size: clamp(25px,4vw,40px);
  overflow-wrap: anywhere;
}

.results-paper>.hint {
  margin: 8px 0 18px;
}

.results-paper>.action {
  margin-top: 17px;
}

.rank {
  text-align: left;
}

.rank b {
  font-family: var(--mono);
  min-width: 27px;
}

.rank span {
  font-weight: 650;
}

.rank.winner b {
  color: #397141;
}

dialog {
  width: min(460px,calc(100% - 32px));
  max-height: 90dvh;
  overflow: auto;
  padding: 25px;
  border: 2px solid var(--ink);
  border-radius: 17px;
  background: var(--white);
  color: var(--ink);
  box-shadow: 4px 5px 0 #20292366;
}

dialog::backdrop {
  background: #14221bb8;
}

dialog h2 {
  font-size: 30px;
  overflow-wrap: anywhere;
}

dialog h3 {
  font-size: 16px;
  margin: 18px 0 5px;
}

dialog p {
  margin-top: 8px;
}

.dialog-top {
  align-items: flex-start;
}

.icon {
  border: 0;
  background: transparent;
  padding: 3px;
  display: grid;
  place-items: center;
}

.dialog-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 22px;
}

#focus-player {
  width: min(660px,calc(100% - 28px));
}

#focus-grid {
  margin: 16px auto 0;
  width: min(100%,65dvh);
}

#notice {
  position: fixed;
  z-index: 5;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: white;
  padding: 10px 18px;
  border-radius: 10px;
  box-shadow: 0 3px 12px #0003;
  font-size: 14px;
  text-align: center;
  max-width: 92vw;
}

@media(max-width:740px) {
  .mast-inner {
    height: 59px;
  }
  .home {
    grid-template-columns: 1fr;
    gap: 27px;
    padding: 30px 0 32px;
  }
  .intro {
    max-width: 450px;
    width: 100%;
    margin: auto;
  }
  .intro h1 {
    font-size: clamp(62px,12vw,85px);
  }
  .lead {
    margin-top: 7px;
  }
  .mode-list {
    max-width: none;
    margin: 20px 0 16px;
    gap: 10px;
  }
  .mode {
    min-height: 52px;
  }
  .poster {
    width: min(100%,450px);
    margin: auto;
    aspect-ratio: 1.45;
    padding: 22px;
  }
  .instrument {
    width: 58%;
    min-width: 165px;
    padding: 12px;
  }
  .instrument-head {
    margin-bottom: 8px;
  }
  .instrument-foot {
    margin-top: 8px;
  }
  .demo-grid {
    gap: 5px;
  }
  .demo-tile {
    border-radius: 6px;
  }
  .instrument-head .mono {
    font-size: 8px;
    gap: 4px;
  }
  .instrument-head .mono:last-child {
    font-size: 8px;
  }
  .watch {
    height: calc(100dvh - 59px);
  }
}

@media(max-height:540px) and (min-width:600px) {
  .mast-inner {
    height: 48px;
  }
  .play,.watch {
    padding-top: 8px;
  }
  .play-top {
    margin-bottom: 2px;
  }
  .phase {
    margin: 2px 0 6px;
  }
  .play-zone {
    width: min(55vh,360px);
  }
  .watch {
    height: calc(100dvh - 48px);
  }
}

@media(prefers-reduced-motion:reduce) {
  *,*:before,*:after {
    transition: none!important;
    scroll-behavior: auto!important;
  }
  .instrument {
    transform: none;
  }
}

@media(max-width:480px) {
  #focus-player {
    width: calc(100% - 12px);
    padding: 12px;
  }
  .card-head small {
    font-size: var(--label,12px);
  }
}

/* Accueil des jokers */
.time-warning {
  outline: 4px solid #d52b32;
  outline-offset: 2px;
  animation: warning-outline 1s steps(1, end) infinite;
}
@keyframes warning-outline {
  50% { outline-color: transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .time-warning { animation: none; }
}
.picker { padding: clamp(32px, 7vh, 78px) 0 42px; }
.picker h1 { font-size: clamp(42px, 5.5vw, 78px); margin-bottom: clamp(22px, 4vh, 42px); }
.games { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(14px, 2.5vw, 30px); }
.game-card { display: grid; text-align: left; border: 2px solid var(--ink); background: var(--white); border-radius: 22px; padding: 0 0 24px; overflow: hidden; box-shadow: 3px 4px 0 var(--ink); }
.game-card:hover { transform: translateY(-2px); box-shadow: 4px 6px 0 var(--ink); }
.game-art { display: grid; place-items: center; height: clamp(165px, 29vh, 286px); border-bottom: 2px solid var(--ink); background-size: 9px 9px; background-image: radial-gradient(#334e342b 1px, transparent 1px); }
.sequence-art { background-color: #b5e7b2; }
.chimp-art { background-color: #ffd28a; }
.visual-art, .visual .poster { background-color: #c9c4f2; }
.preview-grid, .scatter { background: var(--ink); border-radius: 14px; box-shadow: 0 5px 0 #0003; }
.preview-grid { width: clamp(110px, 20vh, 185px); aspect-ratio: 1; padding: 9px; gap: 5px; display: grid; grid-template-columns: repeat(3, 1fr); transform: rotate(-5deg); }
.preview-grid i { border-radius: 5px; background: #47574a; }
.preview-grid i:nth-child(5) { background: var(--yellow); }
.visual-art .preview-grid { transform: rotate(-3deg); }
.visual-art .preview-grid i:is(:first-child,:nth-child(5),:nth-child(6)),
.visual .pad.lit, .visual .demo-tile.lit { background: #f6f3ff; border-color: white; box-shadow: none; }
.visual .demo-tile.found { background: var(--green); }
.visual .demo-tile.lit:after, .visual .demo-tile.found:after { display: none; }
.visual .board, .visual .mini-grid { grid-template: repeat(var(--visual-side,3),minmax(0,1fr)) / repeat(var(--visual-side,3),minmax(0,1fr)); }
.visual .mini-grid.time-warning { outline-offset: -2px; }
.scatter { width: clamp(150px, 25vh, 235px); aspect-ratio: 1.3; position: relative; transform: rotate(4deg); }
.scatter i { display: grid; place-items: center; position: absolute; width: 23%; aspect-ratio: 1; border-radius: 6px; background: #ffe3a9; color: var(--ink); font: 700 clamp(16px, 3.2vh, 32px) var(--mono); }
.scatter i:nth-child(1) { left: 10%; top: 11%; }
.scatter i:nth-child(2) { right: 11%; top: 18%; }
.scatter i:nth-child(3) { left: 23%; bottom: 14%; }
.scatter i:nth-child(4) { right: 24%; bottom: 9%; }
.game-caption { display: flex; align-items: center; justify-content: space-between; padding: 20px 22px 6px; }
.game-caption strong { font-size: clamp(26px, 3vw, 42px); letter-spacing: -.05em; }
.game-caption svg { width: 32px; height: 32px; padding: 5px; border: 1px solid var(--ink); border-radius: 50%; }
.game-desc { display: block; padding: 0 22px; color: var(--muted); line-height: 1.45; }
.chimp-only, .visual-only, .chimp .sequence-only, .visual .sequence-only { display: none; }
.chimp .chimp-only, .visual .visual-only { display: revert; }
.chimp .poster { background-color: #ffd28a; }
.chimp .demo-tile { display: grid; place-items: center; color: var(--ink); font: 700 clamp(14px, 3vw, 32px) var(--mono); }
.chimp .demo-tile:after { display: none; }
.chimp .play-zone { width: min(100%, 810px, 106vh); }
.chimp .board, .chimp .mini-grid { aspect-ratio: 8/5; grid-template: repeat(5,minmax(0,1fr)) / repeat(8,minmax(0,1fr)); }
.chimp .mini-grid { align-self: center; width: 100%; height: auto; }
.chimp .board .pad, .chimp .mini-grid .pad { display: grid; place-items: center; color: var(--ink); background: transparent; border-color: transparent; cursor: default; }
.chimp .board .occupied, .chimp .mini-grid .occupied { background: #ffe3a9; border-color: #ffe3a9; }
.chimp .board .occupied:not(:disabled) { cursor: pointer; }
.chimp .board .pad { font: 700 clamp(15px, 3vw, 36px) var(--mono); }
.chimp .mini-grid .pad { font: 700 clamp(5px, 6cqw, 20px) var(--mono); }
.chimp .pad.tap { background: var(--green); }
.chimp .pad.wrong { background: #ff927b; }
.chimp #focus-grid { width: min(100%, 95vh); }
#continue-chimp { margin-top: 12px; }
@media (max-width: 740px) {
  .games { grid-template-columns: 1fr; }
  .game-card { grid-template-columns: 35% 1fr; grid-template-rows: auto auto; padding: 0; }
  .game-art { grid-row: span 2; height: 146px; border-bottom: 0; border-right: 2px solid var(--ink); }
  .preview-grid, .scatter { width: 74%; }
  .game-caption { align-self: end; gap: 3px; padding: 14px 12px 5px; }
  .game-desc { padding: 0 12px 12px; font-size: 14px; }
  .chimp .board { gap: 4px; padding: 6px; }
  .chimp .board .pad { border-radius: 5px; }
}
