/* Entraînement de frappe (typing.js) : un menu centré, puis une partie en plein écran dans un éditeur de code. */

/* ——— Menu principal : une bulle au milieu de l'écran ——— */
.ty-menu { display: grid; place-items: center; box-sizing: border-box; min-height: 100vh; min-height: 100dvh; padding: 24px 16px; }
.ty-menu-card { display: grid; justify-items: center; gap: 18px; width: min(100%, 520px); padding: 40px 32px 34px; border: 2px solid #2a424b; border-radius: 28px; background: #132329; box-shadow: 0 8px 0 #0a1418; color: #eef7f9; text-align: center; }
.ty-menu-card h1 { margin: 0 0 6px; color: #7aa2ff; font-size: clamp(34px, 6vw, 46px); line-height: 1.05; }
.ty-options { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; width: 100%; padding: 6px; box-sizing: border-box; border-radius: 18px; background: #0e1c21; }
.ty-options button { flex: 1 1 0; min-width: max-content; min-height: 48px; padding: 0 14px; border: 0; border-radius: 13px; background: transparent; color: #9bb5c0; cursor: pointer; font: inherit; font-size: 16px; font-weight: 800; transition: background .12s, color .12s; }
.ty-options button:hover { color: #fff; }
.ty-options button[aria-pressed="true"] { background: #7aa2ff; box-shadow: 0 3px 0 #4e74cf; color: #0b1a3a; }
.ty-options.is-small { width: auto; } .ty-options.is-small button { min-height: 40px; font-size: 15px; }
.ty-start { display: grid; place-items: center; width: 100%; min-height: 58px; margin-top: 8px; border-radius: 18px; background: #58cc02; box-shadow: 0 5px 0 #3f9400; color: #10300a; font-size: 20px; font-weight: 900; text-decoration: none; text-transform: uppercase; letter-spacing: .5px; transition: transform .12s, box-shadow .12s; }
.ty-start:hover { transform: translateY(3px); box-shadow: 0 2px 0 #3f9400; }
.ty-start:active { transform: translateY(5px); box-shadow: none; }

/* ——— Partie : plein écran, croix en haut à gauche, éditeur centré ——— */
.ty-play { position: fixed; z-index: 60; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); background: #0b1620; color: #eef7f9; outline: 0; animation: tyIn .25s ease-out; }
.ty-play-top { display: flex; align-items: center; gap: 18px; padding: 22px 26px 0; }
.ty-close { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; color: #8ea9b5; }
.ty-close svg { width: 26px; height: 26px; }
.ty-close:hover { background: #172a37; color: #fff; }
.ty-hud { display: flex; align-items: baseline; gap: 22px; margin-left: auto; color: #8ea9b5; font-size: 15px; }
.ty-hud strong { color: #eef7f9; font-size: 24px; font-variant-numeric: tabular-nums; }
.ty-hud-item.is-clock strong { color: #ffd34d; font-size: 30px; }
.ty-play-stage { display: grid; align-content: center; justify-items: center; gap: 16px; min-height: 0; padding: 12px 20px 36px; overflow: auto; }
.ty-instruction { max-width: 880px; margin: 0; color: #cfe0ea; font-size: 20px; font-weight: 800; line-height: 1.35; text-align: center; }
.ty-pad { position: relative; width: min(100%, 880px); overflow: hidden; border: 2px solid #24364f; border-radius: 16px; background: #0f1b2d; box-shadow: 0 18px 40px rgba(0, 0, 0, .45); cursor: text; transition: border-color .15s, box-shadow .15s; }
.ty-play.is-focused .ty-pad { border-color: #7aa2ff; box-shadow: 0 18px 40px rgba(0, 0, 0, .45), 0 0 0 4px rgba(122, 162, 255, .2); }
.ty-pad.is-shake { animation: tyShake .22s; }
.ty-pad.is-flash { animation: tyFlash .45s ease-out; }
.ty-tabs { display: flex; align-items: flex-end; gap: 4px; padding: 10px 12px 0; overflow-x: auto; background: #17263d; }
.ty-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 0; border-radius: 10px 10px 0 0; background: transparent; color: #7f93b3; cursor: pointer; font: 700 14px ui-monospace, "Cascadia Code", Consolas, monospace; white-space: nowrap; }
.ty-tab i { width: 10px; height: 10px; border-radius: 3px; background: #58cc02; } .ty-tab.is-local i { background: #31b7ff; } .ty-tab.is-module i { background: #c58bff; }
.ty-tab.is-on { background: #0f1b2d; color: #eef7f9; }
.ty-tab b { color: #58cc02; }
.ty-kind { margin: 0 4px 10px auto; padding-left: 12px; color: #5d7396; font: 600 12px ui-monospace, Consolas, monospace; white-space: nowrap; }
.ty-code { margin: 0; padding: 18px 22px 22px; overflow: auto; max-height: min(58vh, 560px); font: 600 19px/1.7 ui-monospace, "Cascadia Code", Consolas, monospace; white-space: pre; tab-size: 4; }
.ty-line { display: flex; }
.ty-line > i { flex: 0 0 32px; color: #33496a; font-size: 13px; font-style: normal; user-select: none; }
.ty-char { color: #4d6283; font-weight: inherit; }
.ty-char.is-done { color: #c8dcff; }
.ty-char.is-now { border-radius: 4px; background: rgba(122, 162, 255, .32); box-shadow: -2px 0 0 #7aa2ff; color: #fff; animation: tyBlink 1s steps(2) infinite; }
.ty-char.is-now.is-wrong { background: #ff6b6b; box-shadow: -2px 0 0 #ff6b6b; color: #2a0b0b; animation: none; }
.ty-enter { padding-left: 6px; opacity: .45; } .ty-enter.is-now { opacity: 1; }
.ty-input { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; padding: 0; border: 0; opacity: 0; resize: none; }
.ty-hint { margin: 0; color: #6f8aa0; font-size: 14px; }
.ty-play.is-running .ty-hint { visibility: hidden; }
.ty-result { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 16px; padding: 20px; background: rgba(15, 27, 45, .95); text-align: center; animation: tyIn .25s ease-out; }
.ty-result-title { margin: 0; color: #58cc02; font-size: 28px; font-weight: 900; }
.ty-result-stats { display: flex; gap: 12px; }
.ty-result-stats div { display: grid; gap: 2px; min-width: 96px; padding: 12px 10px; border-radius: 16px; background: #17263d; }
.ty-result-stats strong { font-size: 26px; } .ty-result-stats span { color: #8ea9b5; font-size: 13px; }
.ty-result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.ty-button { display: inline-grid; place-items: center; min-height: 48px; padding: 0 24px; border: 0; border-radius: 14px; background: #58cc02; box-shadow: 0 4px 0 #3f9400; color: #10300a; cursor: pointer; font: inherit; font-weight: 900; text-decoration: none; transition: transform .12s, box-shadow .12s; }
.ty-button:hover { transform: translateY(2px); box-shadow: 0 2px 0 #3f9400; }
.ty-button.is-quiet { background: #24364f; box-shadow: 0 4px 0 #152238; color: #d5e2f5; } .ty-button.is-quiet:hover { box-shadow: 0 2px 0 #152238; }
@keyframes tyBlink { 50% { background: transparent; } }
@keyframes tyShake { 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes tyFlash { from { box-shadow: 0 0 0 6px rgba(88, 204, 2, .55); } }
@keyframes tyIn { from { opacity: 0; } }
@media (max-width: 700px) {
  .ty-menu-card { padding: 30px 18px 24px; border-radius: 24px; }
  .ty-options button { min-height: 44px; padding: 0 10px; font-size: 15px; }
  .ty-play-top { padding: 14px 14px 0; gap: 10px; } .ty-hud { gap: 12px; font-size: 13px; } .ty-hud strong { font-size: 19px; } .ty-hud-item.is-clock strong { font-size: 22px; }
  .ty-play-stage { align-content: start; padding: 10px 12px 24px; }
  .ty-instruction { font-size: 17px; }
  .ty-code { padding: 14px 12px 16px; max-height: 52vh; font-size: 15px; white-space: normal; }
  .ty-line > i { flex-basis: 22px; } .ty-line > span { min-width: 0; overflow-wrap: anywhere; }
  .ty-tab { padding: 0 10px; font-size: 13px; } .ty-kind { display: none; }
  .ty-result-stats div { min-width: 78px; }
}
@media (prefers-reduced-motion: reduce) { .ty-play, .ty-play *, .ty-menu * { animation: none !important; transition: none !important; } }
.ty-play-stage { scrollbar-gutter: stable both-edges; }

/* Retouches du 26 nov. 2026 : titre blanc, options en petites fenêtres, icônes de script, emplacements à droite. */
.ty-menu-card h1 { color: #fff; }
.ty-option-list { display: grid; gap: 10px; width: 100%; }
.ty-option { position: relative; }
.ty-option-button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 54px; padding: 0 18px; border: 2px solid #2a424b; border-radius: 16px; background: #0e1c21; color: #9bb5c0; cursor: pointer; font: inherit; font-size: 16px; text-align: left; transition: border-color .12s; }
.ty-option-button strong { margin-left: auto; color: #fff; font-size: 17px; }
.ty-option-button i { color: #6f8a96; font-style: normal; transition: transform .15s; }
.ty-option-button:hover, .ty-option.is-open .ty-option-button { border-color: #7aa2ff; }
.ty-option.is-open .ty-option-button i { transform: rotate(180deg); }
.ty-popup { position: absolute; z-index: 5; top: calc(100% + 6px); left: 0; right: 0; display: grid; gap: 4px; padding: 6px; border: 2px solid #2a424b; border-radius: 16px; background: #182d35; box-shadow: 0 14px 30px rgba(0, 0, 0, .5); animation: tyPop .14s ease-out; }
.ty-popup button { display: flex; align-items: center; justify-content: space-between; min-height: 44px; padding: 0 14px; border: 0; border-radius: 11px; background: transparent; color: #d5e6ec; cursor: pointer; font: inherit; font-size: 16px; font-weight: 800; text-align: left; }
.ty-popup button:hover { background: #223941; }
.ty-popup button[aria-selected="true"] { background: #7aa2ff; color: #0b1a3a; }
@keyframes tyPop { from { opacity: 0; transform: translateY(-4px); } }
.ty-icon { flex: 0 0 auto; width: 18px; height: 18px; }
.ty-icon-page { fill: #f2f6fb; } .ty-icon-fold { fill: #b9c6d8; } .ty-icon-lines { stroke: #5f7088; }
.ty-icon.is-local .ty-icon-page { fill: #38a8ff; } .ty-icon.is-local .ty-icon-fold { fill: #1d76c2; } .ty-icon.is-local .ty-icon-lines { stroke: #0b3c68; }
.ty-icon.is-module .ty-icon-page { fill: #b57bff; } .ty-icon.is-module .ty-icon-fold { fill: #7f48c8; } .ty-icon.is-module .ty-icon-lines { stroke: #3d1b70; }
.ty-tab { cursor: default; }
.ty-editor { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; width: min(100%, 880px); }
.ty-editor.has-explorer { grid-template-columns: minmax(0, 1fr) 220px; width: min(100%, 1120px); }
.ty-editor .ty-pad { width: 100%; }
.ty-explorer { display: none; }
.ty-editor.has-explorer .ty-explorer { display: grid; gap: 14px; padding: 14px; border: 2px solid #24364f; border-radius: 16px; background: #0f1b2d; }
.ty-place { display: grid; gap: 6px; }
.ty-place p { margin: 0 0 2px; color: #7f93b3; font: 700 12px ui-monospace, Consolas, monospace; letter-spacing: .3px; }
.ty-file { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 12px; border: 2px solid transparent; border-radius: 11px; background: #17263d; color: #c8dcff; cursor: pointer; font: 700 14px ui-monospace, Consolas, monospace; text-align: left; }
.ty-file:hover { border-color: #33496a; }
.ty-file.is-on { border-color: #7aa2ff; background: #1c3050; color: #fff; }
.ty-file b { margin-left: auto; color: #58cc02; }
@media (max-width: 860px) {
  .ty-editor.has-explorer { grid-template-columns: minmax(0, 1fr); }
  .ty-editor.has-explorer .ty-explorer { order: -1; grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; padding: 10px; }
  .ty-place { grid-auto-flow: column; align-items: center; } .ty-place p { margin: 0 4px 0 0; }
}

/* Dernière version (26 nov. 2026) : le menu ne garde que le choix du niveau, en couleurs ; fenêtre de fin de script. */
.ty-menu-card { gap: 26px; }
.ty-levels { display: grid; gap: 12px; width: 100%; }
.ty-menu .ty-level { display: grid; place-items: center; min-height: 64px; padding: 0 20px; border: 0; border-radius: 18px; background: var(--tone); box-shadow: 0 5px 0 color-mix(in srgb, var(--tone) 62%, #000); color: #0c1a12; cursor: pointer; font: inherit; font-size: 21px; font-weight: 900; text-align: center; transition: transform .12s, box-shadow .12s; }
.ty-menu .ty-level:hover { transform: translateY(3px); box-shadow: 0 2px 0 color-mix(in srgb, var(--tone) 62%, #000); }
.ty-menu .ty-level:active { transform: translateY(5px); box-shadow: none; }
.ty-hud strong { color: #8ea9b5; font-size: 22px; }
.ty-play.is-running .ty-hud strong { color: #eef7f9; }
.ty-done { position: fixed; z-index: 70; inset: 0; display: grid; place-items: center; padding: 20px; background: rgba(6, 13, 20, .72); animation: tyIn .2s ease-out; }
.ty-done-box { display: grid; justify-items: center; gap: 16px; width: min(100%, 380px); padding: 32px 28px 28px; border: 2px solid #24364f; border-radius: 26px; background: #0f1b2d; box-shadow: 0 8px 0 #07101c; text-align: center; animation: tyDone .3s cubic-bezier(.2, 1.3, .4, 1); }
.ty-done-check { display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%; background: #58cc02; box-shadow: 0 6px 0 #3f9400; }
.ty-done-check svg { width: 46px; height: 46px; }
.ty-done-time { margin: 4px 0 2px; color: #fff; font-size: 44px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; }
.ty-done-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; width: 100%; }
.ty-done-actions .ty-button { flex: 1 1 130px; }
@keyframes tyDone { from { opacity: 0; transform: scale(.85); } }

/* Curseur de texte ordinaire (sa demande du 26 nov. 2026) : une fine barre verticale qui clignote, sans bulle ni contour. */
.ty-char.is-now { position: relative; border-radius: 0; background: none; box-shadow: none; color: #4d6283; animation: none; }
.ty-char.is-now::before { content: ""; position: absolute; left: -1px; top: 12%; bottom: 12%; width: 2px; background: #fff; animation: tyCaret 1.06s steps(1) infinite; }
.ty-char.is-now.is-wrong { background: none; box-shadow: none; color: #ff6b6b; }
.ty-char.is-now.is-wrong::before { background: #ff6b6b; animation: none; }
@keyframes tyCaret { 50% { opacity: 0; } }

/* Fenêtre de fin : trois boutons (Menu, Refaire, Script suivant). */
.ty-done-box { width: min(100%, 440px); }
.ty-done-actions .ty-button { flex: 1 1 110px; padding: 0 14px; }
.ty-done-actions .ty-button[data-ty-next] { flex-basis: 100%; order: 3; }
