:root {
  --brand: #0fa968;
  --brand-dark: #0b8a55;
  --brand-soft: rgba(15, 169, 104, 0.1);
  --bg: #f4f6f8;
  --card: #ffffff;
  --text: #1f2937;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --line: #eef1f4;
  --warn-bg: #fff8ec;
  --warn-line: #fde5c0;
  --warn-text: #a8651a;
  --radius: 16px;
  --shadow: 0 2px 12px rgba(17, 24, 39, 0.06);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

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

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body.locked {
  overflow: hidden;
}

button,
input,
textarea {
  font-family: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--bg);
}

/* ---------------- Hero ---------------- */

.hero {
  position: relative;
  height: 208px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
}

.hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transform: scale(1.02);
}

.hero-mask {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.08) 0%, rgba(0, 0, 0, 0.55) 100%);
}

.hero-inner {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 44px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  color: #fff;
}

.hero-logo {
  flex: none;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: contain;
  background: rgba(255, 255, 255, 0.95);
  padding: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.hero-logo[hidden] {
  display: none;
}

.hero-text {
  min-width: 0;
}

.hero-tag {
  margin: 0 0 6px;
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(6px);
}

.hero-tag:empty {
  display: none;
}

.hero-title {
  margin: 0;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* ---------------- Main ---------------- */

.main {
  position: relative;
  padding: 0 14px calc(32px + var(--safe-bottom));
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* 轮播图 */
.banner {
  position: relative;
  z-index: 2;
  margin: 0 0 12px;
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.banner-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}

.banner-track::-webkit-scrollbar {
  display: none;
}

.banner-item {
  flex: 0 0 100%;
  scroll-snap-align: center;
}

.banner-item img {
  display: block;
  width: 100%;
  height: 176px;
  object-fit: cover;
}

/* 快捷信息 */
.quick {
  position: relative;
  z-index: 2;
  margin: 0 0 12px;
  padding: 14px 8px 12px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.main > .banner:first-child,
.main > .quick:first-child {
  margin-top: -28px;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(64px, 1fr));
  gap: 4px;
}

.quick-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 2px 2px;
  border: 0;
  background: none;
  color: var(--text);
  text-align: center;
  cursor: pointer;
}

.quick-icon {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
}

.quick-icon svg {
  width: 20px;
  height: 20px;
}

.quick-label {
  font-size: 12px;
  color: var(--text-3);
}

.quick-value {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  word-break: break-all;
}

.quick-address {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  margin-top: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 12px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.quick-address-icon {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--brand);
  display: flex;
}

.quick-address-icon svg {
  width: 16px;
  height: 16px;
}

.quick-address-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.quick-address-tip {
  flex: none;
  font-size: 12px;
  color: var(--brand-dark);
}

/* 欢迎语 */
.welcome {
  padding: 14px 16px;
  margin-bottom: 12px;
  font-size: 14px;
  color: var(--text-2);
  white-space: pre-line;
}

.welcome-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.welcome-title i {
  width: 4px;
  height: 14px;
  border-radius: 2px;
  background: var(--brand);
}

/* ---------------- Tabs ---------------- */

.tabs {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  gap: 6px;
  margin: 0 -14px 10px;
  padding: 8px 14px;
  background: rgba(244, 246, 248, 0.92);
  backdrop-filter: blur(10px);
}

.tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: var(--card);
  color: var(--text-2);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 4px rgba(17, 24, 39, 0.04);
}

.tab svg {
  width: 17px;
  height: 17px;
  flex: none;
}

.tab.active {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 4px 12px rgba(15, 169, 104, 0.28);
}

.tab .tab-count {
  font-size: 11px;
  opacity: 0.75;
}

/* ---------------- Search ---------------- */

.toolbar {
  margin-bottom: 10px;
}

.search {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 18px;
  height: 18px;
  color: var(--text-3);
  pointer-events: none;
}

.search input {
  width: 100%;
  height: 42px;
  padding: 0 38px 0 38px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  outline: none;
  box-shadow: 0 1px 4px rgba(17, 24, 39, 0.04);
  transition: border-color 0.2s;
}

.search input:focus {
  border-color: var(--brand);
}

.search input::-webkit-search-cancel-button {
  display: none;
}

.search-clear {
  position: absolute;
  right: 6px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: none;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.search-clear svg {
  width: 16px;
  height: 16px;
}

/* ---------------- Chips ---------------- */

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 10px;
  scrollbar-width: none;
}

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

.chip {
  flex: none;
  height: 32px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--card);
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 1px 4px rgba(17, 24, 39, 0.04);
}

.chip.active {
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-weight: 600;
}

.chips:empty {
  display: none;
}

/* ---------------- List ---------------- */

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.item {
  display: block;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.item:active {
  transform: scale(0.99);
}

.item-media {
  position: relative;
  width: 100%;
  padding-top: 52%;
  background: linear-gradient(135deg, var(--brand-soft), rgba(15, 169, 104, 0.22));
  overflow: hidden;
}

.item-media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.item-media .placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--brand);
  opacity: 0.55;
}

.item-media .placeholder svg {
  width: 44px;
  height: 44px;
}

.item-badge {
  position: absolute;
  left: 10px;
  top: 10px;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 11px;
  backdrop-filter: blur(4px);
}

.item-body {
  padding: 12px 14px 14px;
}

.item-row {
  display: flex;
  gap: 12px;
  padding: 14px;
}

.item-icon {
  flex: none;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
}

.item-icon svg {
  width: 21px;
  height: 21px;
}

.item-main {
  flex: 1;
  min-width: 0;
}

.item-title {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.item-summary {
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-3);
}

.meta span {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.meta svg {
  width: 13px;
  height: 13px;
  flex: none;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--text-2);
  font-size: 11px;
}

/* 骨架屏 / 空状态 */
.skeleton {
  background: var(--card);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}

.sk-line {
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(90deg, #eef1f4 25%, #f7f9fb 37%, #eef1f4 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

.sk-line + .sk-line {
  margin-top: 10px;
}

@keyframes shimmer {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

.empty {
  padding: 48px 20px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
}

.empty svg {
  width: 46px;
  height: 46px;
  margin-bottom: 10px;
  opacity: 0.5;
}

.retry {
  margin-top: 12px;
  padding: 7px 18px;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 13px;
  cursor: pointer;
}

/* ---------------- Footer ---------------- */

.footer {
  margin-top: 22px;
  padding: 0 6px;
  text-align: center;
  font-size: 12px;
  color: var(--text-3);
}

.footer p {
  margin: 0 0 6px;
}

/* ---------------- 详情页 ---------------- */

.detail {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  animation: slideUp 0.24s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.detail[hidden] {
  display: none;
}

@keyframes slideUp {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.detail-topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  padding: 0 8px;
  color: #fff;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}

.detail-topbar.solid {
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 8px rgba(17, 24, 39, 0.06);
}

.detail-topbar-title {
  flex: 1;
  min-width: 0;
  padding: 0 6px;
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0;
  transition: opacity 0.2s;
}

.detail-topbar.solid .detail-topbar-title {
  opacity: 1;
}

.icon-btn {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.28);
  color: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s;
}

.detail-topbar.solid .icon-btn {
  background: transparent;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.detail-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.detail-hero {
  position: relative;
  width: 100%;
  height: 240px;
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  overflow: hidden;
}

.detail-hero img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.detail-hero .placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.7);
}

.detail-hero .placeholder svg {
  width: 64px;
  height: 64px;
}

.detail-content {
  position: relative;
  margin: -20px 12px 0;
  padding: 18px 16px 20px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.detail-group {
  display: inline-block;
  margin-bottom: 8px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 12px;
}

.detail-title {
  margin: 0 0 8px;
  font-size: 21px;
  font-weight: 700;
  line-height: 1.35;
}

.detail-summary {
  margin: 0 0 14px;
  font-size: 14px;
  color: var(--text-2);
}

.info-list {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--bg);
}

.info-row {
  display: flex;
  gap: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.info-row + .info-row {
  margin-top: 9px;
}

.info-key {
  flex: none;
  width: 58px;
  color: var(--text-3);
}

.info-val {
  flex: 1;
  min-width: 0;
  color: var(--text);
  word-break: break-word;
}

.actions {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.btn {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.btn.ghost {
  background: var(--brand-soft);
  color: var(--brand-dark);
}

.btn svg {
  width: 16px;
  height: 16px;
}

/* 正文（轻量 Markdown） */
.md {
  font-size: 15px;
  line-height: 1.75;
  color: var(--text);
}

.md p {
  margin: 0 0 10px;
}

.md h3 {
  margin: 18px 0 8px;
  padding-left: 10px;
  border-left: 3px solid var(--brand);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.4;
}

.md h3:first-child {
  margin-top: 0;
}

.md ul,
.md ol {
  margin: 0 0 12px;
  padding-left: 20px;
}

.md li {
  margin-bottom: 4px;
}

.md strong {
  font-weight: 600;
  color: var(--brand-dark);
}

.md blockquote {
  margin: 0 0 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-2);
  font-size: 14px;
}

.md a {
  color: var(--brand-dark);
  text-decoration: underline;
}

.tips {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--warn-bg);
  border: 1px solid var(--warn-line);
  color: var(--warn-text);
  font-size: 13px;
  line-height: 1.6;
}

.tips svg {
  flex: none;
  width: 17px;
  height: 17px;
  margin-top: 2px;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-top: 16px;
}

.gallery img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  border-radius: 10px;
  background: var(--bg);
}

.detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

.related {
  margin: 12px 12px 0;
  padding: 16px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.related-title {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
}

.related-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  cursor: pointer;
}

.related-item:first-of-type {
  border-top: 0;
}

.related-thumb {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--brand-soft);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
}

.related-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.related-thumb svg {
  width: 20px;
  height: 20px;
}

.related-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.related-arrow {
  flex: none;
  width: 16px;
  height: 16px;
  color: var(--text-3);
}

.detail-bottom {
  height: calc(28px + var(--safe-bottom));
}

/* ---------------- 底部联系条 ---------------- */

.contact-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  display: flex;
  gap: 10px;
  max-width: 640px;
  margin: 0 auto;
  padding: 10px 14px calc(10px + var(--safe-bottom));
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 -2px 14px rgba(17, 24, 39, 0.08);
  backdrop-filter: blur(8px);
}

.contact-bar[hidden] {
  display: none;
}

.contact-bar .btn {
  height: 44px;
}

body.has-contact .main {
  padding-bottom: calc(92px + var(--safe-bottom));
}

body.has-contact .toast {
  bottom: calc(104px + var(--safe-bottom));
}

/* ---------------- Toast ---------------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(64px + var(--safe-bottom));
  transform: translate(-50%, 12px);
  z-index: 200;
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(17, 24, 39, 0.88);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 360px) {
  .hero-title {
    font-size: 22px;
  }
  .tab {
    font-size: 13px;
  }
  .tab svg {
    display: none;
  }
}

/* ===== 首页自定义板块 ===== */
.custom-sections {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin: 14px 0;
}
.custom-section {
  overflow: hidden;
}
.custom-cover {
  display: block;
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: calc(var(--radius, 16px) - 4px);
  margin-bottom: 10px;
}
.custom-title {
  margin: 0 0 4px;
  font-size: 17px;
  font-weight: 600;
  color: var(--text, #2a2422);
}
.custom-subtitle {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-2, rgba(42, 36, 34, 0.62));
}
.custom-section .md {
  font-size: 14px;
}
.custom-section .actions {
  margin-top: 10px;
}
