/* ============================================================
   DESIGN TOKENS
============================================================ */
:root {
  --ink:      #0f0e0d;
  --ink-2:    #3a3530;
  --ink-3:    #7a6f68;
  --ink-4:    #b5aca5;
  --paper:    #faf8f5;
  --paper-2:  #f2ede6;
  --paper-3:  #e8e0d5;
  --red:      #c0392b;
  --red-deep: #8b1a0f;
  --red-warm: #e74c3c;
  --gold:     #c9944a;
  --gold-lt:  #e8c07a;
  --line:     rgba(15,14,13,0.10);
  --line-2:   rgba(15,14,13,0.06);

  --sh-sm:    0 2px 8px rgba(15,14,13,0.07);
  --sh-md:    0 8px 32px rgba(15,14,13,0.10);
  --sh-lg:    0 24px 64px rgba(15,14,13,0.13);

  --r-sm:  6px;
  --r-md:  12px;
  --r-lg:  20px;
  --r-xl:  32px;
  --ease:  cubic-bezier(0.22,1,0.36,1);
  --dur:   0.32s;

  --font-display: 'Noto Serif SC', serif;
  --font-body:    'DM Sans', 'PingFang SC', sans-serif;
}

/* ============================================================
   RESET
============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { text-decoration: none; color: inherit; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ============================================================
   NOISE TEXTURE OVERLAY
============================================================ */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 9999;
  opacity: 0.025;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  background-size: 200px;
}

/* ============================================================
   NAVBAR
============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 200;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 5vw, 48px);
  background: rgba(250,248,245,0.82);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid var(--line);
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.nav-emblem {
  width: 40px;
  height: 40px;
  background: var(--red);
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
}

.nav-emblem::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, var(--red-warm), var(--red-deep));
}

.nav-emblem svg {
  position: relative;
  z-index: 1;
}

.nav-wordmark {
  display: flex;
  flex-direction: column;
  gap: 0px;
}

.nav-wordmark .zh {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  letter-spacing: 0.02em;
}

.nav-wordmark .en {
  font-size: 10px;
  font-weight: 400;
  color: var(--ink-3);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

#userInfo { display: flex; align-items: center; gap: 10px; }

.user-tag {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px 6px 9px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-2);
}

.user-tag .avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red), var(--gold));
  display: grid;
  place-items: center;
  font-size: 11px;
  color: #fff;
  font-weight: 700;
}

/* ============================================================
   BUTTONS
============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--r-xl);
  font-family: inherit;
  font-weight: 600;
  transition: all var(--dur) var(--ease);
  cursor: pointer;
  border: none;
  outline: none;
  white-space: nowrap;
}
.btn:active:not(:disabled) { transform: scale(0.95); }

.btn-sm  { font-size: 12px; padding: 6px 15px; height: 30px; }
.btn-md  { font-size: 14px; padding: 10px 22px; height: 44px; }
.btn-lg  { font-size: 15px; padding: 13px 30px; height: 52px; }
.btn-full { width: 100%; }

.btn-solid {
  background: var(--ink);
  color: var(--paper);
}
.btn-solid:hover:not(:disabled) {
  background: var(--red);
}

.btn-ghost {
  background: transparent;
  color: var(--ink-2);
  border: 1px solid var(--line);
}
.btn-ghost:hover:not(:disabled) {
  border-color: var(--ink-3);
  color: var(--ink);
}

.btn-red {
  background: var(--red);
  color: #fff;
  box-shadow: 0 4px 16px rgba(192,57,43,0.28);
}
.btn-red:hover:not(:disabled) {
  background: var(--red-deep);
  box-shadow: 0 6px 24px rgba(192,57,43,0.36);
}

.btn-outline-red {
  background: transparent;
  color: var(--ink-3);
  border: 1px solid var(--line);
}
.btn-outline-red:hover:not(:disabled) {
  border-color: var(--red);
  color: var(--red);
  background: rgba(192,57,43,0.04);
}

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ============================================================
   HERO — Editorial layout
============================================================ */
.hero {
  position: relative;
  overflow: hidden;
  padding: clamp(48px, 8vw, 96px) clamp(20px, 5vw, 48px) 0;
  background: var(--paper);
}

.hero::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--red) 0%, var(--gold) 100%);
}

.hero-grid {
  max-width: 1120px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 48px;
  align-items: end;
}

.hero-left {}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
  margin-bottom: 20px;
}

.hero-kicker::before {
  content: '';
  display: block;
  width: 24px;
  height: 1.5px;
  background: var(--red);
}

.hero-headline {
  font-family: var(--font-display);
  font-size: clamp(40px, 6vw, 80px);
  font-weight: 900;
  line-height: 1.0;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 24px;
}

.hero-headline em {
  font-style: italic;
  color: var(--red);
}

.hero-sub {
  font-size: 16px;
  color: var(--ink-3);
  font-weight: 300;
  max-width: 360px;
  line-height: 1.75;
}

.hero-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0;
}

.stats-block {
  width: 100%;
  max-width: 420px;
  background: var(--ink);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 36px 40px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  position: relative;
  overflow: hidden;
}

.stats-block::before {
  content: '"';
  font-family: var(--font-display);
  font-size: 320px;
  color: rgba(255,255,255,0.03);
  position: absolute;
  top: -80px;
  right: -20px;
  line-height: 1;
  pointer-events: none;
}

.stat-item {}

.stat-num {
  font-family: var(--font-display);
  font-size: clamp(32px, 4vw, 52px);
  font-weight: 900;
  color: #fff;
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 12px;
  color: rgba(255,255,255,0.45);
  margin-top: 6px;
  font-weight: 400;
  letter-spacing: 0.05em;
}

.stat-bar {
  height: 2px;
  background: rgba(255,255,255,0.10);
  border-radius: 2px;
  margin-top: 16px;
  position: relative;
}

.stat-bar::after {
  content: '';
  position: absolute;
  inset-block: 0;
  left: 0;
  width: 60%;
  background: linear-gradient(90deg, var(--red), var(--gold));
  border-radius: 2px;
}

/* ============================================================
   TAB BAR
============================================================ */
.tabs-wrap {
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 68px;
  z-index: 100;
}

.tabs-inner {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(20px, 5vw, 48px);
  display: flex;
  align-items: center;
  gap: 0;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 18px 4px;
  margin-right: 32px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-4);
  border-bottom: 2px solid transparent;
  transition: color var(--dur) var(--ease), border-color var(--dur) var(--ease);
  letter-spacing: 0.02em;
}

.tab-btn:hover { color: var(--ink-2); }

.tab-btn.active {
  color: var(--ink);
  border-bottom-color: var(--red);
}

.tab-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  transition: opacity var(--dur);
}
.tab-btn.active .tab-dot { opacity: 1; background: var(--red); }

.tabs-rule {
  flex: 1;
}

/* ============================================================
   MAIN GRID
============================================================ */
.main {
  max-width: 1120px;
  margin: 0 auto;
  padding: clamp(32px, 4vw, 56px) clamp(20px, 5vw, 48px) 80px;
}

.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.section-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.section-count {
  font-size: 13px;
  color: var(--ink-4);
}

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

/* ============================================================
   CARD
============================================================ */
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), transform var(--dur) var(--ease);
  position: relative;
}

.card:hover {
  border-color: var(--line-2);
  box-shadow: var(--sh-md);
  transform: translateY(-3px);
}

.card-media {
  aspect-ratio: 16/9;
  position: relative;
  overflow: hidden;
  background: var(--paper-2);
}

.card-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.6s var(--ease);
}

.card:hover .card-img { transform: scale(1.06); }

.img-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--ink-4);
}

.img-placeholder svg { opacity: 0.3; }
.img-placeholder span { font-size: 11px; opacity: 0.5; letter-spacing: 0.08em; }

.card-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  padding: 3px 9px;
  border-radius: var(--r-sm);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  backdrop-filter: blur(12px);
}

.card-badge.charity {
  background: rgba(192,57,43,0.90);
  color: #fff;
}

.card-badge.merchant {
  background: rgba(201,148,74,0.90);
  color: #fff;
}

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

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-4);
  letter-spacing: 0.06em;
}

.card-meta-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--ink-4);
}

.card-title {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.35;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-desc {
  font-size: 13px;
  color: var(--ink-3);
  line-height: 1.7;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
  font-weight: 300;
}

.card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  margin-top: 4px;
  border-top: 1px solid var(--line-2);
  gap: 12px;
}

.card-participants {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-3);
}

.part-bar {
  width: 32px;
  height: 3px;
  border-radius: 3px;
  background: var(--paper-3);
  position: relative;
  overflow: hidden;
}

.part-bar::after {
  content: '';
  position: absolute;
  inset-block: 0;
  left: 0;
  width: var(--fill, 50%);
  background: var(--red);
  border-radius: 3px;
}

/* ============================================================
   EMPTY + LOADING
============================================================ */
.state-wrap {
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 80px 20px;
  gap: 12px;
  text-align: center;
}

.state-icon {
  font-size: 48px;
  line-height: 1;
  opacity: 0.4;
}

.state-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

.state-desc {
  font-size: 14px;
  color: var(--ink-4);
  font-weight: 300;
}

.spinner {
  width: 32px;
  height: 32px;
  border: 2px solid var(--paper-3);
  border-top-color: var(--red);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

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

/* ============================================================
   MODAL
============================================================ */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(15,14,13,0.60);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal.show { display: flex; }

.modal-card {
  background: var(--paper);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 400px;
  box-shadow: var(--sh-lg);
  overflow: hidden;
  animation: modalIn 0.32s var(--ease) both;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(32px) scale(0.95); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  background: var(--ink);
  padding: 32px 32px 28px;
  position: relative;
  overflow: hidden;
}

.modal-header::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -40px;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  background: rgba(192,57,43,0.15);
  pointer-events: none;
}

.modal-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.4);
  margin-bottom: 8px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.modal-close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.6);
  display: grid;
  place-items: center;
  font-size: 18px;
  transition: background var(--dur), color var(--dur);
  cursor: pointer;
  border: none;
  line-height: 1;
}
.modal-close:hover { background: rgba(255,255,255,0.20); color: #fff; }

.modal-body {
  padding: 28px 32px 32px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 7px;
}

.field input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1.5px solid var(--paper-3);
  border-radius: var(--r-md);
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  background: var(--paper);
  outline: none;
  transition: border-color var(--dur), box-shadow var(--dur);
}
.field input::placeholder { color: var(--ink-4); }
.field input:focus {
  border-color: var(--red);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.10);
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.modal-footer {
  text-align: center;
  margin-top: 16px;
  font-size: 12px;
  color: var(--ink-4);
}
.modal-footer a { color: var(--red); font-weight: 600; }

/* ============================================================
   TOAST
============================================================ */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(64px);
  background: var(--ink);
  color: rgba(255,255,255,0.9);
  padding: 11px 20px 11px 16px;
  border-radius: var(--r-xl);
  font-size: 13.5px;
  font-weight: 500;
  box-shadow: var(--sh-lg);
  z-index: 2000;
  opacity: 0;
  transition: transform 0.4s var(--ease), opacity 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
  max-width: 90vw;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 9px;
}

.toast::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
  flex-shrink: 0;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ============================================================
   RESPONSIVE
============================================================ */
@media (max-width: 768px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }
  .hero-right {
    align-items: stretch;
  }
  .stats-block {
    max-width: 100%;
    border-radius: var(--r-lg);
  }
  .hero {
    padding-bottom: 0;
  }
  .grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  .modal-header { padding: 24px 24px 20px; }
  .modal-body { padding: 24px 24px 28px; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ============================================================
   SCROLLBAR
============================================================ */
@media (min-width: 641px) {
  ::-webkit-scrollbar { width: 5px; }
  ::-webkit-scrollbar-track { background: transparent; }
  ::-webkit-scrollbar-thumb { background: var(--paper-3); border-radius: 9px; }
  ::-webkit-scrollbar-thumb:hover { background: var(--paper-2); }
}

/* ============================================================
   CARD ENTRY ANIMATION
============================================================ */
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card {
  animation: cardIn 0.4s var(--ease) both;
}

.card:nth-child(1) { animation-delay: 0.04s; }
.card:nth-child(2) { animation-delay: 0.09s; }
.card:nth-child(3) { animation-delay: 0.14s; }
.card:nth-child(4) { animation-delay: 0.19s; }
.card:nth-child(5) { animation-delay: 0.22s; }
.card:nth-child(6) { animation-delay: 0.25s; }

/* ============================================================
   SUCCESS ICON
============================================================ */
.success-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red), var(--gold));
  display: grid;
  place-items: center;
  font-size: 28px;
  color: #fff;
  margin: 0 auto;
  animation: successPop 0.5s var(--ease) both;
}

@keyframes successPop {
  0% { transform: scale(0); opacity: 0; }
  50% { transform: scale(1.2); }
  100% { transform: scale(1); opacity: 1; }
}
