/* omnifit: le finestre di foto e video che galleggiano sul PC (js/media-win.js, R.MediaWin). Piccole, si spostano
   trascinandole, si allargano dall'angolo, si abbassano in pastiglie in basso a sinistra.
   Livelli: 19, sopra la scrivania (12) e la chat accanto (15), sotto la barra in alto (20) e i fumetti (21).
   Dentro il livello ogni finestra ha il suo z-index (quella toccata per ultima davanti), le pastiglie sopra tutte.
   Sul telefono il lettore dei video (.mwp, in fondo al file): in cima alla chat o staccato, come su WhatsApp.
   Solo i colori dei temi (chiaro e scuro). */

.mw-layer { position: fixed; inset: 0; z-index: 19; pointer-events: none; }
/* sul telefono le finestre non ci sono (i video nel lettore del telefono, le foto nel visore della chat) */
@media (max-width: 820px) { .mw-layer { display: none; } }

/* ---------- la finestra ---------- */
.mw {
  position: fixed; left: 0; top: 0; z-index: 1;
  display: flex; flex-direction: column; width: 340px; max-width: calc(100vw - 16px);
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
  overflow: hidden; pointer-events: auto; animation: mw-in .16s ease-out;
  font: 400 13px/1.35 var(--f-body);
}
/* quella davanti: il bordo e l'intestazione col colore dell'app */
.mw.is-front { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.mw:focus { outline: none; }
.mw:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* lasciata vicino a un bordo: ci arriva piano */
.mw.is-snap { transition: left .16s ease-out, top .16s ease-out; }
@keyframes mw-in { from { opacity: 0; transform: scale(.96); } }

/* intestazione: si trascina da qui (doppio clic: piccola o grande) */
.mw-head {
  flex: none; display: flex; align-items: center; gap: 1px; height: 34px; padding: 0 3px 0 10px;
  background: var(--surface); border-bottom: 1px solid var(--line);
  cursor: grab; touch-action: none; -webkit-user-select: none; user-select: none;
}
.mw.is-front .mw-head { background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.mw-ttl { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 600 12.5px/1.2 var(--f-body); }
.mw-ttl small { font-size: inherit; font-weight: 500; color: var(--muted); }
.mw-hb {
  display: grid; place-items: center; flex: none; width: 26px; height: 26px; padding: 0;
  border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer;
}
.mw-hb:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.mw-hb svg { width: 16px; height: 16px; }

/* ---------- foto o video ---------- */
.mw-stage {
  position: relative; flex: none; height: 180px; overflow: hidden;
  background: color-mix(in srgb, var(--ink) 10%, var(--surface-2));
  touch-action: none; -webkit-user-select: none; user-select: none;
}
.mw-stage > video { display: block; width: 100%; height: 100%; object-fit: contain; }
.mw.is-vid .mw-stage { cursor: pointer; }
.mw.is-img .mw-stage { cursor: zoom-in; }
.mw.is-img .mw-stage.is-zoom { cursor: grab; }
.mw-pan { position: absolute; inset: 0; }
.mw-pan img {
  display: block; width: 100%; height: 100%; object-fit: contain;
  transform-origin: center center; will-change: transform; -webkit-user-drag: none;
}
.mw-pan img:not([src]) { visibility: hidden; }
.mw-pan img.is-anim { transition: transform .2s ease-out; }
.mw.is-load .mw-pan img, .mw.is-load .mw-stage > video { opacity: .35; }

/* fermo: il tasto grande al centro (si tocca il video per farlo partire) */
.mw-big {
  position: absolute; left: 50%; top: 50%; display: grid; place-items: center; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border-radius: 50%; background: color-mix(in srgb, var(--surface) 84%, transparent); color: var(--ink);
  box-shadow: var(--shadow); pointer-events: none; opacity: 0; transition: opacity .15s;
}
.mw-big svg { width: 22px; height: 22px; margin-left: 2px; }
.mw.is-paused.is-ok .mw-big { opacity: 1; }

/* in caricamento (o il video aspetta la rete) */
.mw-load { position: absolute; inset: 0; display: none; place-items: center; pointer-events: none; }
.mw.is-load .mw-load, .mw.is-wait .mw-load { display: grid; }
.mw-spin {
  display: block; width: 24px; height: 24px; border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, var(--accent) 25%, transparent); border-top-color: var(--accent);
  animation: mw-spin .8s linear infinite;
}
@keyframes mw-spin { to { transform: rotate(360deg); } }
/* non si apre: «Non riesco ad aprire il video» e Riprova */
.mw-err {
  position: absolute; inset: 0; z-index: 3; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 12px; background: var(--surface-2); color: var(--muted); font-size: 12.5px; text-align: center; cursor: default;
}
.mw.is-err .mw-err:not(:empty) { display: flex; }
.mw-err p { margin: 0; }

/* foto: il nome (Fronte, Lato…) e ‹ › tra le foto */
.mw-tag {
  position: absolute; left: 6px; bottom: 6px; z-index: 2; max-width: calc(100% - 12px); overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--ink);
  font: 600 11.5px/1.35 var(--f-body); font-variant-numeric: tabular-nums; pointer-events: none;
}
.mw-nav {
  position: absolute; top: 50%; z-index: 2; display: grid; place-items: center; width: 30px; height: 30px; margin-top: -15px; padding: 0;
  border: 0; border-radius: 50%; background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--ink);
  box-shadow: var(--shadow); cursor: pointer; opacity: .85;
}
.mw-nav:hover, .mw-nav:focus-visible { opacity: 1; }
.mw-nav svg { width: 17px; height: 17px; }
.mw-nav.is-prev { left: 6px; }
.mw-nav.is-next { right: 6px; }
/* 5/11: i tasti dello zoom della foto, in basso a destra (la rotella e il doppio clic restano) */
.mw-zbar {
  position: absolute; right: 6px; bottom: 6px; z-index: 2; display: flex; gap: 2px; padding: 2px;
  border-radius: 99px; background: color-mix(in srgb, var(--surface) 88%, transparent); box-shadow: var(--shadow);
}
.mw-zb { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--ink); cursor: pointer; }
.mw-zb:hover, .mw-zb:focus-visible { background: color-mix(in srgb, var(--ink) 10%, transparent); }
.mw-zb svg { width: 17px; height: 17px; }
.mw.is-err .mw-zbar, .mw.is-load .mw-zbar { display: none; }
.mw-tag { max-width: calc(100% - 120px); }

/* ---------- comandi del video ---------- */
.mw-ctl { flex: none; padding: 2px 6px 3px; }
/* la barra del tempo; sopra, nella sua corsia, i segni dei commenti */
.mw-tlw { position: relative; height: 28px; }
.mw-tl { position: absolute; left: 0; right: 0; top: 8px; height: 20px; border-radius: 6px; cursor: pointer; touch-action: none; }
.mw-bar {
  position: absolute; left: 6px; right: 6px; top: 8px; height: 4px; overflow: hidden; border-radius: 2px;
  background: color-mix(in srgb, var(--ink) 13%, transparent);
}
.mw-buf { position: absolute; left: 0; top: 0; bottom: 0; width: var(--mw-buf, 0%); background: color-mix(in srgb, var(--ink) 15%, transparent); }
.mw-fill { position: absolute; left: 0; top: 0; bottom: 0; width: var(--mw-p, 0%); background: var(--accent); }
.mw-knob {
  position: absolute; top: 4px; left: calc(6px + (100% - 12px) * var(--mw-pf, 0)); width: 12px; height: 12px; margin-left: -6px;
  border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); transform: scale(.75); transition: transform .12s;
}
.mw-tl:hover .mw-knob, .mw-tl:focus-visible .mw-knob, body.mw-scrub .mw-knob { transform: scale(1); }
.mw-marks { position: absolute; left: 6px; right: 6px; top: 0; height: 14px; pointer-events: none; }
.mw-mk { position: absolute; top: 0; width: 14px; height: 14px; margin-left: -7px; padding: 0; border: 0; background: transparent; cursor: pointer; pointer-events: auto; }
/* una goccia che punta giù sulla barra: i miei col colore dell'app, quelli dell'atleta scuri */
.mw-mk::before {
  content: ""; position: absolute; left: 3px; top: 1px; width: 8px; height: 8px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); background: var(--ink); box-shadow: 0 0 0 1.5px var(--surface); transition: transform .12s;
}
.mw-mk.is-mine::before { background: var(--accent); }
.mw-mk:hover::before { transform: rotate(-45deg) scale(1.3); }
/* ancora in invio: più chiaro (quelli non partiti non ci sono: sono nella chat con «Riprova») */
.mw-mk.is-wait::before { opacity: .45; }

/* avvio e minuti a sinistra, gli altri tasti a destra; stretta, il secondo gruppo va intero sulla riga sotto */
.mw-row { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 2px 6px; min-height: 30px; }
.mw-grp { display: flex; align-items: center; flex: none; gap: 1px; min-width: 0; }
.mw-grp:last-child { margin-left: auto; }
.mw-b {
  display: inline-grid; place-items: center; flex: none; min-width: 24px; height: 26px; padding: 0 3px;
  border: 0; border-radius: 6px; background: transparent; color: var(--ink); cursor: pointer; white-space: nowrap;
  font: 600 11.5px/1 var(--f-body); font-variant-numeric: tabular-nums;
}
.mw-b:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
.mw-b svg { width: 16px; height: 16px; }
.mw-b[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 16%, transparent); color: color-mix(in srgb, var(--accent) 85%, var(--ink)); }
.mw-play { width: 28px; min-width: 28px; height: 28px; margin-right: 2px; padding: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.mw-play:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.mw-play svg { width: 14px; height: 14px; }
.mw-spd { min-width: 34px; }
.mw-time { flex: none; padding: 0 4px; color: var(--muted); white-space: nowrap; font: 500 11px/1 var(--f-mono); font-variant-numeric: tabular-nums; }
.mw-time b { font-weight: 500; color: var(--ink); }

/* ---------- commento ---------- */
.mw-com { flex: none; display: flex; align-items: center; gap: 6px; padding: 6px 8px 8px; border-top: 1px solid var(--line); }
.mw-stamp {
  flex: none; max-width: 42%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 4px 7px; border-radius: 99px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: color-mix(in srgb, var(--accent) 82%, var(--ink));
  font: 600 11.5px/1.2 var(--f-mono); font-variant-numeric: tabular-nums;
}
.mw-stamp:empty { display: none; }
/* mentre si scrive il minuto resta fermo: si vede dal bordo */
.mw.is-typing .mw-stamp { box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--accent) 60%, transparent); }
.mw-in {
  flex: 1 1 auto; width: 100%; min-width: 0; height: 30px; padding: 0 9px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); color: var(--ink);
  font: 400 13px/1.2 var(--f-body); outline: none;
}
.mw-in::placeholder { color: var(--muted); }
.mw-in:focus { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 25%, transparent); }
.mw-send {
  flex: none; height: 30px; padding: 0 11px; border: 0; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); font: 600 12.5px/1 var(--f-body); white-space: nowrap; cursor: pointer;
}
.mw-send:hover { background: color-mix(in srgb, var(--accent) 88%, var(--ink)); }
.mw-send:disabled { background: color-mix(in srgb, var(--ink) 9%, var(--surface)); color: var(--muted); cursor: default; }
.mw-send.is-done { background: color-mix(in srgb, var(--ok) 16%, var(--surface)); color: color-mix(in srgb, var(--ok) 85%, var(--ink)); }

/* «Commenti (N)» e l'elenco: un clic va a quel minuto */
.mw-foot { flex: none; display: flex; margin-top: -4px; padding: 0 6px 6px; }
.mw-ntog {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); font: 600 12px/1.2 var(--f-body); font-variant-numeric: tabular-nums; cursor: pointer;
}
.mw-ntog:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 6%, transparent); }
.mw-ntog svg { width: 14px; height: 14px; transition: transform .15s; }
.mw-ntog[aria-expanded="true"] svg { transform: rotate(180deg); }
.mw-notes {
  flex: none; max-height: 150px; margin: 0; padding: 0 6px 8px; list-style: none;
  overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; scrollbar-width: thin;
}
.mw-notes button {
  display: flex; align-items: baseline; gap: 8px; width: 100%; padding: 5px 6px; border: 0; border-radius: 7px;
  background: transparent; color: var(--ink); font: 400 12.5px/1.35 var(--f-body); text-align: left; cursor: pointer;
}
.mw-notes button:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.mw-notes b { flex: none; color: color-mix(in srgb, var(--accent) 85%, var(--ink)); font: 600 11.5px/1.35 var(--f-mono); font-variant-numeric: tabular-nums; }
.mw-notes span { min-width: 0; overflow-wrap: anywhere; }
.mw-notes em { font-style: normal; font-weight: 600; color: var(--muted); }
.mw-notes small { color: var(--muted); font-size: 11.5px; }
.mw-notes li.is-wait span { opacity: .7; }

/* l'angolo per allargarla */
.mw-rsz { position: absolute; right: 0; bottom: 0; z-index: 4; width: 13px; height: 13px; cursor: nwse-resize; touch-action: none; }
.mw-rsz::before {
  content: ""; position: absolute; right: 3px; bottom: 3px; width: 7px; height: 7px; border-radius: 0 0 3px 0;
  border-right: 2px solid color-mix(in srgb, var(--ink) 32%, transparent); border-bottom: 2px solid color-mix(in srgb, var(--ink) 32%, transparent);
}
.mw-rsz:hover::before { border-color: var(--accent); }

/* il cursore dei tasti si vede dentro la finestra (che taglia quello che sporge) */
.mw-hb:focus-visible, .mw-b:focus-visible, .mw-send:focus-visible, .mw-ntog:focus-visible, .mw-notes button:focus-visible, .mw-nav:focus-visible,
.mw-tl:focus-visible, .mw-err .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.mw-play:focus-visible { outline-offset: 1px; }

/* ---------- abbassate: le pastiglie in basso a sinistra ---------- */
.mw-tray {
  position: fixed; left: 10px; bottom: 10px; z-index: 100000; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px;
  max-width: calc(100vw - 20px); pointer-events: none;
}
/* sulla scrivania: sopra «Il mio calendario» in fondo alla colonna degli atleti */
body.desk-on .mw-tray { bottom: 58px; }
.mw-pill {
  display: flex; align-items: center; gap: 2px; max-width: 240px; padding: 3px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow); pointer-events: auto; animation: mw-in .16s ease-out;
}
.mw-pbtn {
  display: flex; align-items: center; gap: 8px; min-width: 0; padding: 0 6px 0 0; border: 0; border-radius: 9px;
  background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer;
}
.mw-pbtn:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.mw-thumb {
  position: relative; display: grid; place-items: center; flex: none; width: 52px; height: 36px; overflow: hidden; border-radius: 8px;
  background: color-mix(in srgb, var(--ink) 10%, var(--surface-2)); color: var(--muted);
}
.mw-thumb > svg { width: 16px; height: 16px; }
.mw-thumb canvas, .mw-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.mw-tplay {
  position: relative; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 84%, transparent); color: var(--ink);
}
.mw-tplay svg { width: 11px; height: 11px; margin-left: 1px; }
.mw-pt { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.mw-pt b { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font: 600 12px/1.25 var(--f-body); }
.mw-pt small { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: var(--muted); font: 500 11px/1.2 var(--f-mono); font-variant-numeric: tabular-nums; }
.mw-px {
  display: grid; place-items: center; flex: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px;
  background: transparent; color: var(--muted); cursor: pointer;
}
.mw-px:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.mw-px svg { width: 14px; height: 14px; }
.mw-pbtn:focus-visible, .mw-px:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---------- fumetto (sopra la barra in alto, come quelli della scrivania) ---------- */
.mw-tip {
  position: fixed; left: 0; top: 0; z-index: 21; max-width: 260px; padding: 6px 9px; border-radius: 8px;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow); pointer-events: none;
  font: 500 12px/1.4 var(--f-body); white-space: pre-line; overflow-wrap: anywhere;
}

/* mentre si trascina: il cursore giusto ovunque, niente testo selezionato */
body.mw-moving, body.mw-moving *, body.mw-panning, body.mw-panning * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
body.mw-sizing, body.mw-sizing * { cursor: nwse-resize !important; -webkit-user-select: none; user-select: none; }
body.mw-scrub, body.mw-scrub * { cursor: pointer !important; -webkit-user-select: none; user-select: none; }

@media (prefers-reduced-motion: reduce) {
  .mw, .mw-pill { animation: none; }
  .mw.is-snap, .mw-pan img.is-anim, .mw-knob, .mw-big, .mw-mk::before, .mw-ntog svg { transition: none; }
  .mw-spin { animation-duration: 2.4s; }
}

/* ================= telefono: il lettore dei video (js/media-win.js, R.MediaWin.phone) =================
   Agganciato (.is-top): in cima alla chat di quel video, largo quanto lo schermo; prende lo z-index della chat (lo
   scrive js/media-win.js), così una pagina aperta sopra lo copre e lui si stacca. Staccato (.is-float): una scheda
   piccola a 65, sopra le pagine (25 e in su) e la barra in basso (60), sotto il trascinamento del calendario (70) e
   gli avvisi (80); si sposta col dito e va nell'angolo più vicino. Posto e misure li scrive js/media-win.js (transform,
   larghezza, altezza del video). Nessun gesto fa scorrere la pagina sotto (touch-action: none). */
.mwp {
  position: fixed; left: 0; top: 0; z-index: 65; display: flex; flex-direction: column;
  background: var(--surface); color: var(--ink); font: 400 13px/1.35 var(--f-body);
  touch-action: none; overscroll-behavior: contain;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
}
/* sul PC non c'è (girando il telefono il video passa in una finestra: js/media-win.js, handOver), ma a schermo intero
   resta finché non si esce, anche se intanto lo schermo è diventato più largo */
@media (min-width: 821px) { .mwp:not(.is-full) { display: none; } }
.mwp.is-top { z-index: 25; border-bottom: 1px solid var(--line); box-shadow: var(--shadow); }
.mwp.is-float { overflow: hidden; border-radius: 14px; box-shadow: var(--shadow), 0 0 0 1px var(--line); cursor: grab; }
.mwp.is-float.is-drag { cursor: grabbing; }
/* lasciata: va piano nell'angolo */
.mwp.is-float.is-snap { transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
.mwp.is-in { animation: mwp-in .18s ease-out; }
@keyframes mwp-in { from { opacity: 0; scale: .96; } }

/* ---------- il video ---------- */
.mwp-stage { position: relative; flex: none; height: 200px; overflow: hidden; background: color-mix(in srgb, var(--ink) 10%, var(--surface-2)); }
.mwp-stage > video { display: block; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.mwp.is-load .mwp-stage > video { opacity: .35; }
/* a schermo intero si toccano i comandi del browser sul video (due regole: chi non conosce l'una salterebbe anche l'altra) */
.mwp .mwp-stage > video:fullscreen { pointer-events: auto; opacity: 1; }
.mwp .mwp-stage > video:-webkit-full-screen { pointer-events: auto; opacity: 1; }
/* fermo: ▶ al centro (toccando il video parte) */
.mwp-big {
  position: absolute; left: 50%; top: 50%; z-index: 1; display: grid; place-items: center; width: 52px; height: 52px; margin: -26px 0 0 -26px;
  border-radius: 50%; background: color-mix(in srgb, var(--surface) 84%, transparent); color: var(--ink);
  box-shadow: var(--shadow); pointer-events: none; opacity: 0; transition: opacity .15s;
}
.mwp-big svg { width: 24px; height: 24px; margin-left: 3px; }
.mwp.is-paused.is-ok .mwp-big { opacity: 1; }
.mwp.is-float .mwp-big { width: 40px; height: 40px; margin: -20px 0 0 -20px; }
.mwp.is-float .mwp-big svg { width: 18px; height: 18px; margin-left: 2px; }
.mwp.is-float.is-ctl .mwp-big { opacity: 0; }
/* in caricamento (o il video aspetta la rete) */
.mwp-load { position: absolute; inset: 0; z-index: 1; display: none; place-items: center; pointer-events: none; }
.mwp.is-load .mwp-load, .mwp.is-wait .mwp-load { display: grid; }
/* non si apre: «Non riesco ad aprire il video», Riprova e ✕ (copre i tasti sul video: senza la sua ✕ il lettore
   staccato non si chiuderebbe più) */
.mwp-err {
  position: absolute; inset: 0; z-index: 4; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 10px; background: var(--surface-2); color: var(--muted); font-size: 13px; text-align: center;
}
.mwp.is-err .mwp-err:not(:empty) { display: flex; }
.mwp-err p { margin: 0; }
.mwp-eact { display: flex; align-items: center; gap: 8px; }
.mwp-eact .mwp-mb { width: 44px; height: 44px; }
/* staccato la scheda è piccola (alta anche solo 92 px): tutto più fitto */
.mwp.is-float .mwp-err { gap: 4px; padding: 4px 6px; font-size: 12px; line-height: 1.25; }
/* doppio tocco: «−5 s» a sinistra, «+5 s» a destra, per un attimo */
.mwp-seek {
  position: absolute; top: 50%; z-index: 2; min-width: 64px; margin-top: -19px; padding: 9px 12px; border-radius: 99px;
  background: color-mix(in srgb, var(--surface) 88%, transparent); color: var(--ink); box-shadow: var(--shadow);
  font: 700 15px/1.3 var(--f-body); font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; pointer-events: none;
}
.mwp-seek.is-l { left: 9%; }
.mwp-seek.is-r { right: 9%; }
/* toccato un segno sulla barra: il commento, in basso sul video */
.mwp-note {
  position: absolute; left: 8px; right: 8px; bottom: 8px; z-index: 2; max-height: calc(100% - 16px); overflow: hidden;
  padding: 7px 10px; border-radius: 10px; background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--ink);
  box-shadow: var(--shadow); font: 400 13.5px/1.35 var(--f-body); white-space: pre-line; overflow-wrap: anywhere; pointer-events: none;
}
.mwp-note b { color: color-mix(in srgb, var(--accent) 85%, var(--ink)); font: 600 13px/1.35 var(--f-mono); font-variant-numeric: tabular-nums; }
.mwp-seek[hidden], .mwp-note[hidden] { display: none; }
/* staccato (e agganciato con la tastiera aperta): una riga sottile del tempo in fondo al video */
.mwp-prog {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; display: none; height: 3px;
  background: color-mix(in srgb, var(--ink) 18%, transparent); pointer-events: none;
}
.mwp-prog::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: var(--mwp-p, 0%); background: var(--accent); }
.mwp.is-float .mwp-prog, .mwp.is-compact .mwp-prog { display: block; }

/* ---------- staccato: i tasti che si aprono toccandolo ---------- */
.mwp-mini {
  position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; justify-content: space-between; padding: 4px;
  background: color-mix(in srgb, var(--bg) 42%, transparent); opacity: 0; visibility: hidden; transition: opacity .15s, visibility .15s;
}
.mwp.is-top .mwp-mini { display: none; }
/* anche con la tastiera collegata (Tab): restano aperti finché il cursore è su un tasto */
.mwp.is-float.is-ctl .mwp-mini, .mwp.is-float:has(:focus-visible) .mwp-mini { opacity: 1; visibility: visible; }
.mwp-mrow { display: flex; align-items: center; justify-content: space-between; gap: 4px; min-width: 0; }
.mwp-mtime {
  min-width: 0; overflow: hidden; padding: 3px 8px; border-radius: 99px; background: color-mix(in srgb, var(--surface) 88%, transparent);
  font: 600 12px/1.3 var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap;
}
/* in alto: schermo intero accanto a ✕, a destra */
.mwp-mfull { margin-left: auto; }
/* agganciato senza posto per i tasti sotto (telefono piccolo, in orizzontale: .is-tight): sul video resta la riga in alto
   (minuto, schermo intero, ✕) senza velo; il resto dei tocchi va al video (avvio, −5 / +5 s) */
.mwp.is-top.is-tight .mwp-mini { display: flex; opacity: 1; visibility: visible; background: none; pointer-events: none; }
.mwp.is-tight .mwp-mrow + .mwp-mrow { display: none; }
.mwp.is-tight .mwp-mini button { pointer-events: auto; }
.mwp-mb {
  display: grid; place-items: center; flex: none; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
  background: color-mix(in srgb, var(--surface) 90%, transparent); color: var(--ink); box-shadow: var(--shadow); cursor: pointer;
}
.mwp-mb svg { width: 20px; height: 20px; }
.mwp-mplay { background: var(--accent); color: var(--accent-ink); }
.mwp-mplay svg { width: 17px; height: 17px; }
.mwp-dock {
  display: inline-flex; align-items: center; gap: 4px; flex: 0 1 auto; min-width: 0; height: 40px; padding: 0 10px 0 8px;
  border: 0; border-radius: 99px; background: color-mix(in srgb, var(--surface) 90%, transparent); color: var(--ink);
  box-shadow: var(--shadow); font: 600 12.5px/1 var(--f-body); white-space: nowrap; cursor: pointer;
}
.mwp-dock[hidden] { display: none; }
.mwp-dock svg { flex: none; width: 17px; height: 17px; }
.mwp-dock span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ---------- agganciato: barra del tempo e tasti ---------- */
.mwp.is-float .mwp-ctl, .mwp.is-compact .mwp-ctl { display: none; }
.mwp-ctl { flex: none; padding: 0 8px 4px; background: var(--surface); }
.mwp-tlrow { display: flex; align-items: center; gap: 10px; min-width: 0; }
.mwp-cur, .mwp-dur { flex: none; min-width: 36px; font: 500 12px/1 var(--f-mono); font-variant-numeric: tabular-nums; color: var(--muted); }
.mwp-cur { font-weight: 600; color: var(--ink); text-align: right; }
/* si trascina col dito: sopra, nella sua corsia, i segni dei commenti */
.mwp-tl { position: relative; flex: 1 1 auto; min-width: 0; height: 40px; border-radius: 6px; cursor: pointer; touch-action: none; }
.mwp-marks { position: absolute; left: 0; right: 0; top: 3px; height: 14px; pointer-events: none; }
.mwp-mk { position: absolute; top: 0; width: 14px; height: 14px; margin-left: -7px; }
/* una goccia che punta giù sulla barra: i miei col colore dell'app, quelli dell'atleta scuri; in invio più chiari */
.mwp-mk::before {
  content: ""; position: absolute; left: 3px; top: 1px; width: 8px; height: 8px; border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg); background: var(--ink); box-shadow: 0 0 0 1.5px var(--surface);
}
.mwp-mk.is-mine::before { background: var(--accent); }
.mwp-mk.is-wait::before { opacity: .45; }
.mwp-bar {
  position: absolute; left: 0; right: 0; top: 22px; height: 4px; overflow: hidden; border-radius: 2px;
  background: color-mix(in srgb, var(--ink) 13%, transparent); pointer-events: none;
}
.mwp-buf { position: absolute; left: 0; top: 0; bottom: 0; width: var(--mwp-buf, 0%); background: color-mix(in srgb, var(--ink) 15%, transparent); }
.mwp-fill { position: absolute; left: 0; top: 0; bottom: 0; width: var(--mwp-p, 0%); background: var(--accent); }
.mwp-knob {
  position: absolute; top: 17px; left: var(--mwp-p, 0%); width: 14px; height: 14px; margin-left: -7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 2px var(--surface); pointer-events: none; transition: transform .12s;
}
.mwp.is-scrub .mwp-knob { transform: scale(1.3); }
/* avvio, un fotogramma alla volta, velocità; a destra «Stacca», schermo intero e ✕. Mai più larga dello schermo */
.mwp-row { display: flex; align-items: center; gap: 2px; min-width: 0; min-height: 44px; overflow: hidden; }
.mwp-b {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px; flex: none; min-width: 40px; height: 42px; padding: 0 8px;
  border: 0; border-radius: 10px; background: transparent; color: var(--ink); cursor: pointer; white-space: nowrap;
  font: 600 13.5px/1 var(--f-body); font-variant-numeric: tabular-nums;
}
.mwp-b svg { flex: none; width: 22px; height: 22px; }
.mwp-b:active { background: color-mix(in srgb, var(--ink) 9%, transparent); }
.mwp-play { width: 44px; min-width: 44px; height: 44px; margin-right: 2px; padding: 0; border-radius: 50%; background: var(--accent); color: var(--accent-ink); }
.mwp-play:active { background: color-mix(in srgb, var(--accent) 85%, var(--ink)); }
.mwp-play svg { width: 19px; height: 19px; }
.mwp-spd { min-width: 50px; }
.mwp-sp { flex: 1 1 auto; min-width: 0; }
.mwp-txt { padding: 0 11px 0 8px; background: color-mix(in srgb, var(--ink) 6%, transparent); }
/* fino a 389 px (iPhone SE e mini, 360): «Stacca» solo con l'icona (il nome resta nell'aria-label), se no con
   schermo intero la riga non ci sta e ✕ finirebbe fuori */
@media (max-width: 389px) {
  .mwp-txt { padding: 0 8px; }
  .mwp-txt span { display: none; }
}
/* fino a 339 px (320): anche i tasti un po' più stretti */
@media (max-width: 339px) {
  .mwp-ctl { padding-inline: 6px; }
  .mwp-b:not(.mwp-play) { min-width: 36px; padding: 0 6px; }
  .mwp-row .mwp-spd { min-width: 44px; }
}
.mwp-b:focus-visible, .mwp-mb:focus-visible, .mwp-dock:focus-visible, .mwp-tl:focus-visible, .mwp-err .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* sui tasti pieni del colore dell'app il bordo del cursore è dentro, del colore del testo */
.mwp-play:focus-visible, .mwp-mplay:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: -4px; }

@media (prefers-reduced-motion: reduce) {
  .mwp.is-in { animation: none; }
  .mwp.is-float.is-snap, .mwp-big, .mwp-knob, .mwp-mini { transition: none; }
}
