/* =========================================================
   free time: a tiny date-planning page
   Built iPhone first. Motion uses transform and opacity only,
   so it stays smooth on a phone.
   ========================================================= */

:root {
  color-scheme: light;

  /* ink */
  --ink: #3a1d4d;
  --ink-soft: #5f4670;
  --line: #f1e3f7;

  /* surfaces */
  --surface: rgba(255, 255, 255, 0.84);
  --planner-bg: #fff0f6;

  /* brand (white text passes 4.5:1 on both ends of the gradient) */
  --pink: #e0246e;
  --violet: #8a3ffc;
  --danger: #c2185b;
  --grad: linear-gradient(135deg, #e0246e 0%, #8a3ffc 100%);

  /* elevation */
  --shadow-sm: 0 4px 14px -6px rgba(58, 29, 77, 0.18);
  --shadow-md: 0 14px 34px -16px rgba(58, 29, 77, 0.3);
  --shadow-up: 0 -14px 44px -10px rgba(58, 29, 77, 0.3);
  --shadow-pink: 0 12px 26px -10px rgba(224, 36, 110, 0.7);

  /* shape */
  --r-sm: 14px;
  --r-md: 22px;
  --r-lg: 30px;
  --r-pill: 999px;

  /* motion */
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-in: cubic-bezier(0.5, 0, 0.75, 0);

  /* iPhone safe areas (notch, Dynamic Island, home bar) */
  --sat: env(safe-area-inset-top, 0px);
  --sar: env(safe-area-inset-right, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);

  --font: "Fredoka", ui-rounded, "SF Pro Rounded", "Arial Rounded MT Bold",
    system-ui, -apple-system, "Segoe UI", sans-serif;
}

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

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  background: var(--page, #fff1e6);
  transition: background-color 1.2s ease;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  touch-action: manipulation;
}

body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1,
h2,
p,
ul {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

button {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

button:disabled {
  cursor: default;
}

:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 3px;
}

.sheet:focus,
h1:focus {
  outline: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- the phone ---------- */
.phone {
  /* colour themes, swapped by data-theme */
  --bg: #fff1e6;
  --c1: #ffb199;
  --c2: #ffd76e;
  --c3: #ff9ecb;
  --c4: #ffc2a8;

  position: fixed;
  inset: 0;
  overflow: hidden;
  isolation: isolate;
  background-color: var(--bg);
  transition: background-color 1.2s ease;
}

.phone[data-theme="pink"]    { --bg: #ffe6f0; --c1: #ff8fb8; --c2: #ffc46b; --c3: #c79bff; --c4: #ff9aa2; }
.phone[data-theme="lilac"]   { --bg: #f1e8ff; --c1: #c3a2ff; --c2: #ff9ecb; --c3: #8fd3ff; --c4: #e0b3ff; }
.phone[data-theme="blue"]    { --bg: #e6f3ff; --c1: #8fc8ff; --c2: #c3a2ff; --c3: #9be8d8; --c4: #b3d4ff; }
.phone[data-theme="mint"]    { --bg: #e6fbf4; --c1: #7fe6c8; --c2: #ffe27a; --c3: #8fd3ff; --c4: #b6f0a8; }
.phone[data-theme="sun"]     { --bg: #fff6dc; --c1: #ffd45e; --c2: #ff9ecb; --c3: #ffab7a; --c4: #c79bff; }
.phone[data-theme="planner"] { --bg: #fff0f6; --c1: #ffb3d1; --c2: #ffe08a; --c3: #cdb4ff; --c4: #a8e6ff; }
.phone[data-theme="party"]   { --bg: #ffe9f3; --c1: #ff8fb8; --c2: #ffd45e; --c3: #b58cff; --c4: #7fe6c8; }

/* ---------- moving colour ---------- */
.sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  width: 95%;
  aspect-ratio: 1;
  border-radius: 50%;
  -webkit-mask-image: radial-gradient(closest-side, #000 0%, rgba(0, 0, 0, 0.55) 45%, transparent 100%);
  mask-image: radial-gradient(closest-side, #000 0%, rgba(0, 0, 0, 0.55) 45%, transparent 100%);
  transition: background-color 1.4s ease, opacity 1s ease;
  will-change: transform;
}

.b1 { background-color: var(--c1); top: -18%; left: -32%; animation: drift-a 17s ease-in-out infinite alternate; }
.b2 { background-color: var(--c2); top: 14%; right: -46%; animation: drift-b 21s ease-in-out infinite alternate; }
.b3 { background-color: var(--c3); bottom: -14%; left: -38%; animation: drift-c 19s ease-in-out infinite alternate; }
.b4 { background-color: var(--c4); bottom: 12%; right: -28%; width: 70%; animation: drift-a 25s ease-in-out infinite alternate-reverse; }

.phone[data-theme="planner"] .blob {
  opacity: 0.6;
}

@keyframes drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(22%, 14%, 0) scale(1.18); }
}
@keyframes drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.1); }
  to   { transform: translate3d(-26%, 18%, 0) scale(0.9); }
}
@keyframes drift-c {
  from { transform: translate3d(0, 0, 0) scale(0.95); }
  to   { transform: translate3d(24%, -20%, 0) scale(1.2); }
}

/* floating hearts */
.hearts {
  position: absolute;
  inset: 0;
  transition: opacity 0.6s ease;
}

/* the planner stays calm: hearts are for the intro and the finale */
.phone[data-theme="planner"] .hearts {
  opacity: 0;
}

.heart {
  position: absolute;
  left: var(--x);
  bottom: -56px;
  font-size: var(--size);
  line-height: 1;
  opacity: 0;
  animation: float-up var(--dur) linear forwards;
  will-change: transform, opacity;
}

@keyframes float-up {
  0% {
    opacity: 0;
    transform: translate3d(0, 0, 0) rotate(0deg) scale(0.6);
  }
  12% {
    opacity: 0.9;
    transform: translate3d(calc(var(--drift) * 0.15), calc(var(--rise) * 0.12), 0) rotate(calc(var(--rot) * 0.12)) scale(1);
  }
  85% {
    opacity: 0.75;
  }
  100% {
    opacity: 0;
    transform: translate3d(var(--drift), var(--rise), 0) rotate(var(--rot)) scale(1);
  }
}

/* ---------- screens ---------- */
.screen {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(0, 28px, 0) scale(0.97);
  transition: opacity 0.3s ease, transform 0.3s var(--ease-in), visibility 0s linear 0.3s;
}

/* a screen you already moved past leaves upward */
.screen.is-past {
  transform: translate3d(0, -28px, 0) scale(0.97);
}

.screen.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.5s ease 0.12s, transform 0.7s var(--ease-out) 0.12s, visibility 0s;
}

/* ---------- buttons ---------- */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 0 28px;
  border-radius: var(--r-pill);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.005em;
  white-space: nowrap;
  transition: transform 0.2s var(--ease-spring), box-shadow 0.25s ease, opacity 0.25s ease, filter 0.25s ease;
}

.btn:active:not(:disabled) {
  transform: scale(0.95);
}

.btn.block {
  display: flex;
  width: 100%;
}

.btn.primary {
  color: #fff;
  background: var(--grad);
  box-shadow: var(--shadow-pink), inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

/* stays solid and readable: the label says what to do next */
.btn.primary:disabled {
  background: #eadff2;
  color: var(--ink-soft);
  box-shadow: inset 0 0 0 2px #dccbe8;
}

.btn.ghost {
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--line), var(--shadow-sm);
}

.btn.link {
  min-height: 44px;
  padding: 0 16px;
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* soft ring that pulses out of the intro button */
.btn.glow::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: 0 0 0 3px rgba(224, 36, 110, 0.55);
  pointer-events: none;
  animation: ring 1.8s ease-out infinite;
}

@keyframes ring {
  0%   { opacity: 0.75; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.16, 1.5); }
}

.btn.nudge {
  animation: nudge 0.5s ease;
}

@keyframes nudge {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25%      { transform: rotate(-4deg) scale(1.06); }
  60%      { transform: rotate(4deg) scale(1.06); }
}

/* =========================================================
   1 · intro
   ========================================================= */
.intro {
  display: flex;
  flex-direction: column;
  padding: calc(var(--sat) + 14px) calc(var(--sar) + 22px) calc(var(--sab) + 18px) calc(var(--sal) + 22px);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

/* story-style progress */
.bars {
  display: flex;
  gap: 5px;
}

.bar {
  flex: 1;
  height: 4px;
  overflow: hidden;
  border-radius: 4px;
  background: rgba(58, 29, 77, 0.15);
}

.bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--ink);
  opacity: 0.78;
  transform: scaleX(0);
  transform-origin: 0 50%;
}

.skip {
  align-self: flex-end;
  min-width: 44px;
  min-height: 44px;
  margin: 6px -12px 0 0;
  padding: 0 14px;
  border-radius: var(--r-pill);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: transform 0.2s var(--ease-spring);
}

.skip:active {
  transform: scale(0.92);
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

.noscript {
  padding-top: 40%;
  text-align: center;
  font-size: 20px;
  font-weight: 600;
}

.scene {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding-bottom: 6%;
  text-align: center;
  transition: opacity 0.3s ease, transform 0.36s var(--ease-in);
}

.scene.out {
  opacity: 0;
  transform: translate3d(0, -40px, 0) scale(0.9);
  pointer-events: none;
}

.scene-emoji {
  font-size: 76px;
  line-height: 1;
  animation: pop 0.6s var(--ease-spring) both;
  animation-delay: 80ms;
}

.scene-emoji span {
  display: inline-block;
  animation: bob 2.8s ease-in-out infinite;
}

@keyframes bob {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-4deg); }
  50%      { transform: translate3d(0, -10px, 0) rotate(5deg); }
}

.scene-text {
  font-size: clamp(32px, 10vw, 44px);
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.scene-text.big {
  font-size: clamp(44px, 14vw, 62px);
}

.line {
  display: block;
}

/* every word pops in, one after another */
.w {
  --tilt: 0deg;
  display: inline-block;
  white-space: nowrap;
  opacity: 0;
  transform-origin: 50% 80%;
  animation: pop 0.52s var(--ease-spring) both;
  animation-delay: calc(var(--i) * 105ms + 280ms);
  will-change: transform, opacity;
}

@keyframes pop {
  0% {
    opacity: 0;
    transform: translate3d(0, 0.55em, 0) scale(0.3) rotate(-10deg);
  }
  55% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: rotate(var(--tilt, 0deg));
  }
}

/* highlighted words sit on a little sticker */
.w.hl {
  --tilt: -2.5deg;
  margin: 0.1em 0;
  padding: 0.02em 0.32em 0.08em;
  border-radius: 0.42em;
  background: #fff;
  color: var(--pink);
  box-shadow: 0 0.12em 0.4em -0.1em rgba(58, 29, 77, 0.3);
}

/* the loud word slams in, then its letters keep bouncing */
.w.shout {
  display: inline-flex;
  margin: 0.06em 0 0.02em;
  font-size: 1.52em;
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.01em;
  animation-name: slam;
  animation-duration: 0.7s;
  animation-timing-function: var(--ease-out);
}

@keyframes slam {
  0%   { opacity: 0; transform: scale(2.8) rotate(-12deg); }
  50%  { opacity: 1; transform: scale(0.88) rotate(3deg); }
  72%  { transform: scale(1.07) rotate(-2deg); }
  100% { opacity: 1; transform: none; }
}

.ch {
  display: inline-block;
  color: var(--col);
  text-shadow: 0 0.045em 0 #fff, 0 0.09em 0 rgba(58, 29, 77, 0.12), 0 0.16em 0.3em rgba(58, 29, 77, 0.18);
  animation: jump 1.5s ease-in-out infinite;
  animation-delay: calc(var(--k) * 80ms + var(--after, 0ms));
}

@keyframes jump {
  0%, 55%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  20%           { transform: translate3d(0, -0.2em, 0) rotate(-5deg); }
  36%           { transform: translate3d(0, 0.03em, 0) rotate(3deg) scale(1.04, 0.94); }
}

.cta-pop {
  margin-top: 14px;
  opacity: 0;
  animation: pop 0.6s var(--ease-spring) both;
  animation-delay: calc(var(--i) * 105ms + 480ms);
}

.tap-hint {
  align-self: center;
  min-height: 44px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink-soft);
  animation: breathe 2.2s ease-in-out infinite;
  transition: opacity 0.3s ease;
}

.tap-hint.is-hidden {
  opacity: 0;
  visibility: hidden;
  animation: none;
}

@keyframes breathe {
  0%, 100% { opacity: 0.6; }
  50%      { opacity: 1; }
}

/* =========================================================
   2 · planner
   ========================================================= */
.scroll {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: calc(var(--sat) + 22px) calc(var(--sar) + 18px) calc(var(--sab) + 118px) calc(var(--sal) + 18px);
}

.scroll.is-locked {
  overflow: hidden;
}

.scroll > * {
  flex: none;
  width: 100%;
  max-width: 430px;
  margin-inline: auto;
}

.planner.is-active .rise {
  animation: rise 0.7s var(--ease-out) backwards;
  animation-delay: calc(var(--n) * 80ms + 200ms);
}

@keyframes rise {
  from { opacity: 0; transform: translate3d(0, 26px, 0); }
}

.eyebrow {
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: var(--ink-soft);
}

.head {
  padding: 0 4px;
}

.head h1 {
  margin: 2px 0 8px;
  font-size: 38px;
  font-weight: 700;
  line-height: 1.08;
  letter-spacing: -0.015em;
}

.grad {
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

.sub {
  max-width: 30ch;
  font-size: 17px;
}

.card {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md), inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

/* calendar */
.cal {
  padding: 14px 12px;
}

.cal-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 8px;
}

.cal-top h2 {
  font-size: 20px;
  font-weight: 600;
}

.nav {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--line);
  transition: transform 0.2s var(--ease-spring), opacity 0.2s ease;
}

.nav:active:not(:disabled) {
  transform: scale(0.88);
}

.nav:disabled {
  opacity: 0.3;
}

.dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 4px 0 6px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.grid {
  --dx: 0px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.blank {
  aspect-ratio: 1;
}

.day {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  font-size: 18px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  transition: color 0.22s ease, box-shadow 0.25s ease, transform 0.2s var(--ease-spring);
  animation: cell-in 0.42s var(--ease-out) backwards;
  animation-delay: calc(var(--i) * 11ms);
}

@keyframes cell-in {
  from { opacity: 0; transform: translate3d(var(--dx), 6px, 0) scale(0.7); }
}

/* gradient fill grows in when a day is picked */
.day::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 50%;
  background: var(--grad);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.2s ease, transform 0.38s var(--ease-spring);
}

/* little dot = this day has times on it */
.day::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 13%;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  border-radius: 50%;
  background: #fff;
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.2s ease, transform 0.3s var(--ease-spring);
}

.day:active:not(:disabled) {
  transform: scale(0.86);
}

.day:disabled {
  background: transparent;
  color: var(--ink-soft);
  opacity: 0.38;
}

.day.is-today {
  box-shadow: inset 0 0 0 2px var(--pink);
}

.day.is-selected {
  color: #fff;
  font-weight: 600;
  box-shadow: 0 8px 16px -6px rgba(224, 36, 110, 0.65);
}

.day.is-selected::before {
  opacity: 1;
  transform: none;
}

.day.has-times::after {
  opacity: 1;
  transform: none;
}

/* picked days */
.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 6px 10px;
  font-size: 20px;
  font-weight: 600;
}

.count {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.count.bump {
  animation: bump 0.4s var(--ease-spring);
}

@keyframes bump {
  0%, 100% { transform: scale(1); }
  40%      { transform: scale(1.35); }
}

.empty {
  padding: 18px;
  border: 2px dashed rgba(58, 29, 77, 0.24);
  border-radius: var(--r-md);
  text-align: center;
  font-size: 16px;
  color: var(--ink-soft);
}

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

.item {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 8px 4px 8px 8px;
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-sm), inset 0 0 0 1px rgba(255, 255, 255, 0.7);
}

.item.is-new {
  animation: item-in 0.5s var(--ease-spring) backwards;
}

.item.is-leaving {
  pointer-events: none;
  animation: item-out 0.22s var(--ease-in) forwards;
}

@keyframes item-in {
  from { opacity: 0; transform: translate3d(0, 14px, 0) scale(0.9); }
}

@keyframes item-out {
  to { opacity: 0; transform: translate3d(30px, 0, 0) scale(0.92); }
}

.item-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  min-height: 56px;
  border-radius: 18px;
  text-align: left;
  transition: transform 0.2s var(--ease-spring);
}

.item-main:active {
  transform: scale(0.98);
}

.badge {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 56px;
  border-radius: 17px;
  background: var(--g, var(--grad));
  color: #fff;
  line-height: 1;
  box-shadow: 0 6px 12px -6px rgba(58, 29, 77, 0.45);
}

.badge small {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.badge b {
  margin-top: 3px;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* four badge colours, all dark enough for white text */
.item:nth-child(4n + 1) { --g: linear-gradient(135deg, #e0246e, #b5179e); }
.item:nth-child(4n + 2) { --g: linear-gradient(135deg, #8a3ffc, #4c63e6); }
.item:nth-child(4n + 3) { --g: linear-gradient(135deg, #0a8069, #1971c2); }
.item:nth-child(4n + 4) { --g: linear-gradient(135deg, #cf4410, #e0246e); }

.item-body {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.item-body strong {
  font-size: 17px;
  font-weight: 600;
  line-height: 1.2;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.pill {
  padding: 3px 10px;
  border-radius: var(--r-pill);
  background: #fff;
  box-shadow: inset 0 0 0 1.5px var(--line);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.4;
  white-space: nowrap;
}

.pill.any {
  background: #fff4cc;
  box-shadow: inset 0 0 0 1.5px #ffd966;
}

.item-x {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  color: var(--ink-soft);
  transition: transform 0.2s var(--ease-spring), background-color 0.2s ease;
}

.item-x:active {
  transform: scale(0.85);
  background: rgba(58, 29, 77, 0.08);
}

/* note */
.note {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 16px 14px;
}

.note label {
  font-size: 17px;
  font-weight: 600;
}

textarea {
  display: block;
  width: 100%;
  min-height: 68px;
  margin: 0;
  padding: 10px 12px;
  resize: none;
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  font: inherit;
  font-size: 17px;
  line-height: 1.35;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea::placeholder {
  color: #7d6a8a;
  opacity: 1;
}

textarea:focus,
input[type="time"]:focus {
  outline: none;
  border-color: var(--violet);
  box-shadow: 0 0 0 4px rgba(138, 63, 252, 0.18);
}

/* send bar, pinned above the home indicator */
.cta-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 5;
  padding: 28px calc(var(--sar) + 18px) calc(var(--sab) + 16px) calc(var(--sal) + 18px);
  background: linear-gradient(to top, #fff0f6 0%, #fff0f6 50%, rgba(255, 240, 246, 0) 100%);
  pointer-events: none;
}

.cta-bar .btn {
  max-width: 430px;
  margin-inline: auto;
  pointer-events: auto;
}

/* =========================================================
   day sheet
   ========================================================= */
.backdrop {
  position: absolute;
  inset: 0;
  z-index: 20;
  background: rgba(40, 16, 56, 0.5);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0s linear 0.3s;
}

.backdrop.is-open {
  opacity: 1;
  visibility: visible;
  transition: opacity 0.35s ease, visibility 0s;
}

.sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  max-width: 520px;
  max-height: 94%;
  margin-inline: auto;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  padding: 0 calc(var(--sar) + 20px) calc(var(--sab) + 18px) calc(var(--sal) + 20px);
  border-radius: 34px 34px 0 0;
  background: #fff;
  box-shadow: var(--shadow-up);
  visibility: hidden;
  transform: translate3d(0, 104%, 0);
  transition: transform 0.3s var(--ease-in), visibility 0s linear 0.3s;
}

.sheet.is-open {
  visibility: visible;
  transform: none;
  transition: transform 0.5s var(--ease-out), visibility 0s;
}

.sheet.is-dragging {
  transition: none;
}

.sheet-grab {
  padding: 10px 0 4px;
  text-align: center;
  touch-action: none;
  cursor: grab;
}

.grabber {
  display: block;
  width: 44px;
  height: 5px;
  margin: 0 auto 14px;
  border-radius: 5px;
  background: rgba(58, 29, 77, 0.22);
}

.sheet h2 {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.01em;
}

.sheet-q {
  margin: 16px 2px 10px;
  font-size: 16px;
  font-weight: 600;
  color: var(--ink-soft);
}

.chips {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.chip {
  position: relative;
  isolation: isolate;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 1px;
  min-height: 60px;
  padding: 8px 14px;
  overflow: hidden;
  border-radius: 20px;
  background: #fff;
  box-shadow: inset 0 0 0 2px var(--line);
  text-align: left;
  transition: transform 0.2s var(--ease-spring), color 0.2s ease, box-shadow 0.25s ease;
}

.chip::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--grad);
  opacity: 0;
  transition: opacity 0.22s ease;
}

.chip:active {
  transform: scale(0.95);
}

.chip b {
  font-size: 17px;
  font-weight: 600;
}

.chip small {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  transition: color 0.2s ease;
}

.chip.wide {
  grid-column: 1 / -1;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  min-height: 52px;
}

.chip[aria-pressed="true"] {
  color: #fff;
  box-shadow: 0 10px 18px -10px rgba(224, 36, 110, 0.8);
}

.chip[aria-pressed="true"]::before {
  opacity: 1;
}

.chip[aria-pressed="true"] small {
  color: #fff;
}

/* tick so "selected" is not shown by colour alone */
.tick {
  position: absolute;
  top: 8px;
  right: 8px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  color: var(--pink);
  opacity: 0;
  transform: scale(0);
  transition: opacity 0.2s ease, transform 0.3s var(--ease-spring);
}

.tick svg {
  width: 12px;
  height: 12px;
}

.chip.wide .tick {
  top: 50%;
  right: 14px;
  margin-top: -10px;
}

.chip[aria-pressed="true"] .tick {
  opacity: 1;
  transform: none;
}

.custom {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  align-items: end;
  gap: 6px;
}

.custom.shake {
  animation: shake 0.4s ease;
}

@keyframes shake {
  0%, 100% { transform: translate3d(0, 0, 0); }
  20%      { transform: translate3d(-7px, 0, 0); }
  40%      { transform: translate3d(6px, 0, 0); }
  60%      { transform: translate3d(-4px, 0, 0); }
  80%      { transform: translate3d(3px, 0, 0); }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.field span {
  padding-left: 4px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-soft);
}

input[type="time"] {
  display: block;
  width: 100%;
  min-width: 0;
  height: 50px;
  margin: 0;
  padding: 0 6px;
  border: 2px solid var(--line);
  border-radius: var(--r-sm);
  background: #fbf7ff;
  font: inherit;
  font-size: 17px;
  font-weight: 500;
  color: var(--ink);
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input[type="time"]::-webkit-date-and-time-value {
  text-align: center;
}

.btn.add {
  min-height: 50px;
  padding: 0 16px;
  background: var(--ink);
  color: #fff;
  font-size: 17px;
}

.msg {
  min-height: 20px;
  margin: 6px 4px 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 20px;
  color: var(--danger);
}

.msg.ok {
  color: var(--ink-soft);
}

.ranges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  margin-top: 8px;
}

.ranges-empty {
  padding: 0 4px;
  font-size: 15px;
  text-align: center;
  color: var(--ink-soft);
}

.rpill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 10px 0 16px;
  border-radius: var(--r-pill);
  background: #f4ecff;
  font-size: 15px;
  font-weight: 600;
  transition: transform 0.2s var(--ease-spring);
}

.rpill.is-new {
  animation: item-in 0.35s var(--ease-spring) backwards;
}

.rpill:active {
  transform: scale(0.93);
}

.rpill svg {
  color: var(--ink-soft);
}

.sheet-actions {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  margin-top: 16px;
}

.sheet-actions .ghost {
  padding: 0 20px;
  font-size: 17px;
  color: var(--danger);
}

/* =========================================================
   3 · done
   ========================================================= */
.done {
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.done-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 478px;
  min-height: 100%;
  margin-inline: auto;
  padding: calc(var(--sat) + 28px) calc(var(--sar) + 24px) calc(var(--sab) + 24px) calc(var(--sal) + 24px);
  text-align: center;
}

.big-heart {
  font-size: 84px;
  line-height: 1;
}

.done.is-active .big-heart {
  animation: pop 0.7s var(--ease-spring) 0.25s backwards;
}

.big-heart span {
  display: inline-block;
  animation: heartbeat 1.3s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 28%, 60%, 100% { transform: scale(1); }
  14%                { transform: scale(1.16); }
  42%                { transform: scale(1.12); }
}

.done h1 {
  font-size: 52px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
}

.done-sub {
  max-width: 26ch;
  font-size: 19px;
  font-weight: 500;
}

.recap {
  width: 100%;
  margin: 8px 0;
  padding: 16px 18px;
  text-align: left;
}

.recap p {
  font-size: 16px;
  line-height: 1.5;
  white-space: pre-line;
  overflow-wrap: anywhere;
}

.done-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 100%;
}

/* =========================================================
   overlays
   ========================================================= */
.fx {
  position: absolute;
  inset: 0;
  z-index: 40;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  line-height: 1;
  will-change: transform, opacity;
}

.toast {
  position: absolute;
  top: calc(var(--sat) + 14px);
  left: 50%;
  z-index: 50;
  width: max-content;
  max-width: calc(100% - 36px);
  padding: 12px 18px;
  border-radius: 22px;
  background: var(--ink);
  color: #fff;
  font-size: 16px;
  font-weight: 500;
  text-align: center;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translate3d(-50%, -24px, 0) scale(0.9);
  transition: opacity 0.25s ease, transform 0.25s var(--ease-in);
}

.toast.is-on {
  opacity: 1;
  transform: translate3d(-50%, 0, 0);
  transition: opacity 0.3s ease, transform 0.45s var(--ease-spring);
}

/* =========================================================
   other sizes
   ========================================================= */

/* short screens: iPhone in landscape, iPhone SE */
@media (max-height: 520px) {
  .scene { gap: 8px; padding-bottom: 0; }
  .scene-emoji { font-size: 44px; }
  .scene-text { font-size: 30px; }
  .scene-text.big { font-size: 40px; }
  .big-heart { font-size: 56px; }
  .done h1 { font-size: 40px; }
}

/* smaller iPhones (SE, mini): tighten the day sheet so it all fits */
@media (max-height: 700px) {
  .sheet h2 { font-size: 24px; }
  .sheet-q { margin: 12px 2px 8px; }
  .chip { min-height: 54px; padding: 6px 14px; }
  .chip.wide { min-height: 48px; }
  .sheet-actions { margin-top: 10px; }
}

/* on a computer, show it inside an iPhone-sized frame */
@media (min-width: 560px) and (min-height: 560px) {
  html {
    background: #1c0f26;
  }

  body {
    display: grid;
    place-items: center;
  }

  .phone {
    position: relative;
    inset: auto;
    width: 393px;
    height: min(852px, calc(100vh - 40px));
    border-radius: 52px;
    box-shadow: 0 0 0 11px #0e0714, 0 0 0 13px #3a2a47, 0 50px 90px -30px rgba(0, 0, 0, 0.7);
  }

  .scene-text { font-size: 39px; }
  .scene-text.big { font-size: 55px; }
}

/* people who asked their phone for less motion get a calm version */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
  }

  .hearts,
  .fx {
    display: none;
  }
}
