/* 手绘笔记本风基础调性 */
:root {
  --paper: #f5f0e1;
  --paper-dark: #ebe3cc;
  --paper-line: #d4c9a8;
  --ink: #2a2a28;
  --ink-soft: #4a4a45;
  --ink-faint: #8a8578;
  --pencil: #3a3a38;
  --red-pen: #a83a3a;
  --blue-pen: #2d5a8a;
  --green-pen: #2e7d5b;
  --yellow-high: #f6d86b;
  --orange-pen: #c08835;
  --accent-soft: rgba(46, 125, 91, 0.12);
  --accent-warn: rgba(168, 58, 58, 0.10);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: 'Kalam', 'Caveat', 'Xiaolai', 'HanziPen SC', 'LXGW WenKai', 'Ma Shan Zheng', cursive, sans-serif;
  background: var(--paper);
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

/* 纸纹理（横线+微噪点） */
.paper-bg {
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0 27px,
      rgba(212, 201, 168, 0.35) 27px 28px
    ),
    radial-gradient(circle at 20% 30%, rgba(0,0,0,0.015) 0, transparent 40%),
    radial-gradient(circle at 70% 80%, rgba(0,0,0,0.02) 0, transparent 35%);
}

.paper-bg-plain {
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(0,0,0,0.015) 0, transparent 40%),
    radial-gradient(circle at 70% 80%, rgba(0,0,0,0.02) 0, transparent 35%);
}

/* 字体层级 */
.title-hand {
  font-family: 'Caveat', 'Ma Shan Zheng', 'Kalam', cursive;
  font-weight: 700;
  letter-spacing: 0.5px;
}
.mono-hand {
  font-family: 'Special Elite', 'Courier New', monospace;
  letter-spacing: 0;
}

/* 铅笔边框 */
.pencil-border {
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  position: relative;
}
.pencil-border-soft {
  border: 1px dashed var(--ink-soft);
  border-radius: 3px;
}

/* 手绘便签 (sticky note) */
.sticky {
  background: #fffbe8;
  padding: 14px 16px;
  border-radius: 2px;
  box-shadow:
    1px 1px 0 rgba(0,0,0,0.08),
    2px 2px 8px rgba(0,0,0,0.10);
  border: 1px solid rgba(0,0,0,0.06);
  position: relative;
}
.sticky.yellow { background: #fff3b5; }
.sticky.green  { background: #d8ecd4; }
.sticky.red    { background: #f5c9c2; }
.sticky.blue   { background: #d0dff0; }
.sticky.tan    { background: #f0e4c8; }

/* 图钉 */
.pin-dot {
  position: absolute;
  width: 14px; height: 14px;
  background: radial-gradient(circle at 30% 30%, #ff6a5a, #a83a3a);
  border-radius: 50%;
  border: 1.5px solid #6a1f1f;
  box-shadow: 0 2px 3px rgba(0,0,0,0.3);
  z-index: 5;
}

/* 徽章 (tier badge) */
.badge {
  display: inline-block;
  padding: 2px 8px;
  font-size: 13px;
  border: 1.5px solid var(--ink);
  border-radius: 10px;
  background: var(--paper);
}
.badge.top { background: #d8ecd4; border-color: var(--green-pen); color: var(--green-pen); }
.badge.good { background: #f5e5c8; border-color: var(--orange-pen); color: var(--orange-pen); }
.badge.avoid { background: #f5c9c2; border-color: var(--red-pen); color: var(--red-pen); }

/* 高光笔 */
.highlight {
  background: linear-gradient(to bottom, transparent 55%, var(--yellow-high) 55%, var(--yellow-high) 92%, transparent 92%);
  padding: 0 2px;
}
.highlight-green {
  background: linear-gradient(to bottom, transparent 55%, #b8dbae 55%, #b8dbae 92%, transparent 92%);
  padding: 0 2px;
}
.highlight-red {
  background: linear-gradient(to bottom, transparent 55%, #f5c9c2 55%, #f5c9c2 92%, transparent 92%);
  padding: 0 2px;
}

/* 划掉 */
.strike-hand {
  text-decoration: line-through;
  text-decoration-thickness: 2px;
  text-decoration-color: var(--red-pen);
  color: var(--ink-soft);
}

/* 按钮 */
.btn-hand {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 20px;
  font-family: inherit;
  font-size: 14px;
  color: var(--ink);
  cursor: pointer;
  transition: all 0.15s;
  font-weight: 600;
}
.btn-hand:hover {
  background: var(--ink);
  color: var(--paper);
}
.btn-hand.active {
  background: var(--ink);
  color: var(--paper);
}
.btn-hand.sm { padding: 3px 9px; font-size: 12px; }

/* 星标 */
.star-row { display: inline-flex; gap: 3px; }
.star { cursor: pointer; color: var(--ink-faint); font-size: 18px; line-height: 1; user-select: none; }
.star.on { color: var(--orange-pen); }

/* 链接样式（手绘下划线） */
.hand-link {
  color: var(--blue-pen);
  text-decoration: none;
  border-bottom: 1.5px dotted var(--blue-pen);
  padding-bottom: 1px;
}

/* 标签 */
.tag-chip {
  display: inline-block;
  padding: 1px 7px;
  margin: 2px 3px 2px 0;
  font-size: 12px;
  background: var(--paper-dark);
  border: 1px solid var(--ink-soft);
  border-radius: 10px;
  color: var(--ink-soft);
}

/* 顶部导航 */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
  position: sticky;
  top: 0;
  z-index: 50;
}
.topbar-title {
  font-size: 28px;
  font-weight: 700;
  font-family: 'Caveat', 'Ma Shan Zheng', cursive;
}
.topbar-tabs { display: flex; gap: 8px; }

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--paper); }
::-webkit-scrollbar-thumb { background: var(--ink-faint); border-radius: 5px; }

/* 卡片阴影（像贴在纸上） */
.paper-card {
  background: var(--paper);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  padding: 14px 16px;
  box-shadow: 2px 3px 0 var(--ink);
}

/* 透明蒙层 */
.muted { color: var(--ink-faint); }
.soft { color: var(--ink-soft); }

/* 让 hr 像铅笔划的 */
.hr-hand {
  border: none;
  border-top: 1.5px solid var(--ink);
  margin: 12px 0;
  opacity: 0.5;
}

/* responsive helpers */
@media (max-width: 900px) {
  .hide-mobile { display: none !important; }
}
@media (min-width: 901px) {
  .only-mobile { display: none !important; }
}

/* ============================================ */
/* 手机端适配 (<= 760px) */
/* ============================================ */
@media (max-width: 760px) {

  html, body { font-size: 15px; }

  /* Topbar: 紧凑化 */
  .topbar {
    padding: 10px 12px !important;
    gap: 6px !important;
  }
  .topbar-title {
    font-size: 20px !important;
    line-height: 1.1;
  }
  .topbar-tabs {
    order: 2;
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .topbar .btn-hand.sm {
    font-size: 11px;
    padding: 3px 7px;
  }

  /* ViewNotebook: 地图在上，列表在下；高度撑满但允许 scroll */
  .view-notebook-root {
    display: block !important;
    height: auto !important;
    min-height: calc(100vh - 80px) !important;
    padding: 10px !important;
    overflow: visible !important;
  }
  .view-notebook-map {
    height: 55vh !important;
    min-height: 320px;
    margin-bottom: 10px;
  }
  .view-notebook-side {
    overflow: visible !important;
    padding-right: 0 !important;
  }

  /* 地图图例缩一圈，位置不遮挡 */
  .view-notebook-map .map-legend {
    font-size: 10px !important;
    padding: 6px 8px !important;
    left: 8px !important;
    bottom: 8px !important;
  }
  .view-notebook-map .map-legend .title-hand {
    font-size: 12px !important;
  }

  /* ViewCompare: 表格横向滚动 + 右栏下移 */
  .view-compare-root {
    padding: 10px !important;
  }
  .view-compare-grid {
    display: block !important;
  }
  .view-compare-grid > div:last-child {
    position: static !important;
    margin-top: 16px;
  }
  .view-compare-root table {
    min-width: 640px;   /* 横向滚动 */
  }

  /* ViewVote: 改为单列堆叠 */
  .view-vote-root {
    padding: 10px !important;
  }
  .view-vote-card-grid {
    display: block !important;
  }
  .view-vote-rank {
    display: inline-block !important;
    margin-right: 8px;
    vertical-align: middle;
    font-size: 24px !important;
    text-align: left !important;
  }
  .view-vote-stars {
    text-align: left !important;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .view-vote-avg {
    text-align: left !important;
    margin-top: 8px;
    display: flex;
    align-items: baseline;
    gap: 10px;
  }
  .view-vote-avg .big {
    font-size: 24px !important;
  }

  /* RegionDetail 里的 2 列 label/value grid 改成单列 */
  .region-detail-grid {
    grid-template-columns: 1fr !important;
    row-gap: 2px !important;
  }
  .region-detail-grid > .label-cell {
    font-size: 11px;
    color: var(--ink-faint);
    margin-top: 8px;
  }
  .region-detail-grid > .label-cell:first-child {
    margin-top: 0;
  }

  /* pros/cons 从 2 列改为单列，避免挤 */
  .region-detail-proscons {
    grid-template-columns: 1fr !important;
    gap: 6px !important;
  }

  /* Tweak 面板收窄到屏幕宽度 */
  .tweak-panel {
    width: calc(100vw - 24px) !important;
    right: 12px !important;
    bottom: 12px !important;
    max-height: 70vh;
    overflow-y: auto;
  }

  /* 便签略微收紧 */
  .sticky { padding: 10px 12px; }

  /* Plan / Tips 页面的通用 padding 调小 */
  .paper-bg[style*="padding: 20px"] {
    padding: 12px !important;
  }

  /* Plan 顶层 grid 2 列 → 1 列 */
  .plan-grid {
    grid-template-columns: 1fr !important;
  }

  /* 行程模板的 label 列收窄 */
  .schedule-grid {
    grid-template-columns: 90px 1fr !important;
  }
}

/* 更小的屏（iPhone SE 等, <= 380px）继续收紧 */
@media (max-width: 380px) {
  .topbar-title { font-size: 17px !important; }
  html, body { font-size: 14px; }
  .sticky { padding: 9px 10px; }
}

/* 投票弹窗背景 */
.scrim {
  position: fixed;
  inset: 0;
  background: rgba(30,30,28,0.5);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* 地图样式覆盖 — leaflet 复古手绘 */
.leaflet-container {
  background: var(--paper) !important;
  font-family: inherit !important;
}
.leaflet-tile {
  filter: sepia(0.35) saturate(0.7) contrast(0.95) brightness(1.03);
}
.leaflet-control-zoom a {
  background: var(--paper) !important;
  color: var(--ink) !important;
  border: 1.5px solid var(--ink) !important;
}
.leaflet-popup-content-wrapper {
  background: #fffbe8 !important;
  border-radius: 3px !important;
  box-shadow: 2px 3px 6px rgba(0,0,0,0.25) !important;
  font-family: inherit !important;
}
.leaflet-popup-tip { background: #fffbe8 !important; }
