:root {
  color-scheme: light;
  --ink: #1b2540;
  --muted: #64708a;
  --paper: #fffdf8;
  --cream: #f7f1e5;
  --line: #e8dfd1;
  --blue: #2f65d9;
  --blue-dark: #214ca9;
  --blue-soft: #eaf0ff;
  --yellow: #f7bd4c;
  --yellow-soft: #fff3d4;
  --green: #238a66;
  --green-soft: #e7f7ef;
  --coral: #e56f5f;
  --coral-soft: #fff0ed;
  --shadow: 0 18px 50px rgba(40, 54, 91, 0.1);
  font-family: "Trebuchet MS", "Avenir Next", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--cream);
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at 6% 4%, rgba(247, 189, 76, 0.22), transparent 22rem),
    radial-gradient(circle at 94% 19%, rgba(47, 101, 217, 0.11), transparent 24rem),
    var(--cream);
}

button,
a,
select {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
select:focus-visible {
  outline: 4px solid rgba(47, 101, 217, 0.32);
  outline-offset: 3px;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 28px 0 22px;
}

.brand {
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 14px 14px 14px 4px;
  color: var(--blue);
  background: var(--yellow);
  font-size: 1.45rem;
  font-weight: 900;
  transform: rotate(-7deg);
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  letter-spacing: -0.02em;
  font-size: 1.05rem;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 0.75rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(255, 253, 248, 0.75);
  font-size: 0.82rem;
  font-weight: 700;
}

.progress-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 4px var(--yellow-soft);
}

.button {
  min-height: 44px;
  padding: 10px 17px;
  border: 2px solid transparent;
  border-radius: 13px;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover {
  transform: translateY(-2px);
}

.button-primary {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 9px 18px rgba(47, 101, 217, 0.22);
}

.button-primary:hover {
  background: var(--blue-dark);
}

.button-secondary {
  color: var(--ink);
  border-color: var(--line);
  background: var(--paper);
}

.button-secondary:hover {
  border-color: var(--blue);
}

.button-quiet {
  min-height: 38px;
  padding: 7px 12px;
  color: var(--muted);
  background: transparent;
}

.button-quiet:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.55);
}

main {
  flex: 1;
  padding: 28px 0 60px;
}

.hero {
  max-width: 760px;
  margin-bottom: clamp(36px, 5vw, 56px);
  padding-inline: clamp(12px, 3vw, 36px);
}

.eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 700px;
  margin-bottom: 15px;
  font-size: clamp(2.35rem, 6vw, 4.65rem);
  line-height: 0.98;
  letter-spacing: -0.06em;
}

h2 {
  margin-bottom: 10px;
  font-size: clamp(1.7rem, 3vw, 2.45rem);
  letter-spacing: -0.04em;
}

h3 {
  margin-bottom: 8px;
  font-size: 1.15rem;
}

.lead {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.map-board {
  position: relative;
  padding: clamp(32px, 7vw, 78px);
  border: 1px solid var(--line);
  border-radius: 30px;
  background: #fffdf8;
  box-shadow: var(--shadow);
}

.map-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
}

.map-heading p {
  max-width: 380px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
  text-align: right;
}

.map-territory {
  position: relative;
  isolation: isolate;
  min-height: 650px;
  overflow: hidden;
  padding: 10px 0;
  border: 1px solid #d8e4c4;
  border-radius: 26px;
  background: #eaf1d9;
}

.map-art {
  position: absolute;
  z-index: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.map-island {
  fill: #f0f3db;
  stroke: #d3e2be;
  stroke-width: 4;
}

.map-water {
  fill: none;
  stroke: #b6dce5;
  stroke-width: 34;
  stroke-linecap: round;
  opacity: 0.72;
}

.map-path-edge,
.map-path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-path-edge {
  stroke: #fff9e8;
  stroke-width: 23;
}

.map-path {
  stroke: #e8b44e;
  stroke-width: 9;
  stroke-dasharray: 2 17;
}

.map-hill {
  fill: rgba(105, 163, 97, 0.24);
}

.job-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: repeat(3, minmax(200px, 1fr));
  gap: 14px 18px;
}

.job-card {
  position: relative;
  width: min(100%, 230px);
  min-height: 154px;
  padding: 16px 14px 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-self: center;
  align-self: center;
  border: 2px solid rgba(91, 112, 78, 0.2);
  border-radius: 20px 20px 20px 8px;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.96);
  box-shadow: 0 10px 20px rgba(50, 75, 58, 0.13);
  text-align: center;
  backdrop-filter: blur(3px);
  transition: transform 180ms ease, box-shadow 180ms ease, border 180ms ease;
}

.job-card:nth-child(1) { grid-column: 1; grid-row: 1; }
.job-card:nth-child(2) { grid-column: 2; grid-row: 1; }
.job-card:nth-child(3) { grid-column: 3; grid-row: 1; }
.job-card:nth-child(4) { grid-column: 3; grid-row: 2; }
.job-card:nth-child(5) { grid-column: 2; grid-row: 2; }
.job-card:nth-child(6) { grid-column: 1; grid-row: 2; }
.job-card:nth-child(7) { grid-column: 1; grid-row: 3; }
.job-card:nth-child(8) { grid-column: 2; grid-row: 3; }
.job-card:nth-child(9) { grid-column: 3; grid-row: 3; }

.job-card:hover {
  border-color: var(--blue);
  box-shadow: 0 15px 26px rgba(47, 101, 217, 0.2);
  transform: translateY(-4px) rotate(-1deg);
}

.job-card.is-complete {
  border-color: rgba(35, 138, 102, 0.48);
  background: linear-gradient(145deg, #fffdf8, var(--green-soft));
}

.job-number {
  position: absolute;
  top: 10px;
  right: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.job-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 0 5px;
  border-radius: 18px;
  background: var(--blue-soft);
  font-size: 2rem;
}

.job-card:nth-child(2) .job-icon {
  background: var(--yellow-soft);
}

.job-card:nth-child(3) .job-icon {
  background: var(--coral-soft);
}

.job-card:nth-child(4) .job-icon,
.job-card:nth-child(7) .job-icon {
  background: var(--green-soft);
}

.job-card:nth-child(5) .job-icon,
.job-card:nth-child(8) .job-icon {
  background: var(--yellow-soft);
}

.job-card:nth-child(6) .job-icon,
.job-card:nth-child(9) .job-icon {
  background: var(--coral-soft);
}

.job-card h3 {
  margin-bottom: 5px;
  font-size: 1rem;
  line-height: 1.2;
}

.job-card-action,
.completed-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: auto;
  font-size: 0.78rem;
  font-weight: 900;
}

.job-card-action {
  color: var(--blue);
}

.completed-label {
  color: var(--green);
}

.finish-panel {
  position: relative;
  z-index: 1;
  margin-top: 26px;
  padding: 23px 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 2px solid rgba(35, 138, 102, 0.3);
  border-radius: 20px;
  background: var(--green-soft);
}

.finish-panel p {
  margin: 0;
  color: #27684f;
  line-height: 1.5;
}

.finish-panel strong {
  display: block;
  margin-bottom: 3px;
  color: var(--green);
}

.job-view {
  max-width: 880px;
  margin: 0 auto;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 27px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 800;
  text-decoration: none;
}

.back-link:hover {
  color: var(--blue);
}

.job-intro {
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  align-items: center;
  gap: 30px;
  margin-bottom: 28px;
  padding: clamp(24px, 5vw, 45px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.job-illustration {
  min-height: 190px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 5rem;
  font-weight: 900;
}

.job-view[data-job="professeur"] .job-illustration {
  color: #a26b14;
  background: var(--yellow-soft);
}

.job-view[data-job="informaticien"] .job-illustration {
  color: #b84d42;
  background: var(--coral-soft);
}

.job-intro p {
  color: var(--muted);
  line-height: 1.65;
}

.challenge-panel {
  padding: clamp(22px, 5vw, 38px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255, 253, 248, 0.82);
}

.challenge-kicker {
  margin-bottom: 8px;
  color: var(--blue);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.challenge-intro {
  max-width: 690px;
  margin-bottom: 24px;
  color: var(--muted);
  line-height: 1.55;
}

.challenge-duration {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.challenge-items {
  display: grid;
  gap: 11px;
  margin: 22px 0;
}

.sequence-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sequence-list button {
  width: 100%;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 2px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: var(--paper);
  text-align: left;
  transition: border 160ms ease, background 160ms ease, transform 160ms ease;
}

.sequence-list button:hover {
  border-color: var(--blue);
  transform: translateX(4px);
}

.sequence-list button:disabled {
  cursor: default;
}

.step-number {
  width: 25px;
  height: 25px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-size: 0.8rem;
  font-weight: 900;
}

.chosen-sequence {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
  margin-bottom: 19px;
  padding: 9px 11px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.45);
  font-size: 0.86rem;
}

.chosen-sequence span {
  padding: 5px 9px;
  border-radius: 8px;
  color: var(--blue-dark);
  background: var(--blue-soft);
  font-weight: 800;
}

.match-grid {
  display: grid;
  gap: 13px;
  margin: 20px 0;
}

.match-row {
  display: grid;
  grid-template-columns: 1fr minmax(180px, 0.9fr);
  align-items: center;
  gap: 15px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
}

.match-row label {
  font-weight: 800;
  line-height: 1.35;
}

select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  background: #fff;
}

.logic-code {
  display: grid;
  gap: 8px;
  margin: 20px 0;
  padding: 17px;
  border-radius: 15px;
  background: #202b49;
}

.logic-code button {
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 9px;
  color: #f3f6ff;
  background: #2c3a61;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88rem;
  text-align: left;
}

.logic-code button:hover {
  border-color: var(--yellow);
  background: #394b79;
}

.feedback {
  margin: 20px 0 0;
  padding: 13px 15px;
  border-radius: 12px;
  color: #7d332c;
  background: var(--coral-soft);
  font-weight: 700;
  line-height: 1.45;
}

.feedback.success {
  color: #21664b;
  background: var(--green-soft);
}

.challenge-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 22px;
}

.success-card {
  padding: 28px;
  border: 2px solid rgba(35, 138, 102, 0.3);
  border-radius: 20px;
  background: var(--green-soft);
}

.success-card h3 {
  color: var(--green);
}

.success-card p {
  margin-bottom: 0;
  color: #27684f;
  line-height: 1.6;
}

.empty-state {
  padding: 50px 20px;
  text-align: center;
}

.site-footer {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 0 25px;
  color: var(--muted);
  font-size: 0.75rem;
}

@media (max-width: 780px) {
  .site-header,
  .header-actions,
  .map-heading,
  .finish-panel,
  .site-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-header {
    gap: 16px;
  }

  .map-board {
    padding: 34px;
  }

  .header-actions {
    width: 100%;
    gap: 8px;
  }

  .progress-chip {
    width: 100%;
  }

  .header-actions .button {
    align-self: flex-start;
  }

  .map-heading p {
    text-align: left;
  }

  .map-territory {
    min-height: 0;
    overflow: visible;
    padding: 0;
    border: 0;
    background: transparent;
  }

  .map-art {
    display: none;
  }

  .job-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: none;
    gap: 12px;
    padding: 10px 0 10px 42px;
  }

  .job-grid::before {
    position: absolute;
    top: 28px;
    bottom: 28px;
    left: 18px;
    width: 5px;
    border-radius: 999px;
    background: repeating-linear-gradient(
      to bottom,
      var(--yellow) 0 10px,
      transparent 10px 19px
    );
    content: "";
  }

  .job-card {
    width: 100%;
    max-width: none;
    min-height: 96px;
    padding: 12px 36px 12px 12px;
    display: grid;
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-rows: auto auto;
    justify-self: stretch;
    align-self: stretch;
    gap: 5px 12px;
    border-radius: 16px;
    text-align: left;
  }

  .job-card:nth-child(n) {
    grid-column: auto;
    grid-row: auto;
  }

  .job-card .job-icon {
    width: 46px;
    height: 46px;
    grid-column: 1;
    grid-row: 1 / span 2;
    margin: 0;
    border-radius: 14px;
    font-size: 1.65rem;
  }

  .job-card h3 {
    grid-column: 2;
    grid-row: 1;
    align-self: end;
    margin: 0;
    text-align: left;
  }

  .job-card-action,
  .job-card .completed-label {
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    margin: 0;
  }

  .job-intro {
    grid-template-columns: 1fr;
  }

  .job-illustration {
    min-height: 135px;
  }
}

@media (max-width: 520px) {
  .page-shell {
    width: min(100% - 22px, 1180px);
  }

  main {
    padding-top: 18px;
  }

  h1 {
    font-size: clamp(2.3rem, 15vw, 3.8rem);
  }

  .map-board,
  .job-intro,
  .challenge-panel {
    border-radius: 21px;
  }

  .map-board {
    padding: 24px 18px;
  }

  .match-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
