/* ==========================================================================
   小芽启蒙课堂 · 宝宝端公共样式
   ========================================================================== */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
body {
    font-family: -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: linear-gradient(160deg, #e8f5ff 0%, #fff7e6 100%);
    min-height: 100vh; color: #333;
}
.hidden { display: none !important; }
button { font-family: inherit; cursor: pointer; }

/* ---------------- 登录 ---------------- */
.login-wrap { max-width: 420px; margin: 12vh auto; background: #fff; padding: 40px 32px;
              border-radius: 24px; box-shadow: 0 8px 30px rgba(0,0,0,.08); }
.login-wrap h1 { text-align: center; font-size: 26px; color: #ff8c1a; margin-bottom: 6px; }
.login-wrap p.sub { text-align: center; color: #909399; margin-bottom: 28px; font-size: 14px; }
.login-wrap input { width: 100%; padding: 16px; font-size: 18px; border: 2px solid #ffd9a0;
                    border-radius: 14px; margin-bottom: 16px; outline: none; }
.login-wrap input:focus { border-color: #ff8c1a; }
.btn-primary { width: 100%; padding: 16px; font-size: 20px; font-weight: bold; color: #fff;
               background: #ff8c1a; border: none; border-radius: 14px; }
.btn-primary:active { background: #e67400; }
.btn-primary:disabled { opacity: .6; }
.login-tip { text-align: center; color: #c0c4cc; font-size: 13px; margin-top: 16px; }

/* ---------------- 顶栏 ---------------- */
.topbar { display: flex; align-items: center; justify-content: space-between;
          padding: 16px 24px; background: #fff; box-shadow: 0 2px 10px rgba(0,0,0,.05);
          position: sticky; top: 0; z-index: 20; }
.topbar .logo { font-size: 22px; font-weight: bold; color: #ff8c1a; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.topbar .user { font-size: 15px; color: #606266; }
.topbar .logout { color: #909399; font-size: 14px; cursor: pointer; }

/* ---------------- 四大类型入口 ---------------- */
.type-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; padding: 22px 24px 6px; }
.type-card { background: #fff; border-radius: 20px; padding: 20px 14px; text-align: center;
             cursor: pointer; border: 2px solid transparent; transition: all .18s;
             box-shadow: 0 4px 16px rgba(0,0,0,.06); }
.type-card:active { transform: scale(.97); }
.type-card.active { border-color: #ff8c1a; background: #fff8ee; }
.tc-icon { font-size: 34px; line-height: 1.1; }
.tc-label { font-size: 17px; font-weight: bold; margin-top: 6px; }
.tc-count { font-size: 12px; color: #909399; margin-top: 2px; }

/* ---------------- 内容区 ---------------- */
.section { padding: 14px 24px 40px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 12px; }
.section-title { font-size: 19px; font-weight: bold; color: #4a3a28; }
.search { padding: 10px 16px; font-size: 15px; border: 2px solid #ffe0b8; border-radius: 12px;
          outline: none; background: #fff; width: 200px; }
.search:focus { border-color: #ff8c1a; }
.chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.chip { padding: 8px 16px; background: #fff; border-radius: 999px; font-size: 14px; color: #606266;
        cursor: pointer; border: 1px solid #eee; }
.chip.active { background: #ff8c1a; color: #fff; border-color: #ff8c1a; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.card { background: #fff; border-radius: 20px; overflow: hidden; cursor: pointer;
        box-shadow: 0 4px 16px rgba(0,0,0,.06); transition: transform .15s; }
.card:active { transform: scale(.97); }
.card .cover { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #ffe8c2; display: block; }
.card .placeholder { width: 100%; aspect-ratio: 16/9; background: #ffe8c2;
        display: flex; align-items: center; justify-content: center; font-size: 40px; }
.card .info { padding: 13px 15px 16px; }
.card .title { font-size: 18px; font-weight: bold; margin-bottom: 7px;
        overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #909399; }
.meta-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tag { padding: 2px 10px; border-radius: 10px; font-size: 12px; flex: none; }
.tag.free { background: #e1f3d8; color: #67c23a; }
.tag.paid { background: #fde2c2; color: #e67400; }
.progbar { height: 8px; background: #eee; border-radius: 4px; margin-top: 12px; overflow: hidden; }
.progbar > i { display: block; height: 100%; background: #ff8c1a; }
.empty { text-align: center; color: #c0c4cc; padding: 70px 20px; font-size: 17px; }

/* ---------------- 播放器通用外壳 ---------------- */
.stage-wrap { position: fixed; inset: 0; background: #000; z-index: 50; display: flex; flex-direction: column; }
.stage-top { display: flex; align-items: center; gap: 14px; padding: 12px 18px; color: #fff;
             background: linear-gradient(180deg, rgba(0,0,0,.75), rgba(0,0,0,0)); flex: none; }
.stage-top .back { font-size: 15px; padding: 8px 16px; background: rgba(255,255,255,.16);
                   border-radius: 10px; cursor: pointer; border: none; color: #fff; }
.stage-top .title { font-size: 17px; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stage-body { flex: 1; position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.stage-body video, .stage-body img { max-width: 100%; max-height: 100%; display: block; }
.stage-body iframe { width: 100%; height: 100%; border: none; background: #fff; }
.stage-foot { padding: 14px 18px; color: #fff; font-size: 13px; text-align: center;
              background: rgba(0,0,0,.35); flex: none; }

@media (max-width: 720px) {
    .type-grid { grid-template-columns: repeat(2, 1fr); }
    .search { width: 130px; }
    .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
    .section { padding: 12px 14px 30px; }
    .type-grid { padding: 14px 14px 4px; }
}

/* ---------------- App 下载入口（登录页 + 登录后全局右上角） ----------------
   两种形态：
     · 在 .topbar-right 里 → 融进顶栏（首页登录后）
     · .floating → 固定悬浮在右上角（登录页、播放器页等没有顶栏的页面）
   -------------------------------------------------------------------------- */
.app-dl { position: relative; display: inline-block; flex: none; }
.app-dl.floating { position: fixed; top: 14px; right: 18px; z-index: 9998; }

.app-dl-btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px;
              background: #fff5e8; color: #e67400; border: 1px solid #ffd9a0; border-radius: 999px;
              font-size: 14px; cursor: pointer; user-select: none; white-space: nowrap;
              transition: background .15s, color .15s, border-color .15s; }
.app-dl-btn:hover { background: #ff8c1a; color: #fff; border-color: #ff8c1a; }
.app-dl.open .app-dl-btn { background: #ff8c1a; color: #fff; border-color: #ff8c1a; }

/* 弹层：默认隐藏，hover 或 .open 时显示 */
.app-dl-pop { position: absolute; top: calc(100% + 10px); right: 0; width: 236px;
              background: #fff; border-radius: 18px; padding: 18px 16px 14px; text-align: center;
              box-shadow: 0 14px 44px rgba(0,0,0,.18); border: 1px solid #f2e6d8;
              opacity: 0; visibility: hidden; transform: translateY(-6px); z-index: 30;
              transition: opacity .18s, transform .18s, visibility .18s; }
.app-dl:hover .app-dl-pop,
.app-dl.open .app-dl-pop { opacity: 1; visibility: visible; transform: translateY(0); }

.app-dl-title { font-size: 14px; font-weight: bold; color: #4a3a28; margin-bottom: 12px; }
.app-dl-qr { width: 168px; height: 168px; margin: 0 auto; line-height: 0; }
.app-dl-qr img, .app-dl-qr canvas { width: 168px !important; height: 168px !important; display: block; }
.app-dl-qrerr { width: 168px; height: 168px; margin: 0 auto; display: flex; align-items: center;
                justify-content: center; background: #faf7f2; border-radius: 10px;
                font-size: 12px; color: #909399; line-height: 1.6; padding: 0 12px; }
.app-dl-sub { font-size: 12px; color: #909399; margin-top: 10px; }
.app-dl-link { display: inline-block; margin-top: 8px; font-size: 12px; color: #ff8c1a;
               text-decoration: none; }
.app-dl-link:hover { text-decoration: underline; }
.app-dl-tip { font-size: 11px; color: #c0c4cc; margin-top: 10px; line-height: 1.55;
              border-top: 1px dashed #f0e6da; padding-top: 9px; }

@media (max-width: 720px) {
    .app-dl-btn { padding: 6px 11px; font-size: 13px; }
    .app-dl-pop { width: 206px; padding: 15px 13px 12px; }
    .app-dl-qr, .app-dl-qr img, .app-dl-qr canvas { width: 146px !important; height: 146px !important; }
    .app-dl-qrerr { width: 146px; height: 146px; }
}
