:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.78);
  --surface-solid: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.09);
  --accent: #1d1d1f;
  --accent-hover: #000000;
  --accent-soft: rgba(29, 29, 31, 0.1);
  --green: #34c759;
  --orange: #ff9500;
  --red: #ff3b30;
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(245, 245, 247, 0.9)),
    radial-gradient(circle at 50% 0%, rgba(29, 29, 31, 0.08), transparent 34%),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1040px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 40px 0;
}

.workspace {
  width: min(820px, 100%);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 30px;
  background: var(--surface);
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px) saturate(180%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 28px;
}

.eyebrow {
  margin: 0 0 10px;
  color: #515154;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
}

h1 {
  margin: 0;
  max-width: 560px;
  font-size: clamp(42px, 8vw, 76px);
  line-height: 1.02;
  letter-spacing: 0;
}

.progress-ring {
  position: relative;
  width: 104px;
  height: 104px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}

.progress-ring svg {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}

.progress-ring circle {
  fill: none;
  stroke-width: 9;
}

.ring-track {
  stroke: #e5e5ea;
}

.ring-value {
  stroke: var(--accent);
  stroke-linecap: round;
  stroke-dasharray: 326.73;
  stroke-dashoffset: 326.73;
  transition: stroke-dashoffset 260ms ease;
}

#progressText {
  font-size: 22px;
  font-weight: 700;
}

.task-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px 48px 48px;
  gap: 8px;
  margin-top: 32px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-solid);
}

.task-composer input,
.search-box input {
  min-width: 0;
  color: var(--text);
  border: 0;
  outline: 0;
  background: transparent;
}

.task-composer input {
  padding: 0 10px;
  font-size: 17px;
}

.task-composer input::placeholder,
.search-box input::placeholder {
  color: #8e8e93;
}

.add-button,
.voice-button {
  width: 48px;
  height: 48px;
  border: 0;
  border-radius: 50%;
  line-height: 1;
  transition: transform 160ms ease, background 160ms ease;
}

.add-button {
  color: #ffffff;
  background: var(--accent);
  font-size: 28px;
  font-weight: 500;
}

.voice-button {
  position: relative;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: #f5f5f7;
  font-size: 0;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.05);
}

.voice-button::before {
  content: "";
  width: 12px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 8px;
}

.voice-button::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 9px;
  border-bottom: 2px solid currentColor;
  border-left: 2px solid currentColor;
  border-right: 2px solid currentColor;
  border-radius: 0 0 10px 10px;
  transform: translateY(8px);
}

.add-button:hover,
.voice-button:hover {
  transform: translateY(-1px);
}

.add-button:hover {
  background: var(--accent-hover);
}

.voice-button:hover,
.voice-button.listening {
  color: #ffffff;
  background: var(--accent);
}

.priority-select {
  position: relative;
  min-width: 0;
}

.priority-trigger {
  width: 100%;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 15px;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 999px;
  color: var(--text);
  background: #f5f5f7;
  font-size: 16px;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.72);
  transition: background 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.priority-trigger:hover,
.priority-select.open .priority-trigger {
  background: #ffffff;
  border-color: rgba(29, 29, 31, 0.2);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.priority-chevron {
  width: 8px;
  height: 8px;
  border-right: 1.8px solid #6e6e73;
  border-bottom: 1.8px solid #6e6e73;
  transform: rotate(45deg) translateY(-2px);
  transition: transform 160ms ease;
}

.priority-select.open .priority-chevron {
  transform: rotate(225deg) translateY(-2px);
}

.priority-menu {
  position: absolute;
  z-index: 20;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: grid;
  gap: 4px;
  padding: 6px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.14);
  backdrop-filter: blur(22px) saturate(180%);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px) scale(0.98);
  transform-origin: top center;
  transition: opacity 140ms ease, transform 140ms ease;
}

.priority-select.open .priority-menu {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.priority-menu button {
  width: 100%;
  height: 38px;
  border: 0;
  border-radius: 11px;
  color: var(--text);
  background: transparent;
  font-size: 15px;
  text-align: left;
  padding: 0 12px;
  transition: background 140ms ease, color 140ms ease;
}

.priority-menu button:hover {
  background: #f5f5f7;
}

.priority-menu button.selected {
  color: #ffffff;
  background: var(--accent);
}

.control-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.search-box {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.72);
}

.search-box span {
  color: #8e8e93;
  font-size: 19px;
}

.filter-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #eeeeef;
}

.filter-tabs button {
  border: 0;
  color: var(--muted);
  background: transparent;
  border-radius: 10px;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.filter-tabs button {
  min-height: 34px;
  padding: 0 14px;
  white-space: nowrap;
}

.filter-tabs button.active {
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.filter-tabs button:hover,
.archive-button:hover {
  color: var(--accent);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.stats-grid article {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.66);
}

.stats-grid span {
  display: block;
  font-size: 28px;
  font-weight: 700;
}

.stats-grid p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.task-list {
  min-height: 190px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.task-list.empty {
  display: grid;
  place-items: center;
  border: 1px dashed #c7c7cc;
  border-radius: 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.42);
}

.task-item {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.82);
  animation: rise 200ms ease both;
}

.task-item + .task-item {
  margin-top: 9px;
}

.task-item.done {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.48);
}

.task-item.done .task-title {
  text-decoration: line-through;
}

.check-button,
.archive-button,
.delete-button {
  width: 38px;
  height: 38px;
  border: 1px solid #d2d2d7;
  border-radius: 50%;
  color: var(--text);
  background: #ffffff;
}

.check-button::after {
  content: "";
  display: block;
  width: 12px;
  height: 7px;
  margin: 11px auto 0;
  border-left: 2px solid transparent;
  border-bottom: 2px solid transparent;
  transform: rotate(-45deg);
}

.task-item.done .check-button {
  border-color: var(--green);
  background: var(--green);
}

.task-item.done .check-button::after {
  border-color: #ffffff;
}

.task-actions {
  display: flex;
  gap: 6px;
}

.archive-button,
.delete-button {
  color: #86868b;
  font-size: 23px;
  line-height: 1;
}

.archive-button {
  display: none;
  color: var(--accent);
  font-size: 20px;
}

.task-item.done:not(.archived) .archive-button {
  display: inline-grid;
  place-items: center;
}

.task-item.archived .check-button {
  pointer-events: none;
}

.task-item.archived .archive-button {
  display: none;
}

.archive-button:hover {
  color: var(--accent-hover);
  border-color: rgba(29, 29, 31, 0.18);
}

.delete-button:hover {
  color: var(--red);
  border-color: rgba(255, 59, 48, 0.24);
}

.task-title {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 17px;
  font-weight: 600;
}

.task-meta {
  display: inline-flex;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.task-item.high {
  border-color: rgba(255, 149, 0, 0.3);
}

.task-item.high .task-meta {
  color: var(--orange);
}

.task-item.low .task-meta {
  color: #515154;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 18px, 560px);
    padding: 12px 0;
  }

  .workspace {
    padding: 20px;
    border-radius: 24px;
  }

  .topbar {
    align-items: flex-start;
  }

  .progress-ring {
    width: 78px;
    height: 78px;
  }

  #progressText {
    font-size: 17px;
  }

  .task-composer,
  .control-row,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .task-composer {
    grid-template-columns: 1fr 48px 48px;
  }

  .priority-select {
    grid-column: 1 / -1;
    order: 3;
  }

  .filter-tabs {
    overflow-x: auto;
  }
}
