/* ==========================================================================
   AISBOX 应用中心 · 门户样式
   路径：/portal/style.css

   断点约定（手机优先，逐步放大）：
     < 360px     超窄手机（卡片单列）
     360–767px   手机（卡片两列）
     768–1023px  平板（卡片两列，留白更大）
     ≥ 1024px    桌面（三列 + 鼠标悬停效果）
     横向 & max-height 500px   手机横屏：压缩留白，别让首屏全是头部

   兼容性说明（重要）：
     这里刻意不用 clamp()、min()、max()、flex 的 gap 这些新写法。
     国产手机自带浏览器 / 老安卓 WebView 内核偏旧，遇到不认识的函数会把
     整条声明丢掉，页面就塌了（内边距变 0、卡片排成一列）。
     所以尺寸全部写死 px，靠下面的媒体查询分设备。

   改完记得把 index.html 里 portal/style.css 的 ?v= 版本号 +1，否则用户还在读缓存
   ========================================================================== */

:root{
  --teal:#12766D;
  --teal-light:#1B8A80;
  --teal-dark:#0E6B62;
  --page:#EEF1F1;
  --card:#FFFFFF;
  --text:#1F2937;
  --sub:#6B7280;
  --line:#E3E8E8;
}

*{box-sizing:border-box;}
html{
  -webkit-text-size-adjust:100%;   /* 防止 iOS 横屏自动放大字号 */
  text-size-adjust:100%;
}
html,body{margin:0;padding:0;}
body{
  background:var(--page);
  color:var(--text);
  font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","PingFang SC","Hiragino Sans GB","Microsoft YaHei",sans-serif;
  -webkit-font-smoothing:antialiased;
  -webkit-tap-highlight-color:transparent;
  min-height:100vh;
  min-height:100dvh;              /* 移动端浏览器工具栏会吃掉 100vh */
  display:flex;
  flex-direction:column;
  overflow-x:hidden;              /* 兜底：任何元素都不要让页面横向滚动 */
}

/* 图片一律自适应，防止在窄屏上撑破布局 */
img{max-width:100%;height:auto;display:block;}

/* ---------------- 顶部 ---------------- */
.hero{
  background:linear-gradient(160deg,var(--teal) 0%,var(--teal-light) 100%);
  color:#fff;
  padding:34px 18px 30px;
  text-align:center;
  position:relative;
  overflow:hidden;
}
/* 两个半透明装饰圆，纯装饰；不认识 vw 的老内核丢掉也不影响布局 */
.hero::after{
  content:"";
  position:absolute;
  width:280px;height:280px;
  border-radius:50%;
  background:rgba(255,255,255,.07);
  top:-150px;right:-90px;
}
.hero::before{
  content:"";
  position:absolute;
  width:150px;height:150px;
  border-radius:50%;
  background:rgba(255,255,255,.06);
  bottom:-90px;left:-40px;
}
.logo{
  position:relative;
  display:inline-block;
  font-size:30px;
  font-weight:700;
  letter-spacing:3px;
  padding:4px 4px 0;
}
.logo img{height:40px;display:block;margin:0 auto;}
.slogan{
  position:relative;
  margin:8px 0 22px;
  font-size:13px;
  letter-spacing:4px;
  opacity:.82;
}

.search{
  position:relative;
  display:flex;
  margin:0 auto;
  max-width:520px;
}
.search input{
  flex:1;
  min-width:0;                    /* flex 子项必须加，否则长内容会撑破容器 */
  height:46px;
  border:0;
  border-radius:23px;
  padding:0 18px;
  font-size:16px;                 /* ≥16px，否则 iOS 聚焦时会自动放大页面 */
  font-family:inherit;
  color:var(--text);
  background:#fff;
  outline:none;
  box-shadow:0 6px 18px rgba(0,0,0,.12);
  -webkit-appearance:none;        /* 去掉 iOS search 输入框的默认外观 */
  appearance:none;
}
.search input::placeholder{color:#9AA3AF;}
.search input::-webkit-search-cancel-button{-webkit-appearance:none;}
.search button{
  flex:none;
  height:46px;
  margin-left:10px;               /* 不用 flex 的 gap，老内核不支持 */
  padding:0 20px;
  border:0;
  border-radius:23px;
  font-size:15px;
  font-family:inherit;
  font-weight:600;
  color:var(--teal-dark);
  background:#fff;
  cursor:pointer;
  box-shadow:0 6px 18px rgba(0,0,0,.12);
  transition:transform .15s ease, box-shadow .15s ease;
}
.search button:active{transform:scale(.97);}

/* ---------------- 应用网格 ---------------- */
main{
  flex:1;
  width:100%;
  margin:0 auto;
  padding:22px 14px 10px;
}
.grid{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:12px;
}
.card{
  background:var(--card);
  border-radius:14px;
  padding:16px;
  text-decoration:none;
  color:inherit;
  box-shadow:0 2px 10px rgba(15,23,42,.06);
  transition:transform .18s ease, box-shadow .18s ease;
  position:relative;
}
/* 桌面端的右箭头，手机不出现（触屏点整块卡片就够了） */
.go{
  position:absolute;
  top:20px;right:16px;
  font-size:16px;
  color:#C7CFD6;
  opacity:0;
  transform:translateX(-4px);
  transition:all .18s ease;
}
.icon{
  width:46px;
  height:46px;
  border-radius:14px;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:22px;
  background:linear-gradient(150deg,var(--teal),var(--teal-light));
  color:#fff;
  margin-bottom:12px;
  overflow:hidden;
  flex:none;
}
.icon img{width:100%;height:100%;object-fit:cover;}
.name{
  font-size:15px;
  font-weight:600;
  line-height:1.4;
  margin-bottom:6px;
}
.desc{
  font-size:12.5px;
  line-height:1.6;
  color:var(--sub);
  overflow-wrap:anywhere;
}
.tag{
  display:inline-block;
  margin-left:6px;                /* 同理，不用 flex gap */
  font-size:11px;
  font-weight:600;
  line-height:1.6;
  padding:1px 7px;
  border-radius:8px;
  background:rgba(18,118,109,.1);
  color:var(--teal-dark);
  white-space:nowrap;
  vertical-align:1px;
}
.card.off{
  background:#F7F8F9;
  box-shadow:none;
  cursor:not-allowed;
  opacity:.72;
}
.card.off .icon{background:#B9C2C8;}
.card.off .go{display:none;}
.tag.off{background:rgba(107,114,128,.12);color:var(--sub);}

/* 触屏按下反馈 */
.card:active{transform:scale(.99);}

.empty{
  text-align:center;
  color:var(--sub);
  font-size:14px;
  padding:40px 0;
}

/* ---------------- 页脚 ---------------- */
footer{
  text-align:center;
  color:#9AA3AF;
  font-size:12px;
  line-height:1.9;
  padding:30px 20px 26px;
  padding-bottom:calc(26px + env(safe-area-inset-bottom));  /* iPhone 底部圆角 */
}
footer a{color:var(--sub);text-decoration:none;}

/* ==========================================================================
   分设备适配
   ========================================================================== */

/* ---- 超窄屏（iPhone SE 一类）：单列 ---- */
@media (max-width:359px){
  .grid{grid-template-columns:1fr;}
}

/* ---- 平板：留白更大，触控热区更舒服 ---- */
@media (min-width:768px){
  body{font-size:15px;}
  main{max-width:680px;padding:30px 20px 12px;}
  .grid{gap:20px;}
  .card{padding:20px;border-radius:16px;}
  .card .icon{width:52px;height:52px;font-size:24px;}
  .name{font-size:16px;}
  .desc{font-size:13px;}
  .hero{padding:52px 24px 44px;}
  .logo{font-size:36px;}
  .search{max-width:560px;}
  .search input,.search button{height:48px;border-radius:24px;}
}

/* ---- 桌面：三列 + 鼠标悬停反馈 ---- */
@media (min-width:1024px){
  main{max-width:1000px;}
  .grid{grid-template-columns:repeat(3,1fr);gap:22px;}
  .card{padding:22px;}
  .go{top:24px;right:20px;}
  .hero{padding:60px 24px 50px;}
  .search{max-width:620px;}

  .card:hover{
    transform:translateY(-4px);
    box-shadow:0 12px 26px rgba(15,23,42,.13);
  }
  .card:hover .go{opacity:1;transform:translateX(0);}
  .card:active{transform:translateY(-2px);}
  .card.off:hover{transform:none;box-shadow:none;}
  .search button:hover{
    transform:translateY(-1px);
    box-shadow:0 8px 22px rgba(0,0,0,.18);
  }
  .search button:active{transform:translateY(0);}
}

/* 触屏设备不给 hover，避免「点一下之后一直亮着」 */
@media (hover:none){
  .card:hover{transform:none;box-shadow:0 2px 10px rgba(15,23,42,.06);}
  .search button:hover{transform:none;box-shadow:0 6px 18px rgba(0,0,0,.12);}
}

/* ---- 手机横屏：别让头部占满整屏 ---- */
@media (max-height:500px) and (orientation:landscape){
  .hero{padding:20px 20px 18px;}
  .logo{font-size:24px;}
  .slogan{margin:4px 0 12px;}
  main{padding:18px 16px 6px;}
  footer{padding:18px 20px 16px;}
}
