:root {
  --fondo: #f3f1ec;
  --carta: #ffffff;
  --pavimento: #faf9f6;
  --corridoio: #efece5;
  --inchiostro: #18181b;
  --tenue: #8b8780;
  --linea: #e2ded5;
  --muro: #c9c4b9;
  --accento: #3552d4;
  --accento-chiaro: #e6eafb;
  --libera: #2f8a5b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--fondo);
  color: var(--inchiostro);
  font-family: 'Mona Sans Variable', 'Mona Sans', system-ui, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

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

/* ---- the card ---- */
.map {
  width: min(600px, 94vw, calc((100vh - 170px) / 0.66));
  min-width: 260px;
  background: var(--carta);
  border-radius: 22px;
  padding: clamp(10px, 2.4vw, 18px);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset, 0 0 0 1px rgba(24, 24, 27, 0.05),
    0 22px 48px -26px rgba(24, 24, 27, 0.28), 0 6px 14px -8px rgba(24, 24, 27, 0.12);
}

.map__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: clamp(8px, 1.6vh, 12px);
}
.brand { display: flex; align-items: center; gap: 7px; min-width: 0; }
.brand__mark { width: 18px; height: 18px; flex: none; fill: none; stroke: var(--accento); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.brand__name { font-size: clamp(12px, 1.9vw, 14px); font-weight: 650; white-space: nowrap; }
.brand__sub { font-size: clamp(10px, 1.6vw, 12px); color: var(--tenue); white-space: nowrap; }

/* ---- Now / Next ---- */
.seg {
  position: relative;
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--corridoio);
  flex: none;
}
.seg__thumb {
  position: absolute;
  top: 3px; bottom: 3px; left: 3px;
  width: 0;
  border-radius: 999px;
  background: var(--carta);
  box-shadow: 0 1px 2px rgba(24, 24, 27, 0.12), 0 0 0 0.5px rgba(24, 24, 27, 0.06);
}
.seg__btn {
  position: relative;
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-size: clamp(10.5px, 1.7vw, 12.5px);
  font-weight: 560;
  color: var(--tenue);
  padding: 5px clamp(8px, 1.6vw, 12px);
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.25s ease;
}
.seg__btn.is-on { color: var(--inchiostro); }
.seg__time { font-weight: 450; opacity: 0.6; margin-left: 3px; }
.seg__btn:focus-visible { outline: 2px solid var(--accento); outline-offset: 1px; }

/* ---- the plan ---- */
.plan { position: relative; }
.plan__svg { display: block; width: 100%; height: auto; overflow: visible; }
.floor { fill: var(--pavimento); stroke: var(--muro); stroke-width: 1.4; }
.grid { fill: none; stroke: rgba(24, 24, 27, 0.035); stroke-width: 0.6; }
.corridor { fill: var(--corridoio); }

.room { cursor: pointer; }
.room__shape {
  fill: var(--carta);
  stroke: var(--muro);
  stroke-width: 1.2;
  transition: stroke 0.3s ease;
}
.room__heat { fill: var(--accento); pointer-events: none; }
.room__door { stroke: var(--pavimento); stroke-width: 3.2; stroke-linecap: round; pointer-events: none; }
.room__name {
  font-size: 9.6px;
  font-weight: 600;
  fill: var(--inchiostro);
  pointer-events: none;
  letter-spacing: 0.01em;
}
.room__state { font-size: 7.6px; font-weight: 500; fill: var(--tenue); pointer-events: none; }
.room__state.is-free { fill: var(--libera); }
.room.is-on .room__shape { stroke: var(--accento); }

.route {
  fill: none;
  stroke: var(--accento);
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.route-end__ring { fill: var(--carta); stroke: var(--accento); stroke-width: 2; }
.walk { pointer-events: none; }
.walk__bg { fill: var(--inchiostro); }
.walk__txt { font-size: 8.4px; font-weight: 600; fill: #fff; }

.here__halo { fill: var(--accento); opacity: 0.14; }
.here__dot { fill: var(--accento); stroke: #fff; stroke-width: 1.6; }
.here__txt { font-size: 8.2px; font-weight: 600; fill: var(--accento); }

/* ---- the info row ---- */
.info {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(8px, 1.6vw, 12px);
  margin-top: clamp(8px, 1.6vh, 12px);
  padding: clamp(8px, 1.4vh, 11px) clamp(9px, 1.6vw, 12px);
  border-radius: 14px;
  background: var(--pavimento);
  box-shadow: 0 0 0 1px var(--linea) inset;
  min-height: 52px;
}
.info__avatar {
  width: clamp(28px, 4.4vw, 34px);
  height: clamp(28px, 4.4vw, 34px);
  border-radius: 50%;
  background: var(--accento-chiaro);
  color: var(--accento);
  display: grid;
  place-items: center;
  font-size: clamp(9.5px, 1.5vw, 11px);
  font-weight: 650;
}
.info__avatar.is-free { background: #e4f2ea; color: var(--libera); }
.info__avatar svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.info__text { min-width: 0; }
.line { position: relative; overflow: hidden; padding: 1px 0; }
.line > span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info__title { font-size: clamp(12px, 1.9vw, 14.5px); font-weight: 620; }
.info__meta { font-size: clamp(10px, 1.55vw, 12px); color: var(--tenue); margin-top: 1px; }

.seats { display: flex; flex-direction: column; align-items: flex-end; gap: 5px; min-width: 64px; }
.seats__num { font-size: clamp(10px, 1.55vw, 12px); font-weight: 560; color: var(--inchiostro); text-align: right; }
.seats__bar { position: relative; width: clamp(56px, 9vw, 78px); height: 4px; border-radius: 4px; background: var(--linea); overflow: hidden; }
.seats__fill { position: absolute; inset: 0; transform-origin: left center; background: var(--accento); border-radius: 4px; }

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

@media (max-width: 420px) {
  .brand__sub { display: none; }
}
