/* Spa Timer — "spa day"
   One stylesheet for the landing page and the app. Dark (deep ocean) is the
   default; light (sand) follows the phone's setting. Every animation is
   transform/opacity only and switches off under prefers-reduced-motion. */

:root {
  --ocean:      #0B3D4A;
  --ocean-deep: #072A33;
  --ocean-mid:  #0F4B5A;
  --aqua:       #2BC0C8;
  --aqua-soft:  #7FE3E1;
  --cream:      #F5EFE6;
  --sand:       #E9D8C3;
  --coral:      #FF7A6B;
  --seafoam:    #6FD6A8;
  --amber:      #F4C27A;

  --bg:         var(--ocean);
  --bg-2:       var(--ocean-deep);
  --text:       var(--cream);
  --text-soft:  rgba(245, 239, 230, .72);
  --text-faint: rgba(245, 239, 230, .5);
  --glass:      rgba(245, 239, 230, .07);
  --glass-2:    rgba(245, 239, 230, .11);
  --glass-line: rgba(245, 239, 230, .14);
  --shadow:     0 18px 50px -18px rgba(0, 12, 16, .65), 0 2px 6px rgba(0, 12, 16, .25);
  --accent:     var(--aqua);
  --accent-ink: #04262E;
  --ok:         var(--seafoam);
  --bad:        var(--coral);
  --warn:       var(--amber);
  --water-top:  #7FE3E1;
  --water-bot:  #1A8FA0;
  --ring:       rgba(127, 227, 225, .28);
  --field:      rgba(4, 30, 37, .45);

  --r-lg: 28px;
  --r-md: 20px;
  --r-sm: 14px;
  --gap:  clamp(16px, 4vw, 24px);
  --font-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-body: "Nunito Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --tabbar-h: 68px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:         #F5EFE6;
    --bg-2:       #E9D8C3;
    --text:       #0B3D4A;
    --text-soft:  rgba(11, 61, 74, .74);
    --text-faint: rgba(11, 61, 74, .52);
    --glass:      rgba(255, 255, 255, .55);
    --glass-2:    rgba(255, 255, 255, .78);
    --glass-line: rgba(11, 61, 74, .1);
    --shadow:     0 18px 46px -20px rgba(11, 61, 74, .35), 0 2px 6px rgba(11, 61, 74, .08);
    --accent:     #1A9FA8;
    --accent-ink: #FFFFFF;
    --ok:         #2E9E6D;
    --bad:        #E2574A;
    --warn:       #B7791F;
    --water-top:  #5ED6D6;
    --water-bot:  #1A8FA0;
    --ring:       rgba(26, 159, 168, .25);
    --field:      rgba(255, 255, 255, .8);
    color-scheme: light;
  }
}

/* ---- base -------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
h1, h2, h3 {
  font-family: var(--font-display);
  font-variation-settings: "SOFT" 100, "opsz" 72;
  font-weight: 560;
  line-height: 1.12;
  letter-spacing: -.01em;
  margin: 0 0 .5em;
}
h1 { font-size: clamp(30px, 7.5vw, 52px); }
h2 { font-size: clamp(21px, 4.6vw, 28px); }
h3 { font-size: 19px; }
p  { margin: 0 0 1em; }
a  { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--aqua-soft); }
@media (prefers-color-scheme: light) { a:hover { color: var(--ocean); } }
img, svg { display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--aqua-soft); outline-offset: 3px; border-radius: 8px; }
.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; }
.muted { color: var(--text-soft); }
.small { font-size: 14px; }
[hidden] { display: none !important; }

/* ---- the sea: background glow, slow ripples, drifting light -------------------- */
.sea { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none;
       background: radial-gradient(120% 80% at 50% -10%, var(--ocean-mid) 0%, var(--bg) 55%, var(--bg-2) 100%); }
@media (prefers-color-scheme: light) {
  .sea { background: radial-gradient(120% 80% at 50% -10%, #FFFFFF 0%, var(--bg) 50%, var(--bg-2) 100%); }
}
.sea__glow { position: absolute; width: 90vmax; height: 90vmax; left: 50%; top: 18%;
             transform: translate(-50%, -50%);
             background: radial-gradient(closest-side, rgba(43, 192, 200, .22), transparent 70%);
             animation: glow 14s ease-in-out infinite alternate; }
.sea__ripple { position: absolute; left: 50%; top: 30%; width: 70vmin; height: 70vmin; margin: -35vmin 0 0 -35vmin;
               border-radius: 50%; border: 1.5px solid rgba(127, 227, 225, .18);
               transform: scale(.2); opacity: 0;
               animation: ripple 12s cubic-bezier(.2, .6, .3, 1) infinite; will-change: transform, opacity; }
.sea__ripple.r2 { animation-delay: 4s; }
.sea__ripple.r3 { animation-delay: 8s; }
.sea__caustics { position: absolute; inset: -20%; opacity: .5;
                 background:
                   radial-gradient(40% 25% at 20% 80%, rgba(127, 227, 225, .10), transparent 70%),
                   radial-gradient(30% 20% at 80% 70%, rgba(233, 216, 195, .07), transparent 70%),
                   radial-gradient(35% 22% at 60% 95%, rgba(43, 192, 200, .10), transparent 70%);
                 animation: drift 30s ease-in-out infinite alternate; }
@media (prefers-color-scheme: light) {
  .sea__glow { background: radial-gradient(closest-side, rgba(43, 192, 200, .16), transparent 70%); }
  .sea__ripple { border-color: rgba(26, 159, 168, .16); }
}
@keyframes glow   { to { transform: translate(-50%, -46%) scale(1.08); } }
@keyframes ripple { 0% { transform: scale(.2); opacity: 0; } 15% { opacity: 1; } 100% { transform: scale(2.4); opacity: 0; } }
@keyframes drift  { to { transform: translate3d(4%, -3%, 0) rotate(3deg); } }

/* ---- layout -------------------------------------------------------------------- */
.wrap { width: 100%; max-width: 560px; margin: 0 auto; padding: 8px 16px 32px; }
body.app .wrap { padding-bottom: calc(var(--tabbar-h) + var(--safe-b) + 28px); }
.wrap > * + * { margin-top: var(--gap); }

.card {
  background: var(--glass);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow);
  padding: 22px;
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  backdrop-filter: blur(18px) saturate(140%);
}
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card__head h2 { margin: 0; font-size: 21px; }
.card.empty { text-align: center; padding: 36px 24px; }

/* ---- top bar ------------------------------------------------------------------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px;
          max-width: 560px; margin: 0 auto; padding: calc(12px + var(--safe-t)) 16px 12px; }
body.landing .topbar { max-width: 1120px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text);
         font-family: var(--font-display); font-variation-settings: "SOFT" 100; font-size: 21px; font-weight: 600; }
.brand:hover { color: var(--text); }
.topbar__tub { font-size: 14px; color: var(--text-soft); max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
               padding: 6px 12px; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-line); }
.tubpick select { appearance: none; -webkit-appearance: none; background: var(--glass) no-repeat right 12px center / 10px
                  url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237FE3E1' stroke-width='1.6'/%3E%3C/svg%3E");
                  border: 1px solid var(--glass-line); border-radius: 999px; padding: 7px 32px 7px 14px; font-size: 14px; max-width: 200px; }
.topbar__links { display: flex; align-items: center; gap: 8px; }

/* ---- bottom tab bar (app) ------------------------------------------------------- */
.tabbar { position: fixed; z-index: 30; left: 50%; transform: translateX(-50%);
          bottom: calc(10px + var(--safe-b)); width: min(420px, calc(100% - 24px)); height: var(--tabbar-h);
          display: grid; grid-template-columns: repeat(3, 1fr); padding: 6px;
          background: rgba(7, 42, 51, .72); border: 1px solid var(--glass-line); border-radius: 24px;
          -webkit-backdrop-filter: blur(20px) saturate(150%); backdrop-filter: blur(20px) saturate(150%);
          box-shadow: var(--shadow); }
@media (prefers-color-scheme: light) { .tabbar { background: rgba(255, 255, 255, .78); } }
.tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 18px;
            color: var(--text-faint); text-decoration: none; font-size: 12px; font-weight: 700; letter-spacing: .02em;
            transition: color .2s, background .2s; }
.tabbar a svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.on { color: var(--text); background: var(--glass-2); }
.tabbar a.on svg { stroke: var(--accent); }

/* ---- buttons -------------------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px;
       border-radius: 999px; border: 1px solid transparent; font-weight: 800; font-size: 16px; letter-spacing: .01em;
       text-decoration: none; cursor: pointer; transition: transform .15s, box-shadow .2s, background .2s, opacity .2s; }
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(180deg, var(--aqua-soft), var(--aqua)); color: #04262E;
               box-shadow: 0 10px 26px -10px rgba(43, 192, 200, .8); }
.btn.primary:hover { color: #04262E; box-shadow: 0 12px 30px -8px rgba(43, 192, 200, .9); }
.btn.ghost { background: var(--glass); border-color: var(--glass-line); color: var(--text); }
.btn.ghost:hover { background: var(--glass-2); color: var(--text); }
.btn.danger { background: transparent; border-color: rgba(255, 122, 107, .5); color: var(--bad); }
.btn.small { min-height: 38px; padding: 0 16px; font-size: 14px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; }

/* ---- alert banner ---------------------------------------------------------------- */
.alert { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--r-md);
         background: rgba(255, 122, 107, .14); border: 1px solid rgba(255, 122, 107, .45); color: var(--text);
         box-shadow: 0 10px 30px -16px rgba(255, 122, 107, .7); animation: slide-in .4s ease-out; }
.alert svg { flex: 0 0 26px; width: 26px; height: 26px; fill: none; stroke: var(--bad); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; margin-top: 1px; }
.alert strong { display: block; font-size: 16px; margin-bottom: 2px; }
.alert p { margin: 0; color: var(--text-soft); font-size: 15px; }
.alert.warn { background: rgba(244, 194, 122, .13); border-color: rgba(244, 194, 122, .45); box-shadow: none; }
.alert.warn svg { stroke: var(--warn); }
.alert.info { background: var(--glass); border-color: var(--glass-line); box-shadow: none; }
.alert.info svg { stroke: var(--accent); }
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } }

/* ---- hero gauge ------------------------------------------------------------------ */
.gauge-card { display: flex; flex-direction: column; align-items: center; padding-top: 34px; }
.gauge { --level: 80; position: relative; width: min(78vw, 320px); aspect-ratio: 1; }
.gauge__ring { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; isolation: isolate;
               background: radial-gradient(circle at 50% 35%, rgba(245, 239, 230, .10), rgba(4, 30, 37, .35) 70%);
               box-shadow: inset 0 0 0 10px rgba(245, 239, 230, .05), inset 0 0 0 11px var(--ring),
                           inset 0 -20px 50px rgba(0, 0, 0, .25), 0 30px 70px -30px rgba(43, 192, 200, .55), var(--shadow);
               transition: filter .6s, opacity .6s; }
@media (prefers-color-scheme: light) {
  .gauge__ring { background: radial-gradient(circle at 50% 35%, #FFFFFF, #E4ECEA 75%);
                 box-shadow: inset 0 0 0 10px rgba(255, 255, 255, .6), inset 0 0 0 11px var(--ring),
                             inset 0 -16px 40px rgba(11, 61, 74, .08), 0 30px 60px -30px rgba(26, 159, 168, .45), var(--shadow); }
}
/* glass highlight on top of the water */
.gauge__ring::after { content: ""; position: absolute; inset: 0; border-radius: 50%; z-index: 3; pointer-events: none;
                      background: radial-gradient(60% 40% at 32% 18%, rgba(255, 255, 255, .22), transparent 60%); }

.gauge__water { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
                height: calc(var(--level) * 1%);
                transition: height 1.6s cubic-bezier(.45, .05, .25, 1); }
.gauge__body { position: absolute; inset: 0;
               background: linear-gradient(180deg, var(--water-top) 0%, var(--aqua) 30%, var(--water-bot) 100%); }
.wave { position: absolute; left: 0; bottom: calc(100% - 1px); width: 200%; height: 18px; will-change: transform; }
.wave path { fill: var(--water-top); }
.wave.w1 { animation: wave 7s linear infinite; }
.wave.w2 { opacity: .55; height: 22px; animation: wave 11s linear infinite reverse; }
.wave.w2 path { fill: var(--aqua-soft); }
@keyframes wave { from { transform: translateX(0); } to { transform: translateX(-50%); } }

.gauge[data-mode="drain"] .wave.w1 { animation-duration: 3.2s; }
.gauge[data-mode="drain"] .wave.w2 { animation-duration: 4.6s; }
.gauge[data-mode="fill"]  .wave.w1 { animation-duration: 2.8s; }
.gauge[data-mode="fill"]  .wave.w2 { animation-duration: 3.8s; }
.gauge[data-mode="unknown"] .gauge__water { opacity: .45; }

/* bubbles rise while filling */
.bubbles { position: absolute; inset: 0; overflow: hidden; opacity: 0; transition: opacity .6s; }
.gauge[data-mode="fill"] .bubbles { opacity: 1; }
.bubbles i { position: absolute; bottom: -10px; width: 8px; height: 8px; border-radius: 50%;
             border: 1.5px solid rgba(255, 255, 255, .7); animation: bubble 3.6s ease-in infinite; }
.bubbles i:nth-child(1) { left: 18%; animation-delay: 0s; }
.bubbles i:nth-child(2) { left: 34%; width: 5px; height: 5px; animation-delay: 1.1s; }
.bubbles i:nth-child(3) { left: 50%; width: 10px; height: 10px; animation-delay: 2.2s; }
.bubbles i:nth-child(4) { left: 63%; animation-delay: .6s; }
.bubbles i:nth-child(5) { left: 76%; width: 6px; height: 6px; animation-delay: 1.7s; }
.bubbles i:nth-child(6) { left: 86%; width: 4px; height: 4px; animation-delay: 2.8s; }
@keyframes bubble { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 100% { transform: translateY(-260px); opacity: 0; } }

/* swirl at the drain */
.gauge[data-mode="drain"] .gauge__body { background:
  radial-gradient(14% 10% at 50% 100%, rgba(4, 38, 46, .55), transparent 70%),
  linear-gradient(180deg, var(--water-top) 0%, var(--aqua) 30%, var(--water-bot) 100%); }

.gauge__label { position: absolute; inset: 0; z-index: 4; display: flex; flex-direction: column; align-items: center; justify-content: center;
                text-align: center; padding: 0 18%; pointer-events: none; }
.gauge__status { font-family: var(--font-display); font-variation-settings: "SOFT" 100, "opsz" 144; font-weight: 640;
                 font-size: clamp(30px, 9vw, 42px); letter-spacing: .04em; line-height: 1;
                 color: var(--cream); text-shadow: 0 2px 18px rgba(4, 38, 46, .55); }
.gauge__sub { margin-top: 10px; font-size: 14.5px; font-weight: 700; line-height: 1.35; color: rgba(245, 239, 230, .92);
              text-shadow: 0 1px 10px rgba(4, 38, 46, .6); }
@media (prefers-color-scheme: light) {
  .gauge[data-mode="unknown"] .gauge__status, .gauge[data-online="0"] .gauge__status { color: var(--ocean); text-shadow: none; }
  .gauge[data-mode="unknown"] .gauge__sub,    .gauge[data-online="0"] .gauge__sub    { color: var(--text-soft); text-shadow: none; }
  /* low or moving water leaves the label over the white ring: dark ink reads on both */
  .gauge:is([data-float="empty"], [data-float="needs_water"], [data-float="filling"], [data-float="draining"]) .gauge__status { color: var(--ocean); text-shadow: 0 1px 12px rgba(255, 255, 255, .6); }
  .gauge:is([data-float="empty"], [data-float="needs_water"], [data-float="filling"], [data-float="draining"]) .gauge__sub    { color: var(--ocean); text-shadow: 0 1px 10px rgba(255, 255, 255, .6); }
}

/* steam above the tub while the heater is on */
.gauge__steam { position: absolute; left: 22%; right: 22%; top: -26px; height: 70px; z-index: 5; pointer-events: none;
                opacity: 0; transition: opacity 1s; }
.gauge[data-steam="1"] .gauge__steam { opacity: 1; }
.gauge__steam i { position: absolute; bottom: 0; width: 26px; height: 54px; border-radius: 50%;
                  background: radial-gradient(closest-side, rgba(245, 239, 230, .55), transparent);
                  filter: blur(5px); opacity: 0; animation: steam 4.8s ease-out infinite; }
.gauge__steam i:nth-child(1) { left: 6%;  animation-delay: 0s; }
.gauge__steam i:nth-child(2) { left: 26%; animation-delay: 1.4s; }
.gauge__steam i:nth-child(3) { left: 46%; animation-delay: .7s; }
.gauge__steam i:nth-child(4) { left: 66%; animation-delay: 2.2s; }
.gauge__steam i:nth-child(5) { left: 84%; animation-delay: 3s; }
@media (prefers-color-scheme: light) { .gauge__steam i { background: radial-gradient(closest-side, rgba(11, 61, 74, .22), transparent); } }
@keyframes steam { 0% { transform: translateY(20px) scale(.6); opacity: 0; } 30% { opacity: .9; }
                   100% { transform: translateY(-40px) scale(1.5) rotate(8deg); opacity: 0; } }

/* offline: grey everything */
.gauge[data-online="0"] .gauge__ring { filter: grayscale(1) brightness(.85); }
.gauge[data-online="0"] .wave, .gauge[data-online="0"] .bubbles i { animation-play-state: paused; }
body.is-offline .action, body.is-offline .timeline-card, body.is-offline .chips, body.is-offline .alert { filter: grayscale(1); opacity: .6; }

/* status chips under the gauge */
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px; font-size: 13.5px; font-weight: 700;
        background: var(--glass); border: 1px solid var(--glass-line); color: var(--text-soft); }
.chip svg { width: 16px; height: 16px; fill: currentColor; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
.chip.ok   { color: var(--ok); }   .chip.ok .dot   { background: var(--ok); box-shadow: 0 0 0 0 var(--ok); animation: pulse 2.4s infinite; }
.chip.bad  { color: var(--bad); }  .chip.bad .dot  { background: var(--bad); }
.chip.warn { color: var(--warn); } .chip.warn .dot { background: var(--warn); }
.chip.hot  { color: var(--warn); }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(111, 214, 168, .55); } 70% { box-shadow: 0 0 0 8px rgba(111, 214, 168, 0); } 100% { box-shadow: 0 0 0 0 rgba(111, 214, 168, 0); } }

/* ---- the big button ----------------------------------------------------------------- */
.action { text-align: center; }
.big-btn { position: relative; width: 100%; min-height: 76px; padding: 0 28px; border: 0; border-radius: 999px; cursor: pointer;
           display: flex; align-items: center; justify-content: center; gap: 14px;
           font-family: var(--font-display); font-variation-settings: "SOFT" 100; font-size: 22px; font-weight: 600; letter-spacing: .005em;
           color: #04262E;   /* dark ink on aqua in both themes: white fails contrast */
           background: linear-gradient(180deg, var(--aqua-soft) 0%, var(--aqua) 100%);
           box-shadow: 0 18px 40px -16px rgba(43, 192, 200, .95), inset 0 1px 0 rgba(255, 255, 255, .55);
           transition: transform .15s, box-shadow .25s, background .3s, opacity .3s; overflow: hidden; }
.big-btn::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
                   background: linear-gradient(110deg, transparent 30%, rgba(255, 255, 255, .35) 50%, transparent 70%);
                   transform: translateX(-100%); animation: sheen 5s ease-in-out 1.5s infinite; }
.big-btn:active { transform: scale(.98); }
.big-btn__icon { width: 26px; height: 26px; flex: 0 0 26px;
                 background: currentColor;
                 -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5c4 5 7 8.5 7 12.2a7 7 0 0 1-14 0C5 11 8 7.5 12 2.5z'/%3E%3C/svg%3E") center / contain no-repeat;
                         mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5c4 5 7 8.5 7 12.2a7 7 0 0 1-14 0C5 11 8 7.5 12 2.5z'/%3E%3C/svg%3E") center / contain no-repeat; }
.big-btn.stop { color: #FFF; background: linear-gradient(180deg, #FF9A8E 0%, var(--coral) 100%);
                box-shadow: 0 18px 40px -16px rgba(255, 122, 107, .95), inset 0 1px 0 rgba(255, 255, 255, .4); }
.big-btn.stop::before { animation: none; }
.big-btn.stop .big-btn__icon {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='5' width='14' height='14' rx='3'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='5' y='5' width='14' height='14' rx='3'/%3E%3C/svg%3E"); }
.big-btn.busy .big-btn__icon { -webkit-mask: none; mask: none; background: none; border-radius: 50%;
                               border: 3px solid currentColor; border-right-color: transparent; animation: spin .8s linear infinite; }
.big-btn[disabled] { cursor: not-allowed; opacity: .5; filter: saturate(.4); box-shadow: none; }
.big-btn[disabled]::before { animation: none; }
@keyframes sheen { 0%, 70% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
@keyframes spin  { to { transform: rotate(360deg); } }

.why  { margin: 14px 4px 0; color: var(--text-soft); font-size: 15px; }
.why::before { content: "ⓘ "; color: var(--warn); font-weight: 800; }
.hint { margin: 12px 4px 0; font-size: 15px; font-weight: 700; color: var(--ok); }
.hint.bad { color: var(--bad); }

/* ---- step timeline ---------------------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; position: relative; }
.timeline li { position: relative; display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 12px;
               min-height: 46px; color: var(--text-faint); transition: color .3s; }
.timeline li + li::before { content: ""; position: absolute; left: 13px; top: -14px; height: 28px; width: 2px; border-radius: 2px;
                            background: var(--glass-line); }
.tl__dot { width: 16px; height: 16px; margin-left: 6px; border-radius: 50%; border: 2px solid var(--glass-line); background: var(--bg);
           transition: all .3s; position: relative; z-index: 1; }
.tl__label { font-weight: 700; }
.tl__meta  { font-size: 13.5px; font-variant-numeric: tabular-nums; }
.timeline li.done { color: var(--text-soft); }
.timeline li.done .tl__dot { background: var(--ok); border-color: var(--ok); }
.timeline li.done + li::before { background: var(--ok); opacity: .7; }
.timeline li.now { color: var(--text); }
.timeline li.now .tl__label { font-size: 17px; }
.timeline li.now .tl__dot { width: 22px; height: 22px; margin-left: 3px; background: var(--accent); border-color: var(--aqua-soft);
                            box-shadow: 0 0 0 6px rgba(43, 192, 200, .2); animation: now 2s ease-in-out infinite; }
.timeline li.now .tl__meta { color: var(--accent); font-weight: 800; }
.timeline-card.idle .timeline { opacity: .7; }
@keyframes now { 50% { box-shadow: 0 0 0 10px rgba(43, 192, 200, .05); } }

.foot-note { text-align: center; }

/* ---- bottom sheet (confirm) -------------------------------------------------------- */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet__scrim { position: absolute; inset: 0; background: rgba(2, 18, 22, .55); animation: fade .25s ease-out;
                -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sheet__panel { position: relative; width: 100%; max-width: 560px; max-height: 92vh; overflow-y: auto;
                padding: 12px 22px calc(22px + var(--safe-b)); border-radius: 30px 30px 0 0;
                background: var(--ocean); border: 1px solid var(--glass-line); border-bottom: 0;
                box-shadow: 0 -20px 60px -20px rgba(0, 0, 0, .6); animation: sheet-up .32s cubic-bezier(.2, .8, .2, 1); }
@media (prefers-color-scheme: light) { .sheet__panel { background: #FBF8F3; } }
@media (min-width: 600px) { .sheet { align-items: center; } .sheet__panel { border-radius: 30px; border-bottom: 1px solid var(--glass-line); } }
.sheet__grab { width: 44px; height: 5px; border-radius: 5px; background: var(--glass-line); margin: 0 auto 18px; }
.sheet h2 { font-size: 25px; }
.sheet p { color: var(--text-soft); }
.ticks { list-style: none; margin: 0 0 22px; padding: 0; display: grid; gap: 10px; }
.ticks li { position: relative; padding-left: 30px; color: var(--text-soft); font-size: 15px; }
.ticks li::before { content: ""; position: absolute; left: 0; top: 3px; width: 19px; height: 19px; border-radius: 50%;
                    background: rgba(111, 214, 168, .18) no-repeat center / 11px
                      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 10'%3E%3Cpath d='M1 5l3.5 3.5L11 1.5' fill='none' stroke='%236FD6A8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.sheet__actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 12px; }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
@keyframes fade { from { opacity: 0; } }

/* ---- forms ------------------------------------------------------------------------ */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field > span, .field > label { font-size: 14px; font-weight: 700; color: var(--text-soft); }
.input, .form input[type=text], .form input[type=email], .form input[type=password], .form input[type=tel], .form textarea {
  width: 100%; min-height: 50px; padding: 12px 16px; border-radius: var(--r-sm);
  background: var(--field); border: 1px solid var(--glass-line); color: var(--text); font-size: 16px;
  transition: border-color .2s, box-shadow .2s; }
.form textarea { min-height: 110px; resize: vertical; }
.form input:focus, .form textarea:focus { outline: none; border-color: var(--aqua); box-shadow: 0 0 0 4px rgba(43, 192, 200, .2); }
.form .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 380px) { .form .row2 { grid-template-columns: 1fr; } }
.hp { position: absolute; left: -5000px; width: 1px; height: 1px; overflow: hidden; }   /* honeypot */

.flash { padding: 13px 16px; border-radius: var(--r-sm); font-weight: 700; font-size: 15px;
         background: rgba(111, 214, 168, .14); border: 1px solid rgba(111, 214, 168, .4); color: var(--text); }
.flash.bad { background: rgba(255, 122, 107, .14); border-color: rgba(255, 122, 107, .45); }

/* toggle switch */
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch__ui { flex: 0 0 54px; height: 32px; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--glass-line);
              position: relative; transition: background .25s; }
.switch__ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%;
                     background: var(--cream); box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: transform .25s cubic-bezier(.3, .7, .3, 1.3); }
.switch input:checked + .switch__ui { background: var(--ok); }
.switch input:checked + .switch__ui::after { transform: translateX(22px); }
.switch input:focus-visible + .switch__ui { outline: 3px solid var(--aqua-soft); outline-offset: 2px; }

/* ---- auth page --------------------------------------------------------------------- */
.auth { min-height: calc(100dvh - 70px); display: flex; flex-direction: column; justify-content: center; }
.auth .card { padding: 30px 24px; }
.auth__mark { display: flex; justify-content: center; margin-bottom: 14px; }
.auth h1 { text-align: center; font-size: 32px; }
.auth .lede { text-align: center; color: var(--text-soft); margin-bottom: 22px; }

/* ---- history ------------------------------------------------------------------------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { padding: 16px 12px; border-radius: var(--r-md); background: var(--glass); border: 1px solid var(--glass-line); text-align: center; }
.stat b { display: block; font-family: var(--font-display); font-variation-settings: "SOFT" 100; font-size: 26px; font-weight: 600; line-height: 1.1; }
.stat span { display: block; margin-top: 4px; font-size: 11px; line-height: 1.3; font-weight: 800; color: var(--text-soft); text-transform: uppercase; letter-spacing: .05em; }
.cycles { list-style: none; margin-bottom: 0; padding: 0; display: grid; gap: 10px; }
.cycle { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center;
         padding: 16px 18px; border-radius: var(--r-md); background: var(--glass); border: 1px solid var(--glass-line); }
.cycle__when { font-weight: 800; }
.cycle__meta { grid-column: 1 / -1; font-size: 14px; color: var(--text-soft); font-variant-numeric: tabular-nums; }
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px; border-radius: 999px; font-size: 13px; font-weight: 800; white-space: nowrap;
        background: var(--glass-2); color: var(--text-soft); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.ok   { color: var(--ok);   background: rgba(111, 214, 168, .14); }
.pill.bad  { color: var(--bad);  background: rgba(255, 122, 107, .14); }
.pill.warn { color: var(--warn); background: rgba(244, 194, 122, .14); }
.pill.live { color: var(--accent); background: rgba(43, 192, 200, .16); }
.pager { display: flex; justify-content: center; gap: 10px; }
/* float (water level) log */
.float-log__day { margin: 18px 0 6px; font-family: var(--font-body); font-size: 12px; font-weight: 800; letter-spacing: .08em;
                  text-transform: uppercase; color: var(--text-soft); }
.float-log__day:first-of-type { margin-top: 0; }
.float-log__list { list-style: none; margin: 0; padding: 0; }
.float-log__list li { display: grid; grid-template-columns: 52px 1fr; gap: 10px; padding: 8px 0; font-size: 15px;
                      border-top: 1px solid var(--glass-line); }
.float-log__list li:first-child { border-top: 0; }
.float-log__list time { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--text-soft); }
.float-log__list b { font-weight: 800; }
.float-log__list b[data-tone="ok"]   { color: var(--ok); }
.float-log__list b[data-tone="live"] { color: var(--accent); }
.float-log__list b[data-tone="bad"]  { color: var(--bad); }
.float-log__list b[data-tone="off"]  { color: var(--text-faint); }

/* ---- settings ------------------------------------------------------------------------- */
.list { display: grid; gap: 0; }
.list > * + * { border-top: 1px solid var(--glass-line); }
.list .item { padding: 14px 0; }
.item__sub { font-size: 14px; color: var(--text-soft); }
.kv { display: flex; justify-content: space-between; gap: 12px; font-size: 15px; }
.kv span:first-child { color: var(--text-soft); }
.signout { text-align: center; }

/* ---- landing (marketing) ------------------------------------------------------------- */
body.landing .wrap { max-width: 1120px; padding-bottom: 40px; }
.hero { display: grid; gap: 32px; align-items: center; padding: 28px 0 10px; }
@media (min-width: 860px) { .hero { grid-template-columns: 1.1fr .9fr; padding: 64px 0 40px; } }
.eyebrow { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; margin-bottom: 18px;
           font-size: 13px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
           color: var(--aqua-soft); background: rgba(43, 192, 200, .12); border: 1px solid rgba(43, 192, 200, .3); }
@media (prefers-color-scheme: light) { .eyebrow { color: #12808A; } }
.hero h1 { font-size: clamp(38px, 9vw, 66px); margin-bottom: 18px; }
.hero h1 em { font-style: italic; color: var(--aqua-soft); font-variation-settings: "SOFT" 100, "WONK" 1; }
@media (prefers-color-scheme: light) { .hero h1 em { color: var(--accent); } }
.hero .lede { font-size: clamp(17px, 2.4vw, 20px); color: var(--text-soft); max-width: 34em; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }
.hero__cta .btn { min-height: 56px; padding: 0 28px; font-size: 17px; }
.hero__art { display: flex; justify-content: center; }
.hero__art .gauge { width: min(74vw, 360px); }

.section { padding: 34px 0; }
.section > h2 { text-align: center; margin-bottom: 8px; font-size: clamp(26px, 5vw, 38px); }
.section > .lede { text-align: center; color: var(--text-soft); max-width: 36em; margin: 0 auto 28px; }
.benefits { display: grid; gap: 16px; }
@media (min-width: 760px) { .benefits { grid-template-columns: repeat(3, 1fr); } }
.benefit { padding: 26px 22px; }
.benefit__icon { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; margin-bottom: 16px;
                 background: linear-gradient(160deg, rgba(127, 227, 225, .25), rgba(43, 192, 200, .08)); border: 1px solid rgba(127, 227, 225, .3); }
.benefit__icon svg { width: 28px; height: 28px; fill: none; stroke: var(--aqua-soft); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (prefers-color-scheme: light) { .benefit__icon svg { stroke: var(--accent); } }
.benefit h3 { font-size: 21px; }
.benefit p { color: var(--text-soft); margin: 0; }

.how { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; counter-reset: how; }
@media (min-width: 760px) { .how { grid-template-columns: repeat(3, 1fr); } }
.how li { counter-increment: how; position: relative; padding: 24px 22px 22px 22px; }
.how li::before { content: counter(how); display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; margin-bottom: 12px;
                  font-family: var(--font-display); font-weight: 600; font-size: 18px; color: #04262E;
                  background: linear-gradient(180deg, var(--aqua-soft), var(--aqua)); }
.how h3 { margin-bottom: 6px; }
.how p { margin: 0; color: var(--text-soft); }
.cycle-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 22px; }
.cycle-strip span { padding: 8px 14px; border-radius: 999px; font-size: 14px; font-weight: 700; background: var(--glass); border: 1px solid var(--glass-line); }
.cycle-strip i { align-self: center; color: var(--text-faint); font-style: normal; }

.get { max-width: 640px; margin: 0 auto; }
.get .card { padding: 30px 24px; }
.site-foot { text-align: center; padding: 30px 16px calc(30px + var(--safe-b)); color: var(--text-faint); font-size: 14px; }
.site-foot a { color: var(--text-soft); }

/* ---- float card: the one WC02 contact, as six plain states (lib/tub.php spa_float) ---- */
.float-card { --tone: var(--text-faint); display: grid; gap: 22px; }
.float-card[data-tone="ok"]   { --tone: var(--ok); }
.float-card[data-tone="live"] { --tone: var(--accent); }
.float-card[data-tone="bad"]  { --tone: var(--bad); }
.float__top { display: flex; align-items: center; gap: 18px; }
.float__icon { flex: none; display: grid; place-items: center; width: 84px; height: 84px; border-radius: 24px;
               color: var(--tone); background: color-mix(in srgb, var(--tone) 15%, transparent);
               box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--tone) 35%, transparent); transition: color .5s, background .5s; }
.fi { display: none; width: 60px; height: 60px; overflow: visible; }
.float-card[data-float="full"]        .fi-full,
.float-card[data-float="empty"]       .fi-empty,
.float-card[data-float="needs_water"] .fi-empty,
.float-card[data-float="draining"]    .fi-draining,
.float-card[data-float="filling"]     .fi-filling,
.float-card[data-float="offline"]     .fi-offline { display: block; }
.fi-tub, .fi-arrow, .fi-check, .fi-puddle, .fi-dot { fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; stroke-linejoin: round; }
.fi-dot { stroke-width: 3.4; }
.fi-puddle { opacity: .55; }
.fi-water { fill: currentColor; opacity: .4; }
.fi-badge { fill: currentColor; }
.fi-check { stroke: #04262E; stroke-width: 2.4; }
/* resting positions are mid-way, so with motion off the icon still reads as "on its way" */
.fi-water--down, .fi-water--up { transform: translateY(6px); }
.fi-water--down { animation: fi-drain 3s ease-in infinite; }
.fi-water--up   { animation: fi-fill 3s ease-out infinite; }
.fi-arrow--down { animation: fi-bob-down 1.4s ease-in-out infinite alternate; }
.fi-arrow--up   { animation: fi-bob-up 1.4s ease-in-out infinite alternate; }
@keyframes fi-drain   { from { transform: translateY(0); }    to { transform: translateY(13px); } }
@keyframes fi-fill    { from { transform: translateY(13px); } to { transform: translateY(0); } }
@keyframes fi-bob-down { to { transform: translateY(3px); } }
@keyframes fi-bob-up   { to { transform: translateY(-3px); } }

.float__text { min-width: 0; }
.float__kicker { display: block; font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--text-soft); }
.float__state { display: block; margin-top: 2px; font-family: var(--font-display); font-variation-settings: "SOFT" 100, "opsz" 144;
                font-weight: 640; font-size: clamp(30px, 8.5vw, 40px); line-height: 1.05; color: var(--tone); transition: color .5s; }
.float-card[data-float="offline"] .float__state { color: var(--text-soft); }
.float__explain { margin: 8px 0 0; font-size: 15px; line-height: 1.4; color: var(--text-soft); }

/* EMPTY — FILLING — FULL, the current one lit; DRAINING = an arrow travelling FULL -> EMPTY */
.levels { position: relative; }
.levels__track { position: absolute; top: 7px; left: calc(100% / 6); right: calc(100% / 6); height: 4px; border-radius: 4px; background: var(--glass-line); }
.levels__fill { position: absolute; inset: 0; border-radius: inherit; background: var(--tone); transform-origin: left center;
                transform: scaleX(0); transition: transform .9s cubic-bezier(.45, .05, .25, 1), opacity .5s; }
.levels[data-strip="filling"] .levels__fill { transform: scaleX(.5); }
.levels[data-strip="full"]    .levels__fill { transform: scaleX(1); }
.levels[data-strip="draining"] .levels__fill { transform: scaleX(1); opacity: .3; }
.levels__drain { position: absolute; inset: 0; z-index: 2; display: none; animation: lv-drain 2.6s cubic-bezier(.5, 0, .5, 1) infinite; }
.levels[data-strip="draining"] .levels__drain { display: block; }
.levels__drain svg { position: absolute; right: -13px; top: -11px; width: 26px; height: 26px; padding: 3px; border-radius: 50%;
                     background: var(--bg); box-shadow: 0 0 0 2px var(--tone);
                     fill: none; stroke: var(--tone); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
@keyframes lv-drain { 0% { transform: translateX(0); opacity: 0; } 15%, 85% { opacity: 1; } 100% { transform: translateX(-100%); opacity: 0; } }
.levels__steps { position: relative; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); }
.levels__steps li { display: flex; flex-direction: column; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 800;
                    letter-spacing: .08em; text-transform: uppercase; color: var(--text-faint); transition: color .5s; }
.levels__steps i { width: 18px; height: 18px; border-radius: 50%; background: var(--bg); border: 2px solid var(--glass-line);
                   transition: background .5s, border-color .5s, box-shadow .5s; }
.levels[data-strip="empty"]   li[data-k="empty"],
.levels[data-strip="filling"] li[data-k="filling"],
.levels[data-strip="full"]    li[data-k="full"] { color: var(--tone); }
.levels[data-strip="empty"]   li[data-k="empty"] i,
.levels[data-strip="filling"] li[data-k="filling"] i,
.levels[data-strip="full"]    li[data-k="full"] i { background: var(--tone); border-color: var(--tone);
                                                     box-shadow: 0 0 0 6px color-mix(in srgb, var(--tone) 20%, transparent); }
.levels__note { margin: 12px 0 0; text-align: center; font-size: 13.5px; font-weight: 800; color: var(--tone); }
.float-card[data-float="offline"] .float__icon, .float-card[data-float="offline"] .levels { filter: grayscale(1); opacity: .7; }

/* the gauge greys out when the float can't be read */
.gauge[data-float="offline"] .gauge__ring { filter: grayscale(1) brightness(.85); }
.chip.live { color: var(--accent); }
.chip.off  { color: var(--text-faint); }

/* ---- motion & small screens ---------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .sea__ripple, .gauge__steam i, .bubbles i { display: none; }
  .fi-water--down, .fi-water--up, .fi-arrow--down, .fi-arrow--up { animation: none; }
  .levels__drain { animation: none; transform: translateX(-25%); }   /* parked between FULL and FILLING */
  .gauge[data-steam="1"] .gauge__steam::after { content: ""; position: absolute; left: 25%; right: 25%; bottom: 0; height: 40px; border-radius: 50%;
                                                 background: radial-gradient(closest-side, rgba(245, 239, 230, .35), transparent); filter: blur(6px); }
}
@media (max-width: 360px) {
  .big-btn { font-size: 19px; min-height: 68px; padding: 0 18px; }
  .card { padding: 18px; }
}

/* ---- small utilities used by the pages -------------------------------------------------- */
.page-title { font-size: 32px; margin: 6px 0 0; }
.spaced { margin-top: 16px; }
.auth__after { text-align: center; margin-top: 20px; }
