/* Stile coerente con simonecastellan.com — minimale, monocromatico, luce.
   Le classi ricalcano quelle degli altri strumenti: .btn, .seg, .dropzone,
   .site-footer, .toast, .hidden. */
:root {
  --bg: #ffffff;
  --text: #3c4043;
  --ink: #1a1a1a;
  --muted: #5f6368;
  --muted-2: #68716d;
  --faint: #68716d;
  --pill: #f1f3f4;
  --pill-hover: #e6e8ea;
  --line: #c2c6cc;
  --line-soft: #dadce0;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

button, input, summary { touch-action: manipulation; }
button { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 100vh;
  padding: 44px 20px calc(60px + env(safe-area-inset-bottom));
  text-align: center;
}

.card { width: 100%; max-width: 560px; }

header { margin-bottom: 26px; }
h1 { font-size: 27px; font-weight: 500; color: var(--ink); letter-spacing: -0.3px; }
.subtitle { font-size: 16px; color: var(--muted); margin-top: 9px; }

/* Drop zone */
.dropzone {
  border: 1.5px dashed var(--line-soft);
  border-radius: 22px;
  padding: 38px 20px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
  background: #fafbfc;
}
.dropzone:hover { background: var(--pill); }
.dropzone.dragover { background: var(--pill); border-color: var(--muted-2); }
.dz-title { font-size: 16px; font-weight: 500; color: var(--ink); }
.dz-or { color: var(--faint); margin: 6px 0 16px; font-size: 13px; }

.claims { margin-top: 16px; font-size: 12px; color: var(--faint); }

/* Bottoni */
.btn {
  appearance: none; border: none; border-radius: 999px;
  padding: 12px 22px; font-size: 15px; font-weight: 600; font-family: inherit;
  cursor: pointer; transition: background .15s ease, opacity .15s ease;
}
.btn-primary { background: var(--ink); color: #fff; width: 100%; }
.btn-primary:hover { background: #000; }
.btn-secondary { background: var(--pill); color: var(--ink); width: 100%; }
.btn-secondary:hover { background: var(--pill-hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn-ghost {
  background: transparent; color: var(--muted); font-weight: 500; font-size: 13px;
  margin-top: 12px; border-bottom: 1px solid var(--line); border-radius: 0; padding: 0 0 1px;
}
.btn-ghost:hover { color: var(--ink); }
.dropzone .btn { width: auto; min-width: 170px; }

.link-piccolo {
  appearance: none; border: none; background: none; font-family: inherit;
  font-size: 12px; color: var(--muted); cursor: pointer; padding: 0 0 1px;
  border-bottom: 1px solid var(--line-soft);
}
.link-piccolo:hover { color: var(--ink); border-color: var(--line); }

/* Stato ed errore */
.status { padding: 24px 0; }
.status-text { color: var(--muted); font-size: 15px; }
.errore { margin-top: 18px; padding: 16px 18px; background: #fafbfc; border: 1px solid var(--line-soft); border-radius: 16px; }
.errore-msg { font-size: 14px; line-height: 1.55; color: var(--ink); }

/* Riga della foto caricata */
.riga-foto {
  display: flex; align-items: baseline; justify-content: center; gap: 10px;
  flex-wrap: wrap; margin-bottom: 26px;
}
.nome-foto { font-size: 13px; color: var(--muted-2); word-break: break-all; }

.domanda { font-size: 14px; color: var(--ink); font-weight: 500; margin-bottom: 12px; }

/* Chip delle piattaforme */
.chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.chip {
  appearance: none; border: 1px solid var(--line-soft); background: #fff;
  color: var(--muted); font-family: inherit; font-size: 13.5px; font-weight: 600;
  padding: 9px 16px; border-radius: 999px; cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.chip:hover { border-color: var(--line); color: var(--ink); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }

/* Esito del controllo */
.riga-file {
  display: flex; align-items: baseline; justify-content: center; gap: 10px;
  flex-wrap: wrap; margin: 26px 0 22px;
}
.scheda { font-size: 13px; color: var(--muted-2); word-break: break-all; font-variant-numeric: tabular-nums; }

.elenco { text-align: left; }
.piattaforma + .piattaforma { margin-top: 22px; }
.piattaforma-nome {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted-2); margin-bottom: 8px;
}
.uso {
  display: flex; align-items: baseline; gap: 10px;
  padding: 10px 2px; border-top: 1px solid #eef0f2; font-size: 14px; line-height: 1.5;
}
.piattaforma .uso:first-of-type { border-top: none; }
.segno {
  flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; align-self: flex-start; margin-top: 1px;
}
.uso.ok .segno { background: var(--pill); color: var(--ink); }
.uso.attenzione .segno { background: #fdf1dc; color: #b06000; }
.uso.no .segno { background: #fdeceb; color: #c5221f; }
.uso-testo { flex: 1; color: var(--muted); }
.uso-testo b { color: var(--ink); font-weight: 600; }
.uso.ok .uso-testo { color: var(--muted-2); }
.aggiusta {
  flex: 0 0 auto; align-self: center;
  background: var(--ink); color: #fff; text-decoration: none;
  border-radius: 999px; padding: 6px 14px; font-size: 12.5px; font-weight: 600;
}
.aggiusta:hover { background: #000; }
.nota-finale { margin-top: 20px; font-size: 12.5px; line-height: 1.6; color: var(--faint); text-align: left; }

/* Risultati */
.risultati { margin-top: 26px; text-align: left; }
.gruppo + .gruppo { margin-top: 26px; }
.gruppo-nome {
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px;
  color: var(--muted-2); margin-bottom: 10px;
}
.formati { display: flex; flex-direction: column; gap: 10px; }

.formato {
  display: flex; align-items: center; gap: 14px;
  padding: 12px; border: 1px solid #eef0f2; border-radius: 16px; background: #fff;
}
.anteprima {
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--pill);
  cursor: grab;
  touch-action: none;               /* il trascinamento è nostro, non della pagina */
  box-shadow: 0 0 0 1px rgba(0,0,0,.06) inset;
  max-height: 132px;
}
.anteprima:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.anteprima.in-mano { cursor: grabbing; }
.anteprima.staccata { box-shadow: 0 0 0 2px var(--ink) inset; }

.formato-testo { min-width: 0; flex: 1; }
.formato-nome { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.formato-nota { font-size: 11.5px; color: var(--faint); margin-top: 1px; }
.formato-misura {
  font-size: 12px; color: var(--muted-2); margin-top: 4px;
  font-variant-numeric: tabular-nums; line-height: 1.4;
}
.formato-misura.scarsa { color: #b06000; }
.formato-azioni { display: flex; align-items: center; gap: 12px; margin-top: 9px; }
.f-dl {
  appearance: none; border: none; background: var(--pill); color: var(--ink);
  border-radius: 999px; padding: 6px 15px; font-size: 12.5px; font-weight: 600;
  font-family: inherit; cursor: pointer; transition: background .15s ease;
}
.f-dl:hover { background: var(--pill-hover); }

.aiuto { margin-top: 18px; font-size: 12px; line-height: 1.6; color: var(--faint); }

/* Zoom */
.riga-zoom { display: flex; align-items: center; gap: 12px; margin-top: 14px; }
.riga-zoom label { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted-2); }
.range {
  appearance: none; -webkit-appearance: none; flex: 1;
  height: 4px; border-radius: 999px; background: var(--line-soft); cursor: pointer; outline: none;
}
.range::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--ink); cursor: pointer;
}
.range::-moz-range-thumb { width: 18px; height: 18px; border: none; border-radius: 50%; background: var(--ink); }

.azioni { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }

/* Opzioni avanzate */
.avanzate { margin-top: 18px; text-align: left; }
.avanzate summary {
  font-size: 13px; color: var(--muted); cursor: pointer; list-style: none;
  border-bottom: 1px solid var(--line-soft); display: inline-block; padding-bottom: 1px;
}
.avanzate summary::-webkit-details-marker { display: none; }
.avanzate summary:hover { color: var(--ink); }
.avanzate .seg { margin-top: 12px; }
.avanzate-nota { font-size: 12px; color: var(--faint); margin-top: 10px; line-height: 1.5; }

.seg { display: inline-flex; gap: 3px; background: var(--pill); border-radius: 999px; padding: 4px; }
.seg-btn {
  appearance: none; border: none; background: transparent; color: var(--muted);
  font-family: inherit; font-size: 12.5px; font-weight: 600; padding: 7px 14px;
  border-radius: 999px; cursor: pointer; white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.seg-btn.active { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.privacy { margin-top: 26px; font-size: 12px; color: var(--faint); }

/* Spiegazione e domande */
.spiega { margin-top: 48px; padding-top: 30px; border-top: 1px solid #eef0f2; text-align: left; }
.spiega h2 { font-size: 17px; font-weight: 600; color: var(--ink); margin-bottom: 10px; }
.spiega h2 + p { margin-bottom: 12px; }
.spiega h3 { font-size: 14.5px; font-weight: 600; color: var(--ink); margin: 20px 0 6px; }
.spiega p { font-size: 14px; line-height: 1.65; color: var(--muted); }
.spiega h2:not(:first-child) { margin-top: 34px; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(8px);
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 500;
  padding: 10px 18px; border-radius: 999px; opacity: 0; pointer-events: none;
  transition: opacity .18s ease, transform .18s ease; z-index: 20; max-width: 90vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Footer */
.site-footer {
  margin-top: 44px; text-align: center; font-size: 12px; color: #6b7075; letter-spacing: .2px;
}
.site-footer a { color: #6b7075; text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 1px; }
.site-footer a:hover { color: var(--ink); }

.hidden { display: none !important; }

@media (max-width: 460px) {
  body { padding-top: 32px; }
  h1 { font-size: 23px; }
  .subtitle { font-size: 15px; }
  .formato { gap: 12px; padding: 10px; }
  .formato-nome { font-size: 14px; }
  .chip { font-size: 13px; padding: 9px 14px; }
}

/* ---- Metriche: campi e risultati ------------------------------------------
   Nessun campo obbligatorio, quindi nessuna gerarchia visiva fra i campi:
   sono tutti uguali e si riempiono quelli che si hanno. */
.campi {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 26px;
  text-align: left;
}
.campo {
  display: block;
  border: 1px solid var(--line-soft);
  border-radius: 14px;
  padding: 10px 12px 8px;
  transition: border-color .15s ease;
}
.campo:focus-within { border-color: var(--ink); }
.campo-nome { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink); }
.campo-aiuto { display: block; font-size: 11px; color: var(--faint); margin-top: 1px; line-height: 1.35; }
.campo-input {
  width: 100%; border: none; background: transparent; margin-top: 4px;
  font-family: inherit; font-size: 19px; font-weight: 600; color: var(--ink);
  padding: 0; font-variant-numeric: tabular-nums;
}
.campo-input:focus { outline: none; }
.campo-input::placeholder { color: var(--line-soft); font-weight: 400; }

.metrica {
  text-align: left;
  border-top: 1px solid #eef0f2;
  padding: 13px 2px;
}
.risultati .metrica:first-child { border-top: none; }
.metrica-testa { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.metrica-nome { font-size: 14.5px; font-weight: 600; color: var(--ink); }
.metrica-valore { font-size: 20px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.metrica-spiega { font-size: 12.5px; line-height: 1.5; color: var(--muted-2); margin-top: 4px; }

.vuoto { margin-top: 26px; font-size: 13px; color: var(--faint); line-height: 1.6; }

@media (max-width: 460px) {
  .campi { grid-template-columns: 1fr 1fr; gap: 8px; }
  .campo { padding: 9px 10px 7px; }
  .campo-input { font-size: 17px; }
}

/* ---- Bando in chiaro ------------------------------------------------------ */
.dz-alt { margin-top: 14px; font-size: 12px; color: var(--faint); }
.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}
.incolla { margin-top: 16px; }
.testo {
  width: 100%; font-family: inherit; font-size: 14px; line-height: 1.55;
  color: var(--ink); background: #fff;
  border: 1px solid var(--line-soft); border-radius: 14px;
  padding: 13px 14px; resize: vertical; min-height: 120px;
}
.testo:focus { outline: none; border-color: var(--ink); }
.testo::placeholder { color: var(--faint); }
.conta { margin-top: 8px; font-size: 12px; color: var(--muted-2); text-align: left; }
.conta.avviso { color: #b06000; }

.prompt {
  margin-top: 12px; text-align: left;
  background: #fafbfc; border: 1px solid var(--line-soft); border-radius: 12px;
  padding: 12px 14px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px; line-height: 1.55; color: var(--muted);
  white-space: pre-wrap; max-height: 260px; overflow: auto;
}

/* ── La misura di un dito ───────────────────────────────────────────────────
   Questo strumento non era nella vetrina né nella lista delle prove, e la
   regola dei 44 px non l'aveva mai vista: i pulsanti stavano a 41,5 e la riga
   «Cosa verrà chiesto» a 17. La regola sta in OR — lo schermo stretto si può
   misurare, il tipo di puntatore no — e fa crescere l'area, non il testo. */
@media (max-width: 560px), (pointer: coarse) {
  .btn { min-height: 44px; }
  .avanzate summary {
    min-height: 44px; display: flex; align-items: center;
  }
  .dropzone { padding-bottom: 20px; }
}
