/** @format */

@font-face {
  font-family: "Aldrich";
  src: url("fonts/Aldrich-Regular.ttf") format("truetype");
  font-display: swap;
}

@font-face {
  font-family: "Marianne";
  src: url("fonts/Marianne-Regular.woff") format("woff");
  font-display: swap;
}

:root {
  color-scheme: light;
  font-family: "Marianne", Arial, Helvetica, sans-serif;
  color: #20233a;
  background: #f4f6fc;
  --app-primary: #283fb0;
  --app-primary-dark: #1e2f89;
  --app-accent: #7057e8;
  --surface: #fff;
  --surface-soft: #f4f6fc;
  --surface-tint: #eef1ff;
  --text: #20233a;
  --muted: #666c82;
  --border: #dfe3f0;
  --success: #23834d;
  --danger: #ba3545;
  --radius-card: 18px;
  --shadow-soft: 0 8px 24px rgb(31 42 92 / 8%);
  --shadow-card: 0 12px 32px rgb(31 42 92 / 12%);
  --header-height: 64px;
}

* {
  box-sizing: border-box;
}

/* Le moteur historique calcule toutes ses positions en content-box. */
.clc,
.clc *,
.clc *::before,
.clc *::after {
  box-sizing: content-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
  color: var(--text);
  background: var(--surface-soft);
}

button {
  font: inherit;
}

button,
input,
select {
  accent-color: var(--app-primary);
}

body.session-mode #back-button,
body.session-mode #teacher-auth-button,
body.session-mode #cart-open-button,
body.session-mode #scores-open-button {
  display: none !important;
}

body.standalone-mode:not(.teacher-authenticated) #cart-open-button,
body.standalone-mode:not(.teacher-authenticated) #cart-panel[open],
body.session-mode #auth-panel[open] {
  display: none !important;
}

body.session-mode .app-header {
  padding-left: 18px;
  background:
    linear-gradient(115deg, rgb(255 255 255 / 97%), rgb(243 245 255 / 94%));
  border-bottom-color: rgb(101 91 206 / 16%);
  box-shadow: 0 5px 24px rgb(42 39 110 / 9%);
}

body.session-mode .launcher-title {
  color: #292d78;
}

.session-participant {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 8px 13px;
  color: #30336f;
  font-size: 0.92rem;
  font-weight: 800;
  white-space: nowrap;
  background: rgb(255 255 255 / 82%);
  border: 1px solid rgb(68 74 167 / 16%);
  border-radius: 999px;
  box-shadow: 0 5px 15px rgb(42 47 121 / 8%);
}

.session-live-dot {
  width: 9px;
  height: 9px;
  background: #27a866;
  border-radius: 50%;
  box-shadow: 0 0 0 4px rgb(39 168 102 / 13%);
  transition: background-color 180ms ease, box-shadow 180ms ease;
}

.session-participant[data-sync-state="sending"] .session-live-dot {
  background: #755ee8;
  box-shadow: 0 0 0 4px rgb(117 94 232 / 14%);
  animation: session-live-pulse 900ms ease-in-out infinite;
}

.session-participant[data-sync-state="error"] .session-live-dot {
  background: #d84a5f;
  box-shadow: 0 0 0 4px rgb(216 74 95 / 14%);
}

.app-header {
  position: relative;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: var(--header-height);
  align-items: center;
  height: var(--header-height);
  gap: 16px;
  padding: 7px 16px 7px 64px;
  background: rgb(255 255 255 / 94%);
  border-bottom: 1px solid rgb(211 216 233 / 86%);
  box-shadow: 0 3px 16px rgb(35 43 89 / 6%);
  backdrop-filter: blur(14px);
}

.header-button {
  position: absolute;
  left: 12px;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 8px;
  color: var(--app-primary);
  background: var(--surface-tint);
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease,
    border-color 160ms ease, translate 160ms ease;
}

.header-button:hover,
.header-button:focus-visible {
  color: var(--app-primary-dark);
  background: #e6eaff;
  border-color: rgb(40 63 176 / 18%);
  outline: 3px solid rgb(40 63 176 / 20%);
  outline-offset: 2px;
}

.header-button:hover {
  translate: -2px 0;
}

.back-button {
  left: 12px;
  padding: 2px;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 2rem;
  line-height: 1;
}

.header-context {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.header-logo {
  display: block;
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 4px 8px rgb(145 34 89 / 16%));
}

.launcher-title {
  min-width: 0;
  margin: 0;
  color: var(--app-primary);
  font-family: "Aldrich", Arial, sans-serif;
  font-size: 0.9375rem;
  font-weight: 400;
  line-height: 1.25;
  letter-spacing: 0.01em;
  text-align: center;
  text-wrap: balance;
}

.header-actions {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.tool-button {
  position: relative;
  display: inline-flex;
  min-width: 44px;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 11px;
  color: var(--app-primary-dark);
  font-size: 0.875rem;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
  background: var(--surface-tint);
  border: 1px solid rgb(40 63 176 / 12%);
  border-radius: 12px;
  cursor: pointer;
  transition: color 160ms ease, background-color 160ms ease,
    border-color 160ms ease, box-shadow 160ms ease, translate 160ms ease;
}

.tool-button:hover:not(:disabled) {
  color: var(--app-primary);
  background: #e5e9ff;
  border-color: rgb(40 63 176 / 24%);
  box-shadow: 0 7px 16px rgb(40 63 176 / 12%);
  translate: 0 -1px;
}

.tool-button:focus-visible {
  outline: 3px solid rgb(40 63 176 / 28%);
  outline-offset: 2px;
}

.tool-button:disabled {
  color: #8a8da0;
  background: #f1f2f7;
  border-color: #e1e3ec;
  cursor: not-allowed;
}

.teacher-auth-button.is-authenticated {
  color: #17633d;
  background: #ecfaf3;
  border-color: rgb(35 131 77 / 19%);
}

.teacher-auth-button.is-authenticated:hover:not(:disabled) {
  color: #0f5733;
  background: #ddf6e9;
  border-color: rgb(35 131 77 / 30%);
  box-shadow: 0 7px 16px rgb(35 131 77 / 12%);
}

.teacher-auth-button.is-authenticated .teacher-auth-icon {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  color: #fff;
  font-size: 0.72rem;
  background: #258653;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgb(35 131 77 / 11%);
}

.tool-button-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--app-primary), var(--app-accent));
  border-color: transparent;
  box-shadow: 0 7px 17px rgb(40 63 176 / 22%);
}

.tool-button-primary:hover:not(:disabled) {
  color: #fff;
  background: linear-gradient(135deg, var(--app-primary-dark), #6248db);
}

.tool-icon {
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.15rem;
  line-height: 1;
}

.tool-count {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  padding-inline: 5px;
  place-items: center;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  background: var(--app-primary);
  border: 2px solid #fff;
  border-radius: 999px;
}

.main {
  display: flex;
  width: 100%;
  height: 100vh;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 7% 8%, rgb(112 87 232 / 7%), transparent 30%),
    radial-gradient(circle at 93% 96%, rgb(40 63 176 / 6%), transparent 32%),
    var(--surface-soft);
}

body.standalone-mode .main {
  height: calc(100vh - var(--header-height));
  height: calc(100dvh - var(--header-height));
}

body.standalone-mode[data-screen="exercice"] .main {
  background: #fff;
}

.catalogue-view {
  width: 100%;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.catalogue-content {
  width: 100%;
  min-height: 100%;
}

.catalogue-content.levels-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 310px));
  gap: 40px 145px;
  justify-content: space-between;
  max-width: 1366px;
  margin: 0 auto;
  padding: 19px 73px 60px;
}

.level-card {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  padding: 0;
  color: #fff;
  background: var(--level-color);
  border: 2px solid var(--level-color);
  border-radius: 18px;
  cursor: pointer;
  box-shadow: 0 10px 24px color-mix(in srgb, var(--level-color) 16%, transparent);
  transition: transform 180ms ease, box-shadow 180ms ease,
    filter 180ms ease;
}

.level-card::before {
  position: absolute;
  inset: 13.5%;
  content: "";
  border: 4px solid #fff;
  border-radius: 14px;
}

.level-card span {
  position: relative;
  z-index: 1;
  display: grid;
  height: 100%;
  place-items: center;
  font-size: clamp(1.6rem, 3vw, 1.875rem);
  font-weight: 400;
}

.level-card:hover {
  box-shadow: 0 12px 28px color-mix(in srgb, var(--level-color) 42%, transparent);
  filter: saturate(1.05);
  transform: translateY(-4px) scale(1.01);
}

.level-card:focus-visible,
.competence-tile:focus-visible,
.difficulty-button:focus-visible {
  outline: 4px solid var(--app-primary);
  outline-offset: 5px;
}

.catalogue-content.competences-view {
  width: min(calc(100% - 48px), 1440px);
  min-height: auto;
  margin: 0 auto;
  padding: clamp(24px, 4vh, 44px) 0 72px;
}

.competences-view {
  display: grid;
  gap: clamp(20px, 2.4vw, 30px);
}

.competence-section {
  position: relative;
  display: grid;
  gap: 16px;
  padding: clamp(15px, 1.7vw, 22px);
  overflow: hidden;
  background: rgb(255 255 255 / 72%);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 9px 28px rgb(31 42 92 / 7%);
}

.competence-section::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  content: "";
  background: var(--level-color, var(--app-primary));
}

.competence-section-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 2px 13px 5px;
  border-bottom: 1px solid #e5e8f2;
}

.competence-section-title {
  min-width: 0;
  margin: 0;
  color: var(--text);
  font-family: "Aldrich", Arial, sans-serif;
  font-size: clamp(1rem, 1.6vw, 1.22rem);
  font-weight: 400;
  line-height: 1.3;
  text-wrap: balance;
}

.competence-section-count {
  display: inline-flex;
  min-height: 30px;
  flex: 0 0 auto;
  align-items: center;
  padding: 5px 10px;
  color: color-mix(
    in srgb,
    var(--level-color, var(--app-primary)) 68%,
    #20233a
  );
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
  background: color-mix(
    in srgb,
    var(--level-color, var(--app-primary)) 11%,
    #fff
  );
  border: 1px solid color-mix(
    in srgb,
    var(--level-color, var(--app-primary)) 24%,
    #e1e5f0
  );
  border-radius: 999px;
}

.catalogue-content.activities-view {
  width: min(calc(100% - 48px), 1440px);
  min-height: auto;
  margin: 0 auto;
  padding: clamp(24px, 4vh, 44px) 0 72px;
}

.selection-toolbar {
  position: sticky;
  top: 12px;
  z-index: 8;
  display: flex;
  width: fit-content;
  min-height: 48px;
  align-items: center;
  gap: 10px;
  margin: 0 0 20px auto;
  padding: 5px;
  color: var(--text);
  background: rgb(255 255 255 / 92%);
  border: 1px solid var(--border);
  border-radius: 15px;
  box-shadow: 0 9px 25px rgb(31 42 92 / 12%);
  backdrop-filter: blur(14px);
  transition: width 180ms ease, background-color 180ms ease,
    border-color 180ms ease, box-shadow 180ms ease;
}

.selection-toggle,
.selection-cart-button {
  display: inline-flex;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 13px;
  color: var(--app-primary-dark);
  font-size: 0.875rem;
  font-weight: 750;
  white-space: nowrap;
  background: var(--surface-tint);
  border: 1px solid rgb(40 63 176 / 14%);
  border-radius: 11px;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease,
    border-color 150ms ease, box-shadow 150ms ease, translate 150ms ease;
}

.selection-toggle > span[aria-hidden="true"] {
  font-size: 1.2rem;
  line-height: 0.8;
}

.selection-toggle:hover,
.selection-cart-button:hover {
  border-color: rgb(40 63 176 / 32%);
  box-shadow: 0 5px 13px rgb(40 63 176 / 12%);
  translate: 0 -1px;
}

.selection-toggle:focus-visible,
.selection-cart-button:focus-visible {
  outline: 3px solid rgb(40 63 176 / 28%);
  outline-offset: 2px;
}

.selection-help,
.selection-cart-button {
  display: none;
}

body.selection-mode .selection-toolbar {
  width: 100%;
  color: #fff;
  background: linear-gradient(
    125deg,
    rgb(40 63 176 / 96%),
    rgb(112 87 232 / 94%)
  );
  border-color: transparent;
  box-shadow: 0 12px 28px rgb(40 63 176 / 24%);
}

body.selection-mode .selection-toggle {
  color: var(--app-primary-dark);
  background: #fff;
  border-color: #fff;
}

body.selection-mode .selection-help {
  display: block;
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
  color: rgb(255 255 255 / 92%);
  font-size: 0.82rem;
  line-height: 1.3;
}

body.selection-mode .selection-cart-button {
  display: inline-flex;
  color: #fff;
  background: rgb(255 255 255 / 13%);
  border-color: rgb(255 255 255 / 42%);
}

body.selection-mode .selection-cart-button:hover {
  background: rgb(255 255 255 / 22%);
}

.competence-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: clamp(14px, 1.6vw, 22px);
  margin: 0;
  padding: 0;
  list-style: none;
}

.competence-section > .competence-grid {
  width: 100%;
}

.competence-grid > li {
  min-width: 0;
}

.competence-tile {
  position: relative;
  display: grid;
  grid-template-columns: 106px minmax(0, 1fr);
  width: 100%;
  min-height: 122px;
  height: 100%;
  padding: 0;
  overflow: hidden;
  color: var(--text);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--level-color);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  cursor: pointer;
  isolation: isolate;
  transition: border-color 180ms ease, box-shadow 180ms ease,
    transform 180ms ease;
}

.competence-tile::after {
  position: absolute;
  inset: 0;
  z-index: -1;
  content: "";
  background: linear-gradient(
    120deg,
    color-mix(in srgb, var(--level-color) 8%, transparent),
    transparent 52%
  );
  opacity: 0;
  transition: opacity 180ms ease;
}

.competence-collage {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-template-rows: 1fr;
  align-self: stretch;
  align-items: center;
  gap: 4px;
  min-height: 100%;
  padding: 8px 6px;
  overflow: hidden;
  background: color-mix(in srgb, var(--level-color) 9%, #f8f9fe);
  border-right: 1px solid #e8eaf3;
}

.collage-cell {
  display: grid;
  width: 100%;
  aspect-ratio: 1;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  place-items: center;
  background: rgb(255 255 255 / 90%);
  border: 1px solid rgb(220 224 238 / 72%);
  border-radius: 7px;
}

.collage-main {
  grid-row: auto;
}

.collage-image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  padding: 3px;
  object-fit: contain;
  transition: scale 220ms ease;
}

.competence-copy {
  position: relative;
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 7px;
  padding: 15px 38px 15px 15px;
}

.competence-copy strong {
  font-size: clamp(0.9rem, 1.05vw, 1rem);
  line-height: 1.32;
}

.competence-copy > span:not(.competence-arrow) {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}

.competence-arrow {
  position: absolute;
  right: 13px;
  bottom: 13px;
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: var(--level-color);
  font-size: 1.1rem;
  background: color-mix(in srgb, var(--level-color) 11%, #fff);
  border-radius: 50%;
  transition: color 180ms ease, background-color 180ms ease,
    transform 180ms ease;
}

@media (hover: hover) {
  .competence-tile:hover {
    border-color: color-mix(in srgb, var(--level-color) 42%, var(--border));
    box-shadow: var(--shadow-card);
    transform: translateY(-4px);
  }

  .competence-tile:hover::after {
    opacity: 1;
  }

  .competence-tile:hover .collage-image {
    scale: 1.055;
  }

  .competence-tile:hover .competence-arrow {
    color: #fff;
    background: var(--level-color);
    transform: translateX(2px);
  }
}

.activity-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  align-items: stretch;
  gap: 24px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-list > li {
  min-width: 0;
}

.activity-card {
  position: relative;
  z-index: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100%;
  min-height: 270px;
  overflow: visible;
  color: #1c1c1e;
  background: #fff;
  border: 1px solid #d9dce7;
  border-top: 6px solid var(--level-color);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  transition: border-color 180ms ease, box-shadow 180ms ease,
    transform 180ms ease, outline-color 180ms ease;
}

.activity-list > li:has(.activity-level-info[open]) {
  position: relative;
  z-index: 30;
}

.activity-card:has(.difficulty-button:hover),
.activity-card:focus-within {
  border-color: color-mix(in srgb, var(--level-color) 55%, #d9dce7);
  box-shadow: var(--shadow-card);
  transform: translateY(-3px);
}

.activity-card:has(.difficulty-button.is-selected) {
  border-color: var(--app-primary);
  outline: 3px solid rgb(40 63 176 / 16%);
  outline-offset: 2px;
  box-shadow: 0 15px 34px rgb(40 63 176 / 18%);
}

.activity-visual {
  position: relative;
  display: grid;
  width: 100%;
  height: 142px;
  overflow: hidden;
  place-items: center;
  background: color-mix(in srgb, var(--level-color) 9%, #fff);
  border-bottom: 1px solid #e8eaf1;
  border-radius: calc(var(--radius-card) - 6px) calc(var(--radius-card) - 6px) 0 0;
}

.activity-thumbnail,
.activity-thumbnail-fallback,
.activity-thumbnail-overlay,
.activity-card-suits {
  grid-area: 1 / 1;
}

.activity-thumbnail {
  z-index: 1;
  width: 100%;
  height: 100%;
  padding: 8px;
  object-fit: contain;
  background: #fff;
}

.activity-thumbnail-fallback {
  width: 36%;
  height: 58%;
  object-fit: contain;
  opacity: 0.13;
}

.activity-thumbnail-overlay {
  z-index: 2;
  align-self: end;
  width: 100%;
  max-height: 40%;
  object-fit: contain;
}

.activity-card-suits {
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(2, 54px);
  gap: 10px 18px;
  place-content: center;
  width: 100%;
  height: 100%;
  background: #fff;
}

.activity-card-suit {
  width: 54px;
  height: 54px;
  object-fit: contain;
}

.activity-name {
  min-width: 0;
  margin: 0;
  padding: 16px 18px 10px;
  color: #222538;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1.3;
}

.difficulty-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-start;
  min-width: 0;
  margin: 0;
  padding: 4px 18px 18px;
  border: 0;
}

.activity-difficulty-zone {
  min-width: 0;
}

.activity-difficulty-heading {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 18px 2px;
  color: #62677d;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.015em;
}

.activity-level-info {
  position: relative;
  z-index: 2;
  flex: 0 0 auto;
}

.activity-level-info .difficulty-info-button {
  width: 24px;
  height: 24px;
  font-size: 0.92rem;
}

.activity-level-popover {
  top: calc(100% + 10px);
  right: -7px;
  left: auto;
  width: min(370px, calc(100vw - 44px));
  max-height: min(430px, 62vh);
  overflow: auto;
  overscroll-behavior: contain;
}

.activity-level-popover > p {
  margin-bottom: 12px;
  color: #666c82;
}

.activity-level-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.activity-level-list li {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  padding: 8px 9px;
  color: #4b5068;
  font-size: 0.74rem;
  line-height: 1.42;
  background: #f7f8fd;
  border: 1px solid #e5e8f3;
  border-radius: 10px;
}

.activity-level-number {
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  color: #fff;
  font-size: 0.72rem;
  font-weight: 900;
  background: linear-gradient(145deg, var(--app-primary), var(--app-accent));
  border-radius: 50%;
}

.difficulty-guide {
  position: relative;
  z-index: 4;
  display: flex;
  width: fit-content;
  max-width: calc(100% - 24px);
  align-items: center;
  gap: 9px;
  margin: 2px 12px 15px;
  padding: 8px 10px 8px 14px;
  color: #454b67;
  font-size: 0.82rem;
  font-weight: 750;
  background: rgb(255 255 255 / 88%);
  border: 1px solid #dfe3f3;
  border-radius: 999px;
  box-shadow: 0 7px 18px rgb(45 54 110 / 8%);
}

.difficulty-guide-details {
  position: static;
}

.difficulty-info-button {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  color: #fff;
  font-family: Georgia, serif;
  font-size: 1rem;
  font-weight: 800;
  font-style: italic;
  background: linear-gradient(145deg, var(--app-primary), var(--app-accent));
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgb(82 101 202 / 24%);
  cursor: pointer;
  list-style: none;
}

.difficulty-info-button::-webkit-details-marker {
  display: none;
}

.difficulty-info-button:hover,
.difficulty-info-button:focus-visible {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.difficulty-guide-popover {
  position: absolute;
  top: calc(100% + 12px);
  left: 0;
  z-index: 20;
  width: min(340px, calc(100vw - 36px));
  padding: 16px 17px;
  color: #343951;
  font-size: 0.82rem;
  font-weight: 500;
  line-height: 1.48;
  background: #fff;
  border: 1px solid #dce1f1;
  border-radius: 15px;
  box-shadow: 0 18px 44px rgb(35 41 85 / 20%);
}

.difficulty-guide-popover::before {
  display: none;
}

.difficulty-guide-popover strong {
  display: block;
  margin-bottom: 5px;
  color: #2d3374;
  font-size: 0.9rem;
}

.difficulty-guide-popover p {
  margin: 0;
}

.difficulty-button {
  position: relative;
  display: grid;
  width: 44px;
  height: 44px;
  padding: 0;
  place-items: center;
  color: #212121;
  font-weight: 700;
  background: #ccc;
  border: 3px solid #aaa;
  border-radius: 50%;
  cursor: pointer;
  transition: color 140ms ease, background-color 140ms ease,
    border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.difficulty-button[data-difficulty="2"] {
  background: #9ed6a8;
  border-color: #3ab54a;
}

.difficulty-button[data-difficulty="3"] {
  background: #f4b677;
  border-color: #fbb03b;
}

.difficulty-button[data-difficulty="4"] {
  background: #efa0a0;
  border-color: #ff1e24;
}

.difficulty-button:hover {
  filter: brightness(0.92);
  transform: scale(1.08);
}

.difficulty-button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  filter: grayscale(0.5);
}

body.selection-mode .difficulty-button:not(:disabled) {
  border-radius: 13px;
}

.difficulty-button.is-selected {
  color: #fff;
  background: linear-gradient(135deg, var(--app-primary), var(--app-accent));
  border-color: #fff;
  box-shadow: 0 0 0 3px var(--app-primary), 0 7px 15px rgb(40 63 176 / 24%);
}

.difficulty-button.is-selected::after {
  position: absolute;
  top: -10px;
  right: -10px;
  display: grid;
  min-width: 22px;
  height: 22px;
  padding-inline: 4px;
  content: attr(data-cart-order);
  place-items: center;
  color: var(--app-primary-dark);
  font-size: 0.68rem;
  font-weight: 800;
  line-height: 1;
  background: #fff;
  border: 2px solid var(--app-primary);
  border-radius: 999px;
  box-shadow: 0 3px 8px rgb(31 42 92 / 18%);
}

.button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 16px;
  color: var(--app-primary-dark);
  font-size: 0.9rem;
  font-weight: 750;
  line-height: 1.2;
  text-align: center;
  background: var(--surface-tint);
  border: 1px solid rgb(40 63 176 / 16%);
  border-radius: 11px;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease,
    border-color 150ms ease, box-shadow 150ms ease, translate 150ms ease;
}

.button:hover:not(:disabled) {
  border-color: rgb(40 63 176 / 34%);
  box-shadow: 0 7px 16px rgb(40 63 176 / 13%);
  translate: 0 -1px;
}

.button:focus-visible,
.panel-close:focus-visible,
.cart-item-action:focus-visible,
.pathway-action:focus-visible,
.app-panel input:focus-visible,
.app-panel select:focus-visible {
  outline: 3px solid rgb(40 63 176 / 30%);
  outline-offset: 2px;
}

.button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  box-shadow: none;
  translate: none;
}

.button-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--app-primary), var(--app-accent));
  border-color: transparent;
  box-shadow: 0 8px 18px rgb(40 63 176 / 20%);
}

.button-primary:hover:not(:disabled) {
  color: #fff;
  background: linear-gradient(135deg, var(--app-primary-dark), #6248db);
}

.button-secondary {
  color: var(--app-primary-dark);
  background: #fff;
  border-color: rgb(40 63 176 / 28%);
}

.button-ghost {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
}

.button-ghost:hover:not(:disabled) {
  color: var(--danger);
  background: #fff0f2;
  border-color: #f1cbd1;
}

.selection-mode-button {
  flex: 0 0 auto;
  align-self: flex-start;
  margin: 14px 20px 0;
  color: #fff;
  background: linear-gradient(135deg, var(--app-primary), var(--app-accent));
  border-color: transparent;
  box-shadow: 0 8px 18px rgb(40 63 176 / 18%);
}

.selection-mode-button.is-active {
  color: var(--app-primary-dark);
  background: #fff;
  border-color: rgb(40 63 176 / 30%);
  box-shadow: inset 0 0 0 2px rgb(40 63 176 / 8%);
}

/* Panneaux modaux : feuille latérale sur grand écran, bottom sheet sur mobile. */
.app-panel {
  position: fixed;
  inset: 0 0 0 auto;
  width: min(520px, 100%);
  max-width: none;
  height: 100vh;
  height: 100dvh;
  max-height: none;
  margin: 0;
  padding: 0;
  overflow: visible;
  color: var(--text);
  background: transparent;
  border: 0;
}

.app-panel[open] {
  display: block;
  animation: panel-enter 240ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.app-panel::backdrop {
  background: rgb(12 18 48 / 48%);
  backdrop-filter: blur(3px);
  animation: backdrop-enter 180ms ease-out both;
}

.panel-shell {
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 0;
  flex-direction: column;
  overflow: hidden;
  background: #fbfcff;
  border-left: 1px solid rgb(255 255 255 / 55%);
  box-shadow: -20px 0 55px rgb(14 23 67 / 24%);
}

.panel-header {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 22px 16px;
  background: linear-gradient(145deg, #f5f7ff, #fff);
  border-bottom: 1px solid var(--border);
}

.panel-header h2 {
  margin: 2px 0 0;
  color: var(--app-primary-dark);
  font-family: "Aldrich", Arial, sans-serif;
  font-size: clamp(1.2rem, 3vw, 1.55rem);
  font-weight: 400;
}

.panel-eyebrow {
  margin: 0;
  color: var(--app-accent);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.panel-close {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  padding: 0;
  place-items: center;
  color: var(--app-primary-dark);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1.8rem;
  line-height: 1;
  background: var(--surface-tint);
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease,
    rotate 180ms ease;
}

.panel-close:hover {
  color: var(--danger);
  background: #fff0f2;
  rotate: 5deg;
}

.panel-help {
  flex: 0 0 auto;
  margin: 0;
  padding: 13px 22px;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.4;
  background: #fff;
  border-bottom: 1px solid #e8eaf2;
}

.panel-content {
  min-height: 96px;
  flex: 1 1 auto;
  padding: 14px 18px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-color: #b6bddc transparent;
}

.panel-empty {
  display: grid;
  min-height: 180px;
  align-content: center;
  justify-items: center;
  gap: 8px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  background: #fff;
  border: 1px dashed #ccd2e6;
  border-radius: 16px;
}

.panel-empty > span[aria-hidden="true"] {
  color: var(--app-accent);
  font-size: 2.25rem;
  line-height: 1;
}

.panel-empty strong {
  color: var(--text);
  font-size: 1rem;
}

.panel-empty p {
  max-width: 310px;
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
}

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

.cart-list {
  counter-reset: cart-order;
}

.cart-item {
  position: relative;
  display: grid;
  grid-template-columns: 22px 54px minmax(0, 1fr) auto;
  min-width: 0;
  align-items: center;
  gap: 11px;
  padding: 10px;
  counter-increment: cart-order;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 5px 16px rgb(31 42 92 / 6%);
  transition: border-color 150ms ease, box-shadow 150ms ease,
    opacity 150ms ease, translate 150ms ease;
}

.cart-item::before {
  position: absolute;
  top: 5px;
  left: 31px;
  z-index: 2;
  display: grid;
  min-width: 21px;
  height: 21px;
  padding-inline: 4px;
  content: counter(cart-order);
  place-items: center;
  color: #fff;
  font-size: 0.67rem;
  font-weight: 800;
  background: var(--app-primary);
  border: 2px solid #fff;
  border-radius: 999px;
}

.cart-item:hover {
  border-color: #cbd1e7;
  box-shadow: 0 8px 20px rgb(31 42 92 / 10%);
  translate: 0 -1px;
}

.cart-drag-handle {
  display: grid;
  width: 22px;
  height: 42px;
  place-items: center;
  color: #9098b9;
  font-size: 1.3rem;
  line-height: 1;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: color 150ms ease, scale 150ms ease;
}

.cart-item:hover .cart-drag-handle {
  color: var(--app-primary);
}

.cart-item.is-dragging {
  opacity: 0.48;
  cursor: grabbing;
  translate: 0 2px;
}

.cart-item.is-dragging .cart-drag-handle {
  color: var(--app-accent);
  cursor: grabbing;
  scale: 1.12;
}

.cart-item.drop-before::after,
.cart-item.drop-after::after {
  position: absolute;
  right: 8px;
  left: 8px;
  z-index: 5;
  height: 4px;
  content: "";
  pointer-events: none;
  background: linear-gradient(90deg, var(--app-accent), var(--app-primary));
  border-radius: 99px;
  box-shadow: 0 2px 8px rgb(77 93 205 / 30%);
}

.cart-item.drop-before::after {
  top: -7px;
}

.cart-item.drop-after::after {
  bottom: -7px;
}

.panel-thumbnail {
  display: block;
  width: 54px;
  height: 48px;
  padding: 3px;
  object-fit: contain;
  background: #f6f7fb;
  border: 1px solid #e1e4ef;
  border-radius: 10px;
}

.cart-item-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.cart-item-copy strong {
  overflow: hidden;
  color: var(--text);
  font-size: 0.9rem;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cart-item-copy span {
  color: var(--muted);
  font-size: 0.75rem;
}

.cart-item-threshold {
  display: grid;
  gap: 5px;
  margin-top: 5px;
  padding: 8px 9px;
  background: linear-gradient(135deg, #f5f3ff, #f3f7ff);
  border: 1px solid rgb(92 76 198 / 14%);
  border-radius: 10px;
}

.cart-item-copy .cart-item-threshold > span {
  color: #59508c;
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.015em;
}

.cart-item-threshold select {
  width: 100%;
  min-width: 0;
  height: 34px;
  padding: 5px 28px 5px 9px;
  color: #30345f;
  font: inherit;
  font-size: 0.76rem;
  font-weight: 750;
  background-color: #fff;
  border: 1px solid #d5d8ea;
  border-radius: 8px;
  cursor: pointer;
}

.cart-item-threshold select:focus-visible {
  border-color: var(--app-accent);
  outline: 3px solid rgb(112 87 232 / 16%);
  outline-offset: 1px;
}

.cart-item-threshold select:disabled {
  opacity: 0.62;
  cursor: wait;
}

.cart-item-actions {
  display: flex;
  gap: 4px;
}

.cart-item-action {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  color: var(--app-primary-dark);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 1rem;
  font-weight: 700;
  background: var(--surface-tint);
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  transition: color 140ms ease, background-color 140ms ease,
    border-color 140ms ease;
}

.cart-item-action:hover:not(:disabled) {
  color: var(--app-primary);
  background: #e4e9ff;
  border-color: rgb(40 63 176 / 18%);
}

.cart-item-action:last-child:hover:not(:disabled) {
  color: var(--danger);
  background: #fff0f2;
  border-color: #f1cbd1;
}

.cart-item-action:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.progression-settings {
  display: grid;
  flex: 0 0 auto;
  gap: 10px;
  margin: 0;
  padding: 15px 20px;
  background: #f3f5ff;
  border: 0;
  border-block: 1px solid #e0e4f2;
}

.progression-settings legend {
  padding: 0 4px;
  color: var(--app-primary-dark);
  font-size: 0.82rem;
  font-weight: 800;
}

.progression-settings label {
  display: grid;
  grid-template-columns: minmax(118px, auto) minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 650;
}

.progression-settings select,
.progression-settings input[type="text"],
.share-url-row input {
  min-width: 0;
  height: 40px;
  padding: 8px 10px;
  color: var(--text);
  font: inherit;
  background: #fff;
  border: 1px solid #cfd5e8;
  border-radius: 10px;
}

.progression-settings input[type="text"]:focus-visible {
  border-color: var(--app-primary);
  outline: 3px solid rgb(40 63 176 / 17%);
  outline-offset: 1px;
}

.threshold-row {
  grid-template-columns: minmax(118px, auto) minmax(0, 1fr) 52px !important;
}

.threshold-row input[type="range"] {
  width: 100%;
}

.threshold-row output {
  color: var(--app-primary-dark);
  font-weight: 800;
  text-align: right;
}

.share-url-label {
  flex: 0 0 auto;
  padding: 13px 20px 6px;
  color: var(--app-primary-dark);
  font-size: 0.8rem;
  font-weight: 800;
  background: #fff;
}

.share-url-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  flex: 0 0 auto;
  gap: 8px;
  padding: 0 20px 14px;
  background: #fff;
}

.share-url-row input {
  color: #4c5268;
  font-size: 0.76rem;
  text-overflow: ellipsis;
}

.panel-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  padding: 14px 20px calc(14px + env(safe-area-inset-bottom));
  background: #fff;
  border-top: 1px solid var(--border);
}

.panel-actions .button-ghost {
  margin-right: auto;
}

/* Connexion au créateur de sessions. */
.auth-panel {
  width: min(470px, 100%);
}

.auth-panel-shell {
  position: relative;
  background:
    radial-gradient(circle at 88% 8%, rgb(112 87 232 / 13%), transparent 32%),
    linear-gradient(160deg, #fbfcff, #f3f5ff 60%, #f7fbff);
}

.auth-panel-header {
  position: relative;
  z-index: 2;
  background: rgb(255 255 255 / 78%);
  backdrop-filter: blur(16px);
}

.auth-panel-content {
  position: relative;
  display: grid;
  min-height: 0;
  flex: 1 1 auto;
  align-content: center;
  padding: clamp(24px, 6vh, 58px) clamp(22px, 5vw, 38px);
  overflow-x: hidden;
  overflow-y: auto;
}

.auth-decoration {
  display: grid;
  width: 74px;
  height: 74px;
  margin: 0 auto 22px;
  place-items: center;
  color: #fff;
  font-size: 1.65rem;
  background: linear-gradient(145deg, var(--app-primary), var(--app-accent));
  border: 7px solid rgb(255 255 255 / 74%);
  border-radius: 24px;
  box-shadow:
    0 18px 38px rgb(52 56 158 / 21%),
    0 0 0 1px rgb(64 72 181 / 9%);
  rotate: -4deg;
  animation: auth-mark-enter 480ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

#teacher-login-view,
.teacher-account-view {
  animation: auth-content-enter 300ms ease-out both;
}

.auth-kicker {
  margin: 0 0 7px;
  color: var(--app-accent);
  font-size: 0.73rem;
  font-weight: 850;
  letter-spacing: 0.11em;
  text-align: center;
  text-transform: uppercase;
}

.auth-panel-content h3 {
  margin: 0;
  color: #252b70;
  font-family: "Aldrich", Arial, sans-serif;
  font-size: clamp(1.35rem, 4vw, 1.8rem);
  font-weight: 400;
  line-height: 1.22;
  text-align: center;
  text-wrap: balance;
}

.auth-intro {
  max-width: 380px;
  margin: 13px auto 24px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.55;
  text-align: center;
  text-wrap: balance;
}

.teacher-login-form {
  display: grid;
  gap: 9px;
  width: min(100%, 380px);
  margin: 0 auto;
}

.teacher-login-form > label {
  margin-top: 5px;
  color: #30345f;
  font-size: 0.8rem;
  font-weight: 800;
}

.auth-field {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  min-height: 51px;
  align-items: center;
  overflow: hidden;
  background: rgb(255 255 255 / 92%);
  border: 1px solid #ccd2ea;
  border-radius: 14px;
  box-shadow: 0 7px 20px rgb(44 50 117 / 6%);
  transition: border-color 160ms ease, box-shadow 160ms ease, translate 160ms ease;
}

.auth-field:focus-within {
  border-color: #6551d4;
  box-shadow: 0 0 0 4px rgb(101 81 212 / 13%), 0 10px 24px rgb(44 50 117 / 9%);
  translate: 0 -1px;
}

.auth-field > span {
  display: grid;
  height: 100%;
  place-items: center;
  color: #6752d5;
  font-size: 1rem;
  background: #f0efff;
  border-right: 1px solid #e1e0f5;
}

.auth-field input {
  min-width: 0;
  height: 100%;
  padding: 0 14px;
  color: #242744;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  background: transparent;
  border: 0;
  outline: 0;
}

.auth-field input:disabled {
  opacity: 0.62;
}

.auth-error {
  margin: 3px 2px 0;
  padding: 10px 12px;
  color: #a6283d;
  font-size: 0.78rem;
  font-weight: 750;
  line-height: 1.4;
  background: #fff0f2;
  border: 1px solid #f1cbd1;
  border-radius: 10px;
}

.auth-submit {
  width: 100%;
  min-height: 49px;
  margin-top: 8px;
}

.teacher-account-view {
  display: grid;
  justify-items: center;
}

.teacher-account-badge {
  display: grid;
  width: 60px;
  height: 60px;
  margin: 0 0 17px;
  place-items: center;
  color: #fff;
  font-size: 1.45rem;
  font-weight: 900;
  background: linear-gradient(145deg, #27935b, #20ac72);
  border: 6px solid rgb(255 255 255 / 75%);
  border-radius: 999px;
  box-shadow: 0 13px 30px rgb(31 139 88 / 20%);
}

.teacher-account-name {
  display: inline-flex;
  min-height: 43px;
  align-items: center;
  gap: 9px;
  margin: 19px 0 0;
  padding: 9px 15px;
  color: #22533d;
  background: #eaf9f1;
  border: 1px solid #cdebdc;
  border-radius: 999px;
}

.teacher-account-name > span {
  font-size: 1.08rem;
}

.teacher-account-name strong {
  max-width: 240px;
  overflow: hidden;
  font-size: 0.9rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.teacher-account-view .auth-intro {
  margin-top: 18px;
}

.teacher-account-actions {
  display: grid;
  width: min(100%, 340px);
  gap: 9px;
}

.teacher-account-actions .button {
  width: 100%;
  min-height: 47px;
  text-decoration: none;
}

.scores-content {
  background: #f7f8fc;
}

.scores-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  flex: 0 0 auto;
  gap: 8px;
  padding: 14px 18px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

.scores-summary > div {
  display: grid;
  min-width: 0;
  align-content: center;
  gap: 3px;
  min-height: 68px;
  padding: 10px 7px;
  text-align: center;
  background: linear-gradient(145deg, #f3f5ff, #fafaff);
  border: 1px solid #e1e5f3;
  border-radius: 13px;
}

.scores-summary strong {
  color: var(--app-primary);
  font-family: "Aldrich", Arial, sans-serif;
  font-size: 1.22rem;
  font-weight: 400;
}

.scores-summary span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.68rem;
  line-height: 1.2;
  text-overflow: ellipsis;
}

.score-item {
  display: grid;
  gap: 8px;
  padding: 13px 14px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgb(31 42 92 / 5%);
}

.score-item-head {
  display: flex;
  min-width: 0;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.score-item-head strong {
  min-width: 0;
  overflow: hidden;
  font-size: 0.9rem;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.score-value {
  flex: 0 0 auto;
  color: var(--app-primary-dark);
  font-size: 0.79rem;
  font-weight: 800;
}

.score-meta {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

.score-item progress {
  width: 100%;
  height: 8px;
  overflow: hidden;
  appearance: none;
  background: #e8ebf5;
  border: 0;
  border-radius: 999px;
}

.score-item progress::-webkit-progress-bar {
  background: #e8ebf5;
  border-radius: 999px;
}

.score-item progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--app-primary), var(--app-accent));
  border-radius: 999px;
}

.score-item progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--app-primary), var(--app-accent));
  border-radius: 999px;
}

/* Accueil élève d’une session partagée. */
.catalogue-content.session-gate-view {
  min-height: 100%;
}

.session-gate {
  position: relative;
  display: grid;
  min-height: 100%;
  padding: clamp(24px, 5vw, 64px) 18px;
  overflow: hidden;
  place-items: center;
  background:
    radial-gradient(circle at 10% 16%, rgb(123 94 231 / 22%), transparent 29%),
    radial-gradient(circle at 91% 84%, rgb(44 169 194 / 18%), transparent 31%),
    linear-gradient(145deg, #eef1ff 0%, #f8f9ff 48%, #effbfb 100%);
  isolation: isolate;
}

.session-gate::before {
  position: absolute;
  inset: 0;
  z-index: -2;
  content: "";
  opacity: 0.38;
  background-image:
    linear-gradient(rgb(77 84 173 / 7%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(77 84 173 / 7%) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(to bottom, #000, transparent 80%);
}

.session-orb {
  position: absolute;
  z-index: -1;
  width: clamp(190px, 24vw, 360px);
  aspect-ratio: 1;
  opacity: 0.68;
  border-radius: 44% 56% 62% 38% / 43% 39% 61% 57%;
  filter: blur(1px);
  animation: session-orb-float 9s ease-in-out infinite alternate;
}

.session-orb-one {
  top: -95px;
  right: -70px;
  background: linear-gradient(145deg, rgb(109 83 226 / 34%), rgb(58 109 214 / 12%));
  rotate: 18deg;
}

.session-orb-two {
  bottom: -125px;
  left: -72px;
  background: linear-gradient(145deg, rgb(48 181 181 / 28%), rgb(105 82 224 / 14%));
  animation-delay: -3s;
}

.session-gate-card {
  position: relative;
  display: grid;
  width: min(100%, 540px);
  justify-items: center;
  padding: clamp(28px, 4.5vw, 48px);
  overflow: hidden;
  text-align: center;
  background: rgb(255 255 255 / 84%);
  border: 1px solid rgb(255 255 255 / 92%);
  border-radius: 30px;
  box-shadow:
    0 30px 80px rgb(42 47 121 / 17%),
    inset 0 1px 0 #fff;
  backdrop-filter: blur(24px) saturate(1.15);
  animation: session-card-enter 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.session-gate-card::after {
  position: absolute;
  inset: 0 0 auto;
  height: 5px;
  content: "";
  background: linear-gradient(90deg, #374fbd, #7858e7 55%, #38b7bd);
}

.session-gate-mark {
  display: grid;
  width: 174px;
  height: 174px;
  margin-bottom: 22px;
  place-items: center;
  background: linear-gradient(145deg, #fff, #edf0ff);
  border: 1px solid rgb(65 74 174 / 13%);
  border-radius: 38px;
  box-shadow: 0 14px 32px rgb(50 57 154 / 16%);
}

.session-gate-mark img {
  display: block;
  width: 150px;
  height: 150px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  object-position: center;
}

.session-gate-eyebrow {
  margin: 0 0 7px;
  color: #6752d5;
  font-size: 0.88rem;
  font-weight: 850;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.session-gate-card h2 {
  max-width: 440px;
  margin: 0;
  color: #24285f;
  font-family: "Aldrich", Arial, sans-serif;
  font-size: clamp(1.65rem, 4vw, 2.4rem);
  font-weight: 400;
  line-height: 1.16;
  text-wrap: balance;
}

.session-gate-intro {
  max-width: 410px;
  margin: 13px 0 25px;
  color: #656b84;
  font-size: 1.08rem;
  line-height: 1.55;
  text-wrap: balance;
}

.session-identity-form {
  display: grid;
  width: min(100%, 410px);
  gap: 9px;
  text-align: left;
}

.session-identity-step {
  display: grid;
  gap: 9px;
  animation: session-step-enter 260ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.session-identity-step[hidden] {
  display: none;
}

.session-identity-form label {
  color: #30345f;
  font-size: 1rem;
  font-weight: 800;
}

.session-step-back {
  justify-self: start;
  margin: 2px 0 0;
  min-height: 44px;
  padding: 8px 2px;
  color: #6551d4;
  font: inherit;
  font-size: 0.94rem;
  font-weight: 800;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.session-step-back:hover {
  color: #303e9d;
  text-decoration: underline;
}

.session-pin-welcome {
  margin: 4px 0 -7px;
  color: #343966;
  font-size: 1.15rem;
  text-align: center;
}

.session-pin-welcome strong {
  color: #6752d5;
}

.session-pin-step .session-gate-intro {
  margin: 10px 0 13px;
  font-size: 1rem;
  text-align: center;
}

.session-pin-display {
  display: grid;
  grid-template-columns: repeat(4, 52px);
  justify-content: center;
  gap: 10px;
  margin: 2px 0 8px;
}

.session-pin-display span {
  display: grid;
  width: 52px;
  height: 52px;
  place-items: center;
  color: #fff;
  font-size: 1.45rem;
  font-variant-numeric: tabular-nums;
  background: #f3f4fb;
  border: 2px solid #d9ddef;
  border-radius: 16px;
  box-shadow: inset 0 1px 0 #fff;
  transition: background 180ms ease, border-color 180ms ease, scale 180ms ease,
    box-shadow 180ms ease;
}

.session-pin-display span.is-filled {
  background: linear-gradient(145deg, #566ed5, #7655df);
  border-color: #6a59d8;
  box-shadow: 0 8px 18px rgb(83 67 187 / 22%);
  scale: 1.04;
}

.session-pin-keypad {
  display: grid;
  grid-template-columns: repeat(3, minmax(58px, 1fr));
  gap: 9px;
}

.session-pin-keypad button {
  min-height: 54px;
  padding: 7px;
  color: #fff;
  font: inherit;
  font-size: 1.2rem;
  font-weight: 900;
  background: linear-gradient(145deg, #586fd7, #3f54bb);
  border: 0;
  border-radius: 14px;
  box-shadow: 0 7px 15px rgb(48 65 153 / 18%);
  cursor: pointer;
  transition: filter 140ms ease, scale 120ms ease, translate 140ms ease;
}

.session-pin-keypad button:nth-child(3n + 2) {
  background: linear-gradient(145deg, #7a5be2, #6044c7);
}

.session-pin-keypad button:nth-child(3n) {
  background: linear-gradient(145deg, #2eafb6, #278caa);
}

.session-pin-keypad button:hover,
.session-pin-keypad button:focus-visible {
  filter: brightness(1.08) saturate(1.08);
  translate: 0 -2px;
}

.session-pin-keypad button:active {
  scale: 0.95;
  translate: 0 1px;
}

.session-pin-keypad .pin-key-action {
  color: #4f5679;
  background: linear-gradient(145deg, #eef0f8, #dfe4f2);
  box-shadow: 0 6px 14px rgb(48 55 99 / 12%);
}

.session-pin-help {
  text-align: center;
}

.session-name-field {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  min-height: 58px;
  align-items: center;
  overflow: hidden;
  background: #fff;
  border: 1px solid #ccd2ea;
  border-radius: 15px;
  box-shadow: 0 7px 20px rgb(44 50 117 / 7%);
  transition: border-color 160ms ease, box-shadow 160ms ease, translate 160ms ease;
}

.session-name-field:focus-within {
  border-color: #6551d4;
  box-shadow: 0 0 0 4px rgb(101 81 212 / 13%), 0 10px 24px rgb(44 50 117 / 10%);
  translate: 0 -1px;
}

.session-name-field > span {
  display: grid;
  height: 100%;
  place-items: center;
  color: #6752d5;
  font-size: 1.15rem;
  background: #f1efff;
  border-right: 1px solid #e3e0f6;
}

.session-name-field input {
  min-width: 0;
  height: 100%;
  padding: 0 15px;
  color: #242744;
  font: inherit;
  font-size: 1.08rem;
  font-weight: 700;
  background: transparent;
  border: 0;
  outline: 0;
}

.session-name-field:has(input[aria-invalid="true"]) {
  border-color: #d3485d;
  box-shadow: 0 0 0 4px rgb(211 72 93 / 11%);
}

.session-field-help,
.session-form-error {
  margin: 0 2px;
  font-size: 0.9rem;
  line-height: 1.35;
}

.session-field-help {
  color: #596174;
}

.session-form-error {
  color: #b62f46;
  font-weight: 750;
}

.session-enter-button {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 13px;
  margin-top: 8px;
  padding: 12px 20px;
  color: #fff;
  font-size: 1.06rem;
  font-weight: 850;
  background:
    linear-gradient(120deg, #3049af, #6f54df 58%, #6650db);
  border: 0;
  border-radius: 15px;
  box-shadow: 0 13px 28px rgb(77 61 188 / 26%);
  cursor: pointer;
  transition: box-shadow 170ms ease, filter 170ms ease, translate 170ms ease;
}

.session-enter-button span:last-child {
  font-family: Arial, sans-serif;
  font-size: 1.3rem;
  transition: translate 170ms ease;
}

.session-enter-button:hover:not(:disabled) {
  filter: saturate(1.08) brightness(1.03);
  box-shadow: 0 17px 34px rgb(77 61 188 / 31%);
  translate: 0 -2px;
}

.session-enter-button:hover:not(:disabled) span:last-child {
  translate: 3px 0;
}

.session-enter-button:focus-visible {
  outline: 4px solid rgb(81 67 194 / 24%);
  outline-offset: 4px;
}

.session-enter-button:disabled {
  opacity: 0.66;
  cursor: not-allowed;
}

.session-privacy {
  display: flex;
  max-width: 410px;
  align-items: flex-start;
  gap: 7px;
  margin: 18px 0 0;
  color: #5d6478;
  font-size: 0.86rem;
  line-height: 1.4;
  text-align: left;
}

.session-privacy span {
  color: #2daa6b;
  font-size: 0.54rem;
  line-height: 1.7;
}

body.session-mode .catalogue-content.pathway-view {
  width: min(calc(100% - 40px), 1080px);
}

body.session-mode .pathway-hero {
  background:
    radial-gradient(circle at 88% 10%, rgb(255 255 255 / 21%), transparent 28%),
    linear-gradient(125deg, #252b7a, #3d51ba 54%, #7257df);
}

body.session-mode .pathway-item {
  box-shadow: 0 10px 30px rgb(35 43 116 / 10%);
}

@keyframes session-card-enter {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes session-step-enter {
  from {
    opacity: 0;
    transform: translateX(12px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes session-orb-float {
  from { transform: translate3d(0, 0, 0) rotate(0deg); }
  to { transform: translate3d(18px, -14px, 0) rotate(13deg); }
}

@keyframes session-live-pulse {
  50% { box-shadow: 0 0 0 7px rgb(117 94 232 / 5%); }
}

/* Écran du parcours partagé. */
.catalogue-content.pathway-view {
  width: min(calc(100% - 40px), 1050px);
  min-height: auto;
  margin: 0 auto;
  padding: clamp(24px, 4vh, 44px) 0 72px;
}

.pathway-hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 22px;
  padding: clamp(22px, 3vw, 34px);
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 88% 12%, rgb(255 255 255 / 20%), transparent 28%),
    linear-gradient(125deg, var(--app-primary-dark), var(--app-primary) 55%, var(--app-accent));
  border-radius: 22px;
  box-shadow: 0 16px 42px rgb(40 63 176 / 25%);
}

.pathway-hero h2 {
  margin: 5px 0 8px;
  font-family: "Aldrich", Arial, sans-serif;
  font-size: clamp(1.35rem, 3vw, 2rem);
  font-weight: 400;
}

.pathway-hero p {
  max-width: 650px;
  margin: 0;
  color: rgb(255 255 255 / 86%);
  font-size: 1.02rem;
  font-weight: 650;
  line-height: 1.5;
}

.pathway-eyebrow {
  color: #d9dfff;
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.pathway-hero .button-secondary {
  flex: 0 0 auto;
  color: var(--app-primary-dark);
  border-color: #fff;
}

.pathway-list {
  position: relative;
  display: grid;
  gap: 17px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.pathway-item {
  position: relative;
  display: grid;
  grid-template-columns: 58px 104px minmax(0, 1fr) auto;
  min-width: 0;
  align-items: center;
  gap: 18px;
  min-height: 128px;
  padding: 16px 18px 16px 13px;
  background: #fff;
  border: 1px solid var(--border);
  border-left: 7px solid var(--level-color);
  border-radius: 22px;
  box-shadow: var(--shadow-soft);
  transition: border-color 170ms ease, box-shadow 170ms ease,
    transform 170ms ease, opacity 170ms ease;
}

.pathway-item:hover:not(.is-locked) {
  border-color: color-mix(in srgb, var(--level-color) 46%, var(--border));
  box-shadow: var(--shadow-card);
  transform: translateY(-2px);
}

.pathway-order {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  color: #fff;
  font-family: "Aldrich", Arial, sans-serif;
  font-size: 1.08rem;
  background: var(--level-color);
  border: 4px solid color-mix(in srgb, var(--level-color) 18%, #fff);
  border-radius: 50%;
  box-shadow: 0 5px 12px color-mix(in srgb, var(--level-color) 24%, transparent);
}

.pathway-visual {
  display: grid;
  width: 104px;
  height: 88px;
  overflow: hidden;
  place-items: center;
  background: #f7f8fc;
  border: 1px solid #e1e4ef;
  border-radius: 15px;
}

.pathway-thumbnail {
  display: block;
  width: 100%;
  height: 100%;
  padding: 5px;
  object-fit: contain;
}

.pathway-copy {
  display: grid;
  min-width: 0;
  gap: 8px;
}

.pathway-copy > strong {
  color: var(--text);
  font-size: clamp(1.08rem, 1.6vw, 1.22rem);
  line-height: 1.28;
}

.pathway-meta {
  display: flex;
  min-width: 0;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 650;
  line-height: 1.45;
}

.pathway-level-info {
  position: relative;
  z-index: 3;
  display: inline-block;
  flex: 0 0 auto;
}

.pathway-level-info-button {
  display: grid;
  width: 32px;
  height: 32px;
  padding: 0;
  place-items: center;
  color: #fff;
  font-family: Georgia, serif;
  font-size: 1rem;
  font-weight: 800;
  font-style: italic;
  line-height: 1;
  background: linear-gradient(145deg, var(--app-primary), var(--app-accent));
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgb(82 101 202 / 25%);
  cursor: help;
  list-style: none;
  transition: filter 140ms ease, transform 140ms ease;
}

.pathway-level-info-button:hover,
.pathway-level-info-button:focus-visible {
  filter: brightness(1.1);
  outline: 3px solid rgb(112 87 232 / 18%);
  outline-offset: 2px;
  transform: translateY(-1px);
}

.pathway-level-popover {
  position: absolute;
  top: calc(100% + 9px);
  right: -8px;
  z-index: 30;
  display: grid;
  width: min(285px, calc(100vw - 48px));
  gap: 4px;
  padding: 12px 14px;
  color: #383d5b;
  font-size: 0.96rem;
  line-height: 1.42;
  background: #fff;
  border: 1px solid #dce1f1;
  border-radius: 14px;
  box-shadow: 0 17px 38px rgb(35 41 85 / 22%);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top right;
  visibility: hidden;
  transition: opacity 130ms ease, transform 130ms ease, visibility 130ms;
}

.pathway-level-info:hover > .pathway-level-popover,
.pathway-level-info.is-visible > .pathway-level-popover,
.pathway-level-info-button:focus-visible + .pathway-level-popover {
  opacity: 1;
  transform: translateY(0) scale(1);
  visibility: visible;
}

.pathway-item:has(.pathway-level-info:hover),
.pathway-item:has(.pathway-level-info.is-visible),
.pathway-item:has(.pathway-level-info-button:focus-visible) {
  z-index: 8;
}

.pathway-level-popover-title,
.pathway-level-popover-text {
  display: block;
}

.pathway-level-popover-title {
  color: #2d3374;
  font-size: 1.02rem;
  font-weight: 850;
}

.pathway-level-popover-text {
  color: var(--muted);
}

.pathway-status {
  display: inline-flex;
  width: fit-content;
  min-height: 38px;
  align-items: center;
  gap: 8px;
  padding: 5px 11px 5px 6px;
  color: #2853a5;
  font-size: 0.94rem;
  font-weight: 850;
  line-height: 1.35;
  background: #edf4ff;
  border: 1px solid #d7e6ff;
  border-radius: 999px;
}

.pathway-status-icon {
  display: grid;
  width: 27px;
  height: 27px;
  flex: 0 0 27px;
  place-items: center;
  color: #fff;
  background: #4775cd;
  border-radius: 50%;
}

.pathway-status-icon .pathway-icon {
  width: 16px;
  height: 16px;
}

.pathway-item[data-state="complete"] .pathway-status {
  color: #087250;
  background: #e8f8f1;
  border-color: #cdeedd;
}

.pathway-item[data-state="complete"] .pathway-status-icon {
  background: #15966d;
}

.pathway-item[data-state="retry"] .pathway-status {
  color: #98510f;
  background: #fff3df;
  border-color: #f8ddb2;
}

.pathway-item[data-state="retry"] .pathway-status-icon {
  background: #e98a28;
}

.pathway-item[data-state="locked"] .pathway-status {
  color: #596174;
  background: #eceef3;
  border-color: #dfe2e9;
}

.pathway-item[data-state="locked"] .pathway-status-icon {
  background: #7f8798;
}

.pathway-action {
  display: inline-flex;
  min-width: 148px;
  min-height: 58px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 12px 19px;
  color: #fff;
  font-size: 1.02rem;
  font-weight: 850;
  background: linear-gradient(135deg, var(--app-primary), var(--app-accent));
  border: 0;
  border-radius: 15px;
  box-shadow: 0 7px 15px rgb(40 63 176 / 18%);
  cursor: pointer;
  transition: box-shadow 150ms ease, translate 150ms ease;
}

.pathway-action .pathway-icon {
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
}

.pathway-action-label {
  line-height: 1.1;
}

.pathway-action:hover:not([aria-disabled="true"]) {
  box-shadow: 0 10px 21px rgb(40 63 176 / 26%);
  translate: 0 -1px;
}

.pathway-item.is-complete {
  border-left-color: var(--success);
}

.pathway-item.is-complete .pathway-order {
  background: var(--success);
  border-color: #dcefe5;
}

.pathway-item.is-complete .pathway-status {
  color: #087250;
}

.pathway-item[data-state="retry"] {
  border-left-color: #e98a28;
}

.pathway-item.is-locked {
  opacity: 1;
  background: #f4f5f8;
  border-left-color: #a7abba;
  box-shadow: none;
}

.pathway-item.is-locked .pathway-order {
  background: #8f94a6;
  border-color: #e2e4ea;
  box-shadow: none;
}

.pathway-item.is-locked .pathway-visual {
  filter: grayscale(1);
  opacity: 0.56;
}

.pathway-action[aria-disabled="true"] {
  color: #555d6e;
  background: #dfe2e9;
  border: 2px solid #cfd3dd;
  box-shadow: none;
  cursor: not-allowed;
}

.pathway-error {
  display: grid;
  max-width: 650px;
  min-height: 300px;
  align-content: center;
  justify-items: center;
  gap: 12px;
  margin: 6vh auto 0;
  padding: 38px;
  color: var(--muted);
  text-align: center;
  background: #fff;
  border: 1px solid #f0cfd4;
  border-radius: 20px;
  box-shadow: var(--shadow-card);
}

.pathway-error > span[aria-hidden="true"] {
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  color: var(--danger);
  font-size: 1.8rem;
  font-weight: 800;
  background: #fff0f2;
  border-radius: 50%;
}

.pathway-error h2,
.pathway-error p {
  margin: 0;
}

.pathway-error h2 {
  color: var(--text);
}

.pathway-error .button {
  margin-top: 8px;
}

.app-toast {
  position: fixed;
  bottom: max(22px, calc(env(safe-area-inset-bottom) + 14px));
  left: 50%;
  z-index: 100;
  width: max-content;
  max-width: min(calc(100% - 28px), 540px);
  padding: 12px 17px;
  color: #fff;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  background: rgb(31 36 64 / 96%);
  border: 1px solid rgb(255 255 255 / 18%);
  border-radius: 13px;
  box-shadow: 0 14px 35px rgb(7 11 34 / 30%);
  opacity: 0;
  transform: translate(-50%, 14px) scale(0.98);
  pointer-events: none;
  transition: opacity 180ms ease, transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.app-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

@keyframes panel-enter {
  from {
    opacity: 0;
    transform: translateX(34px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes backdrop-enter {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes card-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.competence-grid > li,
.activity-list > li,
.pathway-list > li {
  animation: card-enter 320ms ease-out both;
}

.competence-grid > li:nth-child(2),
.activity-list > li:nth-child(2),
.pathway-list > li:nth-child(2) { animation-delay: 35ms; }

.competence-grid > li:nth-child(3),
.activity-list > li:nth-child(3),
.pathway-list > li:nth-child(3) { animation-delay: 70ms; }

.competence-grid > li:nth-child(4),
.activity-list > li:nth-child(4),
.pathway-list > li:nth-child(4) { animation-delay: 105ms; }

.competence-grid > li:nth-child(5),
.activity-list > li:nth-child(5),
.pathway-list > li:nth-child(5) { animation-delay: 140ms; }

.competence-grid > li:nth-child(n + 6),
.activity-list > li:nth-child(n + 6),
.pathway-list > li:nth-child(n + 6) { animation-delay: 175ms; }

.catalogue-loading,
.catalogue-empty {
  margin: 0;
  padding: 64px 24px;
  color: #555;
  font-family: "Aldrich", Arial, sans-serif;
  text-align: center;
}

.conteneur.exercice {
  display: flex;
  width: 775px;
  max-width: 100%;
  height: 450px;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

body.standalone-mode[data-screen="exercice"] .main {
  align-items: stretch;
}

body.standalone-mode .conteneur.exercice {
  width: 100%;
  max-width: none;
  height: 100% !important;
  padding: clamp(8px, 1.4vw, 18px);
  overflow: hidden;
}

body.standalone-mode .conteneur.exercice > .clc {
  flex: 0 0 auto;
}

.load-error {
  max-width: 620px;
  padding: 24px;
  color: #7c1f1f;
  line-height: 1.5;
  background: #fff3f3;
  border: 1px solid #e7b4b4;
  border-radius: 10px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 1180px) {
  #teacher-auth-button .tool-label,
  #cart-open-button .tool-label,
  #scores-open-button .tool-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .tool-count {
    position: absolute;
    top: -6px;
    right: -6px;
  }

  .catalogue-content.levels-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 40px;
    padding-inline: 42px;
  }

  .catalogue-content.activities-view,
  .catalogue-content.competences-view {
    width: calc(100% - 40px);
  }
}

@media (max-width: 900px) {
  .competence-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .competence-section {
    gap: 14px;
    padding: 16px;
  }

  .header-context {
    justify-content: flex-start;
  }

  .launcher-title {
    overflow: hidden;
    font-size: 0.84rem;
    text-align: left;
    text-overflow: ellipsis;
    white-space: normal;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
  }

  .pathway-item {
    grid-template-columns: 42px 68px minmax(0, 1fr) auto;
    gap: 11px;
  }

  .pathway-visual {
    width: 68px;
    height: 60px;
  }
}

@media (max-width: 700px) {
  .app-header {
    gap: 6px;
    padding: 7px 8px 7px 58px;
  }

  body.session-mode .app-header {
    grid-template-columns: minmax(0, 1fr) auto;
    padding-left: 9px;
  }

  body.session-mode .header-context {
    min-width: 0;
  }

  .session-participant {
    min-width: 40px;
    min-height: 40px;
    justify-content: center;
    padding: 7px 10px;
  }

  #session-participant-name {
    max-width: 86px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .header-button,
  .back-button {
    left: 8px;
    width: 40px;
    height: 40px;
  }

  .header-context {
    gap: 7px;
  }

  .header-logo {
    width: 38px;
    height: 38px;
  }

  .header-actions {
    gap: 4px;
  }

  .tool-button {
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 6px;
    border-radius: 11px;
  }

  .tool-button .tool-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  body.session-mode #pathway-overview-button,
  body.session-mode #next-step-button {
    width: auto;
    min-width: 0;
    min-height: 48px;
    gap: 5px;
    padding-inline: 9px;
  }

  body.session-mode #pathway-overview-button .tool-label,
  body.session-mode #next-step-button .tool-label {
    position: static;
    width: auto;
    height: auto;
    padding: 0;
    margin: 0;
    overflow: visible;
    clip: auto;
    font-size: 0.72rem;
    white-space: nowrap;
  }

  .tool-icon {
    font-size: 1.2rem;
  }

  .catalogue-content.levels-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    padding: 28px 24px 56px;
  }

  .catalogue-content.competences-view,
  .catalogue-content.activities-view,
  .catalogue-content.pathway-view {
    width: calc(100% - 28px);
    padding-top: 18px;
  }

  .competence-grid {
    grid-template-columns: 1fr;
    gap: 13px;
  }

  .competences-view {
    gap: 16px;
  }

  .competence-section {
    gap: 12px;
    padding: 13px 11px 12px 15px;
    border-radius: 17px;
  }

  .competence-section-header {
    gap: 10px;
    padding: 0 2px 10px 3px;
  }

  .competence-section-title {
    font-size: 0.98rem;
  }

  .competence-section-count {
    min-height: 27px;
    padding: 4px 8px;
    font-size: 0.69rem;
  }

  .competence-tile {
    grid-template-columns: 94px minmax(0, 1fr);
    min-height: 112px;
  }

  .competence-copy {
    padding-block: 13px;
  }

  .activity-list {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr));
    gap: 16px;
  }

  .activity-visual {
    height: 132px;
  }

  .selection-toolbar,
  body.selection-mode .selection-toolbar {
    top: 8px;
    gap: 6px;
    min-height: 46px;
    margin-bottom: 15px;
  }

  body.selection-mode .selection-help {
    display: none;
  }

  .selection-toggle,
  .selection-cart-button {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 0.8rem;
  }

  .app-panel {
    inset: auto 0 0;
    width: 100%;
    height: min(90vh, 760px);
    height: min(90dvh, 760px);
    margin: 0;
  }

  .app-panel[open] {
    animation-name: panel-enter-mobile;
  }

  .panel-shell {
    border-top: 1px solid rgb(255 255 255 / 60%);
    border-left: 0;
    border-radius: 22px 22px 0 0;
    box-shadow: 0 -18px 50px rgb(14 23 67 / 24%);
  }

  .panel-header {
    padding: 18px 17px 13px;
  }

  .panel-help {
    padding: 10px 17px;
  }

  .panel-content {
    padding: 12px 13px;
  }

  .progression-settings {
    padding-inline: 16px;
  }

  .share-url-label {
    padding-inline: 16px;
  }

  .share-url-row {
    padding-inline: 16px;
  }

  .panel-actions {
    padding-inline: 16px;
  }

  .pathway-hero {
    align-items: flex-start;
    flex-direction: column;
    gap: 16px;
    border-radius: 18px;
  }

  .pathway-item {
    grid-template-columns: 46px 82px minmax(0, 1fr);
    gap: 12px;
    min-height: 0;
    padding: 14px;
    border-left-width: 6px;
  }

  .pathway-order {
    width: 42px;
    height: 42px;
    border-width: 3px;
  }

  .pathway-visual {
    width: 82px;
    height: 70px;
  }

  .pathway-action {
    grid-column: 1 / -1;
    width: 100%;
    min-width: 0;
    min-height: 56px;
  }

  .session-gate {
    align-items: start;
    padding: 20px 12px 32px;
  }

  .session-gate-card {
    padding: 27px 19px 25px;
    border-radius: 24px;
  }

  .session-gate-mark {
    width: 166px;
    height: 166px;
    margin-bottom: 18px;
    border-radius: 34px;
  }

  .session-gate-intro {
    margin-bottom: 20px;
  }

  .session-pin-display {
    grid-template-columns: repeat(4, 44px);
    gap: 8px;
  }

  .session-pin-display span {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }

  .session-pin-keypad {
    gap: 7px;
  }

  .session-pin-keypad button {
    min-height: 52px;
  }
}

@media (max-width: 430px) {
  .header-logo {
    display: block;
    width: 34px;
    height: 34px;
  }

  body.session-mode .launcher-title {
    font-size: 0.72rem;
  }

  .session-participant {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
    font-size: 0.76rem;
  }

  body.session-mode #session-participant-name {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  body.session-mode #pathway-overview-button,
  body.session-mode #next-step-button {
    padding-inline: 7px;
  }

  body.session-mode #pathway-overview-button .tool-label,
  body.session-mode #next-step-button .tool-label {
    font-size: 0.68rem;
  }

  .launcher-title {
    font-size: 0.75rem;
  }

  .catalogue-content.levels-grid {
    gap: 16px;
    padding: 22px 16px 48px;
  }

  .competence-tile {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .selection-toggle-label {
    max-width: 158px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .cart-item {
    grid-template-columns: 20px 46px minmax(0, 1fr);
  }

  .panel-thumbnail {
    width: 46px;
    height: 43px;
  }

  .cart-item-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
  }

  .progression-settings label,
  .threshold-row {
    grid-template-columns: 1fr !important;
    gap: 6px;
  }

  .threshold-row {
    grid-template-columns: 1fr 54px !important;
  }

  .threshold-row > span {
    grid-column: 1 / -1;
  }

  .scores-summary {
    gap: 5px;
    padding-inline: 12px;
  }

  .scores-summary > div {
    min-height: 62px;
    padding-inline: 4px;
  }

  .score-item-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 5px;
  }

  .score-item-head strong {
    white-space: normal;
  }

  .pathway-copy strong {
    white-space: normal;
  }

  .pathway-item {
    grid-template-columns: 42px 66px minmax(0, 1fr);
    gap: 10px;
    padding: 12px 10px;
    border-radius: 18px;
  }

  .pathway-order {
    width: 40px;
    height: 40px;
  }

  .pathway-visual {
    width: 66px;
    height: 60px;
  }

  .pathway-meta {
    font-size: 0.9rem;
  }

  .pathway-status {
    width: 100%;
    min-height: 42px;
    padding-right: 9px;
    border-radius: 15px;
    font-size: 0.92rem;
  }

  .app-toast {
    bottom: max(14px, calc(env(safe-area-inset-bottom) + 10px));
    font-size: 0.82rem;
  }
}

@keyframes panel-enter-mobile {
  from {
    opacity: 0;
    transform: translateY(34px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes auth-mark-enter {
  from {
    opacity: 0;
    scale: 0.72;
    rotate: -14deg;
  }
  to {
    opacity: 1;
    scale: 1;
    rotate: -4deg;
  }
}

@keyframes auth-content-enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (forced-colors: active) {
  .tool-button,
  .button,
  .selection-toggle,
  .selection-cart-button,
  .pathway-action,
  .difficulty-button.is-selected {
    border: 2px solid ButtonText;
  }

  .pathway-item.is-locked {
    opacity: 1;
  }
}
