:root {
  --bg: #fbeaf3;
  --bg-2: #f3ecfb;
  --sky: #d7effc;
  --mint: #d6f3ea;
  --surface: #fffbfd;
  --ink: #3a2e3f;
  --muted: #6d5c72;
  --line: #f0d5e4;
  --pink: #e88bb0;
  --pink-deep: #c4517a;
  --lavender: #b9a7e0;
  --lilac-deep: #6b4ca0;
  --mint-deep: #2d8f7c;
  --sky-deep: #3e86c4;
  --bow: #ff6b8a;
  --fur: #e2a06a;
  --outline: #5c3a28;
  --shadow: 0 10px 28px rgba(140, 70, 110, 0.12);
  --radius: 22px;
  --font: "ui-rounded", "Hiragino Maru Gothic ProN", "SF Pro Rounded", "Nunito",
    system-ui, -apple-system, "Segoe UI", sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 420px at 10% -10%, var(--sky) 0%, transparent 55%),
    radial-gradient(900px 380px at 110% 8%, var(--mint) 0%, transparent 50%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.45;
}

body {
  min-height: 100dvh;
}

button,
input,
textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
}

h1,
h2,
h3 {
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0;
}

p {
  margin: 0;
}

.sparkle-bg {
  pointer-events: none;
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 12% 18%, #fff 0 1.5px, transparent 2.2px),
    radial-gradient(circle at 88% 12%, #fff8 0 1.5px, transparent 2.2px),
    radial-gradient(circle at 78% 74%, #ffe8f3 0 1.6px, transparent 2.3px),
    radial-gradient(circle at 18% 82%, #e8fff8 0 1.4px, transparent 2.1px);
  opacity: 0.9;
  z-index: 0;
}

.app {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  margin: 0 auto;
  padding: calc(16px + var(--safe-top)) 16px calc(28px + var(--safe-bottom));
  min-height: 100dvh;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--pink-deep);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.bow-dot {
  width: 12px;
  height: 10px;
  position: relative;
  flex: none;
}

.bow-dot::before,
.bow-dot::after {
  content: "";
  position: absolute;
  top: 1px;
  width: 7px;
  height: 7px;
  background: var(--bow);
  border: 1.5px solid var(--outline);
  border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%;
}

.bow-dot::before { left: 0; transform: rotate(-28deg); }
.bow-dot::after { right: 0; transform: rotate(28deg); }

h1 {
  font-size: 1.85rem;
  color: var(--ink);
}

.streak-pill {
  flex: none;
  background: #fff;
  border: 2px solid var(--outline);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.86rem;
  font-weight: 800;
  box-shadow: var(--shadow);
  white-space: nowrap;
}

.install-hint {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
  background: #fff;
  border: 2px solid var(--outline);
  border-radius: 18px;
  padding: 12px 14px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
  font-size: 0.92rem;
}

.install-hint[hidden] {
  display: none;
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid var(--outline);
  border-radius: 999px;
  padding: 5px;
  margin-bottom: 16px;
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  border-radius: 999px;
  min-height: 44px;
  font-weight: 800;
  color: var(--muted);
}

.tab.is-active {
  background: linear-gradient(180deg, #ffe3ef, #ffd0e3);
  color: var(--ink);
  border: 2px solid var(--outline);
}

.view[hidden] {
  display: none;
}

.hero-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.date-label {
  color: var(--muted);
  font-weight: 650;
  font-size: 0.95rem;
}

.progress-line {
  font-weight: 800;
  font-size: 1.15rem;
  margin: 2px 0 12px;
}

.bar {
  height: 12px;
  background: #fff;
  border: 2px solid var(--outline);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 14px;
}

.bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--pink), var(--lavender), #8ad7c8);
  width: 0%;
  transition: width 0.35s ease;
}

.btn {
  appearance: none;
  border: 2px solid var(--outline);
  border-radius: 16px;
  min-height: 52px;
  padding: 10px 16px;
  font-weight: 800;
  background: #fff;
  box-shadow: 0 3px 0 var(--outline);
  transition: transform 0.12s ease;
}

.btn:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 var(--outline);
}

.btn.primary {
  width: 100%;
  background: linear-gradient(180deg, #ffd6e6, #ffb3cc);
  margin-bottom: 14px;
}

.btn.primary:disabled {
  opacity: 0.55;
  box-shadow: none;
  transform: none;
  cursor: default;
}

.btn.tiny,
.text-btn {
  appearance: none;
  border: 0;
  background: none;
  min-height: 44px;
  padding: 0 6px;
  color: var(--lilac-deep);
  font-weight: 800;
  box-shadow: none;
}

.exercise-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  background: var(--surface);
  border: 2px solid var(--outline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.card.is-done {
  background: linear-gradient(180deg, #f3fffb, #e7f8f2);
}

.card-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 12px;
  background: none;
  border: 0;
  text-align: left;
  min-height: 72px;
}

.num {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 800;
  background: #ffe8f2;
  border: 2px solid var(--outline);
  flex: none;
}

.card.is-done .num {
  background: #c8f3e6;
}

.card-copy h3 {
  font-size: 1.05rem;
}

.dose {
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 650;
}

.check {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 2px solid var(--outline);
  background: #fff;
  display: grid;
  place-items: center;
  flex: none;
  padding: 0;
  box-shadow: 0 2px 0 var(--outline);
}

.check svg {
  width: 26px;
  height: 26px;
}

.card.is-done .check {
  background: #7ce0c4;
}

.card-body {
  border-top: 2px dashed #efcfe0;
  padding: 12px 14px 16px;
}

.card-body[hidden] {
  display: none;
}

.how-to {
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.timer {
  background: #f8f1ff;
  border: 2px solid var(--outline);
  border-radius: 16px;
  padding: 12px;
}

.timer-readout {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 800;
}

.timer-readout strong {
  font-size: 1.6rem;
  letter-spacing: -0.03em;
}

.timer-bar {
  height: 8px;
  background: #fff;
  border: 2px solid var(--outline);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 10px;
}

.timer-bar > span {
  display: block;
  height: 100%;
  background: var(--lilac-deep);
  width: 100%;
}

.timer-actions {
  display: flex;
  gap: 8px;
}

.timer-actions .btn {
  flex: 1;
  min-height: 44px;
  box-shadow: none;
}

.feel-card {
  margin-top: 16px;
  padding: 16px;
}

.feel-card h2 {
  font-size: 1.15rem;
  margin-bottom: 4px;
}

.feel-card .lede {
  color: var(--muted);
  margin-bottom: 12px;
}

.pain-chips {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  gap: 4px;
  margin-bottom: 12px;
}

.chip {
  appearance: none;
  border: 2px solid var(--outline);
  background: #fff;
  border-radius: 10px;
  min-height: 40px;
  padding: 0;
  font-weight: 800;
  font-size: 0.78rem;
}

.chip.is-on {
  background: #ffd0e3;
}

.note {
  width: 100%;
  min-height: 88px;
  border: 2px solid var(--outline);
  border-radius: 16px;
  padding: 10px 12px;
  resize: vertical;
  background: #fff;
  margin-bottom: 12px;
}

.note:focus,
.btn:focus-visible,
.tab:focus-visible,
.check:focus-visible,
.chip:focus-visible,
.card-head:focus-visible,
.text-btn:focus-visible {
  outline: 3px solid #8ab4ff;
  outline-offset: 2px;
}

.stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  padding: 14px;
  text-align: left;
}

.stat .label {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.stat .value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.1rem;
  margin: 8px 0 10px;
}

.heatmap {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 8px;
  padding: 12px;
  margin-bottom: 14px;
}

.dow {
  display: grid;
  grid-template-rows: repeat(7, 14px);
  gap: 4px;
  color: var(--muted);
  font-size: 0.65rem;
  font-weight: 700;
  align-items: center;
}

.heat-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(7, 14px);
  grid-auto-flow: column;
  gap: 4px;
}

.heat-cell {
  width: 100%;
  height: 14px;
  border-radius: 4px;
  background: #f3e1ec;
  border: 1px solid #efcfe0;
}

.heat-cell.partial { background: #ffd29a; border-color: var(--outline); }
.heat-cell.full { background: #7ce0c4; border-color: var(--outline); }
.heat-cell.future { background: transparent; border-color: transparent; }

.legend {
  display: flex;
  gap: 10px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  margin: -6px 0 16px;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  border: 1px solid var(--outline);
  display: inline-block;
}

.legend .none { background: #f3e1ec; border-color: #efcfe0; }
.legend .partial { background: #ffd29a; }
.legend .full { background: #7ce0c4; }

.badges {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.badge {
  padding: 12px;
  min-height: 132px;
}

.badge.locked {
  opacity: 0.62;
  filter: saturate(0.7);
}

.badge-icon {
  width: 42px;
  height: 42px;
  margin-bottom: 6px;
}

.badge h3 {
  font-size: 0.98rem;
  margin-bottom: 4px;
}

.badge p {
  color: var(--muted);
  font-size: 0.8rem;
}

.sessions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.session {
  padding: 12px 14px;
}

.session-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 800;
}

.tag {
  border-radius: 999px;
  border: 2px solid var(--outline);
  padding: 1px 8px;
  font-size: 0.72rem;
  background: #ffe8f2;
}

.tag.full { background: #c8f3e6; }

.session .meta {
  color: var(--muted);
  font-size: 0.86rem;
  margin-top: 4px;
}

.empty {
  text-align: center;
  padding: 18px 12px 8px;
}

.empty .mascot {
  margin: 0 auto 8px;
}

.empty p {
  color: var(--muted);
}

.disclaimer {
  margin-top: 22px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
  line-height: 1.4;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(18px + var(--safe-bottom));
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 700;
  z-index: 20;
  max-width: calc(100% - 32px);
  box-shadow: var(--shadow);
}

.toast[hidden] {
  display: none;
}

.mascot svg {
  display: block;
  width: 100%;
  height: 100%;
}

.mascot-sm { width: 58px; height: 58px; flex: none; }
.mascot-md { width: 88px; height: 88px; }
.mascot-lg { width: 132px; height: 132px; margin: 0 auto; }

.celebrate {
  position: fixed;
  inset: 0;
  background: rgba(58, 46, 63, 0.35);
  display: grid;
  place-items: center;
  z-index: 30;
  padding: 20px;
}

.celebrate[hidden] {
  display: none;
}

.celebrate-card {
  position: relative;
  width: min(340px, 100%);
  background: linear-gradient(180deg, #fff8fd, #ffe9f3);
  border: 3px solid var(--outline);
  border-radius: 28px;
  padding: 22px 18px 18px;
  text-align: center;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.speed-lines {
  position: absolute;
  inset: -10%;
  background: repeating-conic-gradient(from 0deg, transparent 0 12deg, rgba(255, 255, 255, 0.45) 12deg 13deg);
  opacity: 0.55;
  pointer-events: none;
  animation: spin 18s linear infinite;
}

.celebrate-kicker {
  position: relative;
  color: var(--pink-deep);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.75rem;
}

.celebrate-card h2 {
  position: relative;
  font-size: 1.7rem;
  margin: 4px 0 8px;
}

.celebrate-card p {
  position: relative;
  color: var(--muted);
  margin-bottom: 14px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .speed-lines { animation: none; }
  .btn, .bar > span { transition: none; }
}

.card-copy {
  background: transparent;
  border: 0;
  box-shadow: none;
  padding: 0;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.pin-gate {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: calc(16px + var(--safe-top)) 16px calc(16px + var(--safe-bottom));
  background:
    radial-gradient(900px 420px at 10% -10%, var(--sky) 0%, transparent 55%),
    radial-gradient(800px 380px at 110% 8%, var(--mint) 0%, transparent 50%),
    var(--bg);
}

.pin-gate[hidden] {
  display: none;
}

.pin-card {
  width: min(360px, 100%);
  background: var(--surface);
  border: 3px solid var(--outline);
  border-radius: 28px;
  padding: 22px 18px 18px;
  text-align: center;
  box-shadow: var(--shadow);
}

.pin-card h2 {
  font-size: 1.7rem;
  margin: 2px 0 6px;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin: 16px 0 18px;
}

.pin-dots span {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--outline);
  background: #fff;
}

.pin-dots span.is-on {
  background: var(--bow);
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pin-pad .btn {
  min-height: 60px;
  font-size: 1.35rem;
  box-shadow: 0 3px 0 var(--outline);
}

.pin-pad .btn.is-ghost {
  background: #f8eef5;
  font-size: 0.85rem;
}

.pin-error {
  color: var(--pink-deep);
  font-weight: 800;
  margin: 12px 0 0;
  min-height: 1.2em;
}

.pin-error[hidden] {
  display: none;
}

.pin-card.is-wrong {
  animation: pin-shake 0.4s ease;
}

@keyframes pin-shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

@media (prefers-reduced-motion: reduce) {
  .pin-card.is-wrong { animation: none; }
}
