/* ============ 环游中国·图鉴之旅 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #f7f2e7;
  --card: #fffdf8;
  --ink: #3d3630;
  --ink2: #8a7f72;
  --line: #eadfce;
  --red: #d95d4e;
  --red-dk: #b8463a;
  --green: #2a9d8f;
  --gold: #e8a33d;
  --blue: #4a7fb5;
  --shadow: 0 2px 10px rgba(120, 96, 60, .12);
}
html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  background: var(--bg) repeating-linear-gradient(45deg, rgba(190,160,110,.04) 0 12px, transparent 12px 24px);
  color: var(--ink);
}
#app { max-width: 860px; margin: 0 auto; min-height: 100vh; display: flex; flex-direction: column; }

/* ---- 顶栏 ---- */
#topbar {
  position: sticky; top: 0; z-index: 50;
  background: linear-gradient(135deg, #d95d4e, #c94f43);
  color: #fff; padding: 10px 14px;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.top-title { font-weight: 800; font-size: 17px; letter-spacing: 1px; text-shadow: 0 1px 2px rgba(0,0,0,.2); }
.top-stats { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.stat {
  background: rgba(255,255,255,.18); border-radius: 20px;
  padding: 4px 10px; font-size: 13px; white-space: nowrap;
}
.stat b { font-weight: 700; }
.stat.money b { color: #ffe08a; }
#btn-reset {
  border: none; background: rgba(255,255,255,.2); color: #fff;
  border-radius: 20px; padding: 4px 9px; cursor: pointer; font-size: 13px;
}
#btn-reset:hover { background: rgba(255,255,255,.35); }

/* ---- Tab 导航 ---- */
#tabs {
  position: sticky; top: 46px; z-index: 49;
  display: flex; gap: 8px; background: var(--card);
  padding: 8px 10px; border-bottom: 2px solid var(--line);
  overflow-x: auto;
}
.tab {
  flex: 1; min-width: 72px; border: none; cursor: pointer;
  padding: 9px 4px; font-size: 14px; font-weight: 600; color: var(--ink2);
  border-radius: 14px; white-space: nowrap;
  background: transparent; transition: all .2s;
}
.tab.active {
  color: #fff; background: linear-gradient(135deg, var(--red), var(--red-dk));
  box-shadow: 0 2px 6px rgba(217,93,78,.35);
}
.tab:not(.active):hover { background: #fdf0ea; color: var(--red); }

/* ---- 主区 ---- */
#view { flex: 1; padding: 14px 12px 30px; }
#footbar { text-align: center; font-size: 11px; color: var(--ink2); padding: 10px; border-top: 1px dashed var(--line); }

/* ---- 城市头部 ---- */
.city-hero {
  background: linear-gradient(135deg, #2a9d8f, #24867a);
  border-radius: 14px; color: #fff; padding: 16px;
  box-shadow: var(--shadow); margin-bottom: 14px; position: relative; overflow: hidden;
}
.city-hero::after { content: attr(data-emoji); position: absolute; right: 6px; bottom: -14px; font-size: 74px; opacity: .18; }
.city-hero h2 { font-size: 22px; margin-bottom: 4px; }
.city-hero .city-meta { font-size: 12px; opacity: .92; margin-bottom: 8px; }
.city-hero p { font-size: 13px; line-height: 1.6; opacity: .95; max-width: 92%; }
.city-progress { margin-top: 10px; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.pbar { flex: 1; max-width: 300px; height: 8px; background: rgba(255,255,255,.25); border-radius: 6px; overflow: hidden; }
.pbar > i { display: block; height: 100%; background: #ffd76e; border-radius: 6px; transition: width .4s; }
.city-done-badge { font-size: 20px; }

/* ---- 子板块 tab ---- */
.sub-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.sub-tab {
  flex: 1; border: 1.5px solid var(--line); background: var(--card); border-radius: 10px;
  padding: 9px 4px; font-size: 13.5px; font-weight: 700; color: var(--ink2); cursor: pointer;
}
.sub-tab.active { border-color: var(--red); color: var(--red); background: #fff3ee; box-shadow: var(--shadow); }
.sub-tab .cnt { font-weight: 400; font-size: 11px; display: block; margin-top: 2px; color: var(--ink2); }

/* ---- 条目卡片 ---- */
.item-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 10px; }

/* ---- 本城·系列收藏：一城多系列按色块分组 ---- */
.sr-city { display: flex; flex-direction: column; gap: 14px; }
.sr-block {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px; box-shadow: var(--shadow);
}
.sr-block-head {
  display: flex; align-items: center; gap: 8px; margin: 2px 2px 10px;
  padding: 4px 10px; border-left: 6px solid var(--sr, #c9a227);
  background: linear-gradient(90deg, rgba(0,0,0,.04), transparent);
  border-radius: 0 10px 10px 0;
}
.sr-block-head .sr-block-name { font-weight: 800; font-size: 14.5px; color: var(--ink); letter-spacing: .5px; }
.sr-block-head .sr-block-cnt { margin-left: auto; font-size: 12px; color: var(--ink2); font-weight: 600; }
.sr-block .item-list { margin-top: 0; }
.sr-dot { width: 14px; height: 14px; border-radius: 4px; display: inline-block; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.06); }
.book-city-head .sr-dot { margin-left: 2px; }
.item-card.has-sr { box-shadow: inset 0 3px 0 var(--sr, #c9a227), var(--shadow); }
.item-card.has-sr .item-icon { box-shadow: inset 0 0 0 2px rgba(0,0,0,.04); }

/* 图鉴·系列收藏细节：格子带系列底色 */
.book-city.sr-tint .book-city-head { border-left: 6px solid var(--sr, #c9a227); border-radius: 0 0 0 10px; }
.book-city.sr-tint .bk-cell { border-color: color-mix(in srgb, var(--sr, #c9a227) 45%, var(--line)); }
.book-city.sr-tint.open .book-city-body { background: linear-gradient(180deg, color-mix(in srgb, var(--sr, #c9a227) 7%, transparent), transparent); }

.item-card {
  background: var(--card); border-radius: 12px; padding: 12px;
  box-shadow: var(--shadow); border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 6px; position: relative;
}
.item-card.locked { opacity: .62; filter: grayscale(.4); }
.item-head { display: flex; align-items: center; gap: 8px; }
.item-icon {
  width: 44px; height: 44px; border-radius: 10px; background: #fff3e0;
  display: flex; align-items: center; justify-content: center; font-size: 26px; flex-shrink: 0;
}
.item-name { font-weight: 700; font-size: 15px; }
.item-tags { display: flex; gap: 4px; margin-top: 2px; }
.tagchip { font-size: 10px; padding: 1px 7px; border-radius: 8px; background: #eef4f8; color: var(--blue); font-weight: 600; }
.tagchip.t-食 { background: #fdeee6; color: #c96b3c; }
.tagchip.t-衣 { background: #f3eaf9; color: #8e5bb5; }
.tagchip.t-住 { background: #e8f3ea; color: #3c8a56; }
.tagchip.t-行 { background: #e9f0fa; color: #3a6fb0; }
.tagchip.t-玩 { background: #fdf3dc; color: #b8860b; }
.tagchip.t-游 { background: #e6f4f2; color: #21867a; }
.tagchip.t-闻 { background: #fbeceb; color: #bb4a3e; }
.item-price { margin-left: auto; font-weight: 800; color: var(--red); white-space: nowrap; }
.item-price.free { color: var(--green); }
.item-desc { font-size: 12.5px; color: var(--ink2); line-height: 1.65; flex: 1; }
.item-foot { display: flex; align-items: center; gap: 8px; }
.btn-do {
  border: none; border-radius: 20px; padding: 7px 16px; cursor: pointer;
  background: linear-gradient(135deg, var(--red), var(--red-dk)); color: #fff;
  font-size: 13px; font-weight: 700; box-shadow: 0 2px 5px rgba(217,93,78,.35);
}
.btn-do:active { transform: scale(.96); }
.btn-do:disabled { background: #cfc6b8; box-shadow: none; cursor: not-allowed; }
.btn-do.done-btn { background: #e8f3ea; color: var(--green); box-shadow: none; cursor: default; }
.reward-hint { font-size: 11px; color: var(--gold); font-weight: 700; }
.reward-hint::before { content: "🎁 +"; }
.item-card .collected-mark { position: absolute; top: 8px; right: 10px; font-size: 15px; }

/* ---- 世界地图 ---- */
.map-group-title { margin: 16px 4px 8px; font-size: 15px; font-weight: 800; color: var(--ink); display: flex; align-items: center; gap: 6px; }
.map-group-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.city-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 7px;
}
.city-card.here { border: 2px solid var(--green); }
.city-card.no-visa { opacity: .85; }
.cc-head { display: flex; align-items: center; gap: 8px; }
.cc-flag { font-size: 26px; }
.cc-name { font-weight: 800; font-size: 16px; }
.cc-region { font-size: 11px; color: var(--ink2); margin-top: 1px; }
.cc-progress { font-size: 11px; color: var(--ink2); }
.cc-desc { font-size: 12px; color: var(--ink2); line-height: 1.55; min-height: 34px; }
.cc-travels { display: flex; flex-wrap: wrap; gap: 5px; }
.travel-chip {
  font-size: 11.5px; background: #f3eee2; border: 1px solid var(--line);
  padding: 3px 9px; border-radius: 14px; cursor: pointer; color: var(--ink);
}
.travel-chip:hover { background: #fde8d8; border-color: var(--red); color: var(--red); }
.travel-chip:disabled { opacity: .45; cursor: not-allowed; }
.here-chip { font-size: 12px; color: var(--green); font-weight: 700; }
.visa-note { font-size: 11px; color: var(--red); }
.visa-note.ok { color: var(--green); }

/* ---- 图鉴 ---- */
.book-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.book-city { background: var(--card); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 10px; box-shadow: var(--shadow); overflow: hidden; }
.book-city-head {
  padding: 11px 14px; display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none;
}
.book-city-head h4 { font-size: 14.5px; }
.book-city-head .bprog { margin-left: auto; font-size: 12px; color: var(--ink2); }
.book-city-head .arrow { transition: transform .25s; color: var(--ink2); font-size: 12px; }
.book-city.open .arrow { transform: rotate(90deg); }
.book-city-body { display: none; padding: 4px 12px 12px; border-top: 1px dashed var(--line); }
.book-city.open .book-city-body { display: block; }
.bk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 8px; }
.bk-cell {
  border: 1px solid var(--line); border-radius: 10px; padding: 9px 8px; text-align: center;
  background: #faf7ef; font-size: 12px; line-height: 1.5;
}
.bk-cell.got { background: #fff8ec; border-color: #ecd9b0; }
.bk-cell .bk-ico { font-size: 24px; display: block; margin-bottom: 3px; }
.bk-cell:not(.got) .bk-ico { filter: grayscale(1) brightness(1.6) opacity(.55); }
.bk-cell .bk-name { font-weight: 700; }
.bk-cell:not(.got) .bk-name { color: #b9b0a2; }
.bk-cell .bk-sub { font-size: 10.5px; color: var(--ink2); }
.bk-unknown { letter-spacing: 3px; }

/* ---- 背包 ---- */
.bag-empty { text-align: center; color: var(--ink2); padding: 50px 0; font-size: 14px; }
.bag-city-title { margin: 14px 4px 8px; font-size: 14px; font-weight: 800; }
.bag-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 9px; }
.bag-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px;
  display: flex; gap: 9px; align-items: center; box-shadow: var(--shadow);
}
.bag-item .bi-ico { font-size: 27px; }
.bag-item .bi-name { font-size: 13px; font-weight: 700; }
.bag-item .bi-type { font-size: 10.5px; color: var(--ink2); margin-top: 2px; }

/* ---- 事务所 ---- */
.office-note { background: #fff8e8; border: 1px solid #f0e0b8; border-radius: 12px; padding: 12px 14px; font-size: 12.5px; color: #7a6a45; line-height: 1.7; margin-bottom: 14px; }
.doc-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin-bottom: 12px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 12px;
}
.doc-ico { font-size: 34px; }
.doc-info { flex: 1; }
.doc-info h4 { font-size: 15px; margin-bottom: 3px; }
.doc-info p { font-size: 12px; color: var(--ink2); line-height: 1.6; }
.doc-state { font-size: 12px; font-weight: 800; }
.doc-state.ok { color: var(--green); }
.doc-state.no { color: var(--red); }
.btn-doc {
  border: none; border-radius: 18px; padding: 8px 15px; cursor: pointer; font-size: 13px; font-weight: 700;
  background: linear-gradient(135deg, var(--blue), #3a6a9d); color: #fff;
}
.btn-doc:disabled { background: #cfc6b8; cursor: not-allowed; }
.btn-doc.done { background: #e8f3ea; color: var(--green); cursor: default; }

/* ---- Toast ---- */
#toast-wrap { position: fixed; top: 54px; left: 0; right: 0; z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  background: rgba(50, 42, 32, .92); color: #fff; border-radius: 22px; padding: 10px 20px;
  font-size: 13.5px; max-width: 88%; text-align: center; box-shadow: 0 4px 14px rgba(0,0,0,.25);
  animation: toastIn .3s ease, toastOut .4s ease 2.3s forwards;
}
.toast b { color: #ffd76e; }
.toast.reward { background: linear-gradient(135deg, rgba(194,84,60,.95), rgba(160,60,50,.95)); }
@keyframes toastIn { from { opacity: 0; transform: translateY(-14px) scale(.9); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-10px); } }

/* ---- Modal ---- */
#modal-wrap {
  position: fixed; inset: 0; z-index: 300; background: rgba(30, 22, 12, .55);
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
#modal-wrap.hidden { display: none; }
.modal-box {
  background: var(--card); border-radius: 18px; max-width: 480px; width: 100%;
  max-height: 82vh; overflow-y: auto; padding: 22px; box-shadow: 0 10px 40px rgba(0,0,0,.35);
  animation: toastIn .3s ease;
}
.modal-box h3 { color: var(--red); margin-bottom: 10px; font-size: 18px; }
.modal-box .m-body { font-size: 14px; line-height: 1.85; color: var(--ink); white-space: pre-wrap; }
.modal-box .m-foot { margin-top: 16px; text-align: center; }
.btn-big {
  border: none; border-radius: 24px; padding: 11px 34px; font-size: 15px; font-weight: 800; cursor: pointer;
  background: linear-gradient(135deg, var(--red), var(--red-dk)); color: #fff; box-shadow: 0 3px 8px rgba(217,93,78,.4);
}
.reward-pop { text-align: center; padding: 8px 0; }
.reward-pop .rp-ico { font-size: 52px; display: block; margin: 6px 0; animation: pop .5s ease; }
.reward-pop .rp-money { font-size: 24px; font-weight: 900; color: var(--gold); display: block; margin: 4px 0 10px; }
@keyframes pop { 0% { transform: scale(0); } 70% { transform: scale(1.25); } 100% { transform: scale(1); } }

/* ---- 响应式 ---- */
@media (max-width: 520px) {
  .top-title { font-size: 14px; }
  #topbar { padding: 8px 10px; }
  .item-list, .map-grid { grid-template-columns: 1fr; }
  #tabs { top: 62px; }
}
