/* style-controls.css — controlli comuni alle pagine del gioco (Antonio, 20/10: «la grafica
   su pc, le droplist custom, la scroll bar in palette con il sito, la scelta del modello
   più user friendly»): barra di scorrimento nel blu del sito, menu a tendina disegnati
   (custom-select.js, solo su computer) e le 4 fasce dei modelli di /play (model-picker.js).
   Colori del brand: style-brand.css. */

/* ---------- Barra di scorrimento ---------- */
html { scrollbar-color: #3d5fd6 #0a1850; scrollbar-width: thin; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0a1850; }
::-webkit-scrollbar-thumb { background: #3d5fd6; border-radius: 8px; border: 2px solid #0a1850; }
::-webkit-scrollbar-thumb:hover { background: #ffd166; }
::-webkit-scrollbar-corner { background: #0a1850; }

/* ---------- Menu a tendina (custom-select.js) ---------- */
.cs { position: relative; display: inline-flex; min-width: 0; vertical-align: middle; }
.cs-native {
  position: absolute !important; inset: 0; width: 100% !important; height: 100% !important;
  opacity: 0; pointer-events: none;
}
.cs-button {
  display: inline-flex; align-items: center; justify-content: space-between; gap: 10px;
  width: 100%; min-height: 44px; padding: 0 12px 0 14px;
  border: 2px solid #2d79f3; border-radius: 10px;
  background: linear-gradient(180deg, #1a3279 0%, #152a66 100%);
  color: #fff; font: inherit; font-size: 0.95rem; font-weight: 700; text-align: left;
  cursor: pointer; box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
  transition: border-color 150ms ease, background-color 150ms ease, transform 120ms ease;
}
.cs-button:hover:not(:disabled) { border-color: #ffd166; }
.cs-button:active:not(:disabled) { transform: translateY(1px); }
.cs-button:focus-visible { outline: 3px solid #ffd166; outline-offset: 2px; }
.cs-button:disabled { opacity: 0.6; cursor: default; }
.cs-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-chevron { flex: none; width: 18px; height: 18px; opacity: 0.85; transition: transform 160ms ease; }
.cs.is-open .cs-chevron { transform: rotate(180deg); }
.cs-list {
  position: fixed; z-index: 10000; margin: 0; padding: 6px; list-style: none;
  max-height: 280px; overflow-y: auto;
  background: #132766; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 12px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  color: #fff; font-family: inherit; font-size: 0.95rem;
  animation: cs-in 140ms ease-out;
}
.cs-list:focus { outline: none; }
@keyframes cs-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.cs-option {
  position: relative; padding: 9px 34px 9px 12px; border-radius: 8px;
  font-weight: 600; cursor: pointer; white-space: nowrap;
}
.cs-option.is-active { background: #1f3c99; }
.cs-option[aria-selected="true"] { color: #ffd166; }
.cs-option[aria-selected="true"]::after {
  content: ''; position: absolute; right: 12px; top: 50%; width: 6px; height: 11px; margin-top: -7px;
  border: solid currentColor; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg);
}
@media (prefers-reduced-motion: reduce) { .cs-list { animation: none; } .cs-chevron { transition: none; } }

/* Il tipo di domande accanto alla categoria (/play): oro quando non è «risposta aperta» */
.cs--category-mode { flex: 0 0 auto; min-width: 200px; max-width: 48%; }
@media (max-width: 480px) { .cs--category-mode { flex: 1 1 100%; max-width: none; } }
.cs--category-mode .cs-button { border-radius: 6px; }
.cs--category-mode .cs-button:not([data-value="open"]) { border-color: #ffd166; color: #ffd166; }
#languageSelect + .cs-button, .cs:has(#languageSelect) { min-width: 180px; }

/* ---------- Le 4 fasce dei modelli (/play, model-picker.js) ---------- */
.tier-picker { display: flex; flex-direction: column; gap: 14px; margin: 4px 0 16px; }
.tier-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.tier-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  min-height: 118px; padding: 14px 14px 12px;
  border: 2px solid rgba(255, 255, 255, 0.14); border-radius: 14px;
  background: #152a66; color: #fff; font: inherit; text-align: left; cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, transform 120ms ease, box-shadow 150ms ease;
}
.tier-btn:hover { border-color: rgba(255, 209, 102, 0.6); transform: translateY(-2px); }
.tier-btn:focus-visible { outline: 3px solid #ffd166; outline-offset: 2px; }
.tier-btn[aria-checked="true"] {
  background: linear-gradient(180deg, #24459f 0%, #1c3887 100%);
  border-color: #ffd166; box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.18), 0 8px 22px rgba(0, 0, 0, 0.3);
}
.tier-name { font-size: 1.08rem; font-weight: 800; }
.tier-meter { display: inline-flex; gap: 4px; }
.tier-meter i { width: 18px; height: 6px; border-radius: 3px; background: rgba(255, 255, 255, 0.18); }
.tier-meter i.on { background: #ffd166; }
.tier-hint { font-size: 0.85rem; line-height: 1.35; color: #c9d3ff; }
.tier-cost { margin-top: auto; font-size: 0.82rem; font-weight: 700; color: #9fb4ff; }
.tier-btn[aria-checked="true"] .tier-cost { color: #ffd166; }

.web-switch { display: inline-flex; align-items: center; gap: 10px; align-self: flex-start; cursor: pointer; font-weight: 700; }
.web-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.web-track {
  position: relative; flex: none; width: 46px; height: 26px; border-radius: 13px;
  background: rgba(255, 255, 255, 0.2); transition: background-color 160ms ease;
}
.web-track::after {
  content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4); transition: transform 160ms ease;
}
.web-switch input:checked + .web-track { background: #2ecc71; }
.web-switch input:checked + .web-track::after { transform: translateX(20px); }
.web-switch input:focus-visible + .web-track { outline: 3px solid #ffd166; outline-offset: 2px; }
.web-switch.is-fixed { cursor: default; }
.web-switch.is-fixed .web-track { opacity: 0.45; }
.web-note { font-size: 0.85rem; font-weight: 600; color: #b3bfef; }

.model-all { margin-top: 2px; }
.model-all > summary {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer; list-style: none;
  font-weight: 700; color: #b3bfef; padding: 6px 0;
}
.model-all > summary::-webkit-details-marker { display: none; }
.model-all > summary::before {
  content: ''; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0;
  transform: rotate(-45deg); transition: transform 150ms ease;
}
.model-all[open] > summary::before { transform: rotate(45deg); }
.model-all > summary:hover { color: #fff; }

@media (max-width: 760px) {
  .tier-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tier-btn { min-height: 104px; padding: 12px; }
}

/* Icona delle modalità con le foto nei menu (custom-select.js) */
.cs-icon { display: inline-flex; vertical-align: -3px; margin-right: 7px; color: #ffd166; }
.cs-icon .ic { width: 16px; height: 16px; }
.cs-option .cs-icon { margin-right: 8px; }

/* /play: il segno delle immagini accanto al tipo di domande e il «?» che spiega i tipi */
.mode-photo-badge { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 34px; height: 34px; border-radius: 8px; background: rgba(255, 209, 102, 0.14); color: #ffd166; }
.mode-photo-badge[hidden] { display: none; }
.mode-photo-badge .ic { width: 18px; height: 18px; }
.mode-help-btn {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 38px; height: 38px; border-radius: 50%; border: 2px solid rgba(255, 255, 255, 0.3);
  background: transparent; color: #d9e0ff; cursor: pointer;
}
.mode-help-btn:hover { border-color: #ffd166; color: #ffd166; }
.mode-help-btn:focus-visible { outline: 3px solid #ffd166; outline-offset: 2px; }
.mode-help-btn .ic { width: 20px; height: 20px; }
.modes-help {
  margin: auto; max-width: min(92vw, 520px); max-height: 86vh; padding: 22px 22px 18px; border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px; background: #132766; color: #fff; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.modes-help::backdrop { background: rgba(5, 12, 40, 0.7); }
.modes-help h3 { margin: 0 0 12px; font-size: 1.25rem; }
.modes-help dl { margin: 0; display: grid; gap: 4px; }
.modes-help dt { margin-top: 10px; font-weight: 800; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.modes-help dd { margin: 0; color: #c9d3ff; line-height: 1.4; }
.modes-help-photo { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; background: rgba(255, 209, 102, 0.16); color: #ffd166; font-size: 0.78rem; font-weight: 700; }
.modes-help-photo .ic { width: 14px; height: 14px; }
.modes-help-close {
  display: block; margin: 18px 0 0 auto; min-height: 42px; padding: 0 20px; border: 0; border-radius: 10px;
  background: #ffd166; color: #1c1500; font: inherit; font-weight: 800; cursor: pointer;
}
.modes-help-close:focus-visible { outline: 3px solid #fff; outline-offset: 2px; }
/* Telefono: il nome su una riga, sotto menu, segno e «?» insieme */
@media (max-width: 480px) {
  .category-input-container .category-input { flex: 1 1 100%; }
  .category-input-container .category-mode, .category-input-container .cs--category-mode { flex: 1 1 0; min-width: 0; max-width: none; }
}
/* Col menu disegnato l'icona sta già nel menu: il segno a parte serve solo al menu del telefono */
.cs + .mode-photo-badge { display: none; }
