/* Edison, versione web. Colori di ui/Tema.kt dell'app Android (Material 3, viola #4527A0) con i
   colori di stato leggibili in chiaro e in scuro. Font di sistema: nessun file esterno (CSP). */

:root {
  color-scheme: light dark;
  --sfondo: #fffbfe;
  --superficie: #f7f2fa;
  --bordo-scheda: transparent;
  --ombra: 0 1px 3px rgba(0, 0, 0, .14), 0 1px 2px rgba(0, 0, 0, .10);
  --testo: #1c1b1f;
  --sec: #49454f;
  --contorno: #79747e;
  --divisore: #cac4d0;
  --traccia: #e7e0ec;
  --primario: #4527a0;
  --su-primario: #ffffff;
  --verde: #2e7d32;
  --rosso: #c62828;
  --ambra: #8f5600;        /* #b26a00 dell'APK qui fa 3,8:1 sulla scheda: troppo poco (WCAG AA 4,5:1) */
  --avviso: #322f35;
  --su-avviso: #f5eff7;
  --avviso-bottone: #d0bcff;
  --raggio: 12px;
  --gutter: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sfondo: #141218;
    --superficie: #1d1b20;
    --bordo-scheda: #2b2930;
    --ombra: none;
    --testo: #e6e1e5;
    --sec: #cac4d0;
    --contorno: #938f99;
    --divisore: #49454f;
    --traccia: #36343b;
    --primario: #b39ddb;
    --su-primario: #21005d;
    --verde: #81c784;
    --rosso: #ef9a9a;
    --ambra: #ffcc80;
    --avviso: #e6e0e9;
    --su-avviso: #322f35;
    --avviso-bottone: #4527a0;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--sfondo);
  color: var(--testo);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  overflow-wrap: anywhere;
}

[hidden] { display: none !important; }

.contenitore {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}

.solo-lettori {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------- testata e casella */

.testata {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--sfondo);
  padding-top: max(12px, env(safe-area-inset-top));
  padding-bottom: 8px;
  border-bottom: 1px solid transparent;
}

.testata.staccata { border-bottom-color: var(--divisore); }

.riga-titolo {
  display: flex;
  align-items: center;
  gap: 8px;
}

h1 {
  flex: 1;
  margin: 0;
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 700;
}

.etichetta {
  display: block;
  margin: 2px 0 10px;
  color: var(--sec);
  font-size: .9375rem;
}

.casella {
  position: relative;
  display: flex;
  align-items: center;
}

.lente {
  position: absolute;
  left: 12px;
  color: var(--sec);
  pointer-events: none;
}

input[type="search"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 12px 48px 12px 44px;
  /* almeno 16px: sotto, Safari su iPhone ingrandisce la pagina quando si tocca la casella */
  font: inherit;
  font-size: max(17px, 1rem);
  color: var(--testo);
  background: transparent;
  border: 1px solid var(--contorno);
  border-radius: 6px;
  outline: none;
  text-overflow: ellipsis;
}

input[type="search"]::placeholder { color: var(--sec); opacity: .8; }

input[type="search"]:focus {
  border-color: var(--primario);
  box-shadow: inset 0 0 0 1px var(--primario);
}

/* la "x" del browser no: c'e' il pulsante Cancella, uguale su tutti i telefoni */
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration { -webkit-appearance: none; appearance: none; }

.casella .bottone-icona {
  position: absolute;
  right: 2px;
}

.bottone-icona {
  display: inline-grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--sec);
  cursor: pointer;
  flex: none;
}

.bottone-icona:hover { background: color-mix(in srgb, var(--testo) 8%, transparent); }

.bottone-icona:focus-visible,
.bottone:focus-visible {
  outline: 2px solid var(--primario);
  outline-offset: 2px;
}

.bottone {
  min-height: 40px;
  padding: 8px 16px;
  border: 0;
  border-radius: 20px;
  background: var(--primario);
  color: var(--su-primario);
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  flex: none;
}

/* ---------------------------------------------------------------- messaggi */

main {
  flex: 1;
  padding-top: 6px;
  padding-bottom: 24px;
}

.messaggio {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin: 0;
  padding: 16px 0;
  color: var(--sec);
}

.messaggio.errore { color: var(--rosso); }

.rotella {
  width: 22px;
  height: 22px;
  border: 3px solid var(--traccia);
  border-top-color: var(--primario);
  border-radius: 50%;
  animation: gira .8s linear infinite;
  flex: none;
}

@keyframes gira { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .rotella { animation-duration: 2.4s; }
}

/* ---------------------------------------------------------------- schede delle carte */

.risultati {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.scheda {
  padding: 14px;
  background: var(--superficie);
  border: 1px solid var(--bordo-scheda);
  border-radius: var(--raggio);
  box-shadow: var(--ombra);
}

.scheda > p { margin: 0; }

.scheda .nome {
  margin: 0;
  font-size: 1.375rem;
  line-height: 1.27;
  font-weight: 700;
}

.scheda .nome-en { color: var(--sec); font-size: .9375rem; }

.scheda .spazio { margin-top: 8px; }

.scheda .forte { font-weight: 600; }

.scheda .grassetto { font-weight: 700; }

.scheda .verde { color: var(--verde); }

.scheda .rosso { color: var(--rosso); }

.scheda .ambra { color: var(--ambra); }

.scheda .sec { color: var(--sec); }

.scheda .piccolo { font-size: .9375rem; }

.scheda .data {
  margin-top: 8px;
  font-size: .75rem;
  color: var(--sec);       /* --contorno in chiaro fa 4,1:1: sotto il 4,5:1 del testo piccolo */
}

/* tabella dei tipi di mazzo: due righe per tipo, come nell'app Android */

.tipi {
  margin-top: 10px;
}

.tipi-intestazione {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--divisore);
  font-size: .75rem;
  color: var(--sec);
}

.tipi ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tipo {
  padding: 4px 0;
}

.tipo-riga {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: .9375rem;
}

.tipo-nome { flex: 1; font-weight: 500; }

.tipo-liste { font-variant-numeric: tabular-nums; white-space: nowrap; }

.tipo-barra-riga {
  display: flex;
  align-items: center;
  margin-top: 3px;
  font-size: .8125rem;
  font-variant-numeric: tabular-nums;
}

.barra {
  flex: 1;
  height: 8px;
  border-radius: 4px;
  background: var(--traccia);
  overflow: hidden;
}

.barra-piena {
  height: 100%;
  width: 0;
  border-radius: 4px;
  background: var(--primario);
}

.tipo-pct { min-width: 3.5em; text-align: right; }

.tipo-torneo { min-width: 7.5em; text-align: right; color: var(--sec); white-space: nowrap; }

.altri-tipi {
  margin-top: 6px;
  padding: 6px 0;
  border: 0;
  background: none;
  color: var(--primario);
  font: inherit;
  font-size: .9375rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 40px;
}

.altri-tipi:focus-visible { outline: 2px solid var(--primario); outline-offset: 2px; border-radius: 4px; }

/* ---------------------------------------------------------------- piede */

.piede {
  padding-top: 8px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  font-size: .75rem;
  color: var(--sec);
}

.piede p { margin: 0 0 4px; }

/* spazio per gli avvisi in basso, quando ci sono */
body.con-avviso .piede { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

/* ---------------------------------------------------------------- avvisi in basso */

.fondo-fisso {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 0 max(var(--gutter), env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(var(--gutter), env(safe-area-inset-left));
  pointer-events: none;
}

.avviso {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 560px;
  padding: 8px 8px 8px 16px;
  border-radius: 8px;
  background: var(--avviso);
  color: var(--su-avviso);
  box-shadow: 0 3px 10px rgba(0, 0, 0, .28);
  font-size: .9375rem;
}

.avviso-testo { flex: 1; }

.avviso .bottone {
  background: transparent;
  color: var(--avviso-bottone);
  padding: 8px 10px;
}

.avviso .bottone-icona { color: var(--su-avviso); width: 40px; height: 40px; }

.avviso.breve { justify-content: center; padding: 12px 16px; width: auto; }
