/* Officina Ava — one visual world: sunlit Riviera plaster above, deep navy below,
   gold wherever Ava would wear it. Single theme on purpose; every colour is set here. */
:root {
  --plaster: #F2D6C1;
  --plaster-deep: #E3B89A;
  --shutter: #9DB8B0;
  --navy: #16244A;
  --navy-2: #22335F;
  --cream: #FBF4E8;
  --ink: #1B2340;
  --gold: #D5A843;
  --gold-soft: #F1D78E;
  --sea: #2A5DB0;
  --display: 'Bodoni Moda', 'Didot', 'Bodoni 72', Georgia, serif;
  --text: 'Figtree', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --label: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --r: 14px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--navy);
  color: var(--ink);
  font: 16px/1.45 var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }
.svg-defs { position: absolute; }

.screen {
  position: relative;
  min-height: 100dvh;
  max-width: 520px;
  margin: 0 auto;
  overflow: hidden;
}

/* ---------- 0 · Garage ---------- */
.garage {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px;
  padding: calc(28px + env(safe-area-inset-top)) 22px 34px;
  background:
    radial-gradient(120% 60% at 30% 0%, #F8E3D2 0%, transparent 60%),
    var(--plaster);
}
.garage-sign {
  display: flex; flex-direction: column; align-items: center;
  padding: 10px 26px 12px;
  background: var(--navy);
  border: 2px solid var(--gold);
  border-radius: 6px;
  box-shadow: 0 8px 0 -4px #0003;
  color: var(--gold-soft);
}
.sign-small { font: 600 13px/1 var(--label); letter-spacing: .32em; text-transform: uppercase; }
.sign-big { font: italic 600 44px/1 var(--display); letter-spacing: .01em; }
.sign-tiny { margin-top: 4px; font: 500 10px/1 var(--label); letter-spacing: .28em; text-transform: uppercase; opacity: .75; }
.garage-kerb {
  width: min(100%, 390px); height: 16px; margin-top: -18px;
  border-radius: 3px;
  background: linear-gradient(180deg, #CDB6A2 0 5px, #B89C86 5px);
  box-shadow: 0 10px 18px -8px #6E4B3355;
}

.garage-door-frame {
  position: relative;
  width: min(100%, 360px);
  aspect-ratio: 4 / 3.4;
  border: 10px solid var(--plaster-deep);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  background: #3A2E28;
  overflow: hidden;
}
.garage-inside {
  position: absolute; inset: 0;
  background: radial-gradient(70% 60% at 50% 70%, #FFE9B8 0%, #7A5A3C 70%, #3A2E28 100%);
}
.garage-door {
  position: absolute; inset: 0;
  border: 0; padding: 0;
  background:
    repeating-linear-gradient(180deg, #A9C3BB 0 9px, #8FAAA2 9px 11px, #B7CEC6 11px 18px),
    var(--shutter);
  box-shadow: inset 0 -6px 0 #6E8A83;
  touch-action: none;
  transition: transform .9s cubic-bezier(.2, .8, .2, 1);
}
.garage-door.dragging { transition: none; }
.door-handle {
  position: absolute; left: 50%; bottom: 14px; translate: -50% 0;
  width: 56px; height: 8px; border-radius: 4px;
  background: #59716A; box-shadow: inset 0 2px 0 #0003;
}
.garage-hello {
  margin: 6px 0 0;
  font: italic 500 clamp(44px, 13vw, 64px)/1 var(--display);
  color: var(--ink);
}
.garage-hint {
  margin: 0;
  font: 600 13px var(--label); letter-spacing: .24em; text-transform: uppercase;
  color: #8A5F45;
  animation: nudge 1.8s ease-in-out infinite;
}
@keyframes nudge { 50% { transform: translateY(-5px); } }

/* ---------- 1 · Werkstatt ---------- */
.werkstatt {
  display: flex; flex-direction: column;
  height: 100dvh; min-height: 0;
  background: var(--navy);
}
.topbar {
  display: flex; justify-content: space-between; align-items: baseline;
  padding: calc(12px + env(safe-area-inset-top)) 18px 8px;
  background: var(--plaster);
}
.brand { margin: 0; font: italic 600 22px/1 var(--display); color: var(--ink); }
.brand span { font: 600 12px var(--label); font-style: normal; letter-spacing: .3em; text-transform: uppercase; margin-right: 4px; }
.step { margin: 0; font: 600 12px var(--label); letter-spacing: .24em; text-transform: uppercase; color: #8A5F45; }

.stage {
  position: relative;
  flex: 1 1 auto; min-height: 250px;
  display: flex; flex-direction: column; justify-content: flex-end;
  background: var(--plaster);
  overflow: hidden;
}
.stage-wall {
  position: absolute; inset: 0 0 26% 0;
  background:
    radial-gradient(60% 70% at 50% 100%, #F9E6D6 0%, transparent 70%),
    linear-gradient(180deg, transparent 0 92%, #D9AE90 92% 100%);
}
.stage-wall::before {
  /* the arched doorway behind the scooter */
  content: ''; position: absolute; left: 50%; bottom: 0; translate: -50% 0;
  width: 62%; height: 84%;
  border-radius: 999px 999px 0 0;
  /* a shaded doorway, so hair, skin and pastel paint all read against it */
  background: linear-gradient(180deg, #B97E60, #D9A687 70%, #E4B99B);
  box-shadow: inset 0 0 0 8px #E8C4AA, inset 0 18px 30px -10px #7A4A3355;
}
.stage-floor {
  position: absolute; left: 0; right: 0; bottom: 0; height: 26%;
  background:
    repeating-linear-gradient(90deg, #0000 0 47px, #0000000d 47px 48px),
    linear-gradient(180deg, #D8B79E, #E8CDB7);
}
.vespa-holder {
  position: relative;
  width: min(96%, 440px);
  margin: 0 auto 2%;
}
.vespa-holder > .vespa-svg { display: block; width: 100%; height: auto; overflow: visible; }
.vespa-svg .badge { font: italic 700 17px var(--display); fill: var(--trim); }
.vespa-svg .plate-text { font: 600 11.5px var(--label); letter-spacing: .06em; fill: #111; }
.vespa-svg .paint, .vespa-svg [style*="--body"] { transition: fill .45s ease; }

/* Leo's notes: a small signed card — noticeable, but it never shouts.
   The navy "L" says who is talking; empty notes disappear. */
.note {
  position: absolute; left: 50%; top: 10px; translate: -50% 0;
  width: max-content; max-width: calc(100% - 28px);
  display: flex; align-items: center; gap: 9px;
  margin: 0;
  padding: 6px 14px 6px 6px;
  background: #FFF9F1eb;
  border: 1px solid #D5A8437a;
  border-radius: 18px;
  box-shadow: 0 6px 18px -8px #1B234066;
  font: italic 600 16.5px/1.3 var(--display);
  color: var(--ink);
  text-wrap: balance;
  transition: opacity .22s, transform .22s;
  z-index: 2;
}
.note::before {
  content: 'L';
  flex: none;
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--navy); color: var(--gold-soft);
  font: italic 600 14px/1 var(--display);
}
.note:empty { display: none; }
.note.swap { opacity: 0; transform: translateY(-4px); }

.quick {
  position: absolute; left: 0; right: 0; top: 82px;
  display: flex; justify-content: center; gap: 8px;
}
.qbtn {
  min-width: 58px;
  padding: 7px 10px;
  border: 1.5px solid #1B234033;
  border-radius: 999px;
  background: #FFF8EFcc;
  backdrop-filter: blur(4px);
  font: 600 12px var(--label); letter-spacing: .12em; text-transform: uppercase;
}
.qbtn[aria-pressed="true"] { background: var(--gold-soft); border-color: var(--gold); }

.sheet {
  flex: 0 0 auto;
  display: flex; flex-direction: column; gap: 14px;
  padding: 14px 16px calc(16px + env(safe-area-inset-bottom));
  background: var(--navy);
  color: var(--cream);
  border-radius: 20px 20px 0 0;
  margin-top: -18px;
  position: relative;
}
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  padding: 7px 13px;
  border: 1px solid #FBF4E82e; border-radius: 999px;
  background: transparent;
  font: 600 13px var(--label); letter-spacing: .14em; text-transform: uppercase;
  color: #FBF4E8b3;
}
.tab[aria-selected="true"] { background: var(--cream); color: var(--navy); border-color: var(--cream); }

.panel { min-height: 138px; display: flex; flex-direction: column; gap: 10px; }
.pick-name { margin: 0; font: italic 500 26px/1.1 var(--display); color: var(--gold-soft); }
.pick-head { display: flex; flex-direction: column; gap: 6px; }
.pick-place {
  display: flex; align-items: center; gap: 8px;
  width: fit-content; max-width: 100%;
  margin: 0; padding: 6px 12px 6px 9px;
  background: #FBF4E814; border: 1px solid #F1D78E55; border-radius: 999px;
  font: italic 500 16.5px/1.25 var(--display); color: var(--cream);
  animation: place-in .35s ease;
}
.pick-place svg { flex: none; width: 11px; height: 15px; fill: var(--gold); }
@keyframes place-in { from { opacity: 0; transform: translateY(4px); } }
.swatches { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 6px; scrollbar-width: none; }
.swatches::-webkit-scrollbar { display: none; }
.swatch {
  flex: 0 0 auto;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: 2px solid #FBF4E826;
  box-shadow: inset 0 -6px 10px #0002, inset 0 6px 8px #fff4;
}
.swatch[aria-checked="true"] { border-color: var(--gold); box-shadow: 0 0 0 3px var(--navy), 0 0 0 5px var(--gold), inset 0 -6px 10px #0002, inset 0 6px 8px #fff4; }
.swatch.metal-oro { background: linear-gradient(180deg, #FBEBA8, #E0B64E 45%, #B8862A 70%, #E9C766); }
.swatch.metal-cromo { background: linear-gradient(180deg, #fff, #C9CED4 45%, #8A9199 70%, #E3E7EA); }

.toggles { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.toggle {
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  padding: 10px 12px;
  border: 1px solid #FBF4E82e; border-radius: 12px;
  background: var(--navy-2);
  font: 500 15px var(--text); text-align: left;
}
.toggle::after {
  content: ''; width: 30px; height: 18px; border-radius: 9px; flex: 0 0 auto;
  background: #FBF4E833 radial-gradient(circle at 9px 9px, var(--cream) 6px, transparent 6.5px);
  transition: background .2s;
}
.toggle[aria-checked="true"] { border-color: var(--gold); }
.toggle-radio::after { width: 18px; border-radius: 50%; background: #FBF4E833; }
.toggle-radio[aria-checked="true"]::after { background: var(--gold) radial-gradient(circle at 9px 9px, var(--navy) 4px, transparent 4.5px); }
.toggle[aria-checked="true"]::after { background: var(--gold) radial-gradient(circle at 21px 9px, var(--navy) 6px, transparent 6.5px); }

.toggle-plain {
  padding: 10px 12px;
  border: 1px solid var(--gold); border-radius: 12px;
  background: var(--navy-2); color: var(--cream);
  font: 600 15px var(--text);
}
.toggle-plain:first-child { background: var(--gold); color: var(--navy); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font: 600 12px var(--label); letter-spacing: .2em; text-transform: uppercase; color: #FBF4E8a6; }
.field input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #FBF4E840; border-radius: 12px;
  background: var(--cream); color: var(--ink);
  font: 500 18px var(--text);
}
.field input.plate-input { font: 600 26px var(--label); letter-spacing: .1em; text-transform: uppercase; }
.hint { margin: 0; font-size: 14px; color: #FBF4E8a6; }

.cta {
  padding: 15px 18px;
  border: 0; border-radius: var(--r);
  background: linear-gradient(180deg, #F3D98F, var(--gold));
  color: var(--navy);
  font: italic 700 19px var(--display);
  box-shadow: 0 3px 0 #9C7521;
}
.cta:active { translate: 0 2px; box-shadow: 0 1px 0 #9C7521; }

/* ---------- motion ---------- */
.vespa-svg.shake .rig { animation: idle .11s linear infinite; }
@keyframes idle { 50% { transform: translateY(.8px); } }
.vespa-svg .emmi-head { transform-box: fill-box; transform-origin: 50% 90%; }
.vespa-svg .emmi-head.bark { animation: bark .45s ease; }
.vespa-svg .emmi { cursor: pointer; }
@keyframes bark { 30% { transform: rotate(-8deg) translateY(-3px); } 60% { transform: rotate(4deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
