/* Piano Trainer 3 — écran de leçon : portée, cartes « à jouer / tu joues », clavier */

.pt3-play { padding-top: 8px; }
.pt3-topbar { display: flex; align-items: center; gap: 8px; }
.pt3-topbar-mid { flex: 1; text-align: center; min-width: 0; }
.pt3-topbar h2 { font-size: 1.1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pt3-dots { display: flex; justify-content: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
.pt3-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--pt3-line); }
.pt3-dots i.is-done { background: var(--pt3-good); }
.pt3-dots i.is-current { background: var(--pt3-accent); transform: scale(1.3); }

/* Introduction */
.pt3-intro { display: grid; place-items: center; padding: 14px 0; }
.pt3-intro-card { background: var(--pt3-surface); border-radius: 24px; padding: 22px 20px; max-width: 640px; width: 100%; box-shadow: var(--pt3-shadow); text-align: center; }
.pt3-intro-ico { font-size: 3rem; }
.pt3-intro-card h3 { font-size: 1.5rem; margin: 4px 0 8px; }
.pt3-intro-card p { font-size: 1.05rem; margin-bottom: 14px; text-align: left; }
.pt3-intro-kb { margin: 0 0 16px; }
.pt3-intro-kb .pt3-kb { height: 110px; }

/* Zone de jeu */
.pt3-label-line { display: flex; justify-content: space-between; align-items: baseline; margin: 8px 2px 4px; }
.pt3-ex-label { font-weight: 800; }
.pt3-ex-count { color: var(--pt3-muted); font-size: .9rem; }

/* Portée */
.pt3-staff-wrap { background: var(--pt3-surface); border-radius: var(--pt3-radius); padding: 6px 8px; box-shadow: var(--pt3-shadow); }
.pt3-staff { width: 100%; height: auto; display: block; }
.pt3-staff .st-line { stroke: var(--pt3-text); stroke-width: 1.2; opacity: .55; }
.pt3-staff .st-clef { fill: none; stroke: var(--pt3-text); stroke-width: 2.2; stroke-linecap: round; opacity: .8; }
.pt3-staff .st-head { fill: var(--pt3-note, var(--pt3-text)); stroke: var(--pt3-note, var(--pt3-text)); stroke-width: 1.6; }
.pt3-staff .st-head.hollow { fill: var(--pt3-surface); }
.pt3-staff .st-stem { stroke: var(--pt3-note, var(--pt3-text)); stroke-width: 1.6; }
.pt3-staff .st-name { font-size: 13px; font-weight: 800; fill: var(--pt3-muted); text-anchor: middle; }
.pt3-staff .st-note { opacity: .85; transition: opacity var(--pt3-transition); }
.pt3-staff .st-note.is-done { --pt3-note: var(--pt3-good) !important; opacity: .6; }
.pt3-staff .st-note.is-current { opacity: 1; }
.pt3-staff .st-halo { fill: var(--pt3-target); opacity: 0; }
.pt3-staff .st-note.is-current .st-halo { opacity: .18; animation: pt3-halo 1.4s ease-in-out infinite; }
.pt3-staff .st-note.is-bad .st-halo { fill: var(--pt3-bad); opacity: .28; animation: none; }
.pt3-staff .st-cursor-ghost { fill: none; stroke: var(--pt3-bad); stroke-width: 2; stroke-dasharray: 4 3; }
@keyframes pt3-halo { 50% { opacity: .38; } }

/* Face-à-face : à jouer VS tu joues */
.pt3-versus { display: grid; grid-template-columns: 1fr 64px 1fr; align-items: stretch; gap: 8px; margin: 12px 0 6px; }
.pt3-card {
  background: var(--pt3-surface); border-radius: var(--pt3-radius); padding: 10px 8px; text-align: center;
  border: 3px solid var(--pt3-line); display: flex; flex-direction: column; justify-content: center; min-height: 112px;
  transition: background var(--pt3-transition), border-color var(--pt3-transition), transform var(--pt3-transition);
}
.pt3-card-title { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--pt3-muted); font-weight: 800; }
.pt3-card-note { font-size: clamp(2rem, 9vw, 3.2rem); font-weight: 900; line-height: 1.1; }
.pt3-card-sub { font-size: .85rem; color: var(--pt3-muted); min-height: 1.2em; }
.pt3-card-target { border-color: var(--pt3-target); }
.pt3-card[data-state="good"] { background: var(--pt3-good-bg); border-color: var(--pt3-good); }
.pt3-card[data-state="bad"]  { background: var(--pt3-bad-bg);  border-color: var(--pt3-bad); animation: pt3-shake .35s; }
.pt3-card[data-state="near"] { background: var(--pt3-near-bg); border-color: var(--pt3-near); }
.pt3-card[data-state="idle"] .pt3-card-note { color: var(--pt3-muted); }

/* Jauge directionnelle */
.pt3-gauge { display: grid; place-items: center; }
.pt3-gauge-arrow { font-size: 2.2rem; font-weight: 900; color: var(--pt3-muted); transition: color var(--pt3-transition), transform var(--pt3-transition); }
.pt3-gauge[data-dir="left"]  .pt3-gauge-arrow { color: var(--pt3-bad); }
.pt3-gauge[data-dir="right"] .pt3-gauge-arrow { color: var(--pt3-bad); }
.pt3-gauge[data-dir="ok"]    .pt3-gauge-arrow { color: var(--pt3-good); transform: scale(1.2); }
.pt3-message { min-height: 2.6em; text-align: center; font-weight: 700; font-size: 1.05rem; margin: 4px 0 8px; }
.pt3-message.is-good { color: var(--pt3-good); }
.pt3-message.is-bad  { color: var(--pt3-bad); }
.pt3-message.is-near { color: var(--pt3-near); }
@keyframes pt3-shake { 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }

/* Clavier */
.pt3-kb-wrap { background: var(--pt3-surface); border-radius: var(--pt3-radius); padding: 10px 8px 8px; box-shadow: var(--pt3-shadow); }
.pt3-kb { position: relative; height: clamp(150px, 30vh, 230px); user-select: none; touch-action: manipulation; }
.pt3-kb .kw {
  position: absolute; top: 0; bottom: 0; background: #fff; border: 1.5px solid #8d849c;
  border-radius: 0 0 9px 9px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center;
  padding-bottom: 8px; cursor: pointer; color: #2b2438; font-weight: 800; font-size: .8rem; overflow: visible;
}
.pt3-kb .kb-black {
  position: absolute; top: 0; height: 62%; background: #2b2438; border-radius: 0 0 6px 6px;
  z-index: 2; cursor: pointer; border: 1px solid #000;
}
.pt3-kb .k-name { pointer-events: none; }
.pt3-kb .k-finger {
  pointer-events: none; width: 24px; height: 24px; border-radius: 50%; background: var(--pt3-accent); color: #fff;
  display: grid; place-items: center; font-size: .8rem; margin-bottom: 4px;
}
.pt3-kb .kw.is-color { background: color-mix(in srgb, var(--k-col) 22%, #fff); }
.pt3-kb .kw.is-dim { opacity: .55; }
.pt3-kb .kw.is-target { box-shadow: inset 0 0 0 4px var(--pt3-target); background: #dbe7ff; animation: pt3-key-pulse 1.1s ease-in-out infinite; }
.pt3-kb .kw.is-good  { background: #b6f0cd; box-shadow: inset 0 0 0 4px var(--pt3-good); animation: none; }
.pt3-kb .kw.is-bad,  .pt3-kb .kb-black.is-bad  { background: #ffc9c4; box-shadow: inset 0 0 0 4px var(--pt3-bad); }
.pt3-kb .kb-black.is-bad { background: var(--pt3-bad); }
.pt3-kb .kw.is-near  { background: #ffe3a8; box-shadow: inset 0 0 0 4px var(--pt3-near); }
.pt3-kb .kw.is-pressed { background: #e8e1f5; }
@keyframes pt3-key-pulse { 50% { box-shadow: inset 0 0 0 7px var(--pt3-target); } }

/* Marqueur « note entendue » (bille + flèche vers la cible) */
.pt3-kb .k-ball {
  position: absolute; top: 14px; left: 50%; width: 30px; height: 30px; margin-left: -15px; border-radius: 50%;
  display: grid; place-items: center; z-index: 4; font-size: 1.1rem; color: #fff; pointer-events: none;
  background: var(--pt3-bad); box-shadow: 0 2px 8px rgba(0,0,0,.35);
}
.pt3-kb .k-ball.is-good { background: var(--pt3-good); }
.pt3-kb .k-ball.is-near { background: var(--pt3-near); }
.pt3-kb .kb-black .k-ball { top: 8px; }
.pt3-kb .k-arrow {
  position: absolute; top: 46px; z-index: 5; font-size: 1.5rem; font-weight: 900; color: var(--pt3-bad); pointer-events: none;
  text-shadow: 0 0 4px #fff, 0 0 4px #fff; white-space: nowrap;
}

/* Actions */
.pt3-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; margin-top: 12px; }
.pt3-mic-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .8rem; color: var(--pt3-muted); padding: 4px 10px; border-radius: 99px; background: var(--pt3-surface); border: 1px solid var(--pt3-line); }
.pt3-mic-pill i { width: 10px; height: 10px; border-radius: 50%; background: var(--pt3-line); transition: background .1s; }
.pt3-mic-pill.is-hearing i { background: var(--pt3-good); }
.pt3-mic-pill.is-muted i { background: var(--pt3-near); }

@media (max-width: 600px) {
  .pt3-screen { padding: 8px 10px 30px; }
  .pt3-versus { grid-template-columns: 1fr 44px 1fr; gap: 4px; }
  .pt3-card { min-height: 96px; }
  .pt3-gauge-arrow { font-size: 1.6rem; }
  .pt3-kb .kw { font-size: .7rem; }
  .pt3-kb .k-finger { width: 20px; height: 20px; font-size: .7rem; }
}
@media (prefers-reduced-motion: reduce) {
  .pt3 * { animation: none !important; transition: none !important; }
}
