.cx-profile-learning-panel {
  --cx-page: var(--page, #eef8f5);
  --cx-card: var(--card, #fff);
  --cx-text: var(--text, #173f36);
  --cx-muted: var(--muted, #7a908b);
  --cx-line: var(--line, #e2eeea);
  --cx-green: var(--green, #0fb486);
  --cx-green-deep: var(--green-deep, #087e62);
  --cx-mint: var(--mint, #dff6ee);
  --cx-blue-soft: var(--blue-soft, #eaf4fb);
  --cx-blue: var(--blue, #4b8eb4);
  --cx-purple-soft: var(--purple-soft, #f0eaff);
  --cx-purple: var(--purple, #7255ad);
  --cx-yellow-soft: var(--yellow-soft, #fff4d7);
  --cx-yellow: var(--yellow, #b87b0c);
  --cx-danger: var(--danger, #d85454);
  position: fixed;
  z-index: 105;
  top: 0;
  bottom: 0;
  left: 50%;
  display: grid;
  width: min(100%, 430px);
  height: 100dvh;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
  color: var(--cx-text);
  background: var(--cx-page);
  box-shadow: 0 0 70px rgba(20, 60, 47, .16);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  transform: translateX(-50%);
  isolation: isolate;
}

.cx-profile-learning-panel[hidden] { display: none !important; }
.cx-profile-learning-panel * { box-sizing: border-box; }
.cx-profile-learning-panel button { min-width: 0; max-width: 100%; margin: 0; padding: 0; border: 0; background: transparent; color: inherit; font: inherit; }
.cx-profile-learning-panel button:not(:disabled) { cursor: pointer; }
.cx-profile-learning-panel button:disabled { cursor: not-allowed; opacity: .55; }
.cx-profile-learning-panel img { display: block; max-width: 100%; }

.cx-profile-learning-nav {
  position: relative;
  z-index: 4;
  display: grid;
  min-height: calc(48px + env(safe-area-inset-top));
  grid-template-columns: 72px minmax(0, 1fr) 72px;
  align-items: end;
  padding: env(safe-area-inset-top) 8px 6px;
  background: rgba(238, 248, 245, .96);
  backdrop-filter: blur(18px) saturate(145%);
}

.cx-profile-learning-nav > button {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  align-self: center;
  border-radius: 50%;
  color: #111;
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
}

.cx-profile-learning-nav > h2 { align-self: center; margin: 0; overflow: hidden; color: #111; font-size: 17px; font-weight: 500; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.cx-profile-learning-scroll { min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.cx-profile-learning-content { width: 100%; min-height: 100%; padding: 0 14px; overflow-x: hidden; }
.cx-learning-card { width: 100%; min-width: 0; overflow: hidden; border: 1px solid var(--cx-line); border-radius: 21px; background: var(--cx-card); }

/* Grade settings: exact 750rpx -> 375px conversion from the mini program. */
.cx-grade-page { padding-bottom: calc(35px + env(safe-area-inset-bottom)); }
.cx-grade-hero { padding: 10px 4px 14px; text-align: center; }
.cx-grade-hero-icon { margin-bottom: 6px; font-size: 37px; }
.cx-grade-hero h1 { margin: 0; color: var(--cx-green-deep); font-size: 22px; line-height: 1.25; font-weight: 500; }
.cx-grade-hero p { margin: 4px 0 0; color: var(--cx-muted); font-size: 13px; line-height: 1.55; }
.cx-grade-promotion-note { display: flex; align-items: center; gap: 9px; padding: 12px; }
.cx-grade-promotion-note > span { display: flex; width: 31px; height: 31px; flex: 0 0 auto; align-items: center; justify-content: center; border-radius: 9px; background: var(--cx-green); color: #fff; font-size: 18px; }
.cx-grade-promotion-note strong,.cx-grade-promotion-note small { display: block; }
.cx-grade-promotion-note strong { margin-bottom: 3px; font-size: 15px; font-weight: 800; }
.cx-grade-promotion-note small { color: var(--cx-muted); font-size: 10.5px; line-height: 1.5; }
.cx-grade-group { margin-top: 10px; padding: 13px; }
.cx-grade-group h2 { margin: 0 0 9px; color: var(--cx-green-deep); font-size: 14px; font-weight: 800; }
.cx-grade-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
.cx-grade-option { display: flex; min-height: 38px; align-items: center; justify-content: center; gap: 4px; border: 1px solid transparent !important; border-radius: 8px; background: #f5f8f7 !important; color: #566d67 !important; font-size: 12px !important; }
.cx-grade-option.is-selected { border-color: var(--cx-green) !important; background: var(--cx-mint) !important; color: var(--cx-green-deep) !important; font-weight: 800 !important; }
.cx-grade-option b { color: var(--cx-green); }
.cx-grade-confirm { display: flex; width: 100%; min-height: 42px; align-items: center; justify-content: center; margin-top: 14px !important; padding: 0 14px !important; border-radius: 12px !important; background: var(--cx-green) !important; color: #fff !important; font-size: 12px !important; font-weight: 500 !important; }

/* Favorites groups. */
.cx-favorites-page { padding: 0 0 calc(35px + env(safe-area-inset-bottom)); }
.cx-favorites-page > h1 { margin: 0; color: var(--cx-green-deep); font-size: 22px; line-height: 1.25; font-weight: 500; }
.cx-favorites-page > p { margin: 4px 0 0; color: var(--cx-muted); font-size: 13px; line-height: 1.55; }
.cx-favorite-tabs-card { margin: 14px 0 11px; padding: 5px; }
.cx-favorite-tabs { display: grid; width: 100%; gap: 4px; }
.cx-favorite-tabs.cx-tab-count-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cx-favorite-tabs.cx-tab-count-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cx-favorite-tabs button { display: flex; min-width: 0; min-height: 38px; align-items: center; justify-content: center; gap: 4px; padding: 0 5px; border-radius: 12px; color: #698078; font-size: 12.5px; font-weight: 600; line-height: 1; white-space: nowrap; }
.cx-favorite-tabs button.is-active { background: #dcf7ee; color: #08795d; font-weight: 700; }
.cx-favorite-tabs small { display: flex; min-width: 18px; height: 18px; align-items: center; justify-content: center; padding: 0 4px; border-radius: 999px; background: #a6c6bd; color: #fff; font-size: 9px; font-weight: 700; line-height: 18px; }
.cx-favorite-tabs .is-active small { background: #10b889; }
.cx-favorite-list { display: grid; gap: 8px; }
.cx-favorite-card { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 27px; gap: 0; align-items: center; padding: 11px; }
.cx-favorite-main { display: grid; width: 100%; min-width: 0; grid-template-columns: 43px minmax(0, 1fr); gap: 9px; align-items: center; text-align: left; }
.cx-favorite-cover { display: flex; width: 43px; height: 43px; align-items: center; justify-content: center; overflow: hidden; border-radius: 11px; background: #eaf5ff; color: #2f76aa; font-size: 10.5px; font-weight: 800; }
.cx-favorite-cover img { width: 100%; height: 100%; object-fit: cover; }
.cx-favorite-cover.topic { background: #e8f8f2; color: #168064; }
.cx-favorite-cover.lesson { background: #f0eaff; color: #7352a3; }
.cx-favorite-cover.note { background: #fff4d5; color: #a76e10; }
.cx-favorite-cover.video { background: #e9f2ff; color: #3978b3; }
.cx-favorite-cover.report { background: linear-gradient(135deg, #e5f2ff, #e9e5ff); color: #3d6fa5; font-size: 9.5px; }
.cx-favorite-copy { min-width: 0; }
.cx-favorite-copy > strong,.cx-favorite-copy > small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cx-favorite-copy > strong { font-size: 13.5px; font-weight: 800; }
.cx-favorite-copy > small { margin-top: 3.5px; color: var(--cx-muted); font-size: 10px; line-height: 1.4; }
.cx-favorite-copy > i { display: inline-flex; margin-top: 5px; padding: 2px 5.5px; border-radius: 999px; background: var(--cx-mint); color: var(--cx-green-deep); font-size: 8.5px; font-style: normal; }
.cx-favorite-remove { display: flex; width: 27px; height: 27px; align-items: center; justify-content: center; justify-self: end; color: #ca584e !important; }
.cx-trash-icon { position: relative; display: block; width: 13px; height: 14px; }
.cx-trash-icon > i { position: absolute; top: 1px; left: 2px; width: 10px; height: 2px; border-radius: 999px; background: currentColor; }
.cx-trash-icon > i::before { position: absolute; top: -2px; left: 3px; width: 4px; height: 3px; border: 1px solid currentColor; border-bottom: 0; border-radius: 2px 2px 0 0; content: ""; }
.cx-trash-icon > b { position: absolute; right: 2px; bottom: 0; left: 2px; display: flex; height: 10px; align-items: center; justify-content: center; gap: 2px; border: 2px solid currentColor; border-top: 0; border-radius: 0 0 3px 3px; }
.cx-trash-icon > b > i { width: 1px; height: 6px; border-radius: 999px; background: currentColor; opacity: .72; }

.cx-report-favorite-card { padding: 11px; }
.cx-report-favorite-main { display: grid; width: 100%; min-width: 0; grid-template-columns: 43px minmax(0, 1fr) 13px; gap: 9px; align-items: center; text-align: left; }
.cx-favorite-chevron { color: #8aa098; font-size: 17px; font-weight: 400; }
.cx-report-tags { display: flex; min-width: 0; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.cx-report-tags i { padding: 2px 5px; border-radius: 999px; background: #eef7f4; color: #376b5d; font-size: 8.5px; font-style: normal; }
.cx-report-tags i.has-scan { background: #e7f4ff; color: #34729e; }
.cx-report-tags i.no-scan { background: #f3f5f4; color: #82918c; }
.cx-report-favorite-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; margin-top: 10px; padding-top: 9px; border-top: 1px solid #edf3f1; }
.cx-report-favorite-actions button { display: flex; min-width: 0; min-height: 35px; align-items: center; justify-content: center; padding: 0 5px; border-radius: 11px; background: #e3f6ef; color: #08795d; font-size: 11px; line-height: 1.2; }
.cx-report-favorite-actions button.scan { background: #e8f3ff; color: #3574a4; }
.cx-report-favorite-actions button.unfavorite { background: #fff1f3; color: #bd5263; }
.cx-learning-empty { display: grid; justify-items: center; gap: 8px; margin-top: 10px; padding: 40px 15px; color: var(--cx-muted); font-size: 12px; line-height: 1.55; text-align: center; }
.cx-learning-empty strong,.cx-learning-empty span { display: block; }
.cx-learning-empty strong { color: var(--cx-text); font-size: 14px; }
.cx-learning-empty button { min-height: 36px; margin-top: 4px; padding: 0 14px; border-radius: 11px; background: var(--cx-mint); color: var(--cx-green-deep); font-size: 11px; font-weight: 700; }

/* Confirmation and no-scan dialogs mirror wx.showModal without leaving the page. */
.cx-learning-dialog-backdrop { position: absolute; z-index: 20; inset: 0; display: grid; place-items: center; padding: 22px; background: rgba(14, 33, 28, .42); backdrop-filter: blur(3px); }
.cx-learning-dialog-backdrop[hidden] { display: none !important; }
.cx-learning-dialog { width: min(100%, 310px); overflow: hidden; border-radius: 18px; background: #fff; box-shadow: 0 22px 60px rgba(8, 35, 27, .24); text-align: center; }
.cx-learning-dialog h3 { margin: 0; padding: 23px 22px 0; color: #182f29; font-size: 17px; font-weight: 650; }
.cx-learning-dialog p { margin: 10px 0 0; padding: 0 22px 22px; color: #637873; font-size: 13px; line-height: 1.6; }
.cx-learning-dialog footer { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border-top: 1px solid #e5ece9; }
.cx-learning-dialog.is-alert footer { grid-template-columns: 1fr; }
.cx-learning-dialog footer button { min-height: 49px; border-right: 1px solid #e5ece9; color: #536b64; font-size: 14px; }
.cx-learning-dialog footer button:last-child { border: 0; }
.cx-learning-dialog footer .is-primary { color: var(--cx-green-deep); font-weight: 650; }

/* Browser equivalent of wx.previewImage. */
.cx-learning-scan-preview { position: absolute; z-index: 15; inset: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); background: #08100e; color: #fff; }
.cx-learning-scan-preview[hidden] { display: none !important; }
.cx-learning-scan-preview > header { display: grid; min-height: calc(48px + env(safe-area-inset-top)); grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: end; padding: env(safe-area-inset-top) 6px 6px; background: rgba(4, 12, 10, .9); }
.cx-learning-scan-preview > header button { display: grid; width: 36px; height: 36px; place-items: center; align-self: center; color: #fff; font-size: 27px; }
.cx-learning-scan-preview > header strong { align-self: center; font-size: 16px; font-weight: 500; text-align: center; }
.cx-learning-scan-preview > div { display: grid; min-height: 0; place-items: center; overflow: auto; padding: 12px; }
.cx-learning-scan-preview img { max-width: 100%; max-height: 100%; background: #fff; object-fit: contain; }

@media (max-width: 350px) {
  .cx-favorite-tabs button { gap: 2px; padding: 0 3px; font-size: 11.5px; }
  .cx-favorite-tabs small { min-width: 16px; height: 16px; padding: 0 3px; line-height: 16px; }
}
