@font-face {
  font-family: "Fredoka";
  src: url("fonts/fredoka.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

/* Colors are replaced every day by app.js from the day's palette. */
:root {
  --bg1: #FFE3EC; --bg2: #FFF6F0; --card: #FFFFFF; --ink: #6B3A4A;
  --accent: #FF7FA6; --soft: #FFD3E1; --water: #8FD3FF;
  --shadow: 0 6px 0 rgba(0, 0, 0, .04), 0 10px 30px rgba(0, 0, 0, .06);
  --r: 26px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "Fredoka", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
  color: var(--ink);
  background: linear-gradient(170deg, var(--bg1) 0%, var(--bg2) 70%) fixed;
  background-color: var(--bg1);
  overflow-x: hidden;
  -webkit-user-select: none; user-select: none;
  transition: background .6s;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
[hidden] { display: none !important; }

/* Floating background things */
.scene { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.scene span {
  position: absolute; top: -10vh; font-size: 22px; opacity: .55;
  animation: drift linear infinite;
}
@keyframes drift {
  0% { transform: translate(0, -10vh) rotate(0deg); }
  50% { transform: translate(30px, 55vh) rotate(160deg); }
  100% { transform: translate(-20px, 120vh) rotate(320deg); }
}

#app {
  position: relative; z-index: 1;
  max-width: 480px; margin: 0 auto;
  padding: calc(var(--safe-t) + 14px) 16px calc(var(--safe-b) + 96px);
}

.top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 6px 4px 6px; }
.hello { margin: 0; font-size: 26px; font-weight: 650; letter-spacing: -.2px; }
.today { margin: 2px 0 0; font-size: 14px; opacity: .7; }
.streak {
  flex: none; background: var(--card); border-radius: 999px; padding: 7px 12px;
  font-weight: 600; font-size: 15px; box-shadow: var(--shadow);
}

/* Buddy stage */
.stage { position: relative; display: flex; flex-direction: column; align-items: center; padding-top: 70px; }
.bubble {
  position: absolute; top: 4px; left: 50%; transform: translateX(-50%);
  max-width: 88%; width: max-content;
  background: var(--card); padding: 10px 16px; border-radius: 20px;
  font-size: 16px; font-weight: 500; text-align: center; line-height: 1.3;
  box-shadow: var(--shadow); animation: pop .35s ease-out;
}
.bubble::after {
  content: ""; position: absolute; bottom: -9px; left: 50%; margin-left: -9px;
  border: 9px solid transparent; border-top-color: var(--card); border-bottom: 0;
}
@keyframes pop { from { transform: translateX(-50%) scale(.6); opacity: 0; } to { transform: translateX(-50%) scale(1); opacity: 1; } }

.buddy-btn { width: 230px; height: 230px; display: block; touch-action: manipulation; }
.buddy { width: 100%; height: 100%; overflow: visible; }
.buddy .bod { transform-box: view-box; transform-origin: 100px 190px; animation: bob 2.6s ease-in-out infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0) scale(1, 1); } 50% { transform: translateY(-5px) scale(1.01, .99); } }
.buddy .eye { transform-box: fill-box; transform-origin: center; animation: blink 4.2s infinite; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
.buddy .eyes-happy { display: none; }
.buddy.happy .eyes-open { display: none; }
.buddy.happy .eyes-happy { display: inline; }
.buddy .flap-l, .buddy .wave-l { transform-box: fill-box; transform-origin: 90% 30%; animation: flapL 2.6s ease-in-out infinite; }
.buddy .flap-r, .buddy .wave-r { transform-box: fill-box; transform-origin: 10% 30%; animation: flapR 2.6s ease-in-out infinite; }
@keyframes flapL { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(6deg); } }
@keyframes flapR { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-6deg); } }
.buddy .tail { transform-box: fill-box; transform-origin: 0% 50%; animation: wag 1.8s ease-in-out infinite; }
@keyframes wag { 0%, 100% { transform: rotate(0); } 50% { transform: rotate(-8deg); } }
.buddy .spout { animation: spout 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: 50% 100%; }
@keyframes spout { 0%, 100% { transform: scaleY(.8); } 50% { transform: scaleY(1.1); } }

.buddy.jump .bod { animation: jump .9s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes jump {
  0% { transform: translateY(0) scale(1.1, .88); }
  35% { transform: translateY(-38px) scale(.94, 1.08); }
  70% { transform: translateY(0) scale(1.08, .92); }
  100% { transform: translateY(0) scale(1, 1); }
}
.buddy.jump .flap-l { animation: flapFastL .18s 5 alternate; }
.buddy.jump .flap-r { animation: flapFastR .18s 5 alternate; }
@keyframes flapFastL { to { transform: rotate(32deg); } }
@keyframes flapFastR { to { transform: rotate(-32deg); } }
.buddy.wiggle .bod { animation: wiggle .6s ease-in-out; }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-7deg); } 75% { transform: rotate(7deg); } }
.buddy.dance .bod { animation: dance .8s ease-in-out infinite; }
@keyframes dance { 0%, 100% { transform: rotate(-8deg) translateY(0); } 50% { transform: rotate(8deg) translateY(-14px); } }

.nameplate { margin-top: -4px; text-align: center; }
.nameplate strong { display: block; font-size: 22px; font-weight: 650; }
.nameplate span { font-size: 14px; opacity: .65; }

.burst { position: fixed; pointer-events: none; z-index: 30; font-size: 26px; animation: burst 1.1s ease-out forwards; }
@keyframes burst {
  0% { transform: translate(0, 0) scale(.4); opacity: 1; }
  100% { transform: translate(var(--dx), var(--dy)) scale(1.2) rotate(var(--rot)); opacity: 0; }
}

/* Cards */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin-top: 16px; }
.water { display: flex; align-items: center; gap: 14px; }
.glass-wrap { position: relative; width: 112px; flex: none; }
.glass { width: 112px; height: 140px; display: block; }
#waterLevel { transition: transform 1s cubic-bezier(.3, 1.3, .5, 1); }
.wave1 { fill: var(--water); animation: waveMove 3s linear infinite; }
.wave2 { fill: var(--water); opacity: .45; animation: waveMove 4.5s linear infinite reverse; }
@keyframes waveMove { from { transform: translateX(0); } to { transform: translateX(120px); } }
.fizz circle { fill: #fff; opacity: .7; animation: fizz 3s ease-in infinite; }
@keyframes fizz { from { transform: translateY(0); opacity: .8; } to { transform: translateY(-90px); opacity: 0; } }
.count { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding-top: 10px; pointer-events: none; }
.count b { font-size: 38px; font-weight: 700; line-height: 1; text-shadow: 0 2px 0 rgba(255, 255, 255, .8); }
.count span { font-size: 13px; font-weight: 600; opacity: .7; text-shadow: 0 1px 0 #fff; }

.water-side { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.cups { display: flex; flex-wrap: wrap; gap: 5px; }
.cups i { width: 17px; height: 22px; border-radius: 4px 4px 7px 7px; background: var(--soft); position: relative; overflow: hidden; transition: background .3s; }
.cups i.full { background: var(--water); animation: cupPop .4s cubic-bezier(.3, 1.8, .5, 1); }
.cups i.full::after { content: ""; position: absolute; left: 4px; top: 4px; width: 4px; height: 10px; border-radius: 2px; background: #fff; opacity: .7; }
@keyframes cupPop { from { transform: scale(.5); } to { transform: scale(1); } }

.sip {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%;
  background: var(--accent); color: #fff; font-size: 18px; font-weight: 600;
  padding: 15px 14px; border-radius: 20px;
  box-shadow: 0 5px 0 rgba(0, 0, 0, .12); transition: transform .1s, box-shadow .1s;
}
.sip:active { transform: translateY(4px); box-shadow: 0 1px 0 rgba(0, 0, 0, .12); }
.sip .drop { font-size: 20px; }
.undo { font-size: 13px; opacity: .55; align-self: center; padding: 2px 8px; }

.next { display: block; width: 100%; text-align: center; font-size: 15px; font-weight: 500; padding: 14px; }

/* Friends */
.label { margin: 0 0 10px; font-weight: 600; font-size: 15px; }
.week-row { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; text-align: center; }
.week-row .d { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 12px; }
.week-row .bar { width: 22px; height: 54px; border-radius: 11px; background: var(--soft); position: relative; overflow: hidden; }
.week-row .bar i { position: absolute; left: 0; right: 0; bottom: 0; background: var(--water); border-radius: 11px; }
.week-row .e { font-size: 16px; height: 18px; }
.week-row .d.now { font-weight: 700; }
.hint { font-size: 14px; opacity: .7; text-align: center; margin: 18px 10px 10px; }
.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.friend { background: var(--card); border-radius: 22px; padding: 8px 6px 10px; text-align: center; box-shadow: var(--shadow); position: relative; }
.friend .pic { width: 86px; height: 86px; margin: 0 auto; display: block; }
.friend .pic .bod, .friend .pic .eye, .friend .pic [class^="flap"], .friend .pic [class^="wave"], .friend .pic .tail { animation: none; }
.friend b { display: block; font-size: 14px; font-weight: 600; }
.friend small { display: block; font-size: 11px; opacity: .6; }
.friend.locked .pic { filter: brightness(0) opacity(.12); }
.friend.today { outline: 3px solid var(--accent); }
.friend .tag { position: absolute; top: -7px; right: 6px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 99px; }

/* Settings */
.set .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px dashed var(--soft); min-height: 52px; }
.set .label + .row, .set .label + div > .row:first-child { border-top: 0; }
.set .field { padding: 10px 0; border-top: 1px dashed var(--soft); }
.set .field > span { display: block; margin-bottom: 8px; }
.set select, .set input:not(.switch) {
  background: var(--soft); border: 0; border-radius: 14px; padding: 9px 12px; font-size: 16px; font-weight: 500;
  -webkit-appearance: none; appearance: none; text-align: center; max-width: 55%;
  -webkit-user-select: text; user-select: text;
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips button { background: var(--soft); border-radius: 99px; padding: 8px 13px; font-weight: 500; font-size: 15px; transition: transform .1s; }
.chips button.on { background: var(--accent); color: #fff; }
.chips button:active { transform: scale(.94); }
.chips.days { gap: 6px; } .chips.days button { width: 38px; height: 38px; padding: 0; }
.switch {
  -webkit-appearance: none; appearance: none; width: 52px; height: 32px; border-radius: 99px; background: var(--soft);
  position: relative; flex: none; transition: background .2s; margin: 0;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .15); transition: transform .2s;
}
.switch:checked { background: var(--accent); }
.switch:checked::after { transform: translateX(20px); }
.stepper { display: flex; gap: 8px; }
.stepper button { width: 40px; height: 40px; border-radius: 50%; background: var(--soft); font-size: 22px; font-weight: 600; }
.ghost { width: 100%; margin-top: 8px; padding: 12px; border-radius: 16px; background: var(--soft); font-weight: 500; }
.push-note { background: var(--soft); border-radius: 18px; padding: 12px 14px; font-size: 15px; line-height: 1.45; margin-bottom: 8px; }
.push-note b { font-weight: 600; }
.push-note .sip { margin-top: 10px; font-size: 16px; padding: 12px; }
.dim { opacity: .45; pointer-events: none; }
.foot { text-align: center; opacity: .55; font-size: 14px; margin: 22px 0 0; }

/* Tabs */
.tabs {
  position: fixed; z-index: 20; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--safe-b) + 10px); width: min(360px, calc(100% - 32px));
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--card); border-radius: 26px; padding: 6px; box-shadow: 0 8px 30px rgba(0, 0, 0, .12);
}
.tabs button { display: flex; flex-direction: column; align-items: center; gap: 1px; font-size: 12px; font-weight: 500; padding: 6px 0; border-radius: 20px; opacity: .6; transition: background .2s, opacity .2s; }
.tabs button span { font-size: 21px; }
.tabs button.on { background: var(--soft); opacity: 1; }

/* Party */
.overlay { position: fixed; inset: 0; z-index: 40; background: rgba(255, 255, 255, .55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; padding: 16px; }
.party-card { background: var(--card); border-radius: 32px; padding: 20px 22px 22px; text-align: center; max-width: 340px; width: 100%; box-shadow: 0 20px 60px rgba(0, 0, 0, .15); animation: partyIn .5s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes partyIn { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }
#partyBuddy { width: 190px; height: 190px; margin: 0 auto; }
.party-card h2 { margin: 6px 0 4px; font-size: 24px; }
.party-card p { margin: 0 0 16px; opacity: .75; }
.confetti { position: fixed; top: -40px; z-index: 41; pointer-events: none; font-size: 24px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(115vh) rotate(540deg); } }

.toast {
  position: fixed; z-index: 50; left: 50%; transform: translateX(-50%); bottom: calc(var(--safe-b) + 92px);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 99px; font-size: 15px; font-weight: 500;
  max-width: calc(100% - 32px); text-align: center; animation: pop .3s ease-out;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
@media (max-width: 360px) {
  .buddy-btn { width: 190px; height: 190px; }
  .glass-wrap, .glass { width: 96px; }
}
