/* 京津冀旅游年卡 · 移动端优先样式（手机 / Pad） */

:root {
  --brand: #ffd100;
  --brand-deep: #ffce00;
  --ink: #22252a;
  --ink-2: #4c5157;
  --muted: #91959b;
  --line: #f0f1f3;
  --bg: #f5f6f8;
  --card: #ffffff;
  --red: #ff5339;
  --red-bg: #fff0ed;
  --green: #00b578;
  --amber: #ff8a00;
  --amber-bg: #fff6e8;
  --blue: #3d7eff;
  --blue-bg: #eef4ff;
  --radius: 12px;
  --shadow: 0 1px 3px rgba(20, 24, 31, .06), 0 6px 16px rgba(20, 24, 31, .04);
  --tap: 44px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* hidden 属性必须能覆盖组件的 display 设置 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue",
    "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.5;
  overscroll-behavior-y: none;
}

button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; }
img { display: block; max-width: 100%; }

/* ============ 顶部栏 ============ */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: var(--brand);
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 12px 10px;
  box-shadow: 0 2px 10px rgba(20, 24, 31, .08);
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }

.brand-badge {
  flex: none;
  background: var(--ink);
  color: var(--brand);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  padding: 5px 7px;
  border-radius: 7px;
}

.brand-text h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
  font-weight: 800;
  letter-spacing: .3px;
}

.brand-text p {
  margin: 1px 0 0;
  font-size: 12px;
  color: rgba(0, 0, 0, .62);
}

.map-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 36px;
  padding: 0 14px;
  border-radius: 18px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.map-btn:active { transform: scale(.97); }
.map-btn[aria-pressed="true"] { background: #fff; color: var(--ink); }

/* 搜索行 */
.search-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

.search-box {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  height: 40px;
  background: #fff;
  border-radius: 20px;
  padding: 0 34px 0 34px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .04);
}

.search-icon {
  position: absolute;
  left: 11px;
  color: var(--muted);
}

.search-box input {
  width: 100%;
  height: 100%;
  border: 0;
  outline: none;
  background: none;
  font-size: 15px;
  color: var(--ink);
}

.search-box input::placeholder { color: #a8acb2; }
.search-box input::-webkit-search-cancel-button { display: none; }

.clear-btn {
  position: absolute;
  right: 6px;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: #b6bac0;
}

.locate-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 40px;
  padding: 0 12px;
  border-radius: 20px;
  background: rgba(255, 255, 255, .75);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
}

.locate-btn.is-on { background: var(--ink); color: #fff; }
.locate-btn.is-on svg { color: var(--brand); }

/* 筛选行 */
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 9px;
}

.filter-row--end { margin-top: 7px; }

.filter-label {
  flex: none;
  font-size: 12px;
  font-weight: 700;
  color: rgba(0, 0, 0, .55);
}

.chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 1px;
}

.chips::-webkit-scrollbar { display: none; }

.chip {
  flex: none;
  height: 32px;
  padding: 0 13px;
  border-radius: 16px;
  background: rgba(255, 255, 255, .72);
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
  transition: background .15s, color .15s;
}

.chip.is-active {
  background: var(--ink);
  color: #fff;
}

.chip.is-disabled {
  opacity: .55;
}

.count {
  margin-left: auto;
  font-size: 12px;
  color: rgba(0, 0, 0, .55);
  white-space: nowrap;
}

.reset-btn {
  font-size: 12px;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 4px 2px;
  white-space: nowrap;
}

/* ============ 列表 ============ */
main { padding: 10px 10px calc(env(safe-area-inset-bottom, 0px) + 24px); }

.list {
  display: grid;
  /* minmax(0,1fr)：避免 nowrap 标题按 min-content 撑破单列布局 */
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
  max-width: 1180px;
  margin: 0 auto;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
  background: var(--card);
  border-radius: var(--radius);
  padding: 11px 11px 0;
  box-shadow: var(--shadow);
  transition: transform .12s ease;
}

.card:active { transform: scale(.985); }

/* 时间轴通到卡片底边，充当卡片的“底部边框” */
.card > .timeline {
  margin: 0 -11px;
  border-radius: 0 0 var(--radius) var(--radius);
}
.card:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

/* 图 + 文字行（时间轴条在下方整行） */
.card-main {
  display: flex;
  gap: 11px;
  min-width: 0;
}

.thumb {
  position: relative;
  flex: none;
  width: 104px;
  height: 104px;
  border-radius: 10px;
  overflow: hidden;
  background: #eceef1 center/cover no-repeat;
  display: grid;
  place-items: center;
  color: #c3c7cd;
}

.thumb::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 55%, rgba(0, 0, 0, .18));
  pointer-events: none;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: relative;
  z-index: 1;
}

.thumb img.is-error { display: none; }

.thumb .thumb-ph { position: absolute; z-index: 0; }

.thumb .dist-badge {
  position: absolute;
  z-index: 2;
  left: 5px;
  bottom: 5px;
  background: rgba(0, 0, 0, .62);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 8px;
}

.card-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }

.card-name-row { display: flex; align-items: center; gap: 6px; min-width: 0; }

.card-name {
  margin: 0;
  min-width: 0;
  font-size: 16.5px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  padding: 1.5px 6px;
  border-radius: 5px;
  line-height: 1.45;
}

.tag--grade { background: var(--line); color: #7b8087; }
.tag--reserve { background: var(--red-bg); color: var(--red); }
.tag--free { background: var(--blue-bg); color: var(--blue); }
.tag--times { background: var(--amber-bg); color: var(--amber); }

.card-tags { display: flex; flex-wrap: wrap; gap: 5px; min-height: 18px; }

.card-price-row { display: flex; align-items: baseline; gap: 5px; }

.price {
  color: var(--red);
  font-weight: 800;
  font-size: 17px;
  letter-spacing: .2px;
}

.price .yen { font-size: 12px; margin-right: 1px; }
.price.is-na { color: var(--muted); font-size: 14px; font-weight: 600; }
.price-note { font-size: 12px; color: var(--muted); }

.card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--ink-2);
  flex-wrap: wrap;
}

.card-meta .dot { color: #d5d8dd; }
.card-meta .area { color: var(--muted); }

.status { display: inline-flex; align-items: center; gap: 4px; font-weight: 600; }
.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}
.status--in { color: var(--green); }
.status--out { color: var(--muted); }
.status--na { color: var(--muted); }

/* ---------------- 可用日期时间轴（未来 365 天） ---------------- */
.timeline {
  position: relative;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  background: #e3e5e8;
  flex: none;
}

.timeline-bar { position: absolute; inset: 0; }

/* 当前日期：1px 白线 */
.timeline-now {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 1px;
  background: #fff;
  z-index: 1;
}

.timeline--detail { height: 10px; border-radius: 5px; margin-bottom: 10px; }

.tl-tip {
  position: fixed;
  z-index: 95;
  transform: translate(-50%, -100%);
  background: rgba(0, 0, 0, .82);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 12px;
  pointer-events: none;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tl-tip::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -4px;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: rgba(0, 0, 0, .82);
  border-bottom-width: 0;
}

/* ---------------- 出行日筛选 ---------------- */
.date-input {
  height: 32px;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, .92);
  padding: 0 8px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}

.date-input::-webkit-calendar-picker-indicator { opacity: .55; cursor: pointer; }
.date-input.is-set { background: var(--ink); color: #fff; }
.date-input.is-set::-webkit-calendar-picker-indicator { filter: invert(1); opacity: .8; }

.date-clear {
  flex: none;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .8);
  color: var(--ink-2);
}

.date-hint {
  font-size: 11.5px;
  color: rgba(0, 0, 0, .5);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status--no { color: var(--red); }

/* 空状态 */
.empty {
  max-width: 420px;
  margin: 48px auto;
  text-align: center;
  color: var(--muted);
}

.empty-icon { opacity: .5; margin-bottom: 8px; }
.empty p { margin: 0 0 14px; font-size: 14px; }

.ghost-btn {
  height: 36px;
  padding: 0 18px;
  border-radius: 18px;
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

/* ============ 详情抽屉 ============ */
/* z-index 必须高于 .map-overlay(60)，否则地图模式下打开详情会被地图盖住 */
.sheet-mask {
  position: fixed;
  inset: 0;
  background: rgba(10, 12, 16, .45);
  z-index: 70;
  animation: fade .2s ease;
}

.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 71;
  background: #fff;
  border-radius: 16px 16px 0 0;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  animation: slide-up .26s cubic-bezier(.22, .8, .3, 1);
  box-shadow: 0 -8px 30px rgba(0, 0, 0, .18);
}

.sheet-close {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .9);
  color: var(--ink);
  box-shadow: 0 1px 6px rgba(0, 0, 0, .2);
}

.sheet-body {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 16px);
}

.hero {
  position: relative;
  height: 200px;
  background: #eceef1;
  display: grid;
  place-items: center;
  color: #c3c7cd;
  overflow: hidden;
}

.hero img { width: 100%; height: 100%; object-fit: cover; }
.hero img.is-error { display: none; }
.hero .hero-ph { position: absolute; }

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, .25), rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, .45));
}

.hero-dist {
  position: absolute;
  z-index: 1;
  right: 12px;
  bottom: 10px;
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .5);
}

.detail { padding: 14px 16px 6px; }

.detail h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  line-height: 1.3;
  padding-right: 76px;
}

.detail-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.detail-tags .tag { font-size: 12px; padding: 3px 8px; }

.addr-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 11px;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.45;
}

.addr-row svg { flex: none; margin-top: 2px; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 13px;
}

.grid-item {
  background: #fafbfc;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
}

.grid-item .k { font-size: 12px; color: var(--muted); }
.grid-item .v { font-size: 15.5px; font-weight: 700; margin-top: 2px; word-break: break-all; }
.grid-item .v.red { color: var(--red); }
.grid-item .v.small { font-size: 13.5px; }

.section { margin-top: 16px; }

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 800;
  margin-bottom: 8px;
}

.section-title .hint { font-size: 12px; font-weight: 500; color: var(--muted); }

.periods { display: flex; flex-wrap: wrap; gap: 6px; }

.period {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--blue-bg);
  border-radius: 7px;
  padding: 5px 8px;
  font-variant-numeric: tabular-nums;
}

.period.is-now { background: #e7f9f1; color: var(--green); }

.notes { margin: 0; padding: 0; list-style: none; }

.notes li {
  position: relative;
  padding-left: 13px;
  font-size: 14px;
  color: var(--ink-2);
  line-height: 1.6;
  margin-bottom: 6px;
}

.notes li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 9px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #cfd3d9;
}

.notes.is-empty { color: var(--muted); font-size: 13.5px; font-style: normal; }

.footnote {
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  position: sticky;
  bottom: 0;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0), #fff 30%);
  padding: 12px 0 6px;
}

.btn {
  flex: 1;
  height: 46px;
  border-radius: 23px;
  font-size: 15.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  text-decoration: none;
}

.btn--primary { background: var(--brand); color: var(--ink); }
.btn--primary:active { background: var(--brand-deep); }
.btn--ghost { background: #f2f3f5; color: var(--ink); }
.btn:disabled { opacity: .5; }

/* ============ 地图模式 ============ */
.map-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #e9ecef;
  animation: fade .18s ease;
}

.map-topbar {
  position: absolute;
  z-index: 3;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: none;
}

.map-back {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 38px;
  padding: 0 14px 0 10px;
  border-radius: 19px;
  background: #fff;
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 700;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}

.map-count {
  pointer-events: none;
  background: rgba(0, 0, 0, .6);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 13px;
}

.map-container { position: absolute; inset: 0; }

.fab {
  position: absolute;
  z-index: 3;
  right: 14px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: #fff;
  color: var(--blue);
  display: grid;
  place-items: center;
  box-shadow: 0 3px 14px rgba(0, 0, 0, .22);
}

.map-hint {
  position: absolute;
  z-index: 3;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 78px);
  margin: 0;
  background: rgba(0, 0, 0, .7);
  color: #fff;
  font-size: 12.5px;
  padding: 7px 13px;
  border-radius: 16px;
  white-space: nowrap;
}

.map-error {
  position: absolute;
  z-index: 4;
  left: 16px;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: #fff;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 10px 34px rgba(0, 0, 0, .2);
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink-2);
}

.map-error h3 { margin: 0 0 8px; font-size: 16px; color: var(--ink); }
.map-error code {
  display: block;
  background: #f5f6f8;
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 8px;
  font-size: 12.5px;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.map-error .map-error-close {
  margin-top: 12px;
  height: 38px;
  width: 100%;
  border-radius: 19px;
  background: var(--brand);
  color: var(--ink);
  font-weight: 700;
}

/* 地图上的信息窗 */
.iw { min-width: 178px; max-width: 240px; padding: 2px; }
.iw h4 { margin: 0 0 5px; font-size: 15px; font-weight: 800; line-height: 1.35; }
.iw .iw-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 7px; }
.iw .iw-meta { font-size: 12.5px; color: var(--ink-2); margin-bottom: 9px; }
.iw .iw-btn {
  display: block;
  width: 100%;
  height: 32px;
  border-radius: 16px;
  background: var(--brand);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 700;
}

/* ============ Toast ============ */
.toast {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 74px);
  transform: translateX(-50%);
  background: rgba(0, 0, 0, .8);
  color: #fff;
  font-size: 13.5px;
  padding: 10px 16px;
  border-radius: 20px;
  max-width: 86vw;
  text-align: center;
  animation: fade .2s ease;
}

/* ============ 动画 ============ */
@keyframes slide-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* ============ Pad / 桌面 ============ */
@media (min-width: 768px) {
  body { font-size: 15.5px; }

  /* 头部弹性换行：桌面/Pad 上搜索与筛选尽量排进同一行，压缩纵向高度 */
  .topbar {
    padding: calc(env(safe-area-inset-top, 0px) + 14px) 20px 14px;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    column-gap: 18px;
    row-gap: 10px;
  }
  .topbar-row { flex: 1 0 100%; }

  .brand-badge { font-size: 12px; padding: 6px 9px; }
  .brand-text h1 { font-size: 20px; }

  .search-row { flex: 1 1 320px; max-width: 560px; margin-top: 0; }
  .search-box { height: 44px; max-width: 560px; }
  .locate-btn { height: 44px; }

  .filter-row { margin-top: 0; flex: 0 1 auto; }
  .filter-row--end { flex: 1 1 auto; min-width: 300px; }
  .chip { height: 34px; padding: 0 15px; font-size: 13.5px; }

  main { padding: 16px 20px 40px; }

  .list { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }

  .card { padding: 14px 14px 0; gap: 11px; }
  .card > .timeline { margin: 0 -14px; }
  .card-main { gap: 13px; }
  .thumb { width: 124px; height: 124px; }
  .card-name { font-size: 17.5px; }
  .price { font-size: 18.5px; }

  /* 详情改为居中弹窗 */
  .sheet {
    left: 50%;
    top: 50%;
    right: auto;
    bottom: auto;
    transform: translate(-50%, -50%);
    width: min(600px, calc(100vw - 64px));
    max-height: min(86vh, 860px);
    border-radius: 18px;
    animation: pop .2s ease;
  }

  .sheet-body { padding-bottom: 18px; }
  .hero { height: 240px; }
  .detail { padding: 16px 20px 6px; }
  .grid { grid-template-columns: repeat(4, 1fr); }

  .map-topbar { top: 16px; left: 20px; right: 20px; }
}

@keyframes pop {
  from { opacity: 0; transform: translate(-50%, -46%) scale(.97); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

@media (min-width: 1100px) {
  .list { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
}

/* 横屏手机：压缩头部 */
@media (max-height: 460px) and (orientation: landscape) {
  .brand-text p { display: none; }
  .hero { height: 150px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
