:root {
  color-scheme: light;
  --bg: #f5f2ec;
  --bg-2: #ebe6dc;
  --card: #ffffff;
  --card-2: #faf8f4;
  --ink: #1d1a24;
  --muted: #6f6878;
  --line: rgba(29, 26, 36, 0.1);
  --accent: #6a4dff;
  --accent-2: #ff6b57;
  --accent-ink: #ffffff;
  --late: #e5484d;
  --good: #22a861;
  --c-coral: #ff6b57;
  --c-amber: #f0a020;
  --c-green: #22a861;
  --c-teal: #12a594;
  --c-blue: #3b7bf6;
  --c-violet: #7c5cff;
  --c-pink: #e8479a;
  --c-slate: #6b7a90;
  --shadow: 0 1px 2px rgba(20, 16, 30, 0.05), 0 8px 22px -12px rgba(20, 16, 30, 0.22);
  --shadow-lift: 0 2px 4px rgba(20, 16, 30, 0.06), 0 16px 32px -14px rgba(20, 16, 30, 0.3);
  --radius: 18px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --round: ui-rounded, "SF Pro Rounded", "Avenir Next", system-ui, sans-serif;
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #121017;
    --bg-2: #1a1722;
    --card: #1f1b29;
    --card-2: #252032;
    --ink: #f3f0f8;
    --muted: #a39cb0;
    --line: rgba(255, 255, 255, 0.09);
    --accent: #8f7bff;
    --late: #ff6b70;
    --good: #3ccf7f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 24px -14px rgba(0, 0, 0, 0.7);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.35), 0 18px 34px -14px rgba(0, 0, 0, 0.8);
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

body {
  min-height: 100vh;
  background:
    radial-gradient(ellipse 60% 40% at 0% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 60%),
    radial-gradient(ellipse 50% 35% at 100% -5%, color-mix(in srgb, var(--accent-2) 12%, transparent), transparent 55%),
    var(--bg);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

.muted { color: var(--muted); }
.error { color: var(--late); font-weight: 600; }

/* ---- header ---------------------------------------------------------- */

header.top {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top, 0px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: blur(14px) saturate(1.4);
  backdrop-filter: blur(14px) saturate(1.4);
  border-bottom: 1px solid var(--line);
}

.top-inner {
  max-width: 44rem;
  margin-inline: auto;
  padding: 0.6rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  font-family: var(--round);
  font-weight: 800;
  font-size: 1.2rem;
  letter-spacing: -0.02em;
}
.brand-mark { border-radius: 8px; display: block; }

.tabs { margin-left: auto; display: flex; gap: 0.25rem; }
.tabs a {
  display: flex;
  align-items: center;
  min-height: 2.25rem;
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }
.tab-icon { width: 1.2rem; height: 1.2rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.notice {
  max-width: 44rem;
  margin: 0.75rem auto 0;
  padding: 0.5rem 1rem;
  background: color-mix(in srgb, var(--c-amber) 18%, var(--card));
  border-radius: 12px;
  font-size: 0.9rem;
}

.wrap {
  max-width: 44rem;
  margin-inline: auto;
  padding: 1.25rem 1rem calc(6rem + env(safe-area-inset-bottom, 0px));
}

/* ---- hero ------------------------------------------------------------ */

.hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.1rem;
}
.hero-text { flex: 1; min-width: 0; }
.eyebrow { color: var(--muted); font-size: 0.85rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; }
.hero h1 {
  font-family: var(--round);
  font-size: clamp(1.7rem, 6vw, 2.3rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
  font-weight: 800;
  margin: 0.15rem 0 0.3rem;
}
.hero-sub { color: var(--muted); }
.hero-stats { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.stat {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  background: var(--card);
  box-shadow: var(--shadow);
  font-size: 0.85rem;
  font-weight: 600;
}
.stat.hot { background: linear-gradient(135deg, #ffb347, #ff6b57); color: #fff; }
.stat.bump { animation: bump 0.5s var(--spring); }

.ring { position: relative; width: 112px; height: 112px; flex: none; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--bg-2); stroke-width: 11; }
.ring-fill {
  fill: none;
  stroke: url(#ring-grad);
  stroke-width: 11;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.9s var(--ease);
}
.ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  line-height: 1.05;
}
.ring-label strong { font-family: var(--round); font-size: 1.9rem; font-weight: 800; letter-spacing: -0.03em; }
.ring-label span { font-size: 0.72rem; color: var(--muted); font-weight: 600; max-width: 5.5rem; }
.ring.full .ring-label strong { color: var(--good); }
.ring.pulse { animation: bump 0.6s var(--spring); }

/* ---- add bar --------------------------------------------------------- */

.adder {
  position: relative;
  background: var(--card);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 0.4rem 0.4rem 0.4rem 0.9rem;
  margin-bottom: 1rem;
  transition: box-shadow 0.25s, transform 0.25s var(--spring);
}
.adder:focus-within { box-shadow: var(--shadow-lift), 0 0 0 3px color-mix(in srgb, var(--accent) 28%, transparent); }
.adder.added { animation: squish 0.45s var(--spring); }
.adder.shake { animation: shake 0.35s; }
.adder-row { display: flex; align-items: center; gap: 0.5rem; }
.adder-plus {
  flex: none;
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  font-weight: 800;
  font-size: 1.15rem;
  line-height: 1;
}
.adder input {
  flex: 1;
  min-width: 0;
  border: 0;
  background: transparent;
  padding: 0.7rem 0.2rem;
  font-size: 1.05rem;
  outline: none;
}
.adder input::placeholder { color: var(--muted); }
.add-btn {
  flex: none;
  border: 0;
  border-radius: 14px;
  padding: 0.65rem 1.1rem;
  font-weight: 700;
  color: var(--accent-ink);
  background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--accent-2)));
  box-shadow: 0 6px 14px -8px var(--accent);
  transition: transform 0.15s var(--spring), opacity 0.2s;
}
.add-btn:active { transform: scale(0.94); }
.add-btn:disabled { opacity: 0.5; }
.adder-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; padding: 0 0.3rem 0.35rem 0; }
.adder-chips { display: contents; }
.tool {
  border: 1px dashed color-mix(in srgb, var(--muted) 60%, transparent);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0.2rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 700;
  transition: background 0.2s, color 0.2s, transform 0.15s var(--spring);
}
.tool:hover { color: var(--ink); border-color: var(--ink); }
.tool:active { transform: scale(0.94); }
.tool.on, .tool[aria-expanded="true"] { border-style: solid; border-color: transparent; background: var(--accent); color: var(--accent-ink); }
.repeat-panel {
  margin: 0.2rem 0.3rem 0.5rem 0;
  padding: 0.85rem;
  border-radius: 16px;
  background: var(--card-2);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  animation: sheet-in 0.3s var(--spring);
}
.repeat-panel .sheet-label { margin: 0.2rem 0 0; }
.repeat-panel select { flex: none; width: auto; padding: 0.35rem 0.5rem; }
.repeat-panel .input { background: var(--card); }
.repeat-panel input[type="date"] { flex: none; min-width: 9.5rem; }
.repeat-explain { font-size: 0.85rem; }
.repeat-actions { display: flex; justify-content: space-between; gap: 0.5rem; }
.adder-hint { font-size: 0.8rem; color: var(--muted); padding: 0.1rem 0.2rem 0.3rem; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  border: 0;
  border-radius: 999px;
  padding: 0.2rem 0.6rem;
  font-size: 0.82rem;
  font-weight: 600;
  background: color-mix(in srgb, var(--c, var(--accent)) 14%, transparent);
  color: color-mix(in srgb, var(--c, var(--accent)) 75%, var(--ink));
  animation: pop-in 0.3s var(--spring);
}
.chip .x { opacity: 0.6; font-size: 0.95em; }
button.chip:hover .x { opacity: 1; }

/* ---- list filter ----------------------------------------------------- */

.filters {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -1rem 0.8rem;
  padding: 0.2rem 1rem 0.4rem;
}
.filters::-webkit-scrollbar { display: none; }
.filter {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.8rem;
  background: var(--card);
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.2s, color 0.2s, transform 0.15s var(--spring);
}
.filter:active { transform: scale(0.95); }
.filter .n { color: var(--muted); font-weight: 700; font-size: 0.8rem; }
.filter[aria-pressed="true"] {
  background: var(--c, var(--ink));
  border-color: transparent;
  color: #fff;
}
.filter[aria-pressed="true"] .n { color: rgba(255, 255, 255, 0.8); }
@media (prefers-color-scheme: dark) {
  .filter[aria-pressed="true"]:not([style]) { color: var(--bg); }
  .filter[aria-pressed="true"]:not([style]) .n { color: var(--bg); opacity: 0.7; }
}

/* ---- groups and cards ------------------------------------------------ */

.group { margin-bottom: 1.3rem; }
.group-title {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  font-weight: 700;
  margin: 0 0.25rem 0.5rem;
}
.group-title .count {
  background: var(--bg-2);
  border-radius: 999px;
  padding: 0 0.45rem;
  font-size: 0.75rem;
  letter-spacing: 0;
}
.group-overdue .group-title { color: var(--late); }
.group-today .group-title { color: var(--accent); }
.group-done .group-title { cursor: pointer; user-select: none; }
.group-done .group-title::after { content: "▾"; transition: transform 0.2s; }
.group-done.collapsed .group-title::after { transform: rotate(-90deg); }
.group-done.collapsed .cards { display: none; }

.cards { list-style: none; }

.card {
  --c: var(--accent);
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.75rem 0.9rem 0.75rem 0.75rem;
  margin-bottom: 0.55rem;
  overflow: hidden;
  transition: transform 0.2s var(--spring), box-shadow 0.2s, opacity 0.25s, height 0.28s var(--ease),
    padding 0.28s var(--ease), margin 0.28s var(--ease);
}
@media (hover: hover) {
  .card:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
}
.card.arriving { animation: arrive 0.55s var(--spring); }
.card.arriving::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: color-mix(in srgb, var(--c) 18%, transparent);
  animation: fade-out 1.2s ease-out forwards;
  pointer-events: none;
}
.card.leaving { opacity: 0; padding-top: 0; padding-bottom: 0; margin-bottom: 0; transform: scale(0.97); }

.check {
  position: relative;
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  margin-top: 0.05rem;
  border-radius: 50%;
  border: 2.5px solid color-mix(in srgb, var(--c) 60%, transparent);
  background: transparent;
  display: grid;
  place-items: center;
  transition: background 0.2s, border-color 0.2s, transform 0.15s var(--spring);
}
.check::before { /* bigger tap target */
  content: "";
  position: absolute;
  inset: -0.6rem;
}
.check::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 3px solid var(--c);
  opacity: 0;
  pointer-events: none;
}
.check svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: #fff; stroke-width: 3.2; stroke-linecap: round; stroke-linejoin: round; }
.check path { stroke-dasharray: 24; stroke-dashoffset: 24; transition: stroke-dashoffset 0.3s 0.08s var(--ease); }
@media (hover: hover) {
  .check:hover { background: color-mix(in srgb, var(--c) 14%, transparent); border-color: var(--c); }
  .check:hover path { stroke: var(--c); stroke-dashoffset: 0; opacity: 0.45; }
}
.check:active { transform: scale(0.88); }

.card.completing .check, .card.is-done .check { background: var(--c); border-color: var(--c); }
.card.completing .check path, .card.is-done .check path { stroke: #fff; stroke-dashoffset: 0; opacity: 1; }
.card.completing .check { animation: check-pop 0.45s var(--spring); }
.card.completing .check::after { animation: ripple 0.6s ease-out; }
.card.completing { background: color-mix(in srgb, var(--c) 8%, var(--card)); }

.card-body {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  text-align: left;
  padding: 0.2rem 0 0;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.card-title {
  font-weight: 600;
  font-size: 1.02rem;
  overflow-wrap: anywhere;
  background: linear-gradient(currentColor, currentColor) no-repeat 0 58% / 0 2px;
  transition: background-size 0.35s 0.12s var(--ease), color 0.3s 0.12s;
  align-self: flex-start;
}
.card.completing .card-title, .card.is-done .card-title { background-size: 100% 2px; color: var(--muted); }
.card.is-done { box-shadow: none; background: var(--card-2); }

.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.6rem; font-size: 0.82rem; color: var(--muted); }
.card-meta:empty { display: none; }
.meta-list { font-weight: 600; color: color-mix(in srgb, var(--c) 70%, var(--ink)); }
.meta-late { color: var(--late); font-weight: 700; }
.meta-today { color: var(--accent); font-weight: 700; }
.meta-steps { display: inline-flex; align-items: center; gap: 0.35rem; }
.mini-bar { width: 2.6rem; height: 0.35rem; border-radius: 999px; background: var(--bg-2); overflow: hidden; }
.mini-bar i { display: block; height: 100%; background: var(--c); border-radius: inherit; }

.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}
.empty .big-emoji { font-size: 3rem; display: block; margin-bottom: 0.5rem; animation: float 3s ease-in-out infinite; }
.empty strong { display: block; color: var(--ink); font-family: var(--round); font-size: 1.3rem; margin-bottom: 0.2rem; }

/* ---- buttons and fields ---------------------------------------------- */

.btn, .primary, .ghost, .danger {
  border: 0;
  border-radius: 12px;
  padding: 0.6rem 1rem;
  font-weight: 700;
  transition: transform 0.15s var(--spring), background 0.2s, opacity 0.2s;
}
.btn:active, .primary:active, .ghost:active, .danger:active { transform: scale(0.96); }
.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 14px -8px var(--accent); }
.primary.big { width: 100%; padding: 0.85rem 1rem; font-size: 1.05rem; border-radius: 14px; }
.primary.done-btn { background: var(--good); box-shadow: 0 6px 14px -8px var(--good); }
.primary.done-btn.ready { animation: glow 1.4s ease-in-out infinite; }
.ghost { background: var(--bg-2); }
.danger { background: transparent; color: var(--late); }
.danger.armed { background: var(--late); color: #fff; }
button:disabled { opacity: 0.5; cursor: default; }

.field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.field input, .field textarea, .field select, .input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-2);
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
  font-weight: 400;
  color: var(--ink);
}
.field textarea { resize: vertical; min-height: 4.5rem; }

.seg { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.seg button {
  border: 1px solid var(--line);
  background: var(--card-2);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.88rem;
  font-weight: 600;
  transition: background 0.2s, color 0.2s, transform 0.15s var(--spring);
}
.seg button:active { transform: scale(0.94); }
.seg button[aria-pressed="true"] { background: var(--c, var(--accent)); border-color: transparent; color: #fff; }

/* ---- editor sheet ---------------------------------------------------- */

dialog.sheet {
  margin: auto;
  width: min(34rem, calc(100% - 2rem));
  max-height: min(90vh, 52rem);
  border: 0;
  border-radius: 22px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.5);
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
}
dialog.sheet[open] { animation: sheet-in 0.35s var(--spring); }
dialog.sheet::backdrop { background: rgba(15, 12, 22, 0.45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
@media (max-width: 600px) {
  dialog.sheet {
    width: 100%;
    max-width: 100%;
    margin: auto 0 0;
    border-radius: 22px 22px 0 0;
    max-height: 92vh;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  dialog.sheet[open] { animation: sheet-up 0.38s var(--ease); }
}
.sheet-inner { padding: 1.1rem 1.1rem 1.25rem; display: flex; flex-direction: column; gap: 1rem; }
.sheet-head { display: flex; align-items: flex-start; gap: 0.6rem; }
.sheet-title {
  flex: 1;
  border: 0;
  background: transparent;
  font-family: var(--round);
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  resize: none;
  outline: none;
  min-width: 0;
  padding: 0.15rem 0;
  border-bottom: 2px solid transparent;
  field-sizing: content;
}
.sheet-title:focus { border-bottom-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.close-x { border: 0; background: var(--bg-2); width: 2.1rem; height: 2.1rem; border-radius: 50%; font-size: 1.2rem; line-height: 1; flex: none; }
.sheet-label { font-size: 0.78rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 0.4rem; }
.when-row { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.when-row input[type="date"] { width: auto; padding: 0.3rem 0.6rem; border-radius: 999px; font-size: 0.88rem; }
.sheet-foot { display: flex; gap: 0.5rem; align-items: center; justify-content: space-between; padding-top: 0.25rem; }
.sheet-foot .primary { flex: 1; max-width: 16rem; }

.repeat-more { margin-top: 0.6rem; display: flex; flex-direction: column; gap: 0.5rem; }
.repeat-more .muted { font-size: 0.85rem; }
.repeat-every { display: flex; align-items: center; gap: 0.5rem; font-weight: 600; }
.repeat-every input { flex: none; width: 4.5rem; padding: 0.35rem 0.5rem; text-align: center; }
.steps { list-style: none; display: flex; flex-direction: column; gap: 0.3rem; }
.step { display: flex; align-items: center; gap: 0.55rem; }
.step .check { width: 1.45rem; height: 1.45rem; border-width: 2px; }
.step .check svg { width: 0.85rem; height: 0.85rem; }
.step.done .check { background: var(--c); border-color: var(--c); }
.step.done .check path { stroke-dashoffset: 0; }
.step.done .step-text { color: var(--muted); text-decoration: line-through; }
.step.flash .check { animation: check-pop 0.4s var(--spring); }
.step-text { flex: 1; min-width: 0; border: 0; background: transparent; padding: 0.3rem 0; outline: none; border-bottom: 1px solid transparent; }
.step-text:focus { border-bottom-color: var(--line); }
.step-del { border: 0; background: none; color: var(--muted); font-size: 1.1rem; padding: 0.2rem 0.4rem; opacity: 0.6; }
.step-del:hover { opacity: 1; color: var(--late); }
.step-add { display: flex; gap: 0.4rem; margin-top: 0.3rem; }
.step-add input { flex: 1; min-width: 0; }

/* ---- done page ------------------------------------------------------- */

.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.6rem; margin-bottom: 1.2rem; }
.stat-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.8rem; text-align: center; }
.stat-card strong { display: block; font-family: var(--round); font-size: 1.7rem; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.stat-card span { font-size: 0.78rem; color: var(--muted); font-weight: 600; }

.heat-card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 0.9rem; margin-bottom: 1.4rem; }
.heat-card h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin-bottom: 0.6rem; }
.heat {
  display: grid;
  grid-template-rows: repeat(7, auto);
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 3px;
  max-width: 36rem;
}
.heat i { aspect-ratio: 1; border-radius: 3px; background: var(--bg-2); }
.heat-card .l1 { background: color-mix(in srgb, var(--good) 35%, var(--bg-2)); }
.heat-card .l2 { background: color-mix(in srgb, var(--good) 60%, var(--bg-2)); }
.heat-card .l3 { background: color-mix(in srgb, var(--good) 82%, var(--bg-2)); }
.heat-card .l4 { background: var(--good); }
.heat i.future { background: transparent; }
.heat i.today { outline: 2px solid var(--ink); outline-offset: -1px; }
.heat-legend { display: flex; align-items: center; gap: 3px; justify-content: flex-end; font-size: 0.72rem; color: var(--muted); margin-top: 0.5rem; }
.heat-legend i { width: 0.7rem; height: 0.7rem; border-radius: 2px; display: inline-block; }

/* ---- settings -------------------------------------------------------- */

.panel { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1rem; margin-bottom: 1.2rem; }
.panel h2 { font-family: var(--round); font-size: 1.15rem; font-weight: 800; margin-bottom: 0.3rem; }
.panel > p { margin-bottom: 0.7rem; font-size: 0.92rem; }
.page-title { font-family: var(--round); font-size: 1.8rem; font-weight: 800; letter-spacing: -0.03em; margin-bottom: 1rem; }

.list-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.55rem 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.list-row:first-of-type { border-top: 0; }
.list-row .emoji-in { width: 3rem; text-align: center; padding: 0.45rem 0.2rem; }
.list-row .name-in { flex: 1; min-width: 8rem; padding: 0.45rem 0.6rem; }
.list-row .n { font-size: 0.8rem; color: var(--muted); min-width: 3.5rem; }
.swatches { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.swatch { width: 1.45rem; height: 1.45rem; border-radius: 50%; border: 2px solid transparent; background: var(--c); transition: transform 0.15s var(--spring); }
.swatch[aria-pressed="true"] { border-color: var(--card); box-shadow: 0 0 0 2px var(--c); transform: scale(1.08); }
.swatch:active { transform: scale(0.9); }
.list-new { border-top: 1px dashed var(--line); margin-top: 0.3rem; padding-top: 0.8rem; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.4rem 0; }
.switch { position: relative; width: 3rem; height: 1.75rem; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--bg-2); transition: background 0.2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: calc(1.75rem - 6px); height: calc(1.75rem - 6px); border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.25s var(--spring); }
.switch input:checked + span { background: var(--good); }
.switch input:checked + span::after { transform: translateX(1.25rem); }
.switch input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); }

.key-row { display: flex; align-items: center; gap: 0.5rem; padding: 0.5rem 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.key-row:first-of-type { border-top: 0; }
.key-row input { flex: 1; min-width: 8rem; padding: 0.45rem 0.6rem; }
.key-row small { color: var(--muted); width: 100%; }
.this-session { font-size: 0.75rem; font-weight: 700; color: var(--good); }
.actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.6rem; }

/* ---- toasts, celebrations -------------------------------------------- */

.toasts {
  position: fixed;
  left: 50%;
  bottom: calc(1.2rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  width: max-content;
  max-width: calc(100% - 2rem);
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  background: #221d2c;
  color: #fff;
  border-radius: 14px;
  padding: 0.65rem 0.75rem 0.65rem 1rem;
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, 0.5);
  font-weight: 600;
  font-size: 0.93rem;
  animation: toast-in 0.35s var(--spring);
}
@media (prefers-color-scheme: dark) { .toast { background: #f3f0f8; color: #1d1a24; } }
.toast.error { background: var(--late); color: #fff; }
.toast.out { animation: toast-out 0.25s ease-in forwards; }
.toast button { border: 0; background: rgba(255, 255, 255, 0.16); color: inherit; font-weight: 800; border-radius: 9px; padding: 0.3rem 0.7rem; }
@media (prefers-color-scheme: dark) { .toast:not(.error) button { background: rgba(0, 0, 0, 0.08); } }

canvas.fx { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

.float-text {
  position: fixed;
  z-index: 71;
  pointer-events: none;
  font-family: var(--round);
  font-weight: 800;
  font-size: 1.1rem;
  white-space: nowrap;
  transform: translate(-50%, -50%);
  text-shadow: 0 2px 10px var(--card);
  animation: float-up 1.1s var(--ease) forwards;
}

.all-clear {
  position: fixed;
  inset: 0;
  z-index: 65;
  display: grid;
  place-items: center;
  pointer-events: none;
}
.all-clear div {
  background: var(--card);
  border-radius: 26px;
  box-shadow: var(--shadow-lift);
  padding: 1.4rem 2rem;
  text-align: center;
  animation: banner 2.6s var(--spring) forwards;
}
.all-clear b { display: block; font-size: 3rem; line-height: 1.2; }
.all-clear strong { display: block; font-family: var(--round); font-size: 1.5rem; font-weight: 800; letter-spacing: -0.02em; }
.all-clear span { color: var(--muted); }

/* ---- Sir JD ---------------------------------------------------------- */

.sir-jd {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(15, 12, 22, 0.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fade-in 0.25s ease-out;
  cursor: pointer;
}
.sir-jd.bye { animation: fade-out 0.3s ease-in forwards; }
.sir-jd-card {
  position: relative;
  width: min(21rem, 100%);
  background: var(--card);
  border-radius: 28px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.6);
  padding: 1.4rem 1.3rem 1.2rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  text-align: center;
  overflow: hidden;
  animation: sheet-in 0.45s var(--spring);
}
.sir-jd-face {
  --open: 0;
  position: relative;
  width: 9rem;
  height: 9rem;
  border-radius: 50%;
  overflow: hidden;
  border: 5px solid #fff;
  box-shadow: 0 0 0 4px #1d2bff, 0 14px 28px -10px rgba(29, 43, 255, 0.7);
  background: #1d2bff;
  animation: jd-arrive 0.8s var(--spring), jd-bob 2.4s 0.8s ease-in-out infinite;
}
/* The picture is 768x511; the circle shows its middle square. The jaw is the
   same picture clipped below the lips, dropped by up to 25 picture pixels
   (5%) over a dark mouth. Coordinates are percent of that square. */
.sir-jd-face i {
  position: absolute;
  inset: 0;
  background: url(sir-jd.webp) 50% 0 / auto 100% no-repeat;
}
/* The mouth follows the lip line (just under the jaw's cut, so nothing shows
   while it's shut) and is deepest in the middle, so it opens as a lens. */
.sir-jd-face .jd-mouth {
  clip-path: polygon(41% 65.05%, 45.7% 65.45%, 50.4% 65.65%, 55.1% 65.45%, 59.8% 64.65%,
    59.8% 66%, 55.1% 70%, 50.4% 70.6%, 45.7% 70%, 41% 66.4%);
  background: linear-gradient(transparent 64%, #f3ece2 64%, #f3ece2 66%, #7a1a2c 66%, #2a060c 70.6%);
  /* Only while open: the jaw's soft edge would let it show through. */
  opacity: clamp(0, calc(var(--open) * 5), 1);
}
.sir-jd-face .jd-jaw {
  /* Below the lips, with a soft edge so the beard blends where it moves. */
  -webkit-mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"%3E%3Cfilter id="f" x="-10%25" y="-10%25" width="120%25" height="120%25"%3E%3CfeGaussianBlur stdDeviation="0.9"/%3E%3C/filter%3E%3Cpolygon points="15,100 20.3,92 32,75.3 41,64.8 45.7,65.2 50.4,65.4 55.1,65.2 59.8,64.4 69.2,75.3 81.5,92 87.4,100 87.4,110 15,110" fill="%23fff" filter="url%28%23f%29"/%3E%3C/svg%3E') 0 0 / 100% 100% no-repeat;
  mask: url('data:image/svg+xml,%3Csvg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" preserveAspectRatio="none"%3E%3Cfilter id="f" x="-10%25" y="-10%25" width="120%25" height="120%25"%3E%3CfeGaussianBlur stdDeviation="0.9"/%3E%3C/filter%3E%3Cpolygon points="15,100 20.3,92 32,75.3 41,64.8 45.7,65.2 50.4,65.4 55.1,65.2 59.8,64.4 69.2,75.3 81.5,92 87.4,100 87.4,110 15,110" fill="%23fff" filter="url%28%23f%29"/%3E%3C/svg%3E') 0 0 / 100% 100% no-repeat;
  transform: translateY(calc(var(--open) * 5%));
  transition: transform 0.05s linear;
}
.sir-jd-name {
  margin-top: -1.4rem;
  z-index: 1;
  background: linear-gradient(135deg, #f5c542, #e8a317);
  color: #2a1d00;
  font-family: var(--round);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.2rem 0.8rem;
  border-radius: 999px;
  box-shadow: 0 4px 10px -4px rgba(0, 0, 0, 0.4);
}
.sir-jd-bubble {
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.8rem 1rem;
  font-size: 0.98rem;
  animation: pop-in 0.4s 0.35s var(--spring) both;
}
.sir-jd-bubble strong { display: block; font-family: var(--round); font-size: 1.15rem; margin-bottom: 0.2rem; }
.sir-jd-card .primary { width: 100%; padding: 0.75rem; }
.sir-jd-timer {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 4px;
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: left;
  opacity: 0;
}
.sir-jd.talked .sir-jd-timer { opacity: 1; animation: jd-timer var(--linger, 10s) linear forwards; }
.sir-jd-bubble strong:empty + span:empty::before { content: "…"; }
/* A cheer: in the corner, above the toasts, without covering the page. */
.sir-jd.cheer {
  inset: auto 1rem calc(4.4rem + env(safe-area-inset-bottom, 0px)) auto;
  display: block;
  padding: 0;
  background: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
  animation: none;
  pointer-events: none;
}
.sir-jd.cheer .sir-jd-card {
  pointer-events: auto;
  width: min(23rem, calc(100vw - 2rem));
  flex-direction: row;
  align-items: flex-start;
  text-align: left;
  gap: 0.8rem;
  padding: 0.8rem 0.9rem 1.15rem;
  border-radius: 22px;
  box-shadow: 0 18px 40px -14px rgba(0, 0, 0, 0.55), 0 0 0 1px var(--line);
  animation: cheer-in 0.5s var(--spring);
}
.sir-jd.cheer.bye { animation: none; }
.sir-jd.cheer.bye .sir-jd-card { animation: toast-out 0.3s ease-in forwards; }
.sir-jd.cheer .sir-jd-face {
  flex: none;
  width: 4.8rem;
  height: 4.8rem;
  border-width: 3px;
  box-shadow: 0 0 0 3px #1d2bff, 0 8px 16px -8px rgba(29, 43, 255, 0.7);
}
.sir-jd.cheer .sir-jd-name {
  position: absolute;
  left: calc(0.9rem + 2.4rem);
  top: 5.1rem;
  transform: translateX(-50%);
  margin: 0;
  font-size: 0.6rem;
  padding: 0.1rem 0.45rem;
}
.sir-jd.cheer .sir-jd-bubble {
  flex: 1;
  min-width: 0;
  min-height: 4.8rem;
  padding: 0.55rem 0.75rem;
  font-size: 0.92rem;
  animation-delay: 0.2s;
}
.sir-jd.cheer .sir-jd-bubble strong { font-size: 1.02rem; }
@media (max-width: 600px) {
  .sir-jd.cheer { left: 1rem; }
  .sir-jd.cheer .sir-jd-card { width: 100%; }
}
@keyframes cheer-in { 0% { opacity: 0; transform: translateY(40px) scale(0.85); } 100% { opacity: 1; transform: none; } }
/* ---- easter eggs ------------------------------------------------------ */

.jd-head {
  --ring: #1d2bff;
  position: fixed;
  z-index: 72;
  border-radius: 50%;
  background: #1d2bff url(sir-jd.webp) 50% 0 / auto 100% no-repeat;
  border: 4px solid #fff;
  box-shadow: 0 0 0 4px var(--ring), 0 10px 24px -8px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.jd-head.bye { opacity: 0; transition: opacity 0.4s; }

.jd-dvd { left: 0; top: 0; width: 84px; height: 84px; pointer-events: auto; cursor: pointer; transition: box-shadow 0.2s; }

.jd-balloon {
  left: 50%;
  top: 45%;
  width: 90px;
  height: 90px;
  margin: -45px 0 0 -45px;
  animation: jd-inflate 2.6s cubic-bezier(0.5, 0, 0.9, 0.6) forwards;
}

.barrel-roll { transform-origin: 50% 40vh; }
.barrel-roll { animation: barrel-roll 1.3s cubic-bezier(0.45, 0, 0.2, 1); }

.jd-parade {
  position: fixed;
  left: 0;
  right: 0;
  top: 38%;
  height: 80px;
  z-index: 72;
  pointer-events: none;
  overflow: hidden;
}
.jd-marcher {
  position: absolute;
  left: -90px;
  top: 6px;
  width: 64px;
  height: 64px;
  border-width: 3px;
  box-shadow: 0 0 0 3px #1d2bff, 0 8px 16px -6px rgba(0, 0, 0, 0.5);
  animation: march 5s linear forwards, march-bob 0.52s ease-in-out infinite alternate;
}

body.disco #app, body.disco header.top { animation: disco 0.5s linear infinite; }
/* Spinning colored lights over everything. */
body.disco::after {
  content: "";
  position: fixed;
  inset: -50%;
  z-index: 71;
  pointer-events: none;
  background: repeating-conic-gradient(from 0deg at 50% 30%,
    rgba(255, 60, 160, 0.38) 0deg 12deg, transparent 12deg 30deg,
    rgba(60, 200, 255, 0.34) 30deg 42deg, transparent 42deg 60deg,
    rgba(255, 220, 60, 0.34) 60deg 72deg, transparent 72deg 90deg);
  mix-blend-mode: screen;
  animation: lights 3s linear infinite, lights-pulse 0.5s ease-in-out infinite alternate;
}
.disco-ball {
  position: fixed;
  left: 50%;
  top: 0;
  z-index: 72;
  font-size: 4.5rem;
  line-height: 1;
  transform: translate(-50%, -120%);
  animation: ball-drop 0.7s var(--spring) forwards, ball-spin 1s linear infinite;
  pointer-events: none;
  filter: drop-shadow(0 0 24px rgba(255, 255, 255, 0.6));
}
.disco-ball.bye { animation: ball-up 0.5s ease-in forwards; }

/* Blue Sir JD, everywhere he appears, until the next finished task. */
body.jd-blue .sir-jd-face i, body.jd-blue .jd-head {
  filter: grayscale(1) sepia(1) saturate(6) hue-rotate(180deg) brightness(0.95);
}
.jd-blue-badge {
  position: fixed;
  left: 0.8rem;
  bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
  z-index: 50;
  border: 0;
  background: none;
  padding: 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  animation: jd-bob 2s ease-in-out infinite;
}
.jd-blue-badge .jd-head {
  position: static;
  display: block;
  width: 3rem;
  height: 3rem;
  border-width: 3px;
  box-shadow: 0 0 0 3px #1d2bff, 0 8px 16px -6px rgba(0, 0, 0, 0.5);
}
.jd-blue-badge b {
  background: #1d2bff;
  color: #fff;
  font-size: 0.75rem;
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
  animation: help 1.4s ease-in-out infinite;
}

/* Laser eyes. */
.laser-stage { position: fixed; inset: 0; z-index: 90; pointer-events: none; }
.laser-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.jd-laser {
  left: 50%;
  top: 0.5rem;
  width: 150px;
  height: 150px;
  margin-left: -75px;
  animation: laser-drop 0.8s var(--spring) both;
}
.jd-laser.leaving { animation: laser-leave 0.8s ease-in forwards; }
/* Eyes in the picture's middle square: about (36.5%, 43%) and (61.9%, 42.7%). */
.jd-laser .eye {
  position: absolute;
  width: 14%;
  height: 10%;
  border-radius: 50%;
  translate: -50% -50%;
  background: radial-gradient(circle, #fff 0 18%, #ff2a2a 40%, rgba(255, 0, 0, 0) 72%);
  opacity: 0;
  transition: opacity 0.5s;
}
.jd-laser .eye.l { left: 36.5%; top: 43%; }
.jd-laser .eye.r { left: 61.9%; top: 42.7%; }
.jd-laser.charged .eye { opacity: 1; animation: eye-glow 0.15s ease-in-out infinite alternate; }
.lasered {
  transform: translate(var(--dx, 0), var(--dy, 0)) rotate(var(--tilt, 0deg)) !important;
  transition: transform 0.25s var(--spring), filter 0.3s;
  filter: sepia(0.7) brightness(0.65) contrast(1.2);
}
.lasered.falling {
  transform: translate(var(--dx, 0), 130vh) rotate(var(--fall-tilt, 60deg)) !important;
  transition: transform 1.4s cubic-bezier(0.55, 0, 0.9, 0.45);
}
.scorch {
  position: absolute;
  width: 46px;
  height: 46px;
  margin: -23px 0 0 -23px;
  border-radius: 50%;
  background: radial-gradient(circle, #1a0a05 0 25%, rgba(60, 20, 5, 0.75) 45%, rgba(255, 120, 20, 0.35) 60%, transparent 72%);
  pointer-events: none;
  z-index: 5;
}
body.wrecked #app, body.wrecked header.top { pointer-events: none; }
body.wrecked::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background:
    radial-gradient(ellipse 60% 40% at 30% 80%, rgba(255, 80, 20, 0.22), transparent 60%),
    radial-gradient(ellipse 50% 50% at 70% 30%, rgba(40, 20, 10, 0.5), transparent 70%),
    rgba(20, 8, 4, 0.35);
  animation: smolder 1.8s ease-in-out infinite alternate;
}
.cleanup-btn {
  position: fixed;
  left: 50%;
  bottom: calc(2rem + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 95;
  border: 0;
  border-radius: 999px;
  padding: 0.9rem 1.4rem;
  font-weight: 800;
  font-size: 1.05rem;
  background: #fff;
  color: #1d1a24;
  box-shadow: 0 14px 34px -10px rgba(0, 0, 0, 0.7);
  animation: toast-in 0.4s var(--spring);
}

/* Whack-a-JD. */
.whack-stage { position: fixed; inset: 0; z-index: 72; pointer-events: none; }
.jd-mole {
  width: 74px;
  height: 74px;
  margin: -37px 0 0 -37px;
  pointer-events: auto;
  cursor: pointer;
  touch-action: manipulation;
  animation: mole-up 0.25s var(--spring);
}
.jd-mole.hiding { transform: scale(0); transition: transform 0.25s ease-in; }
.jd-mole.whacked { transform: scale(0.6, 0.3); transition: transform 0.15s; }

/* Peek-a-boo from the left edge. */
.jd-peek {
  left: 0;
  top: 30%;
  width: 240px;
  height: 240px;
  animation: peek 5.2s ease-in-out forwards;
}

/* Earthquake. */
body.quake #app, body.quake header.top { animation: quake 0.09s linear infinite; }
body.quake .card { animation: quake-card 0.2s ease-in-out infinite alternate; }

/* Jackpot. */
.slot {
  position: fixed;
  left: 50%;
  top: 22%;
  z-index: 72;
  transform: translateX(-50%);
  background: linear-gradient(#ffcf3f, #e8a317);
  border-radius: 24px;
  padding: 0.9rem 0.9rem 0.6rem;
  box-shadow: 0 20px 50px -14px rgba(0, 0, 0, 0.6), inset 0 -4px 0 rgba(0, 0, 0, 0.15);
  text-align: center;
  pointer-events: none;
  animation: sheet-in 0.4s var(--spring);
}
.slot.bye { animation: toast-out 0.4s ease-in forwards; }
.slot-reels { display: flex; gap: 0.5rem; }
.reel {
  width: 76px;
  height: 76px;
  border-radius: 14px;
  background: #fff;
  display: grid;
  place-items: center;
  font-size: 2.6rem;
  box-shadow: inset 0 4px 8px rgba(0, 0, 0, 0.2);
  overflow: hidden;
}
.reel.stopped { animation: bump 0.3s var(--spring); }
.jd-reel { position: static; display: block; width: 62px; height: 62px; border-width: 2px; box-shadow: 0 0 0 2px #1d2bff; }
.slot-msg { margin-top: 0.4rem; font-family: var(--round); font-weight: 800; color: #3a2600; letter-spacing: 0.06em; }
.slot.won .slot-msg { font-size: 1.4rem; animation: bump 0.5s var(--spring) 3; }

@keyframes help { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes laser-drop { from { transform: translateY(-120%) scale(0.6); } to { transform: none; } }
@keyframes laser-leave { to { transform: translateY(-140%) rotate(20deg); } }
@keyframes eye-glow { from { transform: scale(0.9); filter: brightness(1); } to { transform: scale(1.25); filter: brightness(1.6); } }
@keyframes smolder { from { opacity: 0.75; } to { opacity: 1; } }
@keyframes mole-up { from { transform: translateY(40px) scale(0.3); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes peek {
  0% { transform: translateX(-110%) rotate(30deg); }
  25% { transform: translateX(-40%) rotate(18deg); }
  70% { transform: translateX(-40%) rotate(22deg); }
  100% { transform: translateX(-110%) rotate(30deg); }
}
@keyframes quake { 0% { transform: translate(0, 0); } 25% { transform: translate(-5px, 3px) rotate(-0.6deg); } 50% { transform: translate(4px, -4px); } 75% { transform: translate(-3px, 4px) rotate(0.6deg); } 100% { transform: translate(0, 0); } }
@keyframes quake-card { from { rotate: -1.5deg; } to { rotate: 1.5deg; } }

@keyframes jd-inflate {
  0% { transform: scale(0.3); }
  15% { transform: scale(1) rotate(-6deg); }
  30% { transform: scale(1.5, 1.35) rotate(5deg); }
  45% { transform: scale(1.9, 2.1) rotate(-4deg); }
  60% { transform: scale(2.6, 2.4) rotate(6deg); }
  75% { transform: scale(3, 3.3) rotate(-5deg); }
  90% { transform: scale(3.7, 3.5) rotate(3deg); }
  100% { transform: scale(4.2) rotate(0); }
}
@keyframes barrel-roll { from { transform: rotate(0); } to { transform: rotate(360deg); } }
@keyframes march { from { left: -90px; } to { left: calc(100% + 30px); } }
@keyframes march-bob { from { transform: translateY(0) rotate(-8deg); } to { transform: translateY(-12px) rotate(8deg); } }
@keyframes lights { to { rotate: 360deg; } }
@keyframes lights-pulse { from { opacity: 0.55; } to { opacity: 1; } }
@keyframes disco { from { filter: hue-rotate(0deg) saturate(1.6); } to { filter: hue-rotate(360deg) saturate(1.6); } }
@keyframes ball-drop { to { transform: translate(-50%, 1.5rem); } }
@keyframes ball-spin { from { rotate: 0deg; } to { rotate: 360deg; } }
@keyframes ball-up { from { transform: translate(-50%, 1.5rem); } to { transform: translate(-50%, -120%); } }

@keyframes jd-arrive { 0% { transform: scale(0.2) rotate(-25deg); opacity: 0; } 60% { transform: scale(1.12) rotate(6deg); opacity: 1; } 100% { transform: none; } }
@keyframes jd-bob { 0%, 100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-5px) rotate(-2deg); } }
@keyframes jd-timer { to { transform: scaleX(0); } }
@keyframes fade-in { from { opacity: 0; } }

/* ---- sign-in page ---------------------------------------------------- */

.login-body { display: grid; place-items: center; padding: 1.5rem 1rem; }
.login-card {
  width: 100%;
  max-width: 24rem;
  background: var(--card);
  border-radius: 26px;
  box-shadow: var(--shadow-lift);
  padding: 2rem 1.5rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  animation: sheet-in 0.5s var(--spring);
}
.login-mark { margin: 0 auto; border-radius: 18px; box-shadow: 0 12px 24px -10px var(--accent); animation: float 3.5s ease-in-out infinite; }
.login-card h1 { font-family: var(--round); font-size: 2rem; font-weight: 800; letter-spacing: -0.03em; }
.login-card form { display: flex; flex-direction: column; gap: 0.8rem; text-align: left; }

/* ---- motion ---------------------------------------------------------- */

@keyframes check-pop { 0% { transform: scale(0.8); } 45% { transform: scale(1.28); } 100% { transform: scale(1); } }
@keyframes ripple { 0% { opacity: 0.7; transform: scale(1); } 100% { opacity: 0; transform: scale(2.3); } }
@keyframes arrive { 0% { opacity: 0; transform: translateY(-14px) scale(0.94); } 100% { opacity: 1; transform: none; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop-in { 0% { opacity: 0; transform: scale(0.6); } 100% { opacity: 1; transform: none; } }
@keyframes squish { 0% { transform: scale(1); } 30% { transform: scale(0.98, 0.94); } 65% { transform: scale(1.01, 1.03); } 100% { transform: none; } }
@keyframes shake { 0%, 100% { transform: none; } 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes glow { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--good) 50%, transparent); } 50% { box-shadow: 0 0 0 8px transparent; } }
@keyframes sheet-in { 0% { opacity: 0; transform: translateY(12px) scale(0.97); } 100% { opacity: 1; transform: none; } }
@keyframes sheet-up { 0% { transform: translateY(100%); } 100% { transform: none; } }
@keyframes toast-in { 0% { opacity: 0; transform: translateY(16px) scale(0.95); } 100% { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(10px) scale(0.96); } }
@keyframes float-up { 0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); } 20% { opacity: 1; transform: translate(-50%, -90%) scale(1.12); } 100% { opacity: 0; transform: translate(-50%, -260%) scale(1); } }
@keyframes banner { 0% { opacity: 0; transform: scale(0.6); } 15% { opacity: 1; transform: scale(1.05); } 22% { transform: scale(1); } 85% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(0.95); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

@media (max-width: 420px) {
  .ring { width: 92px; height: 92px; }
  .ring-label strong { font-size: 1.55rem; }
  .tabs a { padding: 0.35rem 0.6rem; }
  .stat-card strong { font-size: 1.4rem; }
}
