:root{color-scheme:light;--bg:#fcf9f7;--ink:#3d3c4c;--muted:#666170;--line:#e9e1e7;--white:#fffefd;--green:#514665;--sage:#d7eae1;--mint:#e6f3ed;--cream:#fff1d6;--blue:#e7effb;--pink:#fbe8ed;--lavender:#ede6f8;--accent:#e3d6f4;font-family:"Segoe UI","PingFang HK","Microsoft JhengHei",system-ui,sans-serif;color:var(--ink);background:var(--bg)}
*{box-sizing:border-box}
body{margin:0}
a{color:var(--green);text-decoration:none}
button,input,select,textarea{font:inherit}
button{cursor:pointer}
button:disabled{opacity:.6;cursor:wait}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid #827095;outline-offset:3px}
svg{width:22px;height:22px;vertical-align:middle;flex-shrink:0}
h1,h2,p{margin:0}
.top{max-width:790px;margin:auto;display:flex;justify-content:space-between;align-items:center;padding:calc(15px + env(safe-area-inset-top)) clamp(16px,4vw,32px) 15px}
.brand{display:flex;align-items:center;gap:10px;font-size:1.16rem;font-weight:750;letter-spacing:.06em}
#brand-icon{display:grid;place-items:center;width:36px;height:36px;background:var(--mint);color:#406558;border-radius:12px}
.device{font-size:.78rem;background:var(--lavender);border-radius:30px;padding:7px 12px;font-weight:650}
main{max-width:790px;min-height:75vh;margin:0 auto;padding:0 clamp(16px,4vw,32px) calc(100px + env(safe-area-inset-bottom))}
main:focus{outline:none}
nav{position:fixed;z-index:1;bottom:0;left:50%;transform:translateX(-50%);display:grid;grid-template-columns:repeat(5,minmax(0,1fr));width:100%;max-width:790px;padding:7px clamp(3px,2vw,20px) calc(7px + env(safe-area-inset-bottom));background:var(--white);border:1px solid var(--line);border-radius:22px 22px 0 0;box-shadow:0 -5px 25px #76647f0a}
nav a{display:flex;flex-direction:column;justify-content:center;align-items:center;gap:5px;padding:6px 1px;min-height:56px;color:var(--muted);font-weight:650;font-size:clamp(.65rem,3vw,.85rem);border-radius:14px;white-space:nowrap}
nav a[aria-current]{background:var(--lavender);color:var(--green)}
.hero{position:relative;overflow:hidden;isolation:isolate;min-height:239px;background:linear-gradient(115deg,#e0f0e7 0%,#f4f1e5 65%,#f9e6e9 100%);border-radius:25px;color:var(--ink);display:grid;grid-template-columns:minmax(0,1fr) minmax(0,.9fr);gap:12px;align-items:center;padding:clamp(20px,5vw,40px)}
.hero-copy{z-index:1}
.hero-visual{display:grid;gap:6px;width:100%;align-self:end}
.hero-swim-area{position:relative;width:100%;aspect-ratio:1.5;overflow:hidden}
.hero-bubbles{position:absolute;inset:0;pointer-events:none}
.hero-bubbles i{position:absolute;left:7%;bottom:5%;width:32px;aspect-ratio:1;border:1px solid #ffffffa6;border-radius:50%;background:radial-gradient(ellipse at 28% 20%,#fffffff2 0 6%,#ffffff00 24%),radial-gradient(ellipse at 78% 78%,#f3a9db66 0%,#ffffff00 49%),radial-gradient(ellipse at 20% 75%,#93e2d94d 0%,#d5d2f51a 62%);box-shadow:inset 2px 2px 4px #ffffffb3,inset -2px -2px 4px #b6bfe04d,0 0 6px #eac8f44d;opacity:0;animation:bubble-rise 5.4s ease-in-out infinite}
.hero-bubbles i::before{content:"";position:absolute;inset:-1px;border-radius:50%;padding:1.5px;background:conic-gradient(from -30deg,#ef95cd,#b4a0ef,#74cde9,#8cdec0,#f7e690,#f6b18b,#ef95cd);-webkit-mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);mask:linear-gradient(#fff 0 0) content-box,linear-gradient(#fff 0 0);-webkit-mask-composite:xor;mask-composite:exclude}
.hero-bubbles i::after{content:"";position:absolute;right:4%;top:10%;width:clamp(5px,28%,9px);aspect-ratio:1;background:#fffef5;clip-path:polygon(50% 0,61% 38%,100% 50%,61% 62%,50% 100%,39% 62%,0 50%,39% 38%);animation:bubble-glint 3.2s ease-in-out infinite alternate}
.hero-bubbles i:nth-child(2){left:24%;bottom:18%;width:14px;animation-duration:6.2s;animation-delay:-2.1s}
.hero-bubbles i:nth-child(3){left:68%;bottom:4%;width:46px;animation-duration:6.8s;animation-delay:-4.4s}
.hero-bubbles i:nth-child(4){left:86%;bottom:12%;width:22px;animation-duration:5.8s;animation-delay:-1.3s}
.hero-bubbles i:nth-child(5){left:49%;bottom:10%;width:10px;animation-duration:7.2s;animation-delay:-3.6s}
.hero-bubbles i:nth-child(even)::after{animation-delay:-1.6s}
@keyframes bubble-rise{0%,12%{opacity:0;transform:translateY(0) scale(.65)}28%{opacity:.85}62%{opacity:.55}82%,100%{opacity:0;transform:translateY(-76px) scale(1.1)}}
@keyframes bubble-glint{from{opacity:.35;transform:scale(.65)}to{opacity:1;transform:scale(1.1)}}
.hero-swim-area.motion-paused .hero-bubbles i,.hero-swim-area.motion-paused .hero-bubbles i::after{animation-play-state:paused}
.hero-friends{position:absolute;display:block;width:80%;height:auto;left:10%;top:10%;animation:friends-swimming 16s linear infinite}
.hero-friends.motion-paused{animation-play-state:paused}
.hero .motion-toggle{justify-self:end;font-size:.78rem;min-height:44px;padding:8px 12px}
@keyframes friends-swimming{
  0%,100%{left:2%;top:10%}
  12.5%{left:4.3%;top:4.3%}
  25%{left:10%;top:2%}
  37.5%{left:15.7%;top:4.3%}
  50%{left:18%;top:10%}
  62.5%{left:15.7%;top:15.7%}
  75%{left:10%;top:18%}
  87.5%{left:4.3%;top:15.7%}
}
@media(prefers-reduced-motion:reduce){.hero-friends{animation:none}.hero-bubbles{display:none}}
@media(max-width:619px){.hero{grid-template-columns:1fr;gap:10px}.hero-visual{width:min(100%,340px);justify-self:end}.hero h1{font-size:1.9rem}}
.hero h1{font-size:clamp(2rem,7vw,3.55rem);line-height:1.15;letter-spacing:.05em;margin:13px 0}
.hero p{color:#53635d}
.hero .date-tag{display:flex;align-items:center;gap:6px;font-size:.82rem;font-weight:650}
.date-tag svg,.section-title a svg{width:16px;height:16px}
.section{margin-top:24px}
.section-title{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:12px}
.section-title h2,.family-panel h2{font-size:1.13rem;letter-spacing:.02em}
.section-title p,.page-heading p,.family-panel p,.muted{color:var(--muted);margin-top:7px}
.section-title a{font-size:.83rem;font-weight:750;white-space:nowrap;padding:10px 0}
.metrics,.quick{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:clamp(6px,2vw,13px)}
.metric,.quick button,.panel,.record,.empty{background:var(--white);border:1px solid var(--line);border-radius:18px}
.metric{padding:clamp(8px,3vw,17px);min-height:102px;display:flex;flex-direction:column;gap:5px}
.metric-label{font-size:clamp(.68rem,3vw,.86rem);color:var(--muted);font-weight:650}
.metric strong{font-size:clamp(1rem,4vw,1.55rem);line-height:1.25;overflow-wrap:anywhere}
.metric small,.chart-single small{font-size:.7rem;color:var(--muted)}
.tile-icon{width:36px;height:36px;border-radius:11px;display:inline-grid;place-items:center;background:var(--mint);color:#406558;flex:none}
.tile-icon svg{width:20px;height:20px}
.tile-icon.meal{background:var(--cream);color:#765b32}
.tile-icon.water{background:var(--blue);color:#4c6087}
.tile-icon.family{background:var(--pink);color:#85546a}
.tile-icon.stats{background:var(--lavender);color:var(--green)}
.metrics .metric:nth-child(3n+1){background:#f0f8f3}
.metrics .metric:nth-child(3n+2){background:#fff7e8}
.metrics .metric:nth-child(3n){background:#f1f5fd}
.quick button:nth-child(1){background:#f0f8f3}
.quick button:nth-child(2){background:#fff7e8}
.quick button:nth-child(3){background:#f1f5fd}
.quick button{color:var(--ink);padding:9px 3px;min-height:70px;display:flex;justify-content:center;align-items:center;flex-wrap:wrap;column-gap:5px;font-weight:700;font-size:clamp(.72rem,3vw,.94rem)}
.quick button>svg{height:13px;width:13px;color:var(--muted)}
.quick .tile-icon{width:29px;height:29px}
.quick .tile-icon svg{width:16px;height:16px}
.panel{padding:clamp(14px,4vw,23px)}
.chart{display:grid;grid-auto-flow:column;grid-auto-columns:minmax(0,1fr);gap:clamp(4px,2vw,15px);margin-top:17px}
.chart.dense{gap:2px}
.bar-column{text-align:center;min-width:0}
.bar-track{display:flex;align-items:flex-end;height:96px;background:#f4f0f6;border-radius:8px 8px 5px 5px;overflow:hidden}
.bar{display:block;background:#baa7d3;min-height:2px;width:100%;border-radius:7px 7px 3px 3px}
.bar-column:nth-child(3n+2) .bar{background:#d2a6b8}
.bar-column:nth-child(3n) .bar{background:#9bc6b2}
.bar-label{display:block;min-height:15px;font-size:.72rem;color:var(--muted);margin-top:6px}
.dense .bar-label{font-size:.58rem}
.chart-single{font-size:2rem;font-weight:800}
.page-heading{padding-top:16px;margin-bottom:20px}
.page-heading h1{font-size:clamp(1.9rem,5vw,2.55rem);margin-top:8px}
.actions{display:flex;flex-wrap:wrap;gap:9px}
.primary,.secondary,.danger,.quiet{display:inline-flex;align-items:center;justify-content:center;gap:6px;border:0;border-radius:13px;min-height:46px;padding:11px 15px;font-weight:700}
.primary{background:var(--accent);color:#493b5c}
.secondary,.quiet{background:var(--lavender);color:var(--green)}
.danger{background:var(--pink);color:#8a354c}
.actions svg{width:17px;height:17px}
.full{width:100%}
.records{list-style:none;margin:0;padding:0;display:grid;gap:9px}
.record{padding:12px}
.record-line{display:flex;align-items:center;gap:9px}
.record-text{flex:1;min-width:0;overflow-wrap:anywhere}
.record-text p,.detail{font-size:.87rem;color:var(--muted)}
.detail{margin-top:8px;overflow-wrap:anywhere;white-space:pre-wrap}
.item-actions{display:flex;gap:2px}
.item-actions .quiet{min-width:44px;min-height:44px;background:transparent;padding:0}
.item-actions svg{width:18px;height:18px}
.food-photo{display:block;object-fit:cover;max-width:100%;max-height:185px;border-radius:11px;margin-top:10px}
.empty{text-align:center;color:var(--muted);padding:21px}
.empty svg,.empty p{margin:4px}
.family-panel p{line-height:1.6}
.family-panel .tile-icon,.family-panel button{margin-bottom:9px}
.family-panel button{margin-top:12px}
.small{font-size:.81rem}
.filters label{display:block;margin-bottom:6px;font-weight:700}
.filters input{max-width:250px}
input,textarea,select{width:100%;min-width:0;min-height:44px;padding:8px;border-radius:9px;border:1px solid #c9bfce;background:#fff;color:var(--ink);font-size:16px}
.segments{display:grid;grid-template-columns:repeat(3,1fr);gap:4px;background:var(--lavender);padding:4px;border-radius:12px;margin-top:12px}
.segments button{padding:10px 2px;border:0;border-radius:9px;background:transparent;color:var(--green);font-weight:700;min-height:44px}
.segments button[aria-pressed="true"]{background:var(--white)}
dialog{color:var(--ink);background:var(--white);width:min(550px,calc(100% - 22px));max-height:calc(100dvh - 20px);border:1px solid var(--line);border-radius:20px;padding:clamp(13px,4vw,24px)}
dialog::backdrop{background:#3e354c80}
.dialog-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:13px}
.dialog-head h2{font-size:1.25rem}
#fields{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.field span{display:block;font-size:.85rem;font-weight:700;margin-bottom:4px}
.field[data-wide],.check[data-wide]{grid-column:1/-1}
.check{display:flex;align-items:center;gap:6px}
.check input{width:20px}
.error{color:#923b32;font-weight:700;margin:9px 0;font-size:.88rem}
#remove-dialog .actions{margin-top:14px}
#status{position:fixed;bottom:calc(84px + env(safe-area-inset-bottom));z-index:5;left:50%;transform:translateX(-50%);background:#514665;color:#fff;border-radius:12px;padding:10px 13px;opacity:0;pointer-events:none;max-width:90vw;text-align:center}
#status.visible{opacity:1}
.sr-only{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}
@media(min-width:620px){.hero{min-height:282px}.quick button{gap:9px}}
