/* Scrittura ritmi: pensata per la LIM, con le dita, da lontano */
:root { --bg: #fbf7f0; --fg: #222; --line: #c9bfae; --ar: #c46a12; --ve: #2e9e5b; --ora: #e8531c; font-size: clamp(14px, 1vw, 21px) }
* { box-sizing: border-box }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-user-select: none; user-select: none; touch-action: manipulation }
body { display: flex; flex-direction: column; height: 100vh; overflow: hidden }
button { font: inherit; min-height: 2.2em; min-width: 2.2em; padding: .1em .7em; border: 2px solid var(--line); border-radius: .6em; background: #fff; color: var(--fg); cursor: pointer }
button.sel { border-color: var(--ar); background: #fde9d3; font-weight: 700 }
button.off { opacity: .45; text-decoration: line-through }
button.primo { background: var(--ar); border-color: var(--ar); color: #fff; font-weight: 700 }
input { font: inherit; padding: .3em .5em; border: 2px solid var(--line); border-radius: .5em; min-height: 2.2em }
.fila { display: flex; gap: .35em; padding: .25em .5em; overflow-x: auto; flex-shrink: 0 }
.fila button { white-space: nowrap }
header { border-bottom: 2px solid var(--line) }
#info { padding: 0 .7em; font-size: 1em }
main { flex: 1; overflow: auto; padding: .3em .6em; display: flex; justify-content: flex-start; align-items: flex-start }
main.v-cerchi { justify-content: center; overflow: hidden }
footer, #pannello { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: .4em 1.2em; padding: .25em .5em; border-top: 2px solid var(--line); align-items: center; flex-shrink: 0 }
#pannello { background: #fff4e6 }
.gruppo { display: flex; gap: .3em; align-items: center; flex-shrink: 0; white-space: nowrap }
.pop .gruppo, .pop .riga { white-space: normal }
.pop p { margin: .6em 0 .2em }
#bpm { min-width: 2.2em; text-align: center; font-size: 1.2em }
.vuoto { font-size: 1.6em; opacity: .6; margin: 2em auto }
/* griglia */
.gr { border-collapse: collapse; margin: 0 auto 0 0; font-size: clamp(17px, 1.45vw, 30px) }
.gr th, .gr td { border: 1px solid var(--line); min-width: 2.6em; height: 2.6em; text-align: center; padding: 1px; white-space: nowrap }
.gr tbody th, .gr thead th:first-child { text-align: left; padding: 0 .5em; position: sticky; left: 0; background: var(--bg); z-index: 1; font-size: 1.05em }
.gr .b4 { border-left: 3px solid #555 }
.gr .n4 th { color: var(--ar); font-weight: 700; height: 1.6em }
.gr .n3 th { color: var(--ve); height: 1.6em }
.gr .n3 .g3 { font-weight: 700; border-bottom: 3px solid var(--ve) }
.gr.edit td { cursor: pointer }
.gr.edit td:empty::after { content: "＋"; opacity: .18 }
.gr.edit tbody th { text-decoration: underline dotted; cursor: pointer }
.s { display: inline-block; min-width: 2.1em; padding: .25em .25em; border-radius: .45em; font-weight: 700; font-size: .95em }
.s.rip { opacity: .45 }
.s.cn { border: 2px solid #333; font-style: italic; font-weight: 600 }
.gr .ora { background: rgba(232, 83, 28, .22) }
.gr td.ora .s { outline: 4px solid var(--ora); transform: scale(1.12) }
.gr .ug { background: rgba(46, 158, 91, .18) }
.gr .dv { background: rgba(232, 83, 28, .08) }
.due { display: flex; flex-direction: column; gap: 2px; align-items: center; font-size: .8em }
.due i { opacity: .5 }
.spiega { margin: .2em 0 .5em; font-size: 1.05em; position: sticky; left: 0 }
main.v-confronta { flex-direction: column }
/* forme */
.gr.forme td { min-width: 2.8em; height: 2.8em }
.gr .fo { width: 2.3em; height: 2.3em; display: block; margin: auto }
.gr .fo.rip { opacity: .45 }
.gr td.ora .fo { transform: scale(1.25); filter: drop-shadow(0 0 4px var(--ora)) }
.pop .sill button.fb { background: #fff; display: flex; flex-direction: column; align-items: center; padding: .2em .5em; min-width: 3.6em }
.pop .sill button.fb svg { width: 2.4em; height: 2.4em }
.pop .sill button.fb small { font-size: .7em }
/* cerchi */
#cer { height: 100%; max-width: 100%; aspect-ratio: 1; display: block; margin: 0 auto }
#cer .an { fill: none; stroke: #444; stroke-width: 2.5; opacity: .55 }
#cer .an.cn { stroke-dasharray: 10 7 }
#cer .r4 { stroke: var(--ar); stroke-width: 2; opacity: .55 }
#cer .r3 { stroke: var(--ve); stroke-width: 2; stroke-dasharray: 6 6; opacity: .7 }
#cer .t4 { fill: var(--ar); font-size: 28px; font-weight: 700; text-anchor: middle }
#cer .nm { font-size: 21px; text-anchor: end; fill: #333; paint-order: stroke; stroke: var(--bg); stroke-width: 6px; stroke-linejoin: round }
#cer .vu { fill: #fff; stroke: #999; stroke-width: 2 }
#cer .vu.v4 { stroke: var(--ar) }
#cer .vu.v3 { stroke: var(--ve) }
#cer .pt circle.cn { stroke: #333; stroke-width: 3 }
#cer .pt text { text-anchor: middle; font-weight: 700; pointer-events: none }
#cer .pt { transform-box: fill-box; transform-origin: center; transition: transform .1s }
#cer .pt.rip { opacity: .5 }
#cer .pt.on { transform: scale(1.6) }
#ago { stroke: var(--ora); stroke-width: 6; stroke-linecap: round }
/* blocchi */
main.v-blocchi { flex-direction: column; align-items: stretch }
.filab { display: flex; gap: .8em; align-items: flex-end; flex-wrap: wrap; padding: 1em .5em; min-height: 40vh }
.bast { display: flex; flex-direction: column; align-items: center; gap: .2em; border: 0; background: none; padding: .3em; min-width: 6em; font-size: 1.15em }
.bast .st { width: 2.6em; height: 26vh; border-radius: .8em; background: var(--c); position: relative; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,.25) }
.bast .st i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(255,255,255,.55) }
.bast.ora .st { outline: 6px solid var(--ora) }
.bast em { font-style: normal; font-weight: 700; color: var(--ora); min-height: 1.2em }
.bast small { opacity: .8 }
.aggiungi { display: flex; gap: .4em; align-items: center; flex-wrap: wrap; padding: .5em }
.pal { display: inline-block; width: .7em; height: 1.4em; border-radius: .3em; margin-right: .4em; vertical-align: middle }
.grande { font-size: 1.5em; min-width: 2.5em; text-align: center }
/* finestrelle */
.pop { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); display: flex; align-items: center; justify-content: center; z-index: 10 }
.pop .box { background: #fff; border-radius: 1em; padding: 1em 1.2em; max-width: min(92vw, 44em); max-height: 90vh; overflow: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, .3) }
.pop h2 { margin: 0 0 .5em; font-size: 1.3em }
.pop .sill { display: flex; flex-wrap: wrap; gap: .45em; margin: .4em 0 .8em }
.pop .sill button { min-width: 3.4em; min-height: 2.8em; font-weight: 700; font-size: 1.15em; border-color: rgba(0, 0, 0, .25) }
.pop .sill button.sel { outline: 5px solid var(--ora) }
.pop .riga { display: flex; gap: .5em; flex-wrap: wrap; margin-top: .5em }
.avviso { position: fixed; left: 50%; bottom: 6em; transform: translateX(-50%); background: #222; color: #fff; padding: .6em 1.2em; border-radius: .6em; z-index: 20; font-size: 1.1em }
