:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-hover: #f8fbff;
  --text: #111111;
  --muted: #6e6e73;
  --line: #e5e5ea;
  --line-strong: rgba(0, 122, 255, 0.35);
  --brand: #007aff;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.06);
  --shadow-hover: 0 10px 28px rgba(0, 122, 255, 0.12), 0 3px 12px rgba(0, 0, 0, 0.06);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #090b10;
  --surface: #11151d;
  --surface-hover: #171d28;
  --text: #f5f7fb;
  --muted: #a1a1aa;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(10, 132, 255, 0.48);
  --brand: #0a84ff;
  --shadow: 0 4px 18px rgba(0, 0, 0, 0.28);
  --shadow-hover: 0 12px 30px rgba(10, 132, 255, 0.18), 0 8px 22px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--text);
  transition: background-color 0.25s ease, color 0.25s ease;
}

html.lenis,
html.lenis body {
  height: auto;
}

.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
}

a,
button {
  color: inherit;
  font: inherit;
}

.menu-shell {
  width: min(820px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 46px;
}

.menu-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 42px;
}

.brand-title {
  color: var(--text);
  font-size: 1.08rem;
  font-weight: 760;
  line-height: 1.1;
  letter-spacing: 0;
}

.brand-title span {
  color: var(--brand);
}

.header-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background 0.22s ease, border-color 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease;
}

.icon-button:hover {
  background: var(--surface-hover);
  border-color: color-mix(in srgb, var(--text) 28%, var(--line));
  box-shadow: var(--shadow-hover);
  transform: translateY(-1px);
}

.icon-button:active {
  transform: translateY(0) scale(0.96);
}

.theme-toggle-icon {
  display: block;
  overflow: visible;
  --theme-toggle-duration: 400ms;
}

.theme-toggle-ray,
.theme-toggle-sun {
  transform-box: view-box;
  transform-origin: center;
  transition: opacity var(--theme-toggle-duration) ease, transform var(--theme-toggle-duration) ease;
}

html[data-theme="dark"] .theme-toggle-sun {
  transform: scale(0.72);
}

html[data-theme="dark"] .theme-toggle-ray {
  opacity: 0.35;
}

.menu-title {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 20px;
  align-items: end;
  margin-bottom: 18px;
}

.menu-title h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(2.05rem, 5vw, 3rem);
  line-height: 1.05;
  font-weight: 780;
  letter-spacing: 0;
}

#project-count {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 680;
}

.project-list {
  display: grid;
  gap: 11px;
}

.empty-message {
  margin: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 40;
  max-width: min(360px, calc(100% - 32px));
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-hover);
  font-size: 0.92rem;
  font-weight: 680;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.project-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  min-height: 86px;
  padding: 18px 18px 18px 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  text-decoration: none;
  outline: none;
  transform: translateZ(0);
  transition: transform 0.24s cubic-bezier(0.22, 1, 0.36, 1), background 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease;
  -webkit-tap-highlight-color: transparent;
}

.project-item:hover,
.project-item:focus-visible {
  background: var(--surface-hover);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-hover);
  transform: translateY(-2px);
}

.project-item:active,
.project-item.is-touching {
  transform: translateY(-1px) scale(0.992);
  border-color: var(--brand);
}

.project-name {
  display: block;
  margin-bottom: 7px;
  color: var(--text);
  font-size: 1.06rem;
  font-weight: 720;
  line-height: 1.25;
}

.project-meta {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.project-arrow {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 122, 255, 0.1);
  color: var(--brand);
  transition: background 0.24s ease, color 0.24s ease, transform 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

.project-item:hover .project-arrow,
.project-item:focus-visible .project-arrow {
  background: var(--brand);
  color: #fff;
  transform: translateX(3px);
}

::view-transition-old(root),
::view-transition-new(root) {
  animation: none;
  mix-blend-mode: normal;
}

::view-transition-old(root) {
  z-index: 0;
}

::view-transition-new(root) {
  z-index: 1;
}

.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
  transition-duration: 0ms !important;
}

@media (max-width: 520px) {
  .menu-shell {
    width: calc(100% - 24px);
    padding-top: 24px;
  }

  .menu-header {
    margin-bottom: 34px;
  }

  .icon-button {
    width: 42px;
    height: 42px;
  }

  .menu-title {
    grid-template-columns: 1fr;
    gap: 8px;
    margin-bottom: 18px;
  }

  .menu-title h1 {
    font-size: clamp(2.35rem, 12vw, 3.25rem);
  }

  #project-count {
    margin-bottom: 0;
  }

  .project-item {
    min-height: 80px;
    padding: 16px 14px 16px 18px;
    gap: 14px;
  }

  .project-name {
    font-size: 1.02rem;
  }

  .project-meta {
    font-size: 0.86rem;
  }

  .project-arrow {
    width: 36px;
    height: 36px;
  }
}

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