:root {
  color-scheme: light;
  --bg: oklch(97.8% 0.008 85);
  --bg-soft: oklch(96.4% 0.01 85);
  --surface: rgba(255, 255, 255, 0.72);
  --surface-strong: rgba(255, 255, 255, 0.88);
  --surface-solid: oklch(98.8% 0.006 85);
  --surface-muted: oklch(95.3% 0.01 85);
  --line: rgba(18, 18, 18, 0.08);
  --line-strong: rgba(18, 18, 18, 0.14);
  --line-faint: rgba(18, 18, 18, 0.045);
  --text: oklch(18% 0.01 85);
  --text-soft: oklch(32% 0.012 85);
  --muted: oklch(56% 0.012 85);
  --muted-soft: oklch(73% 0.01 85);
  --accent: oklch(65% 0.20 42);
  --accent-soft: oklch(93% 0.03 42);
  --success: oklch(68% 0.13 150);
  --shadow-soft: 0 12px 48px rgba(21, 18, 14, 0.08);
  --shadow-card: 0 8px 32px rgba(21, 18, 14, 0.06), 0 2px 8px rgba(21, 18, 14, 0.04);
  --radius-xl: 24px;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --container: min(1600px, calc(100vw - 48px));
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.9) 0, rgba(255, 255, 255, 0) 36%),
    radial-gradient(circle at 90% 20%, rgba(255, 246, 240, 0.7) 0, rgba(255, 255, 255, 0) 24%),
    radial-gradient(circle at 68% 72%, rgba(243, 239, 232, 0.7) 0, rgba(255, 255, 255, 0) 28%),
    linear-gradient(180deg, oklch(98.8% 0.008 85), oklch(97.2% 0.01 85));
  color: var(--text);
  font-family: Manrope, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-kerning: normal;
  letter-spacing: -0.015em;
  scroll-behavior: smooth;
}

body {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  padding-left: max(0px, env(safe-area-inset-left));
  padding-right: max(0px, env(safe-area-inset-right));
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: auto;
  pointer-events: none;
  z-index: -1;
  border-radius: 50%;
  filter: blur(64px);
  opacity: 0.6;
}

body::before {
  top: -16rem;
  left: -12rem;
  width: 36rem;
  height: 36rem;
  background: rgba(255, 255, 255, 0.85);
}

body::after {
  right: -10rem;
  bottom: -12rem;
  width: 30rem;
  height: 30rem;
  background: rgba(250, 238, 229, 0.9);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}

img {
  max-width: 100%;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 1.5rem;
  width: var(--container);
  margin: 0 auto;
  min-height: 5.25rem;
  padding: calc(0.85rem + env(safe-area-inset-top)) 0 0.85rem;
}

.topbar::before {
  content: "";
  position: absolute;
  inset: 0 -1.25rem auto;
  height: calc(100% - 0.1rem);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-top: 0;
  border-radius: 0 0 1.75rem 1.75rem;
  background: rgba(249, 247, 243, 0.82);
  box-shadow: 0 18px 44px rgba(20, 17, 14, 0.05);
  backdrop-filter: blur(20px) saturate(140%);
  z-index: -1;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.85rem;
  min-width: max-content;
}

.brand-logo {
  width: 2.1rem;
  height: 2.1rem;
  flex: 0 0 auto;
  display: block;
}

.brand-name {
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.035em;
}

.primary-nav {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

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

.primary-nav button {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.45rem;
  padding: 0.58rem 0.95rem;
  border-radius: 999px;
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 500;
  white-space: nowrap;
  transition: color 220ms ease;
}

.primary-nav button:hover {
  color: var(--text);
}

.primary-nav button.active {
  color: var(--text);
}

.nav-indicator {
  position: absolute;
  top: 50%;
  left: 0;
  width: 0;
  height: 2.45rem;
  border: 1px solid rgba(18, 18, 18, 0.05);
  border-radius: 999px;
  background: rgba(236, 232, 225, 0.95);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
  pointer-events: none;
  will-change: transform, width;
  transform: translateY(-50%);
}

.topbar-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: max-content;
}

.sync-status {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 2.65rem;
  padding: 0.4rem 0.95rem;
  border: 1px solid rgba(18, 18, 18, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--text-soft);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(12px);
}

.sync-dot {
  width: 0.46rem;
  height: 0.46rem;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 0 0 0.22rem rgba(18, 18, 18, 0.04);
}

.sync-dot.synced {
  background: var(--success);
  box-shadow: 0 0 0 0.22rem rgba(118, 201, 154, 0.18);
}

.sync-dot.syncing {
  background: var(--accent);
  box-shadow: 0 0 0 0.22rem rgba(234, 138, 92, 0.12);
  animation: pulse 1.25s infinite;
}

.sync-dot.error {
  background: oklch(63% 0.18 22);
  box-shadow: 0 0 0 0.22rem rgba(232, 99, 85, 0.12);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(0.92);
  }
}

.topbar-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.65rem;
  height: 2.65rem;
  border: 1px solid transparent;
  border-radius: 999px;
  color: var(--text-soft);
  transition: border-color 220ms ease, color 220ms ease, background-color 220ms ease, transform 220ms ease;
}

.topbar-btn:hover {
  border-color: rgba(18, 18, 18, 0.08);
  background: rgba(255, 255, 255, 0.74);
  color: var(--text);
  transform: translateY(-1px);
}

.topbar-btn svg {
  width: 1rem;
  height: 1rem;
  display: block;
}

.github-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  height: 2.65rem;
  padding: 0 0.85rem;
  border: 1px solid rgba(18, 18, 18, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.66);
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: none;
  backdrop-filter: blur(12px);
  transition: border-color 220ms ease, color 220ms ease, background-color 220ms ease, transform 220ms ease;
}

.github-btn:hover {
  border-color: rgba(18, 18, 18, 0.18);
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
  transform: translateY(-1px);
}

.github-btn svg {
  width: 1.1rem;
  height: 1.1rem;
  flex-shrink: 0;
}

.github-stars {
  font-variant-numeric: tabular-nums;
  min-width: 1.5ch;
  text-align: center;
}

.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: max(14vh, 7rem) 1.5rem 2rem;
  background: rgba(248, 245, 240, 0.74);
  backdrop-filter: blur(24px);
}

.search-overlay[hidden] {
  display: none;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  width: min(46rem, 100%);
  padding: 1rem 1.1rem;
  border: 1px solid rgba(18, 18, 18, 0.08);
  border-radius: 1.4rem;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 20px 60px rgba(18, 18, 18, 0.08);
}

.search-box:focus-within {
  border-color: rgba(235, 138, 92, 0.32);
  box-shadow: 0 20px 60px rgba(18, 18, 18, 0.08), 0 0 0 0.35rem rgba(235, 138, 92, 0.08);
}

.search-box input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: none;
  color: var(--text);
  font-size: 1rem;
}

.search-box input::placeholder {
  color: var(--muted);
}

.search-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 999px;
  color: var(--muted);
  transition: background-color 220ms ease, color 220ms ease;
}

.search-close:hover {
  background: var(--bg-soft);
  color: var(--text);
}

.search-close svg {
  width: 1rem;
  height: 1rem;
}

.search-results {
  width: min(46rem, 100%);
  max-height: min(60vh, 40rem);
  margin-top: 0.8rem;
  overflow-y: auto;
  padding: 0.35rem;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  padding: 0.85rem;
  border: 1px solid transparent;
  border-radius: 1.2rem;
  background: rgba(255, 255, 255, 0.56);
  cursor: pointer;
  transition: transform 220ms ease, background-color 220ms ease, border-color 220ms ease;
}

.search-result-item + .search-result-item {
  margin-top: 0.5rem;
}

.search-result-item:hover {
  border-color: rgba(18, 18, 18, 0.06);
  background: rgba(255, 255, 255, 0.9);
  transform: translateY(-1px);
}

.search-result-color {
  width: 3px;
  align-self: stretch;
  border-radius: 999px;
  flex-shrink: 0;
}

.search-result-thumb {
  width: 3.8rem;
  height: 3.8rem;
  border-radius: 1rem;
  object-fit: cover;
  flex: 0 0 auto;
  background: var(--bg-soft);
}

.search-result-text {
  flex: 1;
  min-width: 0;
}

.search-result-title {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-cat,
.search-result-preview {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-cat {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
}

.search-result-preview {
  margin-top: 0.35rem;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.sr-highlight {
  background: rgba(255, 220, 100, 0.35);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

.search-skeleton {
  display: flex;
  align-items: center;
  gap: 0.95rem;
  padding: 0.85rem;
  border-radius: 1.2rem;
}

.search-skeleton + .search-skeleton {
  margin-top: 0.5rem;
}

.search-skeleton-thumb {
  width: 3.8rem;
  height: 3.8rem;
  border-radius: 1rem;
  background: linear-gradient(90deg, var(--surface-muted) 25%, var(--surface-strong) 50%, var(--surface-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
  flex-shrink: 0;
}

.search-skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.search-skeleton-line {
  height: 0.85rem;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-muted) 25%, var(--surface-strong) 50%, var(--surface-muted) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

.search-skeleton-line.title { width: 65%; }
.search-skeleton-line.cat { width: 40%; height: 0.7rem; }
.search-skeleton-line.preview { width: 90%; height: 0.7rem; }

.layout {
  display: grid;
  grid-template-columns: 16rem minmax(0, 1fr);
  gap: 0;
  flex: 1 0 auto;
  width: var(--container);
  margin: 0 auto;
}

.layout[data-view="home"] {
  grid-template-columns: 1fr;
}

.layout[data-view="home"] .sidebar {
  display: none;
}

.sidebar {
  position: sticky;
  top: 5.8rem;
  align-self: start;
  height: calc(100vh - 6rem);
  padding: 2rem 1rem 2rem 0;
}

.sub-wrap {
  position: relative;
  padding: 0.85rem;
  border: 1px solid rgba(18, 18, 18, 0.07);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-card);
  backdrop-filter: blur(20px) saturate(140%);
}

.sub-pill {
  position: absolute;
  left: 0;
  top: 0;
  width: 0;
  height: 0;
  border-radius: 0.95rem;
  background: rgba(236, 232, 225, 0.92);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88);
  opacity: 0;
  pointer-events: none;
  z-index: 0;
  will-change: transform, width, height;
}

.sub-nav {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sub-nav li + li {
  margin-top: 0.2rem;
}

.sub-nav li button {
  display: flex;
  align-items: center;
  width: 100%;
  gap: 0.72rem;
  min-height: 2.8rem;
  padding: 0.7rem 0.85rem;
  border-radius: 0.95rem;
  color: var(--text-soft);
  font-size: 0.92rem;
  font-weight: 500;
  text-align: left;
  transition: color 220ms ease;
}

.sub-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sub-count {
  flex-shrink: 0;
  min-width: 1.4em;
  height: 1.4em;
  padding: 0 0.35em;
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.06);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

.sub-nav li button::before {
  content: "";
  width: 0.34rem;
  height: 0.34rem;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.38;
  flex: 0 0 auto;
}

.sub-nav li button:hover,
.sub-nav li button.active {
  color: var(--text);
}

.content {
  min-width: 0;
  padding: 1.6rem 0 5rem;
}

.home {
  width: min(100%, 96rem);
  margin: 0 auto;
}

.home-hero {
  position: relative;
  padding: clamp(2rem, 4vw, 3.6rem) 0 2rem;
}

.hero-grid {
  position: relative;
  display: grid;
  grid-template-columns: 5.25rem minmax(0, 1.02fr) minmax(22rem, 0.98fr);
  align-items: center;
  gap: clamp(1.25rem, 3vw, 3rem);
  min-height: clamp(28rem, 52vw, 42rem);
  padding: clamp(1.25rem, 2vw, 2rem) 0;
}

.hero-grid::before {
  content: "";
  position: absolute;
  inset: 2rem 0 1rem 4.8rem;
  border-radius: 2.4rem;
  background:
    radial-gradient(circle at 76% 40%, rgba(255, 249, 246, 0.94), rgba(255, 255, 255, 0) 24%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.72));
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.55);
  z-index: -1;
}

/* Subtle gradient flow animation */
.hero-grid::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent 40%, rgba(235, 200, 160, 0.08) 60%, transparent 80%);
  background-size: 200% 200%;
  animation: heroFlow 8s ease-in-out infinite;
  pointer-events: none;
  z-index: 0;
  border-radius: inherit;
}

@keyframes heroFlow {
  0%, 100% { background-position: 0% 0%; opacity: 0.6; }
  50% { background-position: 100% 100%; opacity: 1; }
}

.hero-rail {
  display: flex;
  flex-direction: column;
  align-self: stretch;
  align-items: center;
  gap: 1.25rem;
  padding-top: 2.4rem;
}

.hero-index {
  color: var(--text-soft);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.hero-line {
  width: 1px;
  flex: 1;
  min-height: 9rem;
  background: linear-gradient(180deg, rgba(18, 18, 18, 0.15), rgba(18, 18, 18, 0));
}

.hero-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: 34rem;
  padding: 4.2rem 0 4rem;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin-bottom: 1.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.22em;
}

.hero-kicker::before {
  content: "";
  width: 2rem;
  height: 1px;
  background: rgba(18, 18, 18, 0.18);
}

.hero-copy h1 {
  margin: 0;
  font-size: clamp(3rem, 6vw, 5.6rem);
  font-weight: 800;
  line-height: 0.98;
  letter-spacing: -0.06em;
}

.hero-copy p {
  max-width: 31ch;
  margin: 1.55rem 0 0;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.85;
}

.hero-link {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  min-height: 3.2rem;
  margin-top: 2rem;
  padding: 0 1.25rem 0 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 700;
  border-bottom: 1px solid rgba(18, 18, 18, 0.18);
  transition: gap 220ms ease, border-color 220ms ease, color 220ms ease;
}

.hero-link:hover {
  gap: 1.15rem;
  border-color: rgba(235, 138, 92, 0.38);
  color: var(--accent);
}

.hero-scene {
  position: relative;
  min-height: 100%;
  overflow: hidden;
}

.hero-monogram {
  position: absolute;
  inset: 3rem auto auto 2.5rem;
  color: rgba(18, 18, 18, 0.04);
  font-size: clamp(10rem, 22vw, 18rem);
  font-weight: 800;
  line-height: 0.82;
  letter-spacing: -0.1em;
  pointer-events: none;
}

.hero-side-label {
  position: absolute;
  top: 50%;
  right: 0.2rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.28em;
  writing-mode: vertical-rl;
  transform: translateY(-50%);
}

.hero-scene-inner {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 28rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Abstract geometric pattern instead of sculpture */
.hero-geo {
  position: relative;
  width: 80%;
  max-width: 280px;
  aspect-ratio: 1;
  animation: heroFloat 6s ease-in-out infinite;
}

.hero-geo-ring {
  position: absolute;
  inset: 0;
  border: 1.5px solid rgba(18, 18, 18, 0.07);
  border-radius: 50%;
}

.hero-geo-ring-2 {
  inset: 12%;
  border-color: rgba(18, 18, 18, 0.04);
  animation: heroSpin 20s linear infinite;
}

.hero-geo-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.5;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 20px var(--accent);
}

.hero-geo-dot:nth-child(2) { animation: heroDot1 6s ease-in-out infinite; }
.hero-geo-dot:nth-child(3) { animation: heroDot2 6s ease-in-out infinite 2s; }
.hero-geo-dot:nth-child(4) { animation: heroDot3 6s ease-in-out infinite 4s; }

.hero-geo-cross {
  position: absolute;
  width: 1px;
  height: 100%;
  left: 50%;
  top: 0;
  background: rgba(18, 18, 18, 0.04);
}

.hero-geo-cross-h {
  width: 100%;
  height: 1px;
  top: 50%;
  left: 0;
}

@keyframes heroFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-12px) rotate(3deg); }
}

@keyframes heroSpin {
  to { transform: rotate(360deg); }
}

@keyframes heroDot1 {
  0%, 100% { transform: translate(-50%, -50%) translateX(0); opacity: 0.5; }
  50% { transform: translate(-50%, -50%) translateX(60px); opacity: 0.8; }
}

@keyframes heroDot2 {
  0%, 100% { transform: translate(-50%, -50%) translateY(0); opacity: 0.5; }
  50% { transform: translate(-50%, -50%) translateY(-50px); opacity: 0.8; }
}

@keyframes heroDot3 {
  0%, 100% { transform: translate(-50%, -50%) translate(-40px, 30px); opacity: 0.4; }
  50% { transform: translate(-50%, -50%) translate(30px, -40px); opacity: 0.7; }
}

.home-sections {
  counter-reset: section;
  display: flex;
  flex-direction: column;
  gap: 1.6rem;
  padding-bottom: 1rem;
}

.home-section {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  padding: 2.1rem 2rem 2rem;
  border: 1px solid rgba(18, 18, 18, 0.05);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.84), rgba(250, 248, 244, 0.75)),
    radial-gradient(circle at right top, rgba(255, 250, 246, 0.8), rgba(255, 255, 255, 0) 40%);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  backdrop-filter: blur(20px);
}

.home-section::before {
  counter-increment: section;
  content: counter(section, decimal-leading-zero);
  position: absolute;
  left: -0.4rem;
  top: 1.8rem;
  color: rgba(18, 18, 18, 0.28);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  transform: rotate(-90deg) translateX(-100%);
  transform-origin: left top;
}

.home-section::after {
  content: "+";
  position: absolute;
  right: 1.7rem;
  top: 1.45rem;
  color: rgba(235, 138, 92, 0.68);
  font-size: 1.4rem;
  font-weight: 400;
}

.home-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-left: 0.25rem;
}

.home-section-head h2 {
  margin: 0;
  color: var(--text);
  font-size: clamp(1.75rem, 2.4vw, 2.3rem);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.home-view-all {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 2.7rem;
  padding: 0 1rem;
  border: 1px solid rgba(18, 18, 18, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.64);
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  transition: color 220ms ease, border-color 220ms ease, transform 220ms ease, background-color 220ms ease;
}

.home-view-all:hover {
  color: var(--text);
  border-color: rgba(235, 138, 92, 0.28);
  background: rgba(255, 255, 255, 0.92);
  transform: translateX(2px);
}

.home-section-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1.15rem;
}

.home-tile {
  position: relative;
  overflow: hidden;
  aspect-ratio: 0.88;
  border: 1px solid rgba(18, 18, 18, 0.06);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(242, 239, 233, 0.98), rgba(255, 255, 255, 0.88));
  box-shadow: 0 18px 42px rgba(20, 18, 14, 0.06);
  cursor: pointer;
  transform: translateY(0);
  transition: transform 260ms ease, box-shadow 260ms ease, border-color 260ms ease;
}

.home-tile::before,
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(110deg, rgba(241, 238, 232, 0.8) 30%, rgba(255, 255, 255, 0.96) 50%, rgba(241, 238, 232, 0.8) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
  transition: opacity 0.4s ease;
}

.home-tile.is-loaded::before,
.card.is-loaded::before {
  opacity: 0;
  animation: none;
}

.home-tile::after,
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
  pointer-events: none;
  z-index: 3;
}

.home-tile img,
.card img {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.45s ease, transform 0.55s ease;
}

.home-tile.is-loaded img,
.card.is-loaded img {
  opacity: 1;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

@media (hover: hover) and (pointer: fine) {
  .home-tile:hover,
  .card:hover {
    transform: translateY(-6px);
    border-color: rgba(18, 18, 18, 0.08);
    box-shadow: 0 28px 60px rgba(20, 18, 14, 0.08);
  }

  .home-tile:hover img,
  .card:hover img {
    transform: scale(1.045);
  }
}

.category-view {
  width: min(100%, 88rem);
}

.category-header {
  position: relative;
  margin-bottom: 1.8rem;
  padding: 2.5rem 2.1rem 2rem;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(135deg, var(--cat-bg, rgba(255,255,255,0.7)) 0%, rgba(255,255,255,0.7) 60%),
    rgba(255, 255, 255, 0.7);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

.cat-header-accent {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  border-radius: 4px 0 0 4px;
}

.category-header::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--cat-accent, var(--accent));
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.category-header-accent {
  position: absolute;
  top: -2rem;
  right: -2rem;
  width: 10rem;
  height: 10rem;
  border-radius: 50%;
  background: var(--cat-accent, var(--accent));
  opacity: 0.06;
  pointer-events: none;
}

.category-header h1 {
  margin: 0 0 0.65rem;
  font-size: clamp(2rem, 4vw, 3rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  color: var(--text);
}

.category-header p {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
  gap: 1.2rem;
}

.card {
  position: relative;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  border: 1px solid rgba(18, 18, 18, 0.06);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(242, 239, 233, 0.98), rgba(255, 255, 255, 0.88));
  box-shadow: 0 18px 42px rgba(20, 18, 14, 0.05);
  cursor: pointer;
  transition: transform 260ms ease, box-shadow 260ms ease, border-color 260ms ease;
}

.card-overlay {
  position: absolute;
  left: 0.75rem;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 0.85rem;
  border: 1px solid rgba(255, 255, 255, 0.82);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(20px) saturate(140%);
  transform: translateY(10px);
  opacity: 0;
  transition: transform 220ms ease, opacity 220ms ease;
}

.card:hover .card-overlay,
.card:focus-within .card-overlay {
  opacity: 1;
  transform: translateY(0);
}

.card-prompt {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--text-soft);
  font-size: 0.8rem;
  line-height: 1.6;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
  line-clamp: 4;
}

.copy-btn {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.1rem;
  padding: 0 0.85rem;
  border: 1px solid rgba(18, 18, 18, 0.1);
  border-radius: 999px;
  background: rgba(249, 247, 243, 0.95);
  color: var(--text);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  transition: border-color 220ms ease, background-color 220ms ease, color 220ms ease, transform 150ms ease;
}

.copy-btn:hover,
.lightbox-copy:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  transform: scale(1.03);
}

.copy-btn.copied {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.copy-btn svg {
  flex-shrink: 0;
}

.empty-state {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 20rem;
  padding: 2rem;
  border: 1px dashed rgba(18, 18, 18, 0.12);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.62);
  text-align: center;
}

.empty-state-text {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
}

/* Init error / retry */
.init-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  padding: 3rem;
  text-align: center;
  gap: 0.75rem;
}
.init-error-text { margin: 0; font-size: 1.1rem; font-weight: 600; color: var(--fg); }
.init-error-detail { margin: 0; font-size: 0.85rem; color: var(--muted); max-width: 28rem; }
.init-retry-btn {
  margin-top: 0.5rem;
  padding: 0.55rem 1.6rem;
  border: none;
  border-radius: var(--radius);
  background: var(--fg);
  color: var(--bg);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.init-retry-btn:hover { opacity: 0.85; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 4.5rem;
  background: rgba(246, 242, 236, 0.84);
  backdrop-filter: blur(20px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 280ms ease;
}

.lightbox:not([hidden]) {
  visibility: visible;
}

.lightbox[data-open="true"] {
  opacity: 1;
}

.lightbox-stage {
  display: flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}

.lightbox-figure {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
  gap: 1.35rem;
  width: min(88rem, 100%);
  height: min(100%, 90vh);
  margin: 0;
}

.lightbox-image-wrap {
  position: relative;
  display: flex;
  min-width: 0;
  min-height: 0;
  align-items: center;
  justify-content: center;
  padding: 1.2rem;
  border: 1px solid rgba(18, 18, 18, 0.06);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
}

.lightbox-image {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 1.25rem;
  opacity: 0;
  box-shadow: 0 28px 70px rgba(20, 18, 14, 0.08);
  transition: opacity 0.35s ease;
}

.lightbox-image.is-loaded {
  opacity: 1;
}

.lightbox-image-wrap.is-loading::before {
  content: "";
  position: absolute;
  width: 2.4rem;
  height: 2.4rem;
  border: 2px solid rgba(18, 18, 18, 0.1);
  border-top-color: rgba(18, 18, 18, 0.48);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.lightbox-caption {
  display: flex;
  flex-direction: column;
  max-height: 100%;
  padding: 1.2rem;
  border: 1px solid rgba(18, 18, 18, 0.06);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.8);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.lightbox-caption-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-bottom: 0.9rem;
}

.lightbox-caption-title {
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.lightbox-counter,
.lightbox-source {
  color: var(--muted);
  font-size: 0.78rem;
}

.lightbox-counter {
  font-variant-numeric: tabular-nums;
}

.lightbox-prompt {
  flex: 1 1 auto;
  margin: 0;
  padding: 0.65rem 0.8rem;
  color: var(--text-soft);
  font-family: 'SF Mono', 'Cascadia Code', 'JetBrains Mono', 'Fira Code', ui-monospace, monospace;
  font-size: 0.82rem;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(0,0,0,0.03);
  border-radius: var(--radius);
  border: 1px solid rgba(0,0,0,0.05);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(18, 18, 18, 0.15) transparent;
}

.lightbox-prompt::-webkit-scrollbar {
  width: 6px;
}

.lightbox-prompt::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.14);
}

.lightbox-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(18, 18, 18, 0.07);
}

.lightbox-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.6rem;
}

.lightbox-tag {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(18, 18, 18, 0.05);
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.lightbox-source-link {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(235, 138, 92, 0.24);
  transition: border-color 220ms ease;
}

.lightbox-source-link:hover {
  border-color: var(--accent);
}

.lightbox-copy {
  min-height: 2.5rem;
  padding: 0 1rem;
  border: 1px solid rgba(18, 18, 18, 0.08);
  border-radius: 999px;
  background: rgba(249, 247, 243, 0.95);
  color: var(--text);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  transition: border-color 220ms ease, background-color 220ms ease, color 220ms ease;
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.85rem;
  height: 2.85rem;
  border: 1px solid rgba(18, 18, 18, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  color: var(--text-soft);
  backdrop-filter: blur(12px);
  transition: border-color 220ms ease, background-color 220ms ease, color 220ms ease, transform 220ms ease;
}

.lightbox-close:hover,
.lightbox-nav:hover {
  border-color: rgba(235, 138, 92, 0.22);
  background: rgba(255, 255, 255, 0.96);
  color: var(--accent);
  transform: scale(1.03);
}

.lightbox-close {
  top: 1.2rem;
  right: 1.2rem;
}

.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
}

.lightbox-nav:hover {
  transform: translateY(-50%) scale(1.03);
}

.lightbox-prev {
  left: 1.2rem;
}

.lightbox-next {
  right: 1.2rem;
}

.lightbox-close svg,
.lightbox-nav svg {
  width: 1rem;
  height: 1rem;
}

.lightbox-nav[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

body.lightbox-open {
  overflow: hidden;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(1.4rem, calc(1rem + env(safe-area-inset-bottom)));
  z-index: 90;
  padding: 0.8rem 1.1rem;
  border: 1px solid rgba(18, 18, 18, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--text);
  font-size: 0.84rem;
  box-shadow: 0 20px 50px rgba(18, 18, 18, 0.08);
  opacity: 0;
  visibility: hidden;
  transform: translate(-50%, 10px);
  transition: opacity 220ms ease, transform 220ms ease, visibility 220ms ease;
}

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

.footer {
  flex: 0 0 auto;
  width: 100%;
  margin-top: 1rem;
  padding: 1rem 0 max(1.6rem, calc(1rem + env(safe-area-inset-bottom)));
}

.footer-inner,
.footer-bottom {
  width: var(--container);
  margin: 0 auto;
}

.footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 2.5rem;
  padding: 2rem 2rem 2.2rem;
  border: 1px solid rgba(18, 18, 18, 0.05);
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow-card);
}

.footer-brand {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.footer-brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
}

.footer-brand-name {
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.footer-tagline {
  max-width: 34ch;
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.75;
}

.footer-col {
  display: flex;
  flex-direction: column;
}

.footer-col-title {
  margin-bottom: 1rem;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.footer-links a,
.footer-links button {
  color: var(--text-soft);
  font-size: 0.9rem;
  text-align: left;
  transition: color 220ms ease;
}

.footer-links a:hover,
.footer-links button:hover {
  color: var(--accent);
}

.footer-more-wrap { margin-top: 0.2rem; }
.footer-more-btn {
  color: var(--accent) !important;
  font-size: 0.82rem !important;
  opacity: 0.8;
}
.footer-more-btn:hover { opacity: 1; }

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
}

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

@media (prefers-reduced-motion: reduce) {
  html,
  body {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 1080px) {
  :root {
    --container: min(100vw - 32px, 96rem);
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    min-height: 0;
  }

  .hero-grid::before {
    inset: 0;
  }

  .hero-rail {
    display: none;
  }

  .hero-copy {
    padding: 2rem 1.25rem 0;
    max-width: 36rem;
  }

  .hero-scene {
    min-height: 32rem;
  }

  .hero-scene-inner {
    min-height: 32rem;
  }

  .hero-monogram {
    left: 1rem;
    top: 2rem;
  }

  .hero-side-label {
    right: 1rem;
  }

  .hero-geo {
    max-width: 200px;
  }

  .home-section-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .sidebar {
    position: static;
    height: auto;
    padding: 0 0 1rem;
  }

  .sub-nav {
    display: flex;
    gap: 0.45rem;
    overflow-x: auto;
    scrollbar-width: none;
  }

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

  .sub-nav li {
    flex: 0 0 auto;
  }

  .sub-nav li + li {
    margin-top: 0;
  }

  .sub-nav li button::before {
    display: none;
  }
}

@media (max-width: 780px) {
  :root {
    --container: calc(100vw - 24px);
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
    gap: 0.75rem;
    min-height: 4.7rem;
    padding-top: calc(0.65rem + env(safe-area-inset-top));
  }

  .topbar::before {
    inset-inline: -0.4rem;
    border-radius: 0 0 1.35rem 1.35rem;
  }

  .brand-name {
    font-size: 1rem;
  }

  .sync-status {
    display: none;
  }

  .content {
    padding: 1rem 0 3.8rem;
  }

  .home-hero {
    padding-top: 1rem;
  }

  .hero-copy {
    padding: 1.6rem 1rem 0;
  }

  .hero-copy h1 {
    font-size: clamp(2.5rem, 12vw, 3.9rem);
  }

  .hero-copy p {
    font-size: 0.96rem;
  }

  .hero-scene {
    min-height: 24rem;
  }

  .hero-scene-inner {
    min-height: 24rem;
  }

  .hero-side-label {
    writing-mode: horizontal-tb;
    top: auto;
    bottom: 1rem;
    left: 1rem;
    right: auto;
    transform: none;
    letter-spacing: 0.16em;
  }

  .hero-geo {
    max-width: 160px;
  }

  .home-section {
    padding: 1.5rem 1rem 1rem;
    border-radius: 1.8rem;
  }

  .home-section::before,
  .home-section::after {
    display: none;
  }

  .home-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .home-view-all {
    min-height: 2.5rem;
  }

  .home-section-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
  }

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

  .card-overlay {
    opacity: 1;
    transform: translateY(0);
    left: 0.7rem;
    right: 0.7rem;
    bottom: 0.7rem;
    padding: 0.72rem;
  }

  .card-prompt {
    font-size: 0.76rem;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  .copy-btn {
    min-height: 2rem;
    padding-inline: 0.78rem;
  }

  .category-header {
    padding: 1.45rem 1rem;
    border-radius: 1.6rem;
  }

  .search-overlay {
    padding-inline: 0.9rem;
  }

  .search-box {
    border-radius: 1.15rem;
  }

  .lightbox {
    padding: 4.5rem 0.85rem 0.9rem;
  }

  .lightbox-figure {
    grid-template-columns: 1fr;
    height: min(100%, 92vh);
  }

  .lightbox-caption {
    max-height: 38vh;
  }

  .lightbox-close {
    top: 0.8rem;
    right: 0.8rem;
  }

  .lightbox-nav {
    width: 2.5rem;
    height: 2.5rem;
  }

  .lightbox-prev {
    left: 0.55rem;
  }

  .lightbox-next {
    right: 0.55rem;
  }

  .footer-inner {
    grid-template-columns: 1fr;
    gap: 1.8rem;
    padding: 1.35rem 1rem 1.45rem;
    border-radius: 1.8rem;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ── New Mosaic Home ────────────────────────────────────── */

.home-stats {
  padding: 0.8rem 1.5rem;
  background: rgba(255,255,255,0.6);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(18,18,18,0.05);
  backdrop-filter: blur(12px);
}

.stats-inner {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 0.82rem;
}

.stat-item {
  display: flex;
  align-items: baseline;
  gap: 0.3rem;
}

.stat-num {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
}

.stat-label {
  color: var(--muted-soft);
}

.stat-sep {
  color: var(--muted-soft);
  opacity: 0.5;
}

.stat-icon {
  flex-shrink: 0;
  opacity: 0.45;
}

.stats-inner .hint {
  opacity: 0.6;
}

.stats-inner kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.2em;
  height: 1.3em;
  padding: 0 0.3em;
  border: 1px solid rgba(18,18,18,0.12);
  border-radius: 4px;
  background: rgba(255,255,255,0.7);
  font-size: 0.72em;
  font-weight: 600;
  font-family: inherit;
  line-height: 1;
  vertical-align: baseline;
}

/* Category pills */
.cat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.2rem;
}

.cat-pill {
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  border: 1px solid rgba(18,18,18,0.1);
  background: rgba(255,255,255,0.5);
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: all 180ms ease;
  white-space: nowrap;
}

.cat-pill:hover {
  background: rgba(255,255,255,0.9);
  border-color: rgba(18,18,18,0.18);
  color: var(--text);
}

.cat-pill.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.cat-pill:not(.active) {
  border-left: 3px solid var(--pill-accent, transparent);
}

/* Mosaic section */
.home-mosaic-section {
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
}

.mosaic-head {
  display: flex;
  align-items: baseline;
  gap: 1rem;
  padding: 0 0.25rem;
}

.mosaic-title {
  margin: 0;
  font-size: clamp(1.4rem, 2vw, 1.9rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
}

/* CSS columns masonry grid */
.mosaic-grid {
  columns: 4 260px;
  column-gap: 1rem;
}

.mosaic-card {
  break-inside: avoid;
  margin-bottom: 1rem;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(18,18,18,0.07);
  box-shadow: 0 12px 36px rgba(21,18,14,0.05);
  cursor: pointer;
  transition: transform 220ms ease, box-shadow 220ms ease, opacity 180ms ease;
  backdrop-filter: blur(16px);
  position: relative;
}
.mosaic-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--cat-accent, var(--muted));
  z-index: 1;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.mosaic-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 20px 48px rgba(21,18,14,0.1);
  border-color: var(--cat-accent, rgba(18,18,18,0.12));
}

.mosaic-card:hover .mc-title {
  color: var(--accent);
}

.mc-media {
  position: relative;
  width: 100%;
  overflow: hidden;
  background: var(--surface-muted);
}

.mc-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 320ms ease;
}

.mosaic-card:hover .mc-media img {
  transform: scale(1.03);
}

.mc-cat-badge {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.68rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.04em;
  backdrop-filter: blur(8px);
  white-space: nowrap;
}

/* Placeholder for cards without images */
.mc-placeholder {
  width: 100%;
  display: flex;
  flex-direction: column;
  padding: 1rem;
  gap: 0.65rem;
  min-height: 140px;
}

.mc-placeholder-inner {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.mc-cat-bar {
  display: block;
  width: 32px;
  height: 4px;
  border-radius: 2px;
  flex-shrink: 0;
}

.mc-text-preview {
  margin: 0;
  font-size: 0.73rem;
  line-height: 1.6;
  color: var(--text-soft);
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-family: inherit;
}

/* Decorative text-only badge */
.mc-text-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted-soft);
  text-transform: uppercase;
  opacity: 0.7;
}

.mc-text-badge svg {
  flex-shrink: 0;
}

/* Card body */
.mc-body {
  padding: 0.75rem 0.85rem 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.mc-title {
  margin: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  transition: color 180ms ease;
}

.mc-cat-label {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.mc-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

.mc-ratio {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.7rem;
  color: var(--muted-soft);
  font-weight: 500;
  letter-spacing: 0.02em;
}

.mc-fav {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 3;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255,255,255,0.7);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
  cursor: pointer;
  border: none;
}

.mosaic-card:hover .mc-fav {
  opacity: 1;
}

.mc-fav:hover {
  transform: scale(1.2);
}

.mc-fav.active {
  opacity: 1;
}

.mc-fav.active svg {
  fill: oklch(63% 0.18 22);
  stroke: oklch(63% 0.18 22);
}

/* Image error fallback */
.mc-media.img-error {
  background: var(--surface-muted);
}

/* Responsive */
@media (max-width: 900px) {
  .mosaic-grid { columns: 3 200px; }
}

@media (max-width: 600px) {
  .mosaic-grid { columns: 2 160px; column-gap: 0.75rem; }
  .mc-body { padding: 0.6rem 0.65rem 0.7rem; }
  .cat-pills { gap: 0.35rem; }
  .cat-pill { padding: 0.28rem 0.7rem; font-size: 0.75rem; }
  .stats-inner { font-size: 0.75rem; gap: 0.7rem; }
}

@media (max-width: 420px) {
  .mosaic-grid { columns: 1; }
}

/* ── Skeleton Loading ─────────────────────────────────── */

.skeleton-card {
  pointer-events: none;
  aspect-ratio: 4 / 5;
}

.skeleton-card::before {
  opacity: 1;
  animation: shimmer 1.6s linear infinite;
}

.skeleton-media {
  width: 100%;
  height: 65%;
  background: linear-gradient(110deg, rgba(241, 238, 232, 0.8) 30%, rgba(255, 255, 255, 0.96) 50%, rgba(241, 238, 232, 0.8) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}

.skeleton-body {
  padding: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.skeleton-line {
  height: 0.7rem;
  border-radius: 999px;
  background: linear-gradient(110deg, rgba(236, 232, 225, 0.9) 30%, rgba(248, 246, 242, 0.96) 50%, rgba(236, 232, 225, 0.9) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.6s linear infinite;
}

.skeleton-line-title {
  width: 75%;
  height: 0.8rem;
}

.skeleton-line-short {
  width: 45%;
}

/* ── Scroll to Top ───────────────────────────────────── */

.scroll-top {
  position: fixed;
  right: 1.5rem;
  bottom: max(1.5rem, calc(1.5rem + env(safe-area-inset-bottom)));
  z-index: 50;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.8rem;
  height: 2.8rem;
  border: 1px solid rgba(18, 18, 18, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--text-soft);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 28px rgba(18, 18, 18, 0.08);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 220ms ease, border-color 220ms ease, color 220ms ease;
  pointer-events: none;
}

.scroll-top:not([hidden]) {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.scroll-top:hover {
  border-color: rgba(235, 138, 92, 0.28);
  color: var(--accent);
}

.scroll-top svg {
  width: 1.1rem;
  height: 1.1rem;
}

/* ── Toast Types ─────────────────────────────────────── */

.toast-success {
  border-left: 3px solid var(--success);
}

.toast-error {
  border-left: 3px solid oklch(63% 0.18 22);
}

.toast-info {
  border-left: 3px solid var(--accent);
}

/* ── Gallery ──────────────────────────────────────────── */

.lightbox-gallery {
  margin-top: 1.2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(18, 18, 18, 0.07);
}

.gallery-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}

.gallery-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-soft);
  letter-spacing: 0.04em;
  flex: 1;
}

.gallery-upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.3rem 0.75rem;
  border: 1px solid rgba(18, 18, 18, 0.1);
  border-radius: 999px;
  background: rgba(249, 247, 243, 0.9);
  color: var(--text-soft);
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 180ms, background 180ms, color 180ms, transform 150ms;
}

.gallery-upload-btn:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  transform: scale(1.03);
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(5rem, 1fr));
  gap: 0.5rem;
}

.gallery-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 0.75rem;
  overflow: hidden;
  cursor: pointer;
  background: var(--surface-muted);
}

.gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 200ms ease;
}

.gallery-item:hover img {
  transform: scale(1.05);
}

.gallery-item-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  opacity: 0;
  transition: opacity 180ms ease;
}

.gallery-item:hover .gallery-item-overlay {
  opacity: 1;
}

.gallery-item-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  transition: transform 150ms ease;
}

.gallery-item-btn:hover {
  transform: scale(1.15);
}

.gallery-item-btn.sync-btn {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
}

.gallery-item-btn.delete-btn {
  background: rgba(232, 99, 85, 0.85);
  color: #fff;
}

.gallery-item-synced-badge {
  position: absolute;
  top: 0.3rem;
  right: 0.3rem;
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
}

.gallery-empty {
  grid-column: 1 / -1;
  padding: 1.2rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
  border: 1px dashed rgba(18, 18, 18, 0.1);
  border-radius: 0.75rem;
}

.gallery-uploading {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 1rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.spin {
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Gallery Drag & Drop ─────────────────────────────── */

.gallery-grid.drag-over {
  border: 2px dashed var(--accent);
  background: rgba(234, 138, 92, 0.06);
  border-radius: 0.75rem;
}

.gallery-grid.drag-over::after {
  content: '释放以上传图片';
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--accent);
  grid-column: 1 / -1;
  min-height: 6rem;
}

/* ── Lightbox Image Strip (left gallery thumbnails) ── */

.lightbox-image-strip {
  display: flex;
  gap: 0.4rem;
  width: 100%;
  padding: 0 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
}

.lightbox-image-strip::-webkit-scrollbar {
  display: none;
}

.strip-thumb {
  flex-shrink: 0;
  width: 3.2rem;
  height: 3.2rem;
  border-radius: 0.6rem;
  overflow: hidden;
  cursor: pointer;
  border: 2px solid transparent;
  opacity: 0.55;
  transition: opacity 180ms ease, border-color 180ms ease, transform 150ms ease;
  background: var(--surface-muted);
}

.strip-thumb:hover {
  opacity: 0.85;
  transform: scale(1.06);
}

.strip-thumb.active {
  border-color: var(--accent);
  opacity: 1;
}

.strip-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* ── Mosaic Card Gallery Filmstrip ── */

.mc-gallery-strip {
  display: flex;
  gap: 3px;
  padding: 0 0.6rem 0.5rem;
  overflow-x: auto;
  scrollbar-width: none;
  flex-shrink: 0;
}

.mc-gallery-strip::-webkit-scrollbar {
  display: none;
}

.mc-gallery-thumb {
  flex-shrink: 0;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 4px;
  overflow: hidden;
  cursor: pointer;
  opacity: 0.8;
  transition: opacity 150ms ease, transform 150ms ease;
  background: var(--surface-muted);
}

.mc-gallery-thumb:hover {
  opacity: 1;
  transform: scale(1.08);
}

.mc-gallery-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.mc-gallery-more {
  flex-shrink: 0;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 4px;
  background: rgba(18, 18, 18, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.65rem;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.mc-gallery-more:hover {
  background: rgba(18, 18, 18, 0.7);
}
