@font-face {
  font-family: Montserrat;
  src: url("assets/montserrat-semibold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Open Sans";
  src: url("assets/open-sans.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}

:root {
  --blue: #04468b;
  --ink: #19364e;
  --muted: #4c6274;
  --orange: #f99a22;
  --pale: #edf5fa;
  --warm: #fff8e9;
  --border: #d7e3eb;
  --white: #fff;
  color: var(--ink);
  background: #f6fafe;
  font-family: "Open Sans", sans-serif;
  font-size: clamp(16px, 1.4vw, 18px);
  line-height: 1.55;
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--blue); text-underline-offset: 3px; }
h1, h2, h3, .button, .stage-top strong { font-family: Montserrat, sans-serif; font-weight: 600; }
h1, h2, h3 { color: var(--blue); line-height: 1.2; }
h1 { font-size: clamp(2.4rem, 6vw, 4.25rem); letter-spacing: -.04em; margin: .25em 0 .35em; }
h2 { font-size: clamp(1.45rem, 3.2vw, 2rem); margin: 0 0 .55em; }
p { margin: 0 0 .9em; }
button { font-size: inherit; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
[hidden] { display: none !important; }
.wrap { width: min(calc(100% - 2.35rem), 1184px); margin-inline: auto; }
.skip, .visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.skip:focus { width: auto; height: auto; clip-path: none; padding: .5rem; z-index: 2; background: var(--white); }
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 105px; border-bottom: 1px solid var(--border); }
.top img { display: block; width: 130px; height: auto; }
.top nav { display: flex; flex-wrap: wrap; gap: .35rem 1.05rem; font-size: .9rem; }
.top nav a { padding: .3rem 0; }
.top nav [aria-current] { text-decoration-color: var(--orange); text-decoration-thickness: 3px; }
.layout { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 6fr); align-items: start; gap: clamp(1.25rem, 4vw, 3.25rem); padding: clamp(2rem, 6vw, 4.2rem) 0 2rem; }
.intro { padding: .25rem 0; }
.label { display: flex; align-items: center; gap: .55rem; color: var(--blue); font-size: .88rem; }
.lead { font-size: 1.2rem; line-height: 1.39; color: var(--blue); }
.stage-link { display: none; }
.with-cubes { list-style: none; padding-left: 0; margin: 1.3rem 0; }
.with-cubes li { background: url("assets/puce.png") no-repeat left .24em / 1em; padding-left: 1.45em; margin-bottom: .5rem; }
.note { border-left: 4px solid var(--orange); background: var(--warm); border-radius: 0 8px 8px 0; padding: .8rem .95rem; color: var(--ink); font-size: .88rem; }
.eykon { display: block; width: clamp(90px, 20vw, 172px); height: auto; margin: .35rem auto .65rem; }
.stage { background: var(--white); border: 1px solid var(--border); border-radius: 12px; box-shadow: 0 15px 44px #04468b12; overflow: hidden; scroll-margin-top: .75rem; }
.stage-top { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem 1rem; padding: .9rem clamp(.8rem, 4vw, 1.6rem); border-bottom: 1px solid var(--border); background: var(--pale); color: var(--blue); }
.stage-top::before { position: absolute; content: ""; inset: 0 0 auto; height: 4px; background: linear-gradient(to right, var(--blue) 80%, var(--orange) 80%); }
.counter { border: 1px solid var(--border); border-radius: 999px; padding: .2rem .55rem; background: var(--white); color: var(--blue); font-size: .81rem; margin: 0; font-variant-numeric: tabular-nums; }
.exercise { min-height: 340px; padding: clamp(1rem, 4vw, 1.6rem); }
.exercise h2:focus { outline: none; }
.actions { display: flex; flex-wrap: wrap; gap: .6rem; margin-top: 1.15rem; }
.button { color: var(--white); background: var(--blue); border: 2px solid var(--blue); border-radius: 8px; min-height: 46px; padding: .56rem .82rem; line-height: 1.32; cursor: pointer; }
a.button { display: inline-flex; align-items: center; text-decoration: none; }
.button.secondary { color: var(--blue); background: var(--white); }
.button:disabled { cursor: not-allowed; opacity: .6; }
@media (hover: hover) { .button:not(:disabled):hover { box-shadow: 0 0 0 2px var(--pale); } }
.board { border: 1px solid var(--border); border-radius: 12px; background: var(--pale); min-height: 232px; padding: .8rem; display: grid; place-items: center; margin: .8rem 0; }
.number-stimulus { color: var(--blue); font: 600 clamp(3rem, 9vw, 5rem)/1 Montserrat, sans-serif; }
.number-pad { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .4rem; max-width: 390px; width: 100%; }
.word-pad { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; width: 100%; }
.grid-pad { display: grid; grid-template-columns: repeat(3, 1fr); width: min(100%, 204px); gap: .32rem; }
.choice { min-width: 0; border-radius: 8px; min-height: 44px; border: 1px solid var(--border); background: var(--white); color: var(--blue); padding: .4rem .25rem; cursor: pointer; overflow-wrap: anywhere; }
.choice:disabled { cursor: default; }
.choice.chosen { color: var(--white); background: var(--blue); border-color: var(--blue); }
.cell { aspect-ratio: 1; min-height: 0; }
.cell.active { background: var(--orange); border-color: var(--blue); box-shadow: inset 0 0 0 3px var(--white); }
.cell.empty { color: var(--muted); }
.answer-line { width: 100%; min-height: 2.1em; color: var(--blue); overflow-wrap: anywhere; }
.response-board { gap: .7rem; }
.result { margin: .7rem 0 1rem; border: 1px solid var(--border); border-radius: 12px; padding: .8rem; background: var(--pale); }
.result p:last-child, .note p:last-child { margin-bottom: 0; }
.result-list { padding-left: 1.25rem; }
.result-list li { margin-bottom: .35rem; }
.score { display: inline-block; color: var(--blue); font: 600 1.9rem Montserrat, sans-serif; }
.mission { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .55rem; padding: 0; list-style: none; margin: 0; }
.mission li { padding: .5rem .75rem; background: var(--white); border: 1px solid var(--border); border-radius: 8px; color: var(--blue); }
.footer { border-top: 1px solid var(--border); padding: .9rem 0 1.2rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: .55rem; font-size: .85rem; }

@media (max-width: 720px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: .65rem; padding-top: 1.45rem; }
  .top { min-height: 78px; }
  .top img { width: min(30vw, 112px); }
  .top nav { justify-content: flex-end; }
  .intro { position: relative; }
  .stage-link { display: inline-flex; min-height: 44px; align-items: center; margin: -.2rem 0 .5rem; }
  body[data-experience="memo"] .intro .lead { padding-right: 5.25rem; }
  .eykon { position: absolute; top: 4.05rem; right: 0; width: 78px; }
  .exercise { min-height: 310px; }
}

@media (max-width: 355px) {
  .wrap { width: calc(100% - 1.25rem); }
  .top nav { gap: .25rem .6rem; }
  body[data-experience="memo"] .intro .lead { padding-right: 3.8rem; }
  .eykon { width: 62px; }
}
