/* ==========================================================================
   青槐新村 · 智慧社区便民服务网
   Phase 0: 100% 司空见惯的中国本土社区政务/物业便民门户视觉
   Phase 1-3: 渐进式失真、褪色、霉变、渗暗与界面腐化
   Phase 4: 电影级全屏猫眼第一人称恐怖片现场
   ========================================================================== */

:root {
  --bg-page: #eef2f7;
  --bg-card: #ffffff;
  --bg-subtle: #f6f9fc;
  --border-color: #d6e0ec;
  --border-strong: #b8cae0;
  --brand-dark: #0c4480;
  --brand-primary: #145ca8;
  --brand-light: #e8f1fb;
  --accent-red: #c92a2a;
  --accent-orange: #d96b16;
  --accent-green: #1f7a4c;
  --text-main: #222933;
  --text-sub: #5c6878;
  --text-muted: #8692a2;
  --shadow-card: 0 1px 3px rgba(15, 42, 74, 0.06);
  --font-ui: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "SimSun", sans-serif;
  --font-doc: "FangSong", "STFangsong", "SimSun", "Songti SC", serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  min-height: 100%;
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-main);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  transition: background-color 2.2s ease, color 1.8s ease, filter 1.8s ease;
  overflow-x: hidden;
}

a {
  color: var(--brand-primary);
  text-decoration: none;
  cursor: pointer;
}
a:hover {
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
}

/* ---------- 渐进异化全局主题阶段 ---------- */
body.phase-1 {
  --bg-page: #e3e7ec;
  --brand-primary: #164f8a;
  --brand-dark: #0b3666;
}

body.phase-2 {
  --bg-page: #ced4d2;
  --bg-card: #f3f4f0;
  --bg-subtle: #e7eae5;
  --border-color: #b7c0ba;
  --brand-primary: #1e4254;
  --brand-dark: #102935;
  --brand-light: #dce4e3;
  --accent-red: #8f1d1d;
  --text-main: #1f2523;
  --text-sub: #4c5753;
}

body.phase-3 {
  --bg-page: #121614;
  --bg-card: #1d2320;
  --bg-subtle: #161c19;
  --border-color: #323d37;
  --border-strong: #46544c;
  --brand-primary: #263935;
  --brand-dark: #0e1715;
  --brand-light: #24302c;
  --accent-red: #b52626;
  --text-main: #dde4dc;
  --text-sub: #abb7ad;
  --text-muted: #8b988d;
  --shadow-card: 0 4px 20px rgba(0, 0, 0, 0.55);
}

body.finale-open {
  overflow: hidden;
}

/* 霉斑/潮湿暗角叠加层（阶段0完全透明） */
#atmosphere-vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 800;
  opacity: 0;
  background:
    radial-gradient(ellipse at center, transparent 48%, rgba(6, 12, 9, 0.65) 86%, rgba(2, 4, 3, 0.92) 100%);
  transition: opacity 2.5s ease;
}
body.phase-1 #atmosphere-vignette { opacity: 0.14; }
body.phase-2 #atmosphere-vignette { opacity: 0.48; }
body.phase-3 #atmosphere-vignette { opacity: 0.88; }

/* 细微阴冷扫描线与噪点（阶段2-3浮现） */
#atmosphere-scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 801;
  opacity: 0;
  background: repeating-linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0.14) 3px,
    rgba(0, 0, 0, 0) 4px
  );
  transition: opacity 2s ease;
}
body.phase-2 #atmosphere-scanlines { opacity: 0.25; }
body.phase-3 #atmosphere-scanlines { opacity: 0.65; }

/* 瞬时故障闪屏层 */
#glitch-flash {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 950;
  opacity: 0;
  background: rgba(180, 210, 190, 0.18);
  mix-blend-mode: difference;
}
#glitch-flash.active {
  animation: quickGlitchFlash 0.24s steps(2) forwards;
}

@keyframes quickGlitchFlash {
  0% { opacity: 0.9; transform: translateX(-6px); }
  35% { opacity: 0.35; transform: translateX(8px); background: rgba(140, 15, 15, 0.28); }
  70% { opacity: 0.75; transform: translateX(-3px); background: rgba(0, 0, 0, 0.8); }
  100% { opacity: 0; transform: none; }
}

/* 页面颤抖 */
body.screen-shake {
  animation: microShake 0.36s linear;
}
@keyframes microShake {
  0%, 100% { transform: translate(0, 0); }
  20% { transform: translate(-4px, 2px); }
  40% { transform: translate(5px, -3px); }
  60% { transform: translate(-3px, -2px); }
  80% { transform: translate(3px, 3px); }
}

/* ---------- 顶部便民信息细栏 ---------- */
.top-utility-bar {
  background: #f8fafd;
  border-bottom: 1px solid var(--border-color);
  font-size: 12px;
  color: var(--text-sub);
  transition: background-color 1.8s ease, border-color 1.8s ease;
}
body.phase-2 .top-utility-bar { background: #dde2df; }
body.phase-3 .top-utility-bar { background: #101412; border-bottom-color: #27302a; }

.top-utility-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 6px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.top-utility-left, .top-utility-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.utility-sep {
  color: var(--border-strong);
}

.utility-btn {
  background: none;
  border: none;
  color: var(--text-sub);
  font-size: 12px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.utility-btn:hover {
  color: var(--brand-primary);
  text-decoration: underline;
}

.weather-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 1px 8px;
  background: var(--brand-light);
  border-radius: 3px;
  color: var(--brand-dark);
  font-weight: 500;
}
body.phase-3 .weather-chip {
  background: #231818;
  color: #cf9c9c;
}

/* ---------- 门户主抬头（经典本土政务/社区蓝白抬头） ---------- */
.site-header {
  background: linear-gradient(180deg, #ffffff 0%, #f4f8fd 100%);
  border-bottom: 1px solid var(--border-color);
  transition: background 1.8s ease;
}
body.phase-2 .site-header {
  background: linear-gradient(180deg, #edf0ec 0%, #dee4df 100%);
}
body.phase-3 .site-header {
  background: linear-gradient(180deg, #171c19 0%, #101412 100%);
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 18px 16px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-crest {
  width: 54px;
  height: 54px;
  flex-shrink: 0;
}

.brand-titles h1 {
  font-size: 24px;
  font-weight: 700;
  color: var(--brand-dark);
  letter-spacing: 1px;
  line-height: 1.25;
}
body.phase-3 .brand-titles h1 {
  color: #cfd8cf;
  text-shadow: 2px 0 0 rgba(160, 20, 20, 0.35);
}

.brand-subtitle {
  font-size: 12px;
  color: var(--text-sub);
  margin-top: 3px;
  letter-spacing: 0.4px;
}

.header-search-box {
  display: flex;
  align-items: center;
  gap: 0;
}
.header-search-box input {
  width: 220px;
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-right: none;
  border-radius: 3px 0 0 3px;
  font-size: 13px;
  background: var(--bg-card);
  color: var(--text-main);
  outline: none;
}
.header-search-box input:focus {
  border-color: var(--brand-primary);
}
.header-search-box button {
  height: 34px;
  padding: 0 15px;
  background: var(--brand-primary);
  color: #fff;
  border: 1px solid var(--brand-primary);
  border-radius: 0 3px 3px 0;
  font-size: 13px;
  font-weight: 500;
}
.header-search-box button:hover {
  background: var(--brand-dark);
}

/* ---------- 经典蓝色主导航栏 ---------- */
.main-nav {
  background: linear-gradient(180deg, var(--brand-primary) 0%, var(--brand-dark) 100%);
  box-shadow: 0 2px 6px rgba(10, 42, 82, 0.16);
}

.main-nav-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 12px;
  display: flex;
  align-items: center;
  overflow-x: auto;
}

.nav-item {
  position: relative;
  padding: 12px 20px;
  color: rgba(255, 255, 255, 0.94);
  font-size: 15px;
  font-weight: 500;
  white-space: nowrap;
  border: none;
  background: transparent;
  transition: background 0.18s;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.nav-item:hover {
  background: rgba(255, 255, 255, 0.13);
}
.nav-item.active {
  background: rgba(0, 0, 0, 0.2);
  font-weight: 700;
  box-shadow: inset 0 -3px 0 #f2b705;
}
body.phase-3 .nav-item.active {
  box-shadow: inset 0 -3px 0 #b02222;
}

.nav-badge {
  display: none;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #d93025;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 700;
}
.nav-badge.show {
  display: inline-block;
  animation: badgePulse 2.2s infinite;
}
@keyframes badgePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}

/* ---------- 滚动红字通知栏 ---------- */
.ticker-wrap {
  max-width: 1080px;
  margin: 12px auto 0;
  padding: 0 16px;
}
.ticker-bar {
  display: flex;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--accent-red);
  height: 36px;
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.ticker-label {
  flex-shrink: 0;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--accent-red);
  border-right: 1px solid var(--border-color);
  background: var(--bg-subtle);
  height: 100%;
  display: flex;
  align-items: center;
}
.ticker-track {
  flex: 1;
  overflow: hidden;
  white-space: nowrap;
  position: relative;
}
.ticker-text {
  display: inline-block;
  padding-left: 100%;
  font-size: 13px;
  color: var(--text-main);
  animation: marqueeScroll 32s linear infinite;
}
.ticker-bar:hover .ticker-text {
  animation-play-state: paused;
}
body.phase-3 .ticker-text {
  color: #d77272;
  letter-spacing: 0.8px;
  animation-duration: 24s;
}
@keyframes marqueeScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-100%); }
}

/* ---------- 主内容容器 ---------- */
.main-container {
  max-width: 1080px;
  margin: 14px auto 40px;
  padding: 0 16px 48px;
  min-height: 620px;
}

.tab-panel {
  display: none;
}
.tab-panel.active {
  display: block;
}

/* ---------- 通用卡片与栏目头 ---------- */
.portal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-card);
  margin-bottom: 16px;
  transition: background-color 1.8s ease, border-color 1.8s ease;
}
.card-head {
  padding: 10px 15px;
  border-bottom: 1px solid var(--border-color);
  background: linear-gradient(180deg, var(--bg-subtle) 0%, var(--bg-card) 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--brand-dark);
  display: flex;
  align-items: center;
  gap: 8px;
}
body.phase-3 .card-title { color: #c7d1c8; }
.card-title::before {
  content: "";
  display: inline-block;
  width: 4px;
  height: 15px;
  background: var(--brand-primary);
  border-radius: 1px;
}
body.phase-3 .card-title::before { background: #8f2222; }

.card-more {
  font-size: 12px;
  color: var(--text-sub);
}
.card-body {
  padding: 14px 16px;
}

/* ---------- 首页双栏布局 ---------- */
.home-grid {
  display: grid;
  grid-template-columns: 1fr 310px;
  gap: 16px;
  align-items: start;
}

@media (max-width: 820px) {
  .home-grid {
    grid-template-columns: 1fr;
  }
}

/* 首页实景大图横幅 */
.hero-banner-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-color);
  background: #0c1218;
  margin-bottom: 16px;
}
.hero-img-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: 350px;
  overflow: hidden;
}
.hero-img-wrap img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
#hero-img-cursed {
  opacity: 0;
  transition: opacity 0.6s ease;
}
body.banner-mutated #hero-img-cursed {
  opacity: 1;
}
body.phase-3 .hero-img-wrap img {
  filter: contrast(1.12) brightness(0.86);
}

.hero-caption-bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 14px;
  background: linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.78) 100%);
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 10px;
}
.hero-caption-title {
  font-size: 15px;
  font-weight: 600;
}
.hero-caption-sub {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.82);
}

/* 保安亭隐藏热点（仅在异化后触发） */
#booth-hotspot {
  display: none;
  position: absolute;
  right: 11%;
  top: 42%;
  padding: 4px 9px;
  background: rgba(15, 20, 18, 0.82);
  border: 1px solid rgba(190, 60, 60, 0.7);
  color: #e6c6c6;
  font-size: 12px;
  border-radius: 2px;
  cursor: pointer;
}
body.banner-mutated #booth-hotspot {
  display: block;
}
#booth-hotspot:hover {
  background: rgba(120, 20, 20, 0.9);
  color: #fff;
}

/* 公告列表 */
.notice-list {
  list-style: none;
}
.notice-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 9px 6px;
  border-bottom: 1px dashed var(--border-color);
  cursor: pointer;
  transition: background 0.15s;
}
.notice-item:last-child {
  border-bottom: none;
}
.notice-item:hover {
  background: var(--bg-subtle);
}
.notice-item-left {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.notice-tag {
  flex-shrink: 0;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 2px;
  background: var(--brand-light);
  color: var(--brand-primary);
  font-weight: 600;
}
.notice-tag.urgent {
  background: #fdeaea;
  color: var(--accent-red);
}
body.phase-3 .notice-tag.urgent {
  background: #3c1616;
  color: #ef9a9a;
}
.notice-title-text {
  font-size: 14px;
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.notice-item.unread .notice-title-text {
  font-weight: 600;
}
.notice-date {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-muted);
}

/* 菜篮子价格表 */
.market-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.market-table th, .market-table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}
.market-table th {
  background: var(--bg-subtle);
  color: var(--text-sub);
  font-weight: 600;
}
.price-up { color: #c92a2a; }
.price-down { color: #1f7a4c; }
.price-eerie { color: #b83333; font-weight: 700; }

/* 侧栏便民服务宫格 */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.quick-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 6px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 3px;
  color: var(--text-main);
  font-size: 12px;
  text-align: center;
  transition: all 0.15s;
}
.quick-tile:hover {
  border-color: var(--brand-primary);
  background: var(--brand-light);
  color: var(--brand-dark);
}
body.phase-3 .quick-tile:hover {
  border-color: #8f2222;
  background: #281b1b;
  color: #e2c5c5;
}
.quick-icon {
  font-size: 20px;
  line-height: 1;
}

/* 失物预览小卡片 */
.lost-mini-card {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  cursor: pointer;
}
.lost-mini-card:hover {
  border-color: var(--brand-primary);
}
.lost-mini-card img {
  width: 78px;
  height: 58px;
  object-fit: cover;
  border: 1px solid var(--border-strong);
  flex-shrink: 0;
}
.lost-mini-info h4 {
  font-size: 13px;
  color: var(--text-main);
  margin-bottom: 2px;
}
.lost-mini-info p {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.4;
}

/* 值班电话框 */
.duty-list {
  list-style: none;
  font-size: 13px;
}
.duty-list li {
  display: flex;
  justify-content: space-between;
  padding: 7px 0;
  border-bottom: 1px dashed var(--border-color);
}
.duty-list li:last-child { border-bottom: none; }
.duty-phone { font-weight: 600; color: var(--brand-primary); }
body.phase-3 .duty-phone { color: #b56565; }

/* ---------- 红头文件公告正文阅读器 ---------- */
.doc-layout {
  display: grid;
  grid-template-columns: 310px 1fr;
  gap: 16px;
}
@media (max-width: 820px) {
  .doc-layout { grid-template-columns: 1fr; }
}

.doc-paper {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 28px 34px 36px;
  min-height: 460px;
}
.doc-red-header {
  text-align: center;
  font-family: var(--font-doc);
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-red);
  letter-spacing: 3px;
  padding-bottom: 12px;
  border-bottom: 3px double var(--accent-red);
  margin-bottom: 18px;
}
.doc-meta {
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
}
.doc-heading {
  font-size: 19px;
  font-weight: 700;
  text-align: center;
  margin-bottom: 18px;
  color: var(--text-main);
}
.doc-content {
  font-size: 15px;
  line-height: 1.9;
  color: var(--text-main);
}
.doc-content p {
  text-indent: 2em;
  margin-bottom: 12px;
}
.doc-rule-weird {
  color: var(--text-main);
  padding: 8px 12px;
  background: rgba(160, 30, 30, 0.06);
  border-left: 3px solid var(--accent-red);
  text-indent: 0 !important;
  margin: 12px 0;
}
body.phase-3 .doc-rule-weird {
  background: rgba(140, 20, 20, 0.18);
  color: #e5b7b7;
}
.doc-signoff {
  margin-top: 28px;
  text-align: right;
  font-size: 14px;
  position: relative;
}
.official-stamp {
  position: absolute;
  right: 12px;
  bottom: -14px;
  width: 96px;
  height: 96px;
  border: 3px solid rgba(201, 42, 42, 0.65);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: rgba(201, 42, 42, 0.72);
  font-size: 11px;
  font-weight: 700;
  transform: rotate(-14deg);
  pointer-events: none;
  text-align: center;
  line-height: 1.3;
}
body.phase-3 .official-stamp {
  border-color: rgba(160, 20, 20, 0.85);
  color: rgba(185, 45, 45, 0.9);
}

/* ---------- 失物招领卡片与翻转照片检视器 ---------- */
.lost-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (max-width: 720px) {
  .lost-grid { grid-template-columns: 1fr; }
}
.lost-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.lost-card.featured {
  border-color: var(--border-strong);
  grid-column: 1 / -1;
}
body.phase-3 .lost-card {
  background: #202723;
  border-color: #3a4740;
}
body.phase-3 .lost-card strong {
  color: #edf2ec;
}
.photo-inspect-box {
  display: grid;
  grid-template-columns: 1.15fr 1fr;
  gap: 18px;
  align-items: start;
}
@media (max-width: 760px) {
  .photo-inspect-box { grid-template-columns: 1fr; }
}
.photo-frame {
  position: relative;
  background: #1a1a1a;
  border: 6px solid #ede8db;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.18);
  aspect-ratio: 16 / 10;
  overflow: hidden;
}
.photo-frame img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#family-photo-cursed {
  opacity: 0;
  transition: opacity 0.45s ease;
}
.photo-frame.cursed #family-photo-cursed {
  opacity: 1;
}
.photo-frame.zoomed img {
  transform: scale(1.65) translate(12%, 4%);
  transition: transform 0.7s ease;
}
.photo-back-face {
  position: absolute;
  inset: 0;
  background: #dfd8c4;
  color: #5b1818;
  padding: 24px;
  display: none;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-family: var(--font-doc);
  box-shadow: inset 0 0 35px rgba(50, 35, 20, 0.28);
}
.photo-frame.show-back .photo-back-face {
  display: flex;
}
.handwriting-note {
  font-size: 20px;
  line-height: 1.8;
  transform: rotate(-3deg);
  letter-spacing: 2px;
  font-weight: 700;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--brand-primary);
  color: #fff;
  border: 1px solid var(--brand-primary);
  border-radius: 3px;
  font-size: 13px;
  font-weight: 500;
}
.btn-primary:hover {
  background: var(--brand-dark);
}
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  font-size: 13px;
}
.btn-secondary:hover {
  border-color: var(--brand-primary);
}
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 18px;
  background: #9e1b1b;
  color: #fff;
  border: 1px solid #c93232;
  border-radius: 3px;
  font-size: 13px;
  font-weight: 700;
  animation: dangerPulse 1.8s infinite;
}
@keyframes dangerPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(185, 35, 35, 0.55); }
  50% { box-shadow: 0 0 0 9px rgba(185, 35, 35, 0); }
}

/* ---------- 便民缴费 ---------- */
.bill-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}
.bill-form select, .bill-form input {
  height: 36px;
  padding: 0 10px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 14px;
}
.bill-result-box {
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  padding: 16px;
}
.bill-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-color);
}
.bill-row:last-child { border-bottom: none; }

/* ---------- 小区安防监控（NVR 风格四宫格） ---------- */
.cctv-shell {
  background: #0d1210;
  border: 1px solid #26312c;
  padding: 14px;
  color: #c5d4c9;
}
.cctv-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid #24302a;
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
}
.cctv-status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #e03131;
  margin-right: 6px;
  animation: recBlink 1.1s steps(2) infinite;
}
@keyframes recBlink {
  0% { opacity: 1; }
  50% { opacity: 0.15; }
}
.cctv-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
@media (max-width: 720px) {
  .cctv-grid { grid-template-columns: 1fr; }
}
.cctv-feed {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #050706;
  border: 1px solid #2c3a33;
  overflow: hidden;
  cursor: pointer;
}
.cctv-feed:hover {
  border-color: #5b826d;
}
.cctv-feed.selected {
  border: 2px solid #59a87a;
}
.cctv-feed img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.45) contrast(1.12) brightness(0.9);
}
.cctv-feed.nightvision img {
  filter: sepia(0.85) hue-rotate(78deg) saturate(1.8) contrast(1.25) brightness(0.85);
}
.cctv-feed img.alt-layer {
  opacity: 0;
  transition: opacity 0.12s steps(2);
}
.cctv-feed.anomaly img.alt-layer {
  opacity: 1;
}
.cctv-scanline {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.24) 0px, rgba(0, 0, 0, 0.24) 1px, transparent 2px, transparent 4px);
}
.cctv-osd-top {
  position: absolute;
  top: 8px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  color: rgba(232, 245, 234, 0.92);
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
}
.cctv-osd-bottom {
  position: absolute;
  bottom: 7px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  font-family: Consolas, "Courier New", monospace;
  font-size: 11px;
  color: rgba(210, 230, 214, 0.85);
  text-shadow: 0 1px 2px #000;
  pointer-events: none;
}
.cctv-offline-screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 16px;
  background: radial-gradient(circle, #131b17 0%, #050706 100%);
  color: #7d8e83;
  font-family: Consolas, "Courier New", monospace;
}
.cctv-cam4-active {
  background: radial-gradient(circle, rgba(90, 12, 12, 0.35) 0%, #050505 85%);
  color: #f0b3b3;
}
.cctv-noise-burst {
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, rgba(255,255,255,0.22) 0 2px, rgba(0,0,0,0.4) 2px 5px);
  opacity: 0;
  pointer-events: none;
}
.cctv-feed.glitching .cctv-noise-burst {
  opacity: 0.75;
}

.cctv-btn {
  padding: 5px 11px;
  background: #1b2620;
  border: 1px solid #35473e;
  color: #d2e0d6;
  font-size: 12px;
  border-radius: 2px;
}
.cctv-btn:hover {
  background: #283830;
}

/* ---------- 业主留言板 ---------- */
.board-form {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 14px;
  margin-bottom: 16px;
}
.board-form textarea {
  width: 100%;
  min-height: 76px;
  padding: 10px;
  border: 1px solid var(--border-strong);
  border-radius: 3px;
  background: var(--bg-card);
  color: var(--text-main);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
  margin-bottom: 10px;
}
.msg-item {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-color);
}
.msg-item:last-child { border-bottom: none; }
.msg-item.panic {
  background: rgba(165, 25, 25, 0.06);
  border-left: 3px solid var(--accent-red);
}
body.phase-3 .msg-item.panic {
  background: rgba(145, 20, 20, 0.16);
}
.msg-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-sub);
  margin-bottom: 5px;
}
.msg-author {
  font-weight: 700;
  color: var(--text-main);
}
.msg-body {
  font-size: 14px;
  color: var(--text-main);
  margin-bottom: 8px;
}
.msg-reply {
  background: var(--bg-subtle);
  border-left: 3px solid var(--brand-primary);
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-sub);
}
.msg-reply-tag {
  color: var(--brand-primary);
  font-weight: 700;
  margin-right: 6px;
}
body.phase-3 .msg-reply {
  border-left-color: #7c2424;
  color: #b4bab4;
}

/* ---------- 住户档案 ---------- */
.archive-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.archive-table th, .archive-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-color);
  text-align: left;
}
.archive-table th {
  background: var(--bg-subtle);
  color: var(--text-sub);
}
.archive-row-404 {
  background: rgba(175, 28, 28, 0.06);
  font-weight: 600;
}
body.phase-3 .archive-row-404 {
  background: rgba(145, 18, 18, 0.22);
}
.dossier-box {
  margin-top: 16px;
  border: 1px solid var(--border-strong);
  background: var(--bg-subtle);
  padding: 18px;
}
.access-log {
  list-style: none;
  margin-top: 12px;
  font-family: Consolas, "Microsoft YaHei", monospace;
  font-size: 13px;
}
.access-log li {
  padding: 7px 10px;
  border-bottom: 1px dashed var(--border-color);
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.access-log li.alert-row {
  color: #d93838;
  font-weight: 700;
  background: rgba(180, 20, 20, 0.1);
}

/* ---------- 底部官方备案栏 ---------- */
.site-footer {
  background: #e4eaf2;
  border-top: 1px solid var(--border-color);
  padding: 20px 16px 26px;
  text-align: center;
  font-size: 12px;
  color: var(--text-sub);
  line-height: 1.9;
  transition: background-color 1.8s ease;
}
body.phase-2 .site-footer { background: #c5ccc8; }
body.phase-3 .site-footer { background: #0d100e; border-top-color: #242b27; color: #758077; }

/* ---------- 右下角经典「小福在线客服」浮窗 ---------- */
.chat-fab {
  position: fixed;
  right: 16px;
  bottom: 14px;
  z-index: 840;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  background: var(--brand-primary);
  color: #fff;
  border: none;
  border-radius: 24px;
  box-shadow: 0 4px 16px rgba(10, 42, 82, 0.28);
  font-size: 13px;
  font-weight: 600;
}
body.phase-3 .chat-fab {
  background: #2a1818;
  border: 1px solid #7c2424;
  color: #e4c7c7;
}
.chat-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #40c057;
  box-shadow: 0 0 6px #40c057;
}
body.phase-3 .chat-dot {
  background: #d92626;
  box-shadow: 0 0 8px #d92626;
}
.chat-unread {
  display: none;
  background: #e03131;
  color: #fff;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
}
.chat-unread.show { display: inline-block; }

.chat-drawer {
  position: fixed;
  right: 22px;
  bottom: 76px;
  width: 340px;
  max-width: calc(100vw - 32px);
  height: 440px;
  background: var(--bg-card);
  border: 1px solid var(--border-strong);
  border-radius: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
  z-index: 845;
  display: none;
  flex-direction: column;
  overflow: hidden;
}
.chat-drawer.open { display: flex; }

.chat-drawer-head {
  background: var(--brand-primary);
  color: #fff;
  padding: 11px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
}
body.phase-3 .chat-drawer-head { background: #1e1313; border-bottom: 1px solid #4d1e1e; }

.chat-messages {
  flex: 1;
  padding: 12px;
  overflow-y: auto;
  background: var(--bg-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-bubble {
  max-width: 86%;
  padding: 8px 11px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
}
.chat-bubble.bot {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}
.chat-bubble.bot.eerie {
  background: #1f1414;
  border-color: #6b2222;
  color: #e8c7c7;
}
.chat-bubble.user {
  align-self: flex-end;
  background: var(--brand-primary);
  color: #fff;
}

.chat-quick-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
}
.chat-chip {
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 12px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  color: var(--text-main);
}
.chat-chip:hover {
  border-color: var(--brand-primary);
}

.chat-input-bar {
  display: flex;
  border-top: 1px solid var(--border-color);
  background: var(--bg-card);
}
.chat-input-bar input {
  flex: 1;
  border: none;
  padding: 10px 12px;
  font-size: 13px;
  background: transparent;
  color: var(--text-main);
  outline: none;
}
.chat-input-bar button {
  padding: 0 15px;
  border: none;
  background: var(--brand-primary);
  color: #fff;
  font-size: 13px;
}

/* ---------- 诡异系统弹窗（Phase 3 不可忽略调查框） ---------- */
.forced-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 6, 0.78);
  z-index: 900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.forced-modal-backdrop.open { display: flex; }
.forced-modal {
  width: 430px;
  max-width: 100%;
  background: #1a1f1c;
  border: 1px solid #632424;
  color: #dbe2dc;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.85);
}
.forced-modal-head {
  background: #3b1313;
  padding: 11px 15px;
  font-weight: 700;
  font-size: 14px;
  color: #f3c6c6;
  display: flex;
  justify-content: space-between;
}
.forced-modal-body {
  padding: 18px 18px 20px;
  font-size: 14px;
  line-height: 1.75;
}
.forced-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 18px;
}

/* ==========================================================================
   PHASE 4: 电影级全屏猫眼恐怖片终局 (#cinema-finale)
   ========================================================================== */
#cinema-finale {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #020303;
  color: #dce3dd;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  user-select: none;
}
#cinema-finale.active {
  display: flex;
}

#grain-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2030;
  opacity: 0.42;
}

/* 电影上下黑边（宽银幕感） */
.cinema-letterbox-top, .cinema-letterbox-bottom {
  position: absolute;
  left: 0;
  right: 0;
  height: 44px;
  background: #000;
  z-index: 2025;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  color: rgba(205, 222, 210, 0.72);
  letter-spacing: 1px;
}
.cinema-letterbox-top { top: 0; }
.cinema-letterbox-bottom { bottom: 0; }

/* 跳闸序幕文字层 */
.finale-intro-stage {
  position: relative;
  z-index: 2020;
  text-align: center;
  max-width: 520px;
  padding: 24px;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}
.finale-intro-stage.show { display: flex; }

.finale-eyebrow {
  font-family: Consolas, monospace;
  font-size: 13px;
  color: #8ea393;
  letter-spacing: 3px;
}
.finale-intro-text {
  font-family: var(--font-doc);
  font-size: 22px;
  line-height: 1.8;
  color: #e4ebe5;
  text-shadow: 0 0 18px rgba(170, 215, 185, 0.16);
}
.finale-action-btn {
  padding: 12px 28px;
  background: rgba(18, 26, 22, 0.92);
  border: 1px solid rgba(170, 200, 180, 0.42);
  color: #e9f2eb;
  font-size: 15px;
  letter-spacing: 2px;
  border-radius: 2px;
  transition: all 0.2s;
}
.finale-action-btn:hover {
  background: rgba(125, 22, 22, 0.85);
  border-color: #d94646;
  color: #fff;
}

/* 猫眼圆形光学鱼眼舞台 */
.peephole-stage {
  position: relative;
  z-index: 2015;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
.peephole-stage.show { display: flex; }

.peephole-housing {
  position: relative;
  width: min(68vmin, 560px);
  height: min(68vmin, 560px);
  border-radius: 50%;
  padding: 16px;
  background: radial-gradient(circle, #2a2620 0%, #151412 58%, #050505 100%);
  box-shadow:
    0 0 0 6px #0b0b0b,
    0 0 0 14px #171614,
    0 0 90px rgba(0, 0, 0, 0.95),
    inset 0 0 28px rgba(0, 0, 0, 0.95);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.08s linear;
}
.peephole-housing.door-knock {
  animation: doorKnockShake 0.45s cubic-bezier(0.36, 0.07, 0.19, 0.97);
}
.peephole-housing.door-violent {
  animation: doorViolentShake 0.14s linear infinite;
}
.peephole-stage.climax-hit .peephole-housing {
  animation: climaxLunge 0.16s cubic-bezier(0.1, 0.9, 0.2, 1) forwards, climaxTremble 0.085s linear 0.16s infinite;
  box-shadow: 0 0 0 8px #080808, 0 0 140px rgba(180, 10, 10, 0.65);
}

@keyframes climaxLunge {
  0% { transform: scale(0.92); }
  65% { transform: scale(1.72) rotate(-1.6deg); }
  100% { transform: scale(1.58) rotate(1.1deg); }
}
@keyframes climaxTremble {
  0% { transform: scale(1.58) translate(-12px, 6px) rotate(-1.4deg); }
  25% { transform: scale(1.66) translate(13px, -8px) rotate(1.5deg); }
  50% { transform: scale(1.60) translate(-10px, -9px) rotate(-1.1deg); }
  75% { transform: scale(1.68) translate(11px, 7px) rotate(1.3deg); }
  100% { transform: scale(1.58) translate(-12px, 6px) rotate(-1.4deg); }
}

@keyframes doorKnockShake {
  0%, 100% { transform: scale(1) translate(0, 0); }
  15% { transform: scale(1.035) translate(-6px, 3px); }
  30% { transform: scale(0.99) translate(5px, -4px); }
  50% { transform: scale(1.025) translate(-4px, -2px); }
  75% { transform: scale(1.01) translate(3px, 2px); }
}
@keyframes doorViolentShake {
  0% { transform: translate(-8px, 4px) scale(1.04) rotate(-0.8deg); }
  25% { transform: translate(9px, -5px) scale(1.06) rotate(0.9deg); }
  50% { transform: translate(-7px, -6px) scale(1.05) rotate(-0.6deg); }
  75% { transform: translate(8px, 5px) scale(1.07) rotate(0.7deg); }
  100% { transform: translate(-8px, 4px) scale(1.04) rotate(-0.8deg); }
}

.peephole-lens {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  overflow: hidden;
  background: #000;
  box-shadow: inset 0 0 42px 16px rgba(0, 0, 0, 0.96);
}

.peephole-parallax {
  position: absolute;
  inset: -6%;
  width: 112%;
  height: 112%;
  will-change: transform;
  animation: breathingCam 6.5s ease-in-out infinite;
}
@keyframes breathingCam {
  0%, 100% { margin-top: 0px; }
  50% { margin-top: 4px; }
}

.peephole-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  pointer-events: none;
}
.peephole-img.active {
  opacity: 1;
}

/* 贴脸高能时的色差重影层 */
.peephole-rgb-ghost {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  mix-blend-mode: screen;
  pointer-events: none;
}
.peephole-stage.climax-hit .peephole-img.active {
  filter: contrast(1.38) brightness(1.08) saturate(0.75);
}
.peephole-stage.climax-hit .peephole-rgb-ghost {
  opacity: 0.62;
  filter: hue-rotate(135deg) contrast(1.85);
  animation: rgbTear 0.09s steps(2) infinite;
}
@keyframes rgbTear {
  0% { transform: translate(-9px, 2px) scale(1.05); }
  50% { transform: translate(10px, -3px) scale(1.08); }
  100% { transform: translate(-6px, 0) scale(1.04); }
}

/* 走廊声控灯熄灭遮罩 */
.peephole-blackout {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  z-index: 12;
  pointer-events: none;
  transition: opacity 0.06s linear;
}
.peephole-blackout.dark { opacity: 0.99; }
.peephole-blackout.flicker {
  animation: bulbFlicker 0.6s steps(2) forwards;
}
@keyframes bulbFlicker {
  0% { opacity: 0.98; }
  18% { opacity: 0.1; }
  34% { opacity: 0.96; }
  52% { opacity: 0.25; }
  70% { opacity: 0.9; }
  100% { opacity: 0; }
}

/* 猫眼玻璃折射高光与暗角 */
.peephole-glass-overlay {
  position: absolute;
  inset: 0;
  z-index: 15;
  border-radius: 50%;
  pointer-events: none;
  background:
    radial-gradient(circle at 34% 28%, rgba(255, 255, 255, 0.09) 0%, transparent 26%),
    radial-gradient(circle at center, transparent 52%, rgba(0, 0, 0, 0.62) 78%, rgba(0, 0, 0, 0.98) 100%);
}

/* 玻璃裂纹 SVG（高能贴脸瞬间浮现） */
.peephole-crack {
  position: absolute;
  inset: 0;
  z-index: 18;
  opacity: 0;
  pointer-events: none;
}
.peephole-stage.climax-hit .peephole-crack {
  opacity: 0.85;
}

/* 电影高能白闪/反色闪回 */
.cinema-strobe {
  position: fixed;
  inset: 0;
  z-index: 2040;
  pointer-events: none;
  opacity: 0;
  background: #fff;
}
.cinema-strobe.fire {
  animation: climaxStrobe 0.65s steps(2) forwards;
}
@keyframes climaxStrobe {
  0% { opacity: 0.9; background: #e8f5ec; }
  18% { opacity: 0; }
  34% { opacity: 0.72; background: #700a0a; }
  52% { opacity: 0; }
  68% { opacity: 0.55; background: #ffffff; }
  100% { opacity: 0; }
}

/* 电影台词字幕与抉择按钮 */
.cinema-subtitle-bar {
  position: absolute;
  bottom: 70px;
  left: 50%;
  transform: translateX(-50%);
  width: min(760px, 92vw);
  text-align: center;
  z-index: 2035;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}
.cinema-subtitle {
  font-family: var(--font-doc);
  font-size: 21px;
  letter-spacing: 2px;
  color: #eef4ef;
  text-shadow: 0 2px 10px #000, 0 0 24px rgba(0, 0, 0, 0.95);
  min-height: 32px;
}
.cinema-subtitle.scream {
  font-size: 46px;
  font-weight: 900;
  color: #d92626;
  letter-spacing: 16px;
  text-shadow: 0 0 28px rgba(215, 20, 20, 0.85), 3px -2px 0 rgba(255, 255, 255, 0.35);
}
.cinema-choices {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}

/* 终局尾声：冷冰冰的青槐新村回执 */
.finale-epilogue {
  position: relative;
  z-index: 2035;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 20px;
  max-width: 480px;
  width: 92vw;
}
.finale-epilogue.show { display: flex; }

.epilogue-receipt {
  width: 100%;
  background: rgba(16, 22, 20, 0.94);
  border: 1px solid #3c4d45;
  border-top: 4px solid #145ca8;
  padding: 24px 26px;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.9);
}
.epilogue-receipt h2 {
  font-size: 16px;
  color: #a6c4e2;
  margin-bottom: 14px;
  letter-spacing: 1px;
}
.epilogue-receipt p {
  font-size: 14px;
  line-height: 1.9;
  color: #cdd7cf;
  margin-bottom: 10px;
}
.epilogue-highlight {
  color: #e06c6c;
  font-weight: 700;
}
.epilogue-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
