:root {
  --bg: #0f0f13;
  --surface: #1a1a22;
  --surface2: #242430;
  --border: #2e2e3e;
  --text: #e8e8f0;
  --text-muted: #9090a8;
  --accent: #7b68ee;
  --accent-hover: #9b88ff;
  --ai-bg: #2a1a4a;
  --ai-color: #b088ff;
  --price-free: #22c55e;
  --price-paid: #e8e8f0;
  --rating-color: #f59e0b;
}

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

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

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

/* ===== Header ===== */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.site-title small {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  display: block;
  margin-top: 1px;
}

.nav-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  padding: 5px 10px;
  cursor: pointer;
  margin-left: auto;
}

.header-nav {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

@media (max-width: 640px) {
  .site-header { flex-wrap: wrap; }
  .nav-toggle { display: block; }
  .header-nav {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 4px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
  }
  .header-nav.open { display: flex; }
  .nav-btn { text-align: center; padding: 10px 12px; }
}

.nav-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s;
}

.nav-btn:hover, .nav-btn.active {
  border-color: var(--accent);
  color: var(--accent-hover);
}

/* ===== Main content ===== */
.main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px;
}

.section {
  margin-bottom: 40px;
}

.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 17px;
  font-weight: 700;
}

.section-count {
  font-size: 12px;
  color: var(--text-muted);
}

.section-link {
  margin-left: auto;
  font-size: 13px;
  color: var(--accent);
}
.section-link:hover { color: var(--accent-hover); text-decoration: underline; }

/* ===== Card grid ===== */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

@media (min-width: 480px) {
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}
@media (min-width: 768px) {
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
}
@media (min-width: 1200px) {
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
}

/* ===== Work card ===== */
.work-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.15s, transform 0.1s;
}

.work-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.card-img-wrap {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface2);
  overflow: hidden;
}

.card-img-wrap a {
  display: block;
  width: 100%;
  height: 100%;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: opacity 0.2s;
}

.card-img.loading { opacity: 0; }
.card-img.loaded { opacity: 1; }

.card-img-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
}

.card-rank {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1.4;
}

.card-rank.top3 { background: var(--accent); }

.badge-ai {
  position: absolute;
  top: 6px;
  right: 6px;
  background: var(--ai-bg);
  color: var(--ai-color);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid var(--ai-color);
}

.card-body {
  padding: 8px 10px 10px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.card-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-circle {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 2px;
}

.meta-tag {
  font-size: 10px;
  background: var(--surface2);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--text-muted);
}

.card-desc {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-stats {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: auto;
  padding-top: 6px;
  flex-wrap: wrap;
}

.stat-sales {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
}

.stat-rating {
  font-size: 11px;
  color: var(--rating-color);
}

.stat-price {
  font-size: 12px;
  font-weight: 600;
  margin-left: auto;
}

.price-free { color: var(--price-free); }
.price-paid { color: var(--price-paid); }

.card-btn {
  display: block;
  text-align: center;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px;
  margin-top: 8px;
  border-radius: 5px;
  transition: background 0.15s;
}

.card-btn:hover { background: var(--accent-hover); color: #fff; }

/* ===== Status bar ===== */
.status-bar {
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  padding: 6px 16px;
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

/* ===== Loading / error ===== */
.loading-msg {
  padding: 40px;
  text-align: center;
  color: var(--text-muted);
}

.error-msg {
  padding: 20px;
  background: #2a1010;
  border: 1px solid #882222;
  border-radius: 8px;
  color: #ff8888;
  font-size: 14px;
}

/* ===== Age gate modal ===== */
.age-gate {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.age-gate-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 36px 28px;
  max-width: 420px;
  width: 92%;
  text-align: center;
}

.age-gate-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 20px;
}

.age-gate-notice {
  font-size: 14px;
  color: #ff9999;
  font-weight: 600;
  margin-bottom: 8px;
}

.age-gate-question {
  font-size: 16px;
  color: var(--text);
  margin-bottom: 28px;
}

.age-gate-btns {
  display: flex;
  gap: 14px;
  justify-content: center;
}

.age-btn {
  padding: 11px 26px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
}

.age-btn-yes { background: var(--accent); color: #fff; }
.age-btn-yes:hover { background: var(--accent-hover); }

.age-btn-no {
  background: var(--surface2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.age-btn-no:hover { border-color: #ff9999; color: #ff9999; }

body.age-pending .main,
body.age-pending .site-header,
body.age-pending .site-footer { display: none; }

/* ===== Filter bar ===== */
.filter-bar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.filter-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.filter-label {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
  min-width: 52px;
}

.filter-btn {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12px;
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}

.filter-btn:hover { border-color: var(--accent); }
.filter-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.filter-ai-label {
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}

.filter-ai-label input[type="checkbox"] { cursor: pointer; width: 14px; height: 14px; }

.filter-count {
  font-size: 12px;
  color: var(--text-muted);
  margin-left: auto;
}

/* ===== Subsection title ===== */
.subsection-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  margin: 20px 0 10px;
  padding: 4px 10px;
  border-left: 3px solid var(--accent);
}

/* ===== Discount price display ===== */
.price-sale {
  color: var(--price-free);
  font-weight: 700;
}

.price-off {
  display: inline-block;
  font-size: 10px;
  background: #3a1010;
  color: #ff8888;
  border-radius: 3px;
  padding: 1px 4px;
  margin-left: 3px;
  font-weight: 700;
}

/* ===== Footer ===== */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 20px 16px;
  margin-top: 40px;
  text-align: center;
}

.footer-notice {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.footer-notice.age-notice {
  color: #ff9999;
  font-weight: 600;
}

.footer-nav {
  margin-top: 10px;
  font-size: 12px;
}

.footer-nav a {
  color: var(--accent);
}

.footer-nav a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

/* ===== Disclaimer page ===== */
.disclaimer-body {
  max-width: 800px;
  margin: 0 auto;
  padding: 16px;
}

.disclaimer-body h2 {
  font-size: 22px;
  margin-bottom: 20px;
  color: var(--accent);
}

.disclaimer-body h3 {
  font-size: 15px;
  margin: 20px 0 8px;
  color: var(--text);
}

.disclaimer-body p {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.7;
  margin-bottom: 8px;
}

.disclaimer-body .back-link {
  display: inline-block;
  margin-top: 30px;
  color: var(--accent);
  font-size: 14px;
}

.disclaimer-body .back-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}
