:root {
  --bg: #f4f2ee;
  --card: #ffffff;
  --ink: #17181b;
  --soft: rgba(23, 24, 27, 0.52);
  --line: rgba(23, 24, 27, 0.08);
  --accent: #5b5bf0;
  --over: #f0653a;
  --rowh: 46px;
}

*, *::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;
}

.sc {
  width: min(336px, 100%);
  padding: 13px 14px 8px;
  border-radius: 28px;
  background: var(--card);
  box-shadow:
    0 0 0 1px rgba(23, 24, 27, 0.06),
    0 1px 2px rgba(23, 24, 27, 0.05),
    0 16px 30px -14px rgba(23, 24, 27, 0.16),
    0 44px 70px -36px color-mix(in srgb, var(--accent) 34%, rgba(23, 24, 27, 0.25));
}
.sc__head { display: flex; align-items: center; justify-content: space-between; height: 30px; padding-left: 2px; }
.sc__title { font-size: 15px; font-weight: 680; font-stretch: 108%; letter-spacing: -0.008em; }
.sc__seg { position: relative; display: grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 15px; background: rgba(23, 24, 27, 0.06); }
.sc__tile { position: absolute; left: 3px; top: 3px; bottom: 3px; width: calc(50% - 3px); border-radius: 12px; background: #ffffff; box-shadow: 0 1px 2px rgba(23, 24, 27, 0.16), 0 3px 8px -3px rgba(23, 24, 27, 0.2); }
.sc__seg button { position: relative; height: 24px; padding: 0 12px; border: 0; border-radius: 12px; background: none; color: var(--soft); font: inherit; font-size: 12px; font-weight: 640; cursor: pointer; outline: none; -webkit-tap-highlight-color: transparent; touch-action: manipulation; transition: color 0.25s ease; }
.sc__seg button[aria-checked="true"] { color: var(--ink); }
.sc__seg button:focus-visible { box-shadow: 0 0 0 2px var(--accent); }

.sc__read { margin-top: 4px; padding-left: 2px; }
.sc__num { display: block; height: clamp(40px, 12vh, 48px); font-size: clamp(34px, 10.500vh, 42px); line-height: clamp(40px, 12vh, 48px); font-weight: 400; letter-spacing: -0.03em; font-variation-settings: "wght" var(--w, 640), "wdth" 96; white-space: nowrap; }
.sc__num small { font-size: 0.5em; font-weight: 600; letter-spacing: 0; color: var(--soft); margin: 0 0.24em 0 0.06em; font-variation-settings: normal; }
.sc__note { display: block; height: 17px; overflow: hidden; font-size: 12px; line-height: 17px; font-weight: 560; color: var(--soft); }
.sc__note span { display: block; white-space: nowrap; }

/* the apps: rows of fixed height placed by the script, so they can swap places */
.sc__list { position: relative; height: calc(var(--rowh) * 4); margin-top: clamp(4px, 1.600vh, 8px); }
.app {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 10px;
  height: var(--rowh);
  padding: 0 2px;
  border: 0;
  border-top: 1px solid var(--line);
  background: none;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  outline: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  transition: opacity 0.25s ease;
}
.app__tile { grid-row: 1 / 3; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: #ffffff; font-size: 13px; font-weight: 740; font-stretch: 112%; }
.app__name { align-self: end; display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12.5px; font-weight: 620; white-space: nowrap; }
.app__limit { height: 16px; padding: 0 6px; border-radius: 8px; background: color-mix(in srgb, var(--over) 14%, transparent); color: var(--over); font-size: 10px; line-height: 16px; font-weight: 680; opacity: 0; }
.app__time { align-self: end; font-size: 12.5px; font-weight: 660; white-space: nowrap; }
.app__track { position: relative; grid-column: 2 / 4; align-self: start; height: 6px; margin-top: 4px; border-radius: 3px; background: rgba(23, 24, 27, 0.07); }
.app__fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 3px; background: var(--accent); }
/* the part past the limit: a warmer colour with thin slanted lines */
.app__extra { position: absolute; top: 0; bottom: 0; width: 0; border-radius: 0 3px 3px 0; background-color: var(--over); background-image: repeating-linear-gradient(115deg, rgba(255, 255, 255, 0.5) 0 2px, transparent 2px 6px); }
.app__mark { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); opacity: 0; }
.sc.has-pick .app:not(.is-pick) { opacity: 0.4; }
.app:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 10px; }

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

@media (max-height: 400px) { :root { --rowh: 40px; } }
@media (hover: hover) {
  .sc__seg button:hover { color: var(--ink); }
}
/* larger in a roomy window, so the preview is not a small card in a big page */
@media (min-width: 700px) and (min-height: 500px) { .sc { zoom: 1.4; } .ghost { width: 28px; height: 28px; } }
@media (min-width: 1100px) and (min-height: 760px) { .sc { zoom: 2; } .ghost { width: 34px; height: 34px; } }
