:root {
  --fondo: #ffffff;
  --barra: #ffffff;
  --inchiostro: #111113;
  --grigio: #6f6f77;
  --grigio-chiaro: #a1a1aa;
  --bordo: rgba(17, 17, 19, 0.09);
  --campo: #f4f4f5;
  --accento: #5b5bd6;
  --faccia-a: #8b8cf0;
  --faccia-b: #c9b8f5;
  /* il menu chiaro */
  --menu: #ffffff;
  --menu-testo: #111113;
  --menu-grigio: #71717a;
  --menu-bordo: rgba(17, 17, 19, 0.09);
  --menu-hl: rgba(17, 17, 19, 0.055);
  --menu-seg: #f1f1f3;
  --menu-pill: #ffffff;
  --menu-key: #ffffff;
  --menu-key-fondo: #e4e4e7;
}

* { 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: 12px 16px;
}

/* the frame holds the bar and the room the open menu needs, so the shot never cuts it */
.frame {
  position: relative;
  width: min(520px, 100%);
  height: 372px;
}

.bar {
  position: relative;
  z-index: 2;
  display: flex; align-items: center; gap: 14px;
  height: 54px;
  padding: 0 10px 0 16px;
  background: var(--barra);
  border: 1px solid var(--bordo);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(17, 17, 19, 0.04), 0 10px 28px -16px rgba(17, 17, 19, 0.18);
}

.bar__brand { display: flex; align-items: center; gap: 8px; }
.bar__mark { width: 20px; height: 20px; fill: none; stroke: var(--inchiostro); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.bar__name { font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.bar__nav { display: flex; gap: 4px; margin-left: 8px; }
.bar__link { font-size: 13px; font-weight: 520; color: var(--grigio); padding: 6px 9px; border-radius: 8px; }
.bar__link.is-on { color: var(--inchiostro); background: var(--campo); }

.avatar {
  margin-left: auto;
  position: relative;
  width: 36px; height: 36px;
  padding: 0; border: 0; border-radius: 50%;
  background: transparent;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.avatar::before {
  content: "";
  position: absolute; inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--accento);
  opacity: 0; transform: scale(0.86);
  transition: opacity 0.25s, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.avatar.is-open::before, .avatar:focus-visible::before { opacity: 1; transform: scale(1); }
.avatar.is-hover .avatar__face { box-shadow: 0 0 0 4px rgba(91, 91, 214, 0.12); }
@media (hover: hover) { .avatar:hover .avatar__face { box-shadow: 0 0 0 4px rgba(91, 91, 214, 0.12); } }
.avatar:focus-visible { outline: none; }

.avatar__face, .menu__face {
  display: grid; place-items: center;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--faccia-a), var(--faccia-b));
  color: #fff;
  font-weight: 650; letter-spacing: 0.02em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}
.avatar__face { width: 100%; height: 100%; font-size: 13px; transition: box-shadow 0.25s; }

/* the menu: it grows out of the avatar's corner */
.menu {
  position: absolute;
  z-index: 3;
  top: 62px; right: 4px;
  width: min(268px, calc(100% - 8px));
  padding: 6px;
  background: var(--menu);
  color: var(--menu-testo);
  border: 1px solid var(--menu-bordo);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(17, 17, 19, 0.05), 0 calc(var(--alza, 1) * 22px) calc(var(--alza, 1) * 48px) calc(var(--alza, 1) * -18px) rgba(17, 17, 19, 0.28);
  transform-origin: calc(100% - 18px) -26px;
  transition: background 0.35s, color 0.35s, border-color 0.35s;
}
.menu[hidden] { display: block; visibility: hidden; }

.menu__head { display: flex; align-items: center; gap: 10px; padding: 8px 8px 10px; border-bottom: 1px solid var(--menu-bordo); margin-bottom: 4px; transition: border-color 0.35s; }
.menu__face { width: 32px; height: 32px; font-size: 12px; flex: none; }
.menu__who { display: grid; gap: 1px; min-width: 0; }
.menu__name { font-size: 13.5px; font-weight: 640; }
.menu__mail { font-size: 12px; color: var(--menu-grigio); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.35s; }

.menu__list { position: relative; display: grid; }

.menu__hl {
  position: absolute; left: 0; right: 0; top: 0;
  height: 36px;
  border-radius: 9px;
  background: var(--menu-hl);
  opacity: 0;
  pointer-events: none;
  transition: background 0.35s;
}

.menu__rule { display: block; height: 1px; margin: 4px 2px; background: var(--menu-bordo); transition: background 0.35s; }

.item {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  width: 100%; height: 36px;
  padding: 0 8px;
  border: 0; border-radius: 9px;
  background: transparent;
  color: inherit;
  font: inherit; font-size: 13.5px; font-weight: 520;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.item:focus-visible { outline: none; }
.item--theme { height: 40px; cursor: default; }
.item__icon { width: 17px; height: 17px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: 0.78; }
.item__icon .fill { fill: currentColor; stroke: none; }
.item__label { flex: 1; white-space: nowrap; }
.item__note { font-size: 11px; font-weight: 600; color: var(--accento); background: rgba(91, 91, 214, 0.1); padding: 2px 7px; border-radius: 6px; }
.item--out { color: var(--menu-grigio); transition: color 0.35s; }

/* the shortcut key, in relief */
.key {
  display: grid; place-items: center;
  min-width: 22px; height: 22px; padding: 0 6px;
  font: inherit; font-size: 11.5px; font-weight: 600;
  color: var(--menu-grigio);
  background: var(--menu-key);
  border: 1px solid var(--menu-bordo);
  border-radius: 6px;
  box-shadow: 0 1.5px 0 var(--menu-key-fondo);
  transition: background 0.35s, border-color 0.35s, box-shadow 0.35s, color 0.35s;
}

/* the segmented switch inside the Theme row */
.seg {
  position: relative;
  display: flex; gap: 2px;
  padding: 2px;
  background: var(--menu-seg);
  border-radius: 9px;
  transition: background 0.35s;
}
.seg__pill {
  position: absolute; top: 2px; left: 2px;
  width: 26px; height: 24px;
  border-radius: 7px;
  background: var(--menu-pill);
  box-shadow: 0 1px 2px rgba(17, 17, 19, 0.14), 0 0 0 0.5px rgba(17, 17, 19, 0.06);
  transition: background 0.35s;
}
.seg__btn {
  position: relative;
  display: grid; place-items: center;
  width: 26px; height: 24px;
  padding: 0; border: 0; border-radius: 7px;
  background: transparent;
  color: var(--menu-grigio);
  cursor: pointer;
  transition: color 0.25s;
  -webkit-tap-highlight-color: transparent;
}
.seg__btn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.seg__btn.is-on { color: var(--menu-testo); }
.seg__btn:focus-visible { outline: 2px solid var(--accento); outline-offset: 1px; }

/* the menu in its dark theme */
.menu.is-dark {
  --menu: #18181b;
  --menu-testo: #fafafa;
  --menu-grigio: #a1a1aa;
  --menu-bordo: rgba(255, 255, 255, 0.09);
  --menu-hl: rgba(255, 255, 255, 0.075);
  --menu-seg: #27272a;
  --menu-pill: #3f3f46;
  --menu-key: #27272a;
  --menu-key-fondo: #0b0b0c;
}

.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: 420px) {
  .bar__nav { display: none; }
  .frame { height: 366px; }
}

@media (min-width: 1100px) and (min-height: 700px) {
  .frame { zoom: 1.2; }
}

.menu.is-dark .item__note { color: #b4b5ff; background: rgba(140, 141, 255, 0.16); }
