:root {
  --bg: #0b1a2b;
  --bg-2: #0d2137;
  --bg-3: #112d4e;
  --card: rgba(26, 51, 80, 0.55);
  --border: rgba(255, 255, 255, 0.08);
  --text: #e8f0fe;
  --muted: #8899aa;
  --green: #00e5a0;
  --blue: #00b4d8;
  --red: #ff4757;
  --amber: #ffa502;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(180deg, var(--bg), var(--bg-2) 50%, var(--bg-3));
  color: var(--text);
  min-height: 100vh;
}

.app { max-width: 720px; margin: 0 auto; padding: 24px 16px 90px; }
.page { animation: fade .2s ease; }
.hidden { display: none !important; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.muted { color: var(--muted); }
.center { text-align: center; }
.empty { color: var(--muted); text-align: center; padding: 26px 8px; font-size: 14px; line-height: 1.8; }
.empty span { font-size: 12px; opacity: .8; }
.gold { color: #ffc107; }
.link { color: var(--green); background: none; border: 0; cursor: pointer; padding: 0; font-size: 14px; }
.link.active { color: var(--blue); }

/* 登录 */
.login-header { text-align: center; margin: 26px 0 22px; }
.login-logo, .hero-icon {
  width: 88px; height: 88px; margin: 0 auto 14px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 42px; color: #fff;
  background: linear-gradient(135deg, var(--green), var(--blue));
  box-shadow: 0 12px 40px rgba(0, 229, 160, .24);
}
.login-title { font-size: 28px; margin: 0 0 8px; }
.login-subtitle { margin: 0; color: var(--muted); font-size: 14px; }

.segmented { display: flex; gap: 8px; padding: 5px; background: rgba(26, 51, 80, .6); border: 1px solid var(--border); border-radius: 16px; margin-bottom: 14px; }
.seg-btn { flex: 1; border: 0; background: transparent; color: var(--muted); padding: 12px 6px; border-radius: 11px; font-size: 15px; font-weight: 700; cursor: pointer; }
.seg-btn.active { color: var(--green); background: rgba(0, 229, 160, .14); }

.panel { padding: 10px 4px; }
.input-row { display: flex; align-items: center; gap: 10px; padding: 13px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; margin-bottom: 12px; }
.input-row span { font-size: 18px; }
.input-row input { flex: 1; border: 0; outline: none; background: transparent; color: var(--text); font-size: 16px; }
.input-row input::placeholder { color: #556677; }
.code-btn { border: 0; background: rgba(0, 229, 160, .12); color: var(--green); border-radius: 10px; padding: 8px 12px; cursor: pointer; white-space: nowrap; }
.error { color: var(--red); font-size: 12px; margin: -6px 0 10px; min-height: 14px; }
.agree { display: flex; align-items: flex-start; gap: 8px; color: var(--muted); font-size: 13px; margin: 8px 0 14px; }
.agree input { margin-top: 2px; }

.btn-primary, .btn-secondary, .btn-danger {
  display: block; width: 100%; padding: 15px; border: 0; border-radius: 16px;
  font-size: 16px; font-weight: 700; cursor: pointer; margin: 6px 0; color: #fff;
}
.btn-primary { background: linear-gradient(135deg, var(--green), var(--blue)); }
.btn-secondary { background: rgba(26, 51, 80, .7); color: var(--muted); border: 1px solid var(--border); }
.btn-danger { background: linear-gradient(135deg, #ff4757, #ff6b81); }
.btn-primary.disabled { opacity: .45; cursor: not-allowed; }
.link-btn { display: block; margin: 16px auto 0; border: 0; background: transparent; color: var(--green); cursor: pointer; }

/* 页头 / 导航栏 */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.page-header h1 { font-size: 20px; margin: 0; flex: 1; text-align: center; }
.page-header .back-btn { width: 36px; border: 0; background: transparent; color: var(--text); font-size: 22px; cursor: pointer; }
.page-header span:last-child { width: 36px; }
.nav-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.nav-icon { width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, var(--green), var(--blue)); position: relative; display: flex; align-items: center; justify-content: center; }
.pulse-dot { width: 10px; height: 10px; border-radius: 50%; background: #fff; }
.nav-title { font-size: 18px; font-weight: 700; }

/* 首页 */
.hero { text-align: center; margin-bottom: 18px; }
.hero-icon { width: 72px; height: 72px; font-size: 34px; }
.hero h2 { margin: 0 0 8px; font-size: 22px; }
.section-label { color: var(--muted); font-size: 13px; margin: 16px 0 8px; display: block; }
.tag-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tag { border: 1px solid var(--border); background: rgba(26, 51, 80, .5); color: var(--text); border-radius: 12px; padding: 10px 4px; font-size: 13px; cursor: pointer; }
.tag.active { border-color: rgba(0, 229, 160, .5); background: rgba(0, 229, 160, .12); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px; margin-bottom: 8px; }
.card textarea { width: 100%; min-height: 110px; border: 0; outline: none; background: transparent; color: var(--text); resize: vertical; font-size: 15px; }
.char-count { text-align: right; color: var(--muted); font-size: 12px; }
.extra-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.extra-item { border: 1px solid var(--border); background: rgba(26, 51, 80, .5); color: var(--text); border-radius: 12px; padding: 12px; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.extra-item span { color: var(--muted); font-size: 12px; }
.extra-item b { font-size: 14px; }

.analyzing-center, .danger-center { text-align: center; padding: 40px 8px; }
.scan-ring { width: 90px; height: 90px; border-radius: 50%; border: 3px solid var(--green); margin: 0 auto 20px; display: flex; align-items: center; justify-content: center; font-weight: 700; animation: spin 3s linear infinite; box-shadow: 0 0 30px rgba(0, 229, 160, .3); }
@keyframes spin { to { transform: rotate(360deg); } }
.progress { height: 10px; background: rgba(255,255,255,.1); border-radius: 8px; overflow: hidden; margin: 18px 0 6px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--green), var(--blue)); transition: width .4s; }
.danger-icon { width: 76px; height: 76px; border-radius: 50%; background: rgba(255, 71, 87, .15); border: 2px solid var(--red); color: var(--red); font-size: 38px; font-weight: 700; margin: 0 auto 18px; display: flex; align-items: center; justify-content: center; animation: pulse 1.4s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(255,71,87,.4); } 50% { box-shadow: 0 0 0 18px rgba(255,71,87,0); } }
.danger-title { color: var(--red); }
.result-banner { display: inline-block; margin: 0 auto 10px; padding: 8px 18px; border-radius: 20px; font-size: 14px; }
.result-banner.safe { background: rgba(0, 229, 160, .14); color: var(--green); }

.disease-list { text-align: left; margin: 12px 0; }
.disease-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.disease-card.high { border-color: rgba(255, 71, 87, .4); }
.disease-top { display: flex; align-items: center; gap: 8px; }
.disease-top .rank { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, var(--green), var(--blue)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.disease-top b { flex: 1; }
.disease-top em { color: var(--muted); font-style: normal; font-size: 13px; }
.conf, .meter-bar { height: 6px; background: rgba(255,255,255,.1); border-radius: 6px; overflow: hidden; margin-top: 8px; }
.conf i { display: block; height: 100%; }
.conf i.safe { background: var(--green); }
.conf i.danger { background: var(--red); }
.meters { text-align: left; margin: 14px 0; }
.meter { margin-bottom: 12px; }
.meter-head { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 5px; }
.meter-bar i { display: block; height: 100%; }

/* 地区 / 搜索 / 医院 */
.region-bar { display: flex; align-items: center; justify-content: space-between; background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 12px; margin-bottom: 12px; font-size: 14px; }
.search-row { display: flex; gap: 8px; margin-bottom: 12px; }
.search-row input { flex: 1; padding: 12px; background: rgba(0,0,0,.2); border: 1px solid var(--border); border-radius: 12px; color: var(--text); }
.search-btn { border: 0; padding: 0 16px; border-radius: 12px; background: linear-gradient(135deg, var(--green), var(--blue)); color: #fff; font-weight: 700; cursor: pointer; }
.hospital-list { display: flex; flex-direction: column; gap: 10px; }
.hospital-item, .list-item { text-align: left; width: 100%; border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 14px; padding: 14px; cursor: pointer; font-size: 14px; }
.hospital-top { display: flex; align-items: center; gap: 8px; }
.hospital-top .rank { min-width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, var(--green), var(--blue)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.hospital-top b { flex: 1; }
.hospital-item p { margin: 6px 0 0; }
.list-item { display: flex; justify-content: space-between; align-items: center; }
.list-item em { color: var(--muted); font-style: normal; font-size: 13px; }
.list-item.companion { flex-direction: column; align-items: flex-start; gap: 6px; }
.selected-time { display: flex; align-items: center; justify-content: space-between; padding: 8px 0; }

/* 出行 */
.transport-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 16px 0; }
.transport-btn { border: 1px solid var(--border); background: rgba(26, 51, 80, .5); color: var(--text); border-radius: 14px; padding: 18px 8px; font-size: 16px; cursor: pointer; }
.route-result { margin-top: 12px; padding: 14px; border: 1px solid rgba(0, 229, 160, .25); border-radius: 14px; background: rgba(0,0,0,.2); }
.route-summary { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.route-summary span { padding: 5px 10px; border-radius: 8px; background: rgba(0, 229, 160, .14); color: var(--green); font-size: 13px; font-weight: 700; }
.route-step { display: flex; gap: 10px; margin-bottom: 10px; }
.route-step span { width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, var(--green), var(--blue)); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.route-step div { flex: 1; }
.route-step em { color: var(--muted); font-style: normal; font-size: 12px; }

/* 个人中心 */
.profile-header { display: flex; gap: 14px; align-items: center; padding: 16px; background: var(--card); border: 1px solid var(--border); border-radius: 18px; margin-bottom: 14px; }
.avatar { width: 58px; height: 58px; border-radius: 50%; background: linear-gradient(135deg, var(--green), var(--blue)); display: flex; align-items: center; justify-content: center; font-size: 26px; overflow: hidden; flex-shrink: 0; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.nickname { font-size: 18px; font-weight: 700; }
.record { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 13px; margin-bottom: 10px; }
.record-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; gap: 8px; }
.record-head em { font-style: normal; font-size: 12px; padding: 3px 8px; border-radius: 10px; }
.record-head em.ok { color: var(--green); background: rgba(0, 229, 160, .12); }
.record-head em.expired, .record-head em.invalid { color: var(--muted); background: rgba(255,255,255,.06); }
.record-head em.reviewed { color: var(--blue); background: rgba(0, 180, 216, .12); }
.record-head em.active { color: var(--amber); background: rgba(255, 165, 2, .12); }
.record p { margin: 4px 0; font-size: 13px; }
.record.booking.expired { opacity: .7; }
.btn-logout { display: block; width: 100%; margin-top: 18px; padding: 14px; border: 1px solid rgba(255, 71, 87, .35); background: transparent; color: var(--red); border-radius: 14px; cursor: pointer; font-size: 15px; }

/* 医陪空余时间 */
.day-card { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px; margin-bottom: 10px; }
.day-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.slot-row { display: flex; gap: 8px; }
.slot { flex: 1; min-width: 0; border: 1px solid var(--border); background: rgba(0,0,0,.16); color: var(--text); border-radius: 12px; padding: 12px 6px; font-size: 13px; cursor: pointer; }
.slot.active { border-color: rgba(0, 229, 160, .5); background: rgba(0, 229, 160, .1); }
.slot.locked { opacity: .5; cursor: not-allowed; }
.slot span { font-size: 12px; }
.saved-day { padding: 10px 0; border-bottom: 1px solid var(--border); }
.saved-time { display: inline-block; margin: 4px 6px 0 0; padding: 4px 10px; background: rgba(0, 229, 160, .12); color: var(--green); border-radius: 10px; font-size: 12px; }
.actions { display: flex; gap: 10px; margin-top: 10px; }
.actions .btn-primary, .actions .btn-secondary { flex: 1; }
.hospital-section { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 14px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; color: var(--text); font-size: 14px; cursor: pointer; margin-bottom: 12px; }

/* 医陪详情 / 评价 */
.detail-header { display: flex; gap: 14px; align-items: center; padding: 16px; background: var(--card); border: 1px solid var(--border); border-radius: 18px; margin-bottom: 14px; }
.detail-avatar { width: 62px; height: 62px; border-radius: 50%; background: linear-gradient(135deg, var(--green), var(--blue)); display: flex; align-items: center; justify-content: center; font-size: 30px; flex-shrink: 0; }
.detail-header b { font-size: 18px; }
.detail-header p { margin: 4px 0 0; font-size: 13px; }
.avg-card { text-align: center; padding: 14px; background: rgba(255, 193, 7, .1); border-radius: 14px; color: #ffc107; font-size: 18px; font-weight: 700; margin: 10px 0; }
.stars { display: flex; justify-content: center; gap: 8px; font-size: 34px; margin: 12px 0; }
.star { color: #556677; cursor: pointer; }
.star.active { color: #ffc107; }
.review-text { width: 100%; min-height: 120px; background: var(--card); border: 1px solid var(--border); border-radius: 14px; color: var(--text); padding: 12px; resize: vertical; margin: 8px 0; }
.image-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.image-grid img, .img-wrap img { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; cursor: pointer; }
.img-wrap { position: relative; }
.img-wrap .remove { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%; background: var(--red); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; font-size: 14px; }
.booking-info p { margin: 4px 0; }
.booking-info textarea { width: 100%; min-height: 90px; background: rgba(0,0,0,.2); border: 1px solid var(--border); border-radius: 12px; color: var(--text); padding: 10px; }
#booking-remark { width: 100%; min-height: 90px; background: rgba(0,0,0,.2); border: 1px solid var(--border); border-radius: 12px; color: var(--text); padding: 10px; margin-top: 8px; }

/* 底部导航 */
.tab-bar { position: fixed; left: 0; right: 0; bottom: 0; display: flex; background: rgba(11, 26, 43, .96); border-top: 1px solid var(--border); padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); z-index: 30; max-width: 720px; margin: 0 auto; }
.tab-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: transparent; color: var(--muted); font-size: 12px; cursor: pointer; }
.tab-btn.active { color: var(--green); }
.tab-btn span:first-child { font-size: 18px; }

/* 弹窗 */
.modal-mask { position: fixed; inset: 0; background: rgba(0,0,0,.68); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-card { width: 100%; max-width: 460px; background: #1a3350; border-radius: 22px; padding: 22px; max-height: 84vh; overflow: auto; }
.modal-card h3 { margin: 0 0 14px; text-align: center; font-size: 18px; }
.modal-card label { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; font-size: 14px; }
.modal-card label input { padding: 8px; background: rgba(0,0,0,.2); border: 1px solid var(--border); border-radius: 10px; color: var(--text); }
#bind-phone-input { width: 100%; padding: 12px; background: rgba(0,0,0,.2); border: 1px solid var(--border); border-radius: 12px; color: var(--text); }
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.modal-actions button { flex: 1; padding: 13px; border: 0; border-radius: 13px; font-size: 15px; font-weight: 700; cursor: pointer; color: #fff; }
.option { display: block; width: 100%; text-align: left; border: 1px solid var(--border); background: rgba(0,0,0,.16); color: var(--text); border-radius: 12px; padding: 12px; margin-bottom: 8px; cursor: pointer; }
.option.active { border-color: rgba(0, 229, 160, .5); background: rgba(0, 229, 160, .1); }

.region-body { display: flex; gap: 10px; }
.region-list { flex: 1; max-height: 48vh; overflow: auto; }
.region-item { padding: 11px 8px; border-bottom: 1px solid var(--border); font-size: 14px; cursor: pointer; }
.region-item.active { color: var(--green); }
.letter-index { display: flex; flex-direction: column; font-size: 10px; color: var(--muted); overflow: auto; }
.letter-index span { cursor: pointer; padding: 1px 3px; }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); display: flex; align-items: center; justify-content: center; z-index: 80; }
.lightbox img { max-width: 94vw; max-height: 94vh; }

.toast { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); background: rgba(26, 51, 80, .96); border: 1px solid rgba(0, 229, 160, .3); color: var(--text); padding: 13px 24px; border-radius: 14px; z-index: 90; font-size: 14px; }
