/* ============================================================
   Miscela — calcolo olio due tempi
   Tema: quadro strumenti, lettura ambra su grafite
   ============================================================ */

:root {
  --bg:        #14161a;
  --panel:     #1c1f26;
  --panel-2:   #22262f;
  --line:      #2c313b;
  --text:      #e8e6e1;
  --muted:     #8a8f99;
  --amber:     #ffb020;
  --amber-dim: #6b5220;

  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html {
  -webkit-text-size-adjust: 100%; /* iOS non ridimensiona il testo in orizzontale */
  background-color: var(--bg);     /* copre l'area di rimbalzo (overscroll) su iOS */
}

body {
  min-height: 100vh;      /* fallback per browser vecchi */
  min-height: 100dvh;     /* altezza reale con barre del browser mobile */
  display: grid;
  place-items: center;
  padding:
    max(24px, env(safe-area-inset-top))
    max(24px, env(safe-area-inset-right))
    max(24px, env(safe-area-inset-bottom))
    max(24px, env(safe-area-inset-left));
  -webkit-tap-highlight-color: transparent; /* niente lampo grigio al tocco */
  background:
    radial-gradient(120% 90% at 50% -10%, #1b1f27 0%, var(--bg) 60%);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* ---- Contenitore ---- */
.app {
  width: 100%;
  max-width: 420px;
}

/* ---- Intestazione ---- */
.head { text-align: center; margin-bottom: 22px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.title {
  font-size: 44px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1;
  margin: 8px 0 6px;
}

.sub { font-size: 14px; color: var(--muted); }

/* ---- Schede percentuale ---- */
.tabs {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  padding: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  margin-bottom: 16px;
}

.tab {
  padding: 10px 0;
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation; /* niente ritardo di 300ms al tocco */
  transition: color .15s, background .15s;
}

.tab:hover { color: var(--text); }

.tab.is-active {
  color: #14161a;
  background: var(--amber);
}

/* Box miscela personalizzata */
.tab-custom {
  width: 100%;
  min-width: 0;
  text-align: center;
  color: var(--text);
  background: var(--panel-2);
  outline: none;
  transition: color .15s, background .15s, box-shadow .15s;
}

.tab-custom::placeholder { color: #565b65; }

.tab-custom:hover { background: #2a2f39; }

.tab-custom:focus-visible {
  box-shadow: inset 0 0 0 1px var(--amber);
}

.tab-custom.is-active {
  color: #14161a;
  background: var(--amber);
}

.tab-custom.is-active::placeholder { color: rgba(20, 22, 26, .5); }

.tab:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 2px;
}

/* ---- Box centrale ---- */
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
}

.field { display: block; }

.field-label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}

.input-wrap {
  display: flex;
  align-items: center;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 16px;
  transition: border-color .15s;
}

.input-wrap:focus-within { border-color: var(--amber); }

#litri {
  flex: 1;
  padding: 14px 0;
  font-family: var(--mono);
  font-size: 24px;
  font-weight: 600;
  color: var(--text);
  background: transparent;
  border: none;
  outline: none;
}

#litri::placeholder { color: #4a4f58; }

/* nasconde le frecce del number input */
#litri::-webkit-outer-spin-button,
#litri::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
#litri { -moz-appearance: textfield; }

.unit {
  font-family: var(--mono);
  font-size: 16px;
  color: var(--muted);
  padding-left: 8px;
}

/* ---- Lettura risultato ---- */
.readout {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}

.readout-main {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.value {
  font-family: var(--mono);
  font-size: 52px;
  font-weight: 700;
  line-height: 1;
  color: var(--amber);
  text-shadow: 0 0 24px rgba(255, 176, 32, .25);
  letter-spacing: -0.01em;
}

.value-unit {
  font-size: 14px;
  color: var(--muted);
}

.readout-meta {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.chip {
  flex: 1;
  text-align: center;
  padding: 8px 6px;
  font-size: 12px;
  color: var(--muted);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.chip em {
  display: block;
  font-family: var(--mono);
  font-style: normal;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
}

/* ---- Piede ---- */
.foot {
  text-align: center;
  margin-top: 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
}

/* ---- Mobile ---- */
@media (max-width: 380px) {
  .title { font-size: 38px; }
  .value { font-size: 44px; }
  .tab { font-size: 13px; }
}

/* ---- Riduzione movimento ---- */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
