:root {
  --fondo: #ffffff;
  --carta: #ffffff;
  --campo: #f5f5f3;
  --campo-sopra: #efefec;
  --bordo: rgba(22, 24, 27, 0.09);
  --bordo-forte: rgba(22, 24, 27, 0.2);
  --testo: #16181b;
  --testo-2: #686c72;
  --testo-3: #a4a7ac;
  --inchiostro: #16181b;   /* Shop parts, the chosen year, the open field */
  --spento: #e9e9e6;       /* Shop parts while locked */
  --accento: #1f8a5b;      /* the "fits" tick and the parts count */
  --accento-velo: rgba(31, 138, 91, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--fondo);
  color: var(--testo);
  font-family: "Mona Sans Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.stage {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(8px, 2.4vh, 24px) 12px;
}

/* ---- the card ---- */
.card {
  position: relative;
  width: min(392px, 100%);
  background: var(--carta);
  border-radius: 22px;
  padding: clamp(13px, 3.2vh, 22px) clamp(14px, 4.4vw, 22px) clamp(10px, 2.4vh, 16px);
  box-shadow:
    0 0 0 1px var(--bordo),
    0 1px 2px rgba(22, 24, 27, 0.04),
    0 14px 30px -12px rgba(22, 24, 27, 0.16),
    0 36px 64px -34px rgba(22, 24, 27, 0.2);
}

.top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: clamp(8px, 2vh, 14px); }
.brand { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 640; letter-spacing: -0.01em; font-stretch: 108%; }
.brand svg { width: 17px; height: 17px; fill: none; stroke: var(--testo); stroke-width: 1.6; stroke-linecap: round; }
.top__note { font-size: 11px; color: var(--testo-3); white-space: nowrap; }

.title { font-size: clamp(16px, 4.6vh, 20px); line-height: 1.15; font-weight: 640; letter-spacing: -0.02em; font-stretch: 104%; }
.sub { margin-top: 3px; font-size: clamp(11.5px, 3.1vh, 13px); color: var(--testo-2); }

/* ---- the three fields ---- */
.fields { display: grid; gap: clamp(5px, 1.4vh, 8px); margin-top: clamp(10px, 2.6vh, 16px); }
.field { position: relative; }
.field.is-open { z-index: 5; }
.field__btn {
  position: relative;
  width: 100%;
  height: clamp(38px, 10.4vh, 50px);
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  align-content: center;
  column-gap: 8px;
  text-align: left;
  padding: 0 12px 0 13px;
  background: var(--campo);
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px var(--bordo);
  overflow: hidden;
  transition: box-shadow 0.25s ease, background-color 0.25s ease;
}
.field__btn:disabled { cursor: not-allowed; }
.field__label { grid-column: 1; font-size: clamp(9.5px, 2.5vh, 10.5px); line-height: 1.1; font-weight: 560; letter-spacing: 0.02em; color: var(--testo-3); }
.field__value { grid-column: 1; position: relative; display: block; height: 1.3em; font-size: clamp(13px, 3.4vh, 14.5px); line-height: 1.3; font-weight: 560; overflow: hidden; white-space: nowrap; }
.field__value > span { display: inline-block; }
.field__ph { color: var(--testo-2); font-weight: 460; }
.field__chev { grid-column: 2; grid-row: 1 / span 2; width: 16px; height: 16px; fill: none; stroke: var(--testo-2); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1); }
.field.is-open .field__chev { transform: rotate(180deg); }
.field.is-open .field__btn { background: var(--carta); box-shadow: inset 0 0 0 1.5px var(--inchiostro), 0 0 0 4px rgba(22, 24, 27, 0.05); }
.field.is-done .field__btn { background: var(--carta); box-shadow: inset 0 0 0 1px var(--bordo-forte); }
.field.is-locked .field__btn > *:not(.field__sheen) { opacity: 0.42; }
.field__sheen {
  position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.95) 50%, transparent 70%);
  opacity: 0; pointer-events: none;
}
.field__btn:focus-visible { outline: 2px solid var(--inchiostro); outline-offset: 2px; }
@media (hover: hover) {
  .field:not(.is-locked):not(.is-open) .field__btn:hover { background: var(--campo-sopra); }
  .field.is-done:not(.is-open) .field__btn:hover { background: #fafaf9; }
}

/* ---- the menus: GSAP opens them, so the CSS keeps no transform on .menu ---- */
.menu {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 5px);
  padding: 4px;
  background: var(--carta);
  border-radius: 13px;
  box-shadow:
    0 0 0 1px var(--bordo),
    0 10px 24px -8px rgba(22, 24, 27, 0.2),
    0 26px 44px -26px rgba(22, 24, 27, 0.26);
  visibility: hidden;
  opacity: 0;
  transform-origin: 50% 0;
}
.menu--grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; }
.opt {
  position: relative;
  width: 100%;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  height: clamp(27px, 7.4vh, 34px);
  padding: 0 10px;
  border-radius: 9px;
  font-size: clamp(12.5px, 3.3vh, 14px);
  font-weight: 520;
  text-align: left;
}
.opt__meta { font-size: 11.5px; font-weight: 440; color: var(--testo-3); }
.menu--grid .opt { justify-content: center; padding: 0; font-variant-numeric: normal; }
.opt.is-active { background: var(--campo); }
.opt[aria-selected="true"] { background: var(--inchiostro); color: #fff; }
.opt[aria-selected="true"] .opt__meta { color: rgba(255, 255, 255, 0.6); }
@media (hover: hover) { .opt:hover { background: var(--campo); } .opt[aria-selected="true"]:hover { background: var(--inchiostro); } }

/* the chosen word flying from the menu into the field */
.flyer { position: fixed; left: 0; top: 0; z-index: 20; pointer-events: none; white-space: nowrap; font-weight: 560; color: var(--testo); }

/* ---- Shop parts: the site's elastic pill, locked until the three fields are set ---- */
.shop {
  position: relative;
  width: 100%;
  height: clamp(38px, 10vh, 48px);
  margin-top: clamp(9px, 2.4vh, 14px);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: clamp(13px, 3.4vh, 14.5px);
  font-weight: 600;
  color: var(--testo-3);
  isolation: isolate;
}
.shop:disabled { cursor: not-allowed; }
.shop__bg { position: absolute; inset: 0; z-index: -1; border-radius: 999px; background: var(--spento); overflow: hidden; }
.shop__light { position: absolute; top: 0; bottom: 0; left: 0; width: 40%; background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.34), transparent); opacity: 0; }
.shop__label { font-stretch: 100%; transition: font-stretch 0.5s cubic-bezier(0.34, 1.56, 0.64, 1), letter-spacing 0.5s ease; }
.shop__arrow { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: 0; margin-left: -10px; }
.shop:focus-visible { outline: 2px solid var(--inchiostro); outline-offset: 3px; border-radius: 999px; }
@media (hover: hover) { .shop.is-on:hover .shop__label { font-stretch: 118%; } }

/* ---- the "fits" line: born under the button, its height grows on a spring ---- */
.fit { height: 0; overflow: hidden; }
.fit__in {
  display: flex; align-items: center; gap: 10px;
  margin-top: clamp(8px, 2vh, 12px);
  padding: clamp(7px, 1.8vh, 10px) 10px clamp(7px, 1.8vh, 10px) 10px;
  border-radius: 12px;
  background: var(--accento-velo);
}
.fit__tick { flex: none; width: 26px; height: 26px; fill: none; stroke: var(--accento); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fit__tick circle { stroke-dasharray: 1; stroke-dashoffset: 1; }
.fit__tick path { stroke-width: 2.1; stroke-dasharray: 1; stroke-dashoffset: 1; }
.fit__text { flex: 1; min-width: 0; }
.fit__line { font-size: clamp(12.5px, 3.3vh, 13.5px); line-height: 1.25; color: var(--testo); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fit__line b { font-weight: 640; }
.fit__count { margin-top: 1px; font-size: 11.5px; line-height: 1.25; color: var(--testo-2); display: flex; align-items: baseline; gap: 4px; }
.odo { display: inline-flex; color: var(--accento); font-weight: 640; height: 1.25em; overflow: hidden; }
.odo__col { display: block; height: 1.25em; overflow: hidden; }
.odo__strip { display: flex; flex-direction: column; }
.odo__strip span, .odo__sep { display: block; height: 1.25em; line-height: 1.25em; }
.change {
  flex: none;
  font-size: 12px; font-weight: 600;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--testo);
  box-shadow: inset 0 0 0 1px var(--bordo-forte);
  background: var(--carta);
  transition: box-shadow 0.2s ease;
}
.change:focus-visible { outline: 2px solid var(--inchiostro); outline-offset: 2px; }
@media (hover: hover) { .change:hover { box-shadow: inset 0 0 0 1px var(--inchiostro); } }

/* ---- My garage ---- */
.garage {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  margin-top: clamp(10px, 2.4vh, 14px);
  padding-top: clamp(8px, 2vh, 12px);
  border-top: 1px solid var(--bordo);
  min-height: calc(26px + clamp(8px, 2vh, 12px));
}
.garage__label { flex: none; display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--testo-2); }
.garage__label svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; }
.garage__empty { position: absolute; left: 92px; font-size: 11.5px; color: var(--testo-3); }
.garage__pills { flex: 1; min-width: 0; display: flex; justify-content: flex-end; gap: 5px; }
.gpill {
  flex: none;
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 10px 0 8px;
  border-radius: 999px;
  font-size: 11.5px; font-weight: 560; white-space: nowrap;
  background: var(--campo);
  box-shadow: inset 0 0 0 1px var(--bordo);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.gpill svg { width: 13px; height: 13px; fill: none; stroke: var(--accento); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.gpill.is-current { background: var(--carta); box-shadow: inset 0 0 0 1px var(--accento); }
.gpill:focus-visible { outline: 2px solid var(--inchiostro); outline-offset: 2px; }
@media (hover: hover) { .gpill:hover { box-shadow: inset 0 0 0 1px var(--bordo-forte); } .gpill.is-current:hover { box-shadow: inset 0 0 0 1px var(--accento); } }

@media (max-width: 360px) { .top__note { display: none; } }
