/* Tests d'appareil : micro, webcam, clavier, souris, clics, frappe, écran, réaction */

.tt-centre { text-align: center; }
.tt-panneau { display: grid; gap: 14px; min-width: 0; }
.tt-tuiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tt-tuiles.tt-trois { grid-template-columns: repeat(3, 1fr); }
.tt-tuiles.tt-quatre { grid-template-columns: repeat(4, 1fr); }
.tt-tuiles .res { min-width: 0; }
.tt-tuiles .res b { display: block; overflow-wrap: anywhere; }
.tt-tuiles:not(.tt-quatre) .res-main b { font-size: 28px; }
.tt-quatre .res-main b { font-size: 24px; }
.tt-quatre .res-main { padding: 13px 16px; }

/* Choix unique (durée, niveau) */
.tt-seg { display: flex; gap: 4px; padding: 4px; border-radius: 14px; background: var(--soft); }
.tt-seg button { flex: 1; height: 42px; padding: 0 10px; border-radius: 11px; font: 600 15px/1 var(--body); color: var(--muted); transition: background .2s, color .2s; }
.tt-seg button[aria-pressed="true"] { background: #fff; color: var(--ink); box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(12, 12, 24, .08); }
.tt-reglages { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }

/* ── Micro ── */
.tt-etat { padding: 12px 14px; border-radius: 12px; background: var(--soft); font-size: 15px; line-height: 1.45; color: var(--text); }
.tt-etat[data-genre="erreur"] { background: var(--tint); color: var(--red-deep); }
.tt-etat[data-genre="ok"] { background: #e8f7ee; color: #0b7a3b; }
.tt-jauge { height: 22px; border-radius: 22px; background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
.tt-jauge i { display: block; height: 100%; background: linear-gradient(90deg, #17a35c 0 60%, #e0a000 82%, var(--red)); clip-path: inset(0 100% 0 0); }
.tt-onde { display: block; width: 100%; height: 120px; border-radius: 16px; background: var(--soft); }
.tt-ecoute { display: grid; gap: 8px; padding: 14px; border-radius: 16px; background: var(--soft); }
.tt-lecteur { width: 100%; }

/* ── Webcam ── */
.tt-cadre { display: grid; place-items: center; border-radius: 18px; background: #0b0b10; overflow: hidden; min-height: 180px; }
.tt-video { display: block; width: 100%; max-height: 62vh; object-fit: contain; }
.tt-video.tt-miroir { transform: scaleX(-1); }
.tt-cliche { display: grid; gap: 10px; padding: 14px; border-radius: 16px; background: var(--soft); }
.tt-photo { display: block; width: 100%; max-width: 360px; border-radius: 12px; }
.tt-cliche-bas { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }

/* ── Clavier ── */
.tool-box.tt-large { max-width: 1100px; }
.tt-clav-zone { padding: 14px; border-radius: 18px; background: var(--soft); overflow-x: auto; outline: 0; transition: box-shadow .2s; }
.tt-clav-zone:focus { box-shadow: 0 0 0 2px var(--red); }
.tt-clav { display: grid; grid-template-columns: 15fr 3fr 4fr; gap: 16px; min-width: 1000px; }
.tt-bloc { display: grid; grid-template-rows: repeat(6, 46px); gap: 5px; min-width: 0; }
.tt-nav { grid-template-columns: repeat(3, 1fr); }
.tt-pave { grid-template-columns: repeat(4, 1fr); }
.tt-rangee { display: flex; gap: 5px; min-width: 0; }
.tt-vide { flex: 1 1 0; }
.tt-k { flex: 1 1 0; min-width: 0; display: grid; place-items: center; align-content: center; border-radius: 9px; background: #fff; box-shadow: 0 0 0 1px var(--line), 0 2px 0 rgba(12, 12, 24, .1); font: 600 13px/1.15 var(--body); color: var(--ink); white-space: nowrap; overflow: hidden; user-select: none; transition: background .12s, color .12s, transform .08s; }
.tt-k small { font: 500 13px/1.1 var(--body); color: var(--muted); }
.tt-k.vue { background: #dff5e7; color: #0b6b35; box-shadow: 0 0 0 1px rgba(15, 145, 89, .4), 0 2px 0 rgba(15, 145, 89, .25); }
.tt-k.vue small { color: #0b6b35; }
.tt-k.on { background: var(--red); color: #fff; box-shadow: 0 0 0 1px var(--red-deep); transform: translateY(2px); }
.tt-k.on small { color: #fff; }
@media (max-width: 1140px) {
  .tt-pave { display: none; }
  .tt-clav { grid-template-columns: 15fr 3fr; min-width: 860px; }
}

/* ── Souris ── */
.tt-pad { display: grid; place-items: center; align-content: center; gap: 6px; min-height: 220px; padding: 24px; border: 2px dashed rgba(238, 47, 59, .38); border-radius: 18px; background: var(--tint); text-align: center; cursor: crosshair; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.tt-pad b { font: 600 18px/1.3 var(--head); color: var(--ink); }
.tt-pad span { font-size: 14px; color: var(--muted); }
.tt-cases { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.tt-case { display: grid; gap: 3px; min-width: 0; padding: 13px 14px; border-radius: 14px; background: #fff; box-shadow: 0 0 0 1px var(--line); transition: background .15s, box-shadow .15s, transform .12s; }
.tt-case b { font: 600 15px/1.3 var(--head); color: var(--ink); }
.tt-case span { font-size: 13px; color: var(--muted); }
.tt-case.vue { background: #e8f7ee; box-shadow: 0 0 0 1.5px rgba(15, 145, 89, .5); }
.tt-case.vue span { color: #0b7a3b; font-weight: 600; }
.tt-case.on { background: #c9eed7; transform: scale(.97); }

/* ── Grande zone de clic (clics par seconde, réaction) ── */
.tt-zone { display: grid; place-items: center; align-content: center; gap: 8px; width: 100%; min-height: 260px; padding: 24px; border-radius: 20px; background: var(--tint); box-shadow: inset 0 0 0 2px rgba(238, 47, 59, .3); text-align: center; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: background .15s; }
.tt-zone b { font: 700 clamp(22px, 4vw, 32px)/1.2 var(--head); letter-spacing: -.02em; color: var(--ink); }
.tt-zone span { min-height: 21px; font-size: 15px; line-height: 1.4; color: var(--text); }
.tt-zone[data-etat="encours"] { background: #ffe1e3; }
.tt-zone[data-etat="encours"]:active { background: #ffcfd3; }
.tt-zone[data-etat="fini"] { background: #e8f7ee; box-shadow: inset 0 0 0 2px rgba(15, 145, 89, .4); }
.tt-reac { transition: none; }
.tt-reac[data-etat="rouge"], .tt-reac[data-etat="tot"] { background: var(--red); box-shadow: none; }
.tt-reac[data-etat="vert"] { background: #12a150; box-shadow: none; }
.tt-reac[data-etat="rouge"] b, .tt-reac[data-etat="rouge"] span, .tt-reac[data-etat="tot"] b, .tt-reac[data-etat="tot"] span, .tt-reac[data-etat="vert"] b, .tt-reac[data-etat="vert"] span { color: #fff; }
.tt-essais { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; }
.tt-essais li { display: grid; gap: 2px; min-width: 0; padding: 10px 8px; border-radius: 12px; background: var(--soft); text-align: center; }
.tt-essais small { font-size: 13px; color: var(--muted); }
.tt-essais b { font: 600 16px/1.3 var(--head); color: var(--ink); white-space: nowrap; }
.tt-essais li.vue { background: #e8f7ee; }

/* ── Vitesse de frappe ── */
.tt-texte { position: relative; height: 148px; padding: 14px 18px; border-radius: 18px; background: var(--soft); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; cursor: text; transition: box-shadow .2s; }
.tt-texte:focus-within { box-shadow: inset 0 0 0 2px var(--red); }
.tt-texte[data-etat="fini"] { cursor: default; }
.tt-fenetre { height: 120px; overflow: hidden; }
.tt-lignes { font: 500 21px/40px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--muted); white-space: pre-wrap; overflow-wrap: break-word; transition: transform .2s var(--ease); }
.tt-lignes span { border-radius: 3px; }
.tt-lignes .ok { color: var(--ink); }
.tt-lignes .ko { color: var(--red-deep); background: #ffc9cd; }
.tt-lignes .ici { box-shadow: inset 0 -3px 0 var(--red); color: var(--ink); }
.tt-saisie { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; border: 0; background: transparent; color: transparent; caret-color: transparent; font-size: 16px; resize: none; opacity: 0; cursor: text; }
.tt-saisie:disabled { cursor: default; }

/* ── Écran ── */
.tt-couleurs { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.tt-couleur { display: grid; gap: 8px; justify-items: center; min-width: 0; padding: 8px 8px 10px; border-radius: 16px; background: #fff; box-shadow: 0 0 0 1px var(--line); font: 600 14px/1.2 var(--body); color: var(--ink); transition: transform .2s var(--ease), box-shadow .2s; }
.tt-couleur:hover { transform: translateY(-2px); box-shadow: 0 0 0 1px rgba(12, 12, 24, .18), 0 10px 22px -12px rgba(12, 12, 24, .35); }
.tt-couleur i { display: block; width: 100%; aspect-ratio: 16 / 10; border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(12, 12, 24, .14); }
.tt-apercu-mire { background: linear-gradient(90deg, #fff 0 14.3%, #ff0 0 28.6%, #0ff 0 42.9%, #0f0 0 57.2%, #f0f 0 71.5%, #f00 0 85.8%, #00f 0) center / 70% 46% no-repeat, #000; }
.tt-plein { position: fixed; inset: 0; z-index: 2147483000; width: 100vw; height: 100vh; height: 100dvh; background: #000; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.tt-plein.tt-calme { cursor: none; }
.tt-mire { position: absolute; inset: 0; display: block; width: 100%; height: 100%; }
.tt-guide { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); max-width: calc(100% - 32px); margin: 0; padding: 9px 16px; border-radius: 12px; background: rgba(12, 12, 24, .78); font: 500 15px/1.35 var(--body); color: #fff; text-align: center; pointer-events: none; transition: opacity .4s; }
.tt-guide[data-clair="1"] { background: rgba(12, 12, 24, .88); }
.tt-sortir { position: absolute; top: 14px; right: 14px; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: rgba(12, 12, 24, .78); font: 400 28px/1 var(--body); color: #fff; transition: opacity .4s; }
.tt-calme .tt-guide, .tt-calme .tt-sortir { opacity: 0; }
html.tt-fige { overflow: hidden; }

@media (max-width: 760px) {
  .tt-cases { grid-template-columns: 1fr 1fr; }
  .tt-tuiles.tt-quatre { grid-template-columns: 1fr 1fr; }
  .tt-couleurs { grid-template-columns: repeat(4, 1fr); }
  .tt-reglages { grid-template-columns: 1fr; }
  .tt-essais b { font-size: 14px; }
}
@media (max-width: 600px) {
  .tt-tuiles.tt-trois { grid-template-columns: 1fr 1fr; }
  .tt-tuiles.tt-trois .res:last-child { grid-column: 1 / -1; }
  .tt-zone { min-height: 220px; }
  .tt-lignes { font-size: 18px; line-height: 36px; }
  .tt-texte { height: 136px; padding: 14px; }
  .tt-fenetre { height: 108px; }
  .tt-couleurs { grid-template-columns: repeat(3, 1fr); }
  .tt-essais { grid-template-columns: repeat(3, 1fr); }
  .tt-essais small { font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) {
  .tt-lignes, .tt-k, .tt-case { transition: none; }
}
