/* ============================================================
   招考 AI 助手（第104轮）：首页入口卡 + 悬浮球 + 对话面板
   ============================================================ */

/* ---------- 首页入口卡 ---------- */
.ai-hero { display: flex; align-items: center; gap: 16px; margin: 16px 0 4px; padding: 16px 20px;
  border-radius: 16px; background: linear-gradient(120deg, #0B2545 0%, #123F74 48%, #1A73E8 100%);
  color: #fff; cursor: pointer; position: relative; overflow: hidden;
  box-shadow: 0 8px 24px rgba(13, 45, 90, .16); transition: transform .18s, box-shadow .18s; }
.ai-hero::after { content: ""; position: absolute; right: -40px; top: -60px; width: 200px; height: 200px;
  border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.16), transparent 70%); }
.ai-hero:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(13, 45, 90, .22); }
.ai-hero-ic { width: 52px; height: 52px; border-radius: 14px; flex: none; display: flex; align-items: center;
  justify-content: center; font-size: 28px; background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.22); }
.ai-hero-tx { flex: 1; min-width: 0; position: relative; z-index: 1; }
.ai-hero-tx b { display: block; font-size: 16px; margin-bottom: 4px; letter-spacing: .3px; }
.ai-hero-tx p { margin: 0; font-size: 12.5px; line-height: 1.65; color: rgba(255,255,255,.86); }
.ai-hero-go { flex: none; font-size: 13px; font-weight: 600; padding: 8px 16px; border-radius: 999px;
  background: #fff; color: #123F74; position: relative; z-index: 1; white-space: nowrap; }
.ai-hero-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; position: relative; z-index: 1; }
.ai-hero-chips button { font-size: 12px; padding: 5px 12px; border-radius: 999px; cursor: pointer;
  background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.28); color: #fff; transition: .15s; }
.ai-hero-chips button:hover { background: rgba(255,255,255,.24); }

/* ---------- 悬浮机器人（第120轮）：替代左缘把手，全屏可拖动、点按开面板 ---------- */
.ai-bot { position: fixed; left: 48px; top: 45%; z-index: 9050; width: 64px; height: 64px;
  padding: 0; border: none; background: transparent; cursor: grab; touch-action: none;
  user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
  display: none; }
.ai-bot.on { display: block; animation: botIn .32s ease-out; }
.ai-bot.hide { display: none !important; } /* 面板打开时藏起 */
.ai-bot.drag { cursor: grabbing; }
.ai-bot.drag .bot-body, .ai-bot.drag .ai-bot-bubble { animation-play-state: paused; }
.ai-bot-svg { width: 100%; height: 100%; display: block;
  filter: drop-shadow(0 6px 14px rgba(13, 45, 90, .30)); transition: filter .18s; }
.ai-bot:hover .ai-bot-svg { filter: drop-shadow(0 10px 22px rgba(13, 45, 90, .42)); }
@keyframes botIn { from { opacity: 0; } to { opacity: 1; } }
/* 身体呼吸浮动 + 眨眼 + 天线小球闪烁 */
.bot-body { animation: botBob 2.8s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes botBob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-2.6px); } }
.bot-eye { transform-box: fill-box; transform-origin: center; animation: botBlink 4.4s infinite; }
@keyframes botBlink { 0%, 93%, 100% { transform: scaleY(1); } 96% { transform: scaleY(.12); } }
.bot-ant { animation: botAnt 1.6s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes botAnt { 0%, 100% { opacity: 1; } 50% { opacity: .45; } }
/* 首次引导气泡「问小优」 */
.ai-bot-bubble { position: absolute; left: 50%; top: -27px; transform: translateX(-38%);
  background: #fff; color: #C7000B; font-size: 11px; font-weight: 700; white-space: nowrap;
  padding: 3px 10px; border-radius: 999px; border: 1px solid #F3D6D6;
  box-shadow: 0 3px 10px rgba(13, 45, 90, .16); pointer-events: none;
  animation: botBubble 2.2s ease-in-out infinite; }
.ai-bot-bubble::after { content: ""; position: absolute; left: 55%; bottom: -4.5px; width: 8px; height: 8px;
  background: #fff; border-right: 1px solid #F3D6D6; border-bottom: 1px solid #F3D6D6;
  transform: rotate(45deg); border-radius: 2px; }
.ai-bot.seen .ai-bot-bubble, .ai-bot.drag .ai-bot-bubble { display: none; }
@keyframes botBubble { 0%, 100% { transform: translateX(-38%) translateY(0); } 50% { transform: translateX(-38%) translateY(-3px); } }

/* ---------- 对话浮层 ---------- */
.ai-wrap { display: none; position: fixed; inset: 0; z-index: 9000; }
.ai-wrap.on { display: block; }
.ai-mask { position: absolute; inset: 0; background: rgba(10, 24, 44, .38); backdrop-filter: blur(2px);
  animation: aiFade .2s ease-out; }
@keyframes aiFade { from { opacity: 0; } to { opacity: 1; } }
/* 桌面端面板从左侧把手处拉出 */
.ai-panel { position: absolute; left: 66px; bottom: 26px; width: 400px; max-width: calc(100vw - 88px);
  height: min(620px, 76vh); display: flex; flex-direction: column; overflow: hidden; background: #fff;
  border-radius: 18px; box-shadow: 0 24px 60px rgba(8, 26, 52, .28); animation: aiUp .22s ease-out; }
@keyframes aiUp { from { opacity: 0; transform: translateX(-16px); } to { opacity: 1; transform: none; } }
body.ai-lock { overflow: hidden; }

/* 头部 */
.ai-hd { display: flex; align-items: center; gap: 10px; padding: 12px 14px; flex: none;
  background: linear-gradient(120deg, #0B2545, #123F74 55%, #1A73E8); color: #fff; }
.ai-ava { width: 36px; height: 36px; border-radius: 11px; background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.24); display: flex; align-items: center; justify-content: center; font-size: 20px; flex: none; }
.ai-hd-tx { flex: 1; min-width: 0; }
.ai-hd-tx b { display: block; font-size: 14.5px; }
.ai-hd-tx span { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: rgba(255,255,255,.82); margin-top: 1px; }
.ai-dot { width: 6px; height: 6px; border-radius: 50%; background: #4ADE80; box-shadow: 0 0 0 3px rgba(74,222,128,.22); }
.ai-hb { width: 30px; height: 30px; border-radius: 9px; border: 1px solid rgba(255,255,255,.24);
  background: rgba(255,255,255,.1); color: #fff; font-size: 14px; cursor: pointer; flex: none; transition: .15s; }
.ai-hb:hover { background: rgba(255,255,255,.22); }
.ai-hb.on { background: #fff; color: #123F74; }

/* 消息区 */
.ai-msgs { flex: 1; overflow-y: auto; padding: 14px; background: #F6F8FC; display: flex; flex-direction: column; gap: 10px; }
.ai-row { display: flex; gap: 8px; align-items: flex-start; }
.ai-row.u { justify-content: flex-end; }
.ai-ava-s { width: 26px; height: 26px; border-radius: 8px; background: #E8F1FE; display: flex;
  align-items: center; justify-content: center; font-size: 14px; flex: none; margin-top: 2px; }
.ai-col { max-width: 82%; }
.ai-b { font-size: 13.5px; line-height: 1.72; padding: 9px 12px; border-radius: 12px; word-break: break-word; }
.ai-b.ub { background: linear-gradient(135deg, #1A73E8, #2E8BF0); color: #fff; border-bottom-right-radius: 4px; max-width: 80%; }
.ai-b.ab { background: #fff; color: var(--ink, #1F2A37); border: 1px solid #E6ECF5; border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(20,45,80,.04); }
.ai-b.err { border-color: #F3D6D6; background: #FFF8F8; }
.ai-acts { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.ai-act { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px;
  color: #1A73E8; background: #F2F7FE; border: 1px solid #CFE2FA; border-radius: 9px; padding: 8px 12px;
  text-decoration: none; transition: .15s; }
.ai-act:hover { background: #E8F1FE; border-color: #A9CBEF; }
.ai-act span { font-size: 15px; line-height: 1; }
.ai-welcome { text-align: center; padding: 26px 12px 10px; color: var(--ink2, #4A5A6E); }
.ai-w-ic { width: 54px; height: 54px; margin: 0 auto 10px; border-radius: 16px; font-size: 28px;
  background: #E8F1FE; display: flex; align-items: center; justify-content: center; }
.ai-welcome b { display: block; font-size: 15px; color: var(--ink, #1F2A37); margin-bottom: 6px; }
.ai-welcome p { font-size: 12.5px; line-height: 1.75; margin: 0 6px; }
.ai-w-tip { font-size: 11.5px; color: #93A1B3; margin-top: 10px; }
/* 小优语音：再听一次 */
.ai-w-voice { margin-top: 12px; display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px;
  border-radius: 999px; border: 1px solid #CFE2F8; background: #F3F8FF; color: #1B62B8;
  font-size: 12.5px; font-family: inherit; cursor: pointer; transition: .15s; }
.ai-w-voice i { font-style: normal; font-size: 13px; }
.ai-w-voice:hover { background: #E4F0FF; border-color: #A9CBEF; }
.ai-w-voice:active { transform: scale(.97); }

/* 打字中 */
.ai-b.typing { display: flex; gap: 4px; align-items: center; padding: 12px; }
.ai-b.typing i { width: 6px; height: 6px; border-radius: 50%; background: #A9B8CC; animation: aiBlink 1.1s infinite; }
.ai-b.typing i:nth-child(2) { animation-delay: .18s; }
.ai-b.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes aiBlink { 0%, 60%, 100% { opacity: .35; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

/* 快捷问题 */
.ai-chips { flex: none; display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px; background: #fff;
  border-top: 1px solid #EEF2F8; scrollbar-width: none; }
.ai-chips::-webkit-scrollbar { display: none; }
.ai-chip { flex: none; font-size: 12px; padding: 5px 11px; border-radius: 999px; cursor: pointer;
  background: #F4F7FB; border: 1px solid #E3EAF4; color: #42566C; white-space: nowrap; transition: .15s; }
.ai-chip:hover { background: #EAF3FF; border-color: #BBD6F7; color: #1A6FE0; }

/* 输入区 */
.ai-kb-hint { flex: none; text-align: center; font-size: 11px; color: #C7861B; background: #FFF7E8; border-top: 1px solid #F6E7C8; padding: 5px 12px; line-height: 1.5; }
.ai-kb-hint[hidden] { display: none; }
.ai-in { flex: none; display: flex; align-items: flex-end; gap: 8px; padding: 8px 12px; background: #fff; border-top: 1px solid #EEF2F8; }
.ai-mic, .ai-send { flex: none; border: none; cursor: pointer; font-size: 13.5px; }
.ai-mic { width: 38px; height: 38px; border-radius: 50%; background: #F4F7FB; border: 1px solid #E3EAF4; font-size: 17px; }
.ai-mic.on { background: #FDECEC; border-color: #F3C2C2; animation: aiPulse 1.2s infinite; }
@keyframes aiPulse { 0% { box-shadow: 0 0 0 0 rgba(199,0,11,.28); } 70% { box-shadow: 0 0 0 10px rgba(199,0,11,0); } 100% { box-shadow: 0 0 0 0 rgba(199,0,11,0); } }
.ai-in textarea { flex: 1; min-width: 0; max-height: 90px; resize: none; font-family: inherit; font-size: 13.5px;
  line-height: 1.6; padding: 8px 10px; border: 1px solid #E3EAF4; border-radius: 10px; background: #FAFBFD;
  color: var(--ink, #1F2A37); outline: none; }
.ai-in textarea:focus { border-color: #1A73E8; background: #fff; box-shadow: 0 0 0 2px rgba(26,115,232,.1); }
.ai-send { height: 38px; padding: 0 16px; border-radius: 10px; background: #C7000B; color: #fff; font-weight: 600; }
.ai-send:disabled { background: #CBD5E1; cursor: default; }
/* 按住说话（微信式）：按住识别、松开发送；触屏设备隐藏小话筒，避免按钮拥挤 */
.ai-hold { flex: none; height: 38px; min-width: 88px; padding: 0 13px; border-radius: 10px; border: 1px solid #E3EAF4;
  background: #F4F7FB; color: #C7000B; font-size: 13.5px; font-weight: 600; cursor: pointer;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.ai-hold.rec { background: #C7000B; border-color: #C7000B; color: #fff; animation: aiHoldPulse 1.1s ease-in-out infinite; }
.ai-hold.cancel { background: #9AA4B2; border-color: #9AA4B2; color: #fff; animation: none; }
@keyframes aiHoldPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@media (pointer: coarse) { .ai-mic { display: none; } .ai-hold { flex: 0 0 auto; } }
.ai-tipbar { flex: none; font-size: 10.5px; color: #96A3B4; text-align: center; padding: 0 12px 8px; background: #fff; line-height: 1.5; }

/* ---------- 手机端 ---------- */
@media (max-width: 720px) {
  .ai-hero { padding: 14px; gap: 12px; margin: 12px 0 2px; border-radius: 14px; }
  .ai-hero-ic { width: 44px; height: 44px; font-size: 24px; border-radius: 12px; }
  .ai-hero-tx b { font-size: 14.5px; }
  .ai-hero-tx p { font-size: 12px; }
  .ai-hero-go { display: none; }
  .ai-hero-chips { gap: 6px; margin-top: 8px; }
  .ai-hero-chips button { font-size: 11.5px; padding: 4px 10px; }
  .ai-bot { width: 56px; height: 56px; z-index: 8800; } /* 手机端面板为全屏抽屉，机器人退回其下 */
  .ai-bot-bubble { top: -25px; font-size: 10.5px; }
  .ai-panel { left: 0; right: 0; bottom: 0; width: auto; max-width: none; height: 86vh;
    border-radius: 18px 18px 0 0; animation: aiSheet .24s ease-out; }
  @keyframes aiSheet { from { transform: translateY(30px); opacity: .6; } to { transform: none; opacity: 1; } }
  .ai-hd { padding: 10px 12px; }
  .ai-msgs { padding: 12px 10px; }
  .ai-b { font-size: 14px; }
  .ai-in { padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); }
  .ai-in textarea { font-size: 16px; } /* 16px 避免 iOS 聚焦自动放大 */
}

/* 手机端首页不显示 AI 入口卡，只保留悬浮机器人（第120轮） */
@media (max-width: 640px) {
  .ai-hero { display: none; }
}
