/* 沐风学堂 Web —— iOS 观感 + iPad 大屏布局 */
:root {
  --bg: #f2f2f7; --card: #fff; --brand: #ff9500;
  --blue: #007aff; --green: #34c759; --red: #ff3b30; --gray: #8e8e93;
  --radius: 16px; --line: rgba(0,0,0,.08);
  --sider: 218px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
/* hidden 必须优先于 .overlay 的 display:flex，否则弹层会一直盖在页面上 */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Helvetica Neue", sans-serif;
  background: var(--bg); color: #1c1c1e; font-size: 15px;
  padding-bottom: calc(62px + env(safe-area-inset-bottom));
}
h1 { font-size: 22px; font-weight: 800; letter-spacing: -.3px; }
h3 { font-size: 14px; font-weight: 700; }
.muted { color: var(--gray); font-size: 12px; }
#main { max-width: 660px; margin: 0 auto; padding: 0 14px; }
#sider { display: none; }

/* ===== 手机底部导航 ===== */
#tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; background: rgba(255,255,255,.94); backdrop-filter: blur(12px);
  border-top: .5px solid rgba(0,0,0,.12);
  padding-bottom: env(safe-area-inset-bottom);
}
#tabbar .tab {
  flex: 1; border: 0; background: none; padding: 7px 0 6px;
  font-size: 11px; color: var(--gray); display: flex; flex-direction: column; gap: 2px; align-items: center;
}
#tabbar .tab.active { color: var(--brand); }
#tabbar .t-ico { font-size: 21px; line-height: 1; }

.page { padding-top: 14px; }
.card { background: var(--card); border-radius: var(--radius); }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }

/* ===== 学习页 ===== */
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.user-row { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.nick { font-size: 14px; font-weight: 600; }
.avatar {
  border-radius: 50%; background: var(--brand); color: #fff; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 700; overflow: hidden; flex: none;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-s { width: 26px; height: 26px; font-size: 13px; }
.avatar-l { width: 56px; height: 56px; font-size: 24px; cursor: pointer; }
.coin-chip {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; white-space: nowrap;
  background: rgba(255,149,0,.12); color: var(--brand); border-radius: 99px; padding: 3px 10px;
}
.coin-ico { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ffd479, #f5a623); display: inline-block; flex: none; }
.sh-stats { display: flex; gap: 16px; flex: none; padding-top: 4px; }
.stat { text-align: center; }
.stat b { display: block; font-size: 20px; font-weight: 800; line-height: 1.15; }
.stat span { font-size: 10.5px; color: var(--gray); }
.c-green { color: var(--green); } .c-blue { color: var(--blue); }
.c-red { color: var(--red); } .c-orange { color: var(--brand); }
.study-sub { font-size: 12px; color: var(--gray); margin: 6px 0 12px; }

/* 继续学习 hero */
.hero {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 10px; margin-bottom: 14px;
  background: linear-gradient(120deg, #fff4e5, #ffe9cc); border: .5px solid rgba(255,149,0,.25);
  border-radius: var(--radius);
}
.hero .h-cover { width: 86px; height: 56px; border-radius: 10px; object-fit: cover; flex: none; background: #ffcf8a; }
.hero .h-ph { width: 86px; height: 56px; border-radius: 10px; flex: none; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 20px; }
.hero .h-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.hero .h-k { font-size: 11px; color: #b96a00; font-weight: 700; letter-spacing: .3px; }
.hero .h-t { font-size: 15.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero .h-s { font-size: 12px; color: #8a6a3a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hero .btn { flex: none; }

.study-list { display: flex; flex-direction: column; gap: 14px; }
.course-sec { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.cs-cover-wrap { position: relative; }
.cs-cover { width: 100%; aspect-ratio: 16/7; object-fit: cover; display: block; background: #eee; }
.cs-cover.ph { display: flex; flex-direction: column; gap: 4px; align-items: center; justify-content: center; }
.cs-cover.ph b { font-size: 34px; font-weight: 800; line-height: 1; opacity: .9; }
.cs-cover.ph span { font-size: 11px; opacity: .55; letter-spacing: .5px; }
.cs-badge {
  position: absolute; left: 10px; top: 10px; font-size: 11px; font-weight: 700; color: #fff;
  background: rgba(0,0,0,.42); backdrop-filter: blur(6px); padding: 3px 9px; border-radius: 99px;
}
.cs-head { display: flex; align-items: center; gap: 10px; padding: 11px 12px 2px; }
.cs-h-main { flex: 1; min-width: 0; }
.cs-title { font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.cs-meta { font-size: 12px; color: var(--gray); margin-top: 3px; }
.cs-progress { height: 4px; margin: 9px 12px 0; border-radius: 99px; background: rgba(0,0,0,.06); overflow: hidden; }
.cs-progress i { display: block; height: 100%; background: linear-gradient(90deg, #ffb340, #ff8a00); border-radius: 99px; }
.cs-eps { padding: 4px 12px 8px; }
.ep-row { display: flex; align-items: center; gap: 9px; padding: 9px 0; border-top: .5px solid rgba(0,0,0,.06); }
.ep-row:first-child { border-top: 0; }
.ep-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); flex: none; }
.ep-dot.makeup { background: var(--red); }
.ep-name { flex: 1; font-size: 14.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep-name.done { color: #b0b0b5; }
.tag { font-size: 10.5px; border-radius: 5px; padding: 2px 6px; flex: none; }
.tag-makeup { background: rgba(255,59,48,.1); color: var(--red); }
.tag-done { background: rgba(0,0,0,.05); color: var(--gray); }
.btn {
  border: 0; border-radius: 9px; padding: 8px 14px; font-size: 13.5px;
  background: rgba(0,0,0,.06); color: #1c1c1e; cursor: pointer; font-weight: 600;
  font-family: inherit; white-space: nowrap;
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.go { background: var(--blue); color: #fff; padding: 6px 14px; flex: none; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.danger { background: rgba(255,59,48,.1); color: var(--red); }
.btn.wide { width: 100%; margin-top: 12px; padding: 12px; font-size: 15px; }
.btn.ghost { background: rgba(255,255,255,.18); color: #fff; }
.btn:disabled { opacity: .35; }
.icon-btn {
  width: 30px; height: 30px; flex: none; border: 0; border-radius: 9px; background: rgba(0,0,0,.05);
  color: #3a3a3c; font-size: 16px; line-height: 1; cursor: pointer;
}
.notice { font-size: 13px; color: var(--gray); padding: 9px 12px 12px; display: flex; gap: 6px; align-items: center; }

/* ===== 课程库 ===== */
.lib-header { display: flex; flex-direction: column; gap: 10px; margin-bottom: 4px; }
.lib-top { display: flex; flex-direction: column; gap: 10px; }
.lib-brand { display: flex; align-items: center; gap: 9px; }
.logo { width: 32px; height: 32px; border-radius: 9px; }
.brand-alt { display: none; }
.lib-tools { display: flex; align-items: center; gap: 8px; }
.add-btn {
  flex: none; height: 36px; padding: 0 14px; border-radius: 10px; border: 0;
  background: var(--brand); color: #fff; font-size: 13.5px; font-weight: 700; cursor: pointer; font-family: inherit;
}
.search {
  border: 0; border-radius: 10px; padding: 9px 12px; font-size: 14px; flex: 1; min-width: 0;
  background: rgba(0,0,0,.055); outline: none; font-family: inherit;
}
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 0; border-radius: 99px; padding: 6px 14px; font-size: 13px;
  background: rgba(0,0,0,.055); color: #3a3a3c; cursor: pointer; font-weight: 500; font-family: inherit;
}
.chip.active { background: var(--brand); color: #fff; }
.lib-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 13px; margin-top: 12px; }
.lib-card {
  background: var(--card); border-radius: var(--radius); overflow: hidden; cursor: pointer;
  border: 0; padding: 0; text-align: left; font-family: inherit; color: inherit;
  transition: transform .15s ease, box-shadow .15s ease;
}
.lib-card:active { transform: scale(.985); }
.lib-card img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; background: #eee; }
.lib-ph { width: 100%; aspect-ratio: 4/3; display: flex; flex-direction: column; gap: 5px; align-items: center; justify-content: center; color: #fff; }
.lib-ph b { font-size: 30px; font-weight: 800; line-height: 1; opacity: .9; }
.lib-ph span { font-size: 11px; opacity: .55; letter-spacing: .5px; }
.lib-name { font-size: 13.5px; font-weight: 600; padding: 8px 10px 10px; line-height: 1.3; }
.empty { text-align: center; color: var(--gray); padding: 80px 0 40px; display: flex; flex-direction: column; gap: 14px; align-items: center; }

/* ===== 我的 ===== */
.page-title { margin: 4px 0 14px; }
.me-grid { display: flex; flex-direction: column; gap: 12px; }
.me-col { display: flex; flex-direction: column; gap: 12px; }
.me-card { display: flex; align-items: center; gap: 13px; padding: 16px; }
.me-info { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.me-info b { font-size: 16px; }
.me-sub { font-size: 12px; color: var(--gray); }
.stat-row { display: flex; padding: 15px 0; }
.stat-row .stat { flex: 1; }
.me-actions { display: flex; gap: 10px; padding: 14px; }
.me-actions .btn { flex: 1; }
.me-foot { text-align: center; font-size: 11px; color: #c7c7cc; margin: 24px 0 10px; }
.heat-card, .recent-card { padding: 14px; }
.heat { display: grid; grid-template-columns: repeat(10, minmax(0,1fr)); gap: 5px; }
.heat i {
  aspect-ratio: 1; border-radius: 4px; background: rgba(0,0,0,.055);
  font-size: 8px; color: #fff; display: flex; align-items: center; justify-content: center; font-style: normal;
}
.heat i.l1 { background: #ffd9a3; }
.heat i.l2 { background: #ffb340; }
.heat i.l3 { background: #f08a00; }
.rec-row { display: flex; align-items: center; gap: 9px; padding: 8px 0; border-top: .5px solid rgba(0,0,0,.06); }
.rec-row:first-child { border-top: 0; }
.rec-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); flex: none; }
.rec-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.rec-main b { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-main span { font-size: 11.5px; color: var(--gray); }
.rec-day { font-size: 11.5px; color: var(--gray); flex: none; }

/* ===== 弹层 ===== */
.overlay {
  position: fixed; inset: 0; z-index: 100; background: rgba(0,0,0,.42);
  display: flex; align-items: flex-end; justify-content: center;
}
.overlay.dark { background: rgba(0,0,0,.88); align-items: center; }
.sheet {
  background: #fff; width: 100%; max-width: 660px; border-radius: 18px 18px 0 0;
  max-height: 88vh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom);
  animation: up .22s ease; -webkit-overflow-scrolling: touch;
}
.small-sheet { max-width: 480px; }
@keyframes up { from { transform: translateY(40px); opacity: .5; } to { transform: none; opacity: 1; } }
.sheet-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 13px 14px; position: sticky; top: 0; background: #fff; z-index: 2;
  border-bottom: .5px solid rgba(0,0,0,.06);
}
.sheet-bar b { font-size: 15.5px; }
.player-box { width: min(880px, 94vw); }
.pb-bar { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.pb-info { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pb-info b { color: #fff; font-size: 16px; }
.pb-info span { color: rgba(255,255,255,.6); font-size: 12px; }
#p-body .ratio { position: relative; width: 100%; aspect-ratio: 16/9; border-radius: 12px; overflow: hidden; background: #000; }
#p-body .ratio iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
#p-body video { width: 100%; max-height: 62vh; border-radius: 12px; background: #000; display: block; }
#p-body .fallback { color: #ddd; font-size: 13.5px; padding: 24px 6px; line-height: 1.7; text-align: center; }
#p-body .fallback a { color: #7cb8ff; }
.pb-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.pb-actions .btn.primary { flex: 1; padding: 12px; font-size: 15px; }

/* 表单 */
.form { display: flex; flex-direction: column; gap: 12px; padding: 4px 14px 20px; }
.form label { font-size: 12.5px; color: var(--gray); display: block; margin-bottom: 5px; }
.form input[type=text], .form input[type=number], .form input[type=date], .form select, .form textarea {
  width: 100%; border: .5px solid rgba(0,0,0,.15); border-radius: 10px; padding: 10px 11px;
  font-size: 15px; outline: none; background: #fff; font-family: inherit;
}
.form textarea { min-height: 92px; resize: vertical; line-height: 1.5; font-size: 14px; }
.form input:focus, .form textarea:focus { border-color: var(--blue); }
.week-grid { display: flex; gap: 7px; flex-wrap: wrap; }
.wk { border: 0; border-radius: 9px; padding: 8px 0; width: 44px; font-size: 13px; background: rgba(0,0,0,.06); cursor: pointer; font-family: inherit; }
.wk.on { background: var(--blue); color: #fff; }
.stepper { display: flex; align-items: center; gap: 14px; }
.stepper button { width: 34px; height: 34px; border-radius: 10px; border: 0; font-size: 19px; background: rgba(0,0,0,.06); cursor: pointer; }
.stepper b { font-size: 17px; min-width: 26px; text-align: center; }
.cover-pick { display: flex; align-items: center; gap: 12px; }
.cover-pick .prev { width: 96px; height: 64px; border-radius: 10px; object-fit: cover; background: #eee; }
.bili-import { background: rgba(0,122,255,.07); border-radius: 12px; padding: 11px 12px; }
.bili-row { display: flex; gap: 8px; margin-top: 7px; }
.bili-row input { flex: 1; min-width: 0; }
.bili-info { font-size: 12.5px; margin-top: 7px; line-height: 1.5; }
.bili-ok { color: #1e9e4a; }
.bili-bad { color: #e0342f; }
.plan-box { background: rgba(0,0,0,.035); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 12px; }
.plan-box h4 { font-size: 13.5px; }
.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: #6b6b70; background: rgba(0,0,0,.03); border-radius: 10px; padding: 9px 11px; }
.plan-head span { flex: 1; min-width: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; }
.d-today {
  display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #6b6b70;
  background: rgba(0,122,255,.08); border-radius: 10px; padding: 9px 11px;
}
.ep-tools { display: flex; gap: 4px; flex: none; }
.mini {
  width: 26px; height: 26px; border: 0; border-radius: 7px; background: rgba(0,0,0,.05);
  font-size: 12px; color: #3a3a3c; cursor: pointer; font-family: inherit; padding: 0;
}
.mini.danger { color: var(--red); background: rgba(255,59,48,.08); }
.ep-title-btn { flex: 1; min-width: 0; text-align: left; border: 0; background: none; padding: 0; font: inherit; font-size: 14px; color: inherit; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Toast */
#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: rgba(30,30,32,.92); color: #fff; font-size: 13.5px; padding: 9px 18px;
  border-radius: 99px; opacity: 0; pointer-events: none; transition: .25s; z-index: 200; max-width: 80vw;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (min-width: 500px) { .lib-grid { grid-template-columns: repeat(3, minmax(0,1fr)); } }

/* ================= iPad / 大屏 ================= */
@media (min-width: 760px) {
  body { font-size: 15.5px; padding-bottom: 0; background: #f4f4f8; }
  #shell { display: flex; align-items: stretch; min-height: 100vh; min-height: 100dvh; }

  #sider {
    display: flex; flex-direction: column; gap: 4px;
    width: var(--sider); flex: none; position: sticky; top: 0; height: 100vh; height: 100dvh;
    padding: 20px 12px 16px; background: rgba(255,255,255,.9);
    backdrop-filter: blur(20px); border-right: .5px solid var(--line);
  }
  .sider-brand { display: flex; align-items: center; gap: 9px; padding: 2px 8px 16px; font-weight: 800; font-size: 17px; }
  .sider-brand img { width: 34px; height: 34px; border-radius: 9px; }
  .sider-nav { display: flex; flex-direction: column; gap: 3px; }
  .s-nav {
    display: flex; align-items: center; gap: 11px; border: 0; background: none;
    padding: 11px 12px; border-radius: 11px; font-size: 15px; font-weight: 600;
    color: #3a3a3c; cursor: pointer; text-align: left; font-family: inherit; width: 100%;
  }
  .s-nav i { font-style: normal; font-size: 18px; }
  .s-nav.active { background: rgba(255,149,0,.13); color: #c96f00; }
  .sider-stat { margin-top: auto; font-size: 12px; color: var(--gray); padding: 10px 8px; line-height: 1.7; }
  #tabbar { display: none !important; }

  #main { flex: 1; min-width: 0; max-width: 1240px; margin: 0; padding: 26px 30px 40px; }
  .page { padding-top: 0; }
  h1 { font-size: 26px; }
  .page-title { margin: 0 0 16px; }
  .study-sub { margin: 8px 0 16px; font-size: 13px; }
  .stat b { font-size: 26px; }
  .stat span { font-size: 11.5px; }
  .sh-stats { gap: 30px; }

  /* 学习页两列 */
  .study-list { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 16px; align-items: start; }
  .cs-cover { aspect-ratio: 16/9; }
  .hero { padding: 12px 14px 12px 12px; }
  .hero .h-cover, .hero .h-ph { width: 104px; height: 66px; }

  /* 课程库 */
  .lib-top { flex-direction: row; align-items: center; justify-content: space-between; gap: 16px; }
  .lib-brand .logo, .lib-brand .brand-name { display: none; }
  .brand-alt { display: block; }
  .lib-tools { width: min(420px, 46%); }
  .lib-grid { grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
  .lib-card:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.08); }

  /* 我的两列 */
  .me-grid { flex-direction: row; align-items: flex-start; gap: 16px; }
  .me-col { flex: 1; min-width: 0; }
  .heat { grid-template-columns: repeat(15, minmax(0,1fr)); gap: 5px; }

  /* 弹层变成居中卡片 */
  .overlay { align-items: center; padding: 24px; }
  .sheet { border-radius: 18px; max-height: 86vh; max-width: 720px; animation: pop .18s ease; }
  .small-sheet { max-width: 500px; }
  @keyframes pop { from { transform: scale(.97); opacity: .6; } to { transform: none; opacity: 1; } }
  #toast { bottom: 40px; }
}
@media (min-width: 1180px) { .lib-grid { grid-template-columns: repeat(4, minmax(0,1fr)); } }
