:root {
  --bg: #f7f0e8;
  --blob-a: #f9d3c6;
  --blob-c: #cde9e4;
  --card: rgb(255 253 250 / .86);
  --card-border: rgb(255 255 255 / .7);
  --ink: #24212a;
  --muted: #8b8492;
  --line: #eee6dc;
  --row: #faf6f1;
  --row-hover: #f5efe7;
  --a: #e3664d;
  --a-soft: #fde5de;
  --c: #2f8f84;
  --c-soft: #d9f0ec;
  --ok: #3f9e66;
  --ok-soft: #e7f4ec;
  --shadow: 0 1px 2px rgb(60 40 20 / .04), 0 24px 60px -20px rgb(80 50 30 / .25);
  --title-font: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141318;
    --blob-a: #3a2220;
    --blob-c: #16302d;
    --card: rgb(32 30 37 / .86);
    --card-border: rgb(255 255 255 / .06);
    --ink: #efebf3;
    --muted: #958fa0;
    --line: #2e2b35;
    --row: #26242c;
    --row-hover: #2c2933;
    --a: #f2896f;
    --a-soft: #432a25;
    --c: #63c3b6;
    --c-soft: #1b3834;
    --ok: #6cc893;
    --ok-soft: #1c3226;
    --shadow: 0 24px 60px -20px rgb(0 0 0 / .7);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; }

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(42rem 32rem at -10% -10%, var(--blob-a), transparent 60%),
    radial-gradient(40rem 30rem at 110% 110%, var(--blob-c), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  display: grid;
  place-items: start center;
  padding: clamp(14px, 5vw, 56px) 12px 32px;
  -webkit-tap-highlight-color: transparent;
}

.card {
  width: 100%;
  max-width: 580px;
  background: var(--card);
  border: 1px solid var(--card-border);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: clamp(20px, 5vw, 30px) clamp(14px, 4vw, 26px) 18px;
  animation: rise .5s cubic-bezier(.2,.8,.2,1);
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* ---------- Cabecera ---------- */
.head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
}

.date {
  margin: 0 0 4px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .03em;
}
.date::first-letter { text-transform: uppercase; }

h1 {
  margin: 0;
  font-family: var(--title-font);
  font-size: clamp(1.6rem, 6vw, 2.1rem);
  line-height: 1.1;
  letter-spacing: -.025em;
  font-weight: 800;
}

.people { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.person {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 4px;
  border-radius: 99px;
  font-size: .76rem;
  color: var(--muted);
  background: var(--row);
}
.person b {
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: .7rem;
  color: #fff;
}
.pa b { background: var(--a); }
.pc b { background: var(--c); }

.ring { position: relative; width: 84px; height: 84px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 6; }
.ring .track { stroke: var(--line); }
.ring .arc {
  stroke: url(#ringGrad);
  stroke-linecap: round;
  stroke-dasharray: 169.65;
  stroke-dashoffset: 169.65;
  transition: stroke-dashoffset .7s cubic-bezier(.2,.8,.2,1);
}
.stop-a { stop-color: var(--a); }
.stop-c { stop-color: var(--c); }
.ring-label {
  position: absolute; inset: 0;
  display: grid; place-content: center; text-align: center;
  line-height: 1;
}
.ring-label strong { font-family: var(--title-font); font-size: 1.45rem; font-weight: 800; }
.ring-label > span { font-size: .68rem; color: var(--muted); margin-top: 3px; }

/* ---------- Lista ---------- */
.cols, .mission {
  display: grid;
  align-items: center;
  column-gap: 10px;
}
.cols {
  grid-template-columns: 1fr 44px 44px;
  padding: 0 10px 8px 52px;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted);
}
.cols .col-a, .cols .col-c { text-align: center; font-size: .78rem; font-weight: 800; letter-spacing: 0; }
.cols .col-a { color: var(--a); }
.cols .col-c { color: var(--c); }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

.mission {
  grid-template-columns: 32px 1fr 44px 44px;
  padding: 9px 10px;
  border-radius: 16px;
  background: var(--row);
  transition: background .3s, transform .2s;
  animation: rise .45s cubic-bezier(.2,.8,.2,1) both;
}
.mission:hover { background: var(--row-hover); }
.mission.done { background: var(--ok-soft); }

.icon {
  display: grid; place-items: center;
  width: 32px; height: 32px;
  border-radius: 10px;
  font-size: 1.05rem;
  background: var(--card);
  transition: filter .3s, opacity .3s;
}
.name {
  font-size: .96rem;
  font-weight: 500;
  line-height: 1.3;
  transition: color .3s;
}
.mission.done .name {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: color-mix(in srgb, var(--ok) 70%, transparent);
  text-decoration-thickness: 2px;
}
.mission.done .icon { filter: grayscale(.5); opacity: .75; }

/* ---------- Casillas ---------- */
.mark {
  --col: var(--a);
  --soft: var(--a-soft);
  justify-self: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 2px dashed color-mix(in srgb, var(--col) 40%, transparent);
  background: transparent;
  color: color-mix(in srgb, var(--col) 50%, transparent);
  font: inherit;
  font-weight: 800;
  font-size: .88rem;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: background .25s, border-color .25s, color .25s, box-shadow .25s, transform .12s;
}
.mark-C { --col: var(--c); --soft: var(--c-soft); }
.mark:hover { border-color: var(--col); color: var(--col); }
.mark:active { transform: scale(.88); }
.mark:focus-visible { outline: 3px solid color-mix(in srgb, var(--col) 35%, transparent); outline-offset: 2px; }

.mark .letter, .mark .check { grid-area: 1 / 1; transition: opacity .2s, transform .25s cubic-bezier(.2,1.4,.4,1); }
.mark .check { opacity: 0; transform: scale(.3) rotate(-20deg); font-size: 1.1rem; }

.mark[data-state="1"] {
  border-style: solid;
  border-color: var(--col);
  background: var(--soft);
  color: var(--col);
}
.mark[data-state="2"] {
  border-style: solid;
  border-color: transparent;
  background: var(--col);
  color: #fff;
  box-shadow: 0 6px 14px -6px var(--col);
}
.mark[data-state="2"] .letter { opacity: 0; transform: scale(.3); }
.mark[data-state="2"] .check { opacity: 1; transform: none; }

.mark.bump { animation: bump .35s cubic-bezier(.2,1.4,.4,1); }
@keyframes bump { 40% { transform: scale(1.15); } }

/* ---------- Final ---------- */
.celebrate {
  margin: 14px 0 0;
  padding: 12px;
  border-radius: 16px;
  text-align: center;
  font-family: var(--title-font);
  font-weight: 700;
  color: var(--ok);
  background: var(--ok-soft);
  animation: bump .5s cubic-bezier(.2,1.4,.4,1);
}

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px 16px;
  margin-top: 18px;
  font-size: .72rem;
  color: var(--muted);
}
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.chip { width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.chip.s0 { border: 1.5px dashed var(--muted); }
.chip.s1 { border: 1.5px solid var(--muted); background: var(--line); }
.chip.s2 { background: var(--muted); }

.sync { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.sync .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--muted);
  transition: background .3s;
}
.sync[data-kind="ok"] .dot { background: var(--ok); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ok) 20%, transparent); }
.sync[data-kind="busy"] .dot { background: #d9a23c; }
.sync[data-kind="err"] .dot { background: #d64545; }
.sync[data-kind="err"] { color: #d64545; }

@media (max-width: 380px) {
  .ring { width: 70px; height: 70px; }
  .mission { grid-template-columns: 28px 1fr 40px 40px; column-gap: 8px; padding: 8px; }
  .cols { grid-template-columns: 1fr 40px 40px; column-gap: 8px; padding-left: 44px; padding-right: 8px; }
  .icon { width: 28px; height: 28px; }
  .mark { width: 36px; height: 36px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
