/* ===== AI学习站 · 复刻B站视频频道风格 ===== */
:root {
  --bili-pink: #FB7299;
  --bili-pink-dark: #F25D8E;
  --bili-blue: #00AEEC;
  --text-main: #18191C;
  --text-sub: #61666D;
  --text-light: #9499A0;
  --bg-page: #F6F7F8;
  --bg-card: #FFFFFF;
  --border: #E3E5E7;
  --radius: 8px;
  --shadow-card: 0 2px 8px rgba(0, 0, 0, .06);
  --shadow-hover: 0 8px 24px rgba(0, 0, 0, .14);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
               "Microsoft YaHei", "Helvetica Neue", Helvetica, Arial, sans-serif;
  background: var(--bg-page);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ===== 顶部 ===== */
.site-header {
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .06);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo {
  width: 46px; height: 46px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--bili-pink), #FF9DB5);
  color: #fff;
  font-size: 20px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: .5px;
  box-shadow: 0 4px 12px rgba(251, 114, 153, .35);
  flex-shrink: 0;
}
.brand-text { display: flex; flex-direction: column; gap: 2px; }
.site-title {
  font-size: 22px; font-weight: 700; letter-spacing: .5px; line-height: 1.2;
}
.site-subtitle {
  font-size: 13px; color: var(--bili-pink); font-weight: 500;
}
.header-actions { display: flex; align-items: center; gap: 12px; }

.search-box {
  position: relative;
  display: flex; align-items: center;
  background: var(--bg-page);
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 0 14px;
  height: 36px;
  min-width: 220px;
  transition: all .2s;
}
.search-box:focus-within {
  background: #fff;
  border-color: var(--bili-pink);
}
.icon-search { width: 16px; height: 16px; color: var(--text-light); flex-shrink: 0; }
.search-box input {
  border: none; outline: none; background: transparent;
  margin-left: 8px; font-size: 14px; color: var(--text-main); width: 100%;
}
.search-box input::placeholder { color: var(--text-light); }

.btn-primary {
  background: var(--bili-pink);
  color: #fff;
  border: none;
  border-radius: 20px;
  height: 36px;
  padding: 0 18px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  transition: background .2s, transform .1s;
  white-space: nowrap;
}
.btn-primary:hover { background: var(--bili-pink-dark); }
.btn-primary:active { transform: scale(.97); }
.btn-primary:disabled { background: #FFC4D5; cursor: not-allowed; }
.plus { font-size: 17px; line-height: 1; }

.btn-ghost {
  background: #fff;
  color: var(--text-sub);
  border: 1px solid var(--border);
  border-radius: 20px;
  height: 36px; padding: 0 18px;
  font-size: 14px; cursor: pointer;
  transition: all .2s;
}
.btn-ghost:hover { border-color: var(--bili-pink); color: var(--bili-pink); }

/* ===== 主体 ===== */
.page-main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px 24px 60px;
}
.stat-bar {
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 18px;
  font-size: 13px; color: var(--text-sub);
  flex-wrap: wrap;
}
.stat-bar strong { color: var(--bili-pink); font-size: 16px; }
.stat-divider { color: var(--border); margin: 0 4px; }
.stat-hint { color: var(--text-light); }

/* ===== 卡片网格 ===== */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 20px 16px;
}
.card {
  background: var(--bg-card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: transform .22s ease, box-shadow .22s ease;
  display: flex; flex-direction: column;
  position: relative;
  animation: fadeUp .35s ease both;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); }
.card:hover .cover img { transform: scale(1.06); }
.card:hover .card-title { color: var(--bili-pink); }

.cover {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #E7E9EB;
  overflow: hidden;
}
.cover img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .3s ease;
}
.cover .placeholder {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-light); font-size: 13px;
}
.duration {
  position: absolute; right: 6px; bottom: 6px;
  background: rgba(0, 0, 0, .65);
  color: #fff;
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 4px;
  line-height: 18px;
}
.play-mask {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .18);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity .22s;
}
.card:hover .play-mask { opacity: 1; }
.play-mask svg { width: 44px; height: 44px; color: rgba(255, 255, 255, .95); }

.card-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card-title {
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-main);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 40px;
  transition: color .2s;
  font-weight: 500;
}
.card-meta {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; color: var(--text-light);
  gap: 8px;
}
.author { display: flex; align-items: center; gap: 4px; overflow: hidden; }
.author span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.author svg { width: 13px; height: 13px; flex-shrink: 0; }
.submitter {
  font-size: 11px;
  color: var(--bili-pink);
  background: #FFF0F5;
  border-radius: 4px;
  padding: 1px 6px;
  white-space: nowrap;
}

/* ===== 状态 ===== */
.state-box {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-light);
  font-size: 14px;
}
.state-box[hidden] { display: none; }
.spinner {
  width: 28px; height: 28px;
  border: 3px solid #FFD7E4;
  border-top-color: var(--bili-pink);
  border-radius: 50%;
  margin: 0 auto 14px;
  animation: spin .8s linear infinite;
}
.state-box:not(.loading) .spinner { display: none; }

/* ===== 页脚 ===== */
.site-footer {
  text-align: center;
  padding: 28px 20px 40px;
  color: var(--text-light);
  font-size: 13px;
  border-top: 1px solid var(--border);
  background: #fff;
}
.footer-sub { margin-top: 6px; font-size: 12px; }

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, .5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  padding: 20px;
  animation: fadeIn .18s ease;
}
.modal-mask[hidden] { display: none; }
.modal-card {
  background: #fff;
  border-radius: 12px;
  width: 100%; max-width: 460px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .2);
  overflow: hidden;
  animation: popIn .22s ease;
}
.modal-head {
  padding: 18px 20px 12px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { font-size: 17px; font-weight: 600; }
.modal-close {
  background: none; border: none;
  font-size: 26px; line-height: 1;
  color: var(--text-light); cursor: pointer;
  padding: 0 4px;
}
.modal-close:hover { color: var(--bili-pink); }
.modal-body { padding: 18px 20px; }
.field-label {
  display: block;
  font-size: 13px; font-weight: 500;
  color: var(--text-main);
  margin-bottom: 7px;
}
.optional { color: var(--text-light); font-weight: 400; }
.field-input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 14px;
  outline: none;
  transition: border-color .2s;
  font-family: inherit;
}
.field-input:focus { border-color: var(--bili-pink); }
.field-tip {
  font-size: 12px; color: var(--text-light);
  margin: 6px 0 16px;
}
.preview {
  display: flex; gap: 12px;
  background: var(--bg-page);
  border-radius: 8px;
  padding: 10px;
  margin-top: 4px;
}
.preview[hidden] { display: none; }
.preview img {
  width: 120px; aspect-ratio: 16/9;
  object-fit: cover; border-radius: 6px; flex-shrink: 0;
}
.preview-meta { display: flex; flex-direction: column; gap: 6px; overflow: hidden; }
.preview-title {
  font-size: 13px; font-weight: 500; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.preview-author { font-size: 12px; color: var(--text-light); }
.error-msg {
  color: #F85A5A;
  font-size: 13px;
  margin-top: 12px;
  background: #FFF1F1;
  border-radius: 6px;
  padding: 8px 10px;
}
.error-msg[hidden] { display: none; }
.modal-foot {
  padding: 14px 20px 20px;
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%; bottom: 40px;
  transform: translateX(-50%);
  background: rgba(24, 25, 28, .92);
  color: #fff;
  padding: 10px 20px;
  border-radius: 20px;
  font-size: 14px;
  z-index: 300;
  animation: fadeUp .25s ease;
  max-width: 90vw;
  text-align: center;
}
.toast[hidden] { display: none; }

/* ===== 动画 ===== */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes popIn { from { opacity: 0; transform: scale(.96); } to { opacity: 1; transform: scale(1); } }

/* ===== 移动端 ===== */
@media (max-width: 768px) {
  .header-inner { padding: 12px 14px; gap: 12px; }
  .header-actions { width: 100%; }
  .search-box { flex: 1; min-width: 0; }
  .site-title { font-size: 19px; }
  .page-main { padding: 16px 14px 40px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px 10px; }
  .card-title { font-size: 13px; min-height: 38px; }
  .brand-logo { width: 40px; height: 40px; font-size: 17px; }
  .stat-hint { display: none; }
}
@media (max-width: 380px) {
  .grid { grid-template-columns: 1fr; }
}
