/* Menu a tendina a pannello (js/menu-tendina.js): testata squadrata, pannello di pergamena che si srotola, voci con rombo o icona */
.mt { position: relative; min-width: 0; }
.mt__nativo { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.mt__testata { display: flex; align-items: stretch; width: 100%; height: 42px; padding: 0; border: 1px solid var(--parchment-shadow); border-radius: 3px; background: #fbf6e9; color: var(--ink); font: inherit; font-size: .88rem; text-align: left; cursor: pointer; box-sizing: border-box; box-shadow: 0 1px 0 rgba(255, 255, 255, .5) inset; }
.mt__testata:focus-visible, .mt--aperto .mt__testata { outline: none; border-color: var(--ember); box-shadow: 0 0 0 3px rgba(184, 84, 42, 0.18); }
.mt__testo { flex: 1 1 auto; min-width: 0; padding: 0 4px 0 10px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.mt__freccia { flex: 0 0 26px; position: relative; border-left: 1px solid rgba(160, 130, 70, .35); }
.mt__freccia::after { content: ''; position: absolute; left: 50%; top: 50%; margin: -2px 0 0 -4px; border: 4px solid transparent; border-top: 5px solid var(--ember-dark); border-bottom: 0; transition: transform .25s ease; }
.mt--aperto .mt__freccia::after { transform: rotate(180deg); margin-top: -3px; }
.mt--aperto { z-index: 50; }
/* Il pannello: un unico foglio di pergamena che si srotola dall'alto; le voci entrano una dopo l'altra */
.mt__lista { position: absolute; z-index: 40; top: calc(100% + 6px); left: 0; min-width: 100%; width: max-content; max-width: min(300px, calc(100vw - 24px)); box-sizing: border-box; margin: 0; padding: 6px 0; list-style: none; max-height: min(420px, 60vh); overflow-y: auto; overflow-x: hidden;
  scrollbar-width: thin; scrollbar-color: rgba(184, 84, 42, .7) transparent;
  background: linear-gradient(180deg, #fdf8ec 0%, #f6ecd4 100%); border: 1px solid var(--parchment-shadow); border-top: 2px solid var(--ember); border-radius: 3px;
  box-shadow: 0 24px 40px -16px rgba(0, 0, 0, .75), 0 4px 10px -4px rgba(0, 0, 0, .4);
  visibility: hidden; pointer-events: none; opacity: 0; transform: translateY(-8px); transform-origin: top; clip-path: inset(0 0 100% 0);
  transition: clip-path .34s cubic-bezier(.2, .8, .2, 1), transform .34s cubic-bezier(.2, .8, .2, 1), opacity .18s ease, visibility 0s linear .34s; }
.mt--destra .mt__lista { left: auto; right: 0; }
.mt--aperto .mt__lista { visibility: visible; pointer-events: auto; opacity: 1; transform: none; clip-path: inset(-40px -40px -60px -40px); transition-delay: 0s; }
.mt__voce { position: relative; display: flex; align-items: center; gap: 10px; padding: 10px 18px 10px 14px; color: var(--ink); font-size: .9rem; line-height: 1.25; cursor: pointer; white-space: nowrap;
  border-top: 1px solid rgba(160, 130, 70, .22);
  opacity: 0; transform: translateX(-10px); transition: opacity .15s ease, transform .15s ease, background .15s ease; }
.mt__voce:first-child { border-top: 0; }
.mt--aperto .mt__voce { opacity: 1; transform: none; transition: opacity .28s ease calc(var(--i) * 32ms + 90ms), transform .32s cubic-bezier(.2, .8, .2, 1) calc(var(--i) * 32ms + 90ms), background .15s ease 0s; }
.mt__voce::before { content: ''; flex: 0 0 6px; width: 6px; height: 6px; background: var(--ember); transform: rotate(45deg) scale(0); transition: transform .2s ease; }
.mt__voce--attiva { background: rgba(184, 84, 42, .11); }
.mt__voce--attiva::before, .mt__voce--scelta::before { transform: rotate(45deg) scale(1); }
.mt__voce--scelta { font-weight: 700; color: var(--ember-dark); }
.mt__lista::-webkit-scrollbar { width: 6px; } .mt__lista::-webkit-scrollbar-track { background: transparent; } .mt__lista::-webkit-scrollbar-thumb { background: rgba(184, 84, 42, .7); border-radius: 3px; }
@media (prefers-reduced-motion: reduce) { .mt__lista, .mt__voce, .mt--aperto .mt__voce { transition: none; transform: none; clip-path: none; } }

/* Icone delle voci (menu "Ordina") */
.mt__testo { gap: 8px; }
.mt__t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mt__ico { flex: 0 0 16px; width: 16px; height: 16px; color: var(--ink-soft); display: inline-flex; }
.mt__ico svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.mt__testata .mt__ico { color: var(--ember-dark); }
.mt__voce--icona::before { display: none; }
.mt__voce--icona.mt__voce--attiva .mt__ico, .mt__voce--icona.mt__voce--scelta .mt__ico { color: var(--ember-dark); }
.mt__voce--icona.mt__voce--scelta { box-shadow: inset 3px 0 0 var(--ember); }
.mt[hidden] { display: none; }
.mt__testata:disabled { opacity: .55; cursor: not-allowed; }
/* Nei moduli (form dello Studio, profilo, contatti): stessa altezza dei campi di testo */
.campo .mt__testata { height: 44px; font-size: .95rem; }
.campo .mt__lista { max-width: min(420px, calc(100vw - 24px)); }
.campo .mt__voce { font-size: .95rem; }

/* Il riquadro che contiene il menu lascia uscire il pannello quando e aperto */
.modulo:has(.mt--aperto) { overflow: visible; }
.modulo__testa { border-radius: 6px 6px 0 0; }
/* Apertura verso l'alto */
.mt--su .mt__lista { top: auto; bottom: calc(100% + 6px); transform: translateY(8px); transform-origin: bottom; border-top: 1px solid var(--parchment-shadow); border-bottom: 2px solid var(--ember); clip-path: inset(100% 0 0 0); box-shadow: 0 -20px 36px -16px rgba(0, 0, 0, .7), 0 -3px 8px -4px rgba(0, 0, 0, .35); }
.mt--su.mt--aperto .mt__lista { transform: none; clip-path: inset(-40px -40px -40px -40px); }

/* Editor delle dinamiche del capitolo: menu dentro righe strette */
.dx-riga .mt { flex: 1 1 170px; max-width: 100%; min-width: 0; }
.dx-modulo .mt__testata, .dx-scelta .mt__testata { height: 38px; font-size: .9rem; }
.dx-modulo .mt__voce, .dx-scelta .mt__voce { font-size: .9rem; }

/* Editor del personaggio */
.pe-campo .mt { width: 100%; }
.pe-campo .mt__testata { height: 40px; font-size: .92rem; }
.pe-campo .mt__voce, .pe-effetto .mt__voce { font-size: .9rem; }
.pe-effetto .mt { min-width: 0; }
.pe-effetto .mt__testata { height: 36px; font-size: .88rem; }
@media (max-width: 640px) { .pe-effetto .mt:first-child { grid-column: 1 / -1; } }

/* Amministrazione: filtri e scelta del gruppo */
.mod-testa .mt { flex: 0 1 230px; min-width: 170px; }
.mod-testa .mt__testata, #adm-filtro ~ .mt__testata { height: 38px; font-size: .9rem; }
.adm .mt { min-width: 0; }
.adm .mt__testata { height: 40px; font-size: .9rem; }
.adm__strumenti .mt { flex: 0 0 160px; }
.adm-barra__riga .mt { flex: 1 1 160px; min-width: 0; }
.adm input[type="search"] { border-radius: 3px; }
