/* ====== 血栓与止血小程序 — 门户样式 ====== */
*{ box-sizing:border-box; margin:0; padding:0; }
:root{
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Microsoft YaHei", "Hiragino Sans GB", Arial, sans-serif;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.10), 0 4px 8px rgba(0,0,0,.04);
  --radius: 14px;
  --transition: .25s cubic-bezier(.4,0,.2,1);
}
html,body{ height:100%; }
body{
  font-family: var(--font);
  background: #f0f4f8;
  color: #1e293b;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
[hidden]{ display:none !important; }

/* ============= 门户首页 ============= */
.portal-view{
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* --- 顶部横幅 --- */
.portal-header{
  position: relative;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 45%, #6f42c1 100%);
  color: #fff;
  padding: 36px 24px 28px;
  text-align: center;
  overflow: hidden;
}
.portal-header::before{
  content:'';
  position:absolute; top:-60%; left:-10%;
  width:120%; height:200%;
  background: radial-gradient(ellipse at center, rgba(255,255,255,.08) 0%, transparent 50%);
  pointer-events: none;
}
.header-inner{
  display: flex; align-items: center; justify-content: center; gap: 16px;
  position: relative;
}
.header-icon{ flex-shrink: 0; }
.header-text h1{
  font-size: 26px; font-weight: 800; letter-spacing: 2px; line-height: 1.2;
  text-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.header-text p{
  font-size: 13px; opacity: .8; margin-top: 4px; letter-spacing: 1px;
}
.home-link{
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 16px;
  position: relative;
  background: rgba(255,255,255,.16);
  border: 1px solid rgba(255,255,255,.28);
  color: #fff;
  text-decoration: none;
  padding: 7px 18px;
  border-radius: 999px;
  font-size: 13px; font-weight: 600;
  letter-spacing: 1px;
  transition: .15s;
  -webkit-tap-highlight-color: transparent;
}
.home-link:hover{
  background: rgba(255,255,255,.28);
  border-color: rgba(255,255,255,.45);
}
.home-link:active{ transform: scale(.96); }

.header-badge{
  display: inline-block;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 999px;
  padding: 4px 16px;
  font-size: 12px;
  font-weight: 500;
  margin-top: 14px;
  position: relative;
}

/* --- 主体网格 --- */
.portal-main{
  flex: 1;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 20px 24px;
}

.portal-grid{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.portal-grid > .app-card:last-child:nth-child(odd){
  grid-column: 1 / -1;
}

/* --- 应用卡片 --- */
.app-card{
  display: flex;
  align-items: center;
  gap: 16px;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: var(--radius);
  padding: 20px 22px;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow);
  text-align: left;
  border: none;
  width: 100%;
  font-family: inherit;
  position: relative;
  overflow: hidden;
}
.app-card::after{
  content:'';
  position:absolute; top:0; left:0; right:0; height:3px;
  background: var(--card-color, #2563eb);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .3s ease;
}
.app-card:hover{
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--card-color, #2563eb);
}
.app-card:hover::after{
  transform: scaleX(1);
}
.app-card:active{
  transform: translateY(-1px);
}

.card-icon{
  flex-shrink: 0;
  width: 56px; height: 56px;
  border-radius: 14px;
  background: var(--card-bg, #dbeafe);
  color: var(--card-color, #2563eb);
  display: flex; align-items: center; justify-content: center;
  transition: var(--transition);
}
.app-card:hover .card-icon{
  transform: scale(1.08) rotate(-3deg);
}

.card-body{
  flex: 1; min-width: 0;
}
.card-body h2{
  font-size: 16px; font-weight: 700; color: #1e293b; margin-bottom: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-body p{
  font-size: 12px; color: #64748b; line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-arrow{
  flex-shrink: 0;
  font-size: 24px; color: #cbd5e1; font-weight: 300;
  transition: var(--transition);
}
.app-card:hover .card-arrow{
  color: var(--card-color, #2563eb);
  transform: translateX(4px);
}

/* --- 底部 --- */
.portal-footer{
  text-align: center;
  padding: 20px 16px 28px;
  border-top: 1px solid #e2e8f0;
  background: #fff;
}
.portal-footer p{
  font-size: 13px; color: #475569; font-weight: 500;
}
.portal-footer .disclaimer{
  font-size: 11px; color: #94a3b8; margin-top: 6px; font-weight: 400;
}

/* ============= 访问计数 ============= */
.visit-stats{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 16px 20px;
  margin: 0 auto 4px;
  background: #fff;
  border-top: 1px solid #e2e8f0;
}
.vs-item{
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 88px;
}
.vs-num{
  font-size: 22px;
  font-weight: 700;
  color: #2563eb;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}
.vs-label{
  font-size: 12px;
  color: #94a3b8;
  letter-spacing: .5px;
}
.vs-sep{
  width: 1px;
  height: 34px;
  background: #e2e8f0;
}

/* ============= 子程序容器 ============= */
.app-container{
  position: fixed; inset: 0; z-index: 9999;
  background: #f0f4f8;
  display: flex; flex-direction: column;
  animation: slideIn .3s ease;
}
@keyframes slideIn{
  from{ opacity:0; transform: translateY(20px); }
  to{ opacity:1; transform: translateY(0); }
}

.app-topbar{
  flex-shrink: 0;
  display: flex; align-items: center; gap: 16px;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 50%, #6f42c1 100%);
  padding: 8px 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,.12);
  position: relative;
  z-index: 10;
}

.back-btn{
  display: flex; align-items: center; gap: 6px;
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.2);
  color: #fff;
  padding: 7px 14px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  font-family: inherit;
}
.back-btn:hover{
  background: rgba(255,255,255,.22);
  transform: translateX(-2px);
}
.back-btn:active{ transform: translateX(0); }

.app-title{
  color: rgba(255,255,255,.9);
  font-size: 14px; font-weight: 500;
}

.app-frame{
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
}

/* ============= 响应式 ============= */
@media (max-width: 640px){
  .portal-header{ padding: 20px 14px 16px; }
  .header-text h1{ font-size: 19px; letter-spacing: 1px; }
  .header-text p{ font-size: 11px; }
  .header-inner{ gap: 12px; }
  .header-icon svg{ width: 38px; height: 38px; }
  .home-link{ margin-top: 12px; padding: 6px 15px; font-size: 12.5px; }
  .portal-main{ padding: 16px 12px 12px; }

  /* 手机端：每排 2 个卡片入口，纵向紧凑排布，尽量一屏看全 */
  .portal-grid{ grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .app-card{
    flex-direction: column; align-items: center; text-align: center;
    gap: 8px; padding: 13px 8px 11px;
  }
  .app-card:hover{ transform: translateY(-2px); }
  .app-card:active{ transform: scale(.97); }
  .card-icon{ width: 44px; height: 44px; border-radius: 12px; }
  .card-icon svg{ width: 26px; height: 26px; }
  .card-body h2{
    font-size: 13px; line-height: 1.35; margin-bottom: 0;
    white-space: normal;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .card-body p{ display: none; }   /* 双列布局下隐藏描述文字，保持卡片紧凑 */
  .card-arrow{ display: none; }

  .app-topbar{ padding: 6px 12px; gap: 10px; }
  .back-btn{ padding: 8px 12px; gap: 4px; font-size: 13px; white-space: nowrap; }
  .app-title{ font-size: 13px; }
}

@media (max-width: 380px){
  .portal-header{ padding: 18px 12px 14px; }
  .header-text h1{ font-size: 17px; }
  .portal-grid{ gap: 8px; }
  .app-card{ padding: 12px 6px 10px; }
  .card-icon{ width: 40px; height: 40px; }
  .card-icon svg{ width: 24px; height: 24px; }
  .card-body h2{ font-size: 12.5px; }
}
