:root {
  --fondo: #ffffff;
  --card: #ffffff;
  --bordo: rgba(10, 10, 20, 0.08);
  --riga: rgba(10, 10, 20, 0.07);
  --testo: #0b0b0f;
  --testo-2: #6b6b76;
  --testo-3: #a1a1aa;
  --accento: #3b5bdb;
  --accento-tenue: rgba(59, 91, 219, 0.1);
  --binario: #efeff2;
  --volto: #f1f1f4;
}

* { box-sizing: border-box; margin: 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;
}

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

/* the slot keeps the top of the card still: the panel grows downwards only */
.slot { width: min(380px, 100%); display: flex; align-items: flex-start; }

.card {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--bordo);
  border-radius: 18px;
  box-shadow: 0 1px 2px rgba(10, 10, 20, 0.04), 0 18px 40px -20px rgba(10, 10, 20, 0.18);
  overflow: hidden;
}

/* the tabs */
.tabs {
  position: relative;
  display: flex;
  gap: 2px;
  padding: 6px 8px 0;
  border-bottom: 1px solid var(--riga);
  touch-action: manipulation;
}

.tab {
  --w: 500;
  position: relative;
  z-index: 1;
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-size: clamp(13px, 3.6vw, 14px);
  font-variation-settings: "wght" var(--w);
  letter-spacing: -0.005em;
  color: var(--testo-2);
  height: clamp(38px, 10vh, 44px);
  padding: 0 12px;
  cursor: pointer;
  transition: color 0.2s;
  -webkit-tap-highlight-color: transparent;
}
.tab span { display: inline-block; }
.tab[aria-selected="true"] { color: var(--testo); }
@media (hover: hover) { .tab:hover { color: var(--testo); } }
.tab:focus { outline: none; }
.tab:focus-visible span { outline: 2px solid var(--accento); outline-offset: 4px; border-radius: 4px; }

.tabs__hover {
  position: absolute;
  left: 0;
  top: 12px;
  height: calc(clamp(38px, 10vh, 44px) - 12px);
  width: 10px;
  border-radius: 8px;
  background: var(--binario);
  opacity: 0;
  pointer-events: none;
}

.tabs__line {
  position: absolute;
  left: 0;
  bottom: -1px;
  height: 2px;
  width: 10px;
  border-radius: 2px;
  background: var(--testo);
  pointer-events: none;
}

/* the panel: its height is driven by script.js */
.panel {
  position: relative;
  overflow: hidden;
}

.pane {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  padding: clamp(14px, 3.6vh, 20px) clamp(16px, 4.6vw, 20px) clamp(16px, 4vh, 22px);
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 2.2vh, 12px);
  visibility: hidden;
}
.pane.is-on { visibility: visible; }

.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13.5px; }
.plan { font-size: clamp(17px, 4.8vw, 19px); font-variation-settings: "wght" 640; letter-spacing: -0.015em; }
.muted { color: var(--testo-2); font-size: 13px; }
.small { font-size: 12px; color: var(--testo-3); }

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--accento-tenue);
  color: var(--accento);
  font-size: 12px;
  font-variation-settings: "wght" 600;
}

.meter { display: flex; flex-direction: column; gap: 7px; }
.meter__track { height: 4px; border-radius: 4px; background: var(--binario); overflow: hidden; }
.meter__fill {
  display: block;
  height: 100%;
  width: 100%;
  border-radius: 4px;
  background: var(--accento);
  transform-origin: 0 50%;
}

.faces { display: flex; padding-left: 6px; }
.face {
  width: clamp(32px, 9vw, 36px);
  height: clamp(32px, 9vw, 36px);
  margin-left: -6px;
  border-radius: 50%;
  background: var(--volto);
  border: 2px solid var(--card);
  display: grid;
  place-items: center;
  font-size: 11.5px;
  font-variation-settings: "wght" 600;
  color: var(--testo-2);
  letter-spacing: 0.01em;
}
.face--more { background: var(--card); box-shadow: inset 0 0 0 1px var(--bordo); color: var(--testo-3); }

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