:root {
  --bg: var(--paper);
  --card-bg: var(--paper-card);
  --text: var(--ink);
  --text-light: var(--ink-2);
  --accent: var(--sun-700);
  --accent-light: var(--sun-100);
  --gold: var(--sprout-300);
  --green: var(--seed-500);
  --blue: var(--chalk-500);
  --border: var(--line);
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-hover: 0 6px 24px rgba(0,0,0,0.10);
  --radius: 12px;
  --max-width: 1200px;
  --font-title: 'STSong', 'SimSun', 'Noto Serif SC', 'Source Han Serif SC', serif;
  --font-body: 'PingFang SC', 'Microsoft YaHei', 'Noto Sans SC', sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
}

/* ---- Hero ---- */
.tv-hero {
  background: linear-gradient(135deg, var(--seed-900) 0%, var(--seed-800) 30%, var(--seed-900) 100%);
  color: #fff;
  padding: 60px 20px 50px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.tv-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-inner { position: relative; z-index: 1; max-width: 700px; margin: 0 auto; }
.tv-hero h1 {
  font-family: var(--font-title);
  font-size: 2.8em;
  font-weight: 700;
  letter-spacing: 4px;
  margin-bottom: 10px;
}
.tv-hero .subtitle {
  font-size: 1.15em;
  color: var(--sprout-300);
  letter-spacing: 2px;
}
.tv-hero .description {
  margin-top: 16px;
  font-size: 0.95em;
  color: var(--sprout-300);
  line-height: 1.8;
}
.tv-hero .stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 28px;
}
.stat-item { text-align: center; }
.stat-num { font-size: 2em; font-weight: 700; font-family: var(--font-title); color: var(--gold); }
.stat-label { font-size: 0.85em; color: var(--ink-3); margin-top: 4px; }

/* ---- Search & Controls ---- */
.controls-bar {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: center;
}
.search-box {
  flex: 1;
  min-width: 260px;
  max-width: 480px;
  position: relative;
}
.search-box input {
  width: 100%;
  padding: 12px 44px 12px 18px;
  border: 2px solid var(--border);
  border-radius: 30px;
  font-size: 0.95em;
  background: var(--paper-card);
  color: var(--text);
  transition: border-color 0.2s;
  font-family: var(--font-body);
}
.search-box input:focus {
  outline: none;
  border-color: var(--accent);
}
.search-icon {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  pointer-events: none;
  font-size: 1.1em;
}
.tv-btn {
  padding: 10px 22px;
  border: 2px solid var(--border);
  border-radius: 30px;
  background: var(--paper-card);
  cursor: pointer;
  font-size: 0.9em;
  color: var(--text);
  transition: all 0.2s;
  font-family: var(--font-body);
  white-space: nowrap;
}
.tv-btn:hover { border-color: var(--accent); color: var(--accent); }
.tv-btn.active {
  background: var(--accent);
  color: var(--ink-invert);
  border-color: var(--accent);
}

/* ---- Region Tabs ---- */
.tabs-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}
.tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.tab {
  padding: 10px 22px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 0.95em;
  color: var(--text-light);
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: all 0.2s;
  font-family: var(--font-body);
  white-space: nowrap;
}
.tab:hover { color: var(--accent); }
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
}

/* ---- Content Area ---- */
.content {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 30px 20px 60px;
}
.region-section { display: none; }
.region-section.active { display: block; }

.region-header {
  text-align: center;
  margin-bottom: 32px;
}
.region-header h2 {
  font-family: var(--font-title);
  font-size: 2em;
  color: var(--accent);
  letter-spacing: 2px;
}
.region-header .region-sub {
  font-size: 0.95em;
  color: var(--text-light);
  margin-top: 6px;
}

/* ---- Location Cards ---- */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
}
.tv-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.3s, transform 0.2s;
  cursor: pointer;
  border: 1px solid var(--border);
}
.tv-card:hover { box-shadow: var(--shadow-hover); transform: translateY(-2px); }
.card-header {
  padding: 20px 22px 14px;
  position: relative;
}
.card-header .province-tag {
  display: inline-block;
  font-size: 0.75em;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 8px;
}
.card-header h3 {
  font-family: var(--font-title);
  font-size: 1.3em;
  color: var(--text);
  margin-bottom: 4px;
}
.card-header .grade-badge {
  font-size: 0.8em;
  color: var(--green);
  font-weight: 500;
}
.card-excerpt {
  padding: 0 22px 16px;
  font-size: 0.88em;
  color: var(--text-light);
  font-style: italic;
  border-left: 3px solid var(--accent-light);
  margin: 0 22px 0 18px;
  padding-left: 14px;
  line-height: 1.6;
}
.card-detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s ease, padding 0.4s ease;
  background: var(--paper);
  border-top: 1px solid var(--border);
}
.tv-card.expanded .card-detail {
  max-height: 2000px;
  padding: 20px 22px;
}
.detail-section {
  margin-bottom: 14px;
}
.detail-section:last-child { margin-bottom: 0; }
.detail-section h4 {
  font-size: 0.85em;
  color: var(--accent);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.detail-section h4 .icon { font-size: 1.1em; }

.quest-section { background: var(--paper); border: 1px solid var(--soil-300); border-radius: 8px; }
.quest-section pre { 
  white-space: pre-wrap; 
  font-family: var(--font-body); 
  font-size: 0.88em; 
  line-height: 1.7; 
  background: transparent; 
  padding: 0; 
  margin: 4px 0 0; 
  color: var(--ink-2); 
}
.detail-section p {
  font-size: 0.88em;
  color: var(--text);
  line-height: 1.7;
}
.card-footer {
  padding: 10px 22px 16px;
  text-align: center;
  color: var(--text-light);
  font-size: 0.8em;
}
.card-footer::after {
  content: '▾ 点击展开详情';
}
.tv-card.expanded .card-footer::after {
  content: '▴ 收起';
}

/* ---- No Results ---- */
.no-results {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  font-size: 1.1em;
  display: none;
}
.no-results.show { display: block; }

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: 30px 20px 40px;
  color: var(--text-light);
  font-size: 0.85em;
  border-top: 1px solid var(--border);
  max-width: var(--max-width);
  margin: 0 auto;
}

/* ---- Print Styles ---- */
@media print {
  .tv-hero, .controls-bar, .tabs-container, .footer, .card-footer { display: none !important; }
  body { background: var(--paper-card); font-size: 12px; }
  .content { padding: 0; max-width: 100%; }
  .region-section { display: block !important; break-inside: avoid; }
  .cards-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .tv-card { break-inside: avoid; box-shadow: none; border: 1px solid var(--line); }
  .card-detail { max-height: none !important; padding: 10px 12px !important; display: block !important; }
  .tv-card:hover { transform: none; }
  .region-header { margin-bottom: 12px; }
  .region-header h2 { font-size: 1.4em; }
}

@media (max-width: 600px) {
  .tv-hero h1 { font-size: 2em; letter-spacing: 2px; }
  .tv-hero .stats { gap: 24px; }
  .cards-grid { grid-template-columns: 1fr; }
  .controls-bar { flex-direction: column; }
  .search-box { max-width: 100%; }
}

/* ---- Map ---- */
.map-toggle-btn {
  position: relative;
}
.map-toggle-btn.active-map {
  background: var(--accent);
  color: var(--ink-invert);
  border-color: var(--accent);
}
/* ========== 静态地图 ========== */
#mapContainer {
  display: none;
  width: 100%;
  max-width: var(--max-width);
  margin: 20px auto 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  position: relative;
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-sunk) 100%);
}
#mapContainer.show {
  display: block;
}
.static-map-wrap {
  position: relative;
  width: 100%;
  padding-bottom: 56%;
  overflow: hidden;
}
.static-map-wrap svg { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
.static-map-wrap svg path.province {
  fill: var(--paper-sunk);
  stroke: var(--line);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill 0.2s;
}
.static-map-wrap svg path.province:hover {
  fill: var(--soil-100);
}
.static-map-wrap svg path.province.highlight {
  fill: var(--soil-300);
  stroke: var(--soil-700);
  stroke-width: 1.2;
}
.map-point {
  cursor: pointer;
  transition: r 0.15s, stroke-width 0.15s;
  filter: drop-shadow(0 1px 3px rgba(0,0,0,0.35));
}
.map-point:hover {
  r: 9;
  stroke-width: 3;
}
.map-point.active {
  r: 9;
  stroke-width: 3;
}
.map-detail {
  display: none;
  position: absolute;
  background: rgba(255,255,255,0.97);
  padding: 14px 18px;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.18);
  z-index: 20;
  min-width: 220px;
  max-width: 280px;
  pointer-events: auto;
}
.map-detail.show {
  display: block;
}
.map-detail h4 {
  font-family: var(--font-title);
  color: var(--accent);
  margin: 0 0 4px;
  font-size: 1.05em;
}
.map-detail .md-province {
  font-size: 0.78em;
  color: var(--text-light);
  margin-bottom: 4px;
}
.map-detail .md-texts {
  font-size: 0.82em;
  color: var(--gold);
  margin-bottom: 2px;
}
.map-detail .md-excerpt {
  font-size: 0.78em;
  color: var(--text);
  line-height: 1.45;
  margin: 4px 0;
  font-style: italic;
  border-left: 2px solid var(--accent-light);
  padding-left: 8px;
}
.map-detail .md-grades {
  margin-top: 4px;
}
.map-detail .md-grades span {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  padding: 1px 7px;
  border-radius: 9px;
  font-size: 0.75em;
  margin-right: 3px;
  margin-bottom: 2px;
}
.map-detail .md-link {
  display: inline-block;
  margin-top: 6px;
  padding: 3px 12px;
  background: var(--accent);
  color: var(--ink-invert);
  border-radius: 12px;
  font-size: 0.78em;
  cursor: pointer;
  text-decoration: none;
}
.map-detail .md-link:hover { opacity: 0.85; }
.map-detail .md-close {
  position: absolute;
  top: 6px; right: 10px;
  cursor: pointer;
  font-size: 1.1em;
  color: var(--text-light);
  line-height: 1;
}
.map-legend {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 5;
  background: rgba(255,255,255,0.92);
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.75em;
  color: var(--text-light);
  box-shadow: var(--shadow);
  display: flex;
  gap: 16px;
  pointer-events: none;
}
.map-legend .dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  margin-right: 4px;
  background: var(--accent);
}

@media (max-width: 768px) {
  .static-map-wrap { padding-bottom: 70%; }
}

/* ---- 站点接入补充（由脚本追加） ---- */
.travel-shell { padding: 0 0 8px; }
.static-map-wrap svg rect { fill: var(--paper-sunk); }
.map-loading { padding: 40px; text-align: center; color: var(--ink-3); font-size: 14px; }

/* --- 修复：站点基础样式 h1{color:var(--ink)} 会压过 hero 继承的白字 --- */
.tv-hero h1 { color: #fff; }

/* --- 全屏详情面板（点击地点打开，替代原来的向下展开） --- */
.tv-modal {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(22, 54, 36, .55);
  padding: 32px 16px; overflow-y: auto;
  display: none;
}
.tv-modal.show { display: block; }
.tv-modal__panel {
  position: relative;
  max-width: 860px; margin: 0 auto;
  background: var(--paper-card);
  border: 1px solid var(--line);
  border-radius: var(--r-card, 16px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .22);
  padding: 32px 34px 36px;
}
.tv-modal__close {
  position: absolute; top: 14px; right: 14px;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--paper);
  color: var(--ink-2); font-size: 15px; line-height: 1; cursor: pointer;
}
.tv-modal__close:hover { color: var(--ink); border-color: var(--seed-300); }
.tv-modal__head { border-bottom: 1px solid var(--line); padding-bottom: 14px; margin-bottom: 20px; }
.tv-modal__head h2 { margin: 0 0 6px; font-size: 26px; color: var(--ink); padding-right: 40px; }
.tv-modal__meta { font-size: 13px; color: var(--ink-3); }
.tv-modal__body .detail-section { margin-bottom: 22px; }
.tv-modal__print { display: none; }
body.modal-open { overflow: hidden; }

@media (max-width: 768px) {
  .tv-modal { padding: 0; background: var(--paper); }
  .tv-modal__panel { max-width: none; min-height: 100vh; border: 0; border-radius: 0; padding: 22px 18px 40px; box-shadow: none; }
  .tv-modal__close { position: sticky; top: 0; margin-left: auto; }
  .tv-modal__head h2 { font-size: 21px; }
}

@media print {
  .app-bar, .app-foot, .controls-bar, .tabs-container, #mapContainer, .tv-modal__close { display: none !important; }
  .tv-card { break-inside: avoid; page-break-inside: avoid; }
  body.modal-open .travel-shell { display: none !important; }
  .tv-modal { position: static; padding: 0; background: none; }
  .tv-modal__panel { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .tv-modal__print { display: block; margin-top: 20px; padding-top: 8px; border-top: 1px solid #ccc; font-size: 9pt; color: #555; }
}
