:root {
  color-scheme: light dark;
  --bg: #fff0f6;
  --fg: #3d3d3d;
  --muted: #7a7a7a;
  --accent: #ff87b0;
  --accent-2: #fdb7cf;
  --card: #ffffff;
  --border: #ffd6e7;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Noto Sans SC", "Comic Neue", "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--fg);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 2px solid var(--border);
  position: sticky;
  top: 0;
  background: #ffe0ec;
  z-index: 10;
}
.nav-links {
  display: flex;
  gap: 16px;
  margin-left: 24px;
  flex-grow: 1;
}
.nav-link {
  text-decoration: none;
  color: var(--fg);
  font-weight: 600;
  font-size: 16px;
  padding: 6px 12px;
  border-radius: 99px;
  transition: all 0.2s;
}
.nav-link:hover {
  background: rgba(255, 255, 255, 0.6);
  color: var(--accent);
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.brand a {
  display: flex;
  text-decoration: none;
}
.logo-img {
  height: 40px;
  width: auto;
  border-radius: 6px;
  box-shadow: 0 1px 4px rgba(255, 135, 176, 0.25);
}
.brand .logo {
  font-weight: 800;
  color: var(--accent);
}
.brand h1 {
  margin: 0;
  font-size: 20px;
}
.controls {
  display: flex;
  gap: 8px;
  align-items: center;
}
input, select, button {
  background: var(--card);
  color: var(--fg);
  border: 1px solid #ffc2d1;
  border-radius: 8px;
  padding: 8px 10px;
}
button {
  cursor: pointer;
}
button:hover {
  border-color: var(--accent);
}
.pill {
  border-radius: 999px;
}
.actions {
  display: flex;
  gap: 6px;
}

.hero {
  background: linear-gradient(180deg, #ffe6f0, #fff0f6);
  border-bottom: 2px solid var(--border);
}
.hero-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  height: 180px;
  background-image: radial-gradient(circle at 20% 20%, #fff, #ffe6f0 40%);
}
.hero-img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(255, 135, 176, 0.25);
}
.hero-title {
  font-size: 28px;
  color: var(--accent);
  font-weight: 700;
  text-shadow: 0 1px 0 #fff;
}
.hero-sub {
  font-size: 14px;
  color: var(--muted);
}

.tabs {
  border-bottom: 2px solid var(--border);
  background: #fff6fa;
}
.tabs-row {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
}
.tab {
  border: 1px solid #ffc2d1;
  border-radius: 999px;
  padding: 8px 10px;
  text-align: center;
  background: #fff;
}
.tab.active {
  border-color: var(--accent);
  background: #ffe0ec;
}

.ad-banner {
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(255, 135, 176, 0.25);
  margin-top: 12px;
}
.ad-banner img {
  width: 100%;
  height: auto;
  display: block;
}

.container {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 12px;
  padding: 12px 16px;
}

.sidebar {
  border-left: 2px solid var(--border);
  position: sticky;
  top: 56px;
  height: calc(100vh - 56px);
  overflow: auto;
  padding-left: 12px;
}
.sidebar.right { order: 2; }
.content { order: 1; }
.sidebar-title {
  margin: 0 0 8px 0;
  font-size: 14px;
  color: var(--muted);
}
.tags-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tags-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}
.tags-list li:hover {
  border-color: var(--accent);
}
.tags-list li.active {
  border-color: var(--accent);
  background: #ffe0ec;
}
.sort {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.content {
  min-height: 60vh;
}

.stats {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 8px;
}

.grid {
  column-width: 260px;
  column-gap: 12px;
}
.grid > .card {
  display: inline-block;
  width: 100%;
}
.card {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--card);
  break-inside: avoid;
  margin-bottom: 12px;
  box-shadow: 0 1px 4px rgba(255, 135, 176, 0.15);
  transition: transform 0.2s ease;
}
.card img {
  width: 100%;
  height: auto;
  display: block;
  background: #fafafa;
}
.card .meta {
  padding: 8px;
  font-size: 12px;
  color: var(--muted);
}
.card .tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 8px;
}
.tag {
  font-size: 11px;
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 999px;
}
.tag:hover { border-color: var(--accent); }
.card .actions {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  padding: 8px;
}
.favorite {
  border: 1px solid #ffc2d1;
  background: #fff;
  border-radius: 999px;
  padding: 4px 8px;
}
.favorite.active {
  border-color: var(--accent);
  background: #ffe0ec;
}

.sentinel {
  text-align: center;
  color: var(--muted);
  padding: 12px 0 24px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal.hidden { display: none; }
.modal-content {
  background: var(--card);
  border: 2px solid var(--border);
  border-radius: 12px;
  overflow-y: auto;
  max-width: 90vw;
  max-height: 90vh;
  width: min-content;
  display: flex;
  flex-direction: column;
}
.modal-content img {
  max-width: 90vw;
  max-height: 70vh;
  display: block;
  object-fit: contain;
  background: #000;
}
.modal-content .meta {
  padding: 10px;
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
  white-space: normal;
}
.close {
  position: absolute;
  margin: 8px;
  right: 8px;
  top: 8px;
  border-radius: 999px;
  width: 28px;
  height: 28px;
}

.gate {
  padding: 20px;
  max-width: 420px;
}
.gate-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
}
.gate-sub {
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0 12px;
}
.gate-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
.accent {
  border-color: var(--accent);
  background: #ffe0ec;
}

.footer {
  border-top: 2px solid var(--border);
  background: #fff6fa;
  display: flex;
  justify-content: space-between;
  padding: 12px 16px;
  font-size: 12px;
  color: var(--muted);
}

.home {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 16px 24px;
}
.block {
  border: 2px solid var(--border);
  background: #fff;
  border-radius: 12px;
  margin-bottom: 16px;
  padding: 12px;
  box-shadow: 0 2px 8px rgba(255, 135, 176, 0.08);
}
.block-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.grid-fixed {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-items: start;
}
.tags-list.inline {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 12px;
  overflow: visible;
  padding-bottom: 6px;
}
.tags-list.inline li {
  padding: 0;
  border: none;
}
.album-carousel {
  position: relative;
  margin: 10px 0 12px;
  border-radius: 12px;
  overflow: hidden;
  border: none;
  background: transparent;
  box-shadow: none;
}
.album-layout {
  display: grid;
  gap: 0;
  padding: 0;
}
.album-body {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}
.album-main,
.album-side-card {
  display: block;
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  background: linear-gradient(135deg, #ffe6f0, #fff0f6);
  transition: transform 0.2s ease;
}
.album-main:hover,
.album-side-card:hover {
  transform: translateY(-1px);
}
.album-media {
  width: 100%;
  aspect-ratio: 16 / 9;
}
.album-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.album-caption {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  backdrop-filter: blur(4px);
  max-width: calc(100% - 20px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.album-side {
  display: grid;
  gap: 12px;
}
.album-side-card .album-caption {
  font-size: 12px;
  padding: 5px 9px;
}
.picker-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
}
.picker-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  background: #fff;
  cursor: pointer;
}
.picker-item:hover {
  border-color: var(--accent);
}
.picker-item img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  display: block;
  background: #fafafa;
}
.picker-item .meta {
  padding: 6px 8px;
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}
.tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 12px;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 4px rgba(0,0,0,0.06);
  white-space: nowrap;
}
.tag-chip::before {
  content: "#";
  opacity: 0.85;
}
.chip-blue { background: #339af0; }
.chip-purple { background: #845ef7; }
.chip-green { background: #82c91e; }
.chip-pink { background: #faa2c1; }
.chip-orange { background: #fab005; }
.chip-cyan { background: #22b8cf; }
.chip-teal { background: #12b886; }
.chip-violet { background: #5c7cfa; }
.chip-lime { background: #94d82d; }
.chip-sky { background: #4dabf7; }

@media (max-width: 900px) {
  .grid-fixed { grid-template-columns: repeat(2, 1fr); }
  .album-body { grid-template-columns: 1fr; }
  .album-side { grid-template-columns: repeat(2, 1fr); }
  .picker-grid { grid-template-columns: repeat(3, 1fr); }
}

.block-header .link {
  color: #1c7ed6;
  background: transparent;
  border: none;
  cursor: pointer;
  font-weight: 600;
}
.block-header .link:hover { text-decoration: underline; }
/* 删除旧的固定高度和占位样式，改为自适应单图展示 */
