:root {
  --bg: #ffffff;
  --accent: #2f6bff; /* the colour of the switch, the arcs and the flooded tile */
  --ink: #14161b;
  --muted: #7a808c;
  --line: rgba(20, 22, 27, 0.08);
  --tile: #f0f2f5;
  --arc-off: #c4c9d2;
  --track-off: #e5e7ec;
  --card: #ffffff;
}

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

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

/* ---- the settings row ---- */
.row {
  position: relative;
  width: min(372px, calc(100vw - 32px));
  height: 74px;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 16px 0 15px;
  background: var(--card);
  border-radius: 20px;
  box-shadow:
    0 0 0 1px var(--line),
    0 1px 1px rgba(20, 22, 27, 0.04),
    0 4px 10px -4px rgba(20, 22, 27, 0.08),
    0 18px 36px -18px rgba(20, 22, 27, 0.18);
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  isolation: isolate;
}
/* a 1px highlight on the top edge, like light caught by the card */
.row::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0) 40%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  pointer-events: none;
}
.row__light {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: radial-gradient(160px 90px at var(--px, 50%) var(--py, 50%), rgba(47, 107, 255, 0.07), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  z-index: -1;
}
.row.is-hot .row__light { opacity: 1; }

/* ---- the icon tile ---- */
.tile {
  position: relative;
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--tile);
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(20, 22, 27, 0.05);
  transition: box-shadow 0.5s ease;
}
.tile.is-on { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 6px 14px -6px rgba(47, 107, 255, 0.55); }
.tile__flood {
  position: absolute;
  left: 50%;
  top: 69%;
  width: 92px;
  height: 92px;
  margin: -46px 0 0 -46px;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, #4f84ff 0%, var(--accent) 55%, #2556e0 100%);
  transform: scale(0);
}
.wifi {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  overflow: visible;
}
.wifi path { fill: none; stroke-width: 2.1; stroke-linecap: round; }
.wifi__base path { stroke: var(--arc-off); transition: stroke 0.4s ease; }
.wifi__lit path { stroke: var(--accent); visibility: hidden; }
.wifi__dot { fill: var(--arc-off); }

/* ---- the words ---- */
.text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.text__title {
  font-size: 16px;
  font-weight: 600;
  font-stretch: 104%;
  letter-spacing: -0.01em;
  line-height: 20px;
}
.sub {
  display: flex;
  align-items: center;
  height: 18px;
  font-size: 13px;
  line-height: 18px;
  color: var(--muted);
  font-weight: 450;
  min-width: 0;
}
.meter {
  flex: none;
  width: 0;
  height: 12px;
  overflow: hidden;
  display: block;
}
.meter svg { width: 16px; height: 12px; display: block; }
.meter path { fill: none; stroke: var(--accent); stroke-width: 1.6; stroke-linecap: round; opacity: 0.22; }
.sub__clip { display: block; overflow: hidden; height: 18px; min-width: 0; }
.sub__word { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub__word b { color: var(--ink); font-weight: 560; }

/* ---- the switch ---- */
.switch {
  position: relative;
  flex: none;
  width: 52px;
  height: 32px;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 99px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.switch:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.switch__track {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: var(--track-off);
  box-shadow: inset 0 1px 2px rgba(20, 22, 27, 0.08);
}
.switch__knob {
  position: absolute;
  left: 2px;
  top: 2px;
  width: 28px;
  height: 28px;
  border-radius: 99px;
  background: #ffffff;
  box-shadow:
    0 0 0 0.5px rgba(20, 22, 27, 0.06),
    0 2px 4px rgba(20, 22, 27, 0.12),
    0 6px 12px -4px rgba(20, 22, 27, 0.16);
}
.switch__shine {
  position: absolute;
  inset: 1px 3px auto;
  height: 45%;
  border-radius: 99px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.9), rgba(255, 255, 255, 0));
  opacity: 0.7;
}

@media (hover: hover) {
  .row:hover .switch__track { filter: brightness(0.97); }
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  fill: #14161b;
  stroke: #ffffff;
  stroke-width: 1.3;
  stroke-linejoin: round;
  opacity: 0;
  visibility: hidden;
  filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.2));
  z-index: 10;
}
