:root {
  --fondo: #ffffff;
  --card: #ffffff;
  --inchiostro: #111113;
  --grigio: #6f6f77;
  --grigio-chiaro: #b4b4bc;
  --bordo: rgba(17, 17, 19, 0.1);
  --campo: #f6f6f7;
  --accento: #5b47e0;
  --errore: #e5484d;
  --spunta: #1f9d55;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; }

body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: "Mona Sans Variable", "Mona Sans", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.card {
  position: relative;
  width: min(380px, 100%);
  background: var(--card);
  border: 1px solid var(--bordo);
  border-radius: 22px;
  padding: clamp(16px, 4.2vh, 24px) clamp(16px, 5vw, 24px) clamp(16px, 4vh, 22px);
  box-shadow: 0 1px 2px rgba(17, 17, 19, 0.04), 0 24px 48px -28px rgba(17, 17, 19, 0.28);
}

.card__head { display: flex; align-items: center; gap: 8px; }
.card__mark {
  width: 22px; height: 22px; padding: 4px;
  border-radius: 7px; background: var(--inchiostro);
  fill: none; stroke: #fff; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.card__brand { font-size: 13px; font-weight: 650; letter-spacing: -0.01em; }
.card__brand span { color: var(--grigio); font-weight: 500; }

.card__title {
  margin-top: clamp(12px, 3.2vh, 20px);
  font-size: clamp(19px, min(6vw, 5.2vh), 23px);
  font-weight: 700;
  font-stretch: 92%;
  letter-spacing: -0.025em;
  line-height: 1.1;
}
.card__sub { margin-top: 6px; font-size: 13px; line-height: 1.4; color: var(--grigio); }

.card__label {
  display: block;
  margin-top: clamp(12px, 3.4vh, 20px);
  font-size: 12px; font-weight: 600; color: var(--inchiostro);
}

/* the field: one rounded box, three segments, a highlight pill that slides between them */
.field {
  position: relative;
  margin-top: 7px;
  height: 50px;
  display: flex; align-items: center;
  padding: 0 46px 0 10px;
  border-radius: 13px;
  background: var(--campo);
  border: 1px solid var(--bordo);
  cursor: text;
  -webkit-tap-highlight-color: transparent;
  transition: border-color 0.25s, background 0.25s, box-shadow 0.25s;
}
.field.is-focus { background: #fff; border-color: color-mix(in srgb, var(--accento) 55%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accento) 12%, transparent); }
.field.is-error { border-color: color-mix(in srgb, var(--errore) 70%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--errore) 12%, transparent); }
.field.is-done { border-color: color-mix(in srgb, var(--spunta) 55%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--spunta) 10%, transparent); }

.field__input {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  opacity: 0;
  font-size: 16px;
  border: 0; background: transparent;
  caret-color: transparent;
  cursor: text;
}

.field__pill {
  position: absolute; left: 0; top: 9px;
  height: 30px; width: 40px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--accento) 11%, transparent);
  opacity: 0;
  pointer-events: none;
}
.field.is-error .field__pill { background: color-mix(in srgb, var(--errore) 11%, transparent); }

.field__segs {
  position: relative;
  display: flex; align-items: center;
  font-size: 19px; font-weight: 560;
  letter-spacing: 0.01em;
  pointer-events: none;
}
.seg { display: inline-flex; padding: 0 6px; }
.sep { color: var(--grigio-chiaro); font-weight: 400; padding: 0 1px; }
.slot {
  display: inline-block;
  width: 0.66em;
  text-align: center;
  color: var(--grigio-chiaro);
  font-weight: 450;
}
.slot.is-full { color: var(--inchiostro); font-weight: 600; }
.seg.is-bad .slot.is-full { color: var(--errore); }

.field__caret {
  position: absolute; left: 0; top: 15px;
  width: 1.6px; height: 20px;
  border-radius: 1px;
  background: var(--accento);
  opacity: 0;
  pointer-events: none;
}

.field__icon {
  position: absolute; right: 14px; top: 50%;
  width: 20px; height: 20px; margin-top: -10px;
  fill: none; stroke: var(--grigio); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round;
  pointer-events: none;
}
.field__icon--ok { stroke: var(--spunta); stroke-width: 2; opacity: 0; }

/* the line under the field: the date spelled out, or the error, and the age on the right */
.hint {
  position: relative;
  height: 22px;
  margin-top: 8px;
  font-size: 12.5px;
}
.hint__line {
  position: absolute; left: 2px; top: 0;
  display: flex; align-items: center; gap: 0;
  line-height: 22px;
  white-space: nowrap;
}
.hint__line--date { color: var(--grigio); }
.hint__line--date.is-place { color: var(--grigio-chiaro); }
.hint__line--date span { white-space: pre; }
.mask { display: inline-flex; overflow: hidden; vertical-align: top; }
.mask > span { display: inline-block; }
.hint__line--err { color: var(--errore); gap: 5px; opacity: 0; font-weight: 550; }
.hint__line--err svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.hint__age {
  position: absolute; right: 2px; top: 0;
  line-height: 22px;
  padding: 0 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--spunta) 10%, transparent);
  color: var(--spunta);
  font-weight: 600;
  opacity: 0;
}
.roll { display: inline-block; min-width: 1.15em; text-align: right; }

/* the button */
.go {
  position: relative;
  margin-top: clamp(12px, 3vh, 18px);
  width: 100%; height: 46px;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 13px;
  background: #ececee;
  color: #a1a1aa;
  font: inherit; font-size: 14.5px; font-weight: 620;
  overflow: hidden;
  cursor: not-allowed;
  -webkit-tap-highlight-color: transparent;
}
.go__fill {
  position: absolute; inset: 0;
  background: var(--inchiostro);
  transform-origin: 0 50%;
  transform: scaleX(0);
}
.go__label, .go__arrow { position: relative; }
.go__arrow { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.go.is-on { cursor: pointer; color: #fff; }
.go.is-on .go__fill { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14); }
.go.is-hover .go__fill { background: #2a2a2e; }
@media (hover: hover) { .go.is-on:hover .go__fill { background: #2a2a2e; } }

.ghost {
  position: absolute; left: 0; top: 0;
  width: 22px; height: 22px;
  fill: var(--inchiostro); stroke: #fff; stroke-width: 1.4; stroke-linejoin: round;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.18));
  pointer-events: none;
  opacity: 0;
  z-index: 5;
}

@media (max-width: 360px) {
  .field__segs { font-size: 17px; }
  .card__sub { font-size: 12.5px; }
}
@media (max-height: 360px) {
  .card__sub { display: none; }
}
