/* ============================================================
   CSS Variables & Reset
   ============================================================ */
:root {
  --primary: #0ea5e9;
  --primary-dark: #0284c7;
  --primary-light: #e0f2fe;
  --accent: #f97316;
  --accent-light: #fff7ed;
  --green: #10b981;
  --green-light: #ecfdf5;
  --purple: #8b5cf6;
  --purple-light: #f5f3ff;
  --red: #ef4444;
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;
  --radius: 16px;
  --radius-sm: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
  --font: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--gray-50);
  color: var(--gray-800);
  line-height: 1.7;
  min-height: 100vh;
  padding-top: 64px;
}

/* ============================================================
   Loading Screen
   ============================================================ */
#loading-screen {
  position: fixed; inset: 0;
  background: white;
  display: flex; align-items: center; justify-content: center;
  z-index: 9999;
  transition: opacity 0.5s ease;
}
#loading-screen.hidden { opacity: 0; pointer-events: none; }
.loader { text-align: center; }
.loader-icon { font-size: 3rem; display: block; animation: bounce 0.8s infinite alternate; }
.loader-text { margin-top: 12px; color: var(--gray-500); font-size: 1rem; }
@keyframes bounce { from { transform: translateY(0); } to { transform: translateY(-10px); } }

/* ============================================================
   Header
   ============================================================ */
#header {
  position: fixed; top: 0; left: 0; right: 0; height: 64px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--gray-200);
  z-index: 1000;
}
.header-inner {
  max-width: 1200px; margin: 0 auto; padding: 0 24px;
  height: 100%; display: flex; align-items: center; justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 8px; text-decoration: none; font-size: 1.1rem; font-weight: 700; color: var(--gray-800); }
.logo-icon { font-size: 1.5rem; }
.logo-highlight { color: var(--primary); }
.desktop-nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.desktop-nav a {
  padding: 6px 12px; border-radius: 20px; text-decoration: none;
  font-size: 0.8rem; color: var(--gray-600); transition: all 0.2s;
  font-weight: 500; white-space: nowrap;
}
.desktop-nav a:hover, .desktop-nav a.active { background: var(--primary-light); color: var(--primary); }
.menu-toggle { display: none; background: none; border: none; font-size: 1.5rem; cursor: pointer; color: var(--gray-600); }

/* ============================================================
   Sidebar (Mobile)
   ============================================================ */
#sidebar-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.3);
  z-index: 2000;
}
#sidebar-overlay.open { display: block; }
#sidebar {
  position: fixed; top: 0; left: -300px; width: 280px; bottom: 0;
  background: white; box-shadow: var(--shadow-lg);
  z-index: 2001; transition: left 0.3s ease;
  overflow-y: auto;
}
#sidebar.open { left: 0; }
.sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px; border-bottom: 1px solid var(--gray-200);
}
.sidebar-title { font-weight: 700; font-size: 1rem; }
.sidebar-close { background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--gray-400); }
.sidebar-list a {
  display: block; padding: 14px 20px; text-decoration: none;
  color: var(--gray-700); border-bottom: 1px solid var(--gray-100);
  transition: background 0.2s; font-size: 0.9rem;
}
.sidebar-list a:hover { background: var(--primary-light); color: var(--primary); }

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

/* ============================================================
   Hero
   ============================================================ */
.hero {
  background: linear-gradient(135deg, #0ea5e9 0%, #06b6d4 50%, #10b981 100%);
  padding: 60px 24px 80px; text-align: center; color: white;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ''; position: absolute; bottom: -2px; left: 0; right: 0;
  height: 40px; background: var(--gray-50);
  border-radius: 50% 50% 0 0;
}
.hero-content { max-width: 700px; margin: 0 auto; position: relative; z-index: 1; }
.hero-title { font-size: 2.5rem; font-weight: 900; margin-bottom: 12px; letter-spacing: -0.02em; }
.hero-subtitle { font-size: 1.1rem; opacity: 0.9; margin-bottom: 8px; }
.hero-desc { font-size: 0.95rem; opacity: 0.8; }

.tag {
  display: inline-block; padding: 3px 12px; border-radius: 20px;
  font-size: 0.8rem; font-weight: 600;
}
.tag-a { background: rgba(255,255,255,0.3); color: white; }
.tag-b { background: rgba(255,255,255,0.2); color: white; border: 1px solid rgba(255,255,255,0.3); }

/* ============================================================
   Cards Grid
   ============================================================ */
.section-title { text-align: center; margin: 40px 0 32px; }
.section-title h2 { font-size: 1.6rem; font-weight: 800; color: var(--gray-800); }
.section-title p { color: var(--gray-500); margin-top: 8px; font-size: 0.95rem; }

.cards-grid { display: grid; gap: 20px; }

.plan-card {
  background: white; border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
  cursor: pointer; transition: all 0.25s ease;
  border: 1px solid var(--gray-100);
  position: relative; overflow: hidden;
}
.plan-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary);
}
.plan-card-header {
  display: flex; align-items: flex-start; gap: 16px; margin-bottom: 12px;
}
.plan-card-emoji { font-size: 2.2rem; flex-shrink: 0; }
.plan-card-title { font-size: 1.15rem; font-weight: 700; line-height: 1.3; }
.plan-card-style { font-size: 0.85rem; color: var(--gray-500); margin-top: 2px; }

.plan-card-meta {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px;
}
.plan-card-meta span {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 4px 10px; background: var(--gray-100); border-radius: 20px;
  font-size: 0.78rem; color: var(--gray-600); font-weight: 500;
}

.plan-card-budgets { display: flex; gap: 8px; flex-wrap: wrap; }
.budget-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 5px 12px; border-radius: 20px; font-size: 0.82rem; font-weight: 600;
}
.budget-badge.a { background: var(--primary-light); color: var(--primary-dark); }
.budget-badge.b { background: var(--green-light); color: var(--green); }

/* ============================================================
   Quick Guide
   ============================================================ */
.quick-guide {
  margin: 48px 0; padding: 36px 24px;
  background: linear-gradient(135deg, #f8fafc, #f0f9ff);
  border-radius: var(--radius);
  border: 1px solid var(--gray-200);
}
.quick-guide h3 { text-align: center; font-size: 1.3rem; margin-bottom: 24px; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.guide-card {
  background: white; border-radius: var(--radius-sm); padding: 16px;
  text-align: center; box-shadow: var(--shadow);
  border: 1px solid var(--gray-100);
}
.guide-icon { font-size: 1.6rem; margin-bottom: 6px; }
.guide-card h4 { font-size: 0.85rem; font-weight: 700; margin-bottom: 4px; }
.guide-card p { font-size: 0.78rem; color: var(--gray-500); }

/* ============================================================
   Detail Page
   ============================================================ */
.back-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 10px 20px; background: white; border: 1px solid var(--gray-200);
  border-radius: 20px; cursor: pointer; font-size: 0.9rem;
  color: var(--gray-600); margin: 24px 0; font-family: var(--font);
  transition: all 0.2s;
}
.back-btn:hover { background: var(--gray-100); border-color: var(--gray-300); }

#plan-content {
  background: white; border-radius: var(--radius);
  padding: 40px; box-shadow: var(--shadow);
  border: 1px solid var(--gray-200);
  margin-bottom: 40px;
}

/* ============================================================
   Markdown Content Styling
   ============================================================ */
#plan-content h1 {
  font-size: 1.8rem; font-weight: 900; margin-bottom: 16px;
  padding-bottom: 12px; border-bottom: 3px solid var(--primary);
  color: var(--gray-900);
}
#plan-content h2 {
  font-size: 1.35rem; font-weight: 700; margin: 28px 0 14px;
  padding-left: 14px; border-left: 4px solid var(--primary);
  color: var(--gray-800);
}
#plan-content h3 {
  font-size: 1.1rem; font-weight: 700; margin: 24px 0 10px;
  color: var(--gray-700);
}
#plan-content h4 {
  font-size: 1rem; font-weight: 600; margin: 18px 0 8px;
  color: var(--gray-600);
}
#plan-content p { margin-bottom: 12px; color: var(--gray-600); line-height: 1.8; }
#plan-content strong { color: var(--gray-800); font-weight: 700; }

/* Blockquote (summary) */
#plan-content blockquote {
  background: linear-gradient(135deg, #f0f9ff, #f8fafc);
  border-left: 4px solid var(--primary);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 16px 20px; margin: 16px 0 24px;
  color: var(--gray-600); font-size: 0.92rem;
}
#plan-content blockquote p { margin-bottom: 4px; }

/* Lists */
#plan-content ul, #plan-content ol { padding-left: 24px; margin-bottom: 16px; }
#plan-content li { margin-bottom: 6px; color: var(--gray-600); line-height: 1.7; }
#plan-content li strong { color: var(--gray-700); }

/* Code blocks */
#plan-content pre {
  background: var(--gray-800); color: #e2e8f0;
  border-radius: var(--radius-sm); padding: 16px 20px;
  overflow-x: auto; margin: 16px 0;
  font-size: 0.85rem; line-height: 1.6;
}
#plan-content code {
  background: var(--gray-100); padding: 2px 6px;
  border-radius: 4px; font-size: 0.85em; color: var(--red);
}
#plan-content pre code { background: none; padding: 0; color: inherit; }

/* Tables */
#plan-content table {
  width: 100%; border-collapse: collapse; margin: 16px 0 24px;
  font-size: 0.88rem; border-radius: var(--radius-sm);
  overflow: hidden; box-shadow: var(--shadow);
}
#plan-content th {
  background: var(--gray-800); color: white; padding: 12px 14px;
  text-align: left; font-weight: 600; white-space: nowrap;
}
#plan-content td {
  padding: 10px 14px; border-bottom: 1px solid var(--gray-100);
  color: var(--gray-600);
}
#plan-content tr:nth-child(even) td { background: var(--gray-50); }
#plan-content tr:last-child td { border-bottom: none; }
#plan-content tr:hover td { background: var(--primary-light); }

/* Horizontal rules */
#plan-content hr {
  border: none; height: 2px; background: linear-gradient(to right, var(--primary-light), var(--primary), var(--primary-light));
  margin: 32px 0;
}

/* Links in content */
#plan-content a { color: var(--primary); text-decoration: none; font-weight: 500; }
#plan-content a:hover { text-decoration: underline; }

/* Inline highlight (路线A/路线B) */
#plan-content p:has(> strong:contains("路线A")),
#plan-content p:has(> strong:contains("买票路线")) {
  border-left: 3px solid var(--primary);
  padding-left: 12px;
}
#plan-content p:has(> strong:contains("路线B")),
#plan-content p:has(> strong:contains("穷游路线")) {
  border-left: 3px solid var(--green);
  padding-left: 12px;
}

/* Route section highlighting */
#plan-content .route-a-highlight {
  background: var(--primary-light);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  color: var(--primary-dark);
  font-weight: 700;
}
#plan-content .route-b-highlight {
  background: var(--green-light);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  color: var(--green);
  font-weight: 700;
}

/* ============================================================
   Footer
   ============================================================ */
#footer {
  background: var(--gray-800); color: var(--gray-400);
  text-align: center; padding: 24px; font-size: 0.85rem;
}

/* ============================================================
   Responsive
   ============================================================ */
@media (min-width: 768px) {
  .cards-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 767px) {
  .desktop-nav { display: none; }
  .menu-toggle { display: block; }
  .hero-title { font-size: 1.6rem; }
  .hero { padding: 40px 20px 60px; }
  #plan-content { padding: 20px; }
  #plan-content h1 { font-size: 1.4rem; }
  #plan-content h2 { font-size: 1.15rem; }
  #plan-content table { font-size: 0.78rem; }
  #plan-content th, #plan-content td { padding: 8px 10px; }
  .guide-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
  .cards-grid { grid-template-columns: 1fr; }
  .guide-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-title { font-size: 1.3rem; }
}
