:root {
  --primary: #1a73e8;
  --primary-dark: #1557b0;
  --bg: #0d1117;
  --bg-card: #161b22;
  --bg-card-hover: #1c2333;
  --text: #e6edf3;
  --text-secondary: #8b949e;
  --border: #30363d;
  --accent: #f0883e;
  --green: #3fb950;
  --gold: #ffd700;
  --radius: 12px;
  --shadow: 0 2px 12px rgba(0,0,0,0.3);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Noto Sans SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

a { color: var(--primary); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent); }

/* ========== Header ========== */
.header {
  background: linear-gradient(135deg, #0d1117 0%, #161b22 100%);
  border-bottom: 1px solid var(--border);
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
}

.logo-icon {
  font-size: 28px;
  animation: pulse 2s ease-in-out infinite;
}

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

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-links a:hover { color: var(--text); }

/* ========== Hero ========== */
.hero {
  background: linear-gradient(135deg, #1a1f2e 0%, #0d1117 50%, #1a2942 100%);
  padding: 60px 20px 50px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(circle at 30% 50%, rgba(26,115,232,0.08) 0%, transparent 50%),
              radial-gradient(circle at 70% 50%, rgba(240,136,62,0.06) 0%, transparent 50%);
  animation: float 20s linear infinite;
}

@keyframes float {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.hero h1 {
  font-size: 36px;
  font-weight: 800;
  margin-bottom: 12px;
  position: relative;
  background: linear-gradient(135deg, #e6edf3, #1a73e8);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.hero p {
  font-size: 16px;
  color: var(--text-secondary);
  position: relative;
}

/* ========== Search & Filter ========== */
.filter-bar {
  max-width: 1200px;
  margin: -25px auto 0;
  padding: 0 20px;
  position: relative;
  z-index: 10;
}

.filter-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  box-shadow: var(--shadow);
}

.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.search-box input:focus { border-color: var(--primary); }

.search-btn {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--primary);
  border: none;
  border-radius: 6px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 14px;
  transition: background 0.2s;
}

.search-btn:hover { background: var(--primary-dark); }

.search-box::before {
  content: '🔍';
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
}

.filter-select {
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  cursor: pointer;
}

.filter-select option { background: var(--bg-card); }

/* ========== Position Filter (Multi-Select) ========== */
.position-filter {
  max-width: 1200px;
  margin: 12px auto 0;
  padding: 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pos-btn {
  padding: 5px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  user-select: none;
}

.pos-btn:hover, .pos-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 600;
}

/* ========== Tags Filter ========== */
.tags-filter {
  max-width: 1200px;
  margin: 16px auto 0;
  padding: 0 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tag-btn {
  padding: 5px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.tag-btn:hover, .tag-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

/* ========== Post Grid ========== */
.container {
  max-width: 1200px;
  margin: 30px auto;
  padding: 0 20px;
}

.post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}

.post-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: all 0.3s;
  cursor: pointer;
}

.post-card:hover {
  transform: translateY(-4px);
  border-color: var(--primary);
  box-shadow: 0 8px 30px rgba(26,115,232,0.15);
}

.post-card .cover {
  width: 100%;
  height: 200px;
  object-fit: cover;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  font-size: 48px;
}

.post-card .cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.card-body { padding: 16px; }

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

.card-meta .rating {
  background: linear-gradient(135deg, var(--gold), #ffaa00);
  color: #000;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.card-meta .position {
  background: var(--primary);
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
}

.card-meta .cost {
  color: var(--green);
  font-weight: 600;
}

.card-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-summary {
  font-size: 14px;
  color: var(--text-secondary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 12px;
}

.card-tags {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.card-tags span {
  font-size: 12px;
  padding: 2px 8px;
  background: rgba(26,115,232,0.15);
  color: var(--primary);
  border-radius: 4px;
}

.card-date {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 10px;
}

/* Top badge */
.card-top {
  position: absolute;
  top: 0;
  right: 0;
  background: linear-gradient(135deg, #ff6b6b, #ee5a24);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 0 0 0 8px;
}

.card-cover-wrap { position: relative; }

/* ========== Pagination ========== */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 40px;
  padding-bottom: 40px;
}

.pagination button {
  padding: 8px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.pagination button:hover { border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .active { background: var(--primary); border-color: var(--primary); }

.pagination .page-info {
  color: var(--text-secondary);
  font-size: 14px;
}

/* ========== Loading ========== */
.loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-secondary);
}

.loading::after {
  content: '';
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-left: 10px;
  vertical-align: middle;
}

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

.empty {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-secondary);
}

.empty-icon { font-size: 64px; margin-bottom: 16px; }

/* ========== Footer ========== */
.footer {
  text-align: center;
  padding: 30px 20px;
  color: var(--text-secondary);
  font-size: 13px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}

/* ========== Detail Page ========== */
.detail-page {
  max-width: 860px;
  margin: 0 auto;
  padding: 30px 20px 60px;
}

.detail-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
  cursor: pointer;
  transition: color 0.2s;
}

.detail-back:hover { color: var(--text); }

.detail-title {
  font-size: 30px;
  font-weight: 800;
  line-height: 1.3;
  margin-bottom: 20px;
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}

.detail-meta .meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
}

.detail-meta .meta-item strong {
  color: var(--text);
}

.detail-cover {
  width: 100%;
  border-radius: var(--radius);
  margin-bottom: 30px;
  max-height: 400px;
  object-fit: cover;
}

.detail-content {
  font-size: 16px;
  line-height: 1.8;
  color: var(--text);
}

.detail-content h2 {
  font-size: 22px;
  margin: 30px 0 16px;
  color: var(--text);
}

.detail-content h3 {
  font-size: 18px;
  margin: 24px 0 12px;
  color: var(--text);
}

.detail-content p {
  margin-bottom: 16px;
}

.detail-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  border-radius: 8px;
  overflow: hidden;
}

.detail-content th, .detail-content td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.detail-content th {
  background: var(--bg-card);
  font-weight: 600;
  color: var(--text-secondary);
  font-size: 14px;
}

.detail-content td { font-size: 15px; }

.detail-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 16px 0;
}

.detail-content ul, .detail-content ol {
  padding-left: 24px;
  margin-bottom: 16px;
}

.detail-content li {
  margin-bottom: 8px;
}

/* ========== Responsive ========== */
@media (max-width: 768px) {
  .hero h1 { font-size: 26px; }
  .hero { padding: 40px 20px 36px; }
  .filter-inner { flex-wrap: nowrap; gap: 8px; padding: 12px 14px; }
  .search-box { flex: 1; min-width: 0; }
  .filter-select { min-width: auto; flex-shrink: 0; font-size: 13px; padding: 8px 10px; }
  .position-filter { gap: 4px; padding: 0 16px; }
  .pos-btn { padding: 4px 10px; font-size: 12px; }
  .post-grid { grid-template-columns: 1fr; }
  .detail-title { font-size: 24px; }
  .header-inner { height: 56px; }
  .logo { font-size: 18px; }
}
