:root {
  --pink: #ff6fa8;
  --pink-dark: #c2255c; /* 5.7:1 on white, 4.7:1 on --pink-light (WCAG AA) */
  --pink-light: #ffe3ee;
  --card: #fff;
  --text: #4a2335;
  --gold: #f5b301;
  --radius: 16px;
  --muted: #6e4a5a;
  --font-head: "Baloo 2", "Comic Sans MS", "Chalkboard SE", system-ui, sans-serif;
  --stars: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='80' height='80'%3E%3Cpath fill='%23ffc2dd' fill-opacity='.55' d='M20 8l3.5 7.2 7.9 1.1-5.7 5.5 1.4 7.8L20 25.8l-7.1 3.8 1.4-7.8-5.7-5.5 7.9-1.1zM62 48l2.6 5.4 5.9.8-4.3 4.1 1 5.9L62 61.4l-5.2 2.8 1-5.9-4.3-4.1 5.9-.8z'/%3E%3C/svg%3E");
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--pink-light) var(--stars);
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
body.center { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
h1, h2 { font-family: var(--font-head); }
h1 { margin: 0; font-size: 1.3rem; color: var(--pink-dark); }
.bar, main { max-width: 480px; margin: 0 auto; }
.bar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; }
main { padding: 0 12px calc(88px + env(safe-area-inset-bottom)); }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; box-shadow: 0 2px 10px rgb(214 51 108 / 15%); }
.login { width: 100%; max-width: 360px; display: grid; gap: 14px; }
.login h1 { text-align: center; font-size: 1.6rem; }
label { display: grid; gap: 4px; font-weight: 600; }
input, textarea { font: inherit; padding: 10px; border: 2px solid var(--pink-light); border-radius: 10px; min-height: 44px; color: var(--text); }
input:focus, textarea:focus { outline: none; border-color: var(--pink); }
button { font: inherit; min-height: 44px; min-width: 44px; border: 0; border-radius: 10px; cursor: pointer; }
button:disabled { opacity: .4; cursor: default; }
.primary { background: var(--pink-dark); color: var(--card); font-weight: 700; padding: 0 16px; }
.ghost { background: transparent; color: var(--pink-dark); font-weight: 600; }
.error { margin: 0; padding: 8px 12px; background: var(--pink-light); color: var(--pink-dark); border-radius: 10px; }
.datebar { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.datebar button { background: var(--pink-light); color: var(--pink-dark); }
.datecenter { flex: 1; display: grid; gap: 4px; text-align: center; font-weight: 700; }
.rules { list-style: none; margin: 0; padding: 0; }
.rules li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--pink-light); }
.tag { display: inline-block; margin-left: 6px; padding: 1px 8px; border-radius: 999px; background: var(--pink-light); color: var(--pink-dark); font-size: .75rem; font-weight: 700; white-space: nowrap; }
/* star button: data-score="0" | "0.5" | "1"; ☆ underneath, ★ clipped on top */
.star { position: relative; flex: none; width: 56px; height: 56px; background: transparent; color: var(--gold); font-size: 2.6rem; line-height: 56px; padding: 0; }
.star::before { content: "☆"; }
.star::after { content: "★"; position: absolute; left: 0; top: 0; width: 100%; text-align: center; clip-path: inset(0 100% 0 0); }
.star[data-score="0.5"]::after { clip-path: inset(0 50% 0 0); }
.star[data-score="1"]::after { clip-path: inset(0); }
.total { text-align: center; font-size: 1.2rem; margin: 16px 0 8px; }
.note textarea { resize: vertical; }
.saved { min-height: 1.4em; margin: 4px 0 0; color: var(--pink-dark); font-size: .85rem; }
.tabs { position: fixed; inset: auto 0 0; display: flex; background: var(--card); border-top: 1px solid var(--pink-light); box-shadow: 0 -2px 10px rgb(214 51 108 / 10%); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { flex: 1; min-height: 56px; display: grid; place-items: center; color: var(--text); font-weight: 600; font-size: .9rem; text-decoration: none; }
.tabs a.active { color: var(--pink-dark); background: var(--pink-light); box-shadow: inset 0 3px var(--pink); }
.scroll { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
.weekgrid { border-collapse: separate; border-spacing: 0; width: 100%; font-size: .85rem; }
.weekgrid th, .weekgrid td { padding: 2px; text-align: center; border-bottom: 1px solid var(--pink-light); }
.weekgrid td { min-width: 44px; }
.weekgrid th.rule { position: sticky; left: 0; z-index: 1; background: var(--card); text-align: left; width: 110px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; padding-right: 6px; }
.weekgrid .today { background: var(--pink-light); }
.daylink { background: transparent; color: var(--pink-dark); font-weight: 700; padding: 0; display: grid; line-height: 1.1; }
.daylink small { font-weight: 400; color: var(--text); }
@keyframes pop { 50% { transform: scale(1.35); } }
.star.pop { animation: pop .25s ease-out; }
@media (prefers-reduced-motion: reduce) { .star.pop { animation: none; } }
.star.mini { display: inline-block; width: 28px; height: 28px; font-size: 1.4rem; line-height: 28px; }
.totals td, .totals th { font-weight: 700; border-bottom: 0; }
.month { margin: 16px 0 6px; font-size: 1rem; color: var(--pink-dark); }
.month:first-child { margin-top: 0; }
.daycard { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; width: 100%; text-align: left; background: var(--pink-light); color: var(--text); padding: 10px 12px; margin-bottom: 8px; }
.daycard .meter, .daycard .muted { grid-column: 1 / -1; }
.daytotal { font-weight: 700; color: var(--pink-dark); }
.meter { height: 6px; border-radius: 999px; background: var(--card); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--gold); }
.muted { color: var(--muted); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { text-align: center; margin: 24px 0; }
