html,
body {
  height: 100%;
}
body {
  margin: 0;
  background: radial-gradient(
      1200px 1200px at 100% -10%,
      #132033 0%,
      #0b0f14 55%
    ),
    radial-gradient(800px 800px at -10% 110%, #0f1a29 0%, #0b0f14 60%);
  font: 16px/1.5 system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue",
    Arial, "Noto Sans", "Apple Color Emoji", "Segoe UI Emoji";
}
.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 80px;
}
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}
header h1 {
  font-size: clamp(22px, 2.4vw, 32px);
  margin: 0;
  color: var(--blu);
  letter-spacing: 0.2px;
}
header p {
  margin: 4px 0 0;
  color: var(--blu);
}

.card {
  background: linear-gradient(180deg, var(--blu) 0%, var(--blu-dark-25) 100%);
  border: 1px solid #1f2a3b;
  border-radius: 18px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 20px;
}

.card-captcha {
  background: linear-gradient(
    180deg,
    var(--blu-light-25) 0%,
    var(--blu--light-75) 100%
  );
  border: 1px solid #1f2a3b;
  border-radius: 18px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: 20px;
}

form {
  display: grid;
  gap: 22px;
  margin: 20px;
}

fieldset {
  padding: 25px;
}

legend {
  padding: 0 8px;
  font-size: 24px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: var(--oro);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 14px;
}
.col-12 {
  grid-column: span 12;
}
.col-6 {
  grid-column: span 6;
}
.col-4 {
  grid-column: span 4;
}
.col-3 {
  grid-column: span 3;
}
.col-2 {
  grid-column: span 2;
}
@media (max-width: 860px) {
  .col-6,
  .col-4,
  .col-3,
  .col-2 {
    grid-column: span 12;
  }
}

label {
  display: block;
  font-size: 16px;
  color: var(--oro-light-75);
  margin: 0 0 6px;
}

input,
select,
textarea {
  width: 100%;
  background: var(--bianco);
  color: var(--oro-dark-50);
  border-radius: 3px;
  padding: 12px 12px;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--oro);
  box-shadow: 0 0 0 4px var(--oro);
  background: var(--oro-light-75);
  color: var(--blu);
}

input::placeholder,
select::placeholder,
textarea::placeholder {
  color: red;
  opacity: 1; /* su Firefox */
  background: transparent; /* i placeholder non hanno background effettivo */
}

.hint {
  font-size: 12px;
  color: var(--bianco);
  margin-top: 6px;
}
.req {
  color: var(--oro);
  font-weight: 700;
  margin-left: 4px;
}
/* Layout generale */
.grid {
  display: flex;
  flex-direction: column;
  gap: 8px; /* spazio verticale tra le righe */
}

/* Contenitore checkbox + label */
.inline {
  display: flex;
  align-items: center; /* centra verticalmente checkbox e testo */
  gap: 8px; /* spazio tra la checkbox e il testo */
  line-height: 1.4;
}

/* Checkbox */
.inline input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--blu); /* colore personalizzato */
  flex-shrink: 0; /* non farla comprimere */
  cursor: pointer;
}

/* Label */
.inline label {
  cursor: pointer;
  color: var(--oro);
  font-size: 14px;
}

/* Link nella label */
.inline label a {
  color: var(--bianco);
  text-decoration: underline;
}
.inline label a:hover {
  color: var(--oro-light-75);
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.btn {
  border: 1px solid #224969;
  color: #eaf3ff;
  background: linear-gradient(180deg, #1a2636, #132133);
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.btn.primary {
  border-color: #1f7acc;
  background: linear-gradient(180deg, var(--blu-light-25), var(--blu-light-75));
  color: var(--blu-dark-75);
}
.btn:focus-visible {
  outline: 3px solid var(--ring);
  outline-offset: 2px;
}
.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.error {
  color: var(--danger);
  font-size: 13px;
  margin-top: 6px;
  display: none;
}

.divider {
  height: 1px;
  background: var(--oro-light-75);
  margin: 6px 0 16px;
}

.chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.chip {
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--blu);
  color: var(--blu);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  white-space: nowrap;
  clip-path: inset(100%);
  clip: rect(0 0 0 0);
  overflow: hidden;
}

.fieldset-head {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 8px;
}

.fs-legend {
  display: flex;
  align-items: center;
  gap: 8px;
}

.info-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--blu);
  background: var(--oro);
  color: var(--blu);
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s;
}
.info-btn:hover {
  background: var(--oro);
  box-shadow: 0 0 0 3px var(--oro-light-75);
}
.info-btn[aria-expanded="true"] {
  background: var(--oro);
}

.info-text {
  margin: 8px 0 12px;
  padding: 8px 10px;
  border: 1px dashed var(--blu);
  border-radius: 6px;
  background: var(--oro-light-75);
  color: var(--blu);
  font-size: 14px;
}

/* Avatar grid */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.avatar-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 10px;
  border-radius: 10px;
  cursor: pointer;
  user-select: none;
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.05s;
  background: var(--oro-light-75);
}
.avatar-card:hover {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}
.avatar-card:active {
  transform: scale(0.99);
}

.avatar-card img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 50%;
  border: 2px solid transparent;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.avatar-name {
  font-size: 12px;
  color: var(--blu);
  text-align: center;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.avatar-check {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--verde);
  color: var(-oro);
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  line-height: 1;
}

/* nasconde i radio (li gestiamo via label) */
.sr-only.avatar-radio {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0;
  height: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

/* Stato selezionato */
.avatar-radio:checked + img {
  border-color: var(--verde);
  box-shadow: 0 0 0 3px rgba(13, 110, 253, 0.15);
}
.avatar-radio:checked ~ .avatar-check {
  display: inline-flex;
}

/* Accessibilità focus da tastiera */
.avatar-card:has(.avatar-radio:focus-visible),
.avatar-card:focus-visible {
  outline: 3px solid rgba(13, 110, 253, 0.35);
  outline-offset: 2px;
}

.msg {
  display: block;
  margin-top: 4px;
  font-size: 0.9em;
  color:#0b0f14;
  background-color: var(--blu);
}

.msg.ok {
  color: var(--verde-light-50);
}
.msg.error {
  color: var(--rosso-light-50);
}

/* Dark mode opzionale, se usi body.dark */
body.dark .avatar-card {
  background: #222;
  border-color: #333;
}
body.dark .avatar-name {
  color: #ddd;
}
body.dark .avatar-card img {
  box-shadow: none;
}
