:root {
  --paper-white: #F7F8F4;
  --sage: #A8B89A;
  --sage-deep: #60715B;
  --lavender: #D9CDEB;
  --mist-blue: #C8E0EB;
  --black: #1C1C1E;
  --white: #FFFFFF;
  --muted: #6F756D;
  --hairline: rgba(28, 28, 30, .09);
  --shadow: 0 20px 60px rgba(74, 88, 66, .12);
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, system-ui, sans-serif;
}

* { box-sizing: border-box; }

html {
  min-height: 100%;
  background: var(--paper-white);
}

body {
  min-width: 320px;
  min-height: 100svh;
  margin: 0;
  overflow-x: hidden;
  color: var(--black);
  background:
    radial-gradient(circle at 88% 4%, rgba(217, 205, 235, .56), transparent 28%),
    radial-gradient(circle at 4% 42%, rgba(200, 224, 235, .44), transparent 24%),
    var(--paper-white);
}

button,
input { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100%, 560px);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 20px max(22px, env(safe-area-inset-bottom));
}

.app-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 11px;
  align-items: center;
}

.app-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(96, 113, 91, .12);
  border-radius: 14px;
  color: var(--sage-deep);
  background: rgba(255, 255, 255, .58);
  box-shadow: 0 8px 24px rgba(96, 113, 91, .08);
  backdrop-filter: blur(16px);
}

.app-mark svg,
.drop-icon svg {
  width: 18px;
  fill: currentColor;
}

.greeting {
  margin: 0 0 2px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
}

.context-line {
  margin: 2px 0 0;
  color: rgba(96, 113, 91, .82);
  font-size: .64rem;
  font-weight: 650;
}

h1,
h2,
p { margin-top: 0; }

h1 {
  margin-bottom: 0;
  font-size: 1.12rem;
  font-weight: 740;
  letter-spacing: -.025em;
}

.date-stamp {
  max-width: 70px;
  margin: 0;
  color: var(--muted);
  font-size: .65rem;
  font-weight: 620;
  line-height: 1.3;
  text-align: right;
  text-transform: uppercase;
}

.progress-section {
  padding: 36px 0 24px;
  text-align: center;
}

.progress-copy h2 {
  max-width: 340px;
  margin: 0 auto 8px;
  font-size: clamp(2rem, 9vw, 2.75rem);
  font-weight: 720;
  line-height: .98;
  letter-spacing: -.06em;
}

.progress-label {
  margin-bottom: 5px;
  color: var(--muted);
  font-size: .82rem;
  font-weight: 520;
}

.motivation-message {
  min-height: 20px;
  margin-bottom: 7px;
  color: var(--sage-deep);
  font-size: .77rem;
  font-weight: 650;
}

.daily-insight {
  max-width: 330px;
  min-height: 34px;
  margin: 0 auto 19px;
  color: rgba(28, 28, 30, .62);
  font-size: .76rem;
  font-weight: 560;
  line-height: 1.45;
}

.progress-orb {
  position: relative;
  width: 220px;
  height: 220px;
  margin: 0 auto 24px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 50%;
  background: linear-gradient(155deg, #BDCAAf, var(--sage));
  box-shadow:
    0 28px 64px rgba(96, 113, 91, .22),
    inset 14px 18px 35px rgba(255, 255, 255, .34),
    inset -12px -16px 36px rgba(96, 113, 91, .12);
  isolation: isolate;
}

.progress-orb::before {
  position: absolute;
  z-index: 3;
  width: 72px;
  height: 34px;
  top: 25px;
  left: 36px;
  border-radius: 50%;
  content: "";
  background: rgba(255, 255, 255, .26);
  filter: blur(5px);
  transform: rotate(-24deg);
}

.water {
  position: absolute;
  inset: auto 0 0;
  z-index: 1;
  height: 0%;
  overflow: hidden;
  background: linear-gradient(180deg, var(--mist-blue), #AFCFDB);
  transition: height .75s cubic-bezier(.22, .75, .24, 1);
}

.wave {
  position: absolute;
  width: 160%;
  height: 18px;
  top: -8px;
  left: -30%;
  border-radius: 48%;
  background: var(--mist-blue);
  animation: wave-slide 4.5s ease-in-out infinite alternate;
}

.wave-two {
  top: -5px;
  background: rgba(255, 255, 255, .38);
  animation-duration: 6s;
  animation-direction: alternate-reverse;
}

.progress-number {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--black);
}

.count {
  font-size: 4.65rem;
  font-weight: 690;
  line-height: .9;
  letter-spacing: -.08em;
  font-variant-numeric: tabular-nums;
}

.count-unit {
  margin-top: 13px;
  color: rgba(28, 28, 30, .56);
  font-size: .67rem;
  font-weight: 730;
  letter-spacing: .03em;
}

.progress-ring {
  position: absolute;
  inset: 11px;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, .55);
  border-radius: 50%;
}

.drink-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.drink-button,
.reminder-action {
  min-height: 58px;
  border: 0;
  border-radius: 19px;
  color: var(--black);
  background: var(--lavender);
  box-shadow: 0 14px 34px rgba(113, 92, 140, .15);
  font-weight: 720;
  cursor: pointer;
  transition: transform .18s ease, box-shadow .18s ease;
}

.drink-button {
  display: inline-flex;
  width: min(100%, 310px);
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0 22px;
  font-size: .96rem;
}

.drink-button:active,
.reminder-action:active {
  transform: scale(.985);
  box-shadow: 0 7px 20px rgba(113, 92, 140, .12);
}

.drop-icon {
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border-radius: 50%;
  color: var(--sage-deep);
  background: rgba(255, 255, 255, .48);
}

.undo-button {
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  color: var(--muted);
  background: transparent;
  font-size: .75rem;
  cursor: pointer;
}

.undo-button:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.reminder-panel {
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, .82);
  border-radius: 26px;
  background: rgba(255, 255, 255, .68);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px) saturate(1.1);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}

.section-label,
.reminder-label {
  margin: 0 0 4px;
  color: var(--sage-deep);
  font-size: .62rem;
  font-weight: 760;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.panel-heading h2 {
  margin-bottom: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -.025em;
}

.switch {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.switch input,
.intervals input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-track {
  width: 46px;
  height: 28px;
  padding: 3px;
  border-radius: 99px;
  background: #D8DAD5;
  transition: background .2s ease;
}

.switch-track span {
  display: block;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 2px 7px rgba(28, 28, 30, .14);
  transition: transform .2s ease;
}

.switch input:checked + .switch-track { background: var(--sage-deep); }
.switch input:checked + .switch-track span { transform: translateX(18px); }

.switch-label {
  min-width: 34px;
  color: var(--muted);
  font-size: .68rem;
  font-weight: 600;
}

.intervals {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin: 18px 0 12px;
  padding: 0;
  border: 0;
}

.intervals label {
  position: relative;
  cursor: pointer;
}

.intervals span {
  display: flex;
  min-height: 50px;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  padding: 14px 4px;
  border: 1px solid var(--hairline);
  border-radius: 15px;
  color: var(--muted);
  background: rgba(247, 248, 244, .75);
  font-weight: 700;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.intervals small {
  font-size: .56rem;
  font-weight: 650;
}

.intervals input:checked + span {
  border-color: rgba(96, 113, 91, .26);
  color: var(--black);
  background: rgba(168, 184, 154, .46);
}

.next-reminder {
  min-height: 18px;
  margin: 0;
  color: var(--muted);
  font-size: .73rem;
  font-variant-numeric: tabular-nums;
  text-align: center;
}

footer {
  padding-top: 18px;
  color: rgba(111, 117, 109, .78);
  font-size: .66rem;
  text-align: center;
}

.social-panel {
  margin-top: 14px;
  padding: 21px;
  overflow: hidden;
  border-radius: 28px;
  color: var(--black);
  background:
    radial-gradient(circle at 100% 0, rgba(217, 205, 235, .85), transparent 42%),
    linear-gradient(145deg, rgba(168, 184, 154, .78), rgba(200, 224, 235, .72));
  box-shadow: var(--shadow);
}

.social-heading,
.badge-heading,
.race-heading,
.rhythm-heading,
.challenge-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.social-heading h2,
.badge-heading h3,
.race-heading h3,
.rhythm-heading h3 {
  margin: 0;
  letter-spacing: -.035em;
}

.social-heading h2 { font-size: 1.05rem; }

.score-pill {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 99px;
  background: rgba(255, 255, 255, .48);
  font-size: .67rem;
  backdrop-filter: blur(14px);
}

.score-pill strong { font-size: 1rem; }

.challenge-summary {
  justify-content: flex-start;
  margin: 17px 0 19px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, .48);
  border-radius: 18px;
  background: rgba(255, 255, 255, .38);
}

.streak-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, .58);
  font-size: 1.2rem;
}

.challenge-summary strong,
.challenge-summary span { display: block; }
.challenge-summary strong { margin-bottom: 3px; font-size: .84rem; }
.challenge-summary span { color: rgba(28, 28, 30, .6); font-size: .65rem; }

.badge-heading h3 { font-size: .84rem; }
.badge-heading > span,
.race-heading > span,
.rhythm-heading > span { color: rgba(28, 28, 30, .55); font-size: .65rem; }

.race-heading h3,
.rhythm-heading h3 { font-size: .84rem; }

.race-list {
  display: grid;
  gap: 8px;
  margin: 11px 0 10px;
}

.race-row {
  display: grid;
  grid-template-columns: minmax(70px, .75fr) minmax(95px, 1fr) 30px;
  min-height: 39px;
  align-items: center;
  gap: 9px;
}

.race-row.is-ada .race-name {
  color: var(--black);
  font-weight: 780;
}

.race-name {
  min-width: 0;
  color: rgba(28, 28, 30, .67);
  font-size: .73rem;
  font-weight: 680;
  line-height: 1.05;
}

.race-name small {
  display: block;
  margin-top: 3px;
  color: rgba(28, 28, 30, .45);
  font-size: .53rem;
  font-weight: 650;
}

.race-bar {
  height: 9px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(255, 255, 255, .38);
}

.race-bar span {
  display: block;
  width: var(--race-progress);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sage-deep), var(--mist-blue));
}

.race-row strong {
  color: rgba(28, 28, 30, .72);
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.closest-rival {
  margin: 2px 0 17px;
  padding: 10px 12px;
  border-left: 3px solid rgba(96, 113, 91, .52);
  color: rgba(28, 28, 30, .7);
  background: rgba(255, 255, 255, .32);
  font-size: .7rem;
  font-weight: 650;
  line-height: 1.35;
}

.weekly-rhythm {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
  height: 76px;
  margin: 11px 0 17px;
  align-items: end;
}

.rhythm-day {
  position: relative;
  display: flex;
  min-width: 0;
  height: 100%;
  align-items: end;
  justify-content: center;
  overflow: hidden;
  border-radius: 13px;
  background: rgba(255, 255, 255, .3);
}

.rhythm-day small {
  position: relative;
  z-index: 2;
  padding-bottom: 7px;
  color: rgba(28, 28, 30, .55);
  font-size: .49rem;
  font-weight: 760;
}

.rhythm-fill {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  min-height: 6px;
  background: rgba(255, 255, 255, .5);
}

.rhythm-day.is-reached .rhythm-fill { background: rgba(96, 113, 91, .62); }
.rhythm-day.is-today { outline: 1px solid rgba(28, 28, 30, .18); }

.badge-list {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
  margin: 11px 0 17px;
}

.badge {
  display: flex;
  min-width: 0;
  min-height: 96px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 9px 4px;
  border: 1px solid rgba(255, 255, 255, .4);
  border-radius: 17px;
  color: rgba(28, 28, 30, .55);
  background: rgba(247, 248, 244, .35);
  text-align: center;
}

.badge.is-unlocked {
  color: var(--black);
  background: rgba(255, 255, 255, .68);
  box-shadow: 0 8px 22px rgba(96, 113, 91, .1);
}

.badge-icon { margin-bottom: 6px; font-size: 1.18rem; }
.badge strong { font-size: .59rem; line-height: 1.15; }
.badge small { margin-top: 4px; font-size: .49rem; line-height: 1.2; opacity: .7; }

.share-button {
  display: flex;
  width: 100%;
  min-height: 54px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  border: 0;
  border-radius: 18px;
  color: var(--white);
  background: var(--black);
  font-weight: 720;
  cursor: pointer;
}

.share-button span { font-size: 1.1rem; }
.share-button:disabled { opacity: .6; cursor: wait; }

.share-status {
  min-height: 14px;
  margin: 7px 0 -3px;
  font-size: .62rem;
  text-align: center;
}

.celebration {
  position: fixed;
  inset: 0;
  z-index: 20;
  overflow: hidden;
  pointer-events: none;
}

.celebration span {
  position: absolute;
  width: 10px;
  height: 17px;
  top: -25px;
  left: calc(8% + var(--piece, 0) * 9%);
  border-radius: 4px;
  background: var(--lavender);
  opacity: 0;
}

.celebration span:nth-child(2n) { background: var(--mist-blue); }
.celebration span:nth-child(3n) { background: var(--sage); }
.celebration span:nth-child(1) { --piece: 0; }.celebration span:nth-child(2) { --piece: 1; }
.celebration span:nth-child(3) { --piece: 2; }.celebration span:nth-child(4) { --piece: 3; }
.celebration span:nth-child(5) { --piece: 4; }.celebration span:nth-child(6) { --piece: 5; }
.celebration span:nth-child(7) { --piece: 6; }.celebration span:nth-child(8) { --piece: 7; }
.celebration span:nth-child(9) { --piece: 8; }.celebration span:nth-child(10) { --piece: 9; }
.celebration.is-active span { animation: celebrate-fall 1.25s cubic-bezier(.15, .7, .3, 1) forwards; }
.celebration.is-active span:nth-child(2n) { animation-delay: .08s; }
.celebration.is-active span:nth-child(3n) { animation-delay: .16s; }

.reminder-modal[hidden] { display: none; }

.reminder-modal {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(46, 52, 44, .28);
  backdrop-filter: blur(18px);
  animation: fade-in .22s ease-out;
}

.reminder-card {
  position: relative;
  width: min(100%, 390px);
  padding: 36px 26px 25px;
  border: 1px solid rgba(255, 255, 255, .9);
  border-radius: 30px;
  color: var(--black);
  background: rgba(247, 248, 244, .92);
  box-shadow: 0 28px 80px rgba(42, 51, 37, .26);
  text-align: center;
  animation: card-in .38s cubic-bezier(.2, .8, .25, 1.08);
}

.reminder-drop {
  display: grid;
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  place-items: center;
  border-radius: 19px;
  background: var(--mist-blue);
  font-size: 1.5rem;
}

.reminder-card h2 {
  margin-bottom: 9px;
  font-size: 2rem;
  font-weight: 750;
  letter-spacing: -.05em;
}

.reminder-card p:not(.reminder-label) {
  max-width: 290px;
  margin: 0 auto 20px;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.5;
}

.reminder-action {
  width: 100%;
  box-shadow: none;
}

.close-reminder {
  position: absolute;
  top: 13px;
  right: 13px;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 50%;
  color: var(--muted);
  background: rgba(28, 28, 30, .05);
  font-size: 1.45rem;
  cursor: pointer;
}

.toast {
  position: fixed;
  z-index: 12;
  right: 20px;
  bottom: max(20px, env(safe-area-inset-bottom));
  left: 20px;
  max-width: 420px;
  margin: auto;
  padding: 13px 17px;
  border-radius: 15px;
  color: var(--white);
  background: rgba(28, 28, 30, .9);
  box-shadow: 0 16px 40px rgba(28, 28, 30, .2);
  font-size: .79rem;
  font-weight: 560;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px);
  transition: opacity .22s ease, transform .22s ease;
  backdrop-filter: blur(16px);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

:focus-visible {
  outline: 3px solid var(--sage-deep);
  outline-offset: 3px;
}

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

@keyframes wave-slide { to { transform: translateX(15%); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes card-in { from { opacity: 0; transform: translateY(18px) scale(.96); } }
@keyframes celebrate-fall {
  10% { opacity: 1; }
  100% { opacity: 0; transform: translateY(105vh) rotate(540deg); }
}

@media (min-width: 700px) {
  .app-shell { padding-top: 30px; }
  .progress-section { padding-top: 42px; }
}

@media (max-height: 720px) {
  .progress-section { padding-top: 25px; padding-bottom: 17px; }
  .progress-label { margin-bottom: 14px; }
  .motivation-message { margin-bottom: 12px; }
  .progress-orb { width: 192px; height: 192px; margin-bottom: 15px; }
  .count { font-size: 4.1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .celebration { display: none; }
}
