/* Always the bright theme: she asked for nothing dark, so there is no dark mode on purpose. */
:root {
  color-scheme: light;
  --ink: #3B2A55;
  --ink-2: #67558A;
  --muted: #8E7CA8;
  --card: rgba(255, 255, 255, 0.78);
  --card-line: rgba(255, 255, 255, 0.9);
  --coral: #FF6F91;
  --orange: #FF9671;
  --sun: #FFC75F;
  --teal: #2BB3A3;
  --lilac: #9D7BFF;
  --sky: #4EA8FF;
  --bar: #EE4D78;
  --grid: rgba(59, 42, 85, 0.10);
  --bg: linear-gradient(165deg, #FFE3D3 0%, #FFD3E5 48%, #E2D6FF 100%);
  --radius: 22px;
  --font: "Nunito", ui-rounded, "Segoe UI Rounded", "SF Pro Rounded", system-ui, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: #FFE3D3 var(--bg) fixed;
  color: var(--ink);
  font-family: var(--font);
  font-weight: 700;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, label { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }

.view {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 16px calc(env(safe-area-inset-bottom) + 24px);
}

/* ---------- header ---------- */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.top h1 { margin: 0; font-size: 1.45rem; font-weight: 900; letter-spacing: -0.01em; }
.hist .top h1 { flex: 1; text-align: center; }
.spacer { width: 84px; }
.pill-link {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--card-line);
  color: var(--ink); text-decoration: none; font-weight: 800; font-size: 0.95rem;
  box-shadow: 0 4px 14px rgba(238, 77, 120, 0.12);
}
.pill-link svg { width: 18px; height: 18px; fill: none; stroke: var(--coral); stroke-width: 2.6; stroke-linecap: round; }
.back { width: 84px; justify-content: center; }

/* ---------- home ---------- */
.home { min-height: 100dvh; display: flex; flex-direction: column; align-items: center; text-align: center; }
.home .top { width: 100%; }
.hint { margin: 10px 0 0; color: var(--ink-2); font-size: 1.05rem; min-height: 1.5em; }

.stage { flex: 1; display: grid; place-items: center; width: 100%; padding: 18px 0 8px; min-height: 300px; }
.kick {
  --size: min(76vw, 44dvh, 340px);
  position: relative; width: var(--size); height: var(--size);
  border: 0; border-radius: 50%; padding: 0; overflow: hidden;
  color: #fff;
  background:
    radial-gradient(circle at 32% 26%, rgba(255,255,255,0.55) 0 8%, transparent 32%),
    radial-gradient(circle at 50% 50%, #FFA27E 0%, #FF7A95 55%, #F2557F 100%);
  box-shadow:
    0 0 0 10px rgba(255, 255, 255, 0.55),
    0 0 0 22px rgba(255, 111, 145, 0.16),
    0 22px 44px rgba(238, 77, 120, 0.38);
  transition: transform 0.12s ease;
  animation: breathe 3.2s ease-in-out infinite;
  user-select: none; -webkit-user-select: none;
}
.kick.counting { animation: none; }
.kick:active { transform: scale(0.96); }
.kick.pop { animation: pop 0.38s cubic-bezier(.3, 1.6, .5, 1); }
.kick:focus-visible { outline: 4px solid var(--lilac); outline-offset: 26px; }
.kick-face { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 4px; }
.foot { width: 34%; fill: #fff; filter: drop-shadow(0 4px 8px rgba(160, 30, 70, 0.25)); transform: rotate(-8deg); }
.count { font-size: calc(var(--size) * 0.40); line-height: 1; font-weight: 900; text-shadow: 0 6px 18px rgba(160, 30, 70, 0.28); font-variant-numeric: tabular-nums; }
.sub { font-size: calc(var(--size) * 0.075); font-weight: 800; opacity: 0.96; }
.ripple {
  position: absolute; border-radius: 50%; pointer-events: none;
  background: rgba(255, 255, 255, 0.55); transform: scale(0);
  animation: ripple 0.6s ease-out forwards;
}
@keyframes breathe { 50% { transform: scale(1.035); } }
@keyframes pop { 0% { transform: scale(0.9); } 60% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes ripple { to { transform: scale(2.6); opacity: 0; } }

.dots { display: flex; gap: 9px; justify-content: center; margin: 18px 0 4px; flex-wrap: wrap; }
.dot { width: 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,0.7); border: 2px solid rgba(255,255,255,0.95); transition: transform 0.25s, background 0.25s; }
.dot.on { border-color: #fff; transform: scale(1.15); box-shadow: 0 3px 8px rgba(59, 42, 85, 0.18); }

.meta { display: flex; gap: 12px; margin-top: 14px; width: 100%; max-width: 380px; }
.meta > div { flex: 1; background: var(--card); border: 1px solid var(--card-line); border-radius: 18px; padding: 10px 8px; display: flex; flex-direction: column; }
.label { font-size: 0.8rem; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.big { font-size: 1.35rem; font-weight: 900; font-variant-numeric: tabular-nums; }

.note {
  margin-top: 14px; max-width: 380px; padding: 12px 14px; border-radius: 16px;
  background: #FFF4D6; border: 1px solid #FFE3A0; color: #6A4A12; font-size: 0.95rem; text-align: left;
}
.actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; justify-content: center; }
.ghost {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 11px 18px; border-radius: 999px; border: 1px solid var(--card-line);
  background: var(--card); font-weight: 800; color: var(--ink-2); min-height: 44px;
}
.last { margin: 18px 0 0; color: var(--ink-2); font-size: 0.98rem; min-height: 1.4em; }

/* ---------- history ---------- */
.chips { display: flex; gap: 8px; justify-content: center; margin: 12px 0 14px; }
.chips button {
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--card-line);
  background: rgba(255,255,255,0.5); font-weight: 800; color: var(--ink-2); min-height: 40px;
}
.chips button[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 12px; }
.tile { background: var(--card); border: 1px solid var(--card-line); border-radius: 18px; padding: 12px 14px; }
.tile .v { display: block; font-size: 1.6rem; font-weight: 900; line-height: 1.15; font-variant-numeric: tabular-nums; }
.tile .k { font-size: 0.85rem; color: var(--muted); font-weight: 800; }
.tile .tag { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: 1px; }

.card { background: var(--card); border: 1px solid var(--card-line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; box-shadow: 0 8px 26px rgba(157, 123, 255, 0.12); }
.card h2 { margin: 0; font-size: 1.1rem; font-weight: 900; }
.card-sub { margin: 2px 0 10px; color: var(--muted); font-size: 0.88rem; }

.chart { position: relative; width: 100%; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis { fill: var(--muted); font-size: 11px; font-weight: 700; font-family: var(--font); }
.chart .avg-label { fill: var(--ink); font-size: 11px; font-weight: 900; font-family: var(--font); paint-order: stroke; stroke: #FFF6FA; stroke-width: 4px; stroke-linejoin: round; }
.chart .bar { fill: var(--bar); transition: opacity 0.15s; }
.chart.focus .bar { opacity: 0.35; }
.chart.focus .bar.hot { opacity: 1; }
.tip {
  position: absolute; pointer-events: none; transform: translate(-50%, -100%);
  background: var(--ink); color: #fff; padding: 7px 10px; border-radius: 12px;
  font-size: 0.85rem; white-space: nowrap; box-shadow: 0 6px 16px rgba(59,42,85,0.3);
}
.tip b { font-weight: 900; }
.empty { color: var(--muted); text-align: center; padding: 22px 8px; margin: 0; }

.day { margin: 14px 0 6px; font-size: 0.82rem; color: var(--muted); font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em; }
.day:first-child { margin-top: 8px; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid rgba(59,42,85,0.07); }
.day + .row { border-top: 0; }
.row .when { width: 72px; color: var(--ink-2); font-variant-numeric: tabular-nums; font-size: 0.95rem; }
.row .what { flex: 1; }
.row .what small { display: block; color: var(--muted); font-size: 0.82rem; }
.row .del { border: 0; background: none; color: var(--muted); font-size: 1.1rem; width: 40px; height: 40px; border-radius: 50%; }
.row .del:active { background: rgba(59,42,85,0.08); }
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; background: rgba(43,179,163,0.14); color: #17766C; font-size: 0.78rem; font-weight: 900; margin-left: 4px; }
.badge.early { background: rgba(157,123,255,0.16); color: #5B3FC4; }

.backup { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-top: 18px; }
.file { position: relative; overflow: hidden; cursor: pointer; }
.file input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.fine { width: 100%; text-align: center; color: var(--muted); font-size: 0.85rem; margin: 4px 0 0; }
.sync.warn { color: #6A4A12; background: #FFF4D6; border: 1px solid #FFE3A0; border-radius: 14px; padding: 10px 12px; }

/* ---------- overlays ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px;
  background: rgba(59, 42, 85, 0.28); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fade 0.2s ease;
}
.sheet {
  width: 100%; max-width: 380px; background: #fff; border-radius: 28px; padding: 22px 20px;
  box-shadow: 0 24px 60px rgba(59, 42, 85, 0.3); text-align: center; animation: rise 0.3s cubic-bezier(.3,1.4,.5,1);
}
.sheet h2 { margin: 0 0 6px; font-size: 1.35rem; font-weight: 900; }
.sheet p { margin: 0 0 16px; color: var(--ink-2); }
.ask-buttons { display: flex; flex-direction: column; gap: 8px; }
.primary {
  border: 0; border-radius: 999px; padding: 14px 20px; min-height: 50px; width: 100%;
  background: linear-gradient(90deg, var(--orange), var(--coral)); color: #fff; font-weight: 900; font-size: 1.05rem;
  box-shadow: 0 8px 20px rgba(238, 77, 120, 0.35);
}
.ask-buttons .ghost { width: 100%; background: #F6F1FF; border-color: #EDE4FF; }
.ask-buttons .danger { color: #B3264E; }
.party { background: linear-gradient(170deg, #FFF8EC, #FFFFFF 50%, #F6F0FF); }
.party-emoji { font-size: 3.4rem; line-height: 1; margin-bottom: 6px; animation: wiggle 1s ease-in-out infinite; }
.party-text { font-size: 1.1rem; }
@keyframes fade { from { opacity: 0; } }
@keyframes rise { from { transform: translateY(24px) scale(0.96); opacity: 0; } }
@keyframes wiggle { 50% { transform: rotate(-10deg) scale(1.1); } }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 30; overflow: hidden; }
.bit { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 3px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); } }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%); z-index: 40;
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 0.95rem;
  box-shadow: 0 8px 20px rgba(59,42,85,0.3);
}

@media (prefers-reduced-motion: reduce) {
  .kick, .party-emoji { animation: none !important; }
  .bit { display: none; }
}
@media (max-height: 640px) {
  .stage { min-height: 240px; padding-top: 8px; }
  .dots { margin-top: 10px; }
}
