:root {
  --fondo: #f2f1ee;          /* the cool paper behind the card */
  --carta: #ffffff;
  --bordo: rgba(20, 22, 28, 0.07);
  --linea: #eeede9;
  --testo: #141518;
  --testo-2: #6c6e74;
  --testo-3: #a6a8ad;
  --pieno: #1c1d21;          /* the liquid of a battery on its own */
  --vuoto: #efeeeb;          /* the empty inside of a battery */
  --accento: #1fa35c;        /* the one accent: green, only while a device is charging */
  --basso: #e4493c;          /* red, only under the low limit */
}

* { 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; text-align: left; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.stage {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: clamp(8px, 3vh, 28px) 14px;
  background: radial-gradient(110% 80% at 50% 0%, #f8f7f5 0%, var(--fondo) 62%);
}

/* ---- the card: the wrapper grows it on large screens (CSS), the card itself is moved by GSAP ---- */
.scala { width: min(392px, 100%); transform-origin: 50% 50%; }
@media (min-width: 900px) and (min-height: 620px) { .scala { transform: scale(1.24); } }
@media (min-width: 1200px) and (min-height: 780px) { .scala { transform: scale(1.36); } }

.card {
  position: relative;
  width: 100%;
  background: var(--carta);
  border-radius: 24px;
  padding: clamp(10px, 3vh, 18px) clamp(12px, 4vw, 18px) clamp(8px, 2.2vh, 14px);
  box-shadow:
    0 0 0 1px var(--bordo),
    0 1px 1px rgba(16, 18, 24, 0.04),
    0 6px 14px -6px rgba(16, 18, 24, 0.08),
    0 26px 50px -24px rgba(16, 18, 24, 0.22);
}
.card::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0) 32%);
  mask: linear-gradient(#000, #000) content-box exclude, linear-gradient(#000, #000);
  padding: 1px;
}

.head { display: flex; align-items: center; justify-content: space-between; padding: 0 2px clamp(4px, 1.4vh, 10px); }
.head__title { font-size: clamp(15px, 4.2vh, 18px); font-weight: 640; font-stretch: 108%; letter-spacing: -0.01em; }
.head__sub { font-size: 12px; color: var(--testo-3); margin-top: 1px; font-variant-numeric: tabular-nums; }
.head__ic svg { width: 22px; height: 22px; fill: none; stroke: var(--testo-3); stroke-width: 1.4; stroke-linecap: round; display: block; }
.head__ic .head__lv { fill: var(--testo-3); stroke: none; }

.list { list-style: none; }
.dev { position: relative; overflow: hidden; }
.dev + .dev::before { content: ""; position: absolute; left: 52px; right: 4px; top: 0; height: 1px; background: var(--linea); }
.dev--hidden { display: none; }

.dev__main {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: clamp(6px, 1.9vh, 11px) 4px;
  border-radius: 14px;
}
.dev__main:focus-visible { outline: 2px solid var(--testo); outline-offset: -2px; }

.dev__ic {
  width: clamp(32px, 9vh, 38px); height: clamp(32px, 9vh, 38px);
  border-radius: 11px;
  display: grid; place-items: center;
  background: linear-gradient(180deg, #f7f7f5, #efeeeb);
  box-shadow: inset 0 0 0 1px rgba(20, 22, 28, 0.05), inset 0 1px 0 #fff;
}
.dev__ic svg { width: 21px; height: 21px; fill: none; stroke: var(--testo); stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.dev__txt { display: flex; flex-direction: column; min-width: 0; }
.dev__name { font-size: clamp(13px, 3.8vh, 15px); font-weight: 560; letter-spacing: -0.005em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dev__sub { font-size: 12px; color: var(--testo-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: color 0.4s; }

.dev__pct { display: inline-flex; align-items: center; gap: 3px; font-size: clamp(13px, 3.8vh, 15px); font-weight: 600; font-stretch: 92%; color: var(--testo); transition: color 0.35s; }
.dev__pct .pct { font-size: 11px; font-weight: 500; color: var(--testo-3); margin-left: 1px; transition: color 0.35s; }
.bolt { width: 9px; height: 12px; overflow: visible; }
.bolt path { fill: none; stroke: var(--accento); stroke-width: 1.5; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; }

/* ---- the battery: a capsule with a nub, a liquid inside ---- */
.batt { display: inline-flex; align-items: center; gap: 2px; }
.batt__in {
  position: relative;
  width: clamp(46px, 14vw, 58px); height: 24px;
  border-radius: 8px;
  padding: 2px;
  background: var(--vuoto);
  box-shadow: inset 0 0 0 1px rgba(20, 22, 28, 0.08), inset 0 1px 2px rgba(20, 22, 28, 0.06);
  overflow: hidden;
}
.batt__fill {
  position: relative;
  display: block;
  height: 100%;
  width: 0;
  border-radius: 6px 3px 3px 6px;
  background: var(--fill, var(--pieno));
  transition: background-color 0.4s;
}
.batt__fill::after { /* the glass highlight on the liquid */
  content: ""; position: absolute; left: 2px; right: 3px; top: 2px; height: 30%; border-radius: 4px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0));
  pointer-events: none;
}
.batt__wave { position: absolute; top: 0; right: -3px; width: 6px; height: 100%; overflow: visible; }
.batt__wave path { fill: var(--fill, var(--pieno)); transition: fill 0.4s; }
.batt__sheen {
  position: absolute; inset: 0; border-radius: inherit; opacity: 0; overflow: hidden;
  background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0.55) 50%, rgba(255, 255, 255, 0) 100%);
  background-size: 50% 100%; background-repeat: no-repeat; background-position: -60% 0;
}
.batt__nub { width: 3px; height: 9px; border-radius: 0 2px 2px 0; background: #d9d8d4; }

.dev.is-charging { --fill: var(--accento); }
.dev.is-charging .dev__sub { color: var(--accento); }
.dev.is-low { --fill: var(--basso); }
.dev.is-low .dev__pct, .dev.is-low .dev__pct .pct, .dev.is-low .dev__sub { color: var(--basso); }

/* ---- the detail that opens on hover ---- */
.dev__more { height: 0; overflow: hidden; }
.dev__more-in { padding: 0 4px clamp(6px, 1.8vh, 11px) 56px; display: flex; flex-direction: column; gap: 2px; }
.dev__more p { font-size: 12.5px; color: var(--testo); font-variant-numeric: tabular-nums; }
.dev__more .muted { color: var(--testo-3); font-size: 11.5px; }

.foot { display: flex; justify-content: center; padding-top: clamp(4px, 1.2vh, 8px); font-size: 11px; color: var(--testo-3); }

@media (hover: hover) {
  .dev__main { transition: background-color 0.25s; }
  .dev__main:hover { background: #f8f8f6; }
}

/* ---- rolling digits ---- */
.roll { display: inline-flex; align-items: flex-start; height: 1.1em; line-height: 1.1em; overflow: hidden; }
.roll .d { display: block; height: 1.1em; overflow: hidden; }
.roll .d__col { display: block; }
.roll .d__col > span { display: block; height: 1.1em; text-align: center; }

@media (max-height: 380px) {
  .foot { display: none; }
}

.no-tr, .no-tr * { transition: none !important; }
