:root {
  --fond: #f6f3ec; --texte: #1d1b16; --carte: #ffffff; --accent: #2f6fdb; --erreur: #c62828; --ok: #2e7d32; --doux: #8a8579;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--fond); color: var(--texte); font: 18px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
.ecran { min-height: 100vh; padding: 16px; display: flex; flex-direction: column; align-items: center; gap: 14px; }
h1 { margin: 0; font-size: clamp(22px, 3vw, 34px); }
.carte { background: var(--carte); border-radius: 16px; padding: 24px; box-shadow: 0 2px 12px #0001; width: min(100%, 420px); display: grid; gap: 12px; }
input, button { font: inherit; padding: 12px 16px; border-radius: 10px; border: 1px solid #ccc; }
button { background: var(--accent); color: #fff; border: 0; cursor: pointer; }
.erreur { color: var(--erreur); margin: 0; }

/* Couleurs des doigts (mêmes des deux côtés) */
.doigt-auriculaire { --d: #c8a2e8; } .doigt-annulaire { --d: #8ec5f2; } .doigt-majeur { --d: #9fdc9f; }
.doigt-index { --d: #ffc77d; } .doigt-pouce { --d: #d5d2ca; }

.zone-clavier { width: min(100%, 980px); display: grid; gap: 4px; }
.clavier { display: grid; gap: 5px; padding: 10px; background: #2b2a27; border-radius: 14px; }
.rangee { display: flex; gap: 5px; justify-content: center; }
.touche { position: relative; flex: 1 1 0; max-width: 66px; height: clamp(32px, 5.6vh, 56px); border-radius: 8px; background: var(--d, #4a4844);
  display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: clamp(11px, 1.6vw, 18px); color: #1d1b16;
  opacity: .55; transition: transform .08s, opacity .08s, box-shadow .08s; }
.touche small { position: absolute; top: 3px; left: 6px; font-size: .62em; font-weight: 500; }
.touche.vide { background: transparent; }
.touche.moyen { flex: .5 1 0; } .touche.large { flex: 1.4 1 0; max-width: 90px; background: #6d6a63; color: #fff; }
.touche.espace { flex: 0 1 50%; max-width: none; }
.touche.repere span { text-decoration: underline; text-underline-offset: 4px; }
.touche.cible { opacity: 1; transform: translateY(-3px) scale(1.08); box-shadow: 0 0 0 3px #fff, 0 0 18px 4px #fff8; z-index: 1; }
.touche.cible-avant { opacity: 1; box-shadow: 0 0 0 3px #ffeb3b; }
.mains { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 12px; }
.main { display: flex; align-items: flex-end; gap: 5px; justify-self: center; position: relative; padding-bottom: 18px; transform: scale(.8); transform-origin: bottom; }
.main .paume { position: absolute; bottom: 0; left: 4px; right: 4px; height: 26px; background: #e8e2d6; border-radius: 0 0 26px 26px; z-index: -1; }
.doigt { width: 22px; border-radius: 11px 11px 4px 4px; background: var(--d); opacity: .4; }
.main-g .doigt:nth-child(1), .main-d .doigt:nth-child(5) { height: 46px; }
.main-g .doigt:nth-child(2), .main-d .doigt:nth-child(4) { height: 62px; }
.main-g .doigt:nth-child(3), .main-d .doigt:nth-child(3) { height: 70px; }
.main-g .doigt:nth-child(4), .main-d .doigt:nth-child(2) { height: 64px; }
.main-g .doigt:nth-child(5) { height: 34px; transform: rotate(35deg) translate(4px, 8px); }
.main-d .doigt:nth-child(1) { height: 34px; transform: rotate(-35deg) translate(-4px, 8px); }
.doigt.actif { opacity: 1; box-shadow: 0 0 0 3px #1d1b16; }
.consigne-doigt { margin: 0; font-weight: 600; text-align: center; min-width: 14ch; }

/* Texte à recopier */
.texte-frappe { width: min(100%, 980px); background: var(--carte); border-radius: 16px; padding: 14px 22px; box-shadow: 0 2px 12px #0001;
  font: 500 clamp(22px, 3vw, 32px)/1.55 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .02em; word-break: break-word; }
.texte-frappe .fait { color: var(--ok); }
.texte-frappe .saute { color: var(--doux); }
.texte-frappe .courant { background: #ffe58a; border-bottom: 4px solid var(--accent); border-radius: 3px; }
.texte-frappe .courant.faute { background: #ffb3b3; border-bottom-color: var(--erreur); }
.texte-frappe .espace-visible.courant::after { content: "␣"; color: var(--doux); }
.alerte { background: #fff3cd; border: 2px solid #f0b400; border-radius: 12px; padding: 10px 16px; font-weight: 600; }
