/* Risultati PlayDecide: grafici (/risultati-playdecide/) e inserimento dati (/risultati-playdecide/inserisci/).
   Dopo una modifica aumentare il numero dopo ?v= nelle due pagine. */
.pd {
  /* quanto si è d'accordo: blu (+) e rosso (−), più scuro = più deciso */
  --pd-p3: #0b5c9e;
  --pd-p2: #3d93d6;
  --pd-p1: #92c6ec;
  --pd-m1: #f0a197;
  --pd-m2: #dc5f55;
  --pd-m3: #a3302a;
  --pd-surface: #fff;
  --pd-half: clamp(150px, 26vw, 230px);
  max-width: none !important;
  margin-top: clamp(24px, 4vw, 40px);
}
.f-flow .f-wrap > .pd { max-width: none; }
.pd [hidden] { display: none !important; }

/* ---------- campi -------------------------------------------------- */
.pd-filters { display: flex; flex-wrap: wrap; gap: 14px 18px; align-items: flex-end; margin: 0 0 18px; }
.pd-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; margin: 0; }
.pd-filters .pd-field { flex: 1 1 200px; max-width: 340px; }
.pd-filters .pd-custom { flex: 0 1 180px; }
.pd-field label, .pd-label { font-weight: 600; font-size: .95rem; color: var(--f-ink); }
.pd select, .pd input[type="date"], .pd input[type="text"], .pd input[type="password"], .pd input[type="number"], .pd textarea {
  box-sizing: border-box; width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px;
  border: 1px solid rgba(11, 34, 51, .22); background: #fff; font: inherit; font-size: 1rem; color: var(--f-ink);
}
.pd select { appearance: none; padding-right: 40px; cursor: pointer;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%230b2233' stroke-width='2'/%3E%3C/svg%3E") right 16px center no-repeat; }
.pd textarea { min-height: 76px; resize: vertical; line-height: 1.45; }
.pd select:focus, .pd input:focus, .pd textarea:focus { border-color: var(--f-button); outline: 3px solid rgba(0, 149, 217, .25); outline-offset: 0; }
.f-home .pd-status { color: var(--f-mute); font-size: .95rem; margin: 0 0 8px; }

/* ---------- grafico -------------------------------------------------- */
.pd-game { margin: clamp(28px, 4vw, 44px) 0 0; padding: clamp(20px, 3vw, 32px); border-radius: var(--f-radius); background: var(--pd-surface); box-shadow: var(--f-shadow); }
.f-home .pd-game h2 { font-size: clamp(1.35rem, 1.2rem + .6vw, 1.75rem) !important; margin: 0 0 4px !important; }
.f-home .pd-meta { color: var(--f-mute); font-size: .95rem; margin: 0 0 14px; }
.f-home .pd-readout { min-height: 1.5em; margin: 0 0 8px; font-weight: 600; color: var(--f-ink); font-size: 1rem; }
.pd-chart { display: grid; grid-template-columns: 28px 1fr; }
.pd-sides { display: grid; grid-template-rows: var(--pd-half) var(--pd-half); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--f-mute); }
.pd-sides span { writing-mode: vertical-rl; transform: rotate(180deg); justify-self: center; }
.pd-sides span:first-child { align-self: end; padding-top: 8px; }
.pd-sides span:last-child { align-self: start; padding-bottom: 8px; }
.pd-plot { position: relative; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(6px, 1.6vw, 14px); padding: 0 clamp(0px, 4vw, 48px); }
.pd-plot::after { content: ""; position: absolute; left: 0; right: 0; top: var(--pd-half); border-top: 1px solid rgba(11, 34, 51, .25); pointer-events: none; }
.pd-col { position: relative; display: grid; grid-template-rows: var(--pd-half) var(--pd-half); max-width: 140px; width: 100%; justify-self: center; border-radius: 8px; outline-offset: 4px; }
.pd-col:focus-visible { outline: 3px solid var(--f-button); }
.pd-up, .pd-down { display: flex; gap: 2px; }
.pd-up { flex-direction: column-reverse; padding-bottom: 1px; }
.pd-down { flex-direction: column; padding-top: 1px; }
.pd-seg { display: block; min-height: 0; transition: filter .15s, box-shadow .15s; cursor: default; }
.pd-up .pd-seg:last-child { border-radius: 4px 4px 0 0; }
.pd-down .pd-seg:last-child { border-radius: 0 0 4px 4px; }
.pd-seg.is-on { box-shadow: inset 0 0 0 2px var(--f-ink); }
.pd-seg[data-l="0"] { background: var(--pd-p3); }
.pd-seg[data-l="1"] { background: var(--pd-p2); }
.pd-seg[data-l="2"] { background: var(--pd-p1); }
.pd-seg[data-l="3"] { background: var(--pd-m1); }
.pd-seg[data-l="4"] { background: var(--pd-m2); }
.pd-seg[data-l="5"] { background: var(--pd-m3); }
.pd-num { position: absolute; left: 50%; top: var(--pd-half); transform: translate(-50%, -50%); z-index: 1;
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--f-ink); color: #fff;
  font-weight: 700; font-size: .9rem; box-shadow: 0 0 0 2px var(--pd-surface); pointer-events: none; }

.pd-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 18px 0 0; padding: 0; list-style: none; font-size: .88rem; color: var(--f-text); }
.pd-legend li { display: flex; align-items: center; gap: 7px; margin: 0; }
.pd-sw { width: 14px; height: 14px; border-radius: 4px; flex: none; }
.pd-sw[data-l="0"] { background: var(--pd-p3); } .pd-sw[data-l="1"] { background: var(--pd-p2); } .pd-sw[data-l="2"] { background: var(--pd-p1); }
.pd-sw[data-l="3"] { background: var(--pd-m1); } .pd-sw[data-l="4"] { background: var(--pd-m2); } .pd-sw[data-l="5"] { background: var(--pd-m3); }

.pd-statements { margin: 20px 0 0; padding: 0; list-style: none; display: grid; gap: 12px; counter-reset: pd; }
.pd-statements li { display: grid; grid-template-columns: 28px 1fr; gap: 12px; align-items: start; margin: 0; }
.pd-statements li::before { counter-increment: pd; content: counter(pd); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--f-ink); color: #fff; font-weight: 700; font-size: .9rem; }
.f-home .pd-statements p { margin: 2px 0 0; color: var(--f-ink); }
.f-home .pd-statements .pd-split { margin: 4px 0 0; font-size: .88rem; color: var(--f-mute); }
.pd-statements .pd-split b { color: var(--f-text); font-weight: 700; }

.pd-table { margin: 18px 0 0; font-size: .9rem; }
.pd-table summary { cursor: pointer; font-weight: 600; color: var(--f-button); }
.pd-table .pd-scroll { overflow-x: auto; margin-top: 10px; }
.pd-table table { border-collapse: collapse; width: 100%; min-width: 520px; }
.pd-table th, .pd-table td { padding: 8px 10px; border-bottom: 1px solid var(--f-line); text-align: right; font-variant-numeric: tabular-nums; }
.pd-table th:first-child, .pd-table td:first-child { text-align: left; }
.pd-table thead th { color: var(--f-ink); font-weight: 700; }
.f-home .pd-empty { margin: 24px 0 0; padding: 20px; border-radius: var(--f-radius-s); background: var(--f-paper); color: var(--f-text); }

/* ---------- inserimento dati -------------------------------------------------- */
.pd-panel { margin: 0 0 clamp(28px, 4vw, 40px); padding: clamp(20px, 3vw, 32px); border-radius: var(--f-radius); background: #fff; box-shadow: var(--f-shadow); }
.f-home .pd-panel h2 { font-size: clamp(1.3rem, 1.15rem + .6vw, 1.65rem) !important; margin: 0 0 14px !important; }
.f-home .pd-panel h3 { margin: 22px 0 10px !important; }
.pd-form { display: grid; gap: 16px; }
.pd-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.pd-btns { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.pd .f-btn { cursor: pointer; }
.pd-btn2 { font: inherit; font-weight: 700; font-size: .95rem; padding: 12px 18px; border-radius: var(--f-radius-s); border: 1px solid rgba(11, 34, 51, .22); background: #fff; color: var(--f-ink); cursor: pointer; }
.pd-btn2:hover, .pd-btn2:focus-visible { border-color: var(--f-ink); }
.pd-btn2--danger { color: #a3302a; border-color: rgba(163, 48, 42, .35); padding: 8px 14px; font-size: .88rem; }
.pd-btn2--danger:hover { background: #a3302a; color: #fff; border-color: #a3302a; }
.f-home .pd-msg { margin: 0; padding: 12px 16px; border-radius: var(--f-radius-s); font-weight: 600; }
.pd-msg--ok { background: #e3f4e6; color: #145c22; }
.pd-msg--err { background: #fbe7e5; color: #8a241f; }

.pd-gamelist { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 0; padding: 0; list-style: none; }
.pd-gamelist li { margin: 0; }
.pd-gamebtn { display: flex; flex-direction: column; gap: 4px; width: 100%; height: 100%; text-align: left; padding: 16px 18px; border-radius: var(--f-radius-s);
  border: 1px solid var(--f-line); background: var(--f-paper); font: inherit; color: var(--f-ink); cursor: pointer; transition: border-color .2s, background .2s; }
.pd-gamebtn strong { font-size: 1.05rem; }
.pd-gamebtn span { font-size: .88rem; color: var(--f-mute); }
.pd-gamebtn:hover, .pd-gamebtn:focus-visible { border-color: var(--f-button); background: var(--f-cyan-soft); }
.pd-gamebtn[aria-current="true"] { border-color: var(--f-button); background: var(--f-cyan-soft); box-shadow: inset 0 0 0 1px var(--f-button); }

.pd-vote { margin: 0; padding: 16px; border: 1px solid var(--f-line); border-radius: var(--f-radius-s); min-width: 0; }
.pd-vote legend { padding: 0 6px; margin-left: -6px; font-weight: 600; color: var(--f-ink); line-height: 1.4; }
.pd-vote legend b { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--f-ink); color: #fff; font-size: .8rem; margin-right: 6px; }
.pd-levels { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.pd-level { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.pd-level label { display: flex; align-items: center; justify-content: center; gap: 5px; font-weight: 700; font-size: .95rem; color: var(--f-ink); }
.pd-level input[type="number"] { text-align: center; padding: 8px 4px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.pd-level input::-webkit-outer-spin-button, .pd-level input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.f-home .pd-total { margin: 8px 0 0; font-size: .88rem; color: var(--f-mute); }
.pd-sessions { width: 100%; border-collapse: collapse; font-size: .93rem; }
.pd-sessions th, .pd-sessions td { padding: 10px 8px; border-bottom: 1px solid var(--f-line); text-align: left; vertical-align: middle; }
.pd-sessions td:last-child { text-align: right; }
.pd-sessions thead th { color: var(--f-ink); }
@media (max-width: 560px) {
  .pd-levels { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pd-chart { grid-template-columns: 20px 1fr; }
  .pd-num { width: 24px; height: 24px; font-size: .8rem; }
}
