/* ============================================
   Tip Jar - Cloudflare Pages 打赏页面
   ============================================ */

/* Reset & Base */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #f59e0b;
  --primary-light: #fbbf24;
  --primary-dark: #d97706;
  --accent: #f59e0b;
  --accent-light: #fbbf24;
  --accent-dark: #d97706;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --bg-alt: #f1f5f9;
  --text: #1e293b;
  --text-muted: #64748b;
  --text-dim: #94a3b8;
  --border: #e2e8f0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 4px 24px rgba(0, 0, 0, 0.25);
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

html {
  scroll-behavior: smooth;
}

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

/* Container */
.container {
  max-width: 720px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Navigation */
.nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.1rem;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-links {
  display: flex;
  gap: 8px;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  padding: 6px 14px;
  border-radius: 8px;
  transition: var(--transition);
}

.nav-link:hover {
  color: var(--text);
  background: rgba(0, 0, 0, 0.04);
}

/* Hero */
.hero {
  position: relative;
  padding: 120px 24px 80px;
  text-align: center;
  overflow: hidden;
}

.hero-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 0%, rgba(245, 158, 11, 0.06) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 50%, rgba(251, 191, 36, 0.06) 0%, transparent 50%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-icon {
  font-size: 3.5rem;
  margin-bottom: 16px;
  animation: heartbeat 2s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.15); }
  50% { transform: scale(1); }
  75% { transform: scale(1.1); }
}

.hero-title {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 16px;
  background: linear-gradient(135deg, #fbbf24, #f59e0b, #d97706);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.8;
}

/* Sections */
.section {
  padding: 64px 0;
}

.section-alt {
  background: var(--bg-alt);
}

.section-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.section-desc {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 40px;
}

/* Tip Grid */
.tip-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

@media (max-width: 640px) {
  .tip-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.tip-card {
  position: relative;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
}

.tip-card:hover {
  border-color: rgba(245, 158, 11, 0.4);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.tip-card.active {
  border-color: var(--primary);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.1), rgba(245, 158, 11, 0.05));
}

.tip-card.popular {
  border-color: rgba(245, 158, 11, 0.3);
}

.tip-badge {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.tip-emoji {
  font-size: 1.5rem;
  margin-bottom: 4px;
}

.tip-amount {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 2px;
}

.tip-symbol {
  font-size: 0.9rem;
  opacity: 0.6;
}

.tip-number {
  letter-spacing: -0.02em;
}

.tip-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Custom Amount */
.custom-amount {
  margin-top: 24px;
  max-width: 320px;
  margin-left: auto;
  margin-right: auto;
}

.custom-label {
  display: block;
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.custom-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.custom-prefix {
  position: absolute;
  left: 16px;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-muted);
  pointer-events: none;
}

.custom-input {
  width: 100%;
  padding: 14px 16px 14px 40px;
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1.1rem;
  font-weight: 600;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.custom-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}

.custom-input::placeholder {
  color: var(--text-dim);
  font-weight: 400;
}

/* Hide number input arrows */
.custom-input::-webkit-outer-spin-button,
.custom-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.custom-input[type="number"] {
  -moz-appearance: textfield;
}

/* Pay Section (below custom amount) */
.pay-section {
  margin-top: 28px;
  max-width: 400px;
  margin-left: auto;
  margin-right: auto;
}

.pay-section .amount-summary {
  margin-bottom: 14px;
}

/* Form */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  max-width: 480px;
  margin: 0 auto;
}

@media (max-width: 480px) {
  .form-card {
    padding: 24px;
  }
}

.form-group {
  margin-bottom: 20px;
}

.form-label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.form-input {
  width: 100%;
  padding: 12px 16px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
  transition: var(--transition);
  outline: none;
}

.form-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.12);
}

.form-input::placeholder {
  color: var(--text-dim);
}

.form-textarea {
  resize: vertical;
  min-height: 80px;
}





/* Payment Methods (hidden by default, uncomment to show) */
.payment-methods {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

@media (max-width: 640px) {
  .payment-methods {
    grid-template-columns: repeat(2, 1fr);
  }
}

.payment-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 8px;
  background: #f8fafc;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  text-align: center;
}

.payment-card:hover {
  border-color: rgba(245, 158, 11, 0.3);
}

.payment-card.active {
  border-color: var(--primary);
  background: rgba(245, 158, 11, 0.08);
}

.payment-icon {
  font-size: 1.5rem;
}

.payment-name {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.payment-sub {
  font-size: 0.65rem;
  color: var(--text-dim);
  margin-top: -2px;
}

.payment-card.active .payment-name {
  color: var(--primary-light);
}

.payment-card.active .payment-sub {
  color: rgba(251, 191, 36, 0.6);
}

.payment-tip {
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 10px;
  line-height: 1.5;
}

/* Afdian Hint */
.afdian-hint {
  margin-bottom: 0;
}

.afdian-hint-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: rgba(130, 90, 255, 0.08);
  border: 1px solid rgba(130, 90, 255, 0.2);
  border-radius: var(--radius-sm);
}

.afdian-hint-icon {
  font-size: 1.8rem;
  flex-shrink: 0;
  animation: pulseGlow 2s ease-in-out infinite;
}

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

.afdian-hint-text {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.6;
}

.afdian-hint-text strong {
  color: #a78bfa;
}

/* QR Area */
.qr-area {
  text-align: center;
  margin-bottom: 0;
  padding: 24px;
  background: #f1f5f9;
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

.qr-hint {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.qr-placeholder {
  padding: 20px;
  color: var(--text-dim);
  font-size: 0.85rem;
  line-height: 2;
}

.qr-placeholder code {
  background: rgba(255, 255, 255, 0.08);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
}

.qr-filename {
  margin-top: 8px;
}

/* Amount Summary */
.amount-summary {
  text-align: center;
  font-size: 0.95rem;
  color: var(--text-muted);
  padding: 12px;
  background: rgba(245, 158, 11, 0.06);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(245, 158, 11, 0.15);
}

.amount-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--primary-light);
}

/* Pay method hint */
.pay-method-hint {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 12px;
}
.pay-method-hint strong {
  color: var(--text-muted);
}

/* Pay Button */
.btn-primary {
  width: 100%;
  padding: 12px 24px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(245, 158, 11, 0.35);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

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

/* Supporters List */
.supporters-list {
  max-width: 480px;
  margin: 0 auto;
}

.supporter-empty {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-dim);
}

.supporter-empty-icon {
  font-size: 3rem;
  display: block;
  margin-bottom: 16px;
}

.supporter-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.supporter-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.supporter-info {
  flex: 1;
  min-width: 0;
}

.supporter-name {
  font-weight: 600;
  font-size: 0.95rem;
}

.supporter-message {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.supporter-meta {
  text-align: right;
  flex-shrink: 0;
}

.supporter-amount {
  font-weight: 700;
  color: var(--primary-light);
  font-size: 0.9rem;
}

.supporter-time {
  font-size: 0.75rem;
  color: var(--text-dim);
  margin-top: 2px;
}

/* Footer */
.footer {
  padding: 32px 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.footer-text {
  color: var(--text-dim);
  font-size: 0.85rem;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: var(--transition);
}

.footer-link:hover {
  color: var(--primary-light);
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text);
  box-shadow: var(--shadow);
  opacity: 0;
  transition: var(--transition);
  z-index: 200;
  pointer-events: none;
}

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

.toast.error {
  border-color: #ef4444;
  color: #fca5a5;
}

.toast.success {
  border-color: #22c55e;
  color: #86efac;
}

/* Loading skeleton for supporters */
.skeleton {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  margin-bottom: 10px;
}

.skeleton-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--border);
  animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-lines {
  flex: 1;
}

.skeleton-line {
  height: 12px;
  background: var(--border);
  border-radius: 6px;
  margin-bottom: 6px;
  animation: pulse 1.5s ease-in-out infinite;
}

.skeleton-line:last-child {
  width: 60%;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; }
}

/* Mobile nav */
@media (max-width: 480px) {
  .nav-inner {
    height: 48px;
    padding: 0 12px;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .nav-inner::-webkit-scrollbar {
    display: none;
  }
  .nav-brand {
    font-size: 0.85rem;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .nav-links {
    gap: 2px;
    flex-shrink: 0;
  }
  .nav-link {
    font-size: 0.72rem;
    padding: 4px 6px;
    white-space: nowrap;
  }
}

/* QR Payment Section */
.qr-payment-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  max-width: 520px;
  margin: 0 auto;
}

@media (max-width: 480px) {
  .qr-payment-grid {
    grid-template-columns: 1fr;
  }
}

.qr-payment-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.qr-payment-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

.qr-payment-img {
  width: 180px;
  height: 180px;
  margin: 0 auto 16px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px;
}

.qr-payment-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.qr-no-img {
  color: var(--text-dim);
  font-size: 0.8rem;
  text-align: center;
  line-height: 1.6;
}

.qr-no-img code {
  background: rgba(0, 0, 0, 0.04);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  background: var(--accent, #f59e0b);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: 0.2s;
  cursor: pointer;
}

.btn-download:hover {
  background: var(--accent-dark, #d97706);
}

.btn-download::before {
  content: "⬇";
  font-size: 0.9rem;
}


/* Payment Selector */
.payment-selector {
  max-width: 400px;
  margin: 16px auto 0;
}

.payment-options {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.payment-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}

.payment-option:hover {
  border-color: var(--accent);
}

.payment-option.active {
  border-color: var(--accent);
  background: rgba(245, 158, 11, 0.06);
}

.po-icon { font-size: 1.3rem; }
.po-name { font-size: 0.8rem; color: var(--text-secondary); }
.payment-option.active .po-name { color: var(--accent-light); }

.payment-result { max-width: 520px; margin: 16px auto 0; }

.qr-result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 480px) { .qr-result-grid { grid-template-columns: 1fr; } }

.qr-result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  text-align: center;
}

.qr-result-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.qr-result-img {
  width: 160px;
  height: 160px;
  margin: 0 auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 8px;
}

.qr-result-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.qr-result-hint {
  font-size: 0.78rem;
  color: var(--text-dim);
  margin-top: 10px;
}

.afdian-result { text-align: center; }

.btn-afdian {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 40px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: var(--transition);
}

.btn-afdian:hover { background: var(--accent-dark); }
.btn-afdian-icon { font-size: 1.3rem; }
.afdian-result-hint { font-size: 0.78rem; color: var(--text-dim); margin-top: 10px; }

/* QR Single (individual display) */
.qr-single {
  max-width: 280px;
  margin: 0 auto;
}

.qr-single-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
}

.qr-single-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 16px;
}

.qr-single-img {
  width: 200px;
  height: 200px;
  margin: 0 auto 16px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 12px;
}

.qr-single-img img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.btn-download-sm {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 20px;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: var(--transition);
  cursor: pointer;
}

.btn-download-sm:hover {
  background: var(--accent-dark);
}

.qr-single-hint {
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-top: 12px;
}
