body { font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; }
.hero { background: linear-gradient(135deg, #0d6efd, #3b82f6); }
.hero h1 { font-size: 30px; line-height: 1.25; }
@media (max-width: 575px) {
  .hero h1 { font-size: 21px; line-height: 1.3; white-space: nowrap; }
}
.cat-card { background: #f1f5f9; transition: .2s; border: 1px solid #e2e8f0; }
.cat-card:hover { background: #e2e8f0; transform: translateY(-2px); }
.card { transition: .2s; border: none; }
.card:hover { transform: translateY(-3px); box-shadow: 0 .5rem 1rem rgba(0,0,0,.12) !important; }
.card-img-top { background: #eef2f7; }
a { color: inherit; }
.navbar-brand { letter-spacing: .5px; }

/* 全站留资浮窗 */
#floatCtaBtn {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 1050;
  font-weight: 700;
  padding: 12px 20px;
  animation: ctaPulse 2.2s infinite;
}
/* 详情页二维码：提层至 1051（高于咨询浮窗 1050、低于聊天浮钮 1060/面板 1061），
   滚动经过浮窗时二维码图案永不被遮挡；源图 954x954 无损不压缩 */
.od-qr-img { position: relative; z-index: 1051; }
@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 6px 18px rgba(255,193,7,.5); }
  50% { box-shadow: 0 6px 26px rgba(255,193,7,.9); }
}
@media (max-width: 575px) {
  #floatCtaBtn { right: 12px; bottom: 16px; padding: 10px 14px; font-size: 14px; }
}

/* 导航栏紧凑化：缩小导航项间距与字号，避免换行 */
.navbar-nav .nav-link { padding: .4rem .7rem; font-size: 15px; }
.navbar-brand { font-size: 18px; }
.navbar .dropdown-menu { border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.12); }
.navbar .dropdown-item { padding: .45rem 1rem; }
@media (max-width: 991px) {
  .navbar-collapse .navbar-text { margin-top: .5rem; text-align: left; }
}

/* ===================== 全屏晃动广告位 ===================== */
#homeAdOverlay {
  position: fixed; inset: 0; z-index: 1090;
  background: rgba(0,0,0,.55);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
#homeAdCard {
  position: relative;
  width: min(560px, 94vw);
  background: #fff; border-radius: 18px; overflow: hidden;
  box-shadow: 0 20px 60px rgba(0,0,0,.45);
  animation: adShake 1.6s ease-in-out infinite;
}
@keyframes adShake {
  0%, 100% { transform: translate(0,0) rotate(0deg); }
  15% { transform: translate(-6px,3px) rotate(-1.1deg); }
  30% { transform: translate(6px,-3px) rotate(1.1deg); }
  45% { transform: translate(-5px,2px) rotate(-0.8deg); }
  60% { transform: translate(5px,-2px) rotate(0.8deg); }
  75% { transform: translate(-3px,1px) rotate(-0.5deg); }
}
#homeAdCard.is-paused { animation-play-state: paused; }
#homeAdCard .ad-media { width: 100%; height: 240px; object-fit: cover; display: block; }
#homeAdCard .ad-body { padding: 18px 20px 20px; }
#homeAdCard .ad-school {
  display: inline-block; font-size: 12px; font-weight: 700;
  color: #d63384; background: #ffe3f1; border-radius: 999px; padding: 3px 12px; margin-bottom: 8px;
}
#homeAdCard .ad-title { font-size: 22px; font-weight: 800; color: #212529; margin: 0 0 6px; }
#homeAdCard .ad-subtitle { font-size: 15px; color: #6c757d; margin: 0 0 14px; line-height: 1.5; }
#homeAdCard .ad-cta {
  display: block; text-align: center; background: linear-gradient(135deg,#fd7e14,#ffc107);
  color: #212529; font-weight: 800; font-size: 16px; border-radius: 999px; padding: 12px; text-decoration: none;
}
#homeAdCard .ad-cta:hover { color: #212529; filter: brightness(.97); }
#homeAdClose {
  position: absolute; top: 10px; right: 10px; z-index: 2;
  width: 34px; height: 34px; border: none; border-radius: 50%;
  background: rgba(0,0,0,.5); color: #fff; font-size: 20px; line-height: 1; cursor: pointer;
}
#homeAdCard .ad-footnote {
  text-align: center; font-size: 11px; color: #adb5bd; margin-top: 10px;
}
@media (max-width: 575px) {
  #homeAdCard .ad-media { height: 170px; }
  #homeAdCard .ad-title { font-size: 19px; }
}

/* 广告位缩小态：全屏闪 1 秒后缩到右下角小挂件持续晃动 */
#homeAdOverlay { transition: background .45s ease; }
#homeAdOverlay.minimized { background: transparent; pointer-events: none; padding: 0; }
#homeAdCard { transition: width .45s ease; }
#homeAdCard.minimized {
  position: fixed; left: 14px; bottom: 96px; width: 180px;
  border-radius: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.35);
  pointer-events: auto; cursor: pointer; z-index: 1080;
  animation: none;
}
#homeAdCard.minimized .ad-media { height: 92px; }
#homeAdCard.minimized .ad-body { padding: 8px 10px 10px; }
#homeAdCard.minimized .ad-school { font-size: 10px; padding: 2px 8px; margin-bottom: 4px; }
#homeAdCard.minimized .ad-title { font-size: 13px; margin: 0 0 2px; }
#homeAdCard.minimized .ad-subtitle,
#homeAdCard.minimized .ad-cta,
#homeAdCard.minimized .ad-footnote { display: none; }
#homeAdCard.minimized #homeAdClose { width: 24px; height: 24px; font-size: 15px; top: 5px; right: 5px; }
@media (max-width: 575px) {
  #homeAdCard.minimized { right: 10px; bottom: 84px; width: 172px; }
  #homeAdCard.minimized .ad-media { height: 74px; }
}

/* ===================== 手机端精简化（≤575px） ===================== */
html, body { overflow-x: hidden; max-width: 100%; }

@media (max-width: 575px) {
  /* 学校卡片：按钮/徽章/标题整体收窄 */
  .card .btn { font-size: 12px; padding: .28rem .5rem; }
  .card .badge { font-size: 9px !important; padding: 2px 6px; }
  .card-title { font-size: 14px; }
  .card-body { padding: .5rem !important; }
  .card-img-top { height: 110px; }
  h4 { font-size: 17px; }
  h5 { font-size: 15px; }
  .container { padding-left: 10px; padding-right: 10px; }

  /* 全站咨询浮窗：缩小不挡内容 */
  #floatCtaBtn { right: 8px; bottom: 12px; padding: 8px 11px; font-size: 12px; }

  /* 广告挂件（缩小态）：全宽可见、更小巧 */
  #homeAdCard.minimized {
    left: 8px; right: auto; bottom: 12px; width: 120px;
    max-width: calc(100vw - 16px);
  }
  #homeAdCard.minimized .ad-media { height: 60px; }
  #homeAdCard.minimized .ad-body { padding: 5px 7px 7px; }
  #homeAdCard.minimized .ad-school { font-size: 9px; padding: 1px 6px; margin-bottom: 3px; }
  #homeAdCard.minimized .ad-title { font-size: 11px; margin: 0; }
  #homeAdCard.minimized #homeAdClose { width: 20px; height: 20px; font-size: 13px; top: 3px; right: 3px; }

  /* 缩小态静止，不再晃动抢戏、不遮挡内容观感 */
  #homeAdCard.minimized { animation: none; }
  @keyframes adShakeMobile {
    0%, 100% { transform: translate(0,0) rotate(0deg); }
    20% { transform: translate(-2px,1px) rotate(-.5deg); }
    40% { transform: translate(2px,-1px) rotate(.5deg); }
    60% { transform: translate(-2px,1px) rotate(-.4deg); }
    80% { transform: translate(1px,-1px) rotate(.3deg); }
  }
}

/* ============ 在线客服浮窗（对标学114：右下角聊天窗） ============ */
#chatLauncher {
  position: fixed;
  right: 20px;
  bottom: 92px;
  z-index: 1060;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #0d6efd, #0a58ca);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  box-shadow: 0 6px 18px rgba(13, 110, 253, .45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .15s ease;
}
#chatLauncher:hover { transform: scale(1.07); }
#chatLauncher .chat-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  background: #dc3545;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
}

#chatPanel {
  position: fixed;
  right: 20px;
  bottom: 160px;
  z-index: 1061;
  width: 360px;
  max-width: calc(100vw - 24px);
  max-height: min(560px, calc(100vh - 220px));
  display: none;
  flex-direction: column;
  background: #f5f7fa;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 14px 44px rgba(15, 34, 67, .28);
  font-size: 14px;
}
#chatPanel.open { display: flex; animation: chatPop .18s ease; }
/* 留资表单弹出态：面板拉高占满视口下部（临时盖住浮钮无妨），body 让位——
   保证 二维码卡 + 留资表单 + 输入区 三者同时完整可见，任何一项都不被裁切 */
#chatPanel.lead-open { bottom: 40px; max-height: calc(100vh - 40px); }
#chatPanel.lead-open #chatBody { min-height: 0; }
@keyframes chatPop { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

#chatPanel .chat-head {
  background: linear-gradient(135deg, #0d6efd, #0a58ca);
  color: #fff;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
#chatPanel .chat-head .chat-head-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #fff;
  padding: 2px;
  flex-shrink: 0;
}
#chatPanel .chat-head .chat-head-title { font-weight: 700; font-size: 15px; line-height: 1.2; }
#chatPanel .chat-head .chat-head-status { font-size: 12px; opacity: .92; display: flex; align-items: center; gap: 4px; }
#chatPanel .chat-head .chat-head-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #2ecc71; display: inline-block; }
#chatPanel .chat-head .chat-head-btns { margin-left: auto; display: flex; gap: 4px; }
#chatPanel .chat-head .chat-head-btns button {
  border: none;
  background: rgba(255, 255, 255, .18);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
}
#chatPanel .chat-head .chat-head-btns button:hover { background: rgba(255, 255, 255, .32); }

#chatBody {
  padding: 14px 12px;
  overflow-y: auto;
  flex: 1;
  min-height: 180px;
  scrollbar-width: thin;
}
.chat-msg { display: flex; gap: 8px; margin-bottom: 14px; }
.chat-msg .chat-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid #e3e8ef;
  padding: 2px;
}
.chat-msg .chat-msg-main { max-width: calc(100% - 46px); }
.chat-msg .chat-msg-meta { font-size: 12px; color: #8a94a6; margin-bottom: 3px; }
.chat-msg .chat-bubble {
  background: #fff;
  border: 1px solid #e6eaf1;
  border-radius: 4px 12px 12px 12px;
  padding: 9px 12px;
  line-height: 1.65;
  color: #1f2d3d;
  word-break: break-word;
  white-space: pre-line;
}
.chat-msg .chat-bubble a { color: #0d6efd; }
.chat-msg.chat-msg-user { flex-direction: row-reverse; }
.chat-msg.chat-msg-user .chat-avatar { display: none; }
.chat-msg.chat-msg-user .chat-msg-main { margin-left: auto; }
.chat-msg.chat-msg-user .chat-msg-meta { text-align: right; }
.chat-msg.chat-msg-user .chat-bubble {
  background: #0d6efd;
  border-color: #0d6efd;
  color: #fff;
  border-radius: 12px 4px 12px 12px;
}
/* 微信二维码卡：固定层不参与滚动；上下左右大留白（QR静区），四边任何元素都压不到 */
.chat-qr-card {
  position: relative;
  z-index: 5;
  flex-shrink: 0;
  margin: 0 10px 8px;
  background: #fff;
  border: 1px solid #e6eaf1;
  border-radius: 12px;
  padding: 18px 16px 14px;
  text-align: center;
}
/* 不压分辨率：源图954x954无损PNG，显示160px（浏览器缩放渲染，像素清晰）；固定宽高防布局抖动 */
.chat-qr-card img { width: 160px; height: 160px; max-width: 100%; display: block; margin: 0 auto; }
.chat-qr-card .chat-qr-note { font-size: 12px; color: #8a94a6; margin-top: 12px; line-height: 1.5; }
.chat-typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.chat-typing i { width: 7px; height: 7px; border-radius: 50%; background: #b6c0cf; animation: chatBlink 1.2s infinite; }
.chat-typing i:nth-child(2) { animation-delay: .2s; }
.chat-typing i:nth-child(3) { animation-delay: .4s; }
@keyframes chatBlink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

#chatLeadForm {
  margin-top: 8px;
  background: #fff;
  border: 1px solid #e6eaf1;
  border-radius: 12px;
  padding: 12px;
}
#chatLeadForm .chat-lead-title { font-weight: 700; font-size: 13px; margin-bottom: 8px; color: #1f2d3d; }
#chatLeadForm .form-control { font-size: 13px; margin-bottom: 8px; }
#chatLeadForm .btn { font-size: 13px; }
#chatLeadForm .chat-lead-msg { font-size: 12px; margin-top: 6px; }

#chatFoot { flex-shrink: 0; background: #fff; border-top: 1px solid #e6eaf1; }
.chat-chips { display: flex; gap: 6px; padding: 8px 10px 0; flex-wrap: wrap; }
.chat-chips button {
  border: 1px solid #cfe0ff;
  background: #eef5ff;
  color: #0d6efd;
  font-size: 12px;
  border-radius: 999px;
  padding: 4px 10px;
  cursor: pointer;
}
.chat-chips button:hover { background: #dbe9ff; }
.chat-input-row { display: flex; gap: 8px; padding: 8px 10px 10px; align-items: center; }
.chat-input-row .chat-tool {
  border: none;
  background: none;
  color: #8a94a6;
  font-size: 18px;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}
.chat-input-row input {
  flex: 1;
  border: 1px solid #e6eaf1;
  background: #f5f7fa;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  outline: none;
  min-width: 0;
}
.chat-input-row input:focus { border-color: #0d6efd; background: #fff; }
.chat-input-row .chat-send {
  border: none;
  background: #0d6efd;
  color: #fff;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.chat-input-row .chat-send:disabled { background: #9db9e8; cursor: not-allowed; }

@media (max-width: 576px) {
  #chatLauncher { right: 12px; bottom: 84px; width: 50px; height: 50px; font-size: 21px; }
  #chatPanel { right: 12px; bottom: 144px; width: calc(100vw - 24px); max-height: calc(100vh - 200px); }
  /* 小屏收紧二维码卡占位，保证 head+码+输入区总高不超面板，二维码永远完整可见 */
  #chatBody { min-height: 78px; }
  /* 表单弹出态：面板贴底拉满，body 让位，二维码+表单+输入区三者齐全 */
  #chatPanel.lead-open { bottom: 16px; max-height: calc(100vh - 32px); }
  .chat-qr-card { margin: 0 8px 6px; padding: 12px 12px 10px; }
  .chat-qr-card img { width: 132px; height: 132px; }
  .chat-qr-card .chat-qr-note { margin-top: 8px; font-size: 11px; }
}

/* 矮视口（横屏手机/极小窗口，≤500px 高）：面板贴底拉满，二维码缩至 100px 保完整可见；
   表单弹出时二维码让位（关闭即恢复），表单+输入区完整可操作。
   注意：本查询只影响 ≤500px 高的视口，常规竖屏手机(≥600px 高)与桌面窗口全部走上面的规则，不受影响 */
@media (max-height: 500px) {
  #chatPanel { bottom: 20px; max-height: calc(100vh - 40px); }
  #chatBody { min-height: 16px; }
  .chat-qr-card { margin: 0 8px 4px; padding: 8px 10px 6px; }
  .chat-qr-card img { width: 100px; height: 100px; }
  .chat-qr-note { display: none; }
  .chat-chips { display: none; }
  #chatPanel.lead-open .chat-qr-card { display: none; }
  #chatPanel.lead-open #chatLeadForm { padding: 8px; }
  #chatPanel.lead-open #chatLeadForm .form-control { margin-bottom: 6px; padding: 5px 10px; }
  #chatPanel.lead-open #chatLeadForm .btn { padding: 6px 12px; }
  #chatPanel.lead-open #chatLeadForm .chat-lead-msg { display: none; }
}
