/* ==========================================================================
   智K网 · 移动端专属样式层（mobile-frontend.css）
   仅作用于 ≤768px 视口，PC 端样式完全隔离、不受影响。
   设计基准：320 / 360 / 375 / 390 / 414 / 430px（iOS + Android 主流分辨率）
   设计语言：延续哑光黄铜 #b8974f 低饱和高端色系
   间距体系：4 / 8 / 12 / 16 / 20 / 24 / 32px
   圆角体系：卡片 16px · 内层 12px · 输入框 12px · 胶囊 999px
   交互曲线：200ms cubic-bezier(.2,.6,.2,1)
   ========================================================================== */

@media (max-width: 768px) {

  /* ---------------------------------------------------------------------
     1. 基础层：排版基准、防溢出、防 iOS 文字缩放与点按高亮
     --------------------------------------------------------------------- */
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  body {
    font-size: 15px;
    line-height: 1.68;
    overflow-x: hidden;
    -webkit-tap-highlight-color: transparent;
    -webkit-font-smoothing: antialiased;
  }

  html, body { max-width: 100%; }

  /* 移动端统一聚焦态：哑光黄铜描边 */
  a, button, input, select, textarea { -webkit-tap-highlight-color: transparent; }
  :focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

  /* 长标题 / 长链接 / 代码块不得撑破视口 */
  h1, h2, h3, .card-body h3, .mine-item h2, .order-info h3, .knowledge-content {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  img, video, svg, iframe { max-width: 100%; }
  table { max-width: 100%; }

  /* 全局内容宽度收敛为单一节奏，所有页面左右留白一致（左右各 16px） */
  .container { width: calc(100% - 32px) !important; }
  body main.course-list-page,
  body main.course-detail,
  body main.live-page,
  body main.live-detail,
  body main.ul-page,
  body main.uc-page,
  body main.orders-page,
  body main.profile-page,
  body main.pay-page,
  body main.player-page,
  body main.mine-page,
  body main.knowledge-page,
  body main.knowledge-detail,
  body main.about-content,
  body main.publish-page {
    width: calc(100% - 32px) !important;
  }

  /* 页面区块节奏：模块间距 24px，底部预留固定导航高度 */
  .section {
    padding-top: 24px !important;
    padding-bottom: calc(88px + env(safe-area-inset-bottom)) !important;
  }

  /* ---------------------------------------------------------------------
     2. 头部导航：可达性优先，保证触控目标 ≥ 40px
     --------------------------------------------------------------------- */
  header .header-inner {
    width: calc(100% - 32px) !important;
    gap: 8px 10px;
    padding: 10px 0 8px;
  }

  header .brand {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    font-size: 18px;
    gap: 8px;
  }
  header .brand-icon {
    width: 30px;
    height: 30px;
    border-radius: 8px;
  }
  header .brand img:not(.brand-icon) { height: 28px; max-width: 132px; }

  /* 主导航：保持两行结构，横向可滑动且隐藏滚动条；导航项均分整行宽度，右侧不留空 */
  .header-inner nav {
    gap: 2px !important;
    padding: 4px 0 2px;
    overflow-x: auto !important;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }
  .header-inner nav::-webkit-scrollbar { display: none; }

  .header-inner nav a {
    flex: 1 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    padding: 0 12px !important;
    font-size: 14.5px !important;
    border-radius: 999px;
    scroll-snap-align: start;
    transition: color 200ms cubic-bezier(.2,.6,.2,1),
                background-color 200ms cubic-bezier(.2,.6,.2,1);
  }
  .header-inner nav a:active {
    color: var(--gold2);
    background: rgba(184,151,79,.12);
  }

  /* 头部右侧入口：已登录显示头像按钮，未登录保留登录胶囊按钮 */
  .header-inner > .btn {
    min-height: 38px;
    padding: 0 16px !important;
    font-size: 14px !important;
  }
  body.u-in .header-inner > .btn {
    position: relative;
    flex: 0 0 auto;
    width: 40px;
    min-width: 40px;
    min-height: 40px;
    padding: 0 !important;
    border: 1px solid rgba(184,151,79,.42) !important;
    border-radius: 50% !important;
    background: rgba(184,151,79,.12) !important;
    color: transparent !important;
    box-shadow: none !important;
    font-size: 0 !important;
  }
  body.u-in .header-inner > .btn::after {
    content: '';
    position: absolute;
    inset: 0;
    margin: auto;
    width: 20px;
    height: 20px;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23ddc99a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='8.4' r='3.8'/%3E%3Cpath d='M4.6 20.2c.9-3.7 3.6-5.8 7.4-5.8s6.5 2.1 7.4 5.8'/%3E%3C/svg%3E") center / contain no-repeat;
  }
  body.u-in .header-inner > .btn:active { background: rgba(184,151,79,.24) !important; }

  /* 全局搜索：默认收起，仅首页通过搜索图标展开，头部由三层降为两层 */
  .msearch-toggle {
    display: none !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 50%;
    background: var(--panel);
    color: var(--muted);
    margin-left: auto;
    transition: color 200ms cubic-bezier(.2,.6,.2,1),
                border-color 200ms cubic-bezier(.2,.6,.2,1);
  }
  .msearch-toggle svg { width: 18px; height: 18px; }
  body.ctrl-index.act-index .msearch-toggle { display: inline-flex !important; }
  body.ctrl-index.act-index .header-inner > .btn { margin-left: 8px !important; }
  body.msearch-open .msearch-toggle { color: var(--gold2); border-color: rgba(184,151,79,.55); }

  /* 移动端搜索条：默认收起，展开后 44px 触控高度 */
  .mobile-search {
    display: none !important;
    width: calc(100% - 32px) !important;
    margin: 6px auto 0 !important;
    gap: 8px;
  }
  body.msearch-open .mobile-search { display: flex !important; }
  .mobile-search input {
    height: 44px !important;
    padding: 0 16px !important;
    border-radius: 999px !important;
    font-size: 16px !important;
  }
  .mobile-search button {
    height: 44px !important;
    padding: 0 18px !important;
    border-radius: 999px !important;
    font-size: 15px !important;
  }

  /* ---------------------------------------------------------------------
     3. 通用按钮与表单：最小触控尺寸 44px，明确按压反馈
     --------------------------------------------------------------------- */
  .btn,
  .gold-btn,
  .pay-submit,
  .login-submit,
  .code-btn,
  .course-search button,
  .knowledge-tools button,
  .publish-submit,
  .live-actions button,
  .chat-form button,
  .knowledge-empty-btn,
  .orders-empty a,
  .mine-head a {
    min-height: 44px !important;
    padding: 0 22px !important;
    border-radius: 999px !important;
    font-size: 15px !important;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: transform 200ms cubic-bezier(.2,.6,.2,1),
                filter 200ms cubic-bezier(.2,.6,.2,1),
                box-shadow 200ms cubic-bezier(.2,.6,.2,1);
  }

  .btn:active,
  .gold-btn:active,
  .pay-submit:active,
  .login-submit:active,
  .code-btn:active,
  .course-search button:active,
  .knowledge-tools button:active,
  .publish-submit:active,
  .live-actions button:active,
  .chat-form button:active,
  .knowledge-empty-btn:active,
  .orders-empty a:active,
  .mine-head a:active {
    transform: scale(.97);
    filter: brightness(1.06);
  }

  /* 输入控件：16px 字号规避 iOS 聚焦自动放大 */
  .login-input,
  .course-search input,
  .profile-form input,
  .profile-form textarea,
  .publish-field input,
  .publish-field select,
  .publish-editor,
  .k-search input,
  .mobile-search input,
  .knowledge-file,
  .site-search input {
    font-size: 16px !important;
  }

  .login-input,
  .course-search input,
  .profile-form input,
  .profile-form textarea,
  .publish-field input,
  .publish-field select,
  .k-search input {
    border-radius: 12px !important;
  }

  .profile-form input,
  .course-search input,
  .k-search input,
  .publish-field input,
  .publish-field select {
    height: 48px !important;
    min-height: 48px !important;
  }

  .profile-form textarea { min-height: 120px !important; }
  .publish-editor { min-height: 240px !important; padding: 14px !important; line-height: 1.8 !important; }

  /* 复选框 / 单选：加大触控面并统一黄铜色 */
  input[type="checkbox"],
  input[type="radio"] {
    width: 20px !important;
    height: 20px !important;
    margin: 0 2px 0 0 !important;
    accent-color: var(--gold);
    vertical-align: middle;
  }
  .profile-actions label {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    font-size: 14.5px;
    color: var(--text);
  }

  /* ---------------------------------------------------------------------
     4. 卡片与排版层级：统一圆角、阴影与字阶
     --------------------------------------------------------------------- */
  .card,
  .course-summary,
  .course-outline,
  .live-panel,
  .pay-card,
  .profile-side,
  .profile-main,
  .uc-side,
  .uc-main,
  .orders-side,
  .orders-main,
  .ul-side,
  .ul-main,
  .player-card,
  .knowledge-article,
  .about-intro,
  .about-stat,
  .mission,
  .profile-card,
  .mine-item {
    border-radius: 16px !important;
    box-shadow: 0 10px 26px rgba(0,0,0,.26);
    transition: transform 200ms cubic-bezier(.2,.6,.2,1),
                border-color 200ms cubic-bezier(.2,.6,.2,1);
  }

  .card:active,
  .uc-card:active,
  .order-card:active,
  .knowledge-item:active {
    transform: scale(.985);
    border-color: var(--gold) !important;
  }

  /* 卡片内排布：留白更舒展，避免文字贴边 */
  .card-body { padding: 16px !important; }
  .card-body h3 { font-size: 17px; line-height: 1.45; margin: 0 0 8px; }
  .card-body p { font-size: 13.5px; line-height: 1.6; }
  .price, .course-price { font-size: 20px !important; }

  .cards { gap: 14px !important; }

  /* 一级 / 二级标题字阶收敛 */
  .course-list-page h1,
  .live-page h1,
  .uc-main h1,
  .orders-main h1,
  .ul-main h1,
  .profile-main h1,
  .pay-card h1,
  .player-card h1,
  .knowledge-article h1,
  .mine-head h1 {
    font-size: 23px !important;
    line-height: 1.3 !important;
    letter-spacing: .3px;
  }
  .course-outline h2,
  .live-info h1,
  .about-intro h2,
  .mission h2 {
    font-size: 19px !important;
    line-height: 1.4 !important;
  }

  /* ---------------------------------------------------------------------
     5. 底部固定导航：安全区适配 + 触控区域 ≥ 50px
     --------------------------------------------------------------------- */
  .mobile-tabs {
    height: calc(62px + env(safe-area-inset-bottom)) !important;
    padding: 4px 0 env(safe-area-inset-bottom) !important;
    /* 实色底：避免页面内容透过底栏显示成半透明残影 */
    background: #11100d !important;
    border-top: 1px solid rgba(184,151,79,.18) !important;
    box-shadow: 0 -8px 24px rgba(0,0,0,.36);
  }
  .mobile-tabs a {
    flex: 1 1 0;
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    min-height: 52px;
    color: #8b8168;
    font-size: 13px !important;
    letter-spacing: .4px;
    transition: color 200ms cubic-bezier(.2,.6,.2,1);
  }
  .mobile-tabs a svg { width: 22px; height: 22px; display: block; }
  .mobile-tabs a.active { color: var(--gold2) !important; font-weight: 700; }
  .mobile-tabs a.active svg { filter: drop-shadow(0 0 6px rgba(184,151,79,.45)); }
  .mobile-tabs a:active { color: var(--gold2) !important; }

  /* ---------------------------------------------------------------------
     6. 首页 / 列表页
     --------------------------------------------------------------------- */
  .hero { padding: 34px 0 26px !important; }
  .home-hero { padding: 22px 16px 18px !important; }
  .hero h1 { font-size: 26px !important; line-height: 1.32; }
  .hero p { font-size: 15px !important; line-height: 1.75; }
  .banner-copy { left: 16px !important; bottom: 14px !important; right: 16px; }
  .banner-copy h1 { font-size: 20px !important; line-height: 1.35; }
  .banner-item, .banner-item img { min-height: 190px; height: 190px !important; }

  .home-section { padding: 20px 16px 8px !important; }
  .home-section h2 { font-size: 19px; }
  .home-advantages {
    grid-template-columns: 1fr !important;
    gap: 18px !important;
    margin-top: 22px !important;
    padding: 20px 16px !important;
    border-radius: 16px;
  }
  .home-advantage { gap: 14px; }
  .adv-icon { width: 44px !important; height: 44px !important; font-size: 20px !important; }
  .home-advantage h3 { font-size: 16px !important; }
  .home-advantage p { font-size: 13.5px !important; line-height: 1.68 !important; }

  /* 课程 / 直播列表 */
  .course-search { flex-direction: row !important; align-items: center; gap: 8px !important; margin: 16px 0 !important; }
  .course-search input {
    flex: 1 1 auto;
    min-width: 0 !important;
    height: 46px !important;
    border-radius: 999px !important;
    font-size: 16px !important;
    padding: 0 16px !important;
  }
  .course-search button {
    flex: 0 0 auto;
    width: auto !important;
    min-width: 84px;
    height: 46px;
    padding: 0 18px !important;
    border-radius: 999px !important;
  }
  .course-filter {
    gap: 8px !important;
    flex-wrap: wrap !important;
    padding-bottom: 0;
    margin-bottom: 14px !important;
  }
  .course-filter::-webkit-scrollbar { display: none; }
  .course-filter a {
    min-height: 38px;
    padding: 0 15px !important;
    display: inline-flex;
    align-items: center;
    border-radius: 999px !important;
    font-size: 13.5px;
    white-space: nowrap;
    transition: background-color 200ms cubic-bezier(.2,.6,.2,1),
                color 200ms cubic-bezier(.2,.6,.2,1);
  }
  .course-hot { font-size: 13px; line-height: 1.9; }
  .course-empty { padding: 64px 18px !important; border-radius: 16px !important; font-size: 14px; }
  .course-pagination { margin-top: 20px !important; }
  .course-pagination a, .knowledge-pager li > a, .knowledge-pager li > span {
    min-width: 38px;
    min-height: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px !important;
    font-size: 13.5px;
  }

  /* 课程详情 */
  .course-summary { display: block !important; }
  .course-cover, .course-cover img { height: 190px !important; min-height: 190px !important; }
  .course-cover { font-size: 26px !important; }
  .course-info { padding: 20px 18px !important; }
  .course-info h1 { font-size: 22px !important; line-height: 1.35; margin-bottom: 10px !important; }
  .course-meta, .course-description { font-size: 14px !important; line-height: 1.78 !important; }
  .course-buy { gap: 12px !important; margin-top: 6px; }
  .course-buy .btn, .buy-form .btn { width: 100%; height: 48px; }
  .buy-form { width: 100%; display: flex; }
  .course-outline { padding: 20px 16px !important; margin-top: 16px !important; }
  .chapter-row { min-height: 50px; padding: 13px 0 !important; gap: 10px !important; font-size: 14.5px; }
  .chapter-name { font-size: 14.5px; line-height: 1.55; }
  .chapter-action {
    flex: none;
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    padding: 0 12px;
    border: 1px solid rgba(184,151,79,.45);
    border-radius: 999px;
    font-size: 13.5px;
    white-space: nowrap;
  }
  .chapter-action:active { background: rgba(184,151,79,.16); }
  .chapter-lock { font-size: 13px; white-space: nowrap; }

  /* 直播 */
  .live-player { height: 210px !important; }
  .live-placeholder { font-size: 18px !important; padding: 0 16px; text-align: center; }
  .live-info { padding: 20px 18px !important; }
  .live-info h1 { margin-bottom: 10px !important; }
  .live-meta { font-size: 14px !important; }
  .live-actions { margin-top: 16px !important; }
  .live-chat { margin-top: 18px !important; padding-top: 16px !important; }
  .chat-list { height: 132px !important; font-size: 14px !important; }
  .chat-form { flex-direction: row !important; gap: 8px !important; min-width: 0; }
  .chat-form input {
    flex: 1 1 auto;
    min-width: 0 !important;
    width: auto !important;
    height: 44px;
    font-size: 16px !important;
    border-radius: 999px !important;
  }
  .chat-form button {
    flex: 0 0 auto;
    min-width: 64px;
    height: 44px;
    border-radius: 999px !important;
    padding: 0 16px !important;
  }

  /* 关于我们 */
  .about-hero { padding: 38px 18px !important; }
  .about-hero h1 { font-size: 26px !important; }
  .about-hero p { font-size: 14px !important; line-height: 1.7; }
  .about-content { padding: 26px 0 calc(88px + env(safe-area-inset-bottom)) !important; }
  .about-intro { grid-template-columns: 1fr !important; gap: 18px !important; padding: 18px !important; }
  .about-intro p { line-height: 1.85 !important; font-size: 14px !important; }
  .about-media { max-height: 240px; border-radius: 12px; }
  .mission { margin-top: 16px !important; padding: 26px 18px !important; }
  .mission p { font-size: 14px !important; line-height: 1.8; }

  /* ---------------------------------------------------------------------
     7. 个人中心 / 订单 / 学习记录
     --------------------------------------------------------------------- */
  .profile-page,
  .uc-page,
  .orders-page,
  .ul-page {
    display: block !important;
    padding-top: 18px !important;
  }

  /* 侧边导航转为自动换行的胶囊条（放不下时换行，避免末项文字被裁切） */
  .profile-side nav,
  .uc-side nav,
  .orders-side nav,
  .ul-side nav {
    display: flex !important;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 10px;
    border: 0;
  }
  .profile-side nav::-webkit-scrollbar,
  .uc-side nav::-webkit-scrollbar,
  .orders-side nav::-webkit-scrollbar,
  .ul-side nav::-webkit-scrollbar { display: none; }

  .profile-side nav a,
  .uc-side nav a,
  .orders-side nav a,
  .ul-side nav a {
    flex: none;
    min-height: 40px;
    display: inline-flex !important;
    align-items: center;
    padding: 0 16px !important;
    border: 1px solid var(--line) !important;
    border-left: 1px solid var(--line) !important;
    border-radius: 999px;
    font-size: 14px;
    white-space: nowrap;
    transition: background-color 200ms cubic-bezier(.2,.6,.2,1),
                color 200ms cubic-bezier(.2,.6,.2,1);
  }
  .profile-side nav a.active,
  .uc-side nav a.active,
  .orders-side nav a.active,
  .ul-side nav a.active {
    background: rgba(184,151,79,.16) !important;
    border-color: var(--gold) !important;
    color: var(--gold2) !important;
  }

  .profile-side,
  .uc-side,
  .orders-side,
  .ul-side {
    margin-bottom: 14px !important;
    border-radius: 16px !important;
    overflow: hidden;
  }
  .ul-side { padding: 0 !important; }
  .profile-side-user, .uhead, .side-user { padding: 16px !important; font-size: 15px; }

  .profile-main, .uc-main, .orders-main, .ul-main { padding: 20px 16px !important; }
  .profile-phone { font-size: 14px !important; line-height: 1.7; }
  .profile-card { padding: 18px 16px !important; margin-top: 18px !important; }
  .profile-form { display: flex !important; flex-direction: column !important; gap: 12px !important; }
  .profile-form .gold-btn { align-self: stretch !important; }
  .profile-actions { gap: 10px !important; }
  .profile-actions,
  .profile-actions form { width: 100% !important; align-items: stretch !important; flex-direction: column !important; }
  .profile-actions a,
  .profile-actions button { width: 100% !important; text-align: center; justify-content: center; }

  .uc-cards { grid-template-columns: 1fr !important; gap: 14px !important; }
  .uc-card { border-radius: 14px; }
  .uc-card .cover { height: 118px !important; }

  /* 订单卡片：缩略图 + 信息纵向堆叠，操作按钮全宽等分 */
  .order-tabs {
    gap: 8px !important;
    overflow-x: auto;
    border-bottom: 1px solid var(--line);
    padding-bottom: 2px;
    scrollbar-width: none;
  }
  .order-tabs::-webkit-scrollbar { display: none; }
  .order-tabs a {
    flex: none;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    padding: 0 14px !important;
    border-radius: 999px;
    font-size: 14px;
    white-space: nowrap;
  }
  .order-tabs a.active {
    background: rgba(184,151,79,.16);
    border-bottom: 2px solid var(--gold) !important;
    color: var(--gold2) !important;
  }

  .order-card { padding: 16px 14px !important; border-radius: 14px !important; margin-bottom: 12px !important; }
  .order-head { font-size: 12.5px !important; gap: 10px; flex-wrap: wrap; padding-bottom: 10px !important; }
  .order-head span { overflow-wrap: anywhere; }
  .order-body { gap: 12px !important; flex-wrap: wrap; padding-top: 12px !important; align-items: flex-start !important; }
  .order-cover { width: 84px !important; height: 54px !important; font-size: 12px; border-radius: 10px !important; }
  .order-info { min-width: 0; }
  .order-info h3 { font-size: 16px !important; line-height: 1.4; margin-bottom: 6px !important; }
  .order-info p { font-size: 12.5px !important; line-height: 1.6; margin: 3px 0 !important; }
  /* 金额独占一行右对齐，避免与标题争抢宽度导致标题折行 */
  .order-price {
    flex: 1 1 100% !important;
    margin: 4px 0 0 !important;
    text-align: right;
  }
  .order-actions { flex-wrap: wrap; gap: 8px !important; margin-top: 12px !important; }
  .order-actions a,
  .order-actions button {
    flex: 1 1 0;
    min-width: 96px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px !important;
    font-size: 14px;
    transition: transform 200ms cubic-bezier(.2,.6,.2,1);
  }
  .order-actions a:active,
  .order-actions button:active { transform: scale(.97); }
  .orders-empty, .uc-empty, .ul-empty { padding: 56px 18px !important; font-size: 14.5px; }

  /* 学习记录：表格横向滑动，字号收紧 */
  .ul-table { font-size: 13px; }
  .ul-table th, .ul-table td { padding: 11px 12px !important; white-space: nowrap; }
  .ul-table th:first-child, .ul-table td:first-child { position: sticky; left: 0; background: #16130e; z-index: 1; }

  /* ---------------------------------------------------------------------
     8. 订单支付 / 退款 / 播放器 / 登录
     --------------------------------------------------------------------- */
  .pay-card { padding: 20px 18px !important; }
  .pay-card p { font-size: 14.5px; line-height: 1.7; }
  .pay-option {
    min-height: 54px;
    padding: 0 16px !important;
    margin: 10px 0 !important;
    border-radius: 12px !important;
    font-size: 15px;
    transition: border-color 200ms cubic-bezier(.2,.6,.2,1),
                background-color 200ms cubic-bezier(.2,.6,.2,1);
  }
  .pay-option:active { background: rgba(184,151,79,.1); }
  .pay-option:has(input:checked) { border-color: var(--gold) !important; background: rgba(184,151,79,.12) !important; }
  .pay-submit { width: 100%; height: 48px; margin-top: 12px; }
  .pay-result { font-size: 14.5px; }
  .pay-result img { max-width: min(220px, 68vw) !important; }

  /* 退款页（容器内卡片） */
  .card.card-body h1 { font-size: 22px !important; }
  .card.card-body .form-control,
  textarea.form-control {
    min-height: 130px;
    font-size: 16px !important;
    border-radius: 12px !important;
  }

  .player-card { padding: 16px 14px !important; }
  .player-video { border-radius: 12px !important; }
  .player-tip { font-size: 13.5px !important; line-height: 1.7; }

  /* 登录页：卡片内边距收窄，按钮与输入框统一 50px 触控高度 */
  .login-wrap {
    min-height: calc(100vh - 58px) !important;
    padding: 24px 16px calc(32px + env(safe-area-inset-bottom)) !important;
    align-items: flex-start !important;
  }
  .login-card {
    width: 100% !important;
    max-width: 440px !important;
    padding: 26px 18px 24px !important;
    border-radius: 20px !important;
    box-shadow: 0 18px 40px rgba(0,0,0,.4);
  }
  .login-card h1 { font-size: 24px !important; margin: 0 0 20px; }
  .login-input { height: 50px !important; border-radius: 12px !important; padding: 0 16px !important; }
  .code-row { gap: 8px !important; margin-top: 14px !important; }
  .code-btn { min-width: 112px; height: 50px !important; border-radius: 12px !important; font-size: 14px !important; }
  .login-submit { height: 50px !important; margin-top: 22px !important; border-radius: 999px !important; font-size: 16.5px !important; }
  .login-tip { font-size: 12.5px !important; line-height: 1.7; margin-top: 16px !important; }

  /* ---------------------------------------------------------------------
     9. 资讯内容 / 我的发布
     --------------------------------------------------------------------- */
  body main.mine-page { min-height: 0 !important; }
  .knowledge-article { padding: 20px 16px !important; }
  .knowledge-article .meta { font-size: 12.5px !important; line-height: 1.8; padding-bottom: 16px !important; margin-bottom: 18px !important; }
  .knowledge-content { font-size: 15px !important; line-height: 1.9 !important; }
  .knowledge-content pre { padding: 14px !important; font-size: 12.5px; border-radius: 10px !important; }
  .knowledge-files { margin-top: 24px !important; padding-top: 18px !important; }
  .knowledge-file {
    min-height: 52px;
    gap: 12px;
    padding: 12px 14px !important;
    border-radius: 10px !important;
    font-size: 13.5px;
        flex-wrap: wrap;
  }
  .knowledge-file span { min-width: 0; overflow-wrap: anywhere; }
  .knowledge-file a { min-height: 36px; display: inline-flex; align-items: center; border-radius: 999px !important; padding: 0 16px !important; }

  .mine-head { align-items: flex-start !important; flex-direction: column !important; gap: 14px !important; }
  .mine-head a { align-self: flex-start; min-width: 0; }
  .mine-item { display: block !important; padding: 16px !important; border-radius: 14px !important; }
  .mine-item h2 { font-size: 16.5px !important; line-height: 1.5; }
  .mine-item p { font-size: 12.5px !important; line-height: 1.7; }
  .mine-status { display: inline-block !important; margin-top: 12px !important; }

  /* 资讯分类胶囊 / 发布页标签与返回：把可点区域补足到 ≥ 38–40px */
  .knowledge-tabs a {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 40px !important;
    padding: 0 16px !important;
    font-size: 14px !important;
  }
  .publish-tag-option {
    height: auto !important;
    min-height: 38px !important;
    padding: 0 16px !important;
    display: inline-flex;
    align-items: center;
    font-size: 14px !important;
    border-radius: 999px !important;
  }
  .publish-back {
    display: inline-flex !important;
    align-items: center;
    min-height: 40px !important;
    padding: 0 18px !important;
    border-radius: 999px !important;
  }
  .editor-toolbar { gap: 8px !important; padding: 10px !important; }
  .editor-toolbar button {
    height: auto !important;
    min-height: 40px !important;
    padding: 0 16px !important;
    font-size: 14px !important;
    border-radius: 999px !important;
  }

  /* 空状态里的内联文字链接（浏览课程 / 去看看 / 发布内容等） */
  .uc-empty a:not(.btn),
  .orders-empty a:not(.btn),
  .ul-empty a:not(.btn),
  .knowledge-empty a:not(.knowledge-empty-btn),
  .mine-empty a:not(.btn),
  .course-empty a:not(.btn) {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    min-height: 44px !important;
    padding: 0 18px !important;
    border: 1px solid rgba(184,151,79,.45);
    border-radius: 999px !important;
    color: var(--gold2);
    font-size: 14px;
    text-decoration: none;
    transition: background-color 200ms cubic-bezier(.2,.6,.2,1);
  }
  .uc-empty a:not(.btn):active,
  .orders-empty a:not(.btn):active,
  .ul-empty a:not(.btn):active,
  .knowledge-empty a:not(.knowledge-empty-btn):active,
  .mine-empty a:not(.btn):active,
  .course-empty a:not(.btn):active {
    background: rgba(184,151,79,.14);
  }

  /* ---------------------------------------------------------------------
     10. 页脚：两行式（导航链接 + 版权/备案），与固定底栏留出安全距离
     --------------------------------------------------------------------- */
  footer {
    padding: 20px 16px calc(74px + env(safe-area-inset-bottom)) !important;
    font-size: 12.5px;
    line-height: 1.8;
    text-align: center;
    letter-spacing: .3px;
  }
  footer .footer-main { font-size: 12.5px; color: var(--muted); }
  /* 页脚导航与顶部导航、底部固定 tab 重复，移动端不再展示 */
  footer .footer-links { display: none !important; }
  footer .footer-copy {
    display: block !important;
    margin-top: 6px;
    font-size: 12px;
    color: #8b8168;
    letter-spacing: .2px;
  }

  /* ---------------------------------------------------------------------
     11. 文件上传控件：隐藏系统默认控件，改为品牌化按钮 + 文件名单行展示
     --------------------------------------------------------------------- */
  .file-field {
    display: flex;
    align-items: center;
    gap: 8px 10px;
    min-height: 48px;
    padding: 5px 10px 5px 12px;
    border: 1px solid rgba(184,151,79,.28);
    border-radius: 12px;
    background: var(--panel2, #211c10);
  }
  .file-field input[type=file] { display: none !important; }
  .file-field .file-btn {
    display: inline-flex !important;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    padding: 0 16px;
    border: 1px solid rgba(184,151,79,.48);
    border-radius: 999px;
    background: rgba(184,151,79,.14);
    color: var(--gold2);
    font-size: 13.5px;
    font-weight: 600;
    white-space: nowrap;
  }
  .file-field .file-name {
    display: block !important;
    flex: 1 1 120px;
    min-width: 0;
    font-size: 12.5px;
    color: var(--muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* ---------------------------------------------------------------------
     12. 统一空状态组件：细线图标 + 文案，替代纯文字空态
     --------------------------------------------------------------------- */
  .course-empty,
  .orders-empty,
  .uc-empty,
  .ul-empty,
  .mine-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 0 !important;
    padding: 36px 18px !important;
    border: 1px dashed rgba(184,151,79,.28) !important;
    border-radius: 16px !important;
    background: rgba(255,255,255,.02) !important;
    color: var(--muted) !important;
    font-size: 14px !important;
    text-align: center;
  }
  .course-empty::before,
  .orders-empty::before,
  .uc-empty::before,
  .ul-empty::before,
  .mine-empty::before {
    content: '' !important;
    width: 52px;
    height: 52px;
    margin: 0 0 2px;
    border: 1px solid rgba(184,151,79,.26);
    border-radius: 50%;
    background:
      rgba(184,151,79,.09)
      url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b8974f' stroke-width='1.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.6 8.4 12 4.4l8.4 4-8.4 4z'/%3E%3Cpath d='M3.6 8.4v7.2l8.4 4 8.4-4V8.4'/%3E%3Cpath d='M12 12.4v7.2'/%3E%3C/svg%3E")
      center / 26px 26px no-repeat;
  }

  /* ---------------------------------------------------------------------
     13. 首页 Hero：空 banner 时渲染品牌化渐变底 + 装饰光效
     --------------------------------------------------------------------- */
  .hero.home-hero {
    padding: 16px 0 10px !important;
    background: transparent !important;
  }
  .hero.home-hero .container {
    position: relative;
    padding: 30px 20px 26px;
    border: 1px solid rgba(184,151,79,.22);
    border-radius: 18px;
    background:
      radial-gradient(120% 96% at 84% 6%, rgba(184,151,79,.22), transparent 62%),
      linear-gradient(142deg, #14110d 0%, #1a1610 54%, #241d10 100%);
    box-shadow: 0 16px 36px rgba(0,0,0,.34);
    overflow: hidden;
  }
  .hero.home-hero .container::after {
    content: '';
    position: absolute;
    right: -56px;
    top: -76px;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(184,151,79,.18), transparent 66%);
    pointer-events: none;
  }
  .hero.home-hero .container > * { position: relative; z-index: 1; }
  .hero.home-hero h1 { margin: 0 0 10px !important; letter-spacing: .6px; }
  .hero.home-hero h1 small {
    display: block;
    margin-top: 6px;
    font-size: 16px;
    font-weight: 400;
    color: var(--gold);
    letter-spacing: 2px;
  }
  .hero.home-hero > .container > .btn { margin-top: 4px; }

  /* ---------------------------------------------------------------------
     14. 课程封面统一暖色：真实图片低饱和处理，避免高饱和蓝紫与金棕暗调冲突
     --------------------------------------------------------------------- */
  .home-section .card img,
  .course-cover img,
  .knowledge-cover img,
  .about-media,
  .banner-item img {
    filter: saturate(.6) sepia(.16) brightness(.94) contrast(.98);
  }

  /* ---------------------------------------------------------------------
     15. 直播卡片：直播中状态加脉冲红点，隐藏无意义的开播时间
     --------------------------------------------------------------------- */
  .cover.is-live {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background:
      radial-gradient(120% 120% at 84% 8%, rgba(184,151,79,.2), transparent 62%),
      linear-gradient(135deg, #2a1f0f, #3d2b13) !important;
    color: #f0dfae !important;
    font-size: 15px !important;
    font-weight: 700;
    letter-spacing: 2px;
  }
  .live-page .cover {
    height: 126px !important;
    font-size: 15px !important;
    font-weight: 700;
    letter-spacing: 2px;
  }
  .live-page .cover:not(.is-live) {
    background:
      radial-gradient(120% 120% at 84% 8%, rgba(184,151,79,.12), transparent 62%),
      linear-gradient(135deg, #171410, #241d12) !important;
    color: #9c927a !important;
  }
  .knowledge-cover:not(.has-img) {
    background: linear-gradient(135deg, #171410, #3a2c17) !important;
    color: #ddc99a !important;
    font-size: 26px !important;
    font-weight: 600;
  }
  .cover.is-live::before {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #e05a4a;
    animation: zkLivePulse 1.8s ease-out infinite;
  }
  @keyframes zkLivePulse {
    0% { box-shadow: 0 0 0 0 rgba(224,90,74,.4); }
    70% { box-shadow: 0 0 0 10px rgba(224,90,74,0); }
    100% { box-shadow: 0 0 0 0 rgba(224,90,74,0); }
  }

  /* ---------------------------------------------------------------------
     16. 学习记录：去掉最小高度留白，进度改为迷你进度条
     --------------------------------------------------------------------- */
  .ul-main { min-height: 0 !important; }
  .ul-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
  }
  .ul-progress span {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12.5px;
    font-variant-numeric: tabular-nums;
  }
  .ul-progress i {
    display: block;
    flex: 1 1 auto;
    max-width: 96px;
    height: 4px;
    border-radius: 999px;
    background: rgba(255,255,255,.09);
    overflow: hidden;
  }
  .ul-progress b {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--gold), var(--gold2));
  }

  /* ---------------------------------------------------------------------
     17. 直播详情操作行：点赞 / 分享并排，图标 + 文字
     --------------------------------------------------------------------- */
  .live-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 14px !important;
  }
  .live-actions button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 40px;
    padding: 0 18px;
    border: 1px solid rgba(184,151,79,.4) !important;
    border-radius: 999px !important;
    background: rgba(184,151,79,.1) !important;
    color: var(--gold2) !important;
    font-size: 13.5px !important;
    font-weight: 600;
    transition: background-color 200ms cubic-bezier(.2,.6,.2,1),
                transform 200ms cubic-bezier(.2,.6,.2,1);
  }
  .live-actions button svg { width: 16px; height: 16px; }
  .live-actions button:active { background: rgba(184,151,79,.22) !important; transform: scale(.97); }
}

/* ==========================================================================
   窄屏（≤430px）：侧栏胶囊导航转为两列等分，避免出现「3 + 1」的失衡排布
   ========================================================================== */
@media (max-width: 430px) {
  .profile-side nav,
  .uc-side nav,
  .orders-side nav,
  .ul-side nav {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .profile-side nav a,
  .uc-side nav a,
  .orders-side nav a,
  .ul-side nav a {
    justify-content: center;
    padding: 0 10px !important;
  }
}

/* ==========================================================================
   超窄屏（≤360px，含 320px）：进一步收敛留白与字阶，杜绝横向溢出
   ========================================================================== */
@media (max-width: 360px) {
  .container { width: calc(100% - 24px) !important; }
  header .header-inner { width: calc(100% - 24px) !important; }
  header .brand { font-size: 16.5px; }
  header .brand-icon { width: 26px; height: 26px; }
  .header-inner nav a { padding: 0 11px !important; font-size: 13.5px !important; }

  .hero h1 { font-size: 23px !important; }
  .banner-copy h1 { font-size: 18px !important; }
  .card-body h3 { font-size: 16px; }
  .course-info h1 { font-size: 20px !important; }
  .course-price { font-size: 24px !important; }
  .course-filter a { padding: 0 12px !important; font-size: 13px; }

  /* 320px：侧栏胶囊导航改为自动换行，避免末项文字被裁切 */
  .profile-side nav,
  .uc-side nav,
  .orders-side nav,
  .ul-side nav {
    flex-wrap: wrap !important;
    overflow-x: visible !important;
    gap: 8px !important;
  }
  .profile-side nav a,
  .uc-side nav a,
  .orders-side nav a,
  .ul-side nav a {
    padding: 0 13px !important;
    font-size: 13.5px !important;
  }

  /* 320px：订单筛选标签压缩，四项可完整呈现 */
  .order-tabs { gap: 6px !important; }
  .order-tabs a { padding: 0 10px !important; font-size: 13px !important; }

  .login-card { padding: 22px 14px 20px !important; }
  .code-btn { min-width: 96px; font-size: 13px !important; }
  .login-submit { font-size: 16px !important; }

  .order-cover { width: 72px !important; height: 48px !important; }
  .order-actions a, .order-actions button { min-width: 88px; font-size: 13.5px; }

  .pay-card, .player-card, .knowledge-article { padding: 16px 14px !important; }
  .mobile-tabs a { font-size: 12.5px !important; }
  .knowledge-tabs a { padding: 0 13px !important; font-size: 13.5px !important; }
  .publish-tag-option { padding: 0 13px !important; font-size: 13.5px !important; }
}

/* 横屏小高度设备：压缩纵向留白，避免内容被底栏挤压 */
@media (max-width: 768px) and (max-height: 420px) {
  .hero { padding: 20px 0 16px !important; }
  .section { padding-top: 16px !important; }
  .mobile-tabs { height: calc(54px + env(safe-area-inset-bottom)) !important; }
  footer { padding-bottom: calc(64px + env(safe-area-inset-bottom)) !important; }
}
