:root {
  color-scheme: light;
  --bg: #f8fafc;
  --bg2: #eef2f6;
  --panel: rgba(255, 255, 255, 0.95);
  --line: rgba(0, 0, 0, 0.06);
  --text: #1e293b;
  --muted: #64748b;
  --accent: #06b6d4;
  --accent2: #8b5cf6;
  --danger: #ef4444;
  --public-accent: #06b6d4;
  --paid-accent: #f59e0b;
}

* { box-sizing: border-box; margin: 0; }
body {
  font-family: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: linear-gradient(135deg, #f8fafc 0%, #eef2f6 50%, #f1f5f9 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== 粒子背景 ===== */
#particles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.particle {
  position: absolute;
  background: radial-gradient(circle, var(--accent), transparent);
  border-radius: 50%;
  opacity: 0.15;
  animation: particleFloat linear infinite;
}

@keyframes particleFloat {
  0% {
    transform: translateY(0) translateX(0) scale(1);
    opacity: 0.15;
  }
  50% {
    transform: translateY(-50vh) translateX(20px) scale(1.1);
    opacity: 0.25;
  }
  100% {
    transform: translateY(-100vh) translateX(-10px) scale(1);
    opacity: 0.1;
  }
}

/* ===== Background Glows ===== */
.bg-glow {
  position: fixed;
  inset: auto;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.15;
  pointer-events: none;
  animation: glowFloat 10s ease-in-out infinite alternate;
  z-index: 0;
}

.bg-glow-left { left: -150px; top: 80px; background: var(--accent); }
.bg-glow-right { right: -180px; top: 250px; background: var(--accent2); animation-delay: 5s; }

@keyframes glowFloat {
  from { opacity: 0.1; transform: translate(0, 0) scale(1); }
  to { opacity: 0.2; transform: translate(30px, 40px) scale(1.15); }
}

/* ===== Layout ===== */
.shell {
  width: min(1200px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 64px;
  position: relative;
  z-index: 1;
}

.hero, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(20px);
  border-radius: 28px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04), 0 2px 8px rgba(0, 0, 0, 0.02);
  position: relative;
  overflow: hidden;
}

.hero::before, .panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  opacity: 0.6;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 32px;
  margin-bottom: 32px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.hero:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.06), 0 4px 12px rgba(0, 0, 0, 0.03);
}

.hero h1 { margin: 14px 0 12px; font-size: clamp(1.8rem, 5vw, 3.2rem); line-height: 1.2; font-weight: 800; }
.hero p, .muted { color: var(--muted); line-height: 1.7; font-size: 15px; }
.compact h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }

.hero-actions {
  display: flex;
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
}

/* ===== Badges & Buttons ===== */
.badge, .admin-link, .primary, .ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-weight: 600;
}

.badge {
  padding: 8px 16px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(139, 92, 246, 0.15));
  color: var(--accent);
  font-size: 13px;
  letter-spacing: 0.06em;
  border: 1px solid rgba(6, 182, 212, 0.2);
  animation: badgePulse 3s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 rgba(6, 182, 212, 0); }
  50% { box-shadow: 0 0 20px rgba(6, 182, 212, 0.15); }
}

.admin-link, .ghost {
  text-decoration: none;
  color: var(--text);
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.03);
  cursor: pointer;
  font-size: 14px;
  border: 1px solid var(--line);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.admin-link:hover, .ghost:hover {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.08), rgba(139, 92, 246, 0.08));
  color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(6, 182, 212, 0.1);
  border-color: rgba(6, 182, 212, 0.15);
}

.ghost:active { transform: translateY(0) scale(0.98); }

.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-weight: 700;
  border: none;
  padding: 12px 24px;
  box-shadow: 0 4px 20px rgba(6, 182, 212, 0.25);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.primary:hover {
  filter: brightness(1.1);
  transform: translateY(-4px) scale(1.02);
  box-shadow: 0 8px 30px rgba(6, 182, 212, 0.35);
}

.primary:active { transform: translateY(0) scale(0.98); }

.ghost { color: var(--muted); }

/* ===== Tab Switcher ===== */
.tab-switcher {
  display: flex;
  justify-content: center;
  gap: 0;
  margin: 28px 0;
  position: relative;
}

.tab-btn, .admin-tab {
  padding: 14px 48px;
  font-size: 15px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.tab-btn:first-child, .admin-tab:first-child {
  border-radius: 28px 0 0 28px;
}

.tab-btn:last-child, .admin-tab:last-child {
  border-radius: 0 28px 28px 0;
  border-left: none;
}

.tab-btn:not(.active):hover, .admin-tab:not(.active):hover {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.08), rgba(139, 92, 246, 0.08));
  color: var(--accent);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(6, 182, 212, 0.08);
}

.tab-btn.active, .admin-tab.active {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-weight: 700;
  border-color: transparent;
  box-shadow: 0 6px 24px rgba(6, 182, 212, 0.2);
  transform: scale(1.02);
}

/* ===== Section Headers ===== */
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 24px 0 16px;
  padding: 0 4px;
}

.section-head h2 {
  position: relative;
  padding-left: 18px;
  font-size: 1.3rem;
  font-weight: 700;
}

.section-head h2::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 2px;
  width: 5px;
  border-radius: 3px;
  background: var(--accent);
  animation: barGlow 2s ease-in-out infinite;
}

@keyframes barGlow {
  0%, 100% { opacity: 0.8; box-shadow: 0 0 0 transparent; }
  50% { opacity: 1; box-shadow: 0 0 12px var(--accent); }
}

.paid-title::before { background: var(--paid-accent); }
.public-title::before { background: var(--public-accent); }

/* ===== Grid & Cards ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.card, .site-row {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--line);
  border-radius: 24px;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.card::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(139, 92, 246, 0.1));
  opacity: 0;
  transition: opacity 0.4s ease;
  z-index: -1;
}

.card {
  padding: 24px;
  min-height: 180px;
  cursor: pointer;
  overflow: hidden;
}

.card:hover {
  transform: translateY(-8px) scale(1.03);
  border-color: rgba(6, 182, 212, 0.25);
  box-shadow: 0 16px 48px rgba(6, 182, 212, 0.1), 0 4px 16px rgba(0, 0, 0, 0.04);
}

.card:hover::after { opacity: 1; }

.site-top {
  display: flex;
  align-items: center;
  gap: 16px;
}

.icon-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  flex: 0 0 auto;
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.card:hover .icon-wrap {
  transform: scale(1.1) rotate(5deg);
}

.icon {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.1), rgba(139, 92, 246, 0.1));
  object-fit: cover;
  border: 2px solid rgba(255, 255, 255, 0.5);
}

.icon-fallback {
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff;
  font-weight: 800;
  font-size: 22px;
  display: none;
  align-items: center;
  justify-content: center;
}

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

.site-name-link {
  display: inline-block;
  color: var(--text);
  text-decoration: none;
  font-size: 1.1rem;
  font-weight: 700;
  transition: all 0.3s ease;
  cursor: pointer;
}

.site-name-link:hover {
  color: var(--accent);
  transform: scale(1.02);
}

.site-name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  transition: color 0.3s ease;
}

.card:hover .site-name { color: var(--accent); }

.site-host {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 4px;
  word-break: break-all;
}

.site-desc {
  color: var(--muted);
  margin: 16px 0 0;
  line-height: 1.6;
  font-size: 14px;
}

.site-meta {
  margin-top: 12px;
  padding: 6px 12px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.08), rgba(139, 92, 246, 0.08));
  border-radius: 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  display: inline-block;
}

.site-time {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
}

/* ===== Disclaimer Edit ===== */
.disclaimer-edit {
  display: flex;
  gap: 16px;
  align-items: flex-start;
}

.disclaimer-edit textarea {
  flex: 1;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.03);
  color: var(--text);
  border-radius: 16px;
  padding: 16px 18px;
  font-size: 14px;
  resize: vertical;
  outline: none;
  transition: all 0.3s ease;
  font-family: inherit;
}

.disclaimer-edit textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.1);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.03);
  cursor: pointer;
}

.switch-row span {
  display: grid;
  gap: 6px;
}

.switch-row strong {
  color: var(--text);
  font-size: 15px;
}

.switch-row small {
  color: var(--muted);
  line-height: 1.5;
}

.switch-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-row i {
  position: relative;
  width: 54px;
  height: 30px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: rgba(239, 68, 68, 0.22);
  transition: background 0.2s ease;
}

.switch-row i::after {
  content: "";
  position: absolute;
  top: 4px;
  left: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition: transform 0.2s ease;
}

.switch-row input:checked + i {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
}

.switch-row input:checked + i::after {
  transform: translateX(24px);
}

/* ===== Modal Hint ===== */
.modal-hint {
  grid-column: 1 / -1;
  padding: 12px 16px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.08), rgba(139, 92, 246, 0.08));
  border-radius: 12px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

/* ===== Fade-in Animation ===== */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px) scale(0.95); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.fade-in {
  animation: fadeInUp 0.5s cubic-bezier(0.4, 0, 0.2, 1) both;
}

.card:nth-child(1) { animation-delay: 0ms; }
.card:nth-child(2) { animation-delay: 80ms; }
.card:nth-child(3) { animation-delay: 160ms; }
.card:nth-child(4) { animation-delay: 240ms; }
.card:nth-child(5) { animation-delay: 320ms; }
.card:nth-child(6) { animation-delay: 400ms; }
.card:nth-child(7) { animation-delay: 480ms; }
.card:nth-child(8) { animation-delay: 560ms; }
.card:nth-child(9) { animation-delay: 640ms; }

/* ===== Empty State ===== */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 64px 32px;
  color: var(--muted);
  font-size: 15px;
  border: 1px dashed rgba(6, 182, 212, 0.2);
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.02), rgba(139, 92, 246, 0.02));
}

/* ===== Disclaimer ===== */
.disclaimer {
  margin-top: 48px;
  padding: 24px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.05), rgba(239, 68, 68, 0.05));
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: 20px;
  text-align: center;
}

.disclaimer p {
  color: #92400e;
  font-size: 14px;
  line-height: 1.7;
}

/* ===== Panel ===== */
.panel {
  padding: 28px;
  margin-bottom: 28px;
}

.panel h2 {
  margin-bottom: 20px;
  font-size: 1.25rem;
  font-weight: 700;
}

/* ===== Admin List ===== */
.admin-list {
  display: grid;
  gap: 16px;
}

.site-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 18px;
  padding: 18px;
  align-items: center;
}

.site-row:hover {
  border-color: rgba(6, 182, 212, 0.15);
  transform: translateY(-3px);
  box-shadow: 0 8px 28px rgba(6, 182, 212, 0.06);
}

.row-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.pill {
  display: inline-flex;
  align-items: center;
  padding: 6px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.12), rgba(139, 92, 246, 0.12));
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

/* ===== Login Panel ===== */
.login-panel {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(20px);
  border-radius: 28px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.06);
  padding: 48px 44px;
  text-align: center;
  max-width: 440px;
  width: 100%;
  animation: cardFloat 5s ease-in-out infinite alternate;
  position: relative;
  overflow: hidden;
}

.login-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

@keyframes cardFloat {
  from { transform: translateY(0); box-shadow: 0 16px 48px rgba(0, 0, 0, 0.06); }
  to { transform: translateY(-12px); box-shadow: 0 24px 64px rgba(6, 182, 212, 0.08); }
}

.login-card h2 {
  font-size: 1.6rem;
  color: var(--text);
  font-weight: 700;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 28px;
}

.login-form input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.03);
  color: var(--text);
  border-radius: 18px;
  padding: 18px 22px;
  outline: none;
  font-size: 15px;
  text-align: center;
  transition: all 0.3s ease;
}

.login-form input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 24px rgba(6, 182, 212, 0.12);
  background: rgba(6, 182, 212, 0.03);
}

.login-form .primary {
  width: 100%;
  padding: 18px;
  font-size: 15px;
}

.login-error {
  margin-top: 14px;
  color: var(--danger);
  font-size: 14px;
}

.save-error {
  margin-top: 14px;
  padding: 12px 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 12px;
  color: var(--danger);
  font-size: 14px;
  text-align: center;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  z-index: 1000;
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal-content {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.2);
  width: min(520px, calc(100vw - 64px));
  animation: modalSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.modal-content::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(40px) scale(0.9); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  font-size: 1.3rem;
  color: var(--text);
  font-weight: 700;
}

.modal-close {
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(0, 0, 0, 0.03);
  color: var(--muted);
  font-size: 24px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.modal-close:hover {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(139, 92, 246, 0.15));
  color: var(--accent);
  transform: rotate(90deg) scale(1.1);
}

.modal-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  padding: 28px;
}

.modal-form label {
  display: grid;
  gap: 12px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.modal-form input, .modal-form select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.03);
  color: var(--text);
  border-radius: 16px;
  padding: 16px 18px;
  outline: none;
  font-size: 14px;
  transition: all 0.3s ease;
}

.modal-form input:focus, .modal-form select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 20px rgba(6, 182, 212, 0.1);
  background: rgba(6, 182, 212, 0.03);
}

.wide { grid-column: 1 / -1; }
.actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 12px;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { flex-direction: column; align-items: flex-start; }
  .modal-form { grid-template-columns: 1fr; }
  .shell { padding-top: 24px; }
}

@media (max-width: 640px) {
  .shell { width: min(100vw - 16px, 1200px); padding: 16px 0 48px; }
  .grid { grid-template-columns: 1fr; gap: 16px; }
  .site-row { grid-template-columns: 1fr; gap: 12px; }
  .hero-actions { width: 100%; justify-content: stretch; }
  .hero-actions .admin-link, .hero-actions .ghost { flex: 1; text-align: center; }
  .tab-btn, .admin-tab { padding: 12px 32px; font-size: 14px; }
  .hero { padding: 20px; }
  .hero h1 { font-size: 1.5rem; }
  .card { padding: 18px; min-height: 140px; }
  .card:hover { transform: translateY(-4px) scale(1.01); }
  .icon-wrap, .icon, .icon-fallback { width: 44px; height: 44px; border-radius: 14px; }
  .icon-fallback { font-size: 18px; }
  .disclaimer-edit, .switch-row { flex-direction: column; align-items: stretch; }
  .switch-row i { align-self: flex-end; }
  .disclaimer { padding: 16px; font-size: 13px; }
  #particles { display: none; }
}
