:root {
  --bg: #000000;
  --bar: #0c0e0d;
  --bar-hi: #161a17;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f3f5f1;
  --mute: rgba(243, 245, 241, 0.42);
  --dim: rgba(243, 245, 241, 0.22);
  --accent: #c8f55a;
  --accent-2: #5ef0b4;
  --track: rgba(255, 255, 255, 0.075);
  --flame: #ffb347;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  overflow: hidden;
}

body {
  font-family: 'Mona Sans Variable', system-ui, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.stage {
  position: relative;
  height: 100vh;
  height: 100dvh;
  display: grid;
  place-items: center;
  overflow: hidden;
}

/* the bar is drawn at its real size and scaled to the window (script.js sets --s) */
.fit {
  position: absolute;
  left: 50%;
  top: 50%;
  width: max-content;
  transform: translate(-50%, -50%) scale(var(--s, 1));
  transform-origin: 50% 50%;
}

.week {
  position: relative;
  height: 64px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 8px;
  border-radius: 22px;
  background:
    radial-gradient(120% 140% at 30% -40%, rgba(200, 245, 90, 0.07), transparent 60%),
    linear-gradient(180deg, var(--bar-hi), var(--bar));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.07) inset,
    0 -1px 0 rgba(0, 0, 0, 0.6) inset,
    0 2px 4px rgba(0, 0, 0, 0.6),
    0 18px 40px -12px rgba(0, 0, 0, 0.9),
    0 30px 80px -30px rgba(200, 245, 90, 0.12);
}

/* a 1px edge that catches the light where the pointer is */
.week__edge {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background:
    radial-gradient(140px 80px at var(--mx, 30%) var(--my, 0%), rgba(220, 255, 150, 0.55), transparent 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.03));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  pointer-events: none;
}

.week__grain {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  opacity: 0.35;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='120' height='120'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .06 0'/></filter><rect width='120' height='120' filter='url(%23n)'/></svg>");
  pointer-events: none;
}

.days {
  position: relative;
  display: flex;
  gap: 4px;
  height: 52px;
}

.day {
  position: relative;
  z-index: 2;
  width: 40px;
  height: 52px;
  padding: 0;
  border: 0;
  border-radius: 15px;
  background: none;
  color: inherit;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  cursor: pointer;
  outline: none;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
}

.day__in {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.day__wd {
  font-size: 9px;
  line-height: 1;
  font-weight: 560;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mute);
  transition: color 0.3s;
}

.day.is-today .day__wd { color: var(--accent); }

.ring {
  position: relative;
  width: 30px;
  height: 30px;
}

.ring svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.ring__track {
  fill: none;
  stroke: var(--track);
  stroke-width: 2.6;
}

.day.is-rest .ring__track {
  stroke: rgba(255, 255, 255, 0.14);
  stroke-dasharray: 1.2 3.2;
  stroke-linecap: round;
}

.ring__arc {
  fill: none;
  stroke-width: 2.6;
  stroke-linecap: round;
  opacity: 0.5;
  transition: opacity 0.35s;
}

.ring__glint {
  fill: none;
  stroke: #ffffff;
  stroke-width: 2.6;
  stroke-linecap: round;
  opacity: 0;
}

.day[aria-selected='true'] .ring__arc { opacity: 1; }

.ring__num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11.5px;
  line-height: 1;
  font-weight: 600;
  font-stretch: 100%;
  font-variant-numeric: tabular-nums;
  color: var(--mute);
  transition: color 0.3s, font-stretch 0.35s, font-weight 0.35s;
}

.day[aria-selected='true'] .ring__num {
  color: var(--text);
  font-weight: 700;
  font-stretch: 112%;
}

.day.is-future .ring__num { color: var(--dim); }

.day:focus-visible .day__in {
  outline: 1.5px solid var(--accent);
  outline-offset: 5px;
  border-radius: 12px;
}

@media (hover: hover) {
  .day:hover .day__wd { color: rgba(243, 245, 241, 0.7); }
  .day.is-today:hover .day__wd { color: var(--accent); }
  .day:hover .ring__arc { opacity: 0.8; }
  .day:hover .ring__track { stroke: rgba(255, 255, 255, 0.12); }
}

/* the capsule under the chosen day */
.cap {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  width: 40px;
  height: 52px;
  pointer-events: none;
}

.cap__body {
  position: absolute;
  inset: 0;
  border-radius: 15px;
  overflow: hidden;
  background: linear-gradient(180deg, #232823 0%, #181b18 55%, #141714 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.13) inset,
    0 0 0 1px rgba(255, 255, 255, 0.06) inset,
    0 -6px 12px -6px rgba(200, 245, 90, 0.14) inset;
}

.cap__shine {
  position: absolute;
  left: 8%;
  right: 8%;
  top: 0;
  height: 40%;
  border-radius: 15px 15px 50% 50%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent);
}

.cap__shadow {
  position: absolute;
  left: 12%;
  right: 12%;
  bottom: -5px;
  height: 8px;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.7), transparent);
  z-index: -1;
}

/* the streak between days in a row */
.bridges {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.bridge {
  position: absolute;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: 0 50%;
  transform: scaleX(0);
  overflow: hidden;
}

.bridge.is-rest {
  background: repeating-linear-gradient(90deg, rgba(200, 245, 90, 0.55) 0 2px, transparent 2px 4px);
}

.bridge__spark {
  position: absolute;
  top: -2px;
  left: 0;
  width: 10px;
  height: 6px;
  border-radius: 50%;
  background: radial-gradient(closest-side, #ffffff, rgba(255, 255, 255, 0));
  opacity: 0;
}

.week__rule {
  width: 1px;
  height: 30px;
  background: linear-gradient(180deg, transparent, var(--line) 20%, var(--line) 80%, transparent);
  flex: none;
}

.streak {
  position: relative;
  flex: none;
  width: 46px;
  display: grid;
  grid-template-columns: auto auto;
  grid-template-rows: auto auto;
  align-items: center;
  justify-content: center;
  column-gap: 3px;
  row-gap: 3px;
}

.streak__flame {
  width: 13px;
  height: 13px;
  overflow: visible;
}

.streak__outer { fill: var(--flame); }
.streak__inner { fill: #fff2c6; }

.streak__num {
  position: relative;
  height: 15px;
  overflow: hidden;
  font-size: 14px;
  line-height: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.streak__col {
  display: flex;
  flex-direction: column;
}

.streak__col span { height: 15px; }

.streak__word {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 8.5px;
  line-height: 1;
  font-weight: 560;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--mute);
}

.hint {
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  margin: 14px 0 0;
  text-align: center;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--mute);
  opacity: 0;
  pointer-events: none;
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.cursor {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 5;
  width: 22px;
  height: 22px;
  pointer-events: none;
  opacity: 0;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.6));
}

.cursor path {
  fill: #ffffff;
  stroke: #000000;
  stroke-width: 1.2;
  stroke-linejoin: round;
}
