/* ===== 版本2 - 考研考点H5 ===== */
:root {
  --page: #eef6f4;
  --panel: #ffffff;
  --panel-2: #f8fbfb;
  --ink: #17202a;
  --muted: #637083;
  --line: rgba(26, 45, 64, 0.12);
  --primary: #0f7a67;
  --primary-2: #16a085;
  --accent: #ff8a3d;
  --accent-2: #3155d4;
  --hero-text: #ffffff;
  --hero-muted: rgba(255, 255, 255, 0.84);
  --hero-overlay: linear-gradient(135deg, rgba(9, 72, 66, 0.86), rgba(14, 114, 90, 0.56));
  --hero-image: url("https://images.unsplash.com/photo-1523050854058-8df90110c9f1?auto=format&fit=crop&w=1000&q=80");
  --shadow: 0 16px 40px rgba(20, 34, 48, 0.12);
  --marquee-speed: 14s;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

body[data-theme="energy"] {
  --page: #fff3ed;
  --panel: #ffffff;
  --panel-2: #fff9f5;
  --ink: #261b19;
  --muted: #745f59;
  --line: rgba(90, 42, 26, 0.14);
  --primary: #df4f2f;
  --primary-2: #ff7a2f;
  --accent: #0b8f83;
  --accent-2: #344ec2;
  --hero-overlay: linear-gradient(135deg, rgba(166, 44, 28, 0.88), rgba(246, 116, 42, 0.58));
  --hero-image: url("https://images.unsplash.com/photo-1516321318423-f06f85e504b3?auto=format&fit=crop&w=1000&q=80");
}

body[data-theme="night"] {
  --page: #111827;
  --panel: #1d2735;
  --panel-2: #16202d;
  --ink: #f4f7fb;
  --muted: #b7c0cf;
  --line: rgba(255, 255, 255, 0.12);
  --primary: #4fd1b8;
  --primary-2: #88e074;
  --accent: #ffd166;
  --accent-2: #7ba5ff;
  --hero-overlay: linear-gradient(135deg, rgba(11, 18, 32, 0.94), rgba(28, 75, 94, 0.58));
  --hero-image: url("https://images.unsplash.com/photo-1498243691581-b145c3f54a5a?auto=format&fit=crop&w=1000&q=80");
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
html { background: #dce4ea; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
}
button, input { font: inherit; }
button { cursor: pointer; }
button, a { -webkit-tap-highlight-color: transparent; }

.app {
  width: min(430px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  background: linear-gradient(180deg, color-mix(in srgb, var(--page) 94%, #fff 6%), var(--page) 45%), var(--page);
  overflow-x: hidden;
}

.page-view { display: none; }
.page-view.is-active { display: block; }

/* ===== Hero ===== */
.hero {
  position: relative;
  min-height: 338px;
  padding: 16px 14px 74px;
  color: var(--hero-text);
  background: var(--hero-overlay), var(--hero-image) center/cover;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute; left: 0; right: 0; bottom: -1px;
  height: 26px;
  background: var(--page);
  border-radius: 20px 20px 0 0;
}

.topbar {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 10px;
}
.brand-mark {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  flex: none;
}
.brand-text { min-width: 0; }
.brand-text strong {
  display: block; font-size: 16px; line-height: 1.2;
}
.brand-text span {
  display: block; margin-top: 3px;
  color: var(--hero-muted); font-size: 11px;
}

.hero-copy { position: relative; z-index: 1; margin-top: 34px; }
.hero-copy h1 {
  margin: 0; max-width: 330px;
  font-size: 31px; line-height: 1.16; font-weight: 850;
}
.hero-copy p {
  margin: 12px 0 0; max-width: 354px;
  color: var(--hero-muted); font-size: 13px; line-height: 1.65;
}

/* ===== Announcement ===== */
.announcement {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 70px 1fr; align-items: center;
  gap: 8px; height: 38px; margin-top: 16px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.15);
  overflow: hidden;
}
.announcement-label {
  height: 100%;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  background: rgba(255, 255, 255, 0.16);
  color: #fff; font-size: 12px; font-weight: 750;
}
.announcement-track { min-width: 0; overflow: hidden; white-space: nowrap; }
.announcement-track span {
  display: inline-block; padding-left: 100%;
  color: var(--hero-muted); font-size: 12px;
  animation: marquee var(--marquee-speed, 14s) linear infinite;
}
@keyframes marquee {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* ===== Countdown ===== */
.countdown {
  position: relative; z-index: 1; margin-top: 10px;
  border-radius: 8px; padding: 12px;
  background: rgba(255, 255, 255, 0.92); color: #16202a;
  box-shadow: 0 16px 34px rgba(0, 0, 0, 0.12);
}
.countdown-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.countdown-head h2 { margin: 0; font-size: 15px; }
.countdown-head span { color: #667085; font-size: 11px; white-space: nowrap; }
.time-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; margin-top: 10px; }
.time-box {
  min-height: 58px; border-radius: 8px;
  display: grid; place-items: center; padding: 7px 4px;
  background: #f3f7f9; border: 1px solid #e2e8f0;
}
.time-box b { color: var(--primary); font-size: 20px; line-height: 1; }
.time-box span { margin-top: 4px; color: #667085; font-size: 11px; }

/* ===== Content ===== */
.content {
  position: relative; z-index: 2;
  padding: 0 12px 30px; margin-top: -52px;
}

/* ===== Search Panel ===== */
.search-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); padding: 10px;
}
.search-box {
  height: 44px;
  display: grid; grid-template-columns: 24px 1fr 30px; align-items: center; gap: 8px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); padding: 0 9px;
}
.search-box svg { color: var(--muted); }
.search-box input {
  width: 100%; min-width: 0; border: 0; outline: 0;
  background: transparent; color: var(--ink); font-size: 14px;
}
.search-box input::placeholder { color: color-mix(in srgb, var(--muted) 76%, transparent); }
/* ===== Quick Cities Row ===== */
.quick-row {
  display: flex; gap: 8px; overflow-x: auto; padding-top: 10px;
  scrollbar-width: none;
}
.quick-row::-webkit-scrollbar { display: none; }
.quick-city {
  flex: none; min-height: 32px; padding: 0 11px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--panel); color: var(--muted);
  font-size: 12px;
}

/* ===== Section Title ===== */
.section-title {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; margin: 18px 2px 10px;
}
.section-title h2 { margin: 0; font-size: 17px; line-height: 1.2; }
.section-title span { color: var(--muted); font-size: 12px; white-space: nowrap; }

/* ===== Province Layout ===== */
.province-layout {
  display: grid; grid-template-columns: 84px 1fr;
  min-height: 404px;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; overflow: hidden;
}
.province-nav {
  background: color-mix(in srgb, var(--panel-2) 92%, var(--primary) 8%);
  border-right: 1px solid var(--line);
  max-height: 520px; overflow-y: auto;
}
.province-btn {
  width: 100%; min-height: 52px;
  border: 0; border-bottom: 1px solid var(--line);
  background: transparent; color: var(--muted);
  padding: 8px 7px; text-align: center;
  font-size: 13px; line-height: 1.25; position: relative;
}
.province-btn.is-active {
  background: var(--panel); color: var(--primary); font-weight: 780;
}
.province-btn.is-active::before {
  content: ""; position: absolute;
  top: 13px; bottom: 13px; left: 0; width: 3px;
  border-radius: 0 4px 4px 0; background: var(--primary);
}

.city-panel { min-width: 0; padding: 12px; }
.province-info {
  display: grid; grid-template-columns: 1fr auto; gap: 10px;
  align-items: start; padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.province-info h3 { margin: 0; font-size: 16px; }
.province-info p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.count-badge {
  min-height: 24px; border-radius: 999px; padding: 4px 8px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary); font-size: 12px; white-space: nowrap;
}

/* ===== City Grid ===== */
.city-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 12px; }
.city-card {
  min-height: 78px;
  border: 1px solid var(--line); border-radius: 8px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--panel) 88%, var(--primary) 8%), var(--panel)), var(--panel);
  padding: 10px; text-align: left; color: inherit;
  display: grid; align-content: space-between; gap: 8px;
}
.city-card:active { transform: scale(0.985); }
.city-name {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; font-weight: 760; font-size: 15px;
}
.city-name svg { flex: none; color: var(--primary); }
.city-meta { color: var(--muted); font-size: 11px; line-height: 1.35; }
.city-badge {
  font-size: 10px; font-weight: 600;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border-radius: 999px; padding: 2px 6px;
}
.city-card.no-article { opacity: 0.55; }
.empty {
  grid-column: 1 / -1;
  padding: 24px 12px;
  border: 1px dashed color-mix(in srgb, var(--muted) 40%, transparent);
  border-radius: 8px; color: var(--muted);
  text-align: center; font-size: 13px;
}

/* ===== Article Page ===== */
.article-page { min-height: 100vh; background: var(--page); padding-bottom: 24px; }
.article-topbar {
  position: sticky; top: 0; z-index: 8;
  display: grid; grid-template-columns: 38px 1fr 38px;
  align-items: center; gap: 8px;
  min-height: 58px; padding: 10px 12px;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.article-topbar h1 {
  margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-align: center; font-size: 16px;
}
.round-btn {
  width: 38px; height: 38px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--ink);
  display: grid; place-items: center;
}
.article-cover {
  height: 188px; margin: 12px 12px 0; border-radius: 8px;
  background: linear-gradient(180deg, rgba(0,0,0,0.05), rgba(0,0,0,0.32)),
              var(--cover-image, url("https://images.unsplash.com/photo-1497366754035-f200968a6e72?auto=format&fit=crop&w=1000&q=80")) center/cover;
  box-shadow: var(--shadow);
}
.article-card {
  margin: -24px 12px 0; position: relative; z-index: 1;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 8px; padding: 14px; box-shadow: var(--shadow);
}
.article-card h2 { margin: 0; font-size: 23px; line-height: 1.32; }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 10px; color: var(--muted); font-size: 12px; }
.pill {
  display: inline-flex; align-items: center; min-height: 24px;
  padding: 0 8px; border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
}

.article-body {
  margin: 12px; background: var(--panel);
  border: 1px solid var(--line); border-radius: 8px; padding: 16px;
}
.article-body h3 { margin: 22px 0 9px; font-size: 18px; line-height: 1.32; }
.article-body h3:first-child { margin-top: 0; }
.article-body p { margin: 0 0 13px; color: var(--muted); font-size: 15px; line-height: 1.86; }

.article-content-html { color: var(--muted); font-size: 15px; line-height: 1.82; }
.article-content-html h2, .article-content-html h3 { margin: 18px 0 8px; color: var(--ink); }
.article-content-html img { width: 100%; display: block; border-radius: 8px; margin: 12px 0; }
.article-content-html table { width: 100%; border-collapse: collapse; margin: 10px 0; color: var(--ink); font-size: 13px; }
.article-content-html th, .article-content-html td { border: 1px solid var(--line); padding: 8px; text-align: left; }
.article-content-html th { background: color-mix(in srgb, var(--panel-2) 88%, var(--primary) 8%); }

.article-photo {
  width: 100%; display: block; margin: 12px 0; border-radius: 8px;
  aspect-ratio: 16 / 9; object-fit: cover; border: 1px solid var(--line);
}

.venue-table { width: 100%; border-collapse: collapse; margin: 8px 0 14px; font-size: 13px; color: var(--ink); }
.venue-table th, .venue-table td { border: 1px solid var(--line); padding: 9px 8px; text-align: left; vertical-align: top; line-height: 1.45; }
.venue-table th { background: color-mix(in srgb, var(--panel-2) 88%, var(--primary) 8%); color: var(--ink); }

.tip-list { display: grid; gap: 8px; margin: 10px 0 14px; }
.tip-item {
  display: grid; grid-template-columns: 8px 1fr; gap: 9px; align-items: start;
  padding: 10px; border-radius: 8px;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 13px; line-height: 1.55;
}
.tip-dot { width: 8px; height: 8px; margin-top: 6px; border-radius: 999px; background: var(--accent); }

/* 推荐阅读（V2 文章页底部） */
.recommend-reading{
  margin:20px 0 0;
  padding:18px;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:12px;
}
.recommend-reading-title{
  display:flex;
  align-items:center;
  gap:8px;
  font-size:14px;
  font-weight:700;
  color:var(--ink);
  margin-bottom:12px;
}
.recommend-reading-icon{
  font-size:13px;
}
.recommend-reading-list{
  display:flex;
  flex-direction:column;
  gap:4px;
}
.recommend-reading-item{
  display:flex;
  align-items:center;
  gap:10px;
  padding:10px 12px;
  border-radius:8px;
  text-decoration:none;
  color:var(--ink);
  font-size:13px;
  transition:background .15s;
}
.recommend-reading-item:hover{
  background:var(--panel-2);
}
.recommend-reading-dot{
  width:5px;height:5px;
  background:var(--primary);
  border-radius:50%;
  flex-shrink:0;
}
.recommend-reading-text{
  flex:1;
  line-height:1.5;
}
.recommend-reading-arrow{
  color:var(--muted);
  font-size:12px;
  flex-shrink:0;
}

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 22px; z-index: 10;
  width: min(360px, calc(100% - 32px));
  transform: translate(-50%, 120px); opacity: 0;
  transition: transform 0.22s ease, opacity 0.22s ease;
  min-height: 46px; border-radius: 8px;
  background: rgba(20, 31, 42, 0.94); color: #fff;
  display: grid; place-items: center;
  padding: 10px 14px; text-align: center;
  font-size: 13px; line-height: 1.5; pointer-events: none;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }

/* ===== Back to Top ===== */
.back-to-top {
  position: fixed; right: 12px; bottom: 20px; z-index: 50;
  width: 38px; height: 38px;
  border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink);
  display: grid; place-items: center;
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  box-shadow: var(--shadow);
}
.back-to-top.show { opacity: 1; transform: translateY(0); pointer-events: auto; }

/* ===== Desktop ===== */
@media (min-width: 760px) {
  .app {
    margin: 24px auto; min-height: calc(100vh - 48px);
    border-radius: 18px; box-shadow: 0 22px 70px rgba(15, 23, 42, 0.18);
  }
  .hero { border-radius: 18px 18px 0 0; }
}

/* ===== 图片预览模态框 ===== */
.image-preview-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.92);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: imgPreviewFadeIn .25s ease;
}
@keyframes imgPreviewFadeIn {
  from { opacity: 0 }
  to { opacity: 1 }
}
.image-preview-container {
  position: relative;
  max-width: 95vw;
  max-height: 95vh;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-preview-img {
  max-width: 95vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0,0,0,.5);
}
.image-preview-close {
  position: fixed;
  top: 16px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  background: rgba(255,255,255,.15);
  color: #fff;
  font-size: 22px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10001;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.image-preview-close:active {
  background: rgba(255,255,255,.3);
}

/* ===== 图片加载失败占位 ===== */
.article-content img {
  position: relative;
  min-height: 80px;
  background: #f0f0f0;
  background-image: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 48 48' fill='%23ccc'><path d='M42 38V10c0-2.2-1.8-4-4-4H10c-2.2 0-4 1.8-4 4v28c0 2.2 1.8 4 4 4h28c2.2 0 4-1.8 4-4zM17 24l10 13 7-9 6 8H10l7-12z'/></svg>");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 40px 40px;
  border-radius: 4px;
}
.article-content img:not([src]), .article-content img[src=""] {
  min-height: 120px;
}
