:root {
  --bg: #0d0e11;
  --card: #17181d;
  --ink: #f4f4f6;
  --soft: rgba(244, 244, 246, 0.6);
  --line: rgba(244, 244, 246, 0.1);
  --accent: #3ddc97;
  --near: #f2b441;
  --warn: #ff6b5e;
  --tone: var(--accent);
}

*, *::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: 8px 12px;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; outline: none; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.sp { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 13px; width: min(348px, 100%); padding: 16px 16px 13px; border-radius: 26px; background: linear-gradient(180deg, #1c1d23, var(--card) 46%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.09), inset 0 0 0 1px var(--line), 0 34px 50px -30px rgba(0, 0, 0, 0.9); }
.sp.is-near { --tone: var(--near); }
.sp.is-over { --tone: var(--warn); }
.sp__head { display: flex; align-items: center; gap: 10px; }
.sp__card { flex: none; display: block; width: 34px; height: 24px; overflow: visible; }
.sp__card rect { fill: rgba(244, 244, 246, 0.06); stroke: var(--ink); stroke-width: 1.500; }
.sp__card path { fill: none; stroke: var(--ink); stroke-width: 1.500; stroke-linecap: round; }
.sp__card .sp__chipline { stroke: var(--tone); stroke-width: 2.500; transition: stroke 0.4s ease; }
.sp__what { display: grid; gap: 1px; min-width: 0; flex: 1; }
.sp__what strong { font-size: 15px; line-height: 19px; font-weight: 700; }
.sp__what span { font-size: 12px; line-height: 16px; font-weight: 580; color: var(--soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp__clip { display: block; height: 16px; line-height: 16px; overflow: hidden; white-space: nowrap; }
.sp__clip span { display: block; overflow: hidden; text-overflow: ellipsis; }
.sp__pill { flex: none; height: 28px; min-width: 96px; padding: 6px 12px; border-radius: 14px; background: color-mix(in srgb, var(--tone) 16%, transparent); color: var(--tone); font-size: 12px; font-weight: 700; text-align: center; transition: background-color 0.4s ease, color 0.4s ease; }

.sp__read { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.sp__big { display: flex; align-items: baseline; gap: 7px; height: 46px; }
.sp__big b { font-size: 44px; line-height: 46px; font-weight: 660; font-stretch: 84%; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; transition: color 0.4s ease; }
.sp.is-neg .sp__big b { color: var(--warn); }
.sp__clip--word { height: 22px; line-height: 22px; font-size: 16px; font-weight: 660; color: var(--soft); }
.sp__clip--sub { font-size: 12.500px; font-weight: 580; color: var(--soft); }

/* the meter: the tinted stretch is the limit, the solid one is what is spent, the handle is the limit itself */
.sp__meter { position: relative; padding-top: 30px; }
.sp__tag { position: absolute; left: 0; top: 0; height: 22px; padding: 0 8px; border-radius: 8px; background: var(--ink); color: #101114; font-size: 12px; line-height: 22px; font-weight: 740; white-space: nowrap; font-variant-numeric: tabular-nums; pointer-events: none; }
.sp__tag b { font-weight: inherit; }
.sp__bar { position: relative; height: 14px; border-radius: 7px; background: rgba(244, 244, 246, 0.08); overflow: hidden; }
.sp__room, .sp__spent { position: absolute; inset: 0; transform-origin: 0 50%; transform: scaleX(0); }
.sp__room { background: color-mix(in srgb, var(--tone) 22%, transparent); transition: background-color 0.4s ease; }
.sp__spent { background: var(--accent); border-radius: 0 7px 7px 0; }
.sp__over { position: absolute; top: 0; bottom: 0; left: 0; width: 0; background: var(--warn); border-radius: 0 7px 7px 0; }
.sp__handle { position: absolute; left: 0; top: 22px; display: grid; place-items: center; width: 32px; height: 30px; margin-left: -16px; cursor: grab; touch-action: none; outline: none; }
.sp__handle i { display: block; width: 6px; height: 26px; border-radius: 3px; background: var(--ink); box-shadow: 0 0 0 3px var(--card), 0 6px 10px -2px rgba(0, 0, 0, 0.8); transition: height 0.25s ease, width 0.25s ease; }
.sp__handle.is-held { cursor: grabbing; }
.sp__handle.is-held i { width: 8px; height: 30px; }
.sp__handle:focus-visible i { box-shadow: 0 0 0 3px var(--card), 0 0 0 5px var(--ink); }
.sp__scale { display: flex; justify-content: space-between; margin-top: 9px; font-size: 11px; line-height: 14px; font-weight: 600; color: rgba(244, 244, 246, 0.42); }

.sp__presets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.sp__preset { height: 36px; border-radius: 12px; background: rgba(244, 244, 246, 0.06); font-size: 13px; font-weight: 700; text-align: center; box-shadow: inset 0 0 0 1.500px transparent; transition: background-color 0.3s ease, box-shadow 0.3s ease, color 0.3s ease; }
.sp__preset[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 14%, transparent); box-shadow: inset 0 0 0 1.500px var(--accent); color: var(--accent); }
.sp__preset:focus-visible { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--ink); }
.sp__foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 12px; font-weight: 600; color: var(--soft); }
.sp__foot .sp__clip { min-width: 0; }
.sp__days { flex: none; }

.ghost { position: absolute; left: 0; top: 0; width: 24px; height: 24px; margin: -3px 0 0 -5px; transform-origin: 20% 15%; pointer-events: none; opacity: 0; fill: #ffffff; stroke: #101114; stroke-width: 1.300; stroke-linejoin: round; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6)); z-index: 6; }

@media (hover: hover) { .sp__preset:hover { background: rgba(244, 244, 246, 0.1); } .sp__preset[aria-pressed="true"]:hover { background: color-mix(in srgb, var(--accent) 20%, transparent); } }
@media (max-width: 350px) { .sp { padding: 14px 12px 11px; } .sp__big b { font-size: 38px; } .sp__pill { min-width: 88px; padding: 6px 9px; } }
@media (max-height: 400px) { .sp { gap: 10px; } .sp__preset { height: 34px; } }
@media (prefers-reduced-motion: reduce) { .sp__pill, .sp__big b, .sp__room, .sp__preset, .sp__handle i, .sp__card .sp__chipline { transition: none; } }
