/* ============================== the lounge =============================== */
.lounge { display: flex; flex-direction: column; gap: 12px; }
.lounge-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
}
.lounge-head h2 {
  margin: 0;
  font-size: clamp(13px, 3.6vw, 16px);
  font-weight: 800;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.lounge-head p {
  margin: 0;
  flex: 1 1 100%;
  order: 3;
  font-size: 13.5px;
  color: var(--ink-faint);
  max-width: 64ch;
}
.icon-btn {
  margin-left: auto;
  min-width: 44px;
  min-height: 40px;
  border: 1px solid var(--rule);
  border-radius: 999px;
  background: transparent;
  cursor: pointer;
  font-size: 15px;
  line-height: 1;
  touch-action: manipulation;
}
.icon-btn[aria-pressed="false"] { opacity: .45; }

/* ------------------------------------------------------------ the menu --- */
.games {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 560px) { .games { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 820px) { .games { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

.game-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-height: 108px;
  padding: 12px 12px 11px;
  text-align: left;
  background: var(--pass);
  border: 1px solid var(--pass-rule);
  border-radius: 12px;
  box-shadow: 0 10px 22px -20px rgba(16, 32, 52, .7);
  color: var(--pass-ink);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 120ms ease, border-color 120ms ease;
}
.game-card:active { transform: scale(.975); }
@media (hover: hover) { .game-card:hover { border-color: var(--accent); } }
.game-card .gi { font-size: 24px; line-height: 1.1; }
.game-card .gn {
  font-size: clamp(12.5px, 3.5vw, 14px);
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.25;
}
.game-card .gb {
  margin-top: auto;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--pass-soft);
  font-variant-numeric: tabular-nums;
}
.game-card .gb.has { color: var(--accent); }

/* ----------------------------------------------------------- the stage --- */
.stage {
  background: var(--pass);
  border: 1px solid var(--pass-rule);
  border-radius: var(--r);
  box-shadow: var(--shadow);
  padding: 10px clamp(10px, 3vw, 18px) clamp(12px, 3vw, 18px);
  display: flex;
  flex-direction: column;
  gap: 10px;
  color: var(--pass-ink);
}
.stage[hidden] { display: none; }

.stage-bar {
  display: flex;
  align-items: center;
  gap: 8px 10px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--pass-rule);
}
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 12px 0 8px;
  border: 1px solid var(--pass-rule);
  border-radius: 999px;
  background: transparent;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  flex: 0 0 auto;
}
.stage-name {
  font-size: clamp(12px, 3.4vw, 14px);
  font-weight: 800;
  letter-spacing: .04em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.stage-score {
  margin-left: auto;
  flex: 0 0 auto;
  font-size: clamp(11px, 3.2vw, 13px);
  font-weight: 800;
  letter-spacing: .08em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stage-play { position: relative; }
/* A DOM game builds nothing until it starts, so the play area would be 0 tall
   and the overlay would collapse onto its own buttons. While the overlay is up,
   hold the box open. Every game's real content is taller than this, so playing
   never sees it. */
.stage-play.veiled { min-height: clamp(300px, 44svh, 400px); }

.stage-frame {
  --arn: .75;
  position: relative;
  width: 100%;
  max-width: calc(min(62svh, 560px) * var(--arn));
  aspect-ratio: var(--ar, 3 / 4);
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--fr) 22%, var(--pass)) 0%,
    color-mix(in srgb, var(--fr) 7%, var(--pass)) 100%);
  border: 1px solid var(--pass-rule);
}
.stage-frame[hidden] { display: none; }
.stage-frame canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.dom-stage { display: block; }
.dom-stage[hidden] { display: none; }

.stage-hint {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--pass-soft);
  min-height: 2.6em;
}

/* on-screen controls, because a phone has no arrow keys */
.pads {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.pads[hidden] { display: none; }
.pad {
  min-width: 0;
  min-height: 54px;
  padding: 0 6px;
  border: 1px solid var(--pass-rule);
  border-radius: 10px;
  background: color-mix(in srgb, var(--pass-ink) 5%, transparent);
  font-size: clamp(15px, 4.4vw, 19px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}
.pad:active { background: color-mix(in srgb, var(--accent) 22%, transparent); }

/* the overlay that covers the play area between rounds */
.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2.6vw, 18px);
  padding: clamp(20px, 5vw, 32px) clamp(16px, 4vw, 28px);
  text-align: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--pass) 90%, transparent);
  backdrop-filter: blur(3px);
  z-index: 3;
}
.overlay[hidden] { display: none; }
.overlay .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.overlay .big {
  font-size: clamp(21px, 6.2vw, 29px);
  font-weight: 800;
  line-height: 1.15;
  margin: 0;
  max-width: 20ch;
}
.overlay .sub {
  font-size: clamp(13.5px, 3.8vw, 15px);
  line-height: 1.5;
  color: var(--pass-soft);
  margin: 0;
  max-width: 40ch;
}
.btn {
  min-height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 999px;
  background: var(--ink);
  color: var(--pass);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation;
}
.btn.ghost {
  background: transparent;
  color: var(--pass-ink);
  border: 1px solid var(--pass-rule);
}

/* ---------------------------------------------------- DOM game surfaces --- */

/* mémoire */
.mem {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(6px, 2vw, 10px);
  max-width: 420px;
  margin: 0 auto;
}
.mem-card {
  aspect-ratio: 3 / 4;
  border: 1px solid var(--pass-rule);
  border-radius: 9px;
  background: color-mix(in srgb, var(--fr) 14%, var(--pass));
  font-size: clamp(22px, 8vw, 34px);
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 160ms ease, background-color 160ms ease;
  transform-style: preserve-3d;
  padding: 0;
  color: transparent;
}
.mem-card .face { transition: opacity 120ms ease; opacity: 0; }
.mem-card.up, .mem-card.done { background: var(--pass); color: var(--pass-ink); }
.mem-card.up .face, .mem-card.done .face { opacity: 1; }
.mem-card.up { transform: rotateY(180deg) scaleX(-1); }
.mem-card.done { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, var(--pass)); cursor: default; }
.mem-card.miss { border-color: var(--alert); background: color-mix(in srgb, var(--alert) 16%, var(--pass)); }
.mem-note {
  margin: 10px 0 0;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--ok);
  min-height: 1.4em;
}

/* quiz + mots — same shape */
.ask {
  max-width: 520px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ask-meta {
  display: flex;
  gap: 10px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--pass-soft);
}
.ask-meta .r { margin-left: auto; color: var(--accent); }
.ask-q {
  margin: 0;
  font-size: clamp(17px, 5vw, 22px);
  font-weight: 700;
  line-height: 1.3;
  min-height: 2.6em;
  display: flex;
  align-items: center;
}
.ask-q .lead {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--pass-soft);
  margin-bottom: 6px;
}
.ask-opts { display: grid; gap: 9px; }
.opt {
  min-height: 54px;
  padding: 10px 16px;
  text-align: left;
  border: 1px solid var(--pass-rule);
  border-radius: 11px;
  background: color-mix(in srgb, var(--pass-ink) 4%, transparent);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}
@media (hover: hover) { .opt:hover { border-color: var(--accent); } }
.opt.good { background: color-mix(in srgb, var(--ok) 22%, transparent); border-color: var(--ok); }
.opt.bad  { background: color-mix(in srgb, var(--alert) 20%, transparent); border-color: var(--alert); }
.opt:disabled { cursor: default; opacity: .95; }
.timebar {
  height: 6px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--pass-ink) 10%, transparent);
  overflow: hidden;
}
.timebar i {
  display: block;
  height: 100%;
  width: 100%;
  background: var(--accent);
  transform-origin: left;
}

/* séquence — runway lights */
.runway {
  max-width: 420px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (min-width: 520px) { .runway { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.light {
  aspect-ratio: 4 / 3;
  border-radius: 12px;
  border: 1px solid var(--pass-rule);
  background: color-mix(in srgb, var(--c) 22%, var(--pass));
  cursor: pointer;
  touch-action: manipulation;
  transition: background-color 90ms linear, box-shadow 90ms linear, transform 90ms ease;
  position: relative;
  overflow: hidden;
}
.light::after {
  content: "";
  position: absolute;
  left: 50%; top: 50%;
  width: 26%; aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: color-mix(in srgb, var(--c) 55%, var(--pass));
}
.light.on {
  background: var(--c);
  box-shadow: 0 0 26px -2px var(--c), inset 0 0 20px rgba(255,255,255,.35);
  transform: scale(1.02);
}
.light.on::after { background: rgba(255,255,255,.85); }
.light:disabled { cursor: default; }

/* ------------------------------------------------------------- extras ---- */
.debug {
  font-size: 11.5px;
  line-height: 1.65;
  color: var(--ink-soft);
  background: color-mix(in srgb, var(--ink) 6%, transparent);
  border: 1px dashed var(--rule);
  border-radius: 10px;
  padding: 12px 14px;
  white-space: pre-wrap;
  overflow-x: auto;
}
.debug[hidden] { display: none; }

footer.strip-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 16px;
  font-size: 11px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--ink-faint);
  border-top: 1px solid var(--rule);
  padding-top: 14px;
}


