:root {
  --bg: #ffffff;
  --card: #ffffff;
  --ink: #15131f;
  --soft: rgba(21, 19, 31, 0.56);
  --line: rgba(21, 19, 31, 0.09);
  --track: #ecebf3;
  --accent: #6d5efc;
  --warm: #e2562f;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 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;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 10px 16px;
}

.du {
  --tone: var(--accent);
  --k: 0;
  width: min(312px, 100%);
  padding: 14px 15px 15px;
  border-radius: 28px;
  background: var(--card);
  box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(21, 19, 31, 0.05), 0 34px 60px -34px color-mix(in srgb, var(--tone) 46%, transparent);
  text-align: center;
}
.du__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 24px; }
.du__title { font-size: 15px; font-weight: 680; font-stretch: 108%; letter-spacing: -0.008em; }
.du__plan { height: 22px; padding: 0 9px; border-radius: 11px; background: rgba(21, 19, 31, 0.05); font-size: 11.5px; line-height: 22px; font-weight: 620; color: var(--soft); white-space: nowrap; }

/* the ring is one button: a tap flips the reading between used and left */
.du__ring {
  position: relative;
  display: block;
  width: min(172px, 42vh);
  aspect-ratio: 1;
  margin: clamp(2px, 1.400vh, 8px) auto -6px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.du__ring svg { display: block; width: 100%; height: 100%; overflow: visible; fill: none; }
.du__track { stroke: var(--track); stroke-width: 12; stroke-linecap: round; }
/* the two arcs trade places: what is used is lit at first, what is left is lit after the flip */
.du__used { stroke: color-mix(in srgb, var(--tone) calc((1 - var(--k)) * 100%), #d6d3e6); stroke-width: 12; stroke-linecap: round; }
.du__left { stroke: color-mix(in srgb, var(--tone) calc(var(--k) * 100%), transparent); stroke-width: 12; stroke-linecap: round; }
.du__ticks line { stroke: var(--ink); stroke-width: 1.200; stroke-linecap: round; }
.du__mid { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-bottom: 4%; pointer-events: none; }
.du__num { display: flex; align-items: baseline; gap: 3px; font-size: clamp(28px, 8.600vh, 36px); line-height: 1.05; font-weight: 400; letter-spacing: -0.035em; font-variation-settings: "wght" 640, "wdth" 96; font-variant-numeric: tabular-nums; }
.du__num i { font-style: normal; font-size: 0.36em; letter-spacing: 0; font-variation-settings: "wght" 640, "wdth" 100; color: var(--soft); }
.du__of { display: flex; align-items: center; gap: 0.28em; margin-top: 1px; font-size: 11.5px; line-height: 16px; font-weight: 600; color: var(--soft); white-space: nowrap; }
.du__mode { display: block; height: 16px; overflow: hidden; color: var(--tone); font-weight: 700; }
.du__mode span { display: block; }
.du__ring:focus-visible { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 40%, transparent); }

.du__note { font-size: 12px; line-height: 18px; font-weight: 540; color: var(--soft); white-space: nowrap; }
.du__note b { font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }

.du__add {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  height: 42px;
  margin-top: clamp(8px, 2.600vh, 13px);
  border: 0;
  border-radius: 21px;
  background: var(--ink);
  color: #ffffff;
  font: inherit;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: background-color 0.35s ease, color 0.35s ease;
}
.du__add[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 13%, #ffffff); color: color-mix(in srgb, var(--accent) 82%, #15131f); }
.du__add svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.800; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.du__tick { stroke-dasharray: 1; stroke-dashoffset: 1; }
.du__add-text { display: block; height: 20px; overflow: hidden; font-size: 13.5px; line-height: 20px; font-weight: 660; font-stretch: 104%; white-space: nowrap; }
.du__add-text span { display: block; }
.du__add:focus-visible { box-shadow: 0 0 0 2px #ffffff, 0 0 0 4px var(--accent); }

.ghost {
  position: fixed;
  left: 0;
  top: 0;
  width: 22px;
  height: 22px;
  pointer-events: none;
  fill: #15131f;
  stroke: #ffffff;
  stroke-width: 1.4;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(21, 19, 31, 0.3));
  opacity: 0;
  visibility: hidden;
  z-index: 5;
}

@media (hover: hover) {
  .du__add:hover { background: #2a2740; }
  .du__add[aria-pressed="true"]:hover { background: color-mix(in srgb, var(--accent) 19%, #ffffff); }
}
