:root {
  --bg-color: #0e0b1e;
  --card-bg: #1a1635;
  --text-color: #f0ecff;
  --text-secondary: #a8a0d0;
  --border-color: #2d2656;
  --primary-color: #ff6ec4;
  --primary-hover: #ff4db0;
  --accent-1: #7873f5;
  --accent-2: #4ade80;
  --shadow: 0 4px 20px rgba(120,115,245,0.18);
  --shadow-hover: 0 8px 32px rgba(255,110,196,0.35);
}

[data-theme="light"] {
  --bg-color: #f8f5ff;
  --card-bg: #ffffff;
  --text-color: #1f1a36;
  --text-secondary: #6b648a;
  --border-color: #e5e1f5;
  --primary-color: #d946ef;
  --primary-hover: #c026d3;
  --accent-1: #6366f1;
  --accent-2: #10b981;
  --shadow: 0 4px 16px rgba(99,102,241,0.1);
  --shadow-hover: 0 8px 30px rgba(217,70,239,0.22);
}

* { margin:0; padding:0; box-sizing:border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  transition: background 0.3s, color 0.3s;
}

.container { max-width: 1280px; margin: 0 auto; padding: 0 16px; }

.header {
  background: var(--card-bg);
  box-shadow: var(--shadow);
  position: sticky;
  top: 0;
  z-index: 100;
  border-bottom: 1px solid var(--border-color);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.logo {
  font-size: 22px;
  font-weight: 800;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-1));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.header-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.search-box { display: flex; border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; background: var(--bg-color); }
.search-box input {
  border: none;
  outline: none;
  padding: 10px 14px;
  font-size: 14px;
  background: transparent;
  color: var(--text-color);
  width: 220px;
}
.search-box button {
  border: none;
  background: linear-gradient(90deg, var(--primary-color), var(--accent-1));
  color: #fff;
  padding: 0 18px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.search-box button:hover { opacity: 0.88; }

.theme-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  cursor: pointer;
  font-size: 18px;
  color: var(--text-color);
  transition: all 0.2s;
}
.theme-btn:hover { transform: scale(1.05); }

.nav { border-top: 1px solid var(--border-color); background: var(--card-bg); }
.nav-inner { display: flex; gap: 8px; padding: 12px 16px; overflow-x: auto; scrollbar-width: none; }
.nav-inner::-webkit-scrollbar { display: none; }
.cat-btn {
  padding: 7px 18px;
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-color);
  border-radius: 20px;
  cursor: pointer;
  white-space: nowrap;
  font-size: 14px;
  transition: all 0.2s;
}
.cat-btn:hover { border-color: var(--primary-color); color: var(--primary-color); }
.cat-btn.active {
  background: linear-gradient(90deg, var(--primary-color), var(--accent-1));
  color: #fff;
  border-color: transparent;
}

.main { padding: 24px 16px; min-height: calc(100vh - 220px); }

.stats-bar {
  display: flex;
  justify-content: space-between;
  padding: 12px 18px;
  background: var(--card-bg);
  border-radius: 12px;
  margin-bottom: 20px;
  font-size: 14px;
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.masonry {
  column-count: 4;
  column-gap: 16px;
}
@media (max-width: 1024px) { .masonry { column-count: 3; } }
@media (max-width: 720px)  { .masonry { column-count: 2; } }
@media (max-width: 460px)  { .masonry { column-count: 1; } }

.wall-card {
  break-inside: avoid;
  margin-bottom: 16px;
  background: var(--card-bg);
  border-radius: 14px;
  overflow: hidden;
  box-shadow: var(--shadow);
  transition: all 0.28s;
  cursor: pointer;
  border: 1px solid var(--border-color);
  position: relative;
}
.wall-card:hover {
  box-shadow: var(--shadow-hover);
  transform: translateY(-3px) scale(1.01);
}
.wall-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.55), transparent 50%);
  opacity: 0;
  transition: opacity 0.25s;
}
.wall-card:hover::after { opacity: 1; }

.wall-img {
  width: 100%;
  display: block;
  object-fit: cover;
}

.wall-caption {
  padding: 12px 14px;
  position: relative;
  z-index: 1;
}
.wall-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-color);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wall-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 8px;
}
.tag {
  display: inline-block;
  padding: 2px 9px;
  font-size: 11px;
  border-radius: 10px;
  background: var(--bg-color);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}
.tag.cat {
  background: linear-gradient(90deg, rgba(255,110,196,0.18), rgba(120,115,245,0.18));
  color: var(--primary-color);
  border-color: transparent;
}
.wall-meta {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.empty-state, .loading-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
  font-size: 16px;
}
.spinner {
  width: 42px;
  height: 42px;
  border: 4px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  margin: 0 auto 16px;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal.open { display: flex; }
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.78);
  backdrop-filter: blur(5px);
}
.modal-inner {
  position: relative;
  background: var(--card-bg);
  border-radius: 16px;
  overflow: hidden;
  max-width: 1000px;
  width: 100%;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 80px rgba(0,0,0,0.5);
  border: 1px solid var(--border-color);
}
@media (min-width: 820px) {
  .modal-inner { flex-direction: row; }
}
.modal-close {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(0,0,0,0.6);
  color: #fff;
  border: none;
  font-size: 20px;
  cursor: pointer;
  width: 38px; height: 38px;
  border-radius: 50%;
  z-index: 2;
  transition: all 0.2s;
}
.modal-close:hover { background: rgba(0,0,0,0.8); transform: rotate(90deg); }

#modalImg {
  max-height: 55vh;
  width: 100%;
  object-fit: contain;
  background: #000;
  flex-shrink: 0;
}
@media (min-width: 820px) {
  #modalImg {
    max-height: 92vh;
    max-width: 65%;
    width: 65%;
  }
}
.modal-info {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
#modalTitle {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--text-color);
}
#modalTags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
  color: var(--text-secondary);
  font-size: 13px;
}
.modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.btn {
  flex: 1;
  min-width: 130px;
  padding: 12px 18px;
  border: 1px solid var(--border-color);
  background: var(--bg-color);
  color: var(--text-color);
  border-radius: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  text-decoration: none;
  transition: all 0.2s;
}
.btn:hover { border-color: var(--primary-color); }
.btn-primary {
  background: linear-gradient(90deg, var(--primary-color), var(--accent-1));
  color: #fff;
  border-color: transparent;
}
.btn-primary:hover { opacity: 0.92; }

@media (max-width: 640px) {
  .search-box input { width: 150px; }
  .stats-bar { flex-direction: column; gap: 6px; text-align: center; }
  .logo { font-size: 18px; }
}
