:root {
  --bg: #FFF4EC;
  --blob-1: #FFD3E2;
  --blob-2: #E2DBFF;
  --blob-3: #CFF3E6;
  --card: #FFFFFF;
  --ink: #3A2E4D;
  --muted: #8B7F9C;
  --faint: #BDB3CC;
  --line: #F3E7EE;
  --soft: #FBF0F5;
  --pink: #FF6FA3;
  --lilac: #8B7CF6;
  --mint: #2FC79B;
  --sun: #FFC24B;
  --coral: #FF7A59;
  --grad: linear-gradient(135deg, #FF7EB0 0%, #A78BFA 100%);
  --danger: #E5386D;
  --danger-soft: #FFE3EC;
  --ok: #2FC79B;
  --shadow: 0 2px 0 rgba(120, 80, 140, .05), 0 10px 30px rgba(150, 100, 170, .12);
  --shadow-lg: 0 20px 60px rgba(90, 50, 120, .28);
  --r: 24px;
  --r-sm: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1D1628;
    --blob-1: #4A2140;
    --blob-2: #2F2860;
    --blob-3: #173D3A;
    --card: #2A2138;
    --ink: #F6EFFC;
    --muted: #AFA3C2;
    --faint: #6E6283;
    --line: #3B3050;
    --soft: #342A46;
    --danger-soft: #4A1C2E;
    --shadow: 0 2px 0 rgba(0, 0, 0, .2), 0 10px 30px rgba(0, 0, 0, .3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  background:
    radial-gradient(520px 380px at 100% 0%, var(--blob-1), transparent 70%),
    radial-gradient(480px 420px at 0% 18%, var(--blob-2), transparent 70%),
    radial-gradient(560px 420px at 60% 100%, var(--blob-3), transparent 70%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: 'Fredoka', 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.45;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--lilac) 60%, transparent); outline-offset: 2px; }
.app { max-width: 1060px; margin: 0 auto; padding: 0 16px calc(120px + env(safe-area-inset-bottom)); }

.loading { display: grid; place-items: center; min-height: 80vh; }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 5px solid var(--line); border-top-color: var(--pink); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- header ---------- */
.top { display: flex; align-items: center; gap: 12px; padding: calc(18px + env(safe-area-inset-top)) 0 14px; }
.logo {
  width: 46px; height: 46px; border-radius: 16px; background: var(--grad); display: grid; place-items: center;
  color: #fff; font-size: 24px; font-weight: 700; box-shadow: 0 6px 16px rgba(255, 110, 170, .4); transform: rotate(-6deg);
}
.top h1 { margin: 0; font-size: 24px; font-weight: 700; letter-spacing: -.2px; }
.top .sub { color: var(--muted); font-size: 14px; }
.top .grow { flex: 1; min-width: 0; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; background: var(--card); box-shadow: var(--shadow);
  display: grid; place-items: center; font-size: 20px; transition: transform .15s;
}
.icon-btn:active { transform: scale(.92); }
.me-btn { display: flex; align-items: center; gap: 8px; padding: 5px 14px 5px 6px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); font-weight: 500; }

.avatar {
  width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center;
  font-weight: 700; font-size: 16px; flex: none; border: 2.5px solid var(--card);
}
.avatar.xs { width: 26px; height: 26px; font-size: 13px; border-width: 2px; }
.avatar.xl { width: 84px; height: 84px; font-size: 40px; border-width: 4px; }

/* ---------- cards, buttons ---------- */
.card { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); padding: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 20px; border-radius: 999px; font-weight: 600; transition: transform .15s, filter .15s;
}
.btn:active { transform: scale(.96); }
.btn.primary { background: var(--grad); color: #fff; box-shadow: 0 8px 20px rgba(200, 110, 220, .35); }
.btn.primary:hover { filter: brightness(1.05); }
.btn.ghost { background: var(--soft); color: var(--ink); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.small { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn.big { width: 100%; min-height: 54px; font-size: 18px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 14px;
  background: var(--card); border-radius: var(--r-sm); box-shadow: var(--shadow); border: 2px dashed color-mix(in srgb, var(--sun) 70%, transparent);
}
.banner .txt { flex: 1; font-size: 15px; }
.banner button { min-height: 38px; padding: 0 14px; border-radius: 999px; font-weight: 600; background: var(--sun); color: #3A2E4D; }

/* ---------- task form (composer + sheets) ---------- */
.composer { margin-bottom: 18px; position: relative; }
.composer-title { font-weight: 700; font-size: 18px; margin-bottom: 10px; }
textarea, input[type="text"], input[type="date"], select {
  width: 100%; background: var(--soft); border: 2px solid transparent; border-radius: var(--r-sm);
  padding: 12px 14px; outline: none; transition: border-color .15s, background .15s;
}
textarea { resize: vertical; min-height: 64px; display: block; }
textarea:focus, input[type="text"]:focus, input[type="date"]:focus, select:focus { border-color: var(--lilac); background: var(--card); }
::placeholder { color: var(--faint); }
.fields { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px 18px; margin: 14px 0 16px; }
.field > label, .field > .label { display: block; font-size: 14px; font-weight: 600; color: var(--muted); margin-bottom: 7px; }
.field.wide { grid-column: 1 / -1; }
@media (max-width: 760px) { .fields { grid-template-columns: 1fr; } }

.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; min-height: 42px; padding: 0 14px 0 14px; border-radius: 999px;
  background: var(--soft); font-weight: 500; border: 2px solid transparent; transition: transform .15s, background .15s; white-space: nowrap;
}
.pill:active { transform: scale(.95); }
.pill .avatar { margin-inline-start: -8px; }
.pill .avatar + .avatar { margin-inline-start: -12px; }
.pill.on { background: color-mix(in srgb, var(--c, var(--lilac)) 22%, var(--card)); border-color: var(--c, var(--lilac)); font-weight: 600; }
.pill.add { border: 2px dashed var(--faint); background: transparent; color: var(--muted); }
.pill.small { min-height: 36px; font-size: 14px; padding: 0 12px; }
.date-wrap { margin-top: 8px; }
.newcat { display: flex; gap: 8px; margin-top: 8px; }
.newcat input { flex: 1; min-width: 0; }

/* ---------- tabs + toolbar ---------- */
.tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 999px;
  font-weight: 600; font-size: 17px; color: var(--muted); background: color-mix(in srgb, var(--card) 60%, transparent);
}
.tab.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.tab .n { min-width: 26px; height: 26px; padding: 0 8px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 14px; background: var(--soft); }
.tab.on .n { background: var(--grad); color: #fff; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.toolbar select { width: auto; min-height: 36px; padding: 6px 12px; font-size: 14px; border-radius: 999px; background: var(--card); box-shadow: var(--shadow); }
.toolbar .grow { flex: 1; }
.count-note { color: var(--muted); font-size: 14px; margin: 0 4px 10px; }

/* ---------- the table ---------- */
.tbl { background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; }
.row, .thead {
  display: grid; align-items: center; gap: 0 14px; padding: 12px 18px;
  grid-template-columns: minmax(0, 1fr) 96px 132px 126px 150px 62px;
}
.tbl.done .row, .tbl.done .thead { grid-template-columns: minmax(0, 1fr) 96px 132px 126px 150px 96px 104px; }
.thead { font-size: 13px; font-weight: 600; color: var(--muted); background: var(--soft); padding-block: 10px; }
.row { border-top: 2px solid var(--line); transition: background .15s; }
.row:first-of-type { border-top: 0; }
.row:hover { background: color-mix(in srgb, var(--soft) 55%, transparent); }
.meta { display: contents; }
.lbl { display: none; }
.c-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 17px; font-weight: 500; cursor: pointer; padding-block: 4px; }
.c-created, .c-finished { font-size: 14px; color: var(--muted); font-family: 'Rubik', system-ui, sans-serif; }
.c-created small, .c-finished small { display: block; font-size: 12px; color: var(--faint); }
.c-done { display: grid; place-items: center; }
.who { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: 15px; }
.who .avatar + .avatar { margin-inline-start: -14px; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 4px 11px; border-radius: 999px; font-size: 14px; font-weight: 500;
  background: color-mix(in srgb, var(--c, var(--faint)) 30%, var(--card)); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip.due { --c: #7CC8FF; font-family: 'Rubik', system-ui, sans-serif; }
.chip.due.now { --c: #FF8A66; font-weight: 600; font-family: inherit; }
.chip.due.today { --c: #FFCB5C; font-weight: 600; }
.chip.due.late { background: var(--danger-soft); color: var(--danger); font-weight: 600; }
.chip.gone { opacity: .6; text-decoration: line-through; }

.bubble {
  width: 38px; height: 38px; border-radius: 50%; border: 3px solid color-mix(in srgb, var(--mint) 55%, var(--line));
  display: grid; place-items: center; color: transparent; font-size: 20px; font-weight: 700; transition: all .18s; background: var(--card);
}
.bubble::after { content: '✓'; }
.bubble:hover { border-color: var(--mint); color: var(--mint); transform: scale(1.08); }
.bubble.pop { background: var(--mint); border-color: var(--mint); color: #fff; animation: pop .45s ease; }
@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.35); } 100% { transform: scale(1); } }
.bubble.pick { border-style: dashed; border-color: var(--lilac); }
.bubble.pick::after { content: ''; }
.bubble.pick.on { background: var(--lilac); border-style: solid; color: #fff; }
.bubble.pick.on::after { content: '🔗'; font-size: 16px; }
.row.going { opacity: .35; transition: opacity .4s; }
.row.going .c-text { text-decoration: line-through; }
.row.picked { background: color-mix(in srgb, var(--lilac) 12%, var(--card)); }
.row.fresh { animation: fresh 2.2s ease; }
@keyframes fresh { 0%, 40% { background: color-mix(in srgb, var(--sun) 35%, var(--card)); } 100% { background: transparent; } }
.tbl.done .c-text { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--faint); cursor: default; }

@media (max-width: 860px) {
  .thead { display: none; }
  .tbl { background: none; box-shadow: none; overflow: visible; display: grid; gap: 10px; }
  .row, .tbl.done .row {
    grid-template-columns: minmax(0, 1fr) auto; gap: 8px 12px; padding: 14px 16px; border: 0;
    background: var(--card); border-radius: var(--r); box-shadow: var(--shadow);
  }
  .row:hover { background: var(--card); }
  .c-text { grid-column: 1; grid-row: 1; }
  .meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; grid-column: 1 / -1; grid-row: 2; }
  .c-done { grid-column: 2; grid-row: 1; align-self: start; }
  .lbl { display: inline; }
  .c-created small, .c-finished small { display: inline; }
  .c-created, .c-finished { font-size: 13px; }
  .tbl.done .c-back { grid-column: 2; grid-row: 1; align-self: start; }
}

.empty { text-align: center; padding: 44px 20px; background: var(--card); border-radius: var(--r); box-shadow: var(--shadow); }
.empty .big { font-size: 56px; display: inline-block; animation: bob 2.4s ease-in-out infinite; }
.empty h3 { margin: 8px 0 2px; font-size: 20px; }
.empty p { margin: 0; color: var(--muted); }
@keyframes bob { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-8px) rotate(4deg); } }

/* ---------- merge bar ---------- */
.mergebar {
  position: fixed; inset-inline: 0; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 20; margin: 0 auto; width: min(560px, calc(100% - 24px));
  display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 18px; border-radius: 999px;
  background: var(--ink); color: var(--bg); box-shadow: var(--shadow-lg);
}
.mergebar .txt { flex: 1; font-weight: 500; }
.mergebar .btn.ghost { background: color-mix(in srgb, var(--bg) 18%, transparent); color: var(--bg); }

/* ---------- sheet ---------- */
.sheet-back { position: fixed; inset: 0; z-index: 40; background: rgba(40, 20, 60, .45); backdrop-filter: blur(3px); display: grid; place-items: end center; animation: fade .2s; }
.sheet {
  width: min(600px, 100%); max-height: 92vh; overflow: auto; background: var(--card); border-radius: 28px 28px 0 0;
  padding: 10px 20px calc(22px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); animation: up .25s cubic-bezier(.2, .9, .3, 1.2);
}
@media (min-width: 700px) { .sheet-back { place-items: center; } .sheet { border-radius: 28px; padding-bottom: 22px; } }
.sheet .grab { width: 44px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 10px; }
.sheet-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sheet-head h2 { flex: 1; margin: 0; font-size: 21px; }
.sheet .fields { grid-template-columns: 1fr; }
.sheet h3 { font-size: 15px; color: var(--muted); margin: 22px 0 8px; }
.note { font-size: 14px; color: var(--muted); background: var(--soft); border-radius: var(--r-sm); padding: 12px 14px; }
.status-line { display: flex; align-items: center; gap: 8px; font-weight: 500; margin-bottom: 10px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.set-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.set-row input[type="text"] { flex: 1; min-width: 0; }
.swatch { width: 34px; height: 34px; border-radius: 50%; flex: none; border: 3px solid var(--card); box-shadow: 0 0 0 2px var(--line); }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }

/* ---------- who are you ---------- */
.hello { min-height: 86vh; display: grid; place-items: center; text-align: center; }
.hello h1 { font-size: 34px; margin: 0 0 6px; }
.hello p { color: var(--muted); margin: 0 0 26px; }
.hello .people { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }
.person { display: grid; justify-items: center; gap: 10px; padding: 22px 30px; border-radius: 28px; background: var(--card); box-shadow: var(--shadow); font-size: 20px; font-weight: 600; transition: transform .18s; }
.person:hover { transform: translateY(-4px) rotate(-2deg); }

/* ---------- toast + confetti ---------- */
.toast {
  position: fixed; inset-inline: 0; bottom: calc(22px + env(safe-area-inset-bottom)); z-index: 60; margin: 0 auto; width: fit-content; max-width: calc(100% - 28px);
  display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-radius: 22px; background: var(--ink); color: var(--bg);
  box-shadow: var(--shadow-lg); font-weight: 500; opacity: 0; transform: translateY(20px); pointer-events: none; transition: all .25s;
}
.toast.show { opacity: 1; transform: none; pointer-events: auto; }
.toast.err { background: var(--danger); color: #fff; }
.toast button { font-weight: 700; text-decoration: underline; white-space: nowrap; color: inherit; }
.confetti { position: fixed; z-index: 70; width: 10px; height: 10px; border-radius: 3px; pointer-events: none; animation: fly .8s cubic-bezier(.2, .7, .3, 1) forwards; }
@keyframes fly { to { transform: translate(var(--dx), var(--dy)) rotate(var(--rot)); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

@media (max-width: 520px) {
  .me-btn { padding: 5px; }
  .me-btn > span:not(.avatar) { display: none; }
  .top h1 { font-size: 22px; }
}

/* ---------- pictures + backup ---------- */
.avatar.photo { background-size: cover; background-position: center; background-color: var(--soft); }
.avatar.lg { width: 50px; height: 50px; font-size: 22px; border-width: 3px; }
.photo-btn { position: relative; flex: none; border-radius: 50%; transition: transform .15s; }
.photo-btn:active { transform: scale(.93); }
.photo-btn .cam {
  position: absolute; inset-inline-end: -6px; bottom: -4px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--card); box-shadow: 0 2px 6px rgba(60, 30, 90, .25); display: grid; place-items: center; font-size: 13px;
}
.set-sub { margin: -2px 0 10px; margin-inline-start: 62px; }
.link { color: var(--muted); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.banner.bad { border-color: var(--danger); background: var(--danger-soft); }
.note.bad { background: var(--danger-soft); color: var(--danger); margin-top: 8px; }

/* ---------- add to home screen ---------- */
.lead { margin: 0 0 14px; font-size: 17px; }
.steps { list-style: none; counter-reset: step; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.steps li { counter-increment: step; display: flex; align-items: flex-start; gap: 12px; background: var(--soft); border-radius: var(--r-sm); padding: 12px 14px; }
.steps li::before {
  content: counter(step); flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--grad); color: #fff;
  display: grid; place-items: center; font-weight: 700; font-size: 16px;
}
.steps li > span { flex: 1; padding-top: 3px; }
.steps small { color: var(--muted); font-size: 14px; }
.ios-share { vertical-align: -5px; color: #2F7BF6; margin: 0 2px; }

/* ---------- a real computer screen ---------- */
.key-hint { display: none; margin-top: 10px; text-align: center; font-size: 13px; color: var(--muted); font-family: 'Rubik', system-ui, sans-serif; }
kbd { font: inherit; font-size: 12px; padding: 1px 6px; border-radius: 6px; background: var(--soft); border: 1px solid var(--line); border-bottom-width: 2px; }
@media (hover: hover) and (pointer: fine) { .key-hint { display: block; } }
@media (min-width: 1280px) {
  .app { max-width: 1600px; padding-inline: 32px; }
  .layout { display: grid; grid-template-columns: 350px minmax(0, 1fr); gap: 26px; align-items: start; }
  .side { position: sticky; top: 18px; }
  .side .composer { margin-bottom: 0; }
  .side .fields { grid-template-columns: 1fr; }
  .side textarea { min-height: 92px; }
  .row, .thead { grid-template-columns: minmax(0, 1fr) 88px 122px 124px 140px 58px; padding-inline: 20px; }
  .tbl.done .row, .tbl.done .thead { grid-template-columns: minmax(0, 1fr) 88px 122px 124px 140px 88px 104px; }
  .row { padding-block: 10px; }
}
@media (min-width: 1280px) and (max-height: 700px) {
  /* A short window: the form scrolls on its own, so the add button is always reachable. */
  .side { max-height: calc(100vh - 36px); overflow: auto; border-radius: var(--r); scrollbar-width: thin; }
}

/* a tiny picture of the browser bar, with the button to press lit up */
.mock { display: flex; align-items: center; gap: 8px; margin: 10px 0 8px; padding: 8px 10px; border-radius: 16px; background: var(--card); box-shadow: inset 0 0 0 2px var(--line); }
.mock-url { flex: 1; min-width: 0; padding: 6px 12px; border-radius: 999px; background: var(--soft); color: var(--muted); font-size: 14px; font-family: 'Rubik', system-ui, sans-serif; }
.mock-btn { width: 34px; height: 34px; border-radius: 50%; background: var(--soft); display: grid; place-items: center; color: var(--faint); font-size: 20px; }
.mock-hit { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: #2F7BF6; background: color-mix(in srgb, var(--sun) 45%, var(--card)); box-shadow: 0 0 0 3px var(--sun); animation: hit 1.4s ease-in-out infinite; }
.mock-hit .ios-share { margin: 0; vertical-align: 0; }
@keyframes hit { 0%, 100% { box-shadow: 0 0 0 3px var(--sun); } 50% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--sun) 30%, transparent); } }
