/* YouppyRec · Crea (crea.js): stile FL Studio con i colori e i grafici di YouppyRec */

/* la barra in basso fa posto a tutte le voci, anche a Crea */
nav { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }

main:has(> #tab-crea.active) { padding: 6px 6px 0; overflow: hidden; }
#tab-crea.tab { max-width: none; }
#tab-crea.tab.active { display: flex; flex-direction: column; height: 100%; min-height: 0; }

/* barre di scorrimento: solo il corpo, niente frecce, colori del tema */
@supports selector(::-webkit-scrollbar) {
  #tab-crea, #tab-crea * { scrollbar-color: auto; scrollbar-width: auto; }
  #tab-crea ::-webkit-scrollbar { width: 9px; height: 9px; background: transparent; }
  #tab-crea ::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
  #tab-crea ::-webkit-scrollbar-track { background: #0b0d11; border-radius: 6px; }
  #tab-crea ::-webkit-scrollbar-thumb { background: var(--accent); border-radius: 6px; border: 2px solid #0b0d11; min-width: 30px; min-height: 30px; }
  #tab-crea ::-webkit-scrollbar-thumb:hover { background: #ff6680; }
  #tab-crea ::-webkit-scrollbar-corner { background: #0b0d11; }
  .cr-menu::-webkit-scrollbar-button, .cr-modale-corpo::-webkit-scrollbar-button { display: none; }
}
@supports not selector(::-webkit-scrollbar) {
  #tab-crea *, .cr-modale-corpo { scrollbar-color: var(--accent) #0b0d11; scrollbar-width: thin; }
}

/* elenco dei progetti */
.cr-lista { max-width: 760px; width: 100%; margin: 0 auto; padding: 10px; overflow-y: auto; }
.cr-lista-testa { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.cr-lista-testa h2 { margin: 0; font-size: 18px; }
.cr-spazio-flex { flex: 1; }
.cr-progetto .info { cursor: pointer; }
.cr-progetto .play svg, .cr-ico svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.cr-progetto .play svg .p, .cr-ico svg .p { fill: currentColor; stroke: none; }
.cr-progetto .play { color: var(--accent); }

/* editor */
.cr-editor { display: flex; flex-direction: column; flex: 1; min-height: 0; gap: 6px; }
.cr-barra { display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow-x: auto; flex: none; }
.cr-barra > * { flex: none; }
.cr-titolo { width: 170px; font-weight: 600; }
.cr-sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 2px; }
.cr-stato { width: 10px; color: var(--warn); font-size: 18px; line-height: 1; }
.cr-pos { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--ok); background: #0b0d11; border: 1px solid var(--line); border-radius: 8px; padding: 5px 9px; min-width: 116px; text-align: center; }
.cr-et { display: inline-flex; flex-direction: row; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.cr-campo { background: #0b0d11; border: 1px solid var(--line); border-radius: 8px; color: var(--text); padding: 6px 8px; font-size: 13px; min-width: 0; }
.cr-campo.cr-corto { max-width: 150px; }
#tab-crea select.cr-campo, .cr-modale select.cr-campo { width: auto; padding: 6px 8px; }

.cr-ico { background: none; border: 0; color: var(--text); width: 32px; height: 32px; min-width: 32px; display: grid; place-items: center; border-radius: 8px; cursor: pointer; padding: 0; }
.cr-ico:hover { background: var(--panel2); }
.cr-ico.acceso { color: var(--accent); }
.cr-ico.piccola { width: 24px; height: 24px; min-width: 24px; }
.cr-ico.piccola svg { width: 14px; height: 14px; }
.cr-suona { color: var(--ok); }
.cr-suona.acceso { color: var(--accent); }
.cr-seg { padding: 2px; border-radius: 8px; }
.cr-seg button { padding: 4px 9px; font-size: 12px; border-radius: 6px; }
.cr-seg-ico { display: grid; place-items: center; padding: 4px 7px !important; }
.cr-seg-ico svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* casella numerica (rotella) */
.cr-num { background: #0b0d11; border: 1px solid var(--line); border-radius: 6px; color: var(--ok); font: 600 12px/1 system-ui; font-variant-numeric: tabular-nums; min-width: 30px; height: 24px; padding: 0 5px; cursor: ns-resize; touch-action: none; display: inline-grid; place-items: center; }
.cr-num:hover { border-color: var(--ok); }
.cr-bpm { min-width: 42px; height: 28px; font-size: 13px; color: var(--warn); }
.cr-num-m { cursor: default; color: var(--accent); }

/* area con le finestre: 2×2 (angoli) o 3×2 */
.cr-spazio { flex: 1; min-height: 0; display: grid; gap: 6px; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); grid-template-rows: repeat(var(--righe, 2), minmax(0, 1fr)); padding-bottom: 6px; }
.cr-fin { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cr-fin.grande { position: fixed; inset: 64px 8px 74px; z-index: 25; box-shadow: 0 10px 40px rgba(0, 0, 0, .6); }
.cr-fin.lampo { border-color: var(--accent); }
.cr-fin-testa { display: flex; align-items: center; gap: 4px; padding: 3px 4px 3px 8px; background: var(--panel2); border-bottom: 1px solid var(--line); flex: none; }
.cr-fin-tipo { background: none; border: 0; color: var(--text); font: 600 13px system-ui; padding: 4px 2px; cursor: pointer; width: auto !important; }
.cr-fin-tipo option { background: var(--panel); }
.cr-fin-corpo { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; container-type: size; }
.cr-strumenti { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-bottom: 1px solid var(--line); flex: none; overflow-x: auto; }
.cr-strumenti > * { flex: none; }
.cr-range { width: 80px; accent-color: var(--accent); }

/* luce verde di ascolto */
.cr-luce { width: 14px; height: 14px; min-width: 14px; border-radius: 50%; border: 1px solid #3a404c; background: #262a33; cursor: pointer; padding: 0; }
.cr-luce.accesa { background: var(--ok); border-color: var(--ok); box-shadow: 0 0 6px rgba(53, 208, 127, .7); }

/* ---- Canali (step sequencer) */
.cr-rack { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cr-rack-testa { display: flex; align-items: center; gap: 8px; padding: 6px; border-bottom: 1px solid var(--line); flex-wrap: wrap; flex: none; }
.cr-pat-box { display: inline-flex; align-items: center; gap: 2px; background: #0b0d11; border: 1px solid var(--line); border-radius: 10px; padding: 2px 2px 2px 4px; }
.cr-pat-box .cr-pat-sel { border: 0; background: none; font-weight: 600; max-width: 150px; }
.cr-piu { color: var(--accent); }
.cr-rack-corpo { display: flex; flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 6px 0; }
.cr-rack-sx { flex: none; width: 168px; padding: 0 6px; }
.cr-riga-sx { height: 34px; display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.cr-num-can { min-width: 26px; height: 22px; }
.cr-nome-can { flex: 1; min-width: 0; height: 30px; text-align: left; padding: 0 8px; border-radius: 7px; border: 1px solid var(--line); border-left: 4px solid var(--col); background: var(--panel2); color: var(--text); font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.cr-nome-can:hover { border-color: var(--col); }
.cr-riga-sx.scelto .cr-nome-can { background: #2a1d24; }
.cr-aggiungi { flex: 1; height: 30px; display: flex; align-items: center; justify-content: center; gap: 6px; border: 1px dashed #4a505c; border-radius: 7px; background: none; color: var(--muted); cursor: pointer; font-size: 13px; }
.cr-aggiungi:hover { color: var(--accent); border-color: var(--accent); }
.cr-aggiungi svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; }
.cr-rack-dx { flex: 1; min-width: 0; overflow-x: auto; overflow-y: hidden; padding-right: 6px; }
.cr-passi { display: inline-block; min-width: 100%; }
.cr-riga-passi { display: grid; grid-template-columns: repeat(var(--passi), 22px); gap: 2px; height: 34px; margin-bottom: 4px; }
.cr-riga-passi.vuota { height: 34px; }
/* battute e quarti riconoscibili: quarti alternati più chiari/scuri, battute dispari con un'altra tinta */
.cr-passo { border: 0; border-radius: 5px; padding: 0; cursor: pointer; background: #2a2f3a; }
.cr-passo.qd { background: #1b1f27; }
.cr-passo.bd { background: #33262c; }
.cr-passo.bd.qd { background: #221a1e; }
.cr-passo.on { background: var(--accent); box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .25); }
.cr-passo.ora { outline: 2px solid var(--text); outline-offset: -2px; }
.cr-passo:hover { filter: brightness(1.25); }

/* ---- Piano roll */
.cr-pr { display: flex; flex: 1; min-height: 0; }
.cr-pr-sx { flex: none; position: relative; border-right: 1px solid var(--line); }
.cr-pr-tasti { display: block; width: 100%; height: 100%; cursor: pointer; }
.cr-maniglia { flex: none; width: 6px; cursor: ew-resize; background: var(--panel2); touch-action: none; }
.cr-maniglia:hover, .cr-maniglia:active { background: var(--accent); }
.cr-scorre { flex: 1; min-width: 0; min-height: 0; overflow: auto; position: relative; background: #0b0d11; }
.cr-dentro { position: relative; }
.cr-tela { position: sticky; left: 0; top: 0; display: block; touch-action: none; outline: none; }

/* ---- Playlist */
.cr-pl-graf { display: flex; height: clamp(48px, 16cqh, 110px); flex: none; border-bottom: 1px solid var(--line); }
.cr-pl-graf-sx { flex: none; display: flex; align-items: center; justify-content: center; border-right: 1px solid var(--line); padding: 4px; }
.cr-seg-graf { display: grid !important; grid-template-columns: 1fr 1fr; gap: 2px; }
.cr-seg-graf button { padding: 3px 4px; font-size: 11px; }
.cr-pl-graf-dx { flex: 1; min-width: 0; position: relative; background: #0b0d11; }
.cr-pl-graf-tela, .cr-mx-graf-tela, .cr-graf-tela { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cr-graf3d { position: absolute; inset: 0; }
.cr-graf3d canvas { display: block; width: 100% !important; height: 100% !important; }
.cr-pl { display: flex; flex: 1; min-height: 0; }
.cr-pl-sx { flex: none; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--panel); min-height: 0; }
.cr-pl-angolo { flex: none; display: grid; grid-template-rows: 1fr 1fr; align-items: center; padding: 0 8px; font-size: 10px; color: var(--muted); border-bottom: 1px solid var(--line); }
.cr-pl-angolo span:last-child { color: var(--warn); }
.cr-pl-sx-tracce { flex: 1; overflow: hidden; min-height: 0; }
.cr-traccia { display: flex; align-items: center; gap: 6px; padding: 0 6px; border-bottom: 1px solid #20242d; overflow: hidden; }
.cr-num-tr { min-width: 30px; height: 22px; font-size: 13px; }
.cr-traccia-nome { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: default; }

/* ---- Mixer */
.cr-mx { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cr-mx-graf { flex: none; border-bottom: 1px solid var(--line); }
.cr-mx-graf-testa { display: flex; align-items: center; gap: 8px; padding: 4px 6px; }
.cr-mx-graf-testa .hint { margin: 0; font-size: 12px; }
.cr-mx-graf-box { position: relative; height: clamp(40px, 20cqh, 120px); background: #0b0d11; }
.cr-mx-corpo { display: flex; flex: 1; min-height: 0; }
.cr-mx-master { flex: none; border-right: 2px solid var(--line); background: #14171d; overflow-y: auto; overflow-x: hidden; }
.cr-mx-strisce { flex: 1; min-width: 0; display: flex; overflow: auto; }
.cr-str { flex: none; width: 68px; display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 6px 4px; border-right: 1px solid #23272f; background: var(--panel); height: 100%; min-height: 214px; }
.cr-str.sel { background: #24191e; box-shadow: inset 0 0 0 1px var(--accent); }
.cr-str-master { background: #14171d; }
.cr-str-testa { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; cursor: pointer; }
.cr-str-nome { font-size: 11px; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-str.sel .cr-str-nome { color: var(--text); }
.cr-str-corpo { display: flex; gap: 6px; flex: 1; min-height: 70px; }
.cr-mis { width: 14px; height: 100%; display: block; }
.cr-fader { position: relative; width: 22px; height: 100%; cursor: ns-resize; touch-action: none; }
.cr-fader b { position: absolute; left: 50%; top: 4px; bottom: 4px; width: 4px; margin-left: -2px; background: #0b0d11; border-radius: 2px; }
.cr-fader i { position: absolute; left: 1px; right: 1px; height: 12px; border-radius: 3px; background: #c9ced8; box-shadow: inset 0 -3px 0 #8a909c, 0 1px 3px rgba(0, 0, 0, .6); }
.cr-fader:focus-visible i { background: var(--accent); }
.cr-str-tasti { display: flex; align-items: center; gap: 6px; }
.cr-solo { width: 20px; height: 18px; border-radius: 4px; border: 1px solid var(--line); background: #0b0d11; color: var(--muted); font: 700 10px system-ui; cursor: pointer; padding: 0; }
.cr-solo.on { background: var(--warn); color: #0f1115; border-color: var(--warn); }
.cr-uscita { width: 58px !important; padding: 2px !important; font-size: 11px !important; border-radius: 6px !important; background: #0b0d11 !important; }
.cr-uscita.fissa { color: var(--muted); text-align: center; border: 1px solid var(--line); }
.cr-slot { flex: none; width: 210px; border-left: 1px solid var(--line); display: flex; flex-direction: column; background: #14171d; min-height: 0; }
.cr-slot-testa { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.cr-slot-testa b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-slot-lista { flex: 1; overflow-y: auto; padding: 4px; }
.cr-slot-voce { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 4px 0 8px; margin-bottom: 2px; border-radius: 6px; background: var(--panel2); width: 100%; }
.cr-slot-voce.vuota { border: 0; color: #5b6474; font-style: italic; font-size: 12px; text-align: left; cursor: pointer; background: #1a1d24; }
.cr-slot-voce.vuota:hover { color: var(--text); }
.cr-slot-voce.spento .cr-slot-nome { opacity: .45; }
.cr-slot-nome { flex: 1; min-width: 0; text-align: left; background: none; border: 0; color: var(--text); font-size: 12px; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0; }
.cr-gruppi { display: flex; gap: 6px; padding: 6px; border-top: 1px solid var(--line); overflow-x: auto; flex: none; }
.cr-gruppi.vuoti .hint { margin: 0; font-size: 12px; }
.cr-album { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 140px; max-width: 240px; padding: 6px 10px; border-radius: 10px; background: var(--panel2); border: 1px solid var(--line); border-left: 4px solid var(--col); color: var(--text); text-align: left; cursor: pointer; }
.cr-album b { font-size: 12px; }
.cr-album span { font-size: 11px; color: var(--muted); }
.cr-album i { font-size: 11px; color: var(--ok); font-style: normal; }

/* manopole */
.cr-man { display: inline-flex; flex-direction: column; align-items: center; gap: 1px; cursor: ns-resize; touch-action: none; user-select: none; outline: none; min-width: 58px; }
.cr-man svg { width: 38px; height: 38px; }
.cr-man.piccola { min-width: 0; }
.cr-man.piccola svg { width: 30px; height: 30px; }
.cr-man-fondo { fill: none; stroke: #0b0d11; stroke-width: 4; stroke-linecap: round; }
.cr-man-val { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: round; }
.cr-man-ago { stroke: var(--text); stroke-width: 2; stroke-linecap: round; }
.cr-man:focus-visible .cr-man-fondo { stroke: var(--line); }
.cr-man-nome { font-size: 11px; color: var(--muted); max-width: 76px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cr-man-num { font-size: 10px; color: var(--ok); font-variant-numeric: tabular-nums; }

/* Grafico e Plugin */
.cr-graf { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cr-graf-box { position: relative; flex: 1; min-height: 120px; background: #0b0d11; }
.cr-stats { padding: 6px; margin: 0; grid-template-columns: repeat(3, 1fr) !important; }
.cr-plug { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.cr-plug-corpo { flex: 1; overflow-y: auto; padding: 8px; }
.cr-plug-spettro-box { position: relative; height: 90px; background: #0b0d11; border-radius: 8px; overflow: hidden; margin-bottom: 8px; }
.cr-plug-spettro { width: 100%; height: 100%; display: block; }
.cr-plug-info .hint { margin: 0 0 8px; }
.cr-manopole { display: flex; flex-wrap: wrap; gap: 12px 6px; margin-top: 10px; }
.cr-riga-btn { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.cr-spunta { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }

/* menu e finestre modali (angoli smussati, tinta del tema) */
.cr-menu { position: fixed; z-index: 60; min-width: 190px; max-height: 60vh; overflow-y: auto; background: var(--panel2); border: 1px solid var(--line); border-radius: 12px; padding: 5px; box-shadow: 0 10px 30px rgba(0, 0, 0, .55); }
.cr-menu button { display: block; width: 100%; text-align: left; background: none; border: 0; color: var(--text); padding: 8px 10px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.cr-menu button:hover { background: #2b303b; }
.cr-menu button.attiva { color: var(--accent); }
.cr-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }
.cr-menu-tit { font-size: 11px; color: var(--muted); padding: 6px 10px 2px; text-transform: uppercase; letter-spacing: .04em; }
.cr-velo { position: fixed; inset: 0; z-index: 50; background: rgba(0, 0, 0, .6); display: grid; place-items: center; padding: 16px; }
.cr-modale { width: min(520px, 100%); max-height: calc(100dvh - 32px); display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.cr-modale-testa { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--line); }
.cr-modale-testa h3 { flex: 1; margin: 0; }
.cr-modale-corpo { padding: 12px 16px 16px; overflow-y: auto; }
.cr-modale-corpo .hint { margin: 0 0 10px; }
.cr-gruppo { margin-bottom: 12px; }
.cr-gruppo h4 { margin: 0 0 6px; font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.cr-synth-lista { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.cr-synth { display: flex; align-items: center; gap: 4px; padding: 4px 4px 4px 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel2); }
.cr-synth.attuale { border-color: var(--accent); }
.cr-synth .cr-ico { color: var(--ok); }
.cr-synth-nome { flex: 1; min-width: 0; align-self: stretch; text-align: left; background: none; border: 0; color: var(--text); font-size: 13px; font-weight: 600; cursor: pointer; padding: 0 6px; border-radius: 8px; }
.cr-synth-nome:hover { background: #2b303b; }
.cr-fondo { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.cr-campi { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cr-audio { width: 100%; margin: 10px 0; }
.cr-modale .btn.small { min-width: 0; }

/* telefono: una finestra per schermata, una sotto l'altra */
@media (max-width: 759px) {
  main:has(> #tab-crea.active) { padding: 4px 4px 0; }
  .cr-spazio { display: flex; flex-direction: column; overflow-y: auto; }
  .cr-spazio > .cr-fin { flex: none; height: calc(100% - 4px); min-height: 380px; }
  .cr-titolo { width: 120px; }
  .cr-rack-sx { width: 132px; padding: 0 4px; }
  .cr-num-can { display: none; }
  .cr-slot { position: absolute; right: 0; top: 0; bottom: 0; z-index: 3; box-shadow: -6px 0 18px rgba(0, 0, 0, .5); }
  .cr-mx-corpo { position: relative; }
  .cr-fin.grande { inset: 56px 0 64px; border-radius: 0; }
  .cr-campi { grid-template-columns: 1fr; }
  .cr-pl-graf { height: 60px; }
  .cr-traccia { gap: 4px; padding: 0 4px; }
}
@supports selector(::-webkit-scrollbar) {
  #tab-crea .cr-barra::-webkit-scrollbar, #tab-crea .cr-strumenti::-webkit-scrollbar { height: 4px; }
  #tab-crea .cr-barra::-webkit-scrollbar-thumb, #tab-crea .cr-strumenti::-webkit-scrollbar-thumb { border-width: 0; }
}
