/* 喵喵云学生端整站优化层 v1
   目标：统一视觉、修正桌面卡片布局、补足移动端细节，不改变现有业务逻辑。 */
:root {
  --meow-ink: #2b1a12;
  --meow-muted: #8b7a70;
  --meow-line: #f1e7e1;
  --meow-orange: #ff7a45;
  --meow-orange-deep: #f25b28;
  --meow-soft: #fff7f2;
  --meow-shadow: 0 10px 28px rgba(86, 49, 28, 0.07);
}

/* 1. 侧栏统一浅色，消除内容区左侧的大块深棕空白 */
.ant-layout-sider.ant-layout-sider-dark {
  background: #fff !important;
  border-right: 1px solid var(--meow-line);
  box-shadow: none !important;
}
.ant-layout-sider.ant-layout-sider-dark .ant-layout-sider-children {
  background: #fff !important;
}
.ant-layout-sider.ant-layout-sider-dark .ant-menu-light {
  border-right: 0 !important;
}

/* 2. 课程卡片：统一圆角、标题层级与悬停反馈 */
html.meow-page-course-list .app-list > .ant-card,
html.meow-page-course-unit .app-list > .ant-card {
  border-radius: 16px !important;
  border-color: #f4e9e2 !important;
  box-shadow: var(--meow-shadow) !important;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
html.meow-page-course-list .app-list > .ant-card:hover,
html.meow-page-course-unit .app-list > .ant-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 36px rgba(86, 49, 28, 0.12) !important;
}
html.meow-page-course-list .app-list .ant-card-meta-title,
html.meow-page-course-unit .app-list .ant-card-meta-title {
  color: var(--meow-ink) !important;
  font-weight: 600 !important;
}
html.meow-page-course-list .app-list .meow-learn-badge,
html.meow-page-course-unit .app-list .meow-learn-badge {
  border-radius: 999px !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 12px rgba(86, 49, 28, 0.08);
}

/* 3. 桌面课程列表：固定 400px 双列改为随容器伸缩的三列 */
@media (min-width: 1280px) {
  html.meow-page-course-list .app-list {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 22px !important;
    align-items: stretch !important;
  }
  html.meow-page-course-list .app-list > .ant-card {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  html.meow-page-course-list .app-list > .ant-card .ant-card-cover {
    aspect-ratio: 16 / 9;
    overflow: hidden;
  }
  html.meow-page-course-list .app-list > .ant-card .ant-card-cover img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }
  html.meow-page-course-list .app-list > .ant-card .ant-card-body {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
  }
  html.meow-page-course-list .app-list > .ant-card .ant-card-meta {
    flex: 1 1 auto !important;
  }
}
@media (min-width: 960px) and (max-width: 1279px) {
  html.meow-page-course-list .app-list {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 20px !important;
    align-items: stretch !important;
  }
  html.meow-page-course-list .app-list > .ant-card {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  html.meow-page-course-list .app-list > .ant-card .ant-card-cover {
    aspect-ratio: 16 / 9;
    overflow: hidden;
  }
  html.meow-page-course-list .app-list > .ant-card .ant-card-cover img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }
  html.meow-page-course-list .app-list > .ant-card .ant-card-body {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
  }
  html.meow-page-course-list .app-list > .ant-card .ant-card-meta {
    flex: 1 1 auto !important;
  }
}
@media (min-width: 821px) and (max-width: 959px) {
  html.meow-page-course-list .app-list {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px !important;
    align-items: stretch !important;
  }
  html.meow-page-course-list .app-list > .ant-card {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
  }
  html.meow-page-course-list .app-list > .ant-card .ant-card-cover {
    aspect-ratio: 16 / 9;
    overflow: hidden;
  }
  html.meow-page-course-list .app-list > .ant-card .ant-card-cover img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }
  html.meow-page-course-list .app-list > .ant-card .ant-card-body {
    flex: 1 1 auto !important;
    display: flex !important;
    flex-direction: column !important;
  }
  html.meow-page-course-list .app-list > .ant-card .ant-card-meta {
    flex: 1 1 auto !important;
  }
}

/* 4. 桌面课程单元：四列紧凑排布，状态徽章上移，避免压住标题 */
@media (min-width: 1280px) {
  html.meow-page-course-unit .app-list {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 18px !important;
    align-items: stretch !important;
  }
}
@media (min-width: 960px) and (max-width: 1279px) {
  html.meow-page-course-unit .app-list {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 18px !important;
    align-items: stretch !important;
  }
}
@media (min-width: 821px) and (max-width: 959px) {
  html.meow-page-course-unit .app-list {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px !important;
    align-items: stretch !important;
  }
}
@media (min-width: 821px) {
  html.meow-page-course-unit .app-list > .meow-learn-card {
    width: auto !important;
    max-width: none !important;
    margin: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    position: relative;
  }
  html.meow-page-course-unit .app-list > .meow-learn-card .ant-card-body {
    display: flex !important;
    flex-direction: column !important;
    width: 100% !important;
    height: 100% !important;
    padding: 14px 14px 42px !important;
    box-sizing: border-box !important;
  }
  html.meow-page-course-unit .app-list > .meow-learn-card .ant-card-meta {
    flex: 1 1 auto !important;
  }
  html.meow-page-course-unit .app-list > .meow-learn-card .ant-card-meta-title {
    padding-top: 24px !important;
    margin-bottom: 8px !important;
  }
  html.meow-page-course-unit .app-list > .meow-learn-card .ant-card-meta-description {
    height: 132px !important;
    overflow: hidden !important;
    border-radius: 10px !important;
    background: var(--meow-soft);
  }
  html.meow-page-course-unit .app-list > .meow-learn-card .ant-card-meta-description img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
  }
  html.meow-page-course-unit .app-list > .meow-learn-card .meow-learn-badge {
    top: 10px !important;
    right: 10px !important;
    padding: 3px 8px !important;
    font-size: 11px !important;
  }
  html.meow-page-course-unit .app-list > .meow-learn-card .meow-homework-action {
    margin-top: auto !important;
    padding-top: 10px !important;
    justify-content: flex-end !important;
  }
  html.meow-page-course-unit .app-list > .meow-learn-card .meow-quiz-link {
    position: absolute !important;
    left: auto !important;
    right: 10px !important;
  }
}

/* 5. 作品预览：补全容器，避免缩略图只有 16px 宽或整块空白 */
html.meow-page-account .ant-card-cover {
  height: 160px !important;
  overflow: hidden !important;
  background: linear-gradient(135deg, #fffaf6 0%, #ffe9dc 100%);
}
html.meow-page-account .ant-card-cover .meta-cardInfo,
html.meow-page-account .ant-card-cover .meta-cardInfo a {
  display: block !important;
  width: 100% !important;
  height: 100% !important;
}
html.meow-page-account .ant-card-cover .meta-cardInfo img {
  width: 100% !important;
  height: 100% !important;
  object-fit: cover !important;
  border-radius: 0 !important;
}
.meow-img-fallback {
  object-fit: contain !important;
  padding: 12px !important;
  background: linear-gradient(135deg, #fffaf6 0%, #ffe7d9 100%) !important;
  color: transparent !important;
}

/* 6. 手机端保持现有适配逻辑，只做细节统一 */
@media (max-width: 820px) {
  html.meow-page-course-unit .app-list > .meow-learn-card {
    border-radius: 14px !important;
  }
  html.meow-page-course-list .app-list > .ant-card,
  html.meow-page-course-unit .app-list > .meow-learn-card {
    box-shadow: 0 8px 22px rgba(86, 49, 28, 0.06) !important;
  }
  .meow-img-fallback {
    padding: 8px !important;
  }
}

/* 7. 首屏外的单元卡片减少同步渲染开销 */
@media (min-width: 821px) {
  html.meow-page-course-unit .app-list > .meow-learn-card:nth-child(n + 9) {
    content-visibility: auto;
    contain-intrinsic-size: 290px 320px;
  }
}

/* 8. 手机端数据表格：允许横向滑动，避免列被硬挤到不可见 */
@media (max-width: 820px) {
  .ant-table-wrapper {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
  }
  .ant-table {
    min-width: 760px;
  }
  .ant-table-content {
    overflow-x: auto !important;
  }
}
