/* ============ 智联 · 样式 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: #e8ebf1;
  color: #222;
  max-width: 480px;
  margin: 0 auto;
  box-shadow: 0 0 24px rgba(0,0,0,.15);
  overflow: hidden;
}
@media (min-width: 500px) { body { height: 100vh; } }

.screen { height: 100vh; height: 100dvh; display: flex; flex-direction: column; position: relative; background: #f5f6f8; }
.hidden { display: none !important; }
button { font-family: inherit; border: none; background: none; cursor: pointer; }

/* ============ 首页·新闻门面 ============ */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; padding-top: calc(12px + env(safe-area-inset-top));
  background: linear-gradient(135deg, #1e4c9c, #16386e); color: #fff;
  font-size: 17px; font-weight: 700;
}
.topbar-left { display: flex; align-items: center; gap: 7px; }
.logo-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff7a59; display: inline-block; }
.topbar-right { display: flex; align-items: center; gap: 10px; font-size: 12px; font-weight: 400; color: #c9d8f2; }
.lockbtn {
  font-size: 16px; width: 30px; height: 30px; border-radius: 8px;
  background: rgba(255,255,255,.14); line-height: 1;
}
.lockbtn:active { transform: scale(.92); }

.page { flex: 1; overflow-y: auto; padding: 12px 12px 20px; }

/* 图片新闻 2×2 网格 */
.photo-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ph-card { background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 4px rgba(30,60,120,.08); }
.ph-img { position: relative; }
.ph-img img { width: 100%; aspect-ratio: 5 / 3; object-fit: cover; display: block; }
.ph-tag {
  position: absolute; left: 8px; top: 8px; color: #fff; font-size: 10px;
  padding: 2px 8px; border-radius: 20px; font-weight: 600;
  background: rgba(0,0,0,.35); backdrop-filter: blur(3px);
}
.ph-title {
  font-size: 13px; line-height: 1.4; padding: 8px 10px 10px; font-weight: 500;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 44px;
}
@keyframes blink { 50% { opacity: .25; } }

.news-list { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.news-card {
  display: flex; gap: 12px; align-items: center; background: #fff;
  padding: 14px; border-radius: 12px; box-shadow: 0 1px 4px rgba(30,60,120,.07);
}
.nc-tag { flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px; color: #fff; font-size: 13px; display: flex; align-items: center; justify-content: center; font-weight: 600; }
.t-tech { background: linear-gradient(135deg,#3a7bd5,#2f6fe4); }
.t-fin  { background: linear-gradient(135deg,#f2a541,#e8871e); }
.t-life { background: linear-gradient(135deg,#43b97f,#2e9d63); }
.t-sport{ background: linear-gradient(135deg,#ef6a6a,#e04848); }
.t-cul  { background: linear-gradient(135deg,#9d6ad8,#7d48bd); }
.nc-title { font-size: 15px; line-height: 1.45; font-weight: 500; }
.nc-meta { font-size: 11px; color: #98a1b3; margin-top: 5px; }

.tabbar {
  display: flex; background: #fff; border-top: 1px solid #eceef3;
  padding-bottom: env(safe-area-inset-bottom);
}
.tab { flex: 1; text-align: center; padding: 8px 0 7px; font-size: 11px; color: #98a1b3; }
.tab span { display: block; font-size: 19px; margin-bottom: 2px; }
.tab.active { color: #2f6fe4; font-weight: 600; }

/* ============ 弹窗通用 ============ */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; max-width: 480px; margin: 0 auto; }
.mask { position: absolute; inset: 0; background: rgba(10,18,35,.55); }
.sheet {
  position: relative; width: 100%; background: #fff; border-radius: 18px 18px 0 0;
  padding: 20px 18px calc(18px + env(safe-area-inset-bottom));
  animation: up .22s ease;
}
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.sheet-title { font-size: 17px; font-weight: 700; text-align: center; }
.sheet-sub { font-size: 12px; color: #8b93a5; text-align: center; margin: 7px 0 4px; line-height: 1.6; }
.sheet-cancel { width: 100%; margin-top: 12px; padding: 12px; font-size: 15px; color: #666; background: #f2f4f8; border-radius: 12px; }
.txt-input {
  width: 100%; margin: 14px 0; padding: 13px 14px; font-size: 15px;
  border: 1.5px solid #e1e5ee; border-radius: 12px; outline: none; font-family: inherit;
}
.txt-input:focus { border-color: #2f6fe4; }
.btn-primary {
  width: 100%; padding: 13px; font-size: 15px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #2f6fe4, #1e4c9c); border-radius: 12px;
}
.btn-primary:active { opacity: .85; }

/* ============ 密码键盘 ============ */
.lock-sheet { text-align: center; }
.lock-dots { display: flex; justify-content: center; gap: 18px; margin: 18px 0 4px; }
.lock-dots span {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid #c3cadb;
  display: inline-block; transition: all .12s;
}
.lock-dots span.fill { background: #2f6fe4; border-color: #2f6fe4; transform: scale(1.12); }
.lock-dots.shake { animation: shake .35s; }
@keyframes shake { 20%{transform:translateX(-8px)} 40%{transform:translateX(8px)} 60%{transform:translateX(-5px)} 80%{transform:translateX(5px)} }
.lock-err { height: 18px; font-size: 12px; color: #e04848; margin-bottom: 4px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 4px 18px 6px; }
.keypad button {
  height: 52px; font-size: 22px; font-weight: 600; background: #f2f4f8; border-radius: 12px;
}
.keypad button:active { background: #dfe5f1; }
.keypad .k-fn { font-size: 15px; color: #6b7387; font-weight: 500; }

/* ============ 聊天 ============ */
#chat { background: #ededed; }
.chat-header {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top));
  background: linear-gradient(135deg, #1e4c9c, #16386e); color: #fff;
}
.hd-btn { color: #fff; font-size: 22px; width: 36px; height: 36px; border-radius: 9px; }
.hd-btn:active { background: rgba(255,255,255,.15); }
.hd-center { flex: 1; text-align: center; }
.hd-title { font-size: 16px; font-weight: 600; }
.hd-sub { font-size: 11px; color: #c9d8f2; margin-top: 1px; display: flex; align-items: center; justify-content: center; gap: 5px; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: #9aa3b8; }
.dot.on { background: #4ade80; animation: blink 2s infinite; }

.messages { flex: 1; overflow-y: auto; padding: 12px 12px 8px; }
.day-sep { text-align: center; margin: 12px 0; }
.day-sep span { background: rgba(0,0,0,.06); color: #8b93a5; font-size: 11px; padding: 3px 10px; border-radius: 8px; }

.msg-row { display: flex; gap: 9px; margin-bottom: 14px; align-items: flex-start; }
.msg-row.mine { flex-direction: row-reverse; }
.avatar {
  width: 38px; height: 38px; border-radius: 7px; flex-shrink: 0; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 16px; font-weight: 600;
}
.msg-col { max-width: 72%; display: flex; flex-direction: column; }
.msg-name { font-size: 11px; color: #98a1b3; margin-bottom: 3px; padding: 0 2px; }
.bubble {
  position: relative; padding: 10px 12px; border-radius: 10px; background: #fff;
  font-size: 15px; line-height: 1.5; word-break: break-word; white-space: pre-wrap;
  box-shadow: 0 1px 2px rgba(0,0,0,.05); min-width: 20px;
}
.msg-row:not(.mine) .bubble { border-top-left-radius: 2px; }
.msg-row.mine .bubble { background: #95ec69; border-top-right-radius: 2px; }
.bubble img.pic { max-width: 100%; border-radius: 6px; display: block; max-height: 320px; object-fit: cover; }
.bubble .sticker { font-size: 52px; line-height: 1.15; display: block; }
.bubble .sticker img { width: 72px; height: 72px; display: block; }
.audio-bubble { display: flex; align-items: center; gap: 8px; min-width: 90px; cursor: pointer; }
.audio-bubble .ab-play {
  width: 30px; height: 30px; border-radius: 50%; background: rgba(0,0,0,.08);
  display: flex; align-items: center; justify-content: center; font-size: 13px; flex-shrink: 0;
}
.msg-row.mine .audio-bubble .ab-play { background: rgba(0,0,0,.1); }
.audio-bubble.playing .ab-play { animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.12); } }
.ab-dur { font-size: 13px; }
.msg-time { font-size: 10px; color: #b3bac9; margin-top: 4px; padding: 0 2px; }
.msg-row.mine .msg-time { text-align: right; }

.sys-tip { text-align: center; font-size: 11px; color: #a7aec0; margin: 6px 0; }

/* ============ 表情面板 & 输入栏 ============ */
.emoji-panel { background: #f7f8fa; border-top: 1px solid #e6e8ee; max-height: 240px; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom); }
.ep-tabs { display: flex; gap: 4px; padding: 8px 12px 0; align-items: center; }
.ep-tab { font-size: 13px; color: #6b7387; padding: 5px 14px; border-radius: 8px; background: #eceef3; }
.ep-tab.active { background: #2f6fe4; color: #fff; }
.ep-close {
  margin-left: auto; width: 30px; height: 30px; border-radius: 50%;
  background: #eceef3; display: flex; align-items: center; justify-content: center;
}
.ep-close:active { background: #dfe4ef; transform: scale(.92); }
.ep-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 4px; padding: 10px 12px; }
.ep-grid button { font-size: 24px; padding: 6px 0; border-radius: 8px; }
.ep-grid button:active { background: #e6e9f2; }
.sticker-grid { grid-template-columns: repeat(4, 1fr); }
.sticker-grid button img { width: 52px; height: 52px; }

.input-bar {
  display: flex; align-items: center; gap: 8px; background: #f7f8fa;
  border-top: 1px solid #e6e8ee; padding: 9px 10px calc(9px + env(safe-area-inset-bottom));
}
.ib-btn { font-size: 24px; width: 38px; height: 38px; border-radius: 9px; flex-shrink: 0; }
.ib-btn:active { background: #e6e9f2; }
.msg-input {
  flex: 1; border: none; background: #fff; border-radius: 10px; padding: 10px 12px;
  font-size: 15px; outline: none; font-family: inherit; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.ib-send {
  flex-shrink: 0; padding: 9px 16px; font-size: 14px; font-weight: 600; color: #fff;
  background: linear-gradient(135deg, #2f6fe4, #1e4c9c); border-radius: 10px;
}
.ib-send:active { opacity: .85; }

/* ============ 录音浮层 ============ */
.rec-box {
  position: relative; width: 100%; background: #fff; border-radius: 18px 18px 0 0;
  padding: 26px 22px calc(22px + env(safe-area-inset-bottom)); text-align: center;
}
.rec-wave { font-size: 44px; animation: pulse 1.2s infinite; }
.rec-time { font-size: 26px; font-weight: 700; margin: 8px 0 2px; font-variant-numeric: tabular-nums; }
.rec-tip { font-size: 12px; color: #8b93a5; margin-bottom: 16px; }

/* ============ Action Sheet ============ */
.as-sheet { padding: 10px 14px calc(14px + env(safe-area-inset-bottom)); }
.as-item {
  width: 100%; padding: 14px; font-size: 15px; text-align: center;
  border-bottom: 1px solid #f0f2f6; margin-top: 4px;
}
.as-item.danger { color: #e04848; }
.as-item:last-child { border-bottom: none; }

/* ============ 图片查看 / Toast ============ */
.img-viewer { position: fixed; inset: 0; z-index: 200; background: rgba(0,0,0,.92); display: flex; align-items: center; justify-content: center; }
.img-viewer img { max-width: 96vw; max-height: 92vh; }
.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%);
  background: rgba(20,28,48,.88); color: #fff; font-size: 14px;
  padding: 11px 20px; border-radius: 12px; z-index: 300; max-width: 80vw; text-align: center;
}

/* ============ 视频消息 ============ */
.bubble video.vid { max-width: 200px; max-height: 260px; border-radius: 6px; display: block; background: #000; }

/* ============ 视频通话 ============ */
.call-overlay { position: fixed; inset: 0; z-index: 150; background: #0d1220; }
.call-overlay #remoteVideo { width: 100%; height: 100%; object-fit: cover; background: #000; }
.call-top {
  position: absolute; top: calc(22px + env(safe-area-inset-top)); left: 0; right: 0;
  text-align: center; color: #fff; pointer-events: none;
}
.call-name { font-size: 21px; font-weight: 700; }
.call-status { font-size: 13px; color: #c9d8f2; margin-top: 6px; letter-spacing: 1px; }
#localVideo {
  position: absolute; right: 12px; top: calc(76px + env(safe-area-inset-top));
  width: 100px; height: 142px; object-fit: cover; border-radius: 12px;
  border: 1.5px solid rgba(255,255,255,.45); background: #000;
}
.call-actions {
  position: absolute; bottom: calc(46px + env(safe-area-inset-bottom));
  left: 0; right: 0; display: flex; justify-content: center; gap: 46px;
}
.call-btn {
  width: 66px; height: 66px; border-radius: 50%; color: #fff;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; font-size: 11px; box-shadow: 0 4px 18px rgba(0,0,0,.4);
}
.call-btn svg { width: 26px; height: 26px; }
.call-btn.accept { background: #22c55e; }
.call-btn.decline { background: #ef4444; }
.call-btn.decline svg { transform: rotate(135deg); }
.call-btn:active { transform: scale(.9); }
