/* F4IOZ site — « La CW, le documentaire » (cw-vues.js and the five tuto-cw-*.js): panels, timing diagrams and
   waterfalls in their frames, codes drawn as dots and dashes, the keys' pads, the decoders' lanes, « Apprendre » as
   small cards. Colours from tutos.css (--tu-*), both themes; reduced motion respected. */

/* A panel of the scene: a framed area that holds a drawing and its readings. */
.cw-panneau { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 16px; border: 1px solid var(--border-strong);
  background: linear-gradient(160deg, color-mix(in srgb, var(--tu-ciel) 7%, var(--panel)), var(--panel)); }
.cw-panneau canvas { border-radius: 10px; }
.cw-attente { padding: 18px; text-align: center; }
.cw-rang { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.cw-puce { padding: 6px 12px; min-height: 36px; border-radius: 999px; font-weight: 700; }
.cw-puce[aria-pressed="true"] { border-color: var(--tu-or); background: color-mix(in srgb, var(--tu-or) 22%, var(--panel-2)); }
.cw-jouer { min-height: 38px; border-radius: 999px; padding: 6px 14px; font-weight: 700; border-color: color-mix(in srgb, var(--tu-vert) 60%, var(--border-strong)); }
.cw-jouer span { display: inline-block; width: 1.1em; color: var(--tu-vert); }
.cw-jouer.en-cours { background: color-mix(in srgb, var(--tu-vert) 18%, var(--panel-2)); }
.cw-jouer.en-cours span { color: var(--tu-rouge); }
.cw-lectures { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 6px; margin: 0; }
.cw-lectures > div { padding: 6px 10px; border-radius: 10px; background: var(--panel-2); border: 1px solid var(--border); }
.cw-lectures dt { font-size: 11px; color: var(--muted, var(--tu-dim)); text-transform: uppercase; letter-spacing: .04em; }
.cw-lectures dd { margin: 0; font-size: 17px; font-weight: 800; color: var(--tu-or); }
.cw-curseur output { color: var(--tu-or); font-weight: 800; }
.cw-gros { font-size: 34px; font-weight: 800; letter-spacing: .08em; margin: 2px 0; color: var(--tu-or); }
.cw-signe { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--border-strong); }
.cw-signe p { margin: 0; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* A code drawn: dots round, dashes long, an inner space (American Morse) a gap. */
.cw-motif { display: inline-flex; align-items: center; gap: 4px; vertical-align: middle; padding: 2px 0; }
.cw-motif i { display: inline-block; height: 9px; border-radius: 5px; background: var(--tu-ciel); }
.cw-motif i.p { width: 9px; }
.cw-motif i.t { width: 27px; background: var(--tu-or); }
.cw-motif i.e { width: 14px; height: 2px; background: var(--tu-dim); opacity: .6; }

/* American against international. */
.cw-am table { border-collapse: collapse; width: 100%; }
.cw-am th, .cw-am td { padding: 7px 10px; border-bottom: 1px solid var(--border); text-align: left; }
.cw-am tbody th { font: 800 20px var(--font-mono, ui-monospace, monospace); color: var(--tu-or); width: 40px; }

/* The dates, put in order. */
.cw-ordre { margin: 0; padding: 0 0 0 22px; display: flex; flex-direction: column; gap: 6px; counter-reset: none; }
.cw-etape { padding: 8px 12px; border-radius: 10px; background: color-mix(in srgb, var(--tu-vert) 12%, var(--panel-2)); border-left: 4px solid var(--tu-vert); animation: cw-arrive .4s ease-out both; }
@keyframes cw-arrive { from { transform: translateX(-14px); opacity: 0; } to { transform: none; opacity: 1; } }

.cw-frise { list-style: none; padding: 0 0 0 26px; position: relative; gap: 10px; }
.cw-frise::before { content: ''; position: absolute; left: 9px; top: 6px; bottom: 6px; width: 4px; border-radius: 2px; background: linear-gradient(var(--tu-ciel), var(--tu-violet)); }
.cw-frise li { position: relative; min-height: 40px; display: flex; align-items: center; }
.cw-frise li::before { content: ''; position: absolute; left: -23px; width: 14px; height: 14px; border-radius: 50%; background: var(--panel); border: 3px solid var(--tu-ciel); }
.cw-frise li.cw-vide { padding: 8px 12px; border-radius: 10px; border: 2px dashed var(--border-strong); color: var(--tu-dim); font-weight: 800; }
.cw-frise li.cw-etape::before { background: var(--tu-vert); border-color: var(--tu-vert); }
.cw-legende { display: flex; flex-wrap: wrap; gap: 14px; margin: 0; font-size: 13px; color: var(--tu-dim); }
.cw-legende span { display: inline-flex; align-items: center; gap: 6px; }
.cw-legende i { display: inline-block; width: 22px; height: 10px; border-radius: 4px; }
.cw-legende .point i { width: 10px; background: var(--tu-ciel); } .cw-legende .trait i { background: var(--tu-or); }
.cw-legende .lettre i { height: 4px; background: var(--tu-vert); } .cw-legende .mot i { height: 4px; background: var(--tu-rose); }

/* Vail's bars. */
.cw-barres { display: grid; gap: 6px; }
.cw-barre { display: grid; grid-template-columns: 100px 1fr 60px; align-items: center; gap: 8px; }
.cw-barre i { height: 14px; border-radius: 7px; background: var(--c); width: calc(var(--v) * 100%); box-shadow: 0 0 12px color-mix(in srgb, var(--c) 40%, transparent); animation: cw-pousse .8s ease-out both; transform-origin: left; }
.cw-barre b { color: var(--c); font-size: 16px; }
@keyframes cw-pousse { from { transform: scaleX(0); } to { transform: none; } }

/* The tree. */
.cw-arbre svg { width: 100%; height: auto; max-height: 46vh; display: block; }
.cw-noeud { cursor: pointer; outline: none; }
.cw-noeud circle { stroke: var(--panel); stroke-width: 3; transition: transform .15s; transform-box: fill-box; transform-origin: center; }
.cw-noeud text { font: 800 14px system-ui, sans-serif; fill: #0B1220; pointer-events: none; }
.cw-noeud:hover circle, .cw-noeud:focus-visible circle { transform: scale(1.18); stroke: var(--tu-texte); }
.cw-noeud.trouve circle { stroke: var(--tu-vert); stroke-width: 5; }

/* Linking: two columns of buttons. */
.cw-relier { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cw-col { display: flex; flex-direction: column; gap: 8px; }
.cw-relier .tu-rep { border-left: 6px solid var(--tu-c, var(--border-strong)); justify-content: flex-start; }
.cw-relier .tu-rep[aria-pressed="true"] { border-color: var(--tu-or); background: color-mix(in srgb, var(--tu-or) 18%, var(--panel-2)); }
.cw-signe-b { min-height: 46px; }

/* Prosigns: two sendings. */
.cw-paires { gap: 10px; }
.cw-paire { display: grid; grid-template-columns: 70px 1fr auto; gap: 8px; align-items: center; }
.cw-zone { width: 100%; min-width: 0; }
.cw-chiffres { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.cw-chiffres > div { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--border); }
.cw-chiffres > div.conteste { border-style: dashed; border-color: var(--tu-orange); }
.cw-chiffres b { font-size: 18px; } .cw-chiffres i { font-style: normal; font-weight: 800; font-size: 20px; color: var(--tu-or); }
.cw-chiffres .cw-motif i.p { width: 7px; height: 7px; } .cw-chiffres .cw-motif i.t { width: 18px; height: 7px; } .cw-chiffres .cw-motif { gap: 3px; }

/* The keys' pads (the iambic keyer, the straight key): big zones for a finger. */
.cw-pads { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cw-pad { min-height: 120px; border-radius: 22px; border: 2px solid var(--border-strong); font: 800 18px system-ui, sans-serif; color: var(--tu-texte); touch-action: none; user-select: none; -webkit-user-select: none;
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--tu-c) 30%, var(--panel-2)), var(--panel-2)); transition: transform .05s, box-shadow .1s; }
.cw-pad small { display: block; font-weight: 600; font-size: 12px; color: var(--tu-dim); }
.cw-pad.on { transform: scale(.97); box-shadow: inset 0 0 0 4px var(--tu-c), 0 0 24px color-mix(in srgb, var(--tu-c) 55%, transparent); }
.cw-pad.point { --tu-c: var(--tu-ciel); } .cw-pad.trait { --tu-c: var(--tu-or); } .cw-pad.pioche { --tu-c: var(--tu-vert); grid-column: 1 / -1; min-height: 140px; }
.cw-sortie { font: 800 26px var(--font-mono, ui-monospace, monospace); color: var(--tu-or); min-height: 38px; letter-spacing: .06em; word-break: break-all; }
.cw-mode { display: flex; gap: 6px; }
.cw-mode .tu-btn[aria-pressed="true"] { border-color: var(--tu-violet); background: color-mix(in srgb, var(--tu-violet) 22%, var(--panel-2)); }

/* Real extracts side by side, the waterfall picture, Koch's letters. */
.cw-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.cw-extrait { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cw-extrait h3 { margin: 0; font-size: 15px; }
.cw-image { margin: 0; } .cw-image img { width: 100%; height: auto; border-radius: 10px; display: block; }
.cw-connus { font-size: 30px; font-weight: 800; color: var(--tu-or); margin: 0; letter-spacing: .1em; }
.cw-formule { margin: 0; color: var(--tu-violet); font-weight: 700; }
@media (max-width: 900px) { .cw-duo { grid-template-columns: 1fr; } }

/* The machine: the chain's stages, the spots, the duties. */
.cw-etages { display: flex; gap: 6px; list-style: none; padding: 0; margin: 0; flex-wrap: wrap; }
.cw-etages li { padding: 5px 12px; border-radius: 999px; border: 1px solid var(--border-strong); font-size: 12px; font-weight: 700; color: var(--tu-dim); }
.cw-etages li.ici { border-color: var(--tu-or); color: var(--tu-or); background: color-mix(in srgb, var(--tu-or) 14%, var(--panel-2)); }
.cw-etages li.fait { border-color: var(--tu-vert); color: var(--tu-vert); }
.cw-etage { min-height: 200px; display: flex; flex-direction: column; gap: 6px; animation: cw-arrive .35s ease-out both; }
.cw-spots tbody tr { cursor: pointer; } .cw-spots tbody tr:hover, .cw-spots tbody tr:focus-visible { background: color-mix(in srgb, var(--tu-ciel) 12%, transparent); outline: none; }
.cw-cases { gap: 6px; } .cw-cases .jeu-case { padding: 6px 8px; border-radius: 10px; }
.cw-cases .jeu-case.juste { background: color-mix(in srgb, var(--tu-vert) 14%, transparent); }
.cw-choix-extraits { display: flex; flex-wrap: wrap; gap: 4px; } .cw-choix-extraits .tf-c { font-size: 12px; padding: 4px 8px; min-height: 30px; }

/* Today: a situation, a log line. */
.cw-situation { font-size: 18px; font-weight: 700; margin: 0; }
.cw-journal { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; align-items: end; }
.cw-journal > .cw-jouer { grid-column: 1 / -1; justify-self: start; }
.cw-champ { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--tu-dim); font-weight: 700; text-transform: uppercase; }

/* The jack. */
.cw-jack svg { width: 100%; height: auto; max-height: 30vh; display: block; }
.cw-partie { cursor: pointer; outline: none; }
.cw-partie text { font: 700 15px system-ui, sans-serif; fill: var(--tu-texte); }
.cw-partie:hover > :first-child, .cw-partie:focus-visible > :first-child, .cw-partie.choisi > :first-child { stroke: var(--tu-or); stroke-width: 4; }
.cw-partie.fait > :first-child { stroke: var(--tu-vert); stroke-width: 4; }

/* Copying: a field to type in, the verdict per character. */
.cw-copie { width: 100%; font: 700 20px var(--font-mono, ui-monospace, monospace); padding: 10px 12px; border-radius: 12px; border: 2px solid var(--border-strong); background: var(--panel-2); color: var(--tu-texte); text-transform: uppercase; }
.cw-copie:focus { outline: none; border-color: var(--tu-or); }
.cw-verdict { font: 700 18px var(--font-mono, ui-monospace, monospace); letter-spacing: .06em; }
.cw-verdict .ok { color: var(--tu-vert); } .cw-verdict .ko { color: var(--tu-rouge); text-decoration: underline wavy; }
.cw-statut { font-style: italic; color: var(--tu-dim); font-size: 13px; }
.cw-palier { display: flex; gap: 4px; flex-wrap: wrap; } .cw-palier span { padding: 3px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--border); font-size: 12px; }
.cw-palier span.fait { border-color: var(--tu-vert); color: var(--tu-vert); } .cw-palier span.ici { border-color: var(--tu-or); color: var(--tu-or); }

/* A table of figures. */
.cw-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.cw-table th, .cw-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.cw-table td.mono, .cw-table td b { color: var(--tu-or); }
.cw-table tr.choisi td { background: color-mix(in srgb, var(--tu-or) 14%, transparent); }

/* Tokens of a reading to label. */
.cw-jetons { display: flex; flex-wrap: wrap; gap: 6px; }
.cw-jeton { font: 800 17px var(--font-mono, ui-monospace, monospace); padding: 6px 10px; border-radius: 10px; border: 2px solid var(--border-strong); background: var(--panel-2); color: var(--tu-texte); cursor: pointer; }
.cw-jeton[aria-pressed="true"] { border-color: var(--tu-or); }
.cw-jeton.juste { border-color: var(--tu-vert); background: color-mix(in srgb, var(--tu-vert) 16%, var(--panel-2)); }
.cw-jeton small { display: block; font: 600 10px system-ui, sans-serif; color: var(--tu-dim); }

/* The blinking rack of the machine room. */
.cw-clignote { animation: cw-clignote var(--d, 1s) steps(2, jump-none) infinite; }
@keyframes cw-clignote { 50% { opacity: .2; } }

/* « Apprendre »: small cards, then the technical part. */
.cw-cartes { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; margin-bottom: 12px; }
.cw-carte { padding: 10px 12px 4px; border-radius: 14px; background: linear-gradient(150deg, color-mix(in srgb, var(--tu-or) 9%, var(--panel-2)), var(--panel-2)); border: 1px solid var(--border-strong); border-top: 4px solid var(--tu-or); }
.cw-carte:nth-child(3n+2) { border-top-color: var(--tu-ciel); } .cw-carte:nth-child(3n) { border-top-color: var(--tu-vert); }
.cw-carte h3 { margin: 0 0 4px; font-size: 15px; }
.cw-carte p { margin: 0 0 8px; font-size: 13.5px; line-height: 1.45; }
.cw-loin { margin: 6px 0 12px; padding: 8px 12px; border-radius: 14px; border: 1px dashed var(--border-strong); background: var(--panel); }
.cw-loin summary { cursor: pointer; font-weight: 800; color: var(--tu-violet); }
.cw-loin h3 { font-size: 14px; margin: 12px 0 4px; }
.cw-loin p { font-size: 13px; line-height: 1.5; }

@media (prefers-reduced-motion: reduce) {
  .cw-etape, .cw-barre i, .cw-clignote { animation: none; }
  .cw-pad, .cw-noeud circle { transition: none; }
}
@media (max-width: 700px) {
  .cw-relier { grid-template-columns: 1fr; }
  .cw-paire { grid-template-columns: 1fr; }
  .cw-pad { min-height: 100px; }
}
