:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --text: #1c1f23;
  --muted: #6b7078;
  --faint: #a3a7ad;
  --line: #e8e7e4;
  --line-strong: #d6d5d1;
  --code-bg: #f2f1ee;

  --done: #16a34a;
  --pr: #d97706;
  --ready: #2563eb;
  --waiting: #a1a1aa;

  --radius: 14px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 4px 16px rgb(0 0 0 / 0.04);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e1013;
    --surface: #16191e;
    --text: #e7e9ec;
    --muted: #9298a1;
    --faint: #5f656e;
    --line: #23272e;
    --line-strong: #30353d;
    --code-bg: #1f2329;

    --done: #22c55e;
    --pr: #f59e0b;
    --ready: #60a5fa;
    --waiting: #6b7280;

    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }

code {
  font: 0.86em var(--mono);
  background: var(--code-bg);
  padding: 0.1em 0.35em;
  border-radius: 5px;
  overflow-wrap: anywhere;
}

main, .topbar, .footer {
  max-width: 1080px;
  margin: 0 auto;
  padding-left: 24px;
  padding-right: 24px;
}

/* ---------- top bar ---------- */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  padding-bottom: 8px;
}

.wordmark { font-weight: 700; letter-spacing: -0.01em; }
.wordmark span { color: var(--muted); font-weight: 500; }

.account { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); }
.account img { width: 26px; height: 26px; border-radius: 50%; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--text);
  background: var(--text);
  color: var(--bg);
  font: 600 14px/1 var(--font);
  padding: 10px 16px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  transition: opacity 0.15s ease;
}
.button:hover { opacity: 0.85; }
.button:disabled { opacity: 0.5; cursor: progress; }
.button.quiet { background: transparent; color: var(--text); border-color: var(--line-strong); }
.button svg { width: 16px; height: 16px; }

.linkish {
  background: none;
  border: 0;
  padding: 0;
  color: var(--muted);
  font: inherit;
  text-decoration: underline;
  text-decoration-color: var(--line-strong);
  text-underline-offset: 3px;
  cursor: pointer;
}
.linkish:hover { color: var(--text); }

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

.week { padding: 40px 0 8px; }

.week-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
}
.week-title h1 { margin: 0; font-size: 44px; line-height: 1.1; letter-spacing: -0.03em; }
.week-title .due { color: var(--muted); font-size: 16px; }
.week-title .due strong { color: var(--text); font-weight: 600; }

.week-headline { margin: 12px 0 28px; font-size: 19px; line-height: 1.45; max-width: 46ch; letter-spacing: -0.01em; }

.progress {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--line);
  gap: 2px;
}
.progress span { display: block; height: 100%; transition: width 0.4s ease; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 20px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.legend b { color: var(--text); font-weight: 600; }

.checkpoints { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; padding: 0; list-style: none; }
.checkpoints li {
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
}
.checkpoints li b { color: var(--text); font-weight: 600; margin-right: 6px; }
.checkpoints li.past { opacity: 0.55; }

.notice {
  margin-top: 24px;
  padding: 12px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  font-size: 14px;
  color: var(--muted);
}

/* ---------- status ---------- */

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--waiting)); flex: none; }
.s-done { --c: var(--done); }
.s-pr { --c: var(--pr); }
.s-ready { --c: var(--ready); }
.s-waiting { --c: var(--waiting); }
.s-unknown { --c: var(--line-strong); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  color: var(--c);
  background: color-mix(in srgb, var(--c) 12%, transparent);
  white-space: nowrap;
}
.pill.s-waiting, .pill.s-unknown { color: var(--muted); }

/* ---------- sections ---------- */

.block { margin-top: 56px; }
.block h2 { margin: 0; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.block-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 24px; margin-bottom: 16px; }
.block > h2 { margin-bottom: 16px; }
.hint { margin: 0; font-size: 13px; color: var(--muted); }

/* ---------- team ---------- */

.team { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; }
.member {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  min-width: 0;
}
.member img { width: 34px; height: 34px; border-radius: 50%; flex: none; background: var(--line); }
.member .who { font-weight: 600; font-size: 14px; }
.member .what { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.member.free .what { color: var(--faint); }

/* ---------- dependency map ---------- */

.map {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 20px;
  overflow-x: auto;
  box-shadow: var(--shadow);
}
.map svg { display: block; margin: 0 auto; }

.lane-label { font: 600 11px var(--font); letter-spacing: 0.08em; text-transform: uppercase; fill: var(--faint); }

.edge { fill: none; stroke: var(--line-strong); stroke-width: 1.5; transition: stroke 0.15s, opacity 0.15s; }
.edge.done { stroke-dasharray: 3 4; }

.node { cursor: pointer; transition: opacity 0.15s; }
.node rect {
  fill: var(--surface);
  stroke: var(--line-strong);
  stroke-width: 1.2;
  transition: stroke 0.15s, fill 0.15s;
}
.node.s-done rect { fill: color-mix(in srgb, var(--done) 10%, var(--surface)); stroke: color-mix(in srgb, var(--done) 45%, var(--surface)); }
.node.s-pr rect { stroke: color-mix(in srgb, var(--pr) 60%, var(--surface)); }
.node.s-ready rect { stroke: color-mix(in srgb, var(--ready) 60%, var(--surface)); }
.node circle { fill: var(--c); }
.node .num { font: 500 12px var(--mono); fill: var(--muted); }
.node .name { font: 600 13px var(--font); fill: var(--text); }
.node .letter { font: 600 11px var(--font); fill: var(--faint); }

.map.mine-mode .node:not(.mine) { opacity: 0.4; }
.map.mine-mode .node.mine rect { stroke: var(--text); stroke-width: 1.6; }
.map.focus .node, .map.focus .edge { opacity: 0.22; }
.map.focus .node.on, .map.focus .edge.on { opacity: 1; }
.map.focus .node.self rect { stroke: var(--text); stroke-width: 2; }
.map.focus .edge.on { stroke: var(--text); }

/* ---------- bundles ---------- */

.bundles { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }

.bundle {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  min-width: 0;
}

.bundle-head { padding: 20px 20px 16px; border-bottom: 1px solid var(--line); }
.bundle-name { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.letter-badge {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--code-bg);
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  flex: none;
}
.bundle-tagline { margin: 6px 0 14px; color: var(--muted); font-size: 14px; }

.share { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.share-track { flex: 1; height: 4px; border-radius: 999px; background: var(--line); overflow: hidden; }
.share-track span { display: block; height: 100%; background: var(--muted); border-radius: 999px; }

.task { padding: 16px 20px; border-bottom: 1px solid var(--line); scroll-margin-top: 24px; transition: background 0.3s; }
.task.flash { background: color-mix(in srgb, var(--ready) 8%, transparent); }
.task-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.task-step { font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--faint); }
.task-title { margin: 2px 0 0; font-size: 15px; font-weight: 600; line-height: 1.35; }
.task-title a { text-decoration: none; }
.task-title a:hover { text-decoration: underline; }
.task-title .num { font: 500 13px var(--mono); color: var(--muted); margin-right: 6px; }
.task-headline { margin: 8px 0 6px; }
.task ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; }
.task li { margin: 3px 0; }
.task li::marker { color: var(--faint); }

.ripple { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 12px; font-size: 13px; color: var(--muted); }
.ripple .arrow { color: var(--faint); }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--code-bg);
  color: var(--text);
  font-size: 12.5px;
  cursor: pointer;
  border: 0;
  font-family: inherit;
}
.chip:hover { background: var(--line); }

.early { margin-top: 10px; font-size: 13px; color: var(--muted); padding-left: 10px; border-left: 2px solid var(--ready); }
.early b { color: var(--text); font-weight: 600; }

.pr-line { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-size: 13px; }
.pr-notes { margin-top: 6px !important; }

.bundle-foot { margin-top: auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; min-height: 72px; }
.owner { display: flex; align-items: center; gap: 10px; font-size: 14px; min-width: 0; }
.owner img { width: 28px; height: 28px; border-radius: 50%; }
.owner .muted { color: var(--muted); }
.error { color: #dc2626; font-size: 13px; }

/* ---------- your bundle ---------- */

main { display: flex; flex-direction: column; }
.week { order: -3; }
.notice { order: -2; }
body.mine-mode #bundles-block { order: -1; }

#team-block { view-transition-name: team-block; }
#map-block { view-transition-name: map-block; }

.bundle.mine { grid-column: 1 / -1; }
.bundle.mine .bundle-head { padding: 24px 24px 18px; }
.bundle.mine .bundle-name { font-size: 22px; }
.bundle.mine .bundle-tasks {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}
.bundle.mine .task { background: var(--surface); border-bottom: 0; padding: 20px 24px; }
.bundle.mine .bundle-foot { padding: 16px 24px; }

.bundle.landed { animation: landed 1.1s ease-out; }
@keyframes landed {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ready) 45%, transparent); }
  100% { box-shadow: 0 0 0 14px transparent; }
}

.syncing { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.spinner {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--ready);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Claiming morphs the chosen card into the focused view; the other cards shrink away. */
::view-transition-group(*) { animation-duration: 0.6s; animation-timing-function: cubic-bezier(0.2, 0.8, 0.2, 1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.3s; }
::view-transition-old(*.bundle):only-child { animation: bundle-out 0.35s ease-in both; }
::view-transition-new(*.bundle):only-child { animation: bundle-in 0.45s 0.15s ease-out both; }
@keyframes bundle-out { to { opacity: 0; transform: scale(0.92); } }
@keyframes bundle-in { from { opacity: 0; transform: scale(0.96); } }

.footer { margin-top: 64px; padding-top: 20px; padding-bottom: 40px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 20px; justify-content: space-between; }

@media (max-width: 640px) {
  main, .topbar, .footer { padding-left: 16px; padding-right: 16px; }
  .week { padding-top: 24px; }
  .week-title h1 { font-size: 34px; }
  .week-headline { font-size: 17px; }
  .bundles { grid-template-columns: 1fr; }
  .block { margin-top: 44px; }
  .map { padding: 12px; }
  .team { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .member { padding: 10px; gap: 10px; }
  .member img { width: 28px; height: 28px; }
}
