:root {
  --page: #fbf3e7;
  --surface: #fffaf2;
  --surface-soft: #f7ecdf;
  --ink: #4f4038;
  --ink-soft: #8b776d;
  --line: #ead8c7;
  --accent: #d98267;
  --accent-soft: #fbe4da;
  --green: #94a27a;
  --green-soft: #edf0df;
  --focus: rgba(217, 130, 103, 0.23);
  --body: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --display: "Kaiti SC", "STKaiti", "KaiTi", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 16% 0, rgba(239, 164, 126, 0.17), transparent 31%),
    radial-gradient(circle at 85% 7%, rgba(244, 205, 130, 0.16), transparent 29%),
    linear-gradient(rgba(255, 255, 255, 0.58), rgba(255, 255, 255, 0) 380px),
    var(--page);
  font-family: var(--body);
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
a:focus-visible,
.todo-text:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.page-shell {
  width: min(780px, calc(100% - 40px));
  margin: 0 auto;
  padding: 30px 0 44px;
}

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid rgba(217, 130, 103, 0.38);
  border-radius: 4px;
  color: var(--accent);
  background: var(--accent-soft);
  font-family: var(--display);
  transform: rotate(-2deg);
}

.brand-mark::before,
.brand-mark::after {
  display: none;
}

.brand-mark span {
  font-size: 23px;
  line-height: 1;
}

.brand strong {
  display: block;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.brand small {
  display: block;
  margin-top: 3px;
  color: var(--ink-soft);
  font-size: 10px;
}

.date-block {
  display: grid;
  grid-template-columns: auto auto;
  align-items: end;
  column-gap: 8px;
  color: var(--ink-soft);
  text-align: right;
}

.date-block span {
  font-size: 9px;
}

.date-block strong {
  grid-row: span 2;
  color: var(--ink);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.hero {
  padding: 68px 0 48px;
}

.eyebrow,
.section-kicker {
  color: var(--accent);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

.eyebrow {
  margin: 0 0 14px;
}

.hero h1 {
  margin: 0;
  font-family: var(--display);
  font-size: clamp(40px, 6.1vw, 54px);
  font-weight: 400;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero h1 em {
  color: var(--accent);
  font-style: normal;
}

.intro {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.95;
}

.shanghai-line {
  position: relative;
  margin-top: 31px;
  color: var(--green);
}

.shanghai-line svg {
  display: block;
  width: 100%;
  height: 86px;
  opacity: 0.4;
  overflow: visible;
}

.shanghai-line path,
.shanghai-line circle {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.shanghai-line .city-base {
  opacity: 0.45;
}

.shanghai-line > span {
  position: absolute;
  right: 1px;
  bottom: -1px;
  padding-left: 9px;
  color: #a18476;
  background: var(--page);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.progress-card {
  margin-top: 12px;
  padding: 19px 21px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 250, 242, 0.84);
  box-shadow: inset 3px 0 0 rgba(217, 130, 103, 0.7);
}

.progress-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.progress-topline span {
  color: var(--ink-soft);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.progress-topline p {
  margin: 5px 0 0;
  font-size: 12px;
  font-weight: 500;
}

.progress-topline > strong {
  color: var(--accent);
  font-size: 22px;
  font-weight: 600;
}

.progress-ring {
  position: relative;
  height: 5px;
  margin-top: 16px;
  overflow: hidden;
  border-radius: 99px;
  background: #eddfd2;
}

.progress-ring::after {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--progress, 0%);
  border-radius: inherit;
  background: var(--accent);
  content: "";
  transition: width 400ms ease;
}

.progress-ring div {
  display: none;
}

.tally {
  margin-top: 9px;
  color: var(--ink-soft);
  font-size: 9px;
  text-align: right;
}

.tally strong {
  color: var(--ink);
  font-weight: 600;
}

.workspace {
  padding: 30px 32px 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 250, 242, 0.97);
  box-shadow: 0 16px 45px rgba(112, 77, 54, 0.08);
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
}

.section-kicker {
  display: block;
  margin-bottom: 4px;
}

.section-heading h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--ink-soft);
  font-size: 9px;
}

.sync-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #d5aa5d;
}

.sync-status.is-online .sync-dot { background: var(--green); }
.sync-status.is-error .sync-dot { background: var(--accent); }

.add-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  margin-top: 23px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

.add-form:focus-within {
  border-color: #cbb29f;
  box-shadow: 0 0 0 3px rgba(217, 130, 103, 0.11);
}

.add-form input {
  width: 100%;
  padding: 12px 13px;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
}

.add-form input::placeholder { color: #b49c8f; }

.add-form button {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 15px;
  border: 0;
  border-radius: 9px;
  color: #fff;
  background: var(--ink);
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  transition: background 160ms ease;
}

.add-form button:hover { background: var(--accent); }
.add-form button span:last-child { font-size: 14px; }

.list-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.filters {
  display: flex;
  gap: 2px;
}

.filter,
.clear-button {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
}

.filter {
  padding: 6px 10px;
  border-radius: 7px;
  color: var(--ink-soft);
}

.filter:hover { color: var(--ink); }
.filter.is-active { color: var(--ink); background: var(--surface-soft); font-weight: 600; }

.clear-button {
  padding: 6px 0;
  color: var(--ink-soft);
}

.clear-button:hover:not(:disabled) { color: var(--accent); }
.clear-button:disabled { cursor: default; opacity: 0.35; }

.todo-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.todo-item {
  border-bottom: 1px solid var(--line);
  animation: item-in 220ms ease both;
}

.todo-main {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 66px;
  padding: 10px 2px;
}

.todo-check {
  display: grid;
  width: 22px;
  height: 22px;
  padding: 0;
  place-items: center;
  border: 1.5px solid #aa9487;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: border-color 150ms ease, background 150ms ease, transform 150ms ease;
}

.todo-check:hover { border-color: var(--green); transform: scale(1.07); }
.todo-check svg { width: 13px; opacity: 0; stroke: #fff; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.6; }
.todo-item.is-complete .todo-check { border-color: var(--accent); background: var(--accent); }
.todo-item.is-complete .todo-check svg { opacity: 1; }

.todo-content { min-width: 0; }
.todo-text {
  display: block;
  cursor: text;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.todo-meta {
  display: block;
  margin-top: 3px;
  color: #a89488;
  font-size: 8px;
}

.todo-item.is-complete .todo-text { color: #a69388; text-decoration: line-through; text-decoration-color: #c5a99a; }

.todo-edit {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: 0;
  color: var(--ink);
  background: #fff;
  font-size: 13px;
}

.todo-actions {
  display: flex;
  align-items: center;
  gap: 3px;
}

.comment-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border: 0;
  border-radius: 7px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  transition: color 150ms ease, background 150ms ease;
}

.comment-toggle span:first-child { font-size: 12px; }
.comment-toggle:hover,
.comment-toggle[aria-expanded="true"] { color: var(--ink); background: var(--surface-soft); }

.delete-button {
  display: grid;
  width: 28px;
  height: 28px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 7px;
  color: #b29b90;
  background: transparent;
  cursor: pointer;
  font-size: 16px;
  opacity: 0;
  transition: color 150ms ease, background 150ms ease, opacity 150ms ease;
}

.todo-item:hover .delete-button,
.delete-button:focus-visible { opacity: 1; }
.delete-button:hover { color: var(--accent); background: var(--accent-soft); }

.comment-panel {
  margin: 0 0 14px 34px;
  padding: 15px;
  border-radius: 11px;
  background: #faecdf;
  animation: panel-in 180ms ease both;
}

.comment-panel[hidden] { display: none; }

.comment-panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.comment-panel-heading > div {
  display: flex;
  align-items: center;
  gap: 7px;
}

.comment-cloud { display: none; }
.comment-panel-heading strong { display: block; font-size: 11px; font-weight: 600; }
.comment-panel-heading small { display: block; margin-top: 2px; color: var(--ink-soft); font-size: 8px; }
.comment-panel-heading > span { color: var(--ink-soft); font-size: 8px; }

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

.comment-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.comment-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 25px;
  height: 25px;
  place-items: center;
  border-radius: 50%;
  color: var(--ink-soft);
  background: #f3dbc9;
  font-size: 9px;
}

.comment-item > div { min-width: 0; flex: 1; }
.comment-item p { display: flex; justify-content: space-between; gap: 10px; margin: 0 0 3px; }
.comment-item strong { font-size: 9px; font-weight: 600; }
.comment-item time { color: #b49c90; font-size: 8px; }
.comment-item > div > span { display: block; font-size: 10px; line-height: 1.6; overflow-wrap: anywhere; white-space: pre-wrap; }

.comment-empty {
  margin: 12px 0;
  color: var(--ink-soft);
  font-size: 9px;
  text-align: center;
}

.comment-empty span { display: none; }

.comment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  margin-top: 12px;
}

.comment-form textarea {
  width: 100%;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  color: var(--ink);
  background: #fff;
  font-size: 10px;
  line-height: 1.5;
  resize: vertical;
}

.comment-form textarea::placeholder { color: #b49c90; }

.comment-form button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 82px;
  padding: 7px 11px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--ink);
  cursor: pointer;
  font-size: 9px;
  font-weight: 600;
  transition: background 150ms ease;
}

.comment-form button:hover { background: var(--accent); }
.comment-form button:disabled { cursor: wait; opacity: 0.5; }
.comment-form button span:last-child { display: none; }

.empty-state {
  padding: 54px 20px 48px;
  text-align: center;
}

.empty-state > span {
  display: grid;
  width: 34px;
  height: 34px;
  margin: 0 auto 12px;
  place-items: center;
  border-radius: 50%;
  color: var(--green);
  background: var(--green-soft);
  font-size: 14px;
}

.empty-state h3 { margin: 0 0 6px; font-size: 13px; font-weight: 600; }
.empty-state p { margin: 0; color: var(--ink-soft); font-size: 10px; }

.site-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 20px;
  padding: 26px 2px 0;
  color: var(--ink-soft);
  font-size: 9px;
}

.site-footer p { margin: 0; }

.site-footer .footer-note {
  color: var(--accent);
  font-family: var(--display);
  font-size: 12px;
  text-align: center;
}

.site-footer p:last-child {
  text-align: right;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink);
  background: #fffaf2;
  box-shadow: 0 10px 30px rgba(112, 77, 54, 0.16);
  font-size: 10px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible { opacity: 1; transform: translateY(0); }

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

.reveal { animation: reveal 450ms ease both; }
.reveal-1 { animation-delay: 20ms; }
.reveal-2 { animation-delay: 70ms; }
.reveal-3 { animation-delay: 120ms; }
.reveal-4 { animation-delay: 170ms; }

@keyframes reveal {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes item-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 600px) {
  .page-shell {
    width: min(100% - 24px, 780px);
    padding-top: 18px;
  }

  .brand small,
  .date-block span:first-child {
    display: none;
  }

  .brand-mark { width: 38px; height: 38px; }
  .brand strong { font-size: 14px; }
  .date-block { display: block; }
  .date-block strong { font-size: 16px; }
  .date-block span:last-child { display: block; margin-top: 2px; }

  .hero { padding: 52px 2px 34px; }
  .hero h1 { font-size: clamp(35px, 10.5vw, 46px); }
  .shanghai-line { margin-top: 24px; }
  .shanghai-line svg { height: 68px; }
  .progress-card { margin-top: 28px; padding: 16px; }
  .progress-topline p { max-width: 230px; font-size: 10px; }
  .progress-topline > strong { font-size: 19px; }

  .workspace { padding: 24px 16px 18px; border-radius: 14px; }
  .section-heading { align-items: flex-start; }
  .section-heading h2 { font-size: 19px; }
  .sync-status { max-width: 145px; text-align: right; line-height: 1.4; }

  .add-form button { padding-inline: 12px; }
  .add-form button span:first-child { display: none; }
  .list-toolbar { align-items: flex-end; }
  .filter { padding-inline: 8px; }
  .clear-button { font-size: 9px; }

  .todo-main { gap: 9px; }
  .comment-toggle { width: 28px; padding-inline: 5px; }
  .comment-toggle span:last-child { display: none; }
  .delete-button { opacity: 0.55; }
  .comment-panel { margin-left: 30px; padding: 12px; }
  .comment-form button { min-width: 62px; padding-inline: 8px; }
  .comment-form button span:first-child { font-size: 0; }
  .comment-form button span:first-child::after { font-size: 9px; content: "发送"; }

  .site-footer {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }
  .site-footer p:first-child { display: none; }
  .site-footer p:last-child { text-align: center; }
  .toast { right: 12px; bottom: 12px; left: 12px; text-align: center; }
}

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