/* ============================================================
 * 前台（index.html）专属样式
 * 深色高级感 + 静态渐变光晕；无 canvas / 无 blur 动画 / 无逐帧 JS
 * ============================================================ */

/* 去掉移动端浏览器默认的方形按压高亮（不跟随圆角，观感突兀） */
button { -webkit-tap-highlight-color: transparent; }

/* ============ 背景：静态渐变光晕（纯 gradient，不做 filter 动画） ============ */
.bg-glow {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(60% 45% at 12% -5%, rgba(99, 102, 241, .18), transparent 70%),
    radial-gradient(45% 40% at 92% 8%, rgba(34, 211, 238, .12), transparent 70%),
    radial-gradient(55% 45% at 50% 105%, rgba(168, 85, 247, .10), transparent 70%);
}

/* ============ 标题区 ============ */
.hero {
  position: relative;
  z-index: 2;
  max-width: 1120px;
  margin: 0 auto;
  padding: 78px 24px 44px;
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .28em;
  color: rgba(238, 241, 255, .42);
}
.eyebrow::before {
  content: "";
  width: 22px;
  height: 1px;
  background: linear-gradient(90deg, #67e8f9, transparent);
}
.hero-title {
  margin-top: 16px;
  font-size: clamp(34px, 5.4vw, 58px);
  font-weight: 700;
  letter-spacing: .01em;
  line-height: 1.15;
  background: linear-gradient(105deg, #ffffff 15%, #c7d2fe 55%, #9bb4ff 90%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-sub {
  margin-top: 14px;
  font-size: 14.5px;
  letter-spacing: .04em;
  color: rgba(238, 241, 255, .5);
}
.hero-meta {
  margin-top: 26px;
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 9px 18px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 999px;
  background: rgba(255, 255, 255, .04);
  font-size: 12.5px;
  letter-spacing: .06em;
  color: rgba(238, 241, 255, .55);
}
.hero-meta b {
  font-size: 17px;
  font-weight: 700;
  color: #a5f3fc;
  font-variant-numeric: tabular-nums;
}

/* ============ 应用网格 ============ */
.grid {
  position: relative;
  z-index: 2;
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px 72px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 20px;
}

/* 卡片 */
.card {
  --ac: #38bdf8;
  --ac2: #818cf8;
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 22px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, .07);
  background: linear-gradient(180deg, rgba(255, 255, 255, .045), rgba(255, 255, 255, .015));
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28);
  /* 入场：backwards 填充——延迟期间保持初始态，动画结束后交还给基础样式，
     这样 hover 的 transform 不会被动画的结束态永久覆盖 */
  animation: cardIn .5s cubic-bezier(.22, 1, .36, 1) backwards;
  animation-delay: var(--d, 0ms);
  transition:
    transform .28s cubic-bezier(.22, 1, .36, 1),
    border-color .25s,
    box-shadow .25s;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: none; }
}
.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in srgb, var(--ac) 42%, transparent);
  box-shadow: 0 18px 44px rgba(0, 0, 0, .42);
}
.card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.card-icon {
  position: relative;
  flex-shrink: 0;
  width: 56px;
  height: 56px;
  border-radius: 15px;
  overflow: hidden;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .3s cubic-bezier(.22, 1, .36, 1);
}
.card:hover .card-icon { transform: scale(1.06); }
.card-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
/* 无图标 / 图标加载失败时的首字母占位（默认隐藏，仅图片坏掉时出现） */
.card-icon .fallback {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: color-mix(in srgb, var(--ac) 85%, white);
}
.card-icon img.broken { display: none; }
.card-icon img.broken + .fallback { display: flex; }

.card-tit { min-width: 0; }
.card-name {
  font-size: 17px;
  font-weight: 650;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-cat {
  display: inline-block;
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  color: color-mix(in srgb, var(--ac) 80%, white);
  background: color-mix(in srgb, var(--ac) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--ac) 22%, transparent);
  padding: 2px 9px;
  border-radius: 999px;
}
.card-desc {
  margin-top: 14px;
  font-size: 13.5px;
  line-height: 1.65;
  color: rgba(238, 241, 255, .5);
  min-height: 44px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-foot {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, .06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-size {
  font-size: 12px;
  letter-spacing: .05em;
  color: rgba(238, 241, 255, .38);
  font-variant-numeric: tabular-nums;
}
.card-go {
  flex-shrink: 0;
  border: 1px solid color-mix(in srgb, var(--ac) 55%, transparent);
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 650;
  letter-spacing: .06em;
  color: color-mix(in srgb, var(--ac) 85%, white);
  background: transparent;
  padding: 8px 21px;
  border-radius: 999px;
  transition: background .22s, border-color .22s, color .22s, transform .18s;
}
.card-go:hover {
  background: color-mix(in srgb, var(--ac) 16%, transparent);
  border-color: color-mix(in srgb, var(--ac) 80%, transparent);
}
.card-go:active { transform: scale(.96); }
.card-go[disabled] { cursor: default; opacity: .55; transform: none; }

/* 骨架屏（数据到达前） */
.skel {
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, .05);
  background: rgba(255, 255, 255, .02);
  padding: 22px;
  min-height: 200px;
}
.skel i {
  display: block;
  border-radius: 8px;
  background: rgba(255, 255, 255, .055);
  animation: pulse 1.6s ease-in-out infinite;
}
.skel .s1 { width: 56px; height: 56px; border-radius: 15px; }
.skel .s2 { width: 45%; height: 14px; margin-top: 20px; animation-delay: .1s; }
.skel .s3 { width: 78%; height: 11px; margin-top: 14px; animation-delay: .2s; }
.skel .s4 { width: 34%; height: 11px; margin-top: 10px; animation-delay: .3s; }
@keyframes pulse { 50% { opacity: .45; } }

/* 空状态 */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: rgba(238, 241, 255, .35);
  font-size: 14px;
  letter-spacing: .04em;
}

/* ============ 密码弹窗 ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(6, 7, 15, .72);
  opacity: 1;
  transition: opacity .28s;
}
.modal.hidden {
  opacity: 0;
  pointer-events: none;
}
.modal-card {
  width: min(340px, 92vw);
  padding: 10px;
  border-radius: 999px;
  background: rgba(17, 19, 32, .96);
  border: 1px solid rgba(255, 255, 255, .1);
  box-shadow: 0 24px 70px rgba(0, 0, 0, .6);
  transition: transform .3s cubic-bezier(.22, 1, .36, 1);
}
.modal.hidden .modal-card { transform: translateY(14px) scale(.97); }
.pwd-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pwd-row input {
  flex: 1;
  min-width: 0;
  padding: 11px 6px 11px 18px;
  border: none;
  outline: none;
  background: transparent;
  color: var(--ink);
  font-size: 15px;
  font-family: inherit;
  letter-spacing: 3px;
  caret-color: #a5f3fc;
}
.pwd-row input::placeholder { letter-spacing: 1px; color: rgba(238, 241, 255, .35); }
.pwd-ok {
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: .06em;
  color: #04121a;
  background: linear-gradient(135deg, #67e8f9, #a5b4fc);
  padding: 10px 20px;
  border-radius: 999px;
  transition: transform .18s, opacity .25s;
}
.pwd-ok:active { transform: scale(.95); }
.pwd-ok:disabled { opacity: .5; cursor: default; }
.pwd-err {
  margin: 6px 0 0;
  text-align: center;
  font-size: 12px;
  color: #fda4af;
}
.pwd-err:empty { display: none; }

/* ============ 页脚 ============ */
.footer {
  position: relative;
  z-index: 2;
  max-width: 1120px;
  margin: 0 auto;
  padding: 28px 24px 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  color: rgba(238, 241, 255, .3);
  font-size: 12.5px;
  letter-spacing: .05em;
}
.admin-link {
  color: rgba(238, 241, 255, .35);
  text-decoration: none;
  font-size: 12px;
  letter-spacing: .08em;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 999px;
  transition: color .25s, border-color .25s, background .25s;
}
.admin-link:hover {
  color: rgba(238, 241, 255, .8);
  border-color: rgba(255, 255, 255, .2);
  background: rgba(255, 255, 255, .04);
}

/* ============ 响应式 ============ */
@media (max-width: 640px) {
  .hero { padding: 52px 18px 30px; }
  .hero-sub { font-size: 13.5px; }
  .grid { grid-template-columns: 1fr; padding: 0 16px 48px; gap: 16px; }
  .card { padding: 18px; }
  .card-desc { min-height: 0; }
  .footer { flex-direction: column; justify-content: center; text-align: center; }
}

/* 尊重系统「减少动态效果」 */
@media (prefers-reduced-motion: reduce) {
  .card,
  .card-icon,
  .card-go,
  .modal-card { transition: none; }
  .card { animation: none; opacity: 1; transform: none; }
  .skel i { animation: none; }
}
