/* Presentation only. Cell colours, audio, keyboard commands and stored data stay in the original pages. */
:root {
  color-scheme: light;
  --page: #f7f6fb; --surface: #ffffff; --surface-soft: #f0eef7;
  --ink: #35334c; --muted: #706e85; --line: #dedcea;
  --accent: #66548d; --accent-soft: #efebf8; --radius: 16px;
}
html { scroll-padding-top: 24px; }
body {
  margin: 0; padding: 28px 24px 56px; background: radial-gradient(ellipse at 6% 0%, #eee8fa 0%, transparent 48%), radial-gradient(ellipse at 100% 25%, #e7f3f6 0%, transparent 48%), var(--page); color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.6; display: flex; flex-direction: column; align-items: center;
}
body *, body *::before, body *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
.lab-masthead { width: min(100%, 1040px); display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 0 auto 20px; }
.lab-brand { display: inline-flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; font-size: 17px; font-weight: 700; letter-spacing: -.02em; }
.lab-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, #8060ad, #398eab); color: white; font-size: 29px; font-weight: 400; line-height: 1; }
.lab-caption { font-size: 12px; color: var(--muted); letter-spacing: .06em; }
/* Choix de la langue : bien visible, même style que la navigation */
.lab-langs { display: flex; align-items: center; gap: 4px; padding: 5px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; font-size: 13px; font-weight: 600; }
.lab-langs::before { content: "🌐" / ""; padding: 0 4px 0 6px; font-size: 16px; }
.lab-langs a { padding: 6px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; }
.lab-langs a:hover { background: var(--surface-soft); color: var(--ink); }
.lab-langs a[aria-current="true"] { background: linear-gradient(115deg, #75609e, #4e819e); color: white; }
.lab-nav { width: min(100%, 1040px); display: flex; flex-wrap: wrap; gap: 5px; padding: 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; margin: 0 auto 34px; }
.lab-nav a { display: block; padding: 8px 13px; border-radius: 8px; font-size: 13px; font-weight: 550; color: var(--muted); text-decoration: none; }
.lab-nav a:hover { background: var(--surface-soft); color: var(--ink); }
.lab-nav a[aria-current="page"] { background: linear-gradient(115deg, #75609e, #4e819e); color: white; }
body > h1, main > h1 { max-width: 960px; margin: 0 0 12px; color: var(--ink); font-size: clamp(24px, 3vw, 34px); line-height: 1.22; font-weight: 650; letter-spacing: -.035em; text-align: center; }
body > main { width: min(100%, 960px); max-width: 960px; margin: 0 auto; }
body > main > h1 { text-align: left; }
body > main > p { color: var(--muted); }
h2, h3 { color: var(--ink); }
main h2 { border-color: var(--line); font-weight: 650; padding-bottom: 10px; }
a { color: var(--accent); text-underline-offset: 3px; }
.sub, .top-links { max-width: 900px; color: var(--muted); font-size: 13px; line-height: 1.9; margin: 0 auto 25px; text-align: center; }
.sub a, .top-links a { color: var(--accent); }
button, select, input { font: inherit; }
button, select { min-height: 42px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 9px; font-size: 13px; padding: 9px 14px; box-shadow: none; }
button { font-weight: 550; cursor: pointer; transition: background .15s, border-color .15s; }
button:hover, select:hover { filter: none; background: var(--surface-soft); border-color: #b2a5c9; }
button.primary, .tab.active { background: linear-gradient(115deg, #75609e, #4e819e); border-color: #746394; color: white; }
button.primary:hover, .tab.active:hover { background: #655084; }
button:disabled, select:disabled { cursor: not-allowed; opacity: .5; }
input[type="text"], input[type="number"], .field input[type="number"], .dots input, .dots select, .field select { color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 9px 12px; }
input[type="text"] { min-width: 0; min-height: 46px; font-size: 16px; }
input[type="range"] { accent-color: var(--accent); max-width: 100%; }
label, .field { color: var(--muted); font-size: 13px; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible, .cell:focus-visible { outline: 3px solid #9276ba; outline-offset: 3px; }
kbd, code { color: var(--ink); background: #eef0eb; border: 1px solid #d2d9d0; border-radius: 5px; font-size: 11px; padding: 2px 6px; }
.controls { max-width: 960px; padding: 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); gap: 12px; margin-bottom: 22px; }
.controls button { min-height: 46px; padding-inline: 25px; }
.tabs { width: min(100%, 960px); justify-content: flex-start; gap: 6px; margin-bottom: 14px; border-bottom: 1px solid var(--line); padding-bottom: 12px; }
.tab { padding-inline: 20px; }
.panel { width: min(100%, 960px); max-width: 960px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px; gap: 18px; margin-bottom: 18px; }
.settings { max-width: none; justify-content: flex-start; gap: 18px 24px; margin: 0; }
.settings label { flex-wrap: wrap; min-width: 0; }
.settings select { max-width: 100%; }
.preset-label { color: var(--muted); font-size: 13px; line-height: 1.7; text-align: left; margin: 0; align-self: stretch; }
.form { grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); gap: 20px 28px; margin: 0; }
.field { gap: 8px; }
.field small { color: var(--muted); font-size: 12px; }
.field .val { color: var(--ink); }
.cells-wrap { width: min(100%, 960px); max-width: 960px; min-height: 112px; padding: 26px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); gap: 18px; }
.cell-label { color: var(--ink); font-size: 15px; font-weight: 700; line-height: 1.3; }   /* lettre sous la cellule : bien lisible */
.cell:focus-visible .cell-face { box-shadow: 0 0 0 3px #45785f; }
.perkins { max-width: 960px; margin-top: 20px; padding: 24px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.perkins:focus { border: 1px solid var(--accent); box-shadow: 0 0 0 3px #e9dff7; }
.perkins-head { color: var(--ink); gap: 16px; margin-bottom: 18px; }
.perkins-keys, .keys-help, .help, .note { color: var(--muted); }
.perkins-live { background: #494061; }
.perkins-text { color: var(--ink); }
.perkins-cells { background: var(--surface-soft); min-height: 0; padding: 18px; }
.actions { gap: 10px; margin-top: 8px; }
.status, #status, .warn { color: #94552c; font-size: 13px; line-height: 1.7; }
.saved-note { color: var(--accent); }
.choice { background: var(--surface); border-color: var(--line); color: var(--ink); padding: 16px; border-radius: 11px; }
.choice small { color: var(--muted); font-size: 12px; margin-top: 5px; }
.choice[aria-pressed="true"] { color: var(--ink); border-color: var(--accent); background: var(--accent-soft); box-shadow: inset 3px 0 var(--accent); }
.progress { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.letter { color: var(--ink); }
.letter.hidden-letter { color: transparent; text-shadow: 0 0 18px rgba(78,62,110,.25); }
.cellbox span { color: var(--muted); }
.cellbox .cell { background: #263b32; }
/* Juste / faux : contour et signe ✓ ✗, sans toucher au fond, qui garde la couleur du signe */
.cell.good, .cell.bad { position: relative; outline: 4px solid; outline-offset: 3px; }
.cell.good { outline-color: #2e9d5b; }
.cell.bad { outline-color: #c8453b; }
.cell.good::after, .cell.bad::after { position: absolute; top: -13px; right: -13px; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-size: 14px; font-weight: 700; line-height: 1; }
.cell.good::after { content: "✓" / ""; background: #2e9d5b; }
.cell.bad::after { content: "✗" / ""; background: #c8453b; }
.feedback, .summary, .big { color: var(--ink); }
table { border-collapse: collapse; max-width: 100%; }
th, td, table.dots th, table.dots td { border-color: var(--line); padding: 10px; }
th, table.dots th { color: var(--muted); font-size: 12px; font-weight: 650; }
td { color: var(--ink); }
#panel-settings { overflow-x: auto; }
#panel-settings > * { flex-shrink: 0; }
#panel-settings table { align-self: flex-start; }
main pre { color: var(--ink); background: var(--surface); border: 1px solid var(--line); }
main .cell { color: var(--ink); background: var(--surface-soft); border-color: var(--line); }
.wrap { width: min(100%, 640px); max-width: 640px; padding: 26px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.hint, .legend { color: var(--muted); }
.legend { border-color: var(--line); }
.legend strong { color: var(--ink); }
.lab-footnote { width: min(100%, 960px); margin: 28px auto 0; color: var(--muted); font-size: 12px; text-align: center; }
@media (max-width: 640px) {
 body { padding: 18px 14px 36px; }
 .lab-masthead { margin-bottom: 14px; }
 .lab-caption { max-width: 145px; font-size: 10px; text-align: right; }
 .lab-masthead:has(.lab-langs) .lab-caption { display: none; }   /* place pour le choix de la langue */
 .lab-langs a { padding: 6px 9px; }
 .lab-nav { margin-bottom: 26px; gap: 3px; }
 .lab-nav a { padding: 8px 10px; font-size: 12px; }
 .panel, .perkins, .wrap { padding: 18px; }
 .controls { padding: 14px; }
 .controls input[type="text"] { flex-basis: 100%; }
 .controls button { width: 100%; }
 .settings { flex-direction: column; align-items: stretch; gap: 16px; }
 .settings label { justify-content: space-between; }
 .settings select { width: 100%; }
 .settings input[type="range"] { flex: 1; min-width: 70px; width: auto; }
 .row { gap: 12px; }
 .choices { grid-template-columns: 1fr; }
 .cells { gap: 22px; }
 .cells-wrap { padding: 20px 14px; gap: 14px; }
 .perkins-head { align-items: flex-start; flex-direction: column; gap: 8px; }
 main nav ol { columns: 1; }
 th, td { padding: 8px 5px; font-size: 12px; overflow-wrap: anywhere; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; } }

/* Small colour cues give each space an identity without competing with the cells. */
.lab-nav a { border-bottom: 2px solid transparent; }
.lab-nav a:nth-child(1):not([aria-current]) { border-bottom-color: #c1a7df; }
.lab-nav a:nth-child(2):not([aria-current]) { border-bottom-color: #a9bae6; }
.lab-nav a:nth-child(3):not([aria-current]) { border-bottom-color: #92cbd4; }
.lab-nav a:nth-child(4):not([aria-current]) { border-bottom-color: #bdd4bc; }
.lab-nav a:nth-child(5):not([aria-current]) { border-bottom-color: #ead59f; }
.lab-nav a:nth-child(6):not([aria-current]) { border-bottom-color: #e7b5bd; }
.lab-nav a:nth-child(7):not([aria-current]) { border-bottom-color: #d4b1d7; }
.lab-nav a:nth-child(8):not([aria-current]) { border-bottom-color: #b8c4d9; }
.lab-nav a:nth-child(9):not([aria-current]) { border-bottom-color: #e6c3a8; }
.lab-nav a:hover { background: #f0edf8; }
.panel, .controls, .perkins, .wrap { box-shadow: 0 3px 18px rgba(94,75,133,.035); }
.choice[aria-pressed="true"] { background: linear-gradient(120deg, #efe8f8, #edf3fa); }
.perkins-live { background: linear-gradient(145deg, #64517d, #446d87); }
.lab-nav a { border: 1px solid #e2deeb; border-bottom-width: 2px; }
.lab-nav a[aria-current="page"] { border-color: #8275a6; }
/* Navigation: equal-width buttons across the whole bar. */
.lab-nav { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); }
.lab-nav a { text-align: center; padding-inline: 6px; white-space: nowrap; }   /* 9 onglets sur une ligne */
@media (max-width: 640px) {
  .lab-nav { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .lab-nav a:last-child:nth-child(odd) { grid-column: 1 / -1; }   /* onglet seul sur sa ligne : toute la largeur */
}

.sound-reference { width: min(100%, 960px); margin: -16px auto 22px; color: var(--muted); text-align: center; font-size: 12px; line-height: 1.7; }

.cell.playing .cell-face { transform: scale(1.08); box-shadow: 0 0 12px rgba(116,99,148,.28); }
.cell-face .dot.sounding { transform: scale(1.6); }

/* Shared visual hierarchy: tools, practice, results and help. */
.lab-nav { grid-template-columns: 3fr 4fr 2fr; gap: 16px; padding: 14px; border-radius: 16px; }
.nav-group { min-width: 0; }
.nav-group + .nav-group { border-left: 1px solid var(--line); padding-left: 16px; }
.nav-group-label { display: block; margin: 0 0 8px 6px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.nav-links { display: grid; gap: 5px; }
.nav-tools .nav-links { grid-template-columns: repeat(3, minmax(0,1fr)); }
.nav-practice .nav-links { grid-template-columns: repeat(4, minmax(0,1fr)); }
.nav-reference .nav-links { grid-template-columns: repeat(2, minmax(0,1fr)); }
.lab-nav .nav-links > a { white-space: normal; display: flex; align-items: center; justify-content: center; min-height: 44px; margin: 0; border: 1px solid transparent; border-bottom: 2px solid #c5b3de; padding: 8px 6px; line-height: 1.35; }
.lab-nav .nav-tools a:not([aria-current]) { background: #f4f0fa; border-bottom-color: #b9a6d2; }
.lab-nav .nav-practice a:not([aria-current]) { background: #eef6f8; border-bottom-color: #a0c8d4; }
.lab-nav .nav-reference a:not([aria-current]) { background: #f4f3f7; border-bottom-color: #c4bfd0; }
.lab-nav .nav-links a:hover { border-color: #aa9bc2; }
.lab-nav .nav-links a[aria-current="page"] { border-color: #8275a6; }
.instruction-details { width: min(100%,760px); margin: -10px auto 24px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.7); font-size: 14px; color: var(--muted); }
.instruction-details summary { cursor: pointer; padding: 12px 16px; font-weight: 600; color: var(--accent); }
.instruction-details > div, .instruction-details > p { padding: 0 16px 16px; line-height: 1.8; margin: 0; }
.command-details { margin: 12px 0 0; align-self: stretch; }
.panel > .progress { width: 100%; font-size: 16px; font-weight: 650; color: var(--ink); text-align: center; padding: 12px 16px; border-radius: 12px; background: linear-gradient(110deg,#f0eafa,#edf5f8); }
.exercise-progress { display: block; width: 100%; height: 7px; border: 0; border-radius: 12px; overflow: hidden; background: #e9e5f0; accent-color: #75609e; margin: -7px 0 12px; }
.exercise-progress::-webkit-progress-bar { background: #e9e5f0; border-radius: 12px; }
.exercise-progress::-webkit-progress-value { background: linear-gradient(90deg,#8563ac,#4a95ad); border-radius: 12px; }
.exercise-progress::-moz-progress-bar { background: linear-gradient(90deg,#8563ac,#4a95ad); border-radius: 12px; }
#menu > #startBtn { margin-top: 12px; min-width: 220px; padding: 13px 26px; font-size: 15px; }
button.primary { box-shadow: 0 3px 10px rgba(94,75,133,.12); }
#sameBtn, #diffBtn { min-width: 150px; padding: 14px 26px; border-color: #b6a8cc; font-size: 16px; background: #f2edf9; }
#sameBtn:hover, #diffBtn:hover { background: #e8dff4; }
#game .cells { gap: 36px; flex-wrap: wrap; }
#game .cell, #test .pair .cell, .row-cells .cell { width: 76px; height: 104px; padding: 12px 14px; border-radius: 12px; gap: 6px; }
#game .cell .dot, #test .pair .cell .dot, .row-cells .cell .dot { width: 15px; height: 15px; }
.row-cells { gap: 18px; padding: 12px 5px; }
.cellbox { gap: 12px; }
.cells-wrap { gap: 20px; }
.cell-face { border-radius: 10px; }
.feedback { line-height: 1.7; max-width: 640px; }
@media(max-width:900px) {
 .lab-nav { grid-template-columns: 1fr; gap: 12px; }
 .nav-group + .nav-group { border-left: 0; border-top: 1px solid var(--line); padding-left: 0; padding-top: 12px; }
}
@media(max-width:640px) {
 .lab-nav { padding: 12px; }
 .lab-nav .nav-links a:last-child { grid-column: auto; }
 .nav-practice .nav-links { grid-template-columns: repeat(2,minmax(0,1fr)); }
 .nav-group-label { margin-bottom: 6px; }
 .panel > .progress { font-size: 14px; padding: 10px; }
 #menu > #startBtn { width: 100%; min-width: 0; }
 #sameBtn, #diffBtn { min-width: 120px; }
 #game .cell, #test .pair .cell, .row-cells .cell { width: 64px; height: 88px; padding: 10px 12px; }
 #game .cell .dot, #test .pair .cell .dot, .row-cells .cell .dot { width: 13px; height: 13px; }
 .row-cells { gap: 14px; }
}

.concept-link { display: block; width: min(100%,960px); margin: 0 auto 24px; padding: 15px 20px; background: linear-gradient(110deg,#f0eafa,#edf5f8); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; }
.concept-link strong { display: block; color: var(--accent); font-size: 15px; }
.concept-link span { display: block; color: var(--muted); font-size: 13px; margin-top: 3px; }
.concept-link:hover { border-color: #aa9bc2; }
.wrap .concept-link { margin: 18px 0; }
.stats-cards { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; margin: 14px 0; }
.stats-card { padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.stats-card > span { display: block; font-size: 13px; color: var(--muted); }
.stats-card > strong { display: block; margin-top: 8px; font-size: 28px; line-height: 1.4; font-weight: 650; color: var(--accent); overflow-wrap: anywhere; }
#overviewReview { font-size: 22px; }
@media(max-width:640px) { .stats-cards { grid-template-columns: 1fr; gap: 10px; } .stats-card { padding: 16px 18px; } }
