:root {
  --bg: #f5f5f7;
  --bg-accent: #ffffff;
  --panel: rgba(255, 255, 255, 0.72);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(15, 23, 42, 0.08);
  --line-strong: rgba(15, 23, 42, 0.12);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --accent: #0071e3;
  --accent-strong: #0071e3;
  --shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.05);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 12px;
  --sidebar-width: 248px;
  --content-width: minmax(0, 1fr);
  --card-width: 300px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  font-family:
    -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at top center, rgba(255, 255, 255, 0.95), transparent 34%),
    linear-gradient(180deg, #fbfbfd 0%, #f5f5f7 52%, #f2f2f4 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 20% 0%, rgba(255, 255, 255, 0.7), transparent 25%),
    radial-gradient(circle at 80% 10%, rgba(255, 255, 255, 0.45), transparent 24%);
}

.page-shell {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 28px clamp(16px, 2vw, 28px) 72px;
  min-width: 0;
}

.hero {
  position: relative;
  min-height: 165px;
  padding: 20px 44px 8px;
  overflow: hidden;
}

.hero::after {
  content: none;
}

.section-kicker,
.nav-index,
.section-count,
.site-arrow {
  font-family: inherit;
}

.hero-main {
  display: flex;
  gap: 24px;
  align-items: center;
  min-height: 109px;
  justify-content: space-between;
  width: 100%;
}

.hero h1 {
  max-width: 820px;
  margin: 0;
  font-size: clamp(2.4rem, 4vw, 4.7rem);
  line-height: 1.05;
  letter-spacing: -0.04em;
  font-weight: 200;
}

.hero-meta {
  display: flex;
  gap: 14px;
  margin-left: auto;
  flex-shrink: 0;
}

.hero-meta div {
  min-width: 120px;
  padding: 18px 18px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(20px) saturate(180%);
}

.hero-meta span {
  display: block;
  font-size: 2.25rem;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.hero-meta small {
  color: var(--muted);
}

.layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  margin-top: 28px;
  min-width: 0;
  width: 100%;
}

.sidebar-panel {
  position: sticky;
  top: 24px;
  width: 100%;
}

.content-panel {
  min-width: 0;
  width: 100%;
}

.sidebar-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px) saturate(160%);
}

.sidebar-card {
  padding: 18px 16px;
}

.sidebar-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sidebar-title-row h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-add-button {
  margin-left: 50px;
  height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: rgba(0, 113, 227, 0.1);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease;
}

.section-add-button:hover,
.section-add-button:focus-visible {
  transform: translateY(-1px);
  background: rgba(0, 113, 227, 0.16);
  outline: none;
}

.category-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.floating-top-button {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 20;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: 0 14px 28px rgba(15, 23, 42, 0.12);
  backdrop-filter: blur(22px) saturate(180%);
  color: var(--text);
  text-decoration: none;
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    background-color 180ms ease;
}

.floating-top-button:hover,
.floating-top-button:focus-visible {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 18px 32px rgba(15, 23, 42, 0.16);
  outline: none;
}

.floating-top-button span {
  font-size: 1.15rem;
  font-weight: 500;
  line-height: 1;
}

.nav-link {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 16px;
  color: inherit;
  text-decoration: none;
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    box-shadow 180ms ease;
}

.nav-link:hover,
.nav-link:focus-visible,
.nav-link.is-active {
  transform: translateX(2px);
  border-color: rgba(0, 113, 227, 0.1);
  background: rgba(255, 255, 255, 0.84);
  box-shadow: var(--shadow-soft);
  outline: none;
}

.nav-index {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(0, 0, 0, 0.04);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
  color: var(--muted);
}

.nav-index svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.nav-index svg path,
.nav-index svg rect,
.nav-index svg circle {
  vector-effect: non-scaling-stroke;
}

.nav-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.sections {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
  width: 100%;
}

.section-block {
  position: relative;
  padding: 0;
  scroll-margin-top: 28px;
  min-width: 0;
  width: 100%;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: flex-start;
  margin-bottom: 18px;
  padding: 4px 2px 0;
}

.section-title {
  margin: 0;
  font-size: clamp(1rem, 0.96rem + 0.18vw, 1.08rem);
  line-height: 1.2;
  letter-spacing: -0.02em;
  font-weight: 600;
}

.site-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
}

.site-card {
  position: relative;
  flex: 0 0 var(--card-width);
  width: var(--card-width);
  height: 65px;
  min-width: 0;
}

.site-manage-delete {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 3;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 50%;
  background: #8e8e93;
  color: #fff;
  font-size: 12px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  display: none;
}

.site-card.is-manage-mode .site-manage-delete {
  display: block;
}

.site-manage-delete:hover,
.site-manage-delete:focus-visible {
  background: #ff4d4f;
  outline: none;
}

.site-link {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 65px;
  height: 65px;
  padding: 8px 12px;
  border: 1px solid rgba(15, 23, 42, 0.06);
  border-radius: var(--radius-md);
  background: var(--panel-strong);
  color: inherit;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.03);
  transition:
    transform 180ms ease,
    box-shadow 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease;
}

.site-link:hover,
.site-link:focus-visible {
  transform: translateY(-2px);
  border-color: rgba(0, 113, 227, 0.12);
  box-shadow: 0 16px 30px rgba(15, 23, 42, 0.08);
  outline: none;
}

.site-logo-wrap {
  position: relative;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #f6f6f8);
  overflow: hidden;
}

.site-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #fff;
}

.site-logo.is-hidden {
  display: none;
}

.site-logo-fallback {
  position: absolute;
  inset: 0;
  display: none;
  place-items: center;
  color: #8a8a8f;
}

.site-logo-fallback svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.site-logo-wrap.show-fallback .site-logo-fallback {
  display: grid;
}

.site-copy {
  min-width: 0;
}

.site-name {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-description {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.manage-site-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(9, 10, 14, 0.42);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.manage-site-modal.is-open {
  display: flex;
}

.manage-site-panel {
  position: relative;
  width: 420px;
  max-width: 100%;
  padding: 26px;
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.18);
}

.manage-site-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(15, 23, 42, 0.06);
  color: #4a4a4f;
  font-size: 20px;
  line-height: 28px;
  cursor: pointer;
}

.manage-site-title {
  margin: 0 0 18px;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.manage-site-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.manage-site-label {
  font-size: 13px;
  font-weight: 600;
  color: #4a4a4f;
}

.manage-site-input {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 14px;
  background: #fff;
  color: #1d1d1f;
  font-size: 14px;
  box-sizing: border-box;
}

.manage-site-input:focus {
  outline: none;
  border-color: rgba(0, 113, 227, 0.65);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.manage-site-manual {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 2px;
}

.manage-site-textarea {
  width: 100%;
  min-height: 76px;
  padding: 12px 14px;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 14px;
  background: #fff;
  color: #111827;
  font: inherit;
  line-height: 1.55;
  resize: vertical;
}

.manage-site-textarea:focus {
  outline: none;
  border-color: rgba(0, 113, 227, 0.65);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

.manage-site-submit {
  height: 44px;
  margin-top: 8px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(180deg, #3f88ff 0%, #1264db 100%);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.manage-site-message {
  margin: 4px 0 0;
  font-size: 13px;
  color: #4a4a4f;
}

.manage-site-message.is-error {
  color: #d93025;
}

@media (max-width: 1160px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar-panel {
    position: sticky;
    top: 12px;
    z-index: 5;
  }

  .category-nav {
    flex-direction: row;
    overflow: auto;
    padding-bottom: 6px;
    scrollbar-width: none;
  }

  .category-nav::-webkit-scrollbar {
    display: none;
  }

  .nav-link {
    grid-template-columns: 34px auto auto;
    flex: 0 0 auto;
  }

  .site-grid {
    gap: 12px;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 16px 12px 44px;
  }

  .layout {
    gap: 16px;
  }

  .hero,
  .sidebar-card {
    border-radius: 22px;
  }

  .hero {
    min-height: 165px;
    padding: 16px 8px 4px;
  }

  .hero-main,
  .section-heading {
    flex-direction: column;
    align-items: start;
  }

  .section-add-button {
    margin-top: 6px;
    margin-left: 0;
  }

  .section-title {
    font-size: 1rem;
  }

  .hero-meta {
    width: 100%;
  }

  .hero-meta div {
    flex: 1;
    min-width: 0;
  }

  .site-grid {
    display: flex;
    flex-direction: column;
  }

  .site-card,
  .site-link {
    width: 100%;
    max-width: 100%;
  }

  .site-link {
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 8px;
    min-height: 65px;
    height: 65px;
    padding: 8px 12px;
  }

  .site-copy {
    min-width: 0;
  }

  .floating-top-button {
    right: 16px;
    bottom: 16px;
    width: 46px;
    height: 46px;
  }
}
