/* ==========================================================================
   Esercizi di matematica e fisica (js/esercizi.js)
   Riusa le classi del Quiz (practice-head, filters, q-card, choices,
   answer-field, tools); qui solo livelli, calcolatrice, timer e riepilogo blind.
   ========================================================================== */

/* livelli: quattro pallini */
.ex-levels button { display: inline-flex; align-items: center; gap: 6px; }
.ex-dots { display: inline-flex; gap: 2px; }
.ex-dots i, .ex-lv i { width: 5px; height: 5px; border-radius: 50%; background: var(--fill-3); }
.ex-dots i.on { background: currentColor; }
.ex-lv { align-items: center; gap: 3px; }
.ex-lv i { width: 6px; height: 6px; }
.ex-lv i.on { background: var(--c, var(--ink-2)); }
.ex-lv em { font-style: normal; font-size: 13px; color: var(--ink-3); margin-left: 5px; }
.seg button svg { width: 15px; height: 15px; vertical-align: -2px; margin-right: 5px; }

.ex-round { margin: 8px 2px 0; font-size: 13.5px; color: var(--ink-3); }
.ex-retry { font-size: 13.5px !important; color: var(--ink-3) !important; }
.ex-bigcalc svg { width: 15px; height: 15px; margin-right: 5px; vertical-align: -2px; }
.feedback .sol p { margin: 0 0 6px; }

/* blind: la colonna degli strumenti sparisce */
.ex-layout.blind { grid-template-columns: minmax(0, 760px); justify-content: center; }

/* ---------- calcolatrice nella colonna ---------- */
.ex-calc { padding: 12px; }
.ex-calc-hist {
  list-style: none; margin: 0 0 8px; padding: 0; max-height: 132px; overflow-y: auto;
  font-variant-numeric: tabular-nums; font-size: 13.5px;
}
.ex-calc-hist:empty { display: none; }
.ex-calc-hist li { display: flex; gap: 10px; justify-content: space-between; padding: 5px 8px; border-radius: 8px; cursor: pointer; color: var(--ink-3); }
.ex-calc-hist li:hover { background: var(--fill); }
.ex-calc-hist li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.ex-calc-hist li b { color: var(--ink); font-weight: 600; white-space: nowrap; }
.ex-calc-io { border: 1px solid var(--stroke-2); border-radius: var(--r); background: var(--sheet); padding: 8px 12px 6px; }
.ex-calc-io:focus-within { border-color: var(--ink-3); }
.ex-calc-in {
  width: 100%; border: 0; outline: none; background: transparent; color: var(--ink);
  font: 500 17px/1.4 var(--font); font-variant-numeric: tabular-nums;
}
.ex-calc-in::placeholder { color: var(--ink-3); font-weight: 400; }
.ex-calc-res { display: block; min-height: 22px; text-align: right; font-size: 18px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.ex-calc-res.err { font-size: 13px; font-weight: 500; color: var(--ko); }
.ex-calc-keys { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; margin-top: 10px; }
.ex-calc-keys button {
  height: 38px; border-radius: 9px; border: 1px solid var(--stroke); background: var(--fill);
  color: var(--ink); font: 500 14.5px var(--font); cursor: pointer; padding: 0; min-width: 0;
}
.ex-calc-keys button:hover { background: var(--fill-2); }
.ex-calc-keys button:active { transform: scale(0.96); }
.ex-calc-keys button.eq { background: var(--solid); color: var(--on-solid); border-color: transparent; }
.ex-calc-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.ex-calc-foot .spacer { flex: 1; }
.seg.seg-sm button { padding: 4px 10px; font-size: 13px; }
.ex-calc .small-note { margin: 10px 0 0; }

/* ---------- blind: presentazione ---------- */
.ex-blind-intro h2 { margin: 10px 0 12px; font-size: 24px; }
.ex-blind-badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  background: color-mix(in srgb, #ff9f0a 16%, transparent); color: #ff9f0a; font-size: 12.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
}
.ex-blind-badge svg { width: 14px; height: 14px; }
.ex-rules { margin: 0 0 16px; padding-left: 20px; color: var(--ink-2); font-size: 15.5px; }
.ex-rules li { margin: 4px 0; }
.ex-best { color: var(--ink-3); font-size: 14.5px; }
.ex-best b { color: var(--ink); }
.ex-go { min-width: 140px; height: 46px; font-size: 16px; }

/* ---------- blind: timer ---------- */
.ex-timer { position: relative; height: 30px; margin: -6px 0 16px; border-radius: 999px; background: var(--fill); overflow: hidden; }
.ex-timer-bar {
  position: absolute; inset: 0; transform-origin: left center; background: var(--ok);
  transition: transform 0.1s linear, background-color 0.3s;
}
.ex-timer.low .ex-timer-bar { background: #ff9f0a; }
.ex-timer.out .ex-timer-bar { background: var(--ko); }
.ex-timer-n {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  font-size: 14px; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums;
}
.ex-timer.low .ex-timer-n { animation: exPulse 1s ease-in-out infinite; }
@keyframes exPulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) {
  .ex-timer-bar { transition: none; }
  .ex-timer.low .ex-timer-n { animation: none; }
}
.ex-timer-mid { position: absolute; left: 50%; top: 6px; bottom: 6px; width: 2px; border-radius: 1px; background: color-mix(in srgb, var(--ink) 35%, transparent); }
.ex-timer.half .ex-timer-mid { opacity: 0; }
/* dopo 15 secondi la domanda si sfoca, come i numeri delle Finanze in modalità privacy (css/glass.css) */
.ex-blind-q { transition: filter 0.35s, opacity 0.35s; }
.ex-blind-q.fog { filter: blur(0.32em); opacity: 0.8; -webkit-user-select: none; user-select: none; pointer-events: none; }
.ex-blind-hidden { margin: -4px 0 12px; color: var(--ink-3); font-size: 14px; font-weight: 600; }
.ex-blind-choices { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 640px) { .ex-blind-choices { grid-template-columns: 1fr; } }

/* ---------- blind: riepilogo ---------- */
.ex-summary { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--stroke); }
.ex-sum-head { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.ex-sum-head > div { border: 1px solid var(--stroke); border-radius: var(--r); padding: 10px 14px; }
.ex-sum-head span { display: block; font-size: 12.5px; color: var(--ink-3); }
.ex-sum-head b { font-size: 22px; color: var(--ink); font-variant-numeric: tabular-nums; }
.ex-record { margin: 12px 0 0; font-weight: 700; color: #ff9f0a; }
.ex-sum-list { list-style: none; padding: 0; margin: 14px 0 0; }
.ex-sum-list li { border-bottom: 1px solid var(--stroke); }
.ex-sum-list summary { display: grid; grid-template-columns: 26px minmax(0, 110px) minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 9px 2px; cursor: pointer; list-style: none; font-size: 14.5px; }
.ex-sum-list summary::-webkit-details-marker { display: none; }
.ex-mark { font-weight: 700; text-align: center; }
.ex-sum-list li.ok .ex-mark { color: var(--ok); }
.ex-sum-list li.ko .ex-mark { color: var(--ko); }
.ex-sum-q { color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ex-sum-a { color: var(--ink); overflow: hidden; }
.ex-sum-pts { color: var(--ink-3); font-size: 13px; white-space: nowrap; }
.ex-sum-body { padding: 4px 4px 14px 36px; }
.ex-sum-body .q-text { font-size: 15.5px; }
.ex-sum-body .sol { font-size: 14.5px; color: var(--ink-2); margin-top: 8px; }
@media (max-width: 640px) {
  .ex-sum-list summary { grid-template-columns: 22px minmax(0, 1fr) auto; }
  .ex-sum-q { display: none; }
  .ex-sum-body { padding-left: 4px; }
}

/* pulsanti con icona su una riga; i cinque livelli vanno a capo sul telefono */
.ex-page .seg button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; white-space: nowrap; }
.ex-page .seg button svg { margin-right: 0; }
.ex-page .ex-levels { flex-wrap: wrap; max-width: 100%; }
@media (max-width: 640px) {
  .ex-page .ex-levels { border-radius: 14px; }
  .ex-page .ex-levels button { flex: 1 0 30%; }
}
