:root {
  --sage-50: #f2f5f0;
  --sage-100: #e4ebe1;
  --sage-500: #78967d;
  --sage-600: #617d68;
  --sage-800: #334a3c;
  --coral-100: #fbe8e3;
  --coral-500: #e98270;
  --coral-600: #d86f5e;
  --ink: #24332b;
  --muted: #6e7a72;
  --line: #dfe5dd;
  --surface: #fffefa;
  --background: #f5f4ee;
  --gradient: linear-gradient(125deg, var(--sage-500), var(--coral-500));
  --shadow-hover: 0 16px 36px rgba(50, 72, 58, 0.12);
  --radius-large: 20px;
  --radius-medium: 14px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(120, 150, 125, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(233, 130, 112, 0.08), transparent 34%),
    var(--background);
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
}

button,
input {
  font: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.shell {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 48px 0 64px;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.title-group {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex: 0 0 auto;
}

h1 {
  margin: 0;
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1;
}

.project-count {
  color: var(--muted);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
}

.search-field {
  position: relative;
  display: block;
  width: min(270px, 32vw);
}

.search-field svg {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 18px;
  height: 18px;
  translate: 0 -50%;
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search-field input {
  width: 100%;
  height: 44px;
  padding: 0 14px 0 42px;
  color: var(--ink);
  background: rgba(255, 254, 250, 0.82);
  border: 1px solid var(--line);
  border-radius: 12px;
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.search-field input::placeholder {
  color: #89928c;
}

.search-field input:focus {
  background: var(--surface);
  border-color: var(--sage-500);
  box-shadow: 0 0 0 3px rgba(120, 150, 125, 0.16);
}

.filter-group {
  display: flex;
  padding: 4px;
  background: rgba(226, 232, 223, 0.72);
  border-radius: 12px;
}

.filter-button {
  min-height: 36px;
  padding: 0 13px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 9px;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

.filter-button:hover {
  color: var(--ink);
}

.filter-button:focus-visible {
  outline: 2px solid var(--sage-500);
  outline-offset: 2px;
}

.filter-button.is-active {
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 2px 8px rgba(45, 66, 52, 0.09);
}

.project-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  padding-top: 24px;
}

.project-card {
  position: relative;
  display: flex;
  min-height: 204px;
  flex-direction: column;
  padding: 22px;
  overflow: hidden;
  background: rgba(255, 254, 250, 0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius-large);
  transition: translate 220ms var(--ease), border-color 220ms ease, box-shadow 220ms ease;
}

.project-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--gradient);
  content: "";
  opacity: 0.9;
}

.project-card.is-ready:hover {
  translate: 0 -4px;
  border-color: rgba(120, 150, 125, 0.48);
  box-shadow: var(--shadow-hover);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.project-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--sage-600);
  font-size: 0.75rem;
  font-weight: 600;
}

.project-status::before {
  width: 7px;
  height: 7px;
  background: var(--sage-500);
  border-radius: 50%;
  content: "";
}

.project-card.is-pending .project-status {
  color: var(--muted);
}

.project-card.is-pending .project-status::before {
  background: #aeb6b0;
}

.port-label {
  color: var(--muted);
  font-family: ui-monospace, "Cascadia Code", monospace;
  font-size: 0.75rem;
}

.project-card h2 {
  margin: 24px 0 6px;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.35;
  text-wrap: pretty;
}

.project-description {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.65;
  text-wrap: pretty;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.project-link,
.pending-label {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 42px;
  margin-top: auto;
  padding-top: 18px;
  color: var(--sage-800);
  font-size: 0.875rem;
  font-weight: 600;
  text-decoration: none;
}

.project-link::after {
  content: "↗";
  font-size: 1.05rem;
  transition: translate 180ms var(--ease);
}

.project-link:hover::after {
  translate: 3px -3px;
}

.project-link:focus-visible {
  border-radius: 4px;
  outline: 2px solid var(--coral-500);
  outline-offset: 4px;
}

.pending-label {
  color: #929a94;
}

.empty-state {
  padding: 96px 24px;
  text-align: center;
}

.empty-state p {
  margin: 0 0 18px;
  color: var(--muted);
}

.empty-state button {
  min-height: 42px;
  padding: 0 18px;
  color: var(--surface);
  background: var(--sage-600);
  border: 0;
  border-radius: 11px;
  cursor: pointer;
}

.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;
}

@media (max-width: 900px) {
  .toolbar {
    align-items: stretch;
    flex-direction: column;
    gap: 22px;
  }

  .controls {
    justify-content: space-between;
  }

  .search-field {
    width: min(360px, 50vw);
  }

  .project-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .shell {
    width: min(100% - 28px, 1180px);
    padding: 28px 0 40px;
  }

  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .search-field {
    width: 100%;
  }

  .filter-group {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }

  .filter-button {
    min-height: 40px;
  }

  .project-grid {
    grid-template-columns: 1fr;
  }

  .project-card {
    min-height: 190px;
  }
}

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