:root {
  --bg: #edf0fc;
  --app-bg: #edf0fc;
  --surface: rgba(255,255,255,.6);
  --surface-2: rgba(255,255,255,.45);
  --text: #131a30;
  --text-2: rgba(28,38,72,.62);
  --line: rgba(120,130,190,.20);
  --tg: #6366f1;
  --tg-dark: #a855f7;
  --accent: #f59e0b;
  --green: #10b981;
  --green-bg: rgba(16,185,129,.14);
  --orange: #f59e0b;
  --orange-bg: rgba(245,158,11,.15);
  --red: #f43f5e;
  --red-bg: rgba(244,63,94,.12);
  --tab-bg: rgba(255,255,255,.62);
  --shadow: 0 22px 44px rgba(80,90,160,.20);
}
      @media (prefers-color-scheme: dark) {
:root {
          --bg: #060a1c;
          --app-bg: #060a1c;
          --surface: rgba(255,255,255,.075);
          --surface-2: rgba(255,255,255,.05);
          --text: #f4f6ff;
          --text-2: rgba(226,233,255,.66);
          --line: rgba(255,255,255,.14);
          --tg: #818cf8;
          --tg-dark: #a78bfa;
          --green-bg: rgba(52,211,153,.14);
          --orange-bg: rgba(251,191,36,.14);
          --red-bg: rgba(251,113,133,.14);
          --tab-bg: rgba(16,20,44,.55);
          --shadow: 0 22px 44px rgba(2,5,20,.5);
        }
}
      * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
      html, body { height: 100%; }
      body {
        margin: 0;
        background: var(--bg);
        font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
        color: var(--text);
      }

      /* ---------- Khung điện thoại ---------- */
      .phone {
        max-width: 430px;
        margin: 0 auto;
        min-height: 100dvh;
        background: var(--app-bg);
        display: flex;
        flex-direction: column;
        position: relative;
        box-shadow: var(--shadow);
      }
      @media (min-width: 520px) {
        body { padding: 18px 0; }
        .phone { border-radius: 28px; min-height: calc(100dvh - 36px); overflow: hidden; }
      }

      /* ---------- Thanh trạng thái kiểu Telegram ---------- */
      .tgbar {
        display: flex; align-items: center; gap: 10px;
        padding: 12px 16px 10px;
        background: var(--surface);
        border-bottom: 1px solid var(--line);
        position: sticky; top: 0; z-index: 20;
      }
      .tgbar .chev { color: var(--tg); font-size: 20px; line-height: 1; }
      .tgbar .bot-ava {
        width: 36px; height: 36px; border-radius: 50%;
        background: linear-gradient(135deg, #37aee2, #1e96c8);
        display: grid; place-items: center; color: #fff; flex: none;
      }
      .tgbar .bot-ava svg { width: 20px; height: 20px; }
      .tgbar h1 { font-size: 16px; margin: 0; font-weight: 700; letter-spacing: -0.01em; }
      .tgbar p { margin: 1px 0 0; font-size: 12.5px; color: var(--text-2); }
      .tgbar .dots { margin-left: auto; color: var(--text-2); font-size: 20px; letter-spacing: 1px; }

      main { flex: 1; padding: 16px 16px 96px; }

      .screen { display: none; }
      .screen.active { display: block; animation: screenIn 1s cubic-bezier(.22,.9,.28,1); }
      @keyframes screenIn {
        from { opacity: 0; transform: translateY(14px) scale(.985); }
        to { opacity: 1; transform: none; }
      }
      @media (prefers-reduced-motion: reduce) { .screen.active { animation: none; } }

      /* ---------- Mượt mà chung ---------- */
      .btn, .tab, .card, .lesson-row, .day {
        transition: transform .14s ease, box-shadow .14s ease, background-color .14s ease, opacity .14s ease;
      }
      .btn:active { transform: scale(.965); }
      .tab:active { transform: scale(.92); }
      .lesson-row:active { transform: scale(.985); }
      .card { animation: cardIn .3s ease backwards; }
      @keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
      @media (prefers-reduced-motion: reduce) {
        .btn, .tab, .card, .lesson-row, .day { transition: none; }
        .btn:active, .tab:active, .lesson-row:active { transform: none; }
        .card { animation: none; }
      }

      /* ---------- Thẻ số dư ---------- */
      .balance-card {
        background: linear-gradient(135deg, #2aabee 0%, #1e7fb8 100%);
        border-radius: 20px; color: #fff; padding: 20px;
        position: relative; overflow: hidden;
      }
      .balance-card::after {
        content: ""; position: absolute; right: -34px; top: -34px;
        width: 130px; height: 130px; border-radius: 50%;
        background: rgba(255,255,255,0.14);
      }
      .balance-card .lbl { font-size: 13px; opacity: .85; }
      .balance-card .amount { font-size: 44px; font-weight: 800; margin: 2px 0; letter-spacing: -0.02em; line-height: 1.1; }
      input.bank-upper { text-transform: uppercase; }
      input.bank-upper:disabled { opacity: .75; }
      .balance-card .amount .cur, .rc-amount small.cur {
        font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
        font-size: 15px; font-weight: 700; color: #f59e0b; letter-spacing: .04em;
      }
      .balance-card .amount { animation: balanceGlow 2.4s ease-in-out infinite; }
      @keyframes balanceGlow {
        0%, 100% { text-shadow: 0 0 18px rgba(165,180,252,.8); }
        50% { text-shadow: 0 0 44px rgba(165,180,252,1), 0 0 80px rgba(99,102,241,.7); }
      }
      @media (prefers-reduced-motion: reduce) { .balance-card .amount { animation: none; } }
      .balance-card .sub { font-size: 13px; opacity: .9; }
      .balance-card .row { display: flex; gap: 10px; margin-top: 16px; position: relative; z-index: 1; }
      .balance-card .mini {
        flex: 1; background: rgba(255,255,255,0.16); border-radius: 12px; padding: 9px 12px;
      }
      .balance-card .mini b { display: block; font-size: 15px; }
      .balance-card .mini span { font-size: 11.5px; opacity: .85; }

      .hello { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
      .hello .ava {
        width: 42px; height: 42px; border-radius: 50%; flex: none;
        background: linear-gradient(135deg, #f6b73c, #ee8f2c);
        display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 17px;
      }
      .hello h2 { margin: 0; font-size: 17px; }
      .hello p { margin: 2px 0 0; font-size: 13px; color: var(--text-2); }
      .hello .lvl {
        margin-left: auto; font-size: 12px; font-weight: 700; color: var(--orange);
        background: var(--orange-bg); padding: 5px 10px; border-radius: 999px; white-space: nowrap;
      }

      /* ---------- Nút & thẻ chung ---------- */
      .card {
        background: var(--surface); border: 1px solid var(--line);
        border-radius: 16px; padding: 16px; margin-top: 14px;
      }
      .card h3 { margin: 0 0 4px; font-size: 15.5px; }
      .card .desc { margin: 0; font-size: 13px; color: var(--text-2); line-height: 1.5; }
      .sec-title { font-size: 16px; font-weight: 700; margin: 22px 2px 0; }
      .sec-title:first-child { margin-top: 2px; }

      .btn {
        appearance: none; border: 0; cursor: pointer;
        font: inherit; font-weight: 700; font-size: 14.5px;
        border-radius: 12px; padding: 12px 16px;
        background: var(--tg); color: #fff;
        transition: filter .15s, transform .1s;
      }
      .btn:active { transform: scale(0.98); }
      .btn:hover { filter: brightness(1.06); }
      .btn.block { width: 100%; }
      .btn.ghost { background: var(--surface-2); color: var(--tg-dark); }
      @media (prefers-color-scheme: dark) { .btn.ghost { color: var(--tg); } }
      .btn.gold { background: var(--accent); color: #3a2703; }
      .btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
      .btn.sm { padding: 8px 14px; font-size: 13px; border-radius: 10px; }

      .quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
      .quick {
        background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
        padding: 13px 4px 11px; text-align: center; cursor: pointer; font: inherit;
        color: var(--text);
      }
      .quick:active { transform: scale(0.97); }
      .quick .ic {
        width: 40px; height: 40px; margin: 0 auto 7px; border-radius: 12px;
        display: grid; place-items: center;
      }
      .quick .ic svg { width: 21px; height: 21px; }
      .quick span { font-size: 12px; font-weight: 600; display: block; line-height: 1.25; }
      .ic-blue { background: #e3f2fb; color: #1e8ac2; }
      .ic-orange { background: #fdeeda; color: #dd8a06; }
      .ic-green { background: #e0f4ec; color: #1f9d6c; }
      .ic-pink { background: #fde7ef; color: #d14d7e; }
      @media (prefers-color-scheme: dark) {
        .ic-blue { background: #17384d; } .ic-orange { background: #3d2f13; }
        .ic-green { background: #14342a; } .ic-pink { background: #3d2230; }
      }

      /* ---------- Điểm danh ---------- */
      .checkin-days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; margin-top: 12px; }
      .day {
        text-align: center; border-radius: 12px; padding: 8px 2px;
        background: var(--surface-2); font-size: 11px; color: var(--text-2);
      }
      .day b { display: block; font-size: 13px; color: var(--text); margin-top: 3px; }
      .day.done { background: var(--green-bg); color: var(--green); }
      .day.done b { color: var(--green); }
      .day.today { outline: 2px solid var(--tg); outline-offset: -2px; }

      /* ---------- Danh sách ---------- */
      .list { margin-top: 10px; display: flex; flex-direction: column; }
      .item {
        display: flex; gap: 12px; align-items: flex-start;
        padding: 13px 0; border-bottom: 1px solid var(--line);
      }
      .item:last-child { border-bottom: 0; padding-bottom: 2px; }
      .item .ic {
        width: 42px; height: 42px; border-radius: 12px; flex: none;
        display: grid; place-items: center; background: var(--surface-2);
      }
      .item .ic svg { width: 21px; height: 21px; }
      .item .body { flex: 1; min-width: 0; }
      .item .t { font-size: 14.5px; font-weight: 600; line-height: 1.35; }
      .item .s { font-size: 12.5px; color: var(--text-2); margin-top: 2px; line-height: 1.45; }
      .item .right { text-align: right; flex: none; }
      .amt { font-weight: 800; font-size: 14.5px; }
      .amt.plus { color: var(--green); }
      .amt.minus { color: var(--text); }

      .chip {
        display: inline-block; font-size: 11px; font-weight: 700;
        padding: 3px 9px; border-radius: 999px; margin-top: 4px; white-space: nowrap;
      }
      .chip.wait { background: var(--orange-bg); color: var(--orange); }
      .chip.ok { background: var(--green-bg); color: var(--green); }
      .chip.bad { background: var(--red-bg); color: var(--red); }
      .chip.info { background: #e3f2fb; color: #1e8ac2; }
      @media (prefers-color-scheme: dark) { .chip.info { background: #17384d; color: #5cc2f2; } }

      .progress { height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 8px; }
      .progress i { display: block; height: 100%; background: var(--tg); border-radius: 99px; transition: width .4s ease; }

      /* ---------- Form ---------- */
      label.flabel { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
      label.flabel:first-of-type { margin-top: 10px; }
      input[type="text"], input[type="number"], select, textarea {
        width: 100%; font: inherit; font-size: 14.5px; color: var(--text);
        background: var(--surface-2); border: 1.5px solid transparent;
        border-radius: 12px; padding: 12px 14px; outline: none;
      }
      input:focus, select:focus, textarea:focus { border-color: var(--tg); background: var(--surface); }
      .hint { font-size: 12.5px; color: var(--text-2); margin-top: 6px; line-height: 1.5; }

      .steps { display: flex; flex-direction: column; gap: 0; margin-top: 6px; }
      .step { display: flex; gap: 12px; padding: 9px 0; }
      .step .n {
        width: 26px; height: 26px; border-radius: 50%; flex: none;
        background: var(--tg); color: #fff; font-size: 13px; font-weight: 800;
        display: grid; place-items: center; margin-top: 1px;
      }
      .step p { margin: 0; font-size: 13.5px; line-height: 1.5; }
      .step p b { display: block; font-size: 14px; }

      .linkbox {
        display: flex; gap: 8px; align-items: center;
        background: var(--surface-2); border-radius: 12px; padding: 8px 8px 8px 14px; margin-top: 12px;
      }
      .linkbox code {
        flex: 1; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
        font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
      }
      .result-box {
        display: none; margin-top: 14px; border: 1.5px dashed var(--tg);
        border-radius: 14px; padding: 14px; background: rgba(34, 158, 217, 0.06);
      }
      .result-box.show { display: block; }
      .result-box .rb-t { font-size: 13px; font-weight: 700; color: var(--tg-dark); margin-bottom: 8px; }
      @media (prefers-color-scheme: dark) { .result-box .rb-t { color: var(--tg); } }

      .stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
      .stat {
        background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
        padding: 13px 10px; text-align: center;
      }
      .stat b { display: block; font-size: 19px; letter-spacing: -0.01em; }
      .stat span { font-size: 11.5px; color: var(--text-2); display: block; margin-top: 2px; line-height: 1.3; }

      .note {
        display: flex; gap: 10px; margin-top: 14px; padding: 13px 14px;
        background: var(--orange-bg); border-radius: 14px;
        font-size: 13px; line-height: 1.55; color: var(--text);
      }
      .note svg { width: 19px; height: 19px; flex: none; color: var(--orange); margin-top: 1px; }

      /* ---------- Thanh tab dưới ---------- */
      .tabbar {
        position: fixed; left: 50%; transform: translateX(-50%);
        width: calc(100% - 24px); max-width: 418px; z-index: 30;
        bottom: calc(10px + env(safe-area-inset-bottom));
        display: grid; grid-template-columns: repeat(6, 1fr);
        background: var(--tab-bg);
        -webkit-backdrop-filter: blur(28px) saturate(180%);
        backdrop-filter: blur(28px) saturate(180%);
        border: 1px solid var(--line);
        border-radius: 26px;
        padding: 7px 4px;
        box-shadow: 0 14px 34px rgba(0,0,0,.28);
      }
      .tab {
        background: none; border: 0; cursor: pointer; font: inherit;
        display: flex; flex-direction: column; align-items: center; gap: 2px;
        color: var(--text-2); font-size: 10px; font-weight: 600; padding: 5px 0 4px;
        position: relative; border-radius: 16px;
      }
      .tab svg { width: 20px; height: 20px; }
      .tab.active { color: var(--tg); }
      .tab.active::after {
        content: ""; position: absolute; bottom: 1px; left: 50%;
        width: 4px; height: 4px; border-radius: 99px;
        background: var(--tg); transform: translateX(-50%);
      }
      .tab .badge {
        position: absolute; top: 1px; right: calc(50% - 20px);
        background: var(--red); color: #fff; font-size: 10px; font-weight: 800;
        min-width: 17px; height: 17px; border-radius: 99px; display: grid; place-items: center; padding: 0 4px;
      }

      /* ---------- Modal quảng cáo ---------- */
      .overlay {
        position: fixed; inset: 0; z-index: 60; display: none;
        background: rgba(8, 14, 20, 0.62); align-items: center; justify-content: center; padding: 20px;
      }
      .overlay.show { display: flex; }
      .modal {
        width: 100%; max-width: 380px; background: var(--surface); border-radius: 20px;
        padding: 20px; color: var(--text); box-shadow: var(--shadow);
      }
      .modal h3 { margin: 0 0 6px; font-size: 17px; }
      .modal .desc { font-size: 13.5px; color: var(--text-2); line-height: 1.55; margin: 0; }
      .ad-creative {
        margin: 16px 0; border-radius: 14px; overflow: hidden; position: relative;
        background: linear-gradient(120deg, #ff7a45, #f53d54 60%, #a8328f);
        color: #fff; padding: 22px 18px; min-height: 150px;
        display: flex; flex-direction: column; justify-content: flex-end;
      }
      .ad-creative .ad-tag {
        position: absolute; top: 10px; left: 10px; font-size: 10.5px; font-weight: 800;
        background: rgba(0,0,0,0.35); padding: 3px 8px; border-radius: 6px; letter-spacing: .04em;
      }
      .ad-creative .ad-count {
        position: absolute; top: 10px; right: 10px; font-size: 12px; font-weight: 700;
        background: rgba(0,0,0,0.35); padding: 3px 9px; border-radius: 99px; min-width: 34px; text-align: center;
      }
      .ad-creative b { font-size: 20px; line-height: 1.25; }
      .ad-creative p { margin: 5px 0 0; font-size: 13px; opacity: .92; }
      .ad-progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
      .ad-progress i { display: block; height: 100%; width: 0%; background: var(--accent); transition: width .2s linear; }

      /* ---------- Toast ---------- */
      .toast {
        position: fixed; left: 50%; bottom: 104px; transform: translate(-50%, 16px);
        background: #17212b; color: #fff; font-size: 13.5px; font-weight: 600;
        padding: 11px 18px; border-radius: 12px; z-index: 80; opacity: 0; pointer-events: none;
        transition: opacity .22s, transform .22s; max-width: calc(100vw - 40px); text-align: center;
        box-shadow: var(--shadow);
      }
      .toast.show { opacity: 1; transform: translate(-50%, 0); }


      .empty-note { text-align: center; color: var(--text-2); font-size: 13px; padding: 14px 0 4px; }
      .seg { display: flex; background: var(--surface-2); border-radius: 12px; padding: 4px; gap: 4px; margin-top: 12px; }
      .seg button {
        flex: 1; border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 700;
        padding: 8px 4px; border-radius: 9px; cursor: pointer; color: var(--text-2);
      }
      .seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 5px rgba(0,0,0,.12); }

/* ===== CSS block ===== */

/* ===== Aurora glass recolor (giống Demo 1) — giữ nguyên bố cục ===== */
html[data-theme="light"] {
  --bg: #edf0fc;
  --app-bg: #edf0fc;
  --surface: rgba(255,255,255,.6);
  --surface-2: rgba(255,255,255,.45);
  --text: #131a30;
  --text-2: rgba(28,38,72,.62);
  --line: rgba(120,130,190,.20);
  --tg: #6366f1;
  --tg-dark: #a855f7;
  --accent: #f59e0b;
  --green: #10b981;
  --green-bg: rgba(16,185,129,.14);
  --orange: #f59e0b;
  --orange-bg: rgba(245,158,11,.15);
  --red: #f43f5e;
  --red-bg: rgba(244,63,94,.12);
  --tab-bg: rgba(255,255,255,.62);
  --shadow: 0 22px 44px rgba(80,90,160,.20);
}
html[data-theme="dark"] {
  --bg: #060a1c;
  --app-bg: #060a1c;
  --surface: rgba(255,255,255,.075);
  --surface-2: rgba(255,255,255,.05);
  --text: #f4f6ff;
  --text-2: rgba(226,233,255,.66);
  --line: rgba(255,255,255,.14);
  --tg: #818cf8;
  --tg-dark: #a78bfa;
  --accent: #fbbf24;
  --green: #34d399;
  --green-bg: rgba(52,211,153,.14);
  --orange: #fbbf24;
  --orange-bg: rgba(251,191,36,.14);
  --red: #fb7185;
  --red-bg: rgba(251,113,133,.14);
  --tab-bg: rgba(16,20,44,.55);
  --shadow: 0 22px 44px rgba(2,5,20,.5);
}
body{ background:var(--bg); }
body::before{
  content:''; position:fixed; inset:0; z-index:-1; pointer-events:none;
  background:
    radial-gradient(120% 90% at 85% -10%, rgba(6,182,212,.20), transparent 55%),
    radial-gradient(110% 80% at -10% 0%, rgba(124,58,237,.26), transparent 55%),
    radial-gradient(90% 70% at 50% 110%, rgba(99,102,241,.14), transparent 60%),
    var(--bg);
}
html[data-theme="light"] body::before, body::before{ }
.phone{ background:transparent !important; box-shadow:none !important; }
.card{
  background:var(--surface) !important;
  -webkit-backdrop-filter:blur(20px) saturate(160%); backdrop-filter:blur(20px) saturate(160%);
  border:1px solid var(--line) !important; box-shadow:var(--shadow);
}
.tgbar{
  background:var(--tab-bg) !important;
  -webkit-backdrop-filter:blur(28px) saturate(170%); backdrop-filter:blur(28px) saturate(170%);
  border-bottom:1px solid var(--line) !important;
}
.btn{
  background:linear-gradient(135deg,#6366f1 0%,#a855f7 55%,#06b6d4 130%) !important;
  box-shadow:0 10px 24px rgba(99,102,241,.35);
}
.btn.gold{
  background:linear-gradient(135deg,#f59e0b,#f43f5e) !important; color:#fff !important;
  box-shadow:0 10px 24px rgba(245,158,11,.35);
}
.balance-card{
  background:linear-gradient(160deg, rgba(99,102,241,.38), rgba(6,182,212,.24)), var(--surface) !important;
  -webkit-backdrop-filter:blur(24px) saturate(170%); backdrop-filter:blur(24px) saturate(170%);
  border:1px solid var(--line) !important; box-shadow:var(--shadow);
}
#themeToggle{
  margin-left:auto; flex:none;
  width:40px; height:40px; border-radius:50%; cursor:pointer;
  border:1px solid var(--line); background:var(--surface); color:var(--text); font-size:18px;
  display:grid; place-items:center; box-shadow:var(--shadow);
}

/* ===== CSS block ===== */

/* ===== Fix: nen the so du + pill tien do ===== */
.balance-card{
  background:
    radial-gradient(130% 150% at 100% -10%, rgba(34,211,238,.45), transparent 55%),
    radial-gradient(130% 150% at -10% 110%, rgba(168,85,247,.50), transparent 55%),
    linear-gradient(150deg, #4c1d95 0%, #6d28d9 45%, #0e7490 135%) !important;
  -webkit-backdrop-filter:blur(24px) saturate(170%); backdrop-filter:blur(24px) saturate(170%);
  border:1px solid rgba(255,255,255,.22) !important;
  box-shadow:0 24px 48px rgba(76,29,149,.45), inset 0 1px 0 rgba(255,255,255,.25) !important;
  color:#fff;
}
.balance-card::before{
  content:""; position:absolute; left:-44px; bottom:-56px; width:160px; height:160px; border-radius:50%;
  background:radial-gradient(circle, rgba(34,211,238,.38), transparent 70%);
  pointer-events:none;
}
.balance-card::after{
  background:rgba(255,255,255,.16) !important;
  box-shadow:0 0 70px rgba(34,211,238,.35);
}
.prog-pill{
  display:inline-block; padding:8px 14px; font-size:13px; font-weight:800; border-radius:10px;
  white-space:nowrap; color:var(--text);
  background:rgba(99,102,241,.14); border:1px solid rgba(99,102,241,.38);
}
.prog-pill.done{ color:var(--green); background:var(--green-bg); border-color:transparent; }

/* Ẩn banner trạng thái kết nối do JS tự tạo */
#rewardxConnectionStatus { display: none !important; }

      /* ---------- Bạn bè đã mời (gọn + phân trang) ---------- */
      #refFriendList .item.ref { padding: 9px 0; gap: 10px; align-items: center; }
      #refFriendList .ref-ava { width: 34px; height: 34px; border-radius: 10px; font-size: 14px; }
      #refFriendList .item.ref .t {
        font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
      }
      #refFriendList .item.ref .u { font-weight: 400; font-size: 11.5px; color: var(--text-2); }
      #refFriendList .item.ref .s { font-size: 11px; margin-top: 1px; }
      #refFriendList .chip.sm { font-size: 10px; padding: 2px 8px; margin-top: 0; }
      .pager { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 12px 0 4px; }
      .pager .pg-info { font-size: 12px; color: var(--text-2); }
      .pager .btn.sm[disabled] { opacity: .4; }

      /* ---------- Hoạt động gần đây / Lịch sử (gọn, tối đa 10 dòng) ---------- */
      #recentList .item, #historyList .item { padding: 9px 0; gap: 10px; align-items: center; }
      #recentList .item .ic, #historyList .item .ic { width: 34px; height: 34px; border-radius: 10px; }
      #recentList .item .ic svg, #historyList .item .ic svg { width: 17px; height: 17px; }
      #recentList .item .t, #historyList .item .t {
        font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
      }
      #recentList .item .s, #historyList .item .s {
        font-size: 11px; margin-top: 1px;
        white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
      }
      #recentList .amt, #historyList .amt { font-size: 13.5px; }
      #recentList .chip.sm, #historyList .chip.sm { font-size: 10px; padding: 2px 8px; margin-top: 2px; }

      /* Thư ngỏ */
      .letter-body { max-height: 52vh; overflow-y: auto; font-size: 13.5px; line-height: 1.65; color: var(--text-2); margin: 10px 0 16px; padding-right: 4px; }
      .letter-body h4 { color: var(--text); font-size: 14px; margin: 14px 0 6px; }
      .letter-body b { color: var(--text); }
      .letter-body p { margin: 0 0 8px; }

      /* Thư ngỏ: nền đặc để đọc rõ chữ */
      #letterOverlay .modal { background: #ffffff; }
      @media (prefers-color-scheme: dark) {
        #letterOverlay .modal { background: #151b31; }
      }
      html[data-theme="dark"] #letterOverlay .modal { background: #151b31; }
      html[data-theme="light"] #letterOverlay .modal { background: #ffffff; }


      /* ===== Tab Bài học: hệ sinh thái RC ===== */
      .rc-card {
        background: linear-gradient(135deg, rgba(245,158,11,.16), rgba(245,158,11,.06));
        border: 1px solid rgba(245,158,11,.35);
      }
      .rc-amount { font-size: 34px; font-weight: 800; color: #f59e0b; line-height: 1.15; }
      .rc-amount small { font-size: 15px; font-weight: 600; color: var(--text-2); }
      .btn.rc-btn { background: #f59e0b; color: #3a2703; font-weight: 700; margin-top: 10px; }
      .btn.rc-btn:hover { filter: brightness(1.06); }
      .search-box { margin: 12px 2px; }
      .search-box input {
        width: 100%; padding: 11px 14px; border-radius: 14px;
        border: 1px solid var(--line); background: var(--surface);
        color: var(--text); font-size: 14px; font-family: inherit;
        outline: none; box-sizing: border-box;
      }
      .search-box input:focus { border-color: #f59e0b; }
      .lesson-row {
        width: 100%; display: flex; align-items: center; gap: 12px;
        text-align: left; font-family: inherit; cursor: pointer;
        background: var(--surface); border: 1px solid var(--line);
        border-radius: 16px; padding: 12px 14px; margin: 0 0 10px;
        color: var(--text); transition: transform .12s ease;
      }
      .lesson-row:active { transform: scale(.985); }
      .lesson-num {
        flex: none; width: 38px; height: 38px; border-radius: 12px;
        display: flex; align-items: center; justify-content: center;
        font-weight: 800; font-size: 16px;
        background: rgba(120,130,180,.18); color: var(--text-2);
      }
      .lesson-row.unlocked .lesson-num { background: rgba(245,158,11,.18); color: #f59e0b; }
      .lesson-info { flex: 1; min-width: 0; }
      .lesson-info b { display: block; font-size: 14px; line-height: 1.35; }
      .lesson-info small { display: block; font-size: 12px; color: var(--text-2); margin-top: 3px; }
      .lesson-row.unlocked .lesson-info small { color: #34d399; }
      .lesson-act { flex: none; font-size: 14px; font-weight: 700; }
      .lesson-act.play { color: #34d399; font-size: 20px; }
      .lesson-act.cost {
        color: #f59e0b; background: rgba(245,158,11,.12);
        border: 1px solid rgba(245,158,11,.4);
        padding: 7px 12px; border-radius: 12px; font-size: 13px; white-space: nowrap;
      }
      .empty { text-align: center; color: var(--text-2); padding: 24px 12px; font-size: 14px; }

      /* Bài học: bài tương lai (chưa tới lượt mở) */
      .lesson-row.future { opacity: .55; cursor: default; }
      .lesson-row.future:active { transform: none; }
      .lesson-act.lock { color: var(--text-2); font-size: 18px; }
      .lesson-row.next { border-color: rgba(245,158,11,.45); }

      /* RC card gọn */
      .rc-card.compact { padding: 12px 14px; }
      .rc-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
      .rc-card.compact .rc-amount { font-size: 26px; }
      .rc-card.compact .btn.rc-btn { margin-top: 0; padding: 10px 18px; font-size: 14px; white-space: nowrap; }

      /* RC card 1 dòng: số dư trái, nút phải */
      .rc-row { gap: 10px; }
      .rc-balance-inline { display: flex; align-items: baseline; gap: 8px; white-space: nowrap; flex-shrink: 1; min-width: 0; }
      .rc-balance-inline .lbl { font-size: 13px; white-space: nowrap; flex-shrink: 0; }
      .rc-card.compact .rc-balance-inline .rc-amount { font-size: 28px; white-space: nowrap; }
      .rc-card.compact .rc-balance-inline .rc-amount small { font-size: 15px; }
      .rc-amount {
        color: #fbbf24;
        animation: rcGlow 2.4s ease-in-out infinite;
      }
      @keyframes rcGlow {
        0%, 100% { text-shadow: 0 0 12px rgba(251,191,36,.7); }
        50% { text-shadow: 0 0 32px rgba(251,191,36,1), 0 0 60px rgba(251,191,36,.5); }
      }
      @media (prefers-reduced-motion: reduce) { .rc-amount { animation: none; } }
      .rc-card.compact .btn.rc-btn { flex-shrink: 0; }

      /* Tab Bài học: thẻ Học tiếp + accordion chương */
      .continue-card {
        background: linear-gradient(135deg, rgba(56,189,248,.14), rgba(56,189,248,.05));
        border: 1px solid rgba(56,189,248,.35);
        border-radius: 20px;
        padding: 14px 16px;
        margin: 12px 0;
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
      }
      .continue-top { font-size: 12px; font-weight: 800; letter-spacing: .08em; color: #38bdf8; margin-bottom: 6px; }
      .continue-main { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
      .continue-main b { font-size: 16px; color: var(--text); }
      .btn.continue-btn {
        background: #38bdf8; color: #082434; border: none; border-radius: 13px;
        padding: 10px 16px; font-size: 14px; font-weight: 800; white-space: nowrap; cursor: pointer;
      }
      .section { margin: 10px 0; }
      .section-head {
        width: 100%; display: flex; align-items: center; justify-content: space-between;
        background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
        border-radius: 16px; padding: 14px 16px; cursor: pointer;
        font-size: 16px; font-weight: 800; color: var(--text);
      }
      .section-head:active { transform: scale(.99); }
      .section-chev { color: var(--text-2); font-size: 13px; }
      .section-body { padding: 8px 4px 0; display: flex; flex-direction: column; gap: 8px; }
      .section-body .lesson-row { margin: 0; }

      /* Card quảng cáo tab Nhiệm vụ: tự đổi theo theme sáng/tối */
      .card.ad-card {
        background: linear-gradient(135deg, rgba(245,158,11,.16), rgba(244,63,94,.07)) !important;
        border-color: rgba(245,158,11,.45) !important;
      }
      html[data-theme="dark"] .card.ad-card {
        background: linear-gradient(135deg, #3a2c12, #241a08) !important;
        border-color: #4a3a17 !important;
        color: #fff;
      }
      html[data-theme="dark"] .card.ad-card h3 { color: #fff; }
      html[data-theme="dark"] .card.ad-card .desc { color: rgba(255,255,255,.78); }
      html[data-theme="dark"] .card.ad-card .hint { color: rgba(255,255,255,.6); }
      html[data-theme="dark"] .card.ad-card .progress { background: rgba(255,255,255,.18); }
      .btn.gold { font-weight: 800; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
