/* 智能云谷小程序 初版原型 — Design Tokens + 组件 */
:root {
  --primary: #1E5FE8;
  --primary-weak: #EAF1FE;
  --bg: #F4F6FA;
  --surface: #FFFFFF;
  --border: #EBEEF3;
  --text: #1F2933;
  --text-sub: #6B7280;
  --text-faint: #9AA3AF;
  --success: #16A34A;
  --success-weak: #E9F7EE;
  --warning: #F59E0B;
  --warning-weak: #FEF4E2;
  --danger: #EF4444;
  --danger-weak: #FDEDED;
  --r-sm: 8px; --r-md: 12px; --r-lg: 16px;
  --shadow-card: 0 1px 3px rgba(16,24,40,.05);
  --shadow-pop: 0 -8px 24px rgba(16,24,40,.12);
  --tabbar-h: 76px;
  --nav-h: 44px;
  --status-h: 47px;
}
* { 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", "Noto Sans SC", sans-serif;
  background: linear-gradient(160deg, #DDE7F5 0%, #EEF2F8 45%, #E4E9F2 100%);
  color: var(--text);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100vh; padding: 24px 16px; gap: 14px;
}
.stage-title { color: #5B6B84; font-size: 13px; letter-spacing: .5px; display: flex; align-items: center; gap: 8px; }
.stage-title b { color: #33415C; font-size: 15px; }
.stage-tip { color: #8593A8; font-size: 12px; }

/* ============ 手机壳 ============ */
.phone {
  width: 390px; height: 844px; max-height: calc(100vh - 90px);
  background: var(--bg); border-radius: 44px; border: 8px solid #101623;
  box-shadow: 0 30px 60px rgba(16,24,40,.28), 0 0 0 1px rgba(255,255,255,.35) inset;
  overflow: hidden; position: relative; display: flex; flex-direction: column; flex: none;
}
.statusbar {
  height: var(--status-h); flex: none; display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 28px 6px; font-size: 14px; font-weight: 600; color: #101623; background: var(--surface);
}
.statusbar .sicons { display: flex; gap: 5px; align-items: center; }
.navbar {
  height: var(--nav-h); flex: none; background: var(--surface); display: flex; align-items: center;
  padding: 0 10px; position: relative; z-index: 5;
}
.navbar .nav-title { position: absolute; left: 50%; transform: translateX(-50%); font-size: 16px; font-weight: 600; max-width: 55%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-back {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  color: #101623; cursor: pointer; border-radius: 50%;
}
.nav-back:active { background: #F0F2F6; }
.nav-capsule {
  margin-left: auto; width: 88px; height: 32px; border: 1px solid #E5E8EE; border-radius: 16px;
  background: rgba(255,255,255,.92); display: flex; align-items: center; color: #1F2933;
  box-shadow: 0 1px 2px rgba(16,24,40,.04);
}
.nav-capsule .c-dot { flex: 1; display: flex; align-items: center; justify-content: center; height: 100%; position: relative; }
.nav-capsule .c-dot:first-child::after { content: ""; position: absolute; right: 0; top: 7px; bottom: 7px; width: 1px; background: #E5E8EE; }
.screen { flex: 1; overflow-y: auto; overscroll-behavior: contain; position: relative; }
.screen::-webkit-scrollbar { width: 0; }
.tabbar {
  height: var(--tabbar-h); flex: none; background: var(--surface); border-top: .5px solid var(--border);
  display: flex; padding-bottom: 14px;
}
.tabbar.hide { display: none; }
.tab-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--text-faint); cursor: pointer; font-size: 10.5px; transition: color .18s; }
.tab-item .ti-ic { width: 30px; height: 30px; display: flex; align-items: center; justify-content: center; border-radius: 10px; transition: background .18s, color .18s; }
.tab-item.on { color: var(--primary); font-weight: 600; }
.tab-item.on .ti-ic { background: var(--primary-weak); }
.tab-item:active { transform: scale(.96); }

/* ============ 通用组件 ============ */
.view { padding: 12px 14px 28px; animation: viewIn .26s ease both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.card { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-card); padding: 14px; margin-bottom: 12px; }
.card-t { font-size: 15px; font-weight: 600; margin-bottom: 10px; display: flex; align-items: center; gap: 6px; }
.card-t .more { margin-left: auto; font-size: 12px; color: var(--text-faint); font-weight: 400; cursor: pointer; }
.sub { color: var(--text-sub); font-size: 12px; line-height: 1.6; }
.tag { display: inline-flex; align-items: center; gap: 3px; font-size: 10.5px; padding: 2px 8px; border-radius: 6px; background: var(--primary-weak); color: var(--primary); font-weight: 500; }
.tag.warn { background: var(--warning-weak); color: #B45309; }
.tag.ok { background: var(--success-weak); color: var(--success); }
.tag.gray { background: #F1F3F7; color: var(--text-sub); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; cursor: pointer; font-size: 14px; font-weight: 600; border-radius: var(--r-md);
  padding: 11px 16px; background: var(--primary); color: #fff; transition: transform .12s, opacity .12s;
  font-family: inherit;
}
.btn:active { transform: scale(.97); opacity: .9; }
.btn.block { width: 100%; }
.btn.ghost { background: var(--primary-weak); color: var(--primary); }
.btn.plain { background: #F1F3F7; color: var(--text); }
.btn.sm { padding: 7px 12px; font-size: 12px; border-radius: 9px; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.divider { height: .5px; background: var(--border); margin: 10px 0; }
.chip {
  flex: none; padding: 6px 14px; border-radius: 999px; background: #fff; border: 1px solid var(--border);
  font-size: 12px; color: var(--text-sub); cursor: pointer; transition: all .15s;
}
.chip.on { background: var(--primary); border-color: var(--primary); color: #fff; font-weight: 500; }
.chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 6px; }
.chip-row::-webkit-scrollbar { height: 0; }
.banner {
  border-radius: var(--r-md); padding: 14px; color: #fff; position: relative; overflow: hidden;
  background: linear-gradient(120deg, #1E5FE8 0%, #3B82F6 55%, #60A5FA 100%);
}
.banner::after { content: ""; position: absolute; right: -30px; top: -30px; width: 130px; height: 130px; border-radius: 50%; background: rgba(255,255,255,.12); }
.banner::before { content: ""; position: absolute; right: 24px; bottom: -46px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,.08); }

/* 宫格 */
.grid8 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px 6px; }
.g-item { display: flex; flex-direction: column; align-items: center; gap: 7px; cursor: pointer; }
.g-item:active { transform: scale(.94); }
.g-ic { width: 46px; height: 46px; border-radius: 15px; display: flex; align-items: center; justify-content: center; color: #fff; }
.g-item span { font-size: 11.5px; color: var(--text); }

/* 列表项 */
.row { display: flex; align-items: center; gap: 12px; padding: 13px 2px; cursor: pointer; }
.row:active { opacity: .7; }
.row .r-ic { width: 38px; height: 38px; border-radius: 11px; flex: none; display: flex; align-items: center; justify-content: center; }
.row .r-main { flex: 1; min-width: 0; }
.row .r-title { font-size: 14px; font-weight: 500; }
.row .r-desc { font-size: 11.5px; color: var(--text-sub); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .r-right { color: #C6CCD6; display: flex; align-items: center; gap: 4px; font-size: 12px; }

/* 表单 */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 12px; color: var(--text-sub); margin-bottom: 6px; }
.field label b { color: var(--danger); font-weight: 400; }
.field input, .field select {
  width: 100%; height: 42px; border: 1px solid var(--border); border-radius: 10px; padding: 0 12px;
  font-size: 14px; background: #FBFCFE; font-family: inherit; color: var(--text); outline: none; transition: border .15s, box-shadow .15s;
}
.field input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(30,95,232,.10); background: #fff; }
.score-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.score-grid .field { margin-bottom: 0; }
.score-grid input { height: 40px; text-align: center; }

/* segmented */
.seg { display: flex; background: #ECEFF5; border-radius: 10px; padding: 3px; gap: 2px; }
.seg .sg { flex: 1; text-align: center; padding: 8px 4px; font-size: 12.5px; border-radius: 8px; color: var(--text-sub); cursor: pointer; transition: all .18s; }
.seg .sg.on { background: #fff; color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(16,24,40,.08); }

/* 学校卡片 */
.school { border: 1px solid var(--border); border-radius: var(--r-md); padding: 12px; margin-bottom: 10px; background: #fff; }
.school .s-top { display: flex; align-items: flex-start; gap: 10px; }
.school .s-name { font-size: 14.5px; font-weight: 600; }
.school .s-meta { font-size: 11.5px; color: var(--text-sub); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.rate { flex: none; text-align: center; min-width: 64px; }
.rate .rt { font-size: 17px; font-weight: 700; }
.rate .rl { font-size: 10px; margin-top: 1px; }
.rate.hi .rt, .rate.hi .rl { color: var(--success); } .rate.hi { background: var(--success-weak); }
.rate.mid .rt, .rate.mid .rl { color: var(--primary); } .rate.mid { background: var(--primary-weak); }
.rate.low .rt, .rate.low .rl { color: #C25E00; } .rate.low { background: var(--warning-weak); }
.rate { border-radius: 10px; padding: 7px 10px; }

/* 悬浮志愿篮条 */
.float-bar {
  position: absolute; left: 14px; right: 14px; bottom: 16px; z-index: 8;
  background: #101623; color: #fff; border-radius: 999px; padding: 10px 16px;
  display: flex; align-items: center; gap: 10px; cursor: pointer; box-shadow: 0 10px 24px rgba(16,22,35,.32);
  animation: viewIn .3s ease;
}
.float-bar .fb-count { background: var(--warning); color: #fff; border-radius: 999px; min-width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; padding: 0 6px; font-weight: 600; }
.float-bar .fb-go { margin-left: auto; background: var(--primary); border-radius: 999px; padding: 7px 14px; font-size: 12.5px; font-weight: 600; }

/* 聊天 */
.chat-wrap { display: flex; flex-direction: column; height: 100%; }
.chat-list { flex: 1; overflow-y: auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 12px; }
.msg { display: flex; gap: 8px; max-width: 86%; animation: viewIn .22s ease; }
.msg.me { align-self: flex-end; flex-direction: row-reverse; }
.avatar { width: 34px; height: 34px; border-radius: 9px; flex: none; display: flex; align-items: center; justify-content: center; color: #fff; }
.msg .bubble { background: #fff; border-radius: 4px 12px 12px 12px; padding: 10px 12px; font-size: 13.5px; line-height: 1.65; box-shadow: var(--shadow-card); }
.msg.me .bubble { background: var(--primary); color: #fff; border-radius: 12px 4px 12px 12px; }
.bubble .b-act { display: inline-flex; align-items: center; gap: 4px; margin-top: 8px; color: var(--primary); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.msg.me .bubble .b-act { color: #fff; }
.chat-input { flex: none; display: flex; gap: 8px; padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); background: #FAFBFD; border-top: .5px solid var(--border); }
.chat-input input { flex: 1; height: 40px; border: none; background: #fff; border-radius: 10px; padding: 0 14px; font-size: 13.5px; outline: none; font-family: inherit; border: 1px solid var(--border); }
.quick-q { display: flex; gap: 8px; flex-wrap: wrap; padding: 0 12px 10px; }
.quick-q .qq { font-size: 11.5px; padding: 6px 11px; background: #fff; border: 1px solid var(--border); color: var(--primary); border-radius: 999px; cursor: pointer; }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: #B9C2D0; animation: tp 1s infinite; }
.typing i:nth-child(2) { animation-delay: .15s; } .typing i:nth-child(3) { animation-delay: .3s; }
@keyframes tp { 0%, 100% { opacity: .35; transform: translateY(0); } 50% { opacity: 1; transform: translateY(-3px); } }

/* Sheet / 弹层 */
.mask { position: absolute; inset: 0; background: rgba(16,22,35,.45); z-index: 20; opacity: 0; pointer-events: none; transition: opacity .22s; }
.mask.show { opacity: 1; pointer-events: auto; }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 21; background: #fff;
  border-radius: 18px 18px 0 0; transform: translateY(105%); transition: transform .28s cubic-bezier(.32,.72,.33,1);
  max-height: 78%; display: flex; flex-direction: column;
}
.sheet.show { transform: none; }
.sheet-h { padding: 16px 16px 10px; display: flex; align-items: center; gap: 8px; flex: none; }
.sheet-h .sh-t { font-size: 16px; font-weight: 700; flex: 1; }
.sh-x { width: 30px; height: 30px; border-radius: 50%; background: #F1F3F7; display: flex; align-items: center; justify-content: center; color: var(--text-sub); cursor: pointer; flex: none; }
.view-fill { height: 100%; padding-bottom: 8px; display: flex; flex-direction: column; overflow: hidden; }
.view-fill .chat-wrap { flex: 1; min-height: 0; }
.sheet-b { padding: 4px 16px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; }
.sheet.grab::before { content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%); width: 38px; height: 4px; border-radius: 2px; background: #E2E6ED; }

/* Toast */
.toast {
  position: absolute; left: 50%; top: 46%; transform: translate(-50%, -50%) scale(.94); z-index: 40;
  background: rgba(23,29,41,.92); color: #fff; padding: 12px 18px; border-radius: 12px; font-size: 13px;
  display: flex; align-items: center; gap: 8px; opacity: 0; pointer-events: none; transition: all .22s; max-width: 78%;
}
.toast.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* 骨架屏 */
.sk { background: linear-gradient(90deg, #EEF1F6 25%, #F7F9FC 45%, #EEF1F6 65%); background-size: 200% 100%; animation: sk 1.1s infinite; border-radius: 8px; }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* 空态 */
.empty { text-align: center; padding: 42px 20px; color: var(--text-faint); }
.empty .e-ic { width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 20px; background: #F1F3F7; display: flex; align-items: center; justify-content: center; }
.empty p { font-size: 13px; line-height: 1.7; }

/* 答题 */
.q-card { background: #fff; border-radius: var(--r-md); padding: 18px 16px; box-shadow: var(--shadow-card); }
.q-idx { font-size: 11px; color: var(--text-faint); margin-bottom: 8px; }
.q-title { font-size: 15.5px; font-weight: 600; line-height: 1.55; margin-bottom: 16px; }
.q-opt { border: 1px solid var(--border); border-radius: 11px; padding: 12px 14px; font-size: 13.5px; margin-bottom: 10px; cursor: pointer; display: flex; align-items: center; gap: 10px; transition: all .15s; }
.q-opt .opt-key { width: 24px; height: 24px; border-radius: 50%; background: #F1F3F7; display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--text-sub); flex: none; }
.q-opt.on { border-color: var(--primary); background: var(--primary-weak); color: var(--primary); font-weight: 600; }
.q-opt.on .opt-key { background: var(--primary); color: #fff; }
.pbar { height: 5px; border-radius: 3px; background: #ECEFF5; overflow: hidden; margin: 4px 0 14px; }
.pbar i { display: block; height: 100%; background: var(--primary); border-radius: 3px; transition: width .3s; }

/* 探校封面 / 商品图 / 报告 */
.cover {
  height: 120px; border-radius: var(--r-md) var(--r-md) 0 0; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.95);
}
.play-btn { width: 44px; height: 44px; border-radius: 50%; background: rgba(255,255,255,.25); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; border: 1.5px solid rgba(255,255,255,.6); }
.video-box { height: 190px; border-radius: 12px; background: linear-gradient(135deg, #232B3D, #3C4A66); display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.9); position: relative; }
.video-box .vb-tip { position: absolute; bottom: 10px; left: 12px; font-size: 10.5px; background: rgba(0,0,0,.45); padding: 3px 8px; border-radius: 6px; }
.product-img { height: 108px; border-radius: 10px; display: flex; align-items: center; justify-content: center; color: #fff; margin-bottom: 10px; }
.report-hero { text-align: center; padding: 18px 0 6px; }
.report-hero .rh-badge { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; background: var(--primary-weak); color: var(--primary); border-radius: 16px; padding: 18px 30px; }
.report-hero .rh-badge b { font-size: 24px; }

/* 公告条 */
.notice { display: flex; align-items: center; gap: 8px; background: #FFF9EE; border: 1px solid #F7E8C5; color: #8A6116; font-size: 11.5px; border-radius: 10px; padding: 9px 12px; margin-bottom: 12px; overflow: hidden; }
.notice .n-txt { flex: 1; white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }

/* 倒计时 */
.cd-num { font-size: 34px; font-weight: 800; letter-spacing: 1px; font-variant-numeric: tabular-nums; }
.cd-row { display: flex; align-items: baseline; gap: 6px; }

/* 页脚注 */
.foot-note { text-align: center; color: #B3BAC6; font-size: 10.5px; padding: 14px 0 4px; line-height: 1.7; }

/* 响应式：小屏全屏 */
@media (max-width: 480px) {
  body { padding: 0; }
  .stage-title, .stage-tip { display: none; }
  .phone { width: 100%; height: 100vh; max-height: none; border-radius: 0; border: none; }
}
